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
listen for tab changes to trigger formdetection (no reload needed)
function handleActivated(activeInfo) { // console.log("Tab " + activeInfo.tabId +" was activated"); // sendMessageToContentScript("task_detect"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleUpdated(tabId, changeInfo, tabInfo) {\n //Request Running rules details from background script\n browser.runtime.sendMessage({event: \"Running-rules\"});\n}", "function on_tab_updated(id, change_info, tab)\n {\n if (tab.active && change_info.url) { update_in_tab(tab); }\n }", "function bindUIRectifiersOnTabChange() {\n\n // create an observer instance\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(mutation) {\n\n // find the div containing all the form elements\n if (mutation.addedNodes)\n for (var i = 0; i < mutation.addedNodes.length; i++) {\n if ($(mutation.addedNodes[i]).hasClass(\"settings-content-inner\")) {\n\n wunderlistListeners.rectifyUIifNeeded($(mutation.addedNodes[i]))\n }\n }\n });\n });\n\n // configure the observer\n var target = document.querySelector('#modals');\n var config = {\n childList: true,\n subtree: true\n };\n\n observer.observe(target, config);\n }", "formChanged() {}", "registeredTabs() {\n this.updateTabs()\n }", "function onTabUpdated() {\n info(\"event: Chrome says that tab was updated\");\n\n // Restrict to non-single-post Google+ pages\n if (!isEnabledOnThisPage())\n return;\n\n // If list mode, make sure the correct last opened entry is unfolded, now\n // that we know that window.location.href is correct\n if (displayMode == 'list')\n unfoldLastOpenInListMode();\n\n // If switching between Streams to Games, we need to inject the content pane buttons.\n // At this time, one of the content panes will be hidden -- we need to pick out the correct\n // subtree\n var $contentPaneDiv = $(_ID_CONTENT_PANE + ' > :not([style*=\"none\"])');\n updateContentPaneButtons($contentPaneDiv);\n}", "_handleActiveTabs() {\n this.dispatchEvent(\n new CustomEvent(\"active-tabs-changed\", {\n bubbles: true,\n cancelable: true,\n composed: false,\n detail: this,\n })\n );\n }", "onTabChange(evt) {\n const win = evt.target.ownerGlobal;\n const currentURI = win.gBrowser.currentURI;\n // Don't show the page action if page is not http or https\n if (currentURI.scheme !== \"http\" && currentURI.scheme !== \"https\") {\n this.hidePageAction(win.document);\n return;\n }\n\n const currentWin = Services.wm.getMostRecentWindow(\"navigator:browser\");\n\n // If user changes tabs but stays within current window we want to update\n // the status of the pageAction, then reshow it if the new page has had any\n // resources blocked.\n if (win === currentWin) {\n this.hidePageAction(win.document);\n // depending on the treatment branch, we want the count of timeSaved\n // (\"fast\") or blockedResources (\"private\")\n const counter = this.treatment === \"private\" ?\n this.state.blockedResources.get(win.gBrowser.selectedBrowser) :\n this.state.timeSaved.get(win.gBrowser.selectedBrowser);\n if (counter) {\n this.showPageAction(win.document, counter);\n this.setPageActionCounter(win.document, counter);\n }\n }\n }", "function onBeforeRequestListener(details) {\n // *** Remember that tabId can be set to -1 ***\n var tab = tabs[details.tabId];\n\n // Respond to tab information\n}", "function afterTabChange(tabPanel, currentTabName){\n\n\tvar currentTab = tabPanel.findTab(currentTabName);\n\tvar controller = abCompViolationController;\n\n\t//when content of tab is loaded\n\tif(currentTab.isContentLoaded){\t\n\n\t\t//if currently select first tab\n\t\tif(currentTabName==controller.selectTabName){\n\t\t\t //if sign needRefreshSelectList is true\n\t\t\tif(controller.needRefreshSelectList){\n\t\t\t\t //refresh the select list in first tab\n\t\t\t\tvar selectControl = currentTab.getContentFrame().View.controllers.get(controller.tabCtrl[currentTabName] );\n\t\t\t\tif(selectControl){\n\t\t\t\t\tselectControl.refreshGrid();\n\t\t\t\t\tcontroller.needRefreshSelectList = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function switchTab(selectedTab) {\r\n\r\n\ttabNames = new Array (\"pageLayoutTab\", \"resultAppearanceTab\", \"imageUploadTab\");\r\n\tfor (i=0; i<3; i++) {\r\n\t\tif (i == selectedTab) {\r\n\t\t\tdocument.getElementById(tabNames[i]).style.display = \"block\";\r\n\t\t} else {\r\n\t\t\tdocument.getElementById(tabNames[i]).style.display = \"none\";\r\n\t\t}\r\n\t}\r\n\r\n\ttop.selectedSubMenuTab = tabNames[selectedTab];\r\n\t\r\n\t// Check if there were changes in the form\r\n\tif (tabNames[selectedTab] == \"imageUploadTab\") {\r\n\t\r\n\t\tsubmitCustomUiForm(\"imageUploadTab\", \"\", true);\r\n\t\r\n\t\tif (mainFormContentChanged == true) {\r\n\t\t\tsubmitCustomUiForm(\"imageUploadTab\", \"savePreview\");\r\n\t\t}\r\n\t}\r\n}", "function listenForClicks() {\n document.addEventListener(\"click\", (e) => {\n /**\n * Fills the form using the values from the storage\n */\n function fillForm(tabs) {\n const gettingItem = browser.storage.local.get(BOOKING_MODEL_KEYS);\n gettingItem.then((res) => {\n browser.tabs.sendMessage(tabs[0].id, {\n command: \"fillForm\",\n bookingDetails: res\n }).catch(err => reportError(err));\n });\n }\n\n /**\n * Open the options page for this add-on to configure the form values\n */\n function openOptionsPage() {\n browser.runtime.openOptionsPage().catch(err => reportError(err))\n }\n\n /**\n * Just log the error to the console.\n */\n function reportError(error) {\n console.error(error);\n }\n\n /**\n * Get the active tab,\n * then call \"fillForm()\" or \"openOptionsPage()\" as appropriate.\n */\n if (e.target[\"id\"] === \"fill-form-button\") {\n browser.tabs.query({active: true, currentWindow: true})\n .then(fillForm)\n .catch(reportError);\n } else if (e.target[\"id\"] === \"options-link\") {\n openOptionsPage();\n }\n });\n}", "function formInit(event,ui)\n{\n switch (ui.tab.attr(\"id\")){\n case \"searchFormTax\":\n taxFormInit();\n break;\n case \"searchFormLit\":\n litFormInit();\n break;\n case \"searchFormLoc\":\n locFormInit();\n break;\n } // switch\n}", "function changeTab(e){\n let targetTab = e.target.id;\n loadTab(targetTab);\n}", "function OnRegTypeChanged(sender) {\n ConfigureTabs();\n }", "function onUpdatedListener(tabId, changeInfo, tab) {\n tabs[tab.id] = tab;\n}", "function onUpdatedListener(tabId, changeInfo, tab) {\n tabs[tab.id] = tab;\n}", "function onUpdatedListener(tabId, changeInfo, tab) {\n tabs[tab.id] = tab;\n}", "async function gotCurrentTab(tabs) {\n let tab = tabs[0];\n let tabLoadSuccess = new CustomEvent(\"tabLoadSuccess\", {\n detail: {\n url: tab.url,\n title: tab.title,\n favicon: tab.favIconUrl\n }\n })\n APP_TOKEN = await browser.storage.sync.get(\"app_token\").then(saveAppToken)\n USER_KEY = await browser.storage.sync.get(\"user_key\").then(saveUserKey)\n URL = truncateUrl(tab.url),\n URL_FULL = tab.url,\n TITLE = tab.title,\n FAVICON = tab.favIconUrl\n\n let validation = await validatePushoverSettings().then()\n if (validation.status === 1) {\n console.log(validation)\n DEVICES = validation.devices\n document.dispatchEvent(tabLoadSuccess)\n } else {\n validationFailed();\n console.log('Validation Failed: '+validation.errors[0])\n }\n \n}", "function updatedListener(tabId, changeInfo, tab) {\n thePageClock.filteredUpdate();\n}", "function listenToEvents() {\n // only one tab list is allowed per page\n $('.tab-list').on('click', '.tab-control', function () {\n //var tab_id = $(this).attr('data-tab');\n var tab_id = $(this).data('tab');\n\n $('.tab-control').removeClass('active');\n $('.tab-panel').removeClass('active');\n\n $(this).addClass('active');\n $(\"#\" + tab_id).addClass('active');\n\n // Save active tab per category\n saveInSession('activetab', '', tab_id);\n })\n }", "function handleTabChange(activeRef){\n var locationName = \"\";\n\n if(activeRef == \"#tabOne\"){\n locationName = $(\"#tab-one\").val(); //e.g. \"family1\"\n }else if(activeRef == \"#tabTwo\"){\n locationName = $(\"#tab-two\").val();\n }else if(activeRef == \"#tabThree\"){\n locationName = $(\"#tab-three\").val();\n }else if(activeRef == \"#tabFour\"){\n locationName = $(\"#tab-four\").val();\n }else if(activeRef == \"#tabFive\"){\n locationName = $(\"#tab-five\").val();\n }\n\n //set tab background\n var url = window.common.getLocationByName(locationName).background;\n $(\"#tab-background\").css(\"background-image\", \"url(\"+url+\")\");\n\n //update jsPlumb connections\n refreshConnectionView(locationName);\n}", "function onTabUpdate(tabId, changeInfo, tab) {\n var url = tab.url;\n\n var url_protocol_stripped = /^http[s]?:\\/\\/(.*)/g.exec(url);\n\n if (url_protocol_stripped != null && url_protocol_stripped.length >= 2) {\n var match_url = url_protocol_stripped[[1]].split(\"/\");\n doRedirectIfSaved(tabId, match_url);\n }\n}", "function _tab_changed(tab, closing){\n //determine the type of tab change (load, reload, hash_change, close)\n //NOTE - if closing==true, then tab is just tab.id NOT the whole tab object\n let tab_id = closing ? tab : tab.id,\n change_type = 'load';\n\n if(closing){\n\n change_type = 'close';\n delete _tab_state[tab_id];\n\n }else if(!closing && !(tab_id in _tab_state)){\n\n change_type = 'load';\n\n }else if(tab_id in _tab_state){\n\n if(tab.url ===_tab_state[tab_id]){\n change_type = 'reload';\n }else{\n let orig_url_parts = _tab_state[tab_id].split(\"#\"),\n new_url_parts = tab.url.split(\"#\");\n if(orig_url_parts[0] === new_url_parts[0]){\n //same base url\n if(orig_url_parts.length !== new_url_parts.length || orig_url_parts[1] !== new_url_parts[1]){\n change_type = 'hash_change';\n }\n }\n }\n }\n\n _tab_change_callbacks.forEach( cb => {\n let types = cb[1];\n if(!types || types.indexOf(change_type) !== -1){\n cb[0](tab, change_type);\n }\n });\n\n if(!closing){\n _execute_content_script_matching_loads_on_tab( tab );\n }\n }", "async function on_tab_activated(info)\n {\n update_in_tab(await browser.tabs.get(info.tabId));\n }", "function tabChangeEvent(tabpanel, tab) { \r\n\ttab.doLayout();\r\n\ttab.syncSize();\r\n\t// WS-1805: find the add contacts tab and hide the result list\r\n\tvar tabTitle = getLocalizationValue('application.javascript.contactList.searchTabTitle');\r\n\tvar searchTab = findTab(tabTitle);\r\n\tif (searchTab != null) {\r\n\t\tsearchTab.getComponent(0).collapse();\r\n\t}\r\n\t\r\n}", "function loadOnUpdated(tab, change) {\n if (change.status === 'complete') {\n delete executed[tab];\n executeScripts(tab);\n }\n}", "onTabChange_() {\n this.updateTree_();\n this.onEditComplete_();\n Controller.closeExprWindow_();\n }", "function appLoad(){\n console.log('*App Loaded*')\n watchForm();\n}", "function tab() {\n let triggerTabList = [].slice.call(document.querySelectorAll('#nav-myProfile-tab, #nav-conundrum-tab'))\n triggerTabList.forEach(function (triggerEl) {\n var tabTrigger = new bootstrap.Tab(triggerEl)\n triggerEl.addEventListener('click', function (event) {\n event.preventDefault()\n tabTrigger.show()\n })\n })\n}", "function onTabChange(i) {\n\t\tsetCurrentTab(i)\n\t}", "function tabchange(tab) {\n\tswitch (tab) {\n\t\tcase \"situations\":\n\t\t\tviewstack = new Moobile.ViewControllerStack;\n\t\t\twindowcontroller.setRootViewController(viewstack).getRootViewController().pushViewController(new ViewController.Situations(), new Moobile.ViewTransition.None);\n\t\t\tbreak;\n\t\tcase \"revivification\":\n\t\t\tviewstack = new Moobile.ViewControllerStack;\n\t\t\twindowcontroller.setRootViewController(viewstack).getRootViewController().pushViewController(new ViewController.Revivification(), new Moobile.ViewTransition.None);\n\t\t\tbreak;\n\t\tcase \"emergency\":\n\t\t\tviewstack = new Moobile.ViewControllerStack;\n\t\t\twindowcontroller.setRootViewController(viewstack).getRootViewController().pushViewController(new ViewController.Emergency(), new Moobile.ViewTransition.None);\n\t\t\tbreak;\n\t\tcase \"more\":\n\t\t\tviewstack = new Moobile.ViewControllerStack;\n\t\t\twindowcontroller.setRootViewController(viewstack).getRootViewController().pushViewController(new ViewController.More(), new Moobile.ViewTransition.None);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n}", "function activateValidation(tabID) {\n $(\"#\" + tabID).validationEngine({\n success: function () {\n if (page == 'general') {\n saveAdminDetails();\n } else if (page == 'notification') {\n saveNotificationDetails();\n } else if (page == 'terms') {\n saveTermsOfUseDetails();\n } else if (page == 'bug') {\n sendBugReport();\n }\n },\n failure: false\n })\n}", "function triggerFromFrontEnd(tabs) {\r\n browser.tabs.sendMessage(tabs[0].id, {\r\n command: \"run\",\r\n });\r\n }", "function changeTab(e) {\n setTab(e.target.id);\n}", "function onTabShown(event, tabId) {\n // always show spinner on tab change, to avoid stale destinations list flashing\n showSpinner();\n if (tabId === tabControl.TABS.EXPLORE) {\n UserPreferences.setPreference('method', 'explore');\n setFromUserPreferences();\n $(options.selectors.isochroneSliderContainer).removeClass(options.selectors.hiddenClass);\n clickedExplore();\n } else {\n clearIsochrone();\n mapControl.isochroneControl.clearDestinations();\n $(options.selectors.isochroneSliderContainer).addClass(options.selectors.hiddenClass);\n }\n }", "registerEventListener() {\n // form submit\n document.addEventListener('submit', evt => {\n // console.debug('submit', event.target);\n evt.preventDefault();\n\n this.btnSubmitAnimation._process();\n this.saveOptions(evt.target);\n this.btnSubmitAnimation._defaut();\n });\n // form unsave\n document.addEventListener('change', ({ target }) => {\n // console.debug('change', target, 'name:', target.name);\n // if (!target.matches('input[type=search]')) return;\n if (!target.name || target.name == 'tabs') return; // fix/ignore switch tabs\n this.btnSubmitAnimation.submitBtns.forEach(e => e.classList.add('unSaved'));\n // textarea trim value\n if (target.tagName.toLowerCase() == 'textarea') target.value = target.value.trim();\n });\n\n document.getElementById('showNotification')\n .addEventListener(\"change\", evt => {\n // console.debug('evt.type:', evt.type);\n // Conf.getPermissions(['notifications', 'downloads.open'], evt);\n Conf.getPermissions(['notifications'], evt);\n });\n\n document.getElementById('toolbarBehavior')\n .addEventListener(\"change\", evt => {\n // console.debug('evt.type:', evt.type);\n switch (this.value) {\n case 'chrome_downloads':\n Conf.getPermissions(['tabs'], evt);\n break;\n // case 'popup':\n // Conf.getPermissions(['downloads.open'], evt);\n // break;\n }\n });\n }", "function alterForm(tab){\n\tswitch (tab){\n\t\tcase 'add':prepareAdd();break;\n\t\tcase 'mod':prepareMod();break;\n\t\tcase 'del':prepareDel();break;\n\t}\n}", "function jscoverage_initTabControl() {\n\t$('.tabs a').on('click', function (e) {\n\t\te.preventDefault();\n\t\tjscoverage_tab_click(e);\n\t\t$(this).tab('show');\n\t});\n\n\t// $('.tabs a:not(.disabled):first').trigger('click');\n}", "function initTabs() {\n $('label').click(function (e) {\n e.preventDefault();\n var forEl = $(this).attr('for');\n $('#' + forEl).trigger('click');\n $('.example__content[data-tab=' + forEl + ']').addClass('is-active').siblings().removeClass('is-active');\n });\n }", "function init() {\n\n // Poll open tabs and set a timer such that, if after half a second we find any tabs that need reloading,\n // we display the options page which will suggest a tab reload\n pollTabVersions();\n setTimeout(function() {\n if (tabVersions.current.length != tabVersions.counted) {\n chrome.tabs.create({'url': 'options.html'});\n }\n }, 500);\n\n // Listen for mark, jump, and last messages from content scripts\n chrome.extension.onMessage.addListener(\n function(request, sender, sendResponse) {\n if (request.action == \"mark\") {\n chrome.tabs.query({active: true, currentWindow: true}, function(tab) {\n keymap[request.key] = tab[0].id;\n msg('Tab Monkey', 'Marking this tab as #' + String.fromCharCode(request.key));\n });\n }\n else if (request.action == \"jump\") {\n if (request.key in keymap) {\n chrome.tabs.update(keymap[request.key], {active: true});\n }\n }\n else if (request.action == \"last\") {\n if (prevTab) {\n chrome.tabs.update(prevTab, {active: true});\n }\n }\n });\n\n // Listen for tab changes and record for future switches\n chrome.tabs.onSelectionChanged.addListener(function(newTab) {\n if (prevTab == null) {\n prevTab = newTab;\n }\n\n if (currentTab == null) {\n currentTab = newTab;\n } else {\n prevTab = currentTab;\n currentTab = newTab;\n }\n });\n\n}", "function tabSwitchHandler(e) {\n actTab = (\"\"+e.target).replace(/.*#/, \"\");\n prevTab = (\"\"+e.relatedTarget).replace(/.*#/, \"\");\n if(bounceProtect != prevTab + actTab) {\n bounceProtect = prevTab + actTab;\n if('' != prevTab) {\n searchStates[prevTab].saveContent();\n }\n searchStates[actTab].restoreContent();\n }\n }", "function initTabEvents() {\n\n\n function cleanTabNav() {\n var tabLinks = $('#pp-nav-tabs > li > a[data-toggle=\"tab\"]');//document.getElementsByClassName('a-tab-nav');\n for (var i = 0; i < tabLinks.length; i++) {\n var h = tabLinks[i].href.substring(tabLinks[i].href.lastIndexOf('#'));\n if (h.lastIndexOf('?') >= 0) {\n h = h.substring(0, h.lastIndexOf('?'));\n tabLinks[i].setAttribute('href', h);\n }\n }\n\n $('#pp-nav-tabs > li > a[data-toggle=\"tab\"]').on('shown.bs.tab', function (e) {\n\n var id = $(e.target).attr(\"href\").substr(1);\n window.location.hash = id;\n\n var url = $(this).attr(\"data-url\");\n\n if (!hasValue(url)) {\n onTanContentLoaded();\n return;\n }\n\n var target = $(e.target).attr(\"href\"); // activated tab\n\n if ($(target).is(':empty')) {\n\n var pane = $(this);\n // showFormLoader('#tp-author');\n // ajax load from data-url\n $(target).load(url, function () {\n // hideFormLoader();\n pane.tab('show');\n onTanContentLoaded();\n });\n }\n else {\n onTanContentLoaded();\n }\n });\n\n var hash = window.location.hash;\n if (hasValue(hash)) {\n $('#pp-nav-tabs a[href=\"' + hash + '\"]').tab('show');\n }\n }\n\n setTimeout(cleanTabNav, 200);\n\n \n}", "activateListeners(html) {\n super.activateListeners(html);\n\n // Activate tabs\n new Tabs(html.find(\".tabs\"), {\n initial: this.item.data.flags[\"_sheetTab\"],\n callback: clicked => this.item.data.flags[\"_sheetTab\"] = clicked.attr(\"data-tab\")\n });\n\n // Checkbox changes\n html.find('input[type=\"checkbox\"]').change(event => this._onSubmit(event));\n }", "update() {\n if (!this.dirty)\n return;\n this.dirty = false;\n const shadowRoot = this.shadowRoot;\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const self = this;\n const activateTab = function (ev) {\n const tab = ev.target;\n if (tab.tagName === 'LABEL') {\n self.activateTab(tab.parentNode.dataset.name);\n }\n };\n // 1. Remove the event handlers\n shadowRoot.querySelectorAll('.tab').forEach((x) => {\n x.removeEventListener('click', activateTab);\n });\n // 2. Collect the content of each tab\n const slots = shadowRoot.querySelectorAll('.original-content slot');\n let content = '';\n slots.forEach((slot) => {\n let text = slot\n .assignedNodes()\n .map((node) => node.innerHTML)\n .join('');\n if (text) {\n // Remove empty comments. This 'trick' is used to work around\n // an issue where Eleventy ignores empty lines in HTML blocks,\n // so an empty comment is insert, but it now needs to be removed\n // so that the empty line is properly picked up by CodeMirror. Sigh.\n text = text.replace(/<!-- -->/g, '');\n const tabId = randomId();\n const language = slot.name;\n content += `<div class='tab' id=\"${tabId}\" data-name=\"${language}\">\n <input type=\"radio\" id=\"${tabId}\" name=\"${this.id}\">\n <label for=\"${tabId}\">${language}</label>\n <div class=\"content ${language.toLowerCase()}\">\n <textarea data-language=\"${language.toLowerCase()}\">${text}</textarea>\n </div>\n </div>`;\n }\n });\n shadowRoot.querySelector('.tabs').innerHTML = content;\n // 3. Listen to tab activation\n const tabs = shadowRoot.querySelectorAll('.tab');\n if (tabs.length <= 1) {\n tabs.forEach((x) => (x.querySelector('.tab > label').style.display = 'none'));\n }\n else {\n shadowRoot.querySelectorAll('.tab label').forEach((x) => {\n x.addEventListener('click', activateTab);\n });\n }\n const firstTab = tabs[0];\n const lastTab = tabs[tabs.length - 1];\n if (tabs.length > 1) {\n firstTab.style.marginTop = '8px';\n }\n else {\n const tabContent = firstTab.querySelector('.content');\n tabContent.style.borderTopLeftRadius = '8px';\n tabContent.style.borderTopRightRadius = '8px';\n }\n if (!this.buttonBarVisible) {\n const tabContent = lastTab.querySelector('.content');\n tabContent.style.borderBottomLeftRadius = '8px';\n tabContent.style.borderBottomRightRadius = '8px';\n lastTab.style.marginBottom = '0';\n lastTab.style.paddingBottom = '0';\n }\n // 4. Setup editors\n if (typeof CodeMirror !== 'undefined') {\n this.resizeObserver.disconnect();\n shadowRoot\n .querySelectorAll('.tab .content textarea')\n .forEach((x) => {\n var _a;\n // Remove XML comments, including the <!-- htmlmin:ignore --> used to\n // indicate to terser to skip sections, so as to preserve the formatting.\n x.value = x.value.replace(/<!--.*-->\\n?/g, '');\n // Watch for re-layout and invoke CodeMirror refresh when they happen\n this.resizeObserver.observe(x.parentElement);\n const lang = {\n javascript: 'javascript',\n css: 'css',\n html: 'xml',\n }[(_a = x.dataset.language) !== null && _a !== void 0 ? _a : 'javascript'];\n const editor = CodeMirror.fromTextArea(x, {\n lineNumbers: this.showLineNumbers,\n lineWrapping: true,\n mode: lang,\n theme: 'tomorrow-night',\n });\n editor.setSize('100%', '100%');\n editor.on('change', () => {\n this.editorContentChanged();\n });\n });\n }\n // 5. Activate the previously active tab, or the first one\n this.activateTab(this.activeTab || tabs[0].dataset.name);\n // 6. Run the playground\n this.runPlayground();\n // Refresh the codemirror layouts\n // (important to get the linenumbers to display correctly)\n setTimeout(() => shadowRoot\n .querySelectorAll('textarea + .CodeMirror')\n .forEach((x) => { var _a; return (_a = x === null || x === void 0 ? void 0 : x['CodeMirror']) === null || _a === void 0 ? void 0 : _a.refresh(); }), 128);\n }", "onTabSwitched(aTab, aOldTab) {\n // (Note: we used to explicitly handle the possibility that the user had\n // typed something but an ontimeout had not yet fired in the textbox.\n // We are bailing on that because it adds complexity without much functional\n // gain. Our UI will be consistent when we switch back to the tab, which\n // is good enough.)\n\n let filterer = this.maybeActiveFilterer;\n if (filterer) {\n this.reflectFiltererState(filterer, aTab.folderDisplay);\n }\n this._updateCommands();\n }", "function fTabSwitchSetInfo(iToTab) {\n // called at initialization and every tab switch\n fLog(\"fTabSwitchSetInfo: \" + iToTab);\n var bTab1 = iToTab <= 0; // tab 1 or initializing\n var bTab2 = iToTab == 1;\n var bTab3 = iToTab == 2;\n\n if (bTab2 || bTab3) {\n var bAnythingSelected = fSetClientSegment(iToTab == 1); // hide/shows all forms called for, including RBCx site\n\n fQkDisplay(oTab2NoneSelected, !bAnythingSelected); // 'Please go back to tab one and select one or more services...\n fQkDisplay(oTab2OnToNext, bTab2 && bAnythingSelected);\n fHide(oTab2Processing);\n fQkDisplay(oTab2Requestor, bTab3 && bAnythingSelected);\n fQkDisplay(oTab2Overview, bTab3 && bAnythingSelected);\n\n if (bAnythingSelected) {\n // one or more forms active\n fCopyGlobalsT1T3();\n }\n\n // other business logic for tabs 2 or 3\n }\n\n if (bTab3) {\n // want to set the 'one' or 'multiple' emails button\n fBuildEMailRouting();\n var iEmails = countEmailsToSend();\n fLog(\"emails to send=\" + iEmails);\n if (iEmails == 0) {\n // Special CEPAS and it's the only form\n oTab3btnSubmit.caption.value.text = msgSendEmail; // msgDisplayEMNotice;\n } else if (iEmails == 1) {\n oTab3btnSubmit.caption.value.text = msgSendEmail;\n } else {\n oTab3btnSubmit.caption.value.text =\n msgSendEmailS1 + iEmails + msgSendEmailS2;\n }\n fFormMakeReadOnly(oTab2Forms);\n } else {\n fFormMakeReadWrite(oTab2Forms);\n }\n}", "function onHashChange() {\n\t\tupdateActiveTab();\n\t\tupdateActiveSection();\n\t}", "componentDidUpdate() {\n\t\t//FIXME a horrible way to attach a tab listener here instead of in componentDidMount\n\t\t//(for now we have to wait until the jquery is available... )\n\t\tif(!this.tabListeners) {\n\t\t\t$('a[data-toggle=\"tab\"]').on('show.bs.tab', function (e) {\n\t\t\t\tconst target = $(e.target).attr(\"href\") // activated tab\n\t\t\t\tconst index = target.substring('#mo__'.length);\n\t\t\t\tconst annotationTarget = this.getAnnotationTarget(this.state.itemData, index)\n\t\t\t\tif(annotationTarget) {\n\t\t\t\t\tthis.setActiveAnnotationTarget.call(this, annotationTarget);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.debug('There is no valid target?');\n\t\t\t\t}\n\n\t\t\t}.bind(this));\n\t\t\tthis.tabListeners = true;\n\t\t}\n\t}", "function user_form_onload(){\n\tif (myTabsFrame.selectedTabName == 'page4b') {\n\t\tvar grid = Ab.view.View.getControl('', 'fields_grid');\n\t\tif (grid) {\n\t\t\t// override default filter listener to check previously selected fields\n\t\t\tgrid.filterListener = checkFieldsFilter;\n\n\t\t\t// override default clearFilter listener to check previously selected fields\n\t\t\tgrid.clearFilterListener = checkFieldsClearFilter;\n\t\t\t\n\t\t\t// override default selectAllRowsSelected function\n\t\t\tgrid.setAllRowsSelected = function (selected){\n\t\t\t\t\n\t\t\t\t// reset the summary panel to avoid adding duplicate fields\n\t\t\t\tvar table = document.getElementById(\"selectedFields\");\n\t\t\t\tvar tBody = table.tBodies[0];\n\t\t\t\tremoveExistingRows(tBody);\n\t\t\n\t\t\t\tvar setSelectedTrue = ((typeof selected == 'undefined') || selected == true) ? true : false;\n\t\t\t\tvar selectedRows = new Array();\t\t\t\t\n\t\t\t\tvar dataRows = this.getDataRows();\n\t\t\t\t\n\t\t\t\tfor (var r = 0; r < dataRows.length; r++) {\n\t\t\t\t\tvar dataRow = dataRows[r];\n\t\t\t\t\t\n\t\t\t\t\tvar selectionCheckbox = dataRow.firstChild.firstChild;\n\t\t\t\t\t\n\t\t\t\t\tif (typeof selectionCheckbox.checked != 'undefined') {\n\t\t\t\t\t\tselectionCheckbox.checked = setSelectedTrue;\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t// add or remove selected field from view object\n\t\t\t\t\t\tonCheck(this.rows[r]);\n\t\t\t\t\t\tselectedRows.push(this.rows[r]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn selectedRows;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (myTabsFrame.selectedTabName == 'page4d') {\n\t\tvar grid = Ab.view.View.getControl('', 'field_grid');\n\t\tif (grid) {\n\t\t\tgrid.enableSelectAll(false);\n\t\t\t\n\t\t\t// override default index listener to check previously selected fields\n\t\t\tgrid.indexListener = checkStandardsIndex;\n\n\t\t\t// override default filter listener to check previously selected fields\n\t\t\tgrid.filterListener = checkStandardsFilter;\n\n\t\t\t// override default clearFilter listener to check previously selected fields\n\t\t\tgrid.clearFilterListener = checkStandardsClearFilter;\n\t\t\t\t\t\t\t\t\t\n\t\t\t// override, default onMultipleSelectionChange\n\t\t\tgrid.addEventListener('onMultipleSelectionChange', function(row){\n\t\t\t\tsaveStandards(row);\n\t\t\t});\n\t\t\t\n\t\t\t// show filter\n\t\t\tgrid.isCollapsed = false;\n\t\t\tgrid.showIndexAndFilter();\n\t\t}\n\t}\n}", "function configureWatchers(){$scope.$watch('$mdTabsCtrl.selectedIndex',handleSelectedIndexChange);}", "function handleChange(event, newValue) {\r\n setCurrentView(newValue); // newValue is the index of the tab that is selected\r\n }", "tabChanged(key) {\r\n if (isUUID(this.state.companyId))\r\n this.stateSet({ tabKey: key });\r\n else\r\n this.props.notifyToaster(NOTIFY_ERROR, { message: this.strings.SAVE_COMPANY_VALIDATION });\r\n }", "onNewTab(){\n console.log(\"onNewTab\");\n\n Session.set('selectedPractitioner', false);\n Session.set('practitionerDetailState', false);\n }", "function init() {\n $(window).bind('hashchange', hashChanged).trigger('hashchange');\n $(window).bind('submit', formSubmitted);\n }", "function onUpdatedListener(tabId, changeInfo, tab) {\n tabs[tab.id] = tab.incognito;\n}", "onNavigatorEvent(event) {\n if (event.id === 'bottomTabSelected') {\n console.log('Tab selected!');\n // if (firebase.auth().currentUser) {\n // this.tabHandler(2);\n // }\n }\n if (event.id === 'bottomTabReselected') {\n console.log('Tab reselected!');\n }\n }", "function updateTab (tabs) {\n if (tabs[0]) {\n currentTab = tabs[0]\n let currentURL = currentTab.url\n if (!isValidURL(currentURL)) {\n hideIcon()\n } else {\n getOptions()\n .then(updateStatus)\n .then(updateUI)\n }\n }\n}", "function preRunFunc() {\n\t\tonglets_ui.tabs();\n\t\tgetOngletsChannels();\n\t\tonInputFocus();\n\t\tonInputFocusOut();\n\t\tformSubmit();\n\t\tputButtonsEvents();\n\t}", "function checkIsFormChanged() {\r\n const inputArr = document.querySelectorAll('input');\r\n const selectArr = document.querySelectorAll('select');\r\n const radioArr = document.querySelectorAll('radio');\r\n const textareaArr = document.querySelectorAll('textarea');\r\n setEventListener(inputArr);\r\n setEventListener(selectArr);\r\n setEventListener(radioArr);\r\n setEventListener(textareaArr);\r\n}", "function tabUpdateHandler(tabId, changeInfo, tab) {\n\tconsole.log(\"tabUpdateHandler: \", changeInfo);\n\tif (typeof changeInfo.url == \"undefined\") {\n\t\t// No change in tab url (e.g., tab reloaded, muted, ...). Skip this event.\n\t\tconsole.log(\"No change in tab url\");\n\t} else if (tabsUpdatedBySync.includes(tabId)) {\n\t\tconsole.log(\"tab updated by sync handler: \", tabId);\n\t\ttabsUpdatedBySync.splice(tabsUpdatedBySync.indexOf(tabId), 1);\n\t} else {\n\t\tconsole.log(\"tab updated by user: \", tabId);\n\t\tsyncUpdatedTab(tabId, changeInfo, tab);\n\t}\n}", "function user_form_afterSelect(){\n // disable \"Save\" and \"Publish\" parent tabs if not alter view wizard.\n if (!isAlterWizard()) {\n tabsFrame.setTabEnabled(\"page6\", false);\n tabsFrame.setTabEnabled(\"page7\", false);\n\n \tif((myTabsFrame.selectedTabName == 'page4a')){\n\t\tvar view = tabsFrame.newView;\n \t\tif(!view.hasOwnProperty('actionProperties')){\n \t\t\tvar actionProperty = new Object();\t\n \t\t\tview.actionProperties = [actionProperty,actionProperty,actionProperty];\n \t\t\ttabsFrame.newView = view;\n\t\t}\n \t}\n\n }\n else {\n // hide \"Add Standard\" tab if alter view wizard.\n myTabsFrame.hideTab('page4d', true);\n }\n\t\n var viewType = tabsFrame.typeRestriction;\n var view = tabsFrame.newView;\n pattern = tabsFrame.patternRestriction;\n\tnumberOfTblgrps = Number(tabsFrame.tablegroupsRestriction);\n\tbIsPaginatedHighlight = pattern.match(/paginated-highlight/gi);\n\tbIsPaginatedHighlightThematic = pattern.match(/paginated-highlight-thematic/gi);\n\tbIsPaginatedHighlightRestriction = pattern.match(/paginated-highlight-restriction/gi);\n\tif (bIsPaginatedHighlightRestriction && (tabsFrame.selectedTableGroup == 2) && (tabsFrame.fileToConvert == null)){\n\t\tbSetPaginatedRestrictionLegend = true;\n\t}\n\n\tif (bIsPaginatedHighlightThematic && (tabsFrame.selectedTableGroup == 2) && (tabsFrame.fileToConvert == null)){\n\t\tbSetPaginatedThematicLegend = true;\n\t}\n\t\t\t\t\n // warn if no pattern was selected\n if ((tabsFrame.patternRestriction == undefined) || (tabsFrame.patternRestriction == \"\")) {\n alert(getMessage('noPattern'));\n tabsFrame.selectTab('page2');\n }\n else \n if (view.tableGroups.length == 0) {\n // warn if no tablegroups were selected\n alert(getMessage('noTables'));\n tabsFrame.selectTab('page3');\n }\n else {\n \n // setup display of view depending upon which tab was selected\n switch (myTabsFrame.selectedTabName) {\n \n case \"page4a\":\n \n // if \"View Summary\" tab was selected\n var summaryPanel = Ab.view.View.getControl('', 'tgFrame_page4a');\n if (summaryPanel) {\n \n // explicitly display the button and status rows for the owner2 and owner tablegroups\n $('drill2Checklist').style.display = \"\";\n $('drillChecklist').style.display = \"\";\n $('drill2Characteristics').style.display = \"\";\n $('drillCharacteristics').style.display = \"\";\n \n // explicitly reset the title\n $('viewTitle').value = getMessage('viewTitleText');\n \n // show button text (for localization)\n var buttonArr = [\"selectFields\", \"setSortOrder\", \"addStandard\", \"setRestriction\", \"setOptions\"];\n for (var i = 0; i < buttonArr.length; i++) {\n\t\t\t\t\t\t\tdocument.getElementById('setSortOrder0')\n $(buttonArr[i] + \"0\").value = getMessage(buttonArr[i]);\n $(buttonArr[i] + \"1\").value = getMessage(buttonArr[i]);\n $(buttonArr[i] + \"2\").value = getMessage(buttonArr[i]);\n }\n \n // clear any restrictions\n tabsFrame.restriction = null;\n \n // get the view title from view object and display\n var title = view.title;\n if (title != undefined) {\n $('viewTitle').value = replaceXMLAmp(title);\n }\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (pattern.match(/paginated-highlight/gi)){\n\t\t\t\t\t\t\t$('drawingOptions').style.display = \"\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// hide sort, restriction, and options for label datasource\n\t\t\t\t\t\t\t$('drillSrt').style.display = \"none\";\n\t\t\t\t\t\t\t$('drillRst').style.display = \"none\";\n\t\t\t\t\t\t\t$('drillOpt').style.display = \"none\";\n\t\t\t\t\t\t\t$('setSortOrder1').style.display = \"none\";\n\t\t\t\t\t\t\t$('setRestriction1').style.display = \"none\";\n\t\t\t\t\t\t\t$('setOptions1').style.display = \"none\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$('drawingOptions').style.display = \"none\";\t\n\t\t\t\t\t\t\t$('drillSrt').style.display = \"\";\n\t\t\t\t\t\t\t$('drillRst').style.display = \"\";\n\t\t\t\t\t\t\t$('drillOpt').style.display = \"\";\t\n\t\t\t\t\t\t\t$('setSortOrder1').style.display = \"\";\n\t\t\t\t\t\t\t$('setRestriction1').style.display = \"\";\n\t\t\t\t\t\t\t$('setOptions1').style.display = \"\";\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (pattern.match(/paginated-highlight-thematic/gi)) {\n\t\t\t\t\t\t\t$('drill2Opt').style.display = \"none\";\n\t\t\t\t\t\t\t$('setOptions2').style.display = \"none\";\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else{\n\t\t\t\t\t\t\t$('drill2Opt').style.display = \"\";\n\t\t\t\t\t\t\t$('setOptions2').style.display = \"\";\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\n /* \n // if this is summary report, set the tab title and button to \"Set Grouping\"\n if ((viewType == 'summaryReports') || (pattern.match(/paginated/gi) && hasSummarizeBySortOrder(view.tableGroups[index]))) {\n $('setSortOrder' + index).value = getMessage(\"setGrouping\");\n myTabsFrame.setTabTitle('page4c', getMessage(\"setGrouping\"));\n }\n else {\n \n // otherwise, set the tab title and button to \"Set Sort Order\"\n $('setSortOrder' + index).value = getMessage(\"setSortOrder\");\n myTabsFrame.setTabTitle('page4c', getMessage(\"selectSortOrder\"));\n }\n */ \n // restrict options according to the number of tablegroups available\n switch (numberOfTblgrps) {\n case 1:\n \n // if one tablegroup was selected, hide the owner and owner2 rows (both buttons and status rows)\n $('drill2Checklist').style.display = \"none\";\n $('drillChecklist').style.display = \"none\";\n $('drill2Characteristics').style.display = \"none\";\n $('drillCharacteristics').style.display = \"none\";\n \n // fill in the table name in input box\n $('dataTable').value = tabsFrame.datagrpRestriction;\n \n // update the status for each characteristic (Required, Optional, or Checked)\n markCheckList('data', view.tableGroups[0]);\n \n // if table empty warn and navigate to \"Select Data\" tab\n if ($('dataTable').value == \"\") {\n alert(getMessage(\"noTables\"));\n tabsFrame.selectTab(\"page3\");\n }\n break;\n \n case 2:\n \n // if two tablegroups were selected, hide the owner row (both buttons and status rows)\n $('drill2Checklist').style.display = \"none\";\n $('drill2Characteristics').style.display = \"none\";\n \n // fill in the table names of each tablegroup\n $('dataTable').value = tabsFrame.datagrpRestriction;\n $('drillDownTable').value = tabsFrame.ownergrpRestriction;\n \n // update the status for each characteristic (Required, Optional, or Checked)\n markCheckList(\"data\", view.tableGroups[1]);\n markCheckList(\"drill\", view.tableGroups[0]);\n \n // warn if table were not selected and navigate to \"Select Data\" tab\n if (($('drillDownTable').value == '') || ($('dataTable').value == '')) {\n alert(getMessage('noTables'));\n tabsFrame.selectTab('page3');\n }\n \n break;\n \n case 3:\n \n\t\t\t\t\t\t\t\t// display appropriate table labels\n\t\t\t\t\t\t\t\tif (pattern.match(/paginated-highlight/gi)){\n\t\t\t\t\t\t\t\t\t$('drillDown2Title').innerHTML = getMessage('highlightTable');\t\n\t\t\t\t\t\t\t\t\t$('drillDownTitle').innerHTML = getMessage('labelTable');\t\n\t\t\t\t\t\t\t\t\t$('dataTitle').innerHTML = getMessage('legendTable');\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tvar bSyncLegend = $('syncLegendCheckBox').checked;\n\t\t\t\t\t\t\t\t\tif (bSyncLegend == true){\n\t\t\t\t\t\t\t\t\t\tcopyDataBand(view);\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} else {\n\t\t\t\t\t\t\t\t\t$('drillDown2Title').innerHTML = getMessage('drillDown2Table');\t\n\t\t\t\t\t\t\t\t\t$('drillDownTitle').innerHTML = getMessage('drillDownTable');\t\n\t\t\t\t\t\t\t\t\t$('dataTitle').innerHTML = getMessage('dataTable');\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\t\n // if three tablegroups were selected, fill in the table names\n $('dataTable').value = tabsFrame.datagrpRestriction;\n $('drillDownTable').value = tabsFrame.ownergrpRestriction;\n $('drillDownTable2').value = tabsFrame.owner2grpRestriction;\n \n // update the status for each characteristic (Required, Optional, or Checked)\n markCheckList(\"data\", view.tableGroups[2]);\n markCheckList(\"drill\", view.tableGroups[1]);\n markCheckList(\"drill2\", view.tableGroups[0]);\n \n // if no table was selected, warn and navigate back to \"Select Data\" tab\n if (($('drillDownTable').value == '') || ($('dataTable').value == '') || ($('drillDownTable2').value == '')) {\n alert(getMessage('noTables'));\n tabsFrame.selectTab('page3');\n }\n break;\n }\n }\n break;\n \n case \"page4b\":\n // if \"Select Fields\" tab was selected\n showAddVFButton();\n\n\t\t\t\t\tvar numberOfTgrps = view.tableGroups.length;\n\t\t\t\t\t// find the index\n\t\t\t\t\tvar index = numberOfTgrps - tabsFrame.selectedTableGroup - 1;\n\t\t\t\t\t// show/hide parameters restriction based on pattern and which tablegroup\n\t\t\t\t\tif (pattern.match(/paginated-parent/gi) && (index < (numberOfTgrps - 1))){\n\t\t\t\t\t\t$('restrictionParameterColumn').style.display = \"\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('restrictionParameterColumn').style.display = \"none\";\t\n\t\t\t\t\t}\n\n\t\t\t\t\tif (pattern.match(/editform/gi) && (index == (numberOfTblgrps - 1))){\n\t\t\t\t\t\t$('showSelectValueActionColumn').style.display = \"\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('showSelectValueActionColumn').style.display = \"none\";\t\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n // reset summary table\n resetTable('selectedFields');\n \n var table = $('selectedFields');\n var tBody = table.tBodies[0];\n \n // get the table name from the passed in restriction, if there is one\n if (tabsFrame.restriction.clauses) {\n var table_name = tabsFrame.restriction.clauses[0].value;\n }\n \n // array of field properties \n //var fieldsList = [\"field_name\", \"ml_heading\", \"data_type\", \"afm_type\", \"primary_key\", \"table_name\"];\n var fieldsList = [\"field_name\", \"ml_heading\", \"data_type\", \"afm_type\", \"primary_key\", \"table_name\", \"ml_heading_english\"];\n \n // find the main table based on index\n var main_table = view.tableGroups[index].tables[0].table_name;\n \n // show only fields that pertain to the main table of the tablegroup\n if (main_table == tabsFrame.restriction.clauses[0].value) {\n var fields = view.tableGroups[index].fields;\n }\n \n // set restriction on grid to show only fields with selected table name\n setRestrictionOnGrid();\n \n // check check boxes for selected fields\n checkBoxesForSelectedFields();\n\n\t\t\t\t\t// auto-pkey: highlight primary keys for restriction drawing or paginated-parent reports\n\t\t\t\t\tif ( pattern.match(/ab-viewdef-report|edit|columnreport/gi) || pattern == 'ab-viewdef-paginated' || (pattern.match(/highlight-restriction/gi) && ((index == 0) || (index == 2))) || pattern.match(/paginated-parent/gi)){\n\t\t\t\t\t\tif ((fields == undefined) || fields == '') {\n\t\t\t\t\t\t\tcheckPKeysAsDefaults();\n\t\t\t\t\t\t\t// highlightPKeyRows();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// if paginated parent (not a child tablegroup), set restriction parameters on primary keys as default\n\t\t\t\t\t\t\tif (isPaginatedParent()){\n\t\t\t\t\t\t\t\tsetPKeysAsRestrictionParams();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tvar status = 'none';\t\t\t\t\t\n\t\t\t\t\tif (pattern.match(/paginated-parent/gi) && (index < (numberOfTblgrps - 1))){\n\t\t\t\t\t\tstatus = '';\t\n\t\t\t\t\t}\n\t \n // create the summary table\n if (fields != undefined) {\n for (m = 0; m < fields.length; m++) {\n \n // create the row and give it an id\n var new_tr = document.createElement('tr');\n new_tr.id = \"row\" + m;\n \n // get field object\n var fldObj = fields[m];\n new_tr.ml_heading_english = fldObj['ml_heading_english'];\n if(valueExistsNotEmpty(fldObj.ml_heading_english_original)){\n \tnew_tr.ml_heading_english_original = fldObj['ml_heading_english_original'];\n }\n if(valueExistsNotEmpty(fldObj.rowspan)){\n \tnew_tr.rowspan = fldObj['rowspan'];\n }\n if(valueExistsNotEmpty(fldObj.colspan)){\n \tnew_tr.colspan = fldObj['colspan'];\n } \n \n // loop through and fill in the field property values in the summary table\n for (var j = 0; j < fieldsList.length; j++) {\n var new_td = document.createElement('td');\n new_td.innerHTML = fldObj[fieldsList[j]];\n if((j > 2 ) && (fieldsList[j] == 'ml_heading_english')){\n \tnew_td.style.display = 'none';\n \tif(valueExistsNotEmpty(fldObj['ml_heading_english_original'])){\n \t\tnew_td.innerHTML = fldObj['ml_heading_english_original'];\n \t}\n }\t\n new_tr.appendChild(new_td);\n if(fldObj['is_virtual'] && fldObj['sql']){\n \tvar sql = fldObj['sql'];\n \tif(typeof(sql) == 'string'){\n \t sql = eval(\"(\" + fldObj['sql'] + \")\");\n \t}\n \tvar sqlMsg = '<b>' + getMessage('generic') + '</b> ' + sql.generic + '<br/><b>' + getMessage('oracle') + '</b> ' + sql.oracle + '<br/><b>' + getMessage('sqlServer') + '</b> ' + sql.sqlServer + '<br/><b>' + getMessage('sybase') + '</b> ' + sql.sybase;\n \tnew_td.setAttribute('ext:qtip', sqlMsg);\n \tnew_td.vf = fldObj;\n \tnew_td.sql = sql;\n }\n }\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// add restriction parameter column\n var new_td = document.createElement('td');\n\t\t\t\t\t\t\tvar id = 'td_' + fldObj.table_name + '.' + fldObj.field_name;\n\t\t\t\t\t\t\tnew_td.id = id;\n\t\t\t\t\t\t\tnew_td.style.display = status;\n\t\t\t\t\t\t\tvar temp = '<input id=\"param_' + fldObj.table_name + '.' + fldObj.field_name + '\" type=\"checkBox\" onclick=\"getFieldValues()\"';\n\t\t\t\t\t\t\tif (fldObj.hasOwnProperty('restriction_parameter') ){\t\t// for new view\n\t\t\t\t\t\t\t\tif (fldObj.restriction_parameter != '') {\n\t\t\t\t\t\t\t\t\ttemp += 'checked=\"checked\"';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttemp += '/>';\n\t\t\t\t\t\t\tnew_td.innerHTML = temp;\n new_tr.appendChild(new_td);\n\n\t\t\t\t\t\t\t// add showselectvalueaction column\n var new_td = document.createElement('td');\n\t\t\t\t\t\t\tvar id = 'td_' + fldObj.table_name + '.' + fldObj.field_name;\n\t\t\t\t\t\t\tnew_td.id = id;\t\n\n\t\t\t\t\t\t\t// show\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar temp = '<input id=\"showSelectValueAction_' + fldObj.table_name + '.' + fldObj.field_name + '\" type=\"checkBox\" onclick=\"getFieldValues();showSelectVWarning(this.checked);\" value=\"true\" ';\n\t\t\t\t\t\t\tif (fldObj.hasOwnProperty('showSelectValueAction') ){\t\t// for new view\n\t\t\t\t\t\t\t\tif (fldObj.showSelectValueAction == true) {\n\t\t\t\t\t\t\t\t\ttemp += 'checked=\"checked\"';\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\t\t\ttemp += 'style=\"';\n\t\t\t\t\t\t\tif ((fldObj['primary_key'] == 0) && pattern.match(/editform/) && (index == (numberOfTblgrps - 1))) {\n\t\t\t\t\t\t\t\ttemp += '\"/>';\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttemp += 'display:none\"></input>';\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tnew_td.innerHTML = temp;\n new_tr.appendChild(new_td);\n\t\t\t\t\t\t\t/*\n var new_td = document.createElement('td');\n\t\t\t\t\t\t\tvar id = 'td_' + fldObj.table_name + '.' + fldObj.field_name;\n\t\t\t\t\t\t\tnew_td.id = id;\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// show\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar temp = '<input name=\"showSelectValueAction_' + fldObj.table_name + '.' + fldObj.field_name + '\" type=\"radio\" onclick=\"getFieldValues()\" value=\"true\" ';\n\t\t\t\t\t\t\tif (fldObj.hasOwnProperty('showSelectValueAction') ){\t\t// for new view\n\t\t\t\t\t\t\t\tif (fldObj.showSelectValueAction == true) {\n\t\t\t\t\t\t\t\t\ttemp += 'checked=\"checked\"';\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\t\t\ttemp += 'style=\"';\n\t\t\t\t\t\t\tif ((fldObj['primary_key'] == 0) && pattern.match(/editform/) && (index == (numberOfTblgrps - 1))) {\n\t\t\t\t\t\t\t\ttemp += '\">' + getMessage('show') + '</input>&nbsp;&nbsp;';\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttemp += 'display:none\"></input>';\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} \t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// hide \n\t\t\t\t\t\t\ttemp += '<input name=\"showSelectValueAction_' + fldObj.table_name + '.' + fldObj.field_name + '\" type=\"radio\" onclick=\"getFieldValues()\" value=\"false\" ';\n\t\t\t\t\t\t\tif (fldObj.hasOwnProperty('showSelectValueAction') ){\t\t// for new view\n\t\t\t\t\t\t\t\tif (fldObj.showSelectValueAction == false) {\n\t\t\t\t\t\t\t\t\ttemp += 'checked=\"checked\"';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttemp += 'style=\"';\n\t\t\t\t\t\t\tif ((fldObj['primary_key'] == 0) && pattern.match(/editform/) && (index == (numberOfTblgrps - 1))) {\n\t\t\t\t\t\t\t\ttemp += '\">' + getMessage('hide') + '</input>';\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttemp += 'display:none\"></input>';\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t\t\tnew_td.innerHTML = temp;\n new_tr.appendChild(new_td);\n\t\t\t\t\t\t\t*/\n\t\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t \n // add extra column\n var new_td = document.createElement('td');\n new_td.innerHTML = fldObj['is_virtual'];\n new_td.sql = fldObj['sql'];\n new_tr.appendChild(new_td);\n \n // add the \"Remove\", \"Up\", and \"Dn\" buttons\n var new_td = document.createElement('td');\n new_td.setAttribute(\"nowrap\", \"nowrap\");\t\n createButton(\"Remove\", \"removeRow\", getMessage(\"remove\"), \"selectedFields\", new_td);\n createButton(\"Up\", \"moveUp\", getMessage(\"up\"), \"selectedFields\", new_td);\n createButton(\"Down\", \"moveDown\", getMessage(\"dn\"), \"selectedFields\", new_td);\n if(fldObj.afm_type == 'Virtual Field'){\n \tcreateButton(\"Edit\", \"editVirtualField\", getMessage(\"edit\"), \"selectedFields\", new_td); \t\n }\n new_tr.appendChild(new_td);\n \t\t\t\t\t\t\t \n // add extra column\n var new_td = document.createElement('td');\n new_tr.appendChild(new_td);\n \n // add to summary table\n tBody.appendChild(new_tr);\n }\n }\n break;\n \n case \"page4c\":\n \n // if \"Set Sort Order\" (aka \"Set Grouping\") tab was selected, create the summary table \n onLoadSortSummary();\n \n // set primary keys as default\n if(pattern.match(/ab-viewdef-report|edit/gi) && !(pattern.match(/edit/) && (index == view.tableGroups.length-1))){\n \tsetPKeysAsSortDefaults();\n }\n \n break;\n \n case \"page4d\":\n // if \"Add Standard\" was selected\n\t\t\t\t\t\t\t \n\t\t\t\t\t// only show button if drawing pattern\n\t\t\t\t\tif (pattern.match(/paginated-highlight/gi)){\n\t\t\t\t\t\t$('showOnlyHightlightsPkeys').style.display = '';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('showOnlyHightlightsPkeys').style.display = 'none';\n\t\t\t\t\t}\n\n\t\t\t\t\t// if index had been used, reset to show top level\n var grid = Ab.view.View.getControl('', 'field_grid');\n\t\t\t\t\tgrid.enableSelectAll(false);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tif (grid.indexLevel > 0){\n\t\t\t\t\t\tgrid.indexLevel = 0;\n\t\t\t\t\t\tgrid.refresh();\n\t\t\t\t\t}\n\n\t\t\t\t\t// check checkboxes of previously selected standards\n\t\t\t\t\tcheckStandards();\n\t\t\t\t\t\n break;\n \n case \"page4e\":\n // if \"Set Restriction\" tab was selected\n \n // display button text (for localization)\n $('addButton').value = getMessage(\"add\");\n \n // set up the restriction form\n loadRestrictionForm();\n \n // get restrictions from view object\n var index = view.tableGroups.length - tabsFrame.selectedTableGroup - 1;\n var restrictions = view.tableGroups[index].parsedRestrictionClauses;\n \n // if previously selected restrictions exist, display them in a summary table\n if (restrictions != undefined) {\n resetTable('restrictionSummary');\n for (j = 0; j < restrictions.length; j++) {\n var field = restrictions[j].table_name + \".\" + restrictions[j].field_name;\n var relop = restrictions[j].relop;\n var value = restrictions[j].value;\n var op = restrictions[j].op;\n createRestrictionSummary(relop, field, op, value);\n }\n }\n \n break;\n \n case \"page4f\":\n\n\t\t\t\t\t// if \"Set Options\" tab was selected\n\t\t\t\t\tvar index = view.tableGroups.length - tabsFrame.selectedTableGroup - 1;\n\t\t\t\t\tvar summaryPanel = Ab.view.View.getControl('', 'statsOptionsPanel');\n\t\t\t\t\tvar panel_title = view.tableGroups[index].title;\n\t\t\t\t\t\n\t\t\t\t\t// display button text (for localization)\n\t\t\t\t\t$('panelTitle').value = getMessage('panelTitle');\n\t\t\t\t\t\n\t\t\t\t\t// if a panel title exists, show title\n\t\t\t\t\tif (panel_title != undefined) {\n\t\t\t\t\t\t$('panelTitle').value = replaceXMLAmp(panel_title);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar numberOfTblgrps = Number(tabsFrame.tablegroupsRestriction);\n\t\t\t\t\tif((pattern.match(/editform|columnreport/) && (index == (numberOfTblgrps - 1))) || (pattern.match(/editform-drilldown-console/) && (index == 0))){\n\t\t\t\t\t\t$('numberOfColumns').style.display = \"\";\t\t\t\t\t\t\t\n\t\t\t\t\t\tdisplayNumberOfColumns();\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$('numberOfColumns').style.display = \"none\";\n\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t// get statistics and chart options panels\n\t\t\t\t\tvar statsOptionsPanel = Ab.view.View.getControl('', 'statsOptionsPanel');\n\t\t\t\t\tvar chartOptionsPanel = Ab.view.View.getControl('', 'chartOptionsPanel');\n\t\t\t\t\tvar paginatedOptionsPanel = Ab.view.View.getControl('', 'paginatedOptionsPanel');\n\t\t\t\t\tvar columnReportOptionsPanel = Ab.view.View.getControl('', 'columnReportOptionsPanel');\n\t\t\t\t\t\n\t\t\t\t\t// get list of field objects from view object\n\t\t\t\t\tvar fields = view.tableGroups[index].fields;\n\t\t\t\t\t\n\t\t\t\t\t// if fields were not selected for this tablegroup, warn and go back to summary tab\t\t\t\t\t\n\t\t\t\t\tif (fields == undefined) {\n\t\t\t\t\t\talert(getMessage(\"noFields\"));\n\t\t\t\t\t\tmyTabsFrame.selectTab('page4a');\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\n\t\t\t\t\t\t// otherwise, explicity reset/delete all rows from the summary table \n\t\t\t\t\t\tresetTable('measuresSummary');\n\n\t\t\t\t\t\t// redraw the summary table per selected tablegroup's field specifications\n\t\t\t\t\t\tcreateMeasuresSummaryTable(view, index);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t// check checkboxes\n\t\t\t\t\t\tmarkSelectedMeasures(view, index);\n\t\t\t\t\t\t\n\t\t\t\t\t\t// for redisplaying\n\t\t\t\t\t\t$('measuresSummary').style.display = \"\";\n\t\t\t\t\t\t$('enableDrilldownTable').style.display = \"\";\n\t\t\t\t\t\t$('paginatedPanelOptions').style.display = \"none\";\n\t\t\t\t\t\t\n\t\t\t\t\t\t// if paginated, hide the enable drilldown option and show the paginated options panel\n\t\t\t\t\t\tif (pattern.match(/paginated/gi)) {\t\t\t\t\t\t\n\t\t\t\t\t\t\t$('enableDrilldownTable').style.display = \"none\";\n\t\t\t\t\t\t\t$('paginatedPanelOptions').style.display = \"\";\n\t\t\t\t\t\t\tvar curTgrp = view.tableGroups[index];\n\t\t\t\t\t\t\tif (hasSummarizeBySortOrder(curTgrp) || (pattern.match(/paginated-stats-data/gi) && index == 0) ){\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t$('summarizeBySortOrder').checked = true;\n\t\t\t\t\t\t\t\t// $('measuresSummary').style.display = \"\";\n\t\t\t\t\t\t\t\tshowStatisticsColumns('', '')\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$('summarizeBySortOrder').checked = false;\n\t\t\t\t\t\t\t\tshowStatisticsColumns('', 'none')\n\t\t\t\t\t\t\t\t// $('measuresSummary').style.display = \"none\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// check box as disabled\n\t\t\t\t\t\t\tif(pattern.match(/paginated-stats-data/gi) && index == 0){\n\t\t\t\t\t\t\t\t$('summarizeBySortOrder').disabled= true;\n\t\t\t\t\t\t\t\t// set property\n\t\t\t\t\t\t\t\tsetPaginatedPanelProperty('summarizeBySortOrder', 'summarizeBySortOrder');\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$('summarizeBySortOrder').disabled= false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t// don't allow statistics or summarizebysortorder for drawings\n\t\t\t\t\t\t\tif(pattern.match(/paginated-highlight-restriction/gi)){\n\t\t\t\t\t\t\t\t$('summarizeBySortOrder').checked = false;\n\t\t\t\t\t\t\t\t$('measuresSummary').style.display = \"none\";\n\t\t\t\t\t\t\t\t$('summarizeBySortOrderOption').style.display = \"none\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$('measuresSummary').style.display = \"\";\n\t\t\t\t\t\t\t\t$('summarizeBySortOrderOption').style.display = \"\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(pattern.match(/highlight-restriction/gi) || pattern.match(/paginated-parent|paginated-highlight-thematic/gi) && ($('summarizeBySortOrder').checked == false)){\n\t\t\t\t\t\t\t// if(pattern.match(/paginated-parent/gi) && (index != (numberOfTblgrps-1)) && ($('summarizeBySortOrder').checked == false)){\n\t\t\t\t\t\t\t\t$('measuresSummary').style.display = \"none\";\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t$('measuresSummary').style.display = \"\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (!curTgrp.hasOwnProperty('paginatedPanelProperties')){\n\t\t\t\t\t\t\t\tcurTgrp.paginatedPanelProperties = new Object();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvar paginatedPanelProperties = curTgrp.paginatedPanelProperties;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (paginatedPanelProperties.hasOwnProperty('pageBreakBefore')) {\n\t\t\t\t\t\t\t\t$('pageBreakBefore').value = paginatedPanelProperties.pageBreakBefore;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (paginatedPanelProperties.hasOwnProperty('format')) {\n\t\t\t\t\t\t\t\tif (paginatedPanelProperties.format == 'table'){\n\t\t\t\t\t\t\t\t\t$('groupBandFormat').value = paginatedPanelProperties.format + '-';\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t$('groupBandFormat').value = paginatedPanelProperties.format + '-' + paginatedPanelProperties.column;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\t} \n }\n \n // if a viewType was specified\t\t \n if (viewType != \"undefined\") {\n \n // if view is a summary report and the selected tablegroup is data tablegroup \n // if ((viewType.match(/summaryReports|paginated/gi)) && (tabsFrame.selectedTableGroup == 0)) {\n if ((viewType.match(/summaryReports/gi) && (tabsFrame.selectedTableGroup == 0)) || pattern.match(/chart-2d/gi) || (pattern.match(/paginated/gi))) { \n // if it is a statistics report, show only stats options and explicity hide chart options \n if (!pattern.match(/chart/)) {\n chartOptionsPanel.show(false);\n statsOptionsPanel.show();\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\tif (pattern.match(/paginated-highlight/gi) && (index != 2) ){\n\t\t\t\t\t\t\t\t\t// only show the statsOptionsPanel for legend data band\n \tchartOptionsPanel.show(false);\n \tstatsOptionsPanel.show(false);\n \tpaginatedOptionsPanel.show();\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n \t\telse \n \t\t*/\n\t\t\t\t\t\t\t\tif (pattern.match(/paginated/)) {\n \tchartOptionsPanel.show(false);\n \tstatsOptionsPanel.show();\n \tpaginatedOptionsPanel.show();\n \t} else {\n \tpaginatedOptionsPanel.show(false);\n \t}\n\n } \n \n else {\n // if not first tgrp in 2d chart, show both panels\n if(!(pattern.match(/summary-chart-2d/gi) && (tabsFrame.selectedTableGroup == 1))){ \n \tchartOptionsPanel.show();\n }\n statsOptionsPanel.show();\n \n\t\t\t\t\t\t\t\t// reset chart options in form\n\t\t\t\t\t\t\t\tresetChartOptions();\n\t\t\t\t\t\t\t\t\n // get chart properties\n var chartProperties = view.chartProperties;\n \n // check or uncheck \"Enable Chart Drilldown\" option based on configuration\n if (view.enableChartDrilldown == true) {\n $('drilldown').checked = true;\n }\n else {\n $('drilldown').checked = false;\n }\n \n // if chart properties have been specified\n if (chartProperties != null) {\n \n // display selected chart properties\n for (var i in chartProperties) {\n\t\t\t\t\t\t\t\t\t\tif (chartProperties.hasOwnProperty(i)) {\n\t\t\t\t\t\t\t\t\t\t\tvar propertyObj = $(i);\n\t\t\t\t\t\t\t\t\t\t\t// code for filling in properties displayed in a select box\n\t\t\t\t\t\t\t\t\t\t\tif (propertyObj.type.match(/select/)) {\n\t\t\t\t\t\t\t\t\t\t\t\tvar options = propertyObj.options;\n\t\t\t\t\t\t\t\t\t\t\t\tfor (var x = 0; x < options.length; x++) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (chartProperties[i].match(options[x].value)) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpropertyObj.selectedIndex = x;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\t\t// code for displaying height and width properties which has a '%'\n\t\t\t\t\t\t\t\t\t\t\t\tvar value = chartProperties[i];\n\t\t\t\t\t\t\t\t\t\t\t\tvar strValue = String(chartProperties[i]);\n\t\t\t\t\t\t\t\t\t\t\t\tvar last_char = strValue.substring(strValue.length - 1, strValue.length);\n\t\t\t\t\t\t\t\t\t\t\t\tif ((i == 'width') || (i == 'height')) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (last_char == '%') {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar temp = strValue.substring(0, value.length - 1);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpropertyObj.value = Number(temp);\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\telse {\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t// otherwise, just display the value as-is\n\t\t\t\t\t\t\t\t\t\t\t\t\tpropertyObj.value = value;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n }\n \n // display the autoCalculateTickSizeInterval property depending upon certain conditions\n // var autocalc = $('autoCalculateTickSizeInterval');\n // toggleRelatedProperty('autoCalculateTickSizeInterval', autocalc.options[autocalc.selectedIndex].value)\n }\n \n\t\t\t\t\t\t\t\t\t\t\t\t// show totals and counts for edit and report forms\n\t\t\t\t\t\t\t\t\t\t\t\t}else if(!hasFieldsWithSameName(view.tableGroups[index].fields) && (pattern.match(/ab-viewdef-report/) || (pattern.match(/editform/)) && (pattern.match(/editform-drilldown-popup/gi) || (index != (numberOfTblgrps-1)) ) )){\n \t statsOptionsPanel.show(true);\n \t showStatisticsColumns('', 'none');\n \t $('enableDrilldownTable').style.display = \"none\";\n }else{\n \n // if view is not a summary report or if the tableggroup is not data group, hide stats and chart options \n chartOptionsPanel.show(false);\n statsOptionsPanel.show(false);\n paginatedOptionsPanel.show(false);\n }\n }\n \n if (((viewType == 'columnReports') && (index == (numberOfTblgrps-1)))){\n \t$('columnReportSummary').style.display = '';\n \tresetTable('columnReportSummary');\n \tcreateColumnReportSummaryTable(view, index);\n } else {\n \t$('columnReportSummary').style.display = 'none';\n }\t\n \n // only show action button options for report views\n var actionsPanel = Ab.view.View.getControl('', 'actionOptionsPanel');\n actionsPanel.show( ((viewType == 'reports') || ((viewType == 'summaryReports')) && (index == (numberOfTblgrps-1))) );\n var bDataTgrp = (index == numberOfTblgrps - 1) ? true : false;\n showSelectedActionOptions(view.actionProperties[index], index, bDataTgrp);\n \n \n }\n }\n}", "handleSelectTab(event) {\n event.preventDefault();\n this.setState({\n tabId: event.currentTarget.id, // Change state to load different month\n shouldRedraw: false,\n as: `/elections?tab=${event.currentTarget.id}&election=${this.state.electionId}`,\n })\n\n history.pushState(this.state, '', `/elections?tab=${event.currentTarget.id}&election=${this.state.electionId}`) // Push State to history\n trackEvent('Elections', `Changed Tab to ${event.currentTarget.id}`) // Track Event on Google Analytics \n }", "function toggleFormTab() {\n\tvar $calcForm = $('.calc-form');\n\n\tif ($calcForm.length) {\n\n\t\t$calcForm.on('click', ':radio', function () {\n\t\t\tvar $this = $(this);\n\n\t\t\tvar $thisCalcForm = $this.closest($calcForm);\n\n\t\t\t$thisCalcForm.find(\".\" + $this.attr('name')).hide(0);\n\t\t\t$thisCalcForm.find(\".\" + $this.val()).show(0);\n\t\t})\n\n\t}\n}", "function onTab(cb) {\n\tvar innerPage = $('.inner-page');\n\tinnerPage.keydown(function(e){\n\t\tif (e.keyCode == 9) {\n\t\t\te.preventDefault();\n\t\t\tcb();\n\t\t}\n\t}) ;\n}", "function hookform()\n\t{\n\t\tvar disablebtn = document.getElementById(\"disable\");\n\t\tdisablebtn.addEventListener(\"click\",\n\t\t\t\tfunction(event)\n\t\t\t\t{\n\t\t\t disable();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t);\n\t\t\n\t\tvar capturebtn = document.getElementById(\"capture\");\n\t\tcapturebtn.addEventListener(\"click\",\n\t\t function(event)\n\t\t {\n\t\t\t capture();\n\t\t }\n\t\t );\n\t\t\n\t\t\n\t\tvar monitorbtn = document.getElementById(\"monitor\");\n\t\tmonitorbtn.addEventListener(\"click\",\n\t\t function(event)\n\t\t {\n\t\t\t monitor();\n\t\t }\n\t\t);\n\t\t\n\t}", "Navigate(_, src) {\n if (src.tab && src.tab.id) {\n onTabUpdate(src.tab.id, src.tab);\n }\n }", "function onFBTabSwitchRequested() {\n browser.tabs.query({ active: true }).then((tabs) => {\n let idActivate;\n if (tabs[0].id !== idFB) {\n idPrevious = tabs[0].id;\n idActivate = idFB;\n } else {\n idActivate = idPrevious;\n }\n\n browser.tabs.update(idActivate, {\n active: true,\n });\n });\n}", "onNewTab(){\n console.log(\"onNewTab\");\n\n Session.set('selectedPatient', false);\n Session.set('patientDetailState', false);\n }", "_bindEvents() {\n this.$scope.on('click.bc-tabs', this.options.tabToggle, (event) => {\n event.preventDefault();\n const hash = $(event.target).attr('href');\n\n this.activateTab(hash);\n\n if (this.options.tabHistory) {\n history.pushState({}, hash, hash);\n } else {\n history.replaceState({}, hash, hash);\n }\n });\n\n $(window).on('hashchange.bc-tabs', () => {\n this.activateTab(window.location.hash);\n });\n\n $(window).on('resize.bc-tabs', debounce(() => {\n this._init(true);\n }, 300));\n }", "function on_form_loaded() {\n Survana.Storage.Get(context, function (result) {\n context = result;\n context.current |= 0; //convert 'current' to a number\n set_progress(context.current, context.workflow.length);\n }, on_storage_error);\n }", "function onLoadEvent(e){\n\t\t\tconsole.log('in tab load event handler');\n\t\t\topenManager(true);\n\t\t}", "function activeTabChanged(activeInfo) {\n if (activeInfo) {\n var tabId = activeInfo.tabId;\n if (tabId) {\n getCurrentTabUrl();\n }\n }\n}", "function tabLoad() {\n // Tab load safety check\n if (tabHasLoaded) {\n return;\n }\n tabHasLoaded = true;\n\n setupPage();\n\n getAlerts();\n }", "function wireUpTabs() {\n var tabEl = document.getElementById('sidebar_switch');\n var children = tabEl.childNodes;\n\n // Each tab has a class corresponding of the id of its tab pane\n for (var i = 0, l = children.length; i < l; i += 1) {\n // Ignore text nodes\n if (children[i].nodeType !== 1) continue;\n children[i].addEventListener('click', function(c) {\n return function() { switchTab(c); };\n }(children[i].className));\n }\n}", "function onHashChange() {\n\tconst method = location.hash.startsWith('#page=revisions&') ? 'show' : 'hide';\n\t$.fn[method].call($DIFF_BUTTONS);\n\n\tif (method == 'show' && DIFF) {\n\t\tDIFF.refreshDiffButtons();\n\t}\n}", "function notifyOfChanges(tabs) {\n // Iterate through all the given tabs\n for (let tab of tabs) {\n // Send a message to the tabs to indicate the content scripts the status of the extension\n if (typeof browser !== 'undefined' && (typeof browser.runtime !== 'undefined' && browser.runtime != null)) {\n browser.tabs.sendMessage(\n tab.id,\n { \"operation\": \"yorStatusChanged\", \"currentStatus\": currentStatus }\n );\n } else if (typeof chrome !== 'undefined' && (typeof chrome.runtime !== 'undefined' && chrome.runtime != null)) {\n chrome.tabs.sendMessage(\n tab.id,\n { \"operation\": \"yorStatusChanged\", \"currentStatus\": currentStatus }\n );\n }\n \n }\n}", "async updateTabs() {\r\n // Make sure the selected tab ID is valid\r\n let tab = await this.getTab(this.state.selectedTabID);\r\n if (!tab) {\r\n tab = this.state.tabs.find(tab => tab.visible);\r\n if (tab)\r\n await this.selectTab(tab.ID);\r\n }\r\n // Only show the tabs if multiple tabs are opened\r\n const shouldShowTabs = this.state.tabs.length > 1;\r\n if (this.state.tabsVisible != shouldShowTabs) {\r\n this.changeState({\r\n tabsVisible: shouldShowTabs,\r\n });\r\n }\r\n }", "registerEvents() {\n /*\n * Activate or Open the Overview tab when extension action is clicked\n * This calls the openBomTab with tabs.tab as parameter.\n * If the browser action is clicked from the overview or eBay tab, then\n */\n browser.browserAction.onClicked.addListener(tab => {\n this.browserActionClickedHandler(tab)\n .then()\n .catch(e => {console.log(\"Biet-O-Matic: BrowserActionClicked error: %s\", e)});\n });\n\n // handle browser close / restart\n browser.windows.onRemoved.addListener(this.windowsOnRemovedHandler);\n\n //runtime extension install listener\n browser.runtime.onInstalled.addListener(this.runtimeOnInstalledHandler);\n }", "function tabUpdated(id, info, tab) {\n if (tab.url.toLowerCase().indexOf(\"youtube.com\") > -1) { // Any page with youtube.com at the start is valid for the extention\n chrome.pageAction.show(tab.id);\n }\n }", "function ajaxForm(form, tab) {\n form.on('submit', function(e) {\n if (!validateForm(form))\n return false;\n $.ajax({\n url: $(this).attr('action')+'?ajax=true',\n method: 'post',\n data: $(this).serialize()+'&'+buildAssociationHref(tab).substring(1),\n success: function(htmlForm) {\n tab.find('.ajax-form').remove();\n tab.find('.ajax-content').show();\n reloadTab(tab);\n },\n error: handleError\n });\n return false;\n });\n}", "function visChange() {\n if (!isHidden()) {\n console.log(\"Tab gains focus\");\n callback();\n }\n }", "function handleUpdated(tabId, changeInfo) {\n // alert(\"Tab: \" + tabId + \" is updated \\n Status: \" \n // \t+ changeInfo.status + \"\\nTitle: \" + changeInfo.title + \"\\n URL: \" + changeInfo.url );\n}", "function onSelectedChange() {\n if (onSelectedChange.queued) return;\n onSelectedChange.queued = true;\n\n $scope.$evalAsync(function() {\n $scope.$broadcast(EVENT.TABS_CHANGED, selected);\n onSelectedChange.queued = false;\n });\n }", "onTabOpened(aTab, aFirstTab, aOldTab) {\n if (aTab.mode.name == \"folder\" || aTab.mode.name == \"glodaList\") {\n let modelTab = this.tabmail.getTabInfoForCurrentOrFirstModeInstance(\n aTab.mode\n );\n let oldFilterer =\n modelTab && \"quickFilter\" in modelTab._ext\n ? modelTab._ext.quickFilter\n : undefined;\n aTab._ext.quickFilter = new QuickFilterState(oldFilterer);\n this.updateSearch(aTab);\n this._updateToggle(aTab);\n }\n }", "function onPageLoad (tabId) {\r\n // capture a preview image if a new page has been loaded\r\n if (tabId === tabs.getSelected()) {\r\n setTimeout(function () {\r\n // sometimes the page isn't visible until a short time after the did-finish-load event occurs\r\n captureCurrentTab()\r\n }, 100)\r\n }\r\n}", "function reloadActiveTabs() {\n\t\n\tvar formJsonData = null;\n\tif (dojo.byId(\"historyWritersJsonFormData\")) {\n\t\tformJsonData = \"historyWritersJsonFormData\";\n\t} else if (dojo.byId(\"historyWritersJsonFormData\")) {\n\t\tformJsonData = \"historyWritersJsonFormData\";\n\t}\n\n\ttry {\n\tdojo.parser.parse(\"referralHistInfo\");\n\t} catch (e) {}\n\tfnConvertHistoryJsonToTab(formJsonData, \"referralHistInfo\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"RefRel\"), false, 'strRefRel_Other', 'strRefRelOthLblWrp');\n\tinitializeReferralReasonsOtherFlds();\n\ttry {\n\tdojo.parser.parse(\"personalHistInfo\");\n\t} catch (e) {}\n\tfnConvertHistoryJsonToTab(formJsonData, \"personalHistInfo\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"rel_stat\"), false, \"rel_statOther\", \"mrtOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"LivingArrangeType\"), false, \"strLivingArrangeType_Other\", \"curLivArngOthLblWrp\");\n\n\ttry {\n\tdojo.parser.parse(\"languageSocialHistInfo\");\n\t} catch (e) {}\n\tfnConvertHistoryJsonToTab(formJsonData, \"languageSocialHistInfo\");\n\tinitializeDefaultRadioSelectionValues('LengthEnglishExposure');\n\tinitializeDefaultRadioSelectionValues('LengthEnglishSpoken');\n\tinitializeDefaultRadioSelectionValues('ObservedEnglish');\n\tinitializeDefaultRadioSelectionValues('Milestones_');\n\tinitializeLoopRadioSelections(dojo.byId(\"LengthEnglishExposure\"), \"strLengthEnglishExposure\", \"strLengthEnglishExposure_OtherWrp\");\n\tinitializeLoopRadioSelections(dojo.byId(\"LengthEnglishSpoken\"), \"strLengthEnglishSpoken_Other\", \"strLengthEnglishSpoken_OtherWrp\");\n\tinitializeLoopRadioSelections(dojo.byId(\"Milestones_Other\"), \"strMilestones_Other\", \"strMilestones_Other_Wrp\", 0, false);\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"DevelopmentAccord\"), false, 'strDevelopmentAccord_Other', 'strDevelopmentAccord_OtherWrp');\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"Birth_Other\"), false, 'strPregBirth_Other', 'Birth_Other', 'strPregBirth_OtherWrp');\n\n\ttry {\n\tdojo.parser.parse(\"educationHistInfo\");\n\t} catch (e) {}\n\tfnConvertHistoryJsonToTab(formJsonData, \"educationHistInfo\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"ed_level\"), false, \"ed_levelOther\", \"exmEduOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"EducMother\"), false, \"EducMother_Other\", \"mthEduOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"EducFather\"), false, \"EducFather_Other\", \"fthEduOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"SchoolPlacement\"), false, \"SchoolPlacement_Other\", \"schPlaceOthLblWrp\");\n\tcheckIfEducationCompletionRequired(dojo.byId(\"ed_level\"), 'EducProgComp');\n\tcheckIfEducationCompletionRequired(dojo.byId(\"EducMother\"), 'EducProgCompMother');\n\tcheckIfEducationCompletionRequired(dojo.byId(\"EducFather\"), 'EducProgCompFather');\n\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"SchoolAttendCurrent\"), false, \"SchoolAttendCurrent_Other\", \"schCurAtndOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"SchoolDiffCurrent\"), false, \"SchoolDiffCurrent_Other\", \"schDifOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"SchoolAttendPast\"), false, \"SchoolAttendPast_Other\", \"schPrvAtndOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"SchoolDiffPast\"), false, \"SchoolDiffPast_Other\", \"schPrvDifOthLblWrp\");\n\t\n\tinitializeDefaultRadioSelectionValues('AchieveTestRecent');\n\tinitializeDefaultRadioSelectionValues('AchieveTestPast');\n\tinitializeLoopRadioSelections(dojo.byId(\"AchieveTestRecent_Other\"), \"strAchieveTestRecent_Other\", \"strAchieveTestRecent_Other_Wrp\", 0, false);\n\tinitializeLoopRadioSelections(dojo.byId(\"AchieveTestPast_Other\"), \"strAchieveTestPast_Other\", \"strAchieveTestPast_Other_Wrp\", 0, false);\n\t\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"FreqSchoolChange\"), false, \"FreqSchoolChange_Other\", \"schChngOthLblWrp\");\n\tmanageChkBoxRelatedAcrdToOtherField(dojo.byId(\"EducAccord\"), false, \"EducAccord_Other\", \"schAcrdToOthLbl\", \"EducAccord_Other_Wrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"EducPreKindergarten\"), false, \"EducPreKindergarten_Other\", \"schPreKndrOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"EducPreFirstGrade\"), false, \"EducPreFirstGrade_Other\", \"schPre1stOthLblWrp\");\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"StrengthPersonal_Other\"), false, 'strStrengthPersonal_Other', 'StrengthPersonal_Other', 'strStrengthPersonal_OtherWrp');\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"WeaknessPersonal_Other\"), false, 'strWeaknessPersonal_Other', 'WeaknessPersonal_Other', 'strWeaknessPersonal_OtherWrp');\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"WeaknessCompPeers_Other\"), false, 'strWeaknessCompPeers_Other', 'WeaknessCompPeers_Other', 'strWeaknessCompPeers_OtherWrp');\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"StrengthCompPeers_Other\"), false, 'strStrengthCompPeers_Other', 'StrengthCompPeers_Other', 'strStrengthCompPeers_OtherWrp');\n\tmanageChkBoxMultiRelatedOtherField(dojo.byId(\"LearningDis_Other1\"), false);\n\tmanageChkBoxMultiRelatedOtherField(dojo.byId(\"LearningDis_Other2\"), false);\n\tmanageChkBoxMultiRelatedOtherField(dojo.byId(\"LearningDis_Other3\"), false);\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"SchoolAcadPerformCurrent\"), false, \"SchoolAcadPerformCurrent_Other\", \"schCurPerfOthLblWrp\"); \n\tmanageChkBoxRelatedOtherField(dojo.byId(\"SchoolAcadPerformPast\"), false, \"SchoolAcadPerformPast_Other\", \"schPastPerfOthLblWrp\"); \n\n\ttry {\n\tdojo.parser.parse(\"healthHistInfo\");\n\t} catch (e) {}\n\tfnConvertHistoryJsonToTab(formJsonData, \"healthHistInfo\");\n\tmanageChkBoxRelatedAcrdToOtherField(dojo.byId(\"HealthRef\"), false, \"HealthRef_Other\", \"hthAcrdToOthLbl\", \"HealthRef_Other_Wrp\");\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"VisionScreenResult_Other\"), false, 'strVisionScreenResult_Other', 'VisionScreenResult_Other', 'strVisionScreenResult_OtherWrp');\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"HearingScreenResult_Other\"), false, 'strHearingScreenResult_Other', 'HearingScreenResult_Other', 'strHearingScreenResult_OtherWrp');\n\tmanageLoopedChkBoxRelatedOtherField(dojo.byId(\"Sensory_Other\"), false, 'strSensory_Other', 'Sensory_Other', 'strSensory_OtherWrp');\n\tmanageChkBoxMultiRelatedOtherField(dojo.byId(\"Motor_OtherFM\"), false);\n\tmanageChkBoxMultiRelatedOtherField(dojo.byId(\"Motor_OtherGM\"), false);\n\tinitializeMedicalConditions(dojo.byId(\"MedCondition_None\"), dojo.byId(\"MedCondition_Unknown\"));\n\tinitSensoryConditions(dojo.byId('Sensory_None'), 'Sensory_', 'strSensory_Other', 'strSensory_OtherWrp');\n\tinitMotorConditions(dojo.byId('Motor_None'), 'Motor_', 'strMotor_OtherGM', 'strMotor_OtherGMWrp', 'strMotor_OtherFM', 'strMotor_OtherFMWrp');\n\tif(dojo.byId('CurrentMedication') != null){\n\t\tsetCount('CurrentMedication','medCount',255);\n\t}\n\t\n\ttry {\n\tdojo.parser.parse(\"employmentHistInfo\");\n\t} catch (e) {}\n\tfnConvertHistoryJsonToTab(formJsonData, \"employmentHistInfo\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"CurrentEmployStatus\"), false, \"CurrentEmployStatus_Other\", \"empCurStsOthLblWrp\");\n\tmanageChkBoxRelatedOtherField(dojo.byId(\"PreviousEmployStatus\"), false, \"PreviousEmployStatus_Other\", \"empPrvStsOthLblWrp\");\n\tcheckIfPositionTitleRequired(dojo.byId(\"CurrentEmployStatus\"), 'CurrentJobTitle', 'CurrentJobTitleWrp');\n\tcheckIfPositionTitleRequired(dojo.byId(\"PreviousEmployStatus\"), 'PreviousJobTitle', 'PreviousJobTitleWrp');\n}", "function gestioneCambioTab(e) {\n var changedInputs = inputDaControllare.findChangedValues();\n var result = true;\n if(changedInputs.length > 0) {\n e.preventDefault();\n // Apri modale conferma cambio, passandogli il this\n apriModaleConfermaCambioTab($(this));\n result = false;\n } else {\n // Posso cambiare il tab: chiudo i messaggi di errore\n alertErrori.slideUp();\n alertInformazioni.slideUp();\n }\n return result;\n }", "function refreshCurrentTab()\n{\n jsobj.swap_tabs(XPCNativeWrapper.unwrap($(\"tabs\")).down(\".tabon\").getAttribute(\"val\"));\n}", "function respond_to_tab_click(theTab)\n\t\t{\n\t\t\tif($('div#index_error').text().indexOf(theTab) == -1){\n\t\t\t\t$('div#index_error').html(\"Please sign in or signup before entering the \" + theTab + \" page.\");\t\t\t\t\n\t\t\t\tsetTimeout(function(){$('#signin_page_signin input#username').focus()}, 1);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$('div#index_error').text('');\n\t\t\t\talert(\"Please sign in or signup before entering the \" + theTab + \" page.\");\n\t\t\t\tsetTimeout(function(){$('#signin_page_signin input#username').focus()}, 1);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t}", "function bindEvents() {\n var tabs = that._elements[\"tab\"];\n if (tabs) {\n for (var i = 0; i < tabs.length; i++) {\n (function(index) {\n tabs[i].addEventListener(\"click\", function(event) {\n navigateAndFocusTab(index);\n });\n tabs[i].addEventListener(\"keydown\", function(event) {\n onKeyDown(event);\n });\n })(i);\n }\n }\n }", "function bindEvents() {\n var tabs = that._elements[\"tab\"];\n if (tabs) {\n for (var i = 0; i < tabs.length; i++) {\n (function(index) {\n tabs[i].addEventListener(\"click\", function(event) {\n navigateAndFocusTab(index);\n });\n tabs[i].addEventListener(\"keydown\", function(event) {\n onKeyDown(event);\n });\n })(i);\n }\n }\n }", "function editTabs() {\n createAlert (\n \"Edit Tabs\",\n \"Create or Edit Section Tabs\",\n \"editTabUI\",\n \"saveEditTabs()\"\n )\n // Focus Tabs in Preview\n document.getElementById(\"previewElementFocuser\").style.display = \"inline\"\n document.getElementsByClassName(\"headerPillSelector\")[0].classList.add(\"focused\")\n}", "function registerFrameListener(browser)\n{\n if (browser.frameListener)\n return;\n\n browser.frameListener = FrameProgressListener; // just a mark saying we've registered. TODO remove!\n browser.addProgressListener(FrameProgressListener);\n\n if (FBTrace.DBG_WINDOWS)\n {\n var win = browser.contentWindow;\n FBTrace.sysout(\"-> tabWatcher register FrameProgressListener for: \"+\n Win.safeGetWindowLocation(win)+\", tab: \"+Win.getWindowProxyIdForWindow(win));\n }\n}", "function observeChangedFiles(pageDom) {\n var event = new ChangesLoadEvent();\n\n var observer = new MutationObserver(function (mutations) {\n mutations.forEach(function(mutation) {\n mutation.addedNodes.forEach(function (node) {\n console.log(node);\n if (pageDom.isChangedFilesBlock(node)) {\n event.trigger(node);\n }\n });\n });\n });\n\n var config = { attributes: true, childList: true, characterData: true };\n observer.observe(pageDom.getChangesTab(), config);\n\n return event;\n }", "function onTabFocus(tab, oldTab) {\n if (!tab) return;\n\n var pageIndex = getPageForTab(tab);\n if (!state.active || pageIndex === state.page) {\n tab.element.focus();\n } else {\n // Go to the new page, wait for the page transition to end, then focus.\n oldTab && oldTab.element.blur();\n setPage(pageIndex).then(function() {\n tab.element.focus();\n });\n }\n }", "function checkForValidFile(tabId, changeInfo, tab) {\n console.log(\"New Tab Url!\");\n console.dir(tab);\n if (_.endsWith(tab.url, \".taskmd\")) {\n chrome.pageAction.show(tabId);\n chrome.tabs.sendMessage(tabId, {\"message\": convert_to_html})\n }\n}", "_runProcessChanges() {\n // Don't run this functionality if the element has disconnected.\n if (!this.isConnected) return;\n\n store.dispatch(ui.reportDirtyForm(this.formName, this.isDirty));\n this.dispatchEvent(new CustomEvent('change', {\n detail: {\n delta: this.delta,\n commentContent: this.getCommentContent(),\n },\n }));\n }", "function tabSwitch( $tab ) {\n\n var id, content, tab;\n\n // if $tab was not set, get the tab from the query string\n if (typeof($tab) === 'undefined') {\n tab = getQ('tab').length ? getQ('tab') : null;\n if (!tab) return;\n $tab = $('#' + tab);\n }\n\n // get id and content location from the chosen tab\n id = $tab.attr('id');\n content = $tab.data('optcontent');\n\n // hide all tab content areas, show current one\n $('.opt-content').hide();\n $(content).show();\n\n // set the active tab head\n $('.opt-tab').removeClass('nav-tab-active');\n $tab.addClass('nav-tab-active').blur();\n\n if (history.pushState) {\n var stateObject = {dummy: true};;\n var url = window.location.protocol\n + \"//\"\n + window.location.host\n + window.location.pathname\n + '?page=integrity-checker_options&tab=' + id;\n\n history.pushState(stateObject, $(document).find('title').text(), url);\n }\n }", "setObserver(on = true) {\n this.$_observer && this.$_observer.disconnect()\n this.$_observer = null\n\n if (on) {\n /* istanbul ignore next: difficult to test mutation observer in JSDOM */\n const handler = () => {\n this.$nextTick(() => {\n requestAF(() => {\n this.updateTabs()\n })\n })\n }\n\n // Watch for changes to `<b-tab>` sub components\n this.$_observer = observeDom(this.$refs.content, handler, {\n childList: true,\n subtree: false,\n attributes: true,\n attributeFilter: ['id']\n })\n }\n }", "function onTabUpdate() {\n chrome.tabs.query({active: true}, function(tab) {\n chrome.tabs.executeScript(null, {\n file: \"findScript.js\"\n }, function() {\n if (chrome.runtime.lastError)\n updateBadge(\"#FF0\");\n });\n });\n}" ]
[ "0.64422375", "0.6403356", "0.63863295", "0.63695955", "0.63191646", "0.6305107", "0.6263924", "0.6246248", "0.61896276", "0.6178994", "0.6176475", "0.6140175", "0.611296", "0.609954", "0.60966235", "0.6094441", "0.6094441", "0.6094441", "0.6064102", "0.605997", "0.60373366", "0.6012866", "0.5974321", "0.59571683", "0.59502524", "0.5949161", "0.59457904", "0.5922916", "0.5914953", "0.5887083", "0.58821344", "0.58741045", "0.58421415", "0.5805153", "0.57857704", "0.5768944", "0.5753705", "0.57386726", "0.5737089", "0.5708223", "0.57069147", "0.56756073", "0.5667985", "0.5654539", "0.5648247", "0.5631742", "0.5620915", "0.5616442", "0.5616369", "0.5615514", "0.56095153", "0.55839545", "0.55653834", "0.5559649", "0.55558205", "0.5546356", "0.5543718", "0.55332965", "0.55315346", "0.5530026", "0.55290234", "0.55285233", "0.55283207", "0.5519107", "0.54969835", "0.54688877", "0.5467952", "0.5465068", "0.5457948", "0.54555786", "0.5449602", "0.5448022", "0.54429793", "0.54407626", "0.54325414", "0.5427244", "0.5426859", "0.5422027", "0.54206973", "0.5410817", "0.5401362", "0.5399961", "0.5394623", "0.53849196", "0.5383079", "0.53733724", "0.5369626", "0.53616506", "0.536049", "0.5359234", "0.5353306", "0.5353306", "0.5351922", "0.5341744", "0.5339035", "0.53380424", "0.53335965", "0.53291893", "0.5328263", "0.53189903", "0.53169864" ]
0.0
-1
receives and answers messages from content_scripts [if needed]
function handleMessage(message, sender, sendResponse) { console.log("Message received: " + message); // console.log(sender); if(message.task == 'test'){ console.log(message.task); sendResponse("test received"); }else if(message.task == 'store'){ sendResponse({msg: 'ok'}); // console.log("store msg"); // TODO check if storing was successful and answer appropriately // browser.runtime.sendMessage({'msg': 'ok'},function(response){}); require(['MVC_Controller_Managerpage'], function(controller){ controller.quickAddEntry(message.url, message.username, message.cat, message.pw, message.pws); }); }else if(message.task == 'showPW'){ // var msg = {action : "requestPW", content: "hallo"}; // sendResponse(msg); controller.requestPassword(message.url, message.entryType, message.hash, message.category); //passing sendresponse not working }else if(message.task == 'addHint'){ console.log("check"); changeBrowserAction(false); }else if(message.task =="removeHint"){ changeBrowserAction(true); }else if(message.task =="log"){ Logger.log(message.content); }else if(message.task == "decrypt"){ console.log("msg task decrypt received"); controller.decrypt(message.content, message.target); }else if(message.task == "requestAutofillPW"){ console.log("received requestAutofillPW"); browser.storage.sync.get('preferences').then((results) =>{ if(results.preferences['pref_autofill_password']){ controller.decryptWithTarget(message.password); }else{ console.log("Password autofill disabled"); } }); }else if(message.task == "open_manager"){ openBackground(); }else if(message.task == "checkAccount"){ var content = message.content; controller.checkAccount(content.username, content.url); }else if(message.task == "getCategories"){ SM.getCategories(function(results){ sendMessageToContentScript({action : "fillList", items : results}); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleMessage(request, sender, sendResponse) {\r\n console.log(\"Message from the content script: \" + sender.url + \",\" + request.command);\r\n console.log(sender);\r\n console.log(request);\r\n switch (request.command) {\r\n case \"login\":\r\n showLoginScreen();\r\n break;\r\n case \"loginSubmit\":\r\n _email = request.email; //set globals to values they filled in which are sent with every php message\r\n _password = request.password;\r\n if (!_clientID) { // sometimes the opin Errors... startup doesn't get called. Not sure why.\r\n startup();\r\n } else {\r\n login();\r\n }\r\n break;\r\n case \"startup\":\r\n startup();\r\n break;\r\n case \"optin\":\r\n optin();\r\n break;\r\n case \"install\":\r\n installStart(); //not really install, so much as first use\r\n break;\r\n case \"updateAll\":\r\n forceUpdate();\r\n break;\r\n case \"update\":\r\n updateStart();\r\n break;\r\n case \"forceSync\":\r\n forceSyncStart();\r\n \r\n break;\r\n case \"autoupdate\":\r\n if (_DEBUG) return; //don't auto update if debugging\r\n updateFromOpsStart();\r\n break;\r\n case \"renametest\":\r\n renametest();\r\n break;\r\n case \"printtree\":\r\n printtree();\r\n break;\r\n case \"register\":\r\n showRegisterScreen();\r\n break;\r\n case \"registerSubmit\":\r\n sendResponse(\"Creating account \" + request.email + \"<br>\");\r\n createAccount(request.email, request.password);\r\n break;\r\n case \"logout\":\r\n logout();\r\n break;\r\n case \"forgotpassword\":\r\n showResetPasswordScreen();\r\n break;\r\n case \"resetPassword\":\r\n resetPassword(request); //contact servers\r\n break;\r\n case \"resendvalidation\":\r\n resendvalidation();\r\n break;\r\n case \"forceValidate\":\r\n forceValidate();\r\n break;\r\n case \"showregisterscreen\":\r\n showRegisterScreen();\r\n break;\r\n case \"clearall\":\r\n clearall();\r\n break;\r\n case \"rebuildBookmarks\":\r\n sendStatus(\"rebuild bookmarks\");\r\n rebuildBookmarks();\r\n break;\r\n case \"rebuildServerBookmarks\":\r\n sendStatus(\"rebuildServer\");\r\n sendToPhp(\"rebuildServer\");\r\n break;\r\n case \"removeDuplicates\":\r\n sendStatus(\"removing duplicate bookmarks and merging duplicate folders\");\r\n removeDuplicates();\r\n break;\r\n case \"compareall\":\r\n getDBbs();\r\n break;\r\n case \"runtest\":\r\n test1();\r\n break;\r\n case \"processOpsToServer\":\r\n sendStatus(\"processing \" + _opsToServer.length + \" operations.\");\r\n processOpsToServer();\r\n break;\r\n case \"test4\":\r\n test4();\r\n break;\r\n case \"requestCount\":\r\n sendResponse(count(_localTreeAssoc));\r\n break;\r\n case \"deleteTables\":\r\n deleteTablesStart();\r\n break;\r\n case \"cleanup\":\r\n sendToPhp(\"cleanup\");\r\n break;\r\n }\r\n}", "function messagePageScript() {\n window.postMessage({\n direction: \"from-content-script\",\n message: \"Message from the content script\"\n }, \"https://mdn.github.io\");\n}", "function handleAddonMessage (request, sender, sendResponse) {\n try{ // Use a try catch structure, as any exception will be caught as an error response to calling part\n\tlet source = request.source;\n\tif (source == \"background\") { // Ignore message from other sidebars\n\t // When coming from background:\n\t // sender.url: moz-extension://28a2a188-53d6-4f91-8974-07cd0d612f9e/_generated_background_page.html\n\t // When coming from sidebar:\n\t // sender.url: moz-extension://28a2a188-53d6-4f91-8974-07cd0d612f9e/sidebar/panel.html\n\t let msg = request.content;\nif (options.traceEnabled) {\n console.log(\"Got message <<\"+msg+\">> from \"+request.source+\" in \"+myWindowId);\n console.log(\" sender.tab: \"+sender.tab);\n console.log(\" sender.frameId: \"+sender.frameId);\n console.log(\" sender.id: \"+sender.id);\n console.log(\" sender.url: \"+sender.url);\n console.log(\" sender.tlsChannelId: \"+sender.tlsChannelId);\n}\n\n\t if (msg == \"Ready\") { // Background initialization is ready\n\t\tbackgroundReady = true; // Signal background ready for private windows for asking curBNList\n\t\tif (waitingInitBckgnd) { // We were waiting for it to continue\nif (options.traceEnabled) {\n console.log(\"Background is Ready 2\");\n}\n\t\t f_initializeNext();\n\t\t}\n\t }\n\t else if (msg.startsWith(\"savedOptions\")) { // Option page changed something to options, reload them\n\t\t// Look at what changed\n//\t\tlet enableCookies_option_old = options.enableCookies;\n//\t\tlet enableFlipFlop_option_old = options.enableFlipFlop;\n\t\tlet advancedClick_option_old = options.advancedClick;\n\t\tlet showPath_option_old = options.showPath;\n//\t\tlet closeSearch_option_old = options.closeSearch;\n//\t\tlet noffapisearch_option_old = options.noffapisearch;\n\t\tlet reversePath_option_old = options.reversePath;\n\t\tlet rememberSizes_option_old = options.rememberSizes;\n\t\tlet searchHeight_option_old = options.searchHeight;\n//\t\tlet openTree_option_old = options.openTree;\n\t\tlet matchTheme_option_old = options.matchTheme;\n\t\tlet setColors_option_old = options.setColors;\n\t\tlet textColor_option_old = options.textColorn;\n\t\tlet bckgndColor_option_old = options.bckgndColor;\n//\t\tlet closeSibblingFolders_option_old = options.closeSibblingFolders;\n\t\tlet altFldrImg_option_old = options.altFldrImg;\n\t\tlet useAltFldr_option_old = options.useAltFldr;\n\t\tlet altNoFavImg_option_old = options.altNoFavImg;\n\t\tlet useAltNoFav_option_old = options.useAltNoFav;\n\t\tlet trashVisible_option_old = options.trashVisible;\n\t\tlet traceEnabled_option_old = options.traceEnabled;\n\n\t\t// Function to process option changes\n\t\tfunction changedOptions () {\n\t\t // If advanced click option changed, update rbkmitem_b class cursor\n\t\t if (advancedClick_option_old != options.advancedClick) {\n\t\t\tsetRBkmkItemBCursor(options.advancedClick);\n\t\t }\n\t\t // If a show path option changed, update any open search result \n\t\t if ((showPath_option_old != options.showPath)\n\t\t\t || (reversePath_option_old != options.reversePath)\n\t\t\t ) {\n\t\t\t// Trigger an update as results can change, if there is a search active\n\t\t\ttriggerUpdate();\n\t\t }\n\t\t if ((rememberSizes_option_old != options.rememberSizes)\n\t\t\t && (options.rememberSizes == false)) {\n\t\t\t// To reset the height to CSS default (\"20%\"), just set\n\t\t\tSearchResult.style.height = \"\";\n\t\t }\n\t\t if (searchHeight_option_old != options.searchHeight) {\n\t\t\tSearchResult.style.height = options.searchHeight; \n\t\t }\n\t\t // If match FF theme option changed\n\t\t if (matchTheme_option_old != options.matchTheme) {\n\t\t\tif (options.matchTheme) {\n\t\t\t // Align colors with window theme \n\t\t\t browser.theme.getCurrent(myWindowId)\n\t\t\t .then(setPanelColors);\n\n\t\t\t // Register listener\n\t\t\t browser.theme.onUpdated.addListener(themeRefreshedHandler);\n\t\t\t}\n\t\t\telse {\n\t\t\t resetPanelColors();\n\n\t\t\t // Remove listener\n\t\t\t browser.theme.onUpdated.removeListener(themeRefreshedHandler);\n\t\t\t}\n\t\t }\n\t\t // If set colors option changed, or if one of the colors changed while that option is set\n\t\t if (setColors_option_old != options.setColors\n\t\t\t || (options.setColors && ((textColor_option_old != options.textColor)\n\t\t\t\t\t\t\t\t\t || (bckgndColor_option_old != options.bckgndColor)\n\t\t\t\t \t\t\t\t\t )\n\t\t\t\t )\n\t\t\t ) {\n\t\t\tif (options.setColors) {\n\t\t\t // Align colors with chosen ones \n\t\t\t setPanelColorsTB(options.textColor, options.bckgndColor);\n\t\t\t}\n\t\t\telse { // Cannot change while machTheme option is set, so no theme to match, reset ..\n\t\t\t resetPanelColors();\n\t\t\t}\n\t\t }\n\t\t // If folder image options changed\n\t\t if ((options.useAltFldr && (altFldrImg_option_old != options.altFldrImg))\n\t\t\t || (useAltFldr_option_old != options.useAltFldr)\n\t\t\t ) {\n\t\t\tsetPanelFolderImg(options.useAltFldr, options.altFldrImg);\n\t\t }\n\t\t // If no-favicon image options changed\n\t\t if ((options.useAltNoFav && (altNoFavImg_option_old != options.altNoFavImg))\n\t\t\t || (useAltNoFav_option_old != options.useAltNoFav)\n\t\t\t ) {\n\t\t\tsetPanelNoFaviconImg(options.useAltNoFav, options.altNoFavImg);\n\t\t }\n\t\t // If BSP2 trash folder visibility changed\n\t\t if (trashVisible_option_old != options.trashVisible) {\n\t\t\tif (options.trashVisible) { // Insert BSP2 trash foder and all its children, with handling of parent twistie\n\t\t\t // Get parent of BSP2 Trash folder BN\n\t\t\t let BN = curBNList[bsp2TrashFldrBNId];\n\t\t\t let parentId = BN.parentId;\n\t\t\t let parentBN = curBNList[parentId];\n\t\t\t let parentRow = curRowList[parentId];\n\n\t\t\t // Retrieve row position where to insert.\n\t\t\t // Introduce robustness in case the BN tree is empty and index is not 0, as that seems to occur some times\n\t\t\t let children = parentBN.children;\n\t\t\t let index = BN_getIndex(BN, parentBN);\n \t\t\t if ((index == 0) || (children == undefined)) { // Insert just after parent row\n\t\t\t\t// Note that this also takes care of the case where parent had so far no child\n\t\t\t\tinsertRowIndex = parentRow.rowIndex + 1; // Can be at end of bookmarks table\n\t\t\t }\n\t\t\t else { // Insert just after previous row\n\t\t\t\tlet previousBN = BN_lastDescendant(children[index-1]);\n\t\t\t\tlet row = curRowList[previousBN.id];\n\t\t\t\tinsertRowIndex = row.rowIndex + 1; // Can be at end of bookmarks table\n\t\t\t }\n\n\t\t\t // We got the insertion point, proceed to insertion\n\t\t\t insertBkmks(BN, parentRow);\n\t\t\t}\n\t\t\telse { // Delete all BSP2 trash folder and its children, if any (with cleanup and handling od parent twistie)\n\t\t\t removeBkmks(curRowList[bsp2TrashFldrBNId], true);\n\t\t\t}\n\n\t\t\t// Trigger an update as results can change, if there is a search active\n\t\t\ttriggerUpdate();\n\t\t }\n\t\t // If trace option changed\n\t\t if (traceEnabled_option_old != options.traceEnabled) {\n\t\t\tTracePlace.hidden = !options.traceEnabled;\n\t\t }\n\t\t}\n\n\t\t// Refresh options\n\t\tif ((backgroundPage == undefined) || (backgroundPage.ready == undefined)) { // Load by ourselves\n\t\t refreshOptionsLStore()\n\t\t .then(changedOptions)\n\t\t .catch( // Asynchronous, like .then\n\t\t\tfunction (err) {\n\t\t\t let msg = \"Error on processing changedOptions : \"+err;\n\t\t\t console.log(msg);\n\t\t\t if (err != undefined) {\n\t\t\t\tlet fn = err.fileName;\n\t\t\t\tif (fn == undefined) fn = err.filename; // Not constant :-( Some errors have filename, and others have fileName \n\t\t\t\tconsole.log(\"fileName: \"+fn);\n\t\t\t\tconsole.log(\"lineNumber: \"+err.lineNumber);\n\t\t\t }\n\t\t\t}\n\t\t );\n\t\t}\n\t\telse { // Bacground page is accessible, all was loaded inside it, so get from there\n\t\t refreshOptionsBgnd(backgroundPage);\n\t\t changedOptions();\n\t\t}\n\t }\n\t else if (msg.startsWith(\"savedSearchOptions\")) { // Reload and process search options\n\t\t// Refresh options\n\t\tif ((backgroundPage == undefined) || (backgroundPage.ready == undefined)) { // Load by ourselves\n\t\t refreshOptionsLStore()\n\t\t .then(setSearchOptions)\n\t\t .catch( // Asynchronous, like .then\n\t\t\tfunction (err) {\n\t\t\t let msg = \"Error on processing changedOptions : \"+err;\n\t\t\t console.log(msg);\n\t\t\t if (err != undefined) {\n\t\t\t\tlet fn = err.fileName;\n\t\t\t\tif (fn == undefined) fn = err.filename; // Not constant :-( Some errors have filename, and others have fileName \n\t\t\t\tconsole.log(\"fileName: \"+fn);\n\t\t\t\tconsole.log(\"lineNumber: \"+err.lineNumber);\n\t\t\t }\n\t\t\t}\n\t\t );\n\t\t}\n\t\telse { // Bacground page is accessible, all was loaded inside it, so get from there\n\t\t refreshOptionsBgnd(backgroundPage);\n\t\t setSearchOptions();\n\t\t}\n\t }\n\t else if (msg.startsWith(\"resetSizes\")) { // Option page reset sizes button was pressed\n\t\t// Reset of search pane height\n\t\tSearchResult.style.height = \"\";\n\t }\n\t else if (msg.startsWith(\"notifFFReload\")) { // Signal we are manually reloading bookmarks, preventing all interaction until reload\n\t\tNotifReloadStyle.visibility = \"visible\";\n\t }\n\t else if (msg.startsWith(\"notifAutoFFReload\")) { // Signal we are reloading bookmarks, preventing all interaction until reload\n\t\tNotifAutoReloadStyle.visibility = \"visible\";\n\t }\n\t else if (msg.startsWith(\"reload\")) { // Reload ourselves\n\t\twindow.location.reload();\n\t }\n\t else if (msg.startsWith(\"asyncFavicon\")) { // Got a favicon uri to display\n\t\tlet bnId = request.bnId;\n\t\tlet uri = request.uri;\n\t\tif (backgroundPage == undefined) { // If we are in a private window, we have our own copy of curBNList\n\t\t // Maintain it up to date\n\t\t curBNList[bnId].faviconUri = uri;\n\t\t}\n\n\t\t// Set image\n\t\tlet row = curRowList[bnId]; // Retrieve row holding the icon\n//trace(\"BN.id: \"+bnId+\" index: \"+row.rowIndex+\" Row id: \"+row.dataset.id+\" uri: \"+uri);\n\t\tif (row != undefined) { // May happen on most visited and recent bookmarks when they are not yet ready\n\t\t let bkmkitem = row.firstElementChild.firstElementChild;\n\t\t let oldImg = bkmkitem.firstElementChild;\n\t\t let cn = oldImg.className;\n\t\t if (uri == \"/icons/nofavicon.png\") {\n\t\t\tif ((cn == undefined) || !cn.includes(\"nofavicon\")) { // Change to nofavicon only if not already a nofavicon\n\t\t\t let tmpElem = document.createElement(\"div\");\n\t\t\t tmpElem.classList.add(\"nofavicon\");\n\t\t\t tmpElem.draggable = false; // True by default for <img>\n\t\t\t bkmkitem.replaceChild(tmpElem, oldImg);\n\t\t\t}\n\t\t }\n\t\t else {\n\t\t\tif ((cn != undefined) && cn.includes(\"nofavicon\")) { // Change type from <div> to <img> if it was a nofavicon\n\t\t\t let tmpElem = document.createElement(\"img\"); // Assuming it is an HTMLImageElement\n\t\t\t tmpElem.classList.add(\"favicon\");\n\t\t\t tmpElem.draggable = false; // True by default for <img>\n\t\t\t tmpElem.src = uri;\n\t\t\t bkmkitem.replaceChild(tmpElem, oldImg);\n\t\t\t}\n\t\t\telse {\n\t\t\t oldImg.src = uri;\n\t\t\t}\n\t\t }\n\t\t}\n//\t\telse {\n//consolde.log(\"null row for: \"+bnId);\n//\t\t}\n\n\t\t// Call refresh search if there is one active to update any result with that BTN\n\t\trefreshFaviconSearch(bnId, uri);\n\t }\n\t else if (msg.startsWith(\"showBookmark\")) { // Demand to show a bookmark originating from BSP2 icon context menu\n\t\tlet wId = request.wId;\n\t\tlet tabId = request.tabId;\n\t\tlet bnId = request.bnId;\n\t\tif (myWindowId == wId) { // This is for us\nconsole.log(\"Received message in \"+wId+\" to show \"+bnId+\" for tab \"+tabId);\n\t\t // Use the search mode to allow coming back to normal view after show\n\t\t // This consists in disabling the searchbox and putting some text in it to reflect the action,\n\t\t // then execute a search and show for bnId\n\t\t SearchTextInput.disabled = true;\n\t\t SearchTextInput.value = \"<show bookmark for tab \"+tabId+\">\";\n\t\t enableCancelSearch();\n\t\t let bn = curBNList[bnId]; // We are protected already, by checking bnId before sending the message\n\t\t displayResults([bn]);\n\t\t let row = curRowList[bnId];\n\t\t let wasRowVisible = showRow(bnId, row);\n\t\t if (!wasRowVisible) {\n\t\t\t// If we have the options.openTree active, then we necessarily changed some folder state\n\t\t\t// => save it.\n\t\t\tif (options.openTree) {\n\t\t\t saveFldrOpen();\n\t\t\t}\n\t\t\telse { // Else show special action on context menu\n\t\t\t cursor.cell.classList.add(Reshidden); // Show special menu to open parent folders\n\t\t\t}\n\t\t }\n\t\t}\n\t }\n\t else if (msg.startsWith(\"bkmkCreated\")) { // Got a BN subtree to add to display\n\t\tbkmkCreated(BN_deserialize(request.newtree), request.index);\n\t }\n\t else if (msg.startsWith(\"bkmkRemoved\")) {\n\t\tbkmkRemoved(request.bnId);\n\t }\n\t else if (msg.startsWith(\"bkmkChanged\")) {\n\t\tbkmkChanged(request.bnId, request.isBookmark, request.title, request.url, request.uri);\n\t }\n\t else if (msg.startsWith(\"bkmkMoved\")) {\n\t\tbkmkMoved(request.bnId, request.curParentId, request.targetParentId, request.targetIndex);\n\t }\n\t else if (msg.startsWith(\"bkmkReordered\")) {\n\t\tbkmkReordered(request.bnId, request.reorderInfo);\n\t }\n\t else if (msg.startsWith(\"recentBkmkBNId\")) { // Recreated (typically on restore bookmarks), so note the id\n\t\trecentBkmkBNId = request.bnId;\n\t }\n\t else if (msg.startsWith(\"mostVisitedBNId\")) { // Recreated (typically on restore bookmarks), so note the id\n\t\tmostVisitedBNId = request.bnId;\n\t }\n\t else if (msg.startsWith(\"recentTagBNId\")) { // Recreated (typically on restore bookmarks), so note the id\n\t\trecentTagBNId = request.bnId;\n\t }\n\t else if (msg.startsWith(\"bsp2TrashFldrBNId\")) { // Recreated, so note the id\n\t\tbsp2TrashFldrBNId = request.bnId;\n\t }\n\n\t // Answer (only to background task, to not perturbate dialog between another sidebar or add-on window, and background)\n\t sendResponse(\n\t\t{content: \"Sidebar:\"+myWindowId+\" response to \"+request.source\t\t\n\t\t}\n\t );\n\t}\n }\n catch (error) {\n\tconsole.log(\"Error processing message: \"+request.content);\n\tif (error != undefined) {\n\t console.log(\"message: \"+error.message);\n\t let fn = error.fileName;\n\t if (fn == undefined) fn = error.filename; // Not constant :-( Some errors have filename, and others have fileName \n\t console.log(\"fileName: \"+fn);\n\t console.log(\"lineNumber: \"+error.lineNumber);\n\t}\n }\n}", "function sendMessageToContentJS(message, callback) {\n chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {\n chrome.tabs.sendMessage(tabs[0].id, message, callback);\n });\n}", "function onMessageRecieved(who, msgType, content) {\n\n switch(msgType) {\n case \"telepointer_info\":\n updateTelepointer(content);\n break;\n case \"inform_my_details_to_all_other_clients\":\n addNewClientToAllOccupantsDetails(content);\n updateOnlineStatusOfClients(all_occupants_details);\n\n //update the audio call button label\n updateAudioCallerBtnLabels(all_occupants_details);\n break;\n case \"disconnected\":\n alert(\"Disconnected : \" + content);\n break;\n case \"chat_room_msg\":\n addToChatRoomConversation(content);\n break;\n case \"P2P_MSG\":\n onP2pMsgReceived(content);\n break;\n case \"floor_owner_changed\":\n onFloorOwnerChanged(content);\n break;\n case \"new_floor_request\":\n onNewFloorRequest(content);\n break;\n case \"release_floor\":\n onFloorRelease(content.newFloorOwner);\n break;\n case \"remote_module_addition\":\n onRemoteModuleAddition(content);\n break;\n case \"moduleSettingsChanged\":\n onModuleSettingsChanged(content);\n break;\n case \"remote_draw\":\n remoteAddClick(content);\n break;\n case \"workflow_obj_new_link_drawn\":\n addNewLinkToWorkflowObject(content);\n break;\n case \"workflow_obj_selection_moved\":\n workflowObjSelectionMoved(content);\n break;\n case \"workflow_obj_selection_node_delete\":\n workflowObjRemoveNode(content);\n break;\n case \"workflow_obj_selection_link_delete\":\n workflowObjRemoveLink(content);\n break;\n }\n}", "function handleAddonMessage (request, sender, sendResponse) {\r\n try{ // Use a try catch structure, as any exception will be caught as an error response to calling part\r\n\t// When coming from background:\r\n\t// sender.url: moz-extension://28a2a188-53d6-4f91-8974-07cd0d612f9e/_generated_background_page.html\r\n\t// When coming from sidebar:\r\n\t// sender.url: moz-extension://28a2a188-53d6-4f91-8974-07cd0d612f9e/sidebar/panel.html\r\n\tlet msg = request.content;\r\nif (options.traceEnabled) {\r\n console.log(\"Got message <<\"+msg+\">> from \"+request.source+\" in background\");\r\n console.log(\" sender.tab: \"+sender.tab);\r\n console.log(\" sender.frameId: \"+sender.frameId);\r\n console.log(\" sender.id: \"+sender.id);\r\n console.log(\" sender.url: \"+sender.url);\r\n console.log(\" sender.tlsChannelId: \"+sender.tlsChannelId);\r\n}\r\n\r\n\tif (msg.startsWith(\"saveCurBnId\")) {\r\n\t let windowId = parseInt(request.source.slice(8), 10);\r\n\t saveCurBnId(windowId, request.bnId);\r\n\t}\r\n\telse if (msg.startsWith(\"Close:\")) { // Private window closing - De-register it\r\n\t \t\t\t\t\t\t\t\t\t // In fact, this message never comes :-(\r\n\t \t\t\t\t\t\t\t\t\t // So have to poll such pages ...\r\n\t let windowId = parseInt(msg.slice(6), 10);\r\n\t closeSidebar(windowId);\r\n\t}\r\n\telse if (msg.startsWith(\"savedOptions\")) { // Option page changed something to options, reload them\r\n\t // Look at what changed\r\n\t let pauseFavicons_option_old = options.pauseFavicons;\r\n\t let disableFavicons_option_old = options.disableFavicons;\r\n\t let enableCookies_option_old = options.enableCookies;\r\n\t let enableFlipFlop_option_old = options.enableFlipFlop;\r\n\t let advancedClick_option_old = options.advancedClick;\r\n\t let showPath_option_old = options.showPath;\r\n\t let closeSearch_option_old = options.closeSearch;\r\n\t let openTree_option_old = options.openTree;\r\n\t let noffapisearch_option_old = options.noffapisearch;\r\n\t let searchOnEnter_option_old = options.searchOnEnter;\r\n\t let reversePath_option_old = options.reversePath;\r\n\t let closeSibblingFolders_option_old = options.closeSibblingFolders;\r\n\t let rememberSizes_option_old = options.rememberSizes;\r\n\t let searchHeight_option_old = options.searchHeight;\r\n\t let setFontSize_option_old = options.setFontSize;\r\n\t let fontSize_option_old = options.fontSize;\r\n\t let setFontBold_option_old = options.setFontBold;\r\n\t let setSpaceSize_option_old = options.setSpaceSize;\r\n\t let spaceSize_option_old = options.spaceSize;\r\n\t let matchTheme_option_old = options.matchTheme;\r\n\t let setColors_option_old = options.setColors;\r\n\t let textColor_option_old = options.textColor;\r\n\t let bckgndColor_option_old = options.bckgndColor;\r\n\t let altFldrImg_option_old = options.altFldrImg;\r\n\t let useAltFldr_option_old = options.useAltFldr;\r\n\t let altNoFavImg_option_old = options.altNoFavImg;\r\n\t let useAltNoFav_option_old = options.useAltNoFav;\r\n\t let trashEnabled_option_old = options.trashEnabled;\r\n\t let trashVisible_option_old = options.trashVisible;\r\n\t let traceEnabled_option_old = options.traceEnabled;\r\n\t refreshOptionsLStore()\r\n\t .then(\r\n\t\tfunction () {\r\n\t\t let SFSChanged;\r\n//\t\t let FSChanged;\r\n\t\t let SSSChanged;\r\n//\t\t let SSChanged;\r\n\t\t if (pauseFavicons_option_old != options.pauseFavicons) {\r\n\t\t\tif (options.pauseFavicons) {\r\n\t\t\t // Stop queued favicon fetching\r\n\t\t\t faviconWorkerPostMessage({data: [\"stopfetching\"]});\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t // Rescan tree to trigger fetching favicon, and save it\r\n\t\t\t countBookmarks = countFolders = countSeparators = countOddities = countFetchFav = countNoFavicon = 0;\r\n\t\t\t scanBNTree(rootBN, faviconWorkerPostMessage);\r\n\t\t\t}\r\n\t\t\t// Signal to others the change in option\r\n\t\t\tsendAddonMessage(\"savedOptions\");\r\n\t\t }\r\n\t\t else if (disableFavicons_option_old != options.disableFavicons) {\r\n\t\t\t// Stop queued favicon fetching\r\n\t\t\tfaviconWorkerPostMessage({data: [\"stopfetching\"]});\r\n\r\n\t\t\t// Rescan tree to either clear favicons or trigger fetching them, and save it\r\n\t\t\tcountBookmarks = countFolders = countSeparators = countOddities = countFetchFav = countNoFavicon = 0;\r\n\t\t\tscanBNTree(rootBN, faviconWorkerPostMessage);\r\n\t\t\tsaveBNList();\r\n\r\n\t\t\t// Change to DFF requires a full reload of all sidebars\r\n\t\t\tsendAddonMessage(\"reload\");\r\n\t\t }\r\n\t\t else if ((SFSChanged = (setFontSize_option_old != options.setFontSize))\r\n\t\t\t \t || (fontSize_option_old != options.fontSize)\r\n\t\t \t\t ) {\r\n\t\t\tif ((SFSChanged && !options.setFontSize\r\n\t\t\t\t\t\t\t&& (fontSize_option_old != DfltFontSize)\r\n\t\t\t\t)\t\t\t\t// SFS changed state to unset, refresh only if FS changed\r\n\t\t\t\t|| !SFSChanged\t// Only the fontSize changed, which can happen only when SFS is set\r\n\t\t\t ) {\r\n\t\t\t // Change to FS requires a full reload of all sidebars\r\n\t\t\t sendAddonMessage(\"reload\");\r\n\t\t\t}\r\n\t\t }\r\n\t\t else if (setFontBold_option_old != options.setFontBold) {\r\n\t\t\t// Change to font weight requires a full reload of all sidebars\r\n\t\t\tsendAddonMessage(\"reload\");\r\n\t\t }\r\n\t\t else if ((SSSChanged = (setSpaceSize_option_old != options.setSpaceSize))\r\n\t\t\t \t || (spaceSize_option_old != options.spaceSize)\r\n\t\t \t\t ) {\r\n\t\t\tif ((SSSChanged && !options.setSpaceSize\r\n\t\t\t\t\t\t\t&& (spaceSize_option_old != DfltSpaceSize)\r\n\t\t\t\t)\t\t\t\t// SFS changed state to unset, refresh only if FS changed\r\n\t\t\t\t|| !SSSChanged\t// Only the fontSize changed, which can happen only when SFS is set\r\n\t\t\t ) {\r\n\t\t\t // Change to SS requires a full reload of all sidebars\r\n\t\t\t sendAddonMessage(\"reload\");\r\n\t\t\t}\r\n\t\t }\r\n\t\t else if (trashEnabled_option_old != options.trashEnabled) {\r\n\t\t\t// Create or delete the BSP2 trash folder, as required\r\n\t\t\tif (options.trashEnabled) { // Create BSP2 trash folder, if not already existing (else trim it)\r\n\t\t\t createBSP2TrashFolder();\r\n \t\t\t}\r\n\t\t\telse { // Delete BSP2 trash folder and all its content\r\n\t\t\t removeBSP2TrashFolder();\r\n\t\t\t}\r\n\t\t\tsendAddonMessage(\"savedOptions\");\r\n\t\t }\r\n\t\t else if ((enableCookies_option_old != options.enableCookies)\r\n\t\t\t \t || (enableFlipFlop_option_old != options.enableFlipFlop)\r\n\t\t\t \t || (advancedClick_option_old != options.advancedClick)\r\n\t\t\t \t || (showPath_option_old != options.showPath)\r\n\t\t\t \t || (closeSearch_option_old != options.closeSearch)\r\n\t\t\t \t || (openTree_option_old != options.openTree)\r\n\t\t\t\t || (noffapisearch_option_old != options.noffapisearch)\r\n\t\t\t \t || (searchOnEnter_option_old != options.searchOnEnter)\r\n\t\t\t \t || (reversePath_option_old != options.reversePath)\r\n\t\t\t \t || (closeSibblingFolders_option_old != options.closeSibblingFolders)\r\n\t\t\t \t || (rememberSizes_option_old != options.rememberSizes)\r\n\t\t\t \t || (searchHeight_option_old != options.searchHeight)\r\n\t\t\t\t || (trashVisible_option_old != options.trashVisible)\r\n\t\t\t || (traceEnabled_option_old != options.traceEnabled)\r\n\t\t\t || (matchTheme_option_old != options.matchTheme)\r\n\t\t\t || (setColors_option_old != options.setColors)\r\n\t\t\t || (options.setColors && ((textColor_option_old != options.textColor)\r\n\t\t\t \t \t\t\t\t\t\t|| (bckgndColor_option_old != options.bckgndColor)\r\n\t\t\t \t \t\t\t\t\t )\r\n\t\t\t \t )\r\n\t\t\t || ((options.useAltFldr && (altFldrImg_option_old != options.altFldrImg))\r\n\t\t\t\t \t || (useAltFldr_option_old != options.useAltFldr)\r\n\t\t\t\t \t )\r\n\t\t\t || ((options.useAltNoFav && (altNoFavImg_option_old != options.altNoFavImg))\r\n\t\t\t\t \t || (useAltNoFav_option_old != options.useAltNoFav)\r\n\t\t\t\t \t )\r\n\t\t\t ) { // Those options only require a re-read and some minor actions\r\n\t\t\tsendAddonMessage(\"savedOptions\");\r\n\t\t }\r\n\t\t}\r\n\t )\r\n\t .catch( // Asynchronous, like .then\r\n\t\tfunction (err) {\r\n\t\t let msg = \"Error on processing addon message : \"+err;\r\n\t\t console.log(msg);\r\n\t\t if (err != undefined) {\r\n\t\t\tlet fn = err.fileName;\r\n\t\t\tif (fn == undefined) fn = err.filename; // Not constant :-( Some errors have filename, and others have fileName \r\n\t\t\tconsole.log(\"fileName: \"+fn);\r\n\t\t\tconsole.log(\"lineNumber: \"+err.lineNumber);\r\n\t\t }\r\n\t\t}\r\n\t );\r\n\t}\r\n\telse if (msg.startsWith(\"savedSearchOptions\")) { // Reload them all\r\n\t refreshOptionsLStore()\r\n\t .then(\r\n\t\tfunction () {\r\n\t\t // Signal to others the change in option\r\n\t\t sendAddonMessage(\"savedSearchOptions\");\r\n\t\t}\r\n\t )\r\n\t .catch( // Asynchronous, like .then\r\n\t\tfunction (err) {\r\n\t\t let msg = \"Error on processing savedSearchOptions : \"+err;\r\n\t\t console.log(msg);\r\n\t\t if (err != undefined) {\r\n\t\t\tlet fn = err.fileName;\r\n\t\t\tif (fn == undefined) fn = err.filename; // Not constant :-( Some errors have filename, and others have fileName \r\n\t\t\tconsole.log(\"fileName: \"+fn);\r\n\t\t\tconsole.log(\"lineNumber: \"+err.lineNumber);\r\n\t\t }\r\n\t\t}\r\n\t );\r\n\t}\r\n\telse if (msg.startsWith(\"refetchFav\")) { // Option page \"Re-fetch all unsuccessful favicons\" button was pressed\r\n\t refetchFav();\r\n\t}\r\n\telse if (msg.startsWith(\"reloadFFAPI\")) { // Option page \"Reload tree from FF API\" button was pressed,\r\n\t \t\t\t\t\t\t\t\t\t\t // or an anomaly was detected.\r\n\t reloadFFAPI(msg == \"reloadFFAPI_auto\");\r\n\t}\r\n\telse if (msg.startsWith(\"resetSizes\")) { // Option page reset sizes button was pressed\r\n\t // Relay to sidebars\r\n\t sendAddonMessage(\"resetSizes\");\r\n\t}\r\n\telse if (msg.startsWith(\"resetMigr16x16\")) { // Option page \"Reset 16x16 migration\" button was pressed\r\n\t // Remove the VersionImg16 flag from structureVersion\r\n\t let pos = structureVersion.indexOf(VersionImg16);\r\n\t if (pos != -1) { // Remove the flag\r\n\t\tstructureVersion = structureVersion.slice(0, pos)\r\n\t\t\t\t\t\t + structureVersion.slice(pos + VersionImg16.length);\r\n\t\tmigr16x16Open = true; // Reset to allow next migration signal to work\r\n\t\t// Do not send any signal to add-ons. Migration is triggered when loading a new sidebar and displaying\r\n\t }\r\n\t}\r\n\telse if (msg.startsWith(\"signalMigrate16x16\")) { // A private window sidebar sent a list of favicons to migrate\r\n\t signalMigrate16x16(request.list, request.len);\r\n\t}\r\n\telse if (msg.startsWith(\"getFavicon\")) { // A private window sidebar asks us to fetch / refresh a favicon\r\n\t faviconWorkerPostMessage({data: request.postMsg});\r\n\t}\r\n\telse if (msg.startsWith(\"refreshMostVisited\")) { // Opening the most visited special folder => refresh it\r\n\t triggerRefreshMostVisited();\r\n\t}\r\n\telse if (msg.startsWith(\"refreshRecentBkmks\")) { // Opening the most visited special folder => refresh it\r\n\t triggerRecentRefreshBkmks();\r\n\t}\r\n\telse if (msg.startsWith(\"sort:\")) { // Sort a folder contents by name\r\n\t let BN_id = msg.substring(5); // Get bookmark item Id\r\n\t sortFolder(BN_id);\r\n\t}\r\n\telse if (msg.startsWith(\"clearHistory\")) { // Clear bookmark history and BSP2 trash, sent from options page\r\n\t historyListClear(curHNList);\r\n\t BN_folderClean(bsp2TrashFldrBN);\r\n\t // Save new current info\r\n\t saveBNList();\r\n\t}\r\n\telse if (msg.startsWith(\"recordHistoryMulti\")) { // Record a multipple operation in hitory\r\n\t recordHistoryMulti(request.operation, request.id_list);\r\n\t}\r\n \r\n\t// Answer\r\n\tif (msg.startsWith(\"New:\")) { // New private window sidebar opening - Register it\r\n\t let windowId = parseInt(msg.slice(4), 10);\r\n\t privateSidebarsList[windowId] = windowId;\r\n\t let bnId = newSidebar(windowId);\r\n\t // Start private windows sidebar tracking, except if FF56 as we cannot track sidebar status in that version\r\n\t if ((sidebarScanIntervalId == undefined) && !beforeFF57) {\r\n\t\tsidebarScanIntervalId = setInterval(scanSidebars, SidebarScanInterval);\r\n\t }\r\n\t sendResponse(\r\n\t\t{content: \"savedCurBnId\",\r\n\t\t bnId: bnId\r\n\t\t}\r\n\t );\r\n\t}\r\n\telse if (msg.startsWith(\"getCurBNList\")) {\r\n\t let json = BN_serialize(curBNList[0]);\r\n\t sendResponse(\r\n\t\t{content: \"getCurBNList\",\r\n\t\t json: json,\r\n\t\t countBookmarks: countBookmarks,\r\n\t\t countFetchFav: countFetchFav,\r\n\t\t countNoFavicon: countNoFavicon,\r\n\t\t countFolders: countFolders,\r\n\t\t countSeparators: countSeparators,\r\n\t\t countOddities: countOddities,\r\n\t\t mostVisitedBNId: mostVisitedBNId,\r\n\t\t recentTagBNId: recentTagBNId, \r\n\t\t recentBkmkBNId: recentBkmkBNId,\r\n\t\t bsp2TrashFldrBNId: bsp2TrashFldrBNId\r\n\t\t}\r\n\t );\r\n\t json = undefined;\r\n\t}\r\n\telse if (msg.startsWith(\"getCurHNList\")) {\r\n\t let json = historyListSerialize(curHNList);\r\n\t sendResponse(\r\n\t\t{content: \"getCurHNList\",\r\n\t\t json: json\r\n\t\t}\r\n\t );\r\n\t json = undefined;\r\n\t}\r\n\telse if (msg.startsWith(\"getStats\")) { // Asked to send stats only\r\n\t sendResponse(\r\n\t\t{content: \"getStats\",\r\n\t\t countBookmarks: countBookmarks,\r\n\t\t countFetchFav: countFetchFav,\r\n\t\t countNoFavicon: countNoFavicon,\r\n\t\t countFolders: countFolders,\r\n\t\t countSeparators: countSeparators,\r\n\t\t countOddities: countOddities\r\n\t\t}\r\n\t );\r\n\t}\r\n\telse if (ready && msg.startsWith(\"getBackground\")) { // Asked to resend ready message .. if we are ready\r\n\t sendResponse(\r\n\t\t{content: \"Ready\"\t\t\r\n\t\t}\r\n\t );\r\n\t}\r\n\telse {\r\n\t sendResponse(\r\n\t\t{content: \"Background response to \"+request.source\t\t\r\n\t\t}\r\n\t );\r\n\t}\r\n }\r\n catch (error) {\r\n\tconsole.log(\"Error processing message: \"+request.content);\r\n\tif (error != undefined) {\r\n\t console.log(\"message: \"+error.message);\r\n\t let fn = error.fileName;\r\n\t if (fn == undefined) fn = error.filename; // Not constant :-( Some errors have filename, and others have fileName \r\n\t console.log(\"fileName: \"+fn);\r\n\t console.log(\"lineNumber: \"+error.lineNumber);\r\n//console.log(\" keys: \"+Object.keys(error));\r\n//console.log(\" values: \"+Object.values(error));\r\n\t}\r\n }\r\n}", "function listenToMessages() {\n chrome.runtime.onConnect.addListener(function (port) {\n console.log(\"connection in content, port:\", port);\n if (port.name !== \"content\") return;\n port.onMessage.addListener(async function (msg, port) {\n console.log(\"msg in content\", msg);\n switch (msg.cmd) {\n case \"open_panel\":\n initPanel();\n // Initiating panel.js etc\n setTimeout(() => {\n openPanel();\n disableStart();\n // Getting roomId\n const urlSplit = document.location.href.split(\"/\");\n const roomId = urlSplit[urlSplit.length - 1];\n msgPanel(\"init\", { name: msg.payload.name, score: 0, roomId });\n }, 1000);\n break;\n case \"close_panel\":\n msgPanel(\"close\");\n enableStart();\n closePanel();\n if (stateObserver) {\n stateObserver.disconnect();\n }\n break;\n case \"is_panel_open\":\n port.postMessage({ cmd: \"is_panel_open\", payload: !!document.getElementById(\"ggPartyPanel\") });\n break;\n case \"start_game\":\n startTimer(startButton, startGame);\n break;\n case \"continue_game\":\n nextRoundButton = document.querySelector(\"[data-qa='close-round-result']\");\n startTimer(nextRoundButton, continueGame);\n break;\n default:\n console.warn(\"unrecognised msg command:\", msg);\n break;\n }\n return true\n });\n });\n\n // Listen to background message about URL\n chrome.runtime.onMessage.addListener(\n function (request) {\n if (request.message === 'url_change') {\n if (!extensionClosed) {\n if (!validChallengerOrResultURL(request.url)) {\n msgPanel(\"close\");\n closePanel();\n extensionClosed = true;\n }\n }\n }\n }\n );\n\n}", "handleMessages() {\n chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {\n switch (request.type) {\n case \"arrangeDomains\":\n this.arrangeDms(request.data.dms);\n sendResponse({ msg: \"Domains arranged!\" });\n break;\n\n case \"arrangeEmails\":\n this.arrangeEms(request.data.ems);\n sendResponse({ msg: \"Emails arranged!\" });\n break;\n\n case \"testConnectionToFrames\":\n if (request.data.connection) {\n chrome.tabs.sendMessage(sender.tab.id, {\n type: \"testingConnections\",\n data: {\n connection: request.data.msg,\n },\n });\n }\n sendResponse({ msg: \"Connections Made!\" });\n break;\n\n case \"closeThisIframe\":\n chrome.tabs.sendMessage(sender.tab.id, {\n type: \"deleteFrames\",\n data: {\n id: request.data.id,\n },\n });\n sendResponse({ msg: \"Closing Iframe!\" });\n break;\n\n case \"removeCustomElements\":\n chrome.runtime.sendMessage({\n type: \"removeCustomElementsOnClearBtn\",\n });\n sendResponse({ msg: \"Closing all Custom Elements!\" });\n break;\n\n case \"setUrlToIframeSrc\":\n chrome.tabs.sendMessage(sender.tab.id, {\n type: \"setUrlToSrc\",\n data: {\n id: request.data.id,\n url: request.data.url,\n },\n });\n sendResponse({ msg: \"Setting urls to iframe's src!\" });\n break;\n\n default:\n console.error(\"Unrecognised message: \", request.type);\n break;\n }\n });\n }", "function messageHandler(request, sender, sendResponse) {\n if (request.name != 'RequestPreview')\n return;\n\n previewArticle();\n\n // register shortcut keys\n document.querySelector(\"body\").addEventListener(\"keydown\", nudge);\n\n var id = setInterval(function () {\n if (previewComplete == 1) {\n sendResponse({'result':'COMPLETE'});\n clearInterval(id);\n } else if (previewComplete == -1) {\n sendResponse({'result':'CANCLED'});\n clearInterval(id);\n }\n }, 300);\n }", "function _onIncomingMessage( data, sender, callback )\n\t{\n\t\t\n\t\tif( !data ) throw new Error( 'no data received for content message' )\n\t\t\n\t\tvar name = data.a\n\t\t\n\t\t/*\n\t\tif( !name )\n\t\t{\n\t\t\t\n\t\t\tthrow new Error( 'no name received for content message' )\n\t\t\t\n\t\t}\n\t\t*/\n\t\t\n\t\tvar args\t= data.b || null\n\t\tvar value \t= null\n\t\tvar method \t= null\n\t\t\n\t\t//f.log( 'received message \"' + name + '\"', args )\n\t\t\n\t\tif( name == 'app' ) \n\t\t{\n\t\t\t\n\t\t\tvar list \t= {}\n\t\t\tvar obj \t= {}\n\t\t\t\n\t\t\tfor( var i in app )\n\t\t\t{\n\t\t\t\t\n\t\t\t\tif( !/^_/.test( i ) )\n\t\t\t\t{\n\t\t\t\t\t\n\t\t\t\t\tif( typeof( app[ i ] ) == 'function' )\n\t\t\t\t\t{\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tlist[ i ] = i\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{\n\t\t\t\t\t\t\n\t\t\t\t\t\tobj[ i ] = f.copy( app[ 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}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tobj._ = list\n\t\n\t\t\tmethod = function()\n\t\t\t{ \n\t\t\t\n\t\t\t\treturn obj\n\t\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\t\telse if( name == 'option_check' )\n\t\t{\n\t\t\t\n\t\t\tmethod = function()\n\t\t\t{\n\t\t\t\t\t\t\t\t\n\t\t\t\treturn _contentUpdateTime\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse if( name == 'show_icon' )\n\t\t{\n\t\t\t\n\t\t\t// save this for later\n\t\t\t_activeTabs[ sender.tab.id ] = true\n\t\t\t\n\t\t\tmethod = function()\n\t\t\t{\n\t\t\t\t\n\t\t\t\tchrome.pageAction.show( sender.tab.id )\n\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse if( name == 'check_popup' )\n\t\t{\n\t\t\tmethod = function()\n\t\t\t{ \n\t\t\t\n\t\t\t\treturn app.popup\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\telse if( name == 'set_popup' )\n\t\t{\n\t\t\t_set( app.library.key.POPUP, f.now() )\n\t\t\tapp.popup = ( _get( app.library.key.POPUP ) * 1 ) || 0\n\n\t\t\tf.log(\"POPPI POPUP\")\n\n\t\t\tmethod = function()\n\t\t\t{ \n\t\t\t\n\t\t\t\treturn null\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\t\n\t\t\tmethod = app[ name ]\n\t\t\t\n\t\t}\n\t\t\n\t\t/*\n\t\tif( method == undefined ) \n\t\t{\n\t\t\t\n\t\t\tthrow new Error( 'method \"' + name + '\" not found' )\n\t\t\n\t\t}\n\t\t*/\n\t\t\n\t\tif( name && method != undefined)\n\t\t{\n\t\t\tvalue = method.apply( app, args )\n\t\t}\n\t\t\n\t\t//f.log( 'content script sent message \"' + name + '\"', args, value )\n\t\n\t\t// execute a callback with the value if needed\n\t\tif( callback )\n\t\t{\n\t\t\n\t\t\tcallback( value )\n\t\t\t\n\t\t}\n\t\t\n\t\treturn false\n\t\t\n\t}", "function emblContentHubSignalFinished() {\n // @todo, shouldn't require the body element\n document.querySelectorAll(\"body\")[0].classList.add(\"embl-content-hub-loaded\");\n\n // if the JS to run embl-conditional-edit is present, run it now\n if (typeof emblConditionalEdit === \"function\") {\n emblConditionalEdit();\n }\n\n // if the JS to run embl-notifications is present, run it now\n if (typeof emblNotifications === \"function\") {\n emblNotifications();\n }\n }", "function onMessageRecieved(who, msgType, content) {\n\n switch(msgType) {\n case \"telepointer_info\":\n updateTelepointer(content);\n break;\n case \"inform_my_details_to_all_other_clients\":\n addNewClientToAllOccupantsDetails(content);\n updateOnlineStatusOfClients(all_occupants_details);\n break;\n case \"disconnected\":\n alert(\"Disconnected : \" + content);\n break;\n case \"chat_room_msg\":\n addToChatRoomConversation(content);\n break;\n case \"floor_owner_changed\":\n onFloorOwnerChanged(content);\n break;\n case \"new_floor_request\":\n onNewFloorRequest(content);\n break;\n case \"release_floor\":\n onFloorRelease();\n break;\n case \"remote_module_addition\":\n onRemoteModuleAddition(content);\n break;\n case \"moduleSettingsChanged\":\n onModuleSettingsChanged(content);\n break;\n\n\n\n\n }\n}", "function handleMessage(message, sender) {\n if (message && message.type) {\n switch (message.type) {\n case 'xhr-capture':\n store.dispatch('fetchFromStorage', 'settings')\n .then(() => {\n switch (message.arrayType) {\n case 'rawTopics':\n store.dispatch('updateTopics', message.arrayObject);\n break;\n case 'rawResults':\n // NOTE: only update topic results if main switch is on\n if (store.getters.settings.ui.auto.isOn === true) {\n store.dispatch('updateTopicResults', {\n topicId: message.topicId,\n results: message.arrayObject\n })\n .catch(err => { utils.logErr(err); });\n }\n break;\n }\n });\n break;\n case 'activate_icon':\n // this guarantees popup click works correctly for page action\n store.dispatch('fetchFromStorage', 'settings')\n .then( () => {\n browser.pageAction.show(sender.tab.id);\n let settings = store.getters.settings\n let ui = store.getters.settings.ui\n utils.updateLastTabId(store, sender.tab.id)\n utils.setPageActionIcon(store.getters.settings) \n })\n break;\n }\n //utils.logMsg({ 'msg. from content script': message });\n }\n // \"Dummy response to keep the console quiet\" see: https://github.com/mozilla/webextension-polyfill/issues/130\n return Promise.resolve('dummy');\n}", "function onScriptEventReceived(message) {\n try {\n message = JSON.parse(message);\n } catch (e) {\n console.log(e);\n return;\n }\n\n if (message.app !== \"botinator\") {\n return; \n }\n\n switch (message.method) {\n case \"UPDATE_UI\":\n loadingContainer.style.display = \"none\";\n // Saving for when volume gets fixed\n // volumeSlider.value = message.volume; \n totalNumberOfBotsNeeded.innerHTML = \"Current Bots: \" + message.totalNumberOfBotsNeeded;\n availableACs.innerHTML = message.availableACs;\n updateContentBoundaryCornersUI(message.contentBoundaryCorners);\n updatePlayLabel(message.playState);\n maybeDisablePlayButton(message.availableACs);\n break;\n case \"UPDATE_AVAILABLE_ACS\":\n updateAvailableACsUI(message.availableACs);\n maybeDisablePlayButton(message.availableACs);\n break;\n case \"UPDATE_CONTENT_BOUNDARY_CORNERS\":\n updateContentBoundaryCornersUI(message.contentBoundaryCorners);\n break;\n case \"UPDATE_CURRENT_SERVER_PLAY_STATUS\":\n updatePlayLabel(message.playState);\n updateAvailableACsUI(message.availableACs);\n maybeDisablePlayButton(message.availableACs);\n break;\n default:\n console.log(\"Unknown message received from botinator.js! \" + JSON.stringify(message));\n break;\n }\n}", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "function messageReceived(event) {\n \tvar data = event.data.data,\n \t\tsubject = event.data.subject;\n\n \t// Spam filter.\n \tswitch (subject) {\n \t\t// New window is ready to receive messages.\n \t\tcase \"hello\":\n \t\t\tlog.info(\"Got greetings form \" + event.origin + '.');\n\n \t\t\tvar play = true;\n \t\t\tif (pref.getPref(\"disableautoplay\")) {\n \t\t\t\tif (pref.getPref(\"disableautoplayalways\"))\n \t\t\t\t\tplay = false;\n \t\t\t\telse {\n \t\t\t\t\tfor (var id in video) {\n \t\t\t\t\t\tif (video[id].playing)\n \t\t\t\t\t\t\tplay = false;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n\n \t\t\tsendMessage(event, {\n \t\t\t\tsubject: \"auto play\",\n \t\t\t\tdata: {\n \t\t\t\t\tautoplay: play\n \t\t\t\t}\n \t\t\t});\n\n \t\t\tlog.info(\"Autoplay option is sent to injected script on \" + event.origin + '.',\n \t\t\t\t\"Autoplay is “\" + play + \"“.\"\n \t\t\t);\n \t\t\tbreak;\n \t\tcase \"add tab\":\n \t\t\tlog.info(\"Received request to add video to list.\",\n \t\t\t\t\"From \" + event.origin + '.'\n \t\t\t);\n \t\t\taddTab(event);\n \t\t\tbreak;\n \t\tcase \"remove tab\":\n \t\t\tlog.info(\"Received request to remove video from list.\",\n \t\t\t\t\"From \" + event.origin + '.'\n \t\t\t);\n \t\t\tremoveTab(event);\n \t\t\tbreak;\n \t\tcase \"player ready\":\n \t\t\tsendMessage(event, event.data);\n\n \t\t\tif (!data.id || !video[data.id]) {\n \t\t\t\tlog.warn(\"Got “player ready” message but video is not in list! Asking for video info.\",\n \t\t\t\t\t\"From \" + event.origin + '.'\n \t\t\t\t);\n \t\t\t\tsendMessage(event, { subject: \"give me info\" });\n \t\t\t}\n \t\t\telse\n \t\t\t\tlog.info(\"Player on page \" + data.id + \" is ready to play video.\");\n \t\t\tbreak;\n \t\tcase \"player state changed\":\n \t\t\tif (!data.id) {\n \t\t\t\tlog.warn(\"Player changed state but video ID is missing! Asking for ID.\",\n \t\t\t\t\t\"New state: \" + data.state + '.',\n \t\t\t\t\t\"From \" + event.origin + '.'\n \t\t\t\t);\n \t\t\t\tsendMessage(event, { subject: \"give me info\" });\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\telse if (!video[data.id]) {\n \t\t\t\tlog.warn(\"Player changed state but video is not in list! Asking for video info.\",\n \t\t\t\t\t\"New state:\" + data.state + '.',\n \t\t\t\t\t\"From \" + event.origin + '.'\n \t\t\t\t);\n \t\t\t\tsendMessage(event, { subject: \"give me info\" });\n \t\t\t\tbreak;\n \t\t\t}\n\n \t\t\tlog.info(\"Player on page \" + data.id + \" changed state to \" + data.state + '.');\n\n \t\t\tswitch (data.state) {\n \t\t\t\tcase 0:\n \t\t\t\t\tvideo[data.id].playing = false;\n \t\t\t\t\tif (pref.getPref(\"loop\")) {\n \t\t\t\t\t\tsendMessage(event, {\n \t\t\t\t\t\t\tsubject: \"player action\",\n \t\t\t\t\t\t\tdata: {\n \t\t\t\t\t\t\t\texec: \"play\"\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\tbreak;\n \t\t\t\tcase 1:\n \t\t\t\t\tvideo[data.id].playing = true;\n \t\t\t\t\tvideo[data.id].firstplay = false;\n \t\t\t\t\ttoolbar.videoid = data.id;\n\n \t\t\t\t\tif (pref.getPref(\"disableautoplay\")) {\n \t\t\t\t\t\tfor (var id in video) {\n \t\t\t\t\t\t\tif (id != data.id) {\n \t\t\t\t\t\t\t\tsendMessage(video[id], {\n \t\t\t\t\t\t\t\t\tsubject: \"player action\",\n \t\t\t\t\t\t\t\t\tdata: {\n \t\t\t\t\t\t\t\t\t\texec: \"pause\"\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\tbreak;\n \t\t\t\tcase 2:\n \t\t\t\tcase -1:\n \t\t\t\t\tvideo[data.id].playing = false;\n \t\t\t}\n\n \t\t\tupdateToolbarButton();\n \t\t\tbreak;\n \t\tcase \"toggle loop\":\n \t\t\tvar oldValue = pref.getPref(\"loop\");\n \t\t\tpref.setPref(\"loop\", !oldValue);\n \t\t\tfireStorageEvent(\"loop\", oldValue);\n \t\t\tbreak;\n \t\tcase \"toggle custom colors\":\n \t\t\tvar oldValue = pref.getPref(\"enablecustomcolors\");\n \t\t\tpref.setPref(\"enablecustomcolors\", !oldValue);\n \t\t\tfireStorageEvent(\"enablecustomcolors\", oldValue);\n \t\t\tbreak;\n \t\tcase \"toggle custom css\":\n \t\t\tvar oldValue = pref.getPref(\"enablecustomstyle\");\n \t\t\tpref.setPref(\"enablecustomstyle\", !oldValue);\n \t\t\tfireStorageEvent(\"enablecustomstyle\", oldValue);\n \t\t\tbreak;\n \t\tcase \"load external resource\":\n \t\t\tloadExternalResource(event.data, event.source);\n \t\t\tbreak;\n \t\tcase \"show preferences\":\n \t\t\textension.tabs.create({\n \t\t\t\turl: extensionAddress + \"/options.html#preferences\",\n \t\t\t\tfocused: true\n \t\t\t});\n \t\t\tbreak;\n \t\tcase \"show bug report window\":\n \t\t\textension.tabs.create({\n \t\t\t\turl: extensionAddress + \"/share/page/bug-report.html\",\n \t\t\t\tfocused: true\n \t\t\t});\n \t\t\tbreak;\n \t\tcase \"tab focused\":\n \t\t\tif (!data.id || !video[data.id]) {\n \t\t\t\tif (!data.player)\n \t\t\t\t\tbreak;\n\n \t\t\t\tlog.warn(\"Tab is focussed but video ID is missing or video is not in video list! Asking for video info.\");\n \t\t\t\tsendMessage(event, { subject: \"give me info\" });\n \t\t\t\tbreak;\n \t\t\t}\n \t\t\telse\n \t\t\t\tlog.info(\"Tab with video \" + data.id + \" is focused.\");\n\n \t\t\tif (pref.getPref(\"playonfocus\") && !video[data.id].focused) {\n \t\t\t\tvar play = true;\n \t\t\t\tif (!pref.getPref(\"forceplayonfocus\")) {\n \t\t\t\t\tif (pref.getPref(\"onlyonfirstfocus\") && !video[data.id].firstplay)\n \t\t\t\t\t\tplay = false;\n\n \t\t\t\t\tif (play) {\n \t\t\t\t\t\tfor (var id in video) {\n \t\t\t\t\t\t\tif (video[id].playing)\n \t\t\t\t\t\t\t\tplay = false;\n \t\t\t\t\t\t}\n \t\t\t\t\t}\n \t\t\t\t}\n\n \t\t\t\tif (play) {\n \t\t\t\t\tsendMessage(event, {\n \t\t\t\t\t\tsubject: \"player action\",\n \t\t\t\t\t\tdata: {\n \t\t\t\t\t\t\texec: \"play\"\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\tvideo[data.id].focused = true;\n \t\t\tbreak;\n \t\tcase \"tab blurred\":\n \t\t\tif (data.id && video[data.id]) {\n \t\t\t\tvideo[data.id].focused = false;\n \t\t\t\tlog.info(\"Tab with video \" + data.id + \" lost focus.\");\n \t\t\t}\n \t\t\tbreak;\n \t\tcase \"echo replay\":\n \t\t\tif (ping[data.id]) {\n \t\t\t\tping[data.id].replay = true;\n\n \t\t\t\tif (ping[data.id].timeout) {\n \t\t\t\t\twindow.clearTimeout(ping[data.id].timeout);\n \t\t\t\t\tping[data.id].timeout = null;\n \t\t\t\t}\n \t\t\t}\n \t\t\telse {\n \t\t\t\tlog.warn(\"Received echo replay from unknown page.\",\n \t\t\t\t\t\"ID: \" + data.id + '.',\n \t\t\t\t\t\"Asking for video info.\"\n \t\t\t\t);\n \t\t\t\tsendMessage(event, { subject: \"give me info\" });\n \t\t\t}\n \t\t\tbreak;\n \t\tcase \"here is message log\":\n \t\t\tif (logViewer)\n \t\t\t\tlogViewer.postMessage(event.data, [event.source]);\n \t}\n }", "onBeforeRespond (message)\n {\n }", "function main() {\n // register a message listener\n chrome.runtime.onMessage.addListener(\n function (request, sender, sendResponse) {\n console.log(request);\n handleMessage(request);\n }\n );\n\n console.log(\"RollShare roll20 roll receive module loaded\")\n}", "function handleMessage(request, sender, sendResponse) {\n if (request.action == \"callback\") {\n\thandleResponse(request);\n\treturn;\n }\n \n if (request.action == \"getLinks\") {\n\tconsole.log(\"Message from the background script: \" + request.action);\n\t\n\tvar expandId = url_domain(request.tabUrl);\n\tif (expands[expandId] == null || expands[expandId] == undefined) {\n\t\texpands[expandId] = {};\n\t}\n\t\t\n\tfunction callback(message) {\n\t\t//here, we have the result of the \"getStatus\" action, or of the original \"getLinks\" result if already computed\n\t\tvar status = statuses[message.tabId];\n\t\tif (status != null && status != undefined) {\n\t\t\tvar result = { \"action\": \"callback\", \"tabId\" : message.tabId, \"tabUrl\" : message.tabUrl, \"status\": status, \"expands\": expands[expandId] };\n\t\t\thandleMessage(result);\n\t\t\t//Send to popups a callback action. (it can raise an error if there is no popup though)\n\t\t\tbrowser.runtime.sendMessage(result);\n\t\t}\n\t};\n\t\n\tfunction storeNewStatus(message) {\n\t\t//here, we have the result of the \"getStatus\" action.\n\t\tstatuses[message.tabId] = message.status;\n\t\tcallback(message);\n\t};\n\t\n\tfunction handleError(error) {\n\t\t//console.log(`Error: ${error}`);\n\t\tstoreNewStatus( { \"tabId\" : request.tabId, \"status\": [] } );\n\t}\n\t \n\tvar status = statuses[request.tabId];\n\tif (status == null || status == undefined) {\n\t\tvar sending = browser.tabs.sendMessage(request.tabId, { \"action\": \"getStatus\", \"tabId\" : request.tabId, \"tabUrl\" : request.tabUrl, \"expands\": expands[expandId] } );\n\t\tsending.then(storeNewStatus, handleError);\n\t\tsendResponse({\"response\": \"wait\", \"action\" : request.action }); \n\t\t\n\t} else if (request.kind != undefined && request.kind != null && status[kind] == undefined) {\n\t\tvar sending = browser.tabs.sendMessage(request.tabId, { \"action\": \"getStatus\", \"tabId\" : request.tabId, \"tabUrl\" : request.tabUrl, \"expands\": expands[expandId] } );\n\t\tsending.then(storeNewStatus, handleError);\n\t\tsendResponse({\"response\": \"wait\", \"action\" : request.action });\n\t\t\n\t} else {\n\t\tcallback(request);\n\t\tsendResponse({\"response\": \"wait\", \"action\" : request.action }); \n\t}\n\t\n } else if (request.action == \"switchExpand\") {\n \n\tvar status = statuses[request.tabId];\n\tvar expandId = url_domain(request.tabUrl);\n\tif (expands[expandId] == null || expands[expandId] == undefined) {\n\t\texpands[expandId] = {};\n\t}\n\tvar kind = request.kind;\n\tif (expands[expandId][kind] == null || expands[expandId][kind] == undefined) {\n\t\texpands[expandId][kind] = false;\n\t}\n\texpands[expandId][kind] = !expands[expandId][kind];\n\t\n\tsendResponse({\"response\": \"switched\", \"action\" : request.action, \"tabId\": request.tabId, \"tabUrl\" : request.tabUrl, \"kind\": request.kind, \"value\": expands[expandId][kind] });\n }\n}", "function listenMessages() {\n\tchrome.runtime.onMessage.addListener(checkMessage);\n}", "function on_message(content) {\n console.log(content);\n let m = JSON.parse(content);\n if (!m) {\n console.log(\"Invalid JSON\");\n } else {\n switch (m.type) {\n case \"message\":\n if (has_all(m, [\"data\"])) {\n add_to_output(\"<<< \" + m.data);\n } else {\n console.log(\"Message had no data: \" + content);\n }\n break;\n case \"update\":\n if (has_all(m, [\"hand\", \"play\"])) {\n document.getElementById(\"hand-state\").innerHTML = m.hand;\n document.getElementById(\"play-state\").innerHTML = m.play;\n } else {\n console.log(\"Update lacked hand or play: \" + content);\n }\n break;\n case \"inspect\":\n if (has_all(m, [\"url\", \"title\", \"value\", \"flags\", \"tags\"])) {\n document.getElementById(\"inspect-image\").src = IMAGE_BASE_URL + m.url;\n document.getElementById(\"inspect-image\").alt = m.title;\n document.getElementById(\"inspect-title\").innerHTML = m.title;\n document.getElementById(\"inspect-value\").innerHTML = m.value;\n document.getElementById(\"inspect-flags\").innerHTML = m.flags;\n document.getElementById(\"inspect-tags\").innerHTML = m.tags;\n } else {\n console.log(\"Inspect lacked url, title, value, or flags: \" + content);\n }\n break;\n case \"choices\":\n if (has_all(m, [\"choices\"])) {\n choices = m.choices;\n add_to_output(\"<<< \" + formatChoices(choices));\n } else {\n console.log(\"Choices lacked choices: \" + content);\n }\n default:\n console.log(\"Weird request: \" + content);\n }\n }\n}", "function messenger(socket, content) {\n socket.talk('m', content);\n }", "function contentScriptWorker() {\n runtime.sendMessage({\n type: SIGN_CONNECT\n }).then(function (msg) {\n return console.info(msg);\n });\n runtime.onMessage.addListener(function (_ref) {\n var type = _ref.type,\n payload = _ref.payload;\n\n switch (type) {\n case SIGN_RELOAD:\n logger(\"Detected Changes. Reloading ...\");\n reloadPage && window.location.reload();\n break;\n\n case SIGN_LOG:\n console.info(payload);\n break;\n }\n });\n } // ======================== Called only on background scripts ============================= //", "function contentScriptWorker() {\n runtime.sendMessage({\n type: SIGN_CONNECT\n }).then(function (msg) {\n return console.info(msg);\n });\n runtime.onMessage.addListener(function (_ref) {\n var type = _ref.type,\n payload = _ref.payload;\n\n switch (type) {\n case SIGN_RELOAD:\n logger(\"Detected Changes. Reloading ...\");\n reloadPage && window.location.reload();\n break;\n\n case SIGN_LOG:\n console.info(payload);\n break;\n }\n });\n } // ======================== Called only on background scripts ============================= //", "function eventTrigger_onConsoleMessage(pageData, msg) {\n if (msg === 'html-grabber-get-content') {\n getContent(pageData, 'event');\n }\n }", "function doPost(e) {\n\n // parse the message content as JSON\n var contents = JSON.parse(e.postData.contents);\n var user_id = contents.message.from.id;\n var text = contents.message.text;\n switch(text) {\n case '/help':\n sendMessage(user_id, getHelp());\n return;\n case '/faq':\n sendMessage(user_id, getFaq());\n return;\n case '/about':\n sendMessage(user_id, getAbout());\n return;\n case '/donate':\n sendMessage(user_id, getDonate());\n return; \n case '/thanks':\n sendMessage(user_id, getThanks());\n return;\n case '/contact':\n sendMessage(user_id, getContactUs());\n return; \n case '/limits':\n sendMessage(user_id, getLimitations());\n return;\n case '/commands':\n sendMessage(user_id, getCommands());\n return;\n case '/manualupload':\n sendMessage(user_id, getManualUpload());\n return;\n default:\n // try to parse file\n var file_id = contents.message.document;\n // if no file exist - say hi\n if(!file_id) {\n sendMessage(user_id, getInstructions());\n return;\n }\n break;\n }\n\n\n sendMessage(user_id, 'מעבד נתונים, אנא המתינו...');\n // get file id\n file_id = contents.message.document.file_id;\n // get file path on telegram server\n try {\n var file_path = getFilePath(file_id);\n } catch (error) {\n sendMessage(user_id, 'אירעה שגיאה בקבלת כתובת הקובץ מהשרת. עמכם הסליחה. קוד שגיאה:' + encodeURI(error.message));\n return;\n }\n\n try {\n switch(contents.message.document.mime_type) {\n case 'application/zip':\n try {\n sendMessage(user_id, 'ניתוח קובץ זיפ עשוי לקחת מספר דקות, ניתן לצאת מהבוט והודעה תישלח אליכם ברגע שהמידע יהיה מוכן');\n var user_locations_file = getJsonFileFromZip(file_path);\n } catch (error) {\n sendMessage(user_id, 'אירעה שגיאה בפענוח קובץ זיפ. ניתן להעלות את קובץ המיקום ידנית.%0Aלהוראות לחצו /manualupload %0Aקוד שגיאה:' + encodeURI(error.message) + '%0A' + contents.message.document.mime_type);\n return;\n }\n break;\n default:\n var user_locations_file = getJsonFileFromTelegramServer(file_path);\n break; \n }\n } catch (error) {\n sendMessage(user_id, 'אירעה שגיאה בהורדת הקובץ מהשרת. עמכם הסליחה.%0A קוד שגיאה:%0A' + encodeURI(error.message) + '%0A' + contents.message.document.mime_type);\n return;\n }\n \n try{\n searchMatchLocations(user_id, user_locations_file);\n } catch (error) {\n sendMessage(user_id, 'אירעה שגיאה בניתוח נתוני המיקום. עמכם הסליחה.%0A קוד שגיאה:%0A' + encodeURI(error.message));\n return;\n }\n sendMessage(user_id, 'עדכון מפה אחרון: ' + getLastUpdate());\n}", "function networkSend(){\nchrome.tabs.executeScript(null, {file: \"content.js\"});\n}", "function contentScriptWorker() {\n runtime.sendMessage({\n type: SIGN_CONNECT\n }, function (msg) {\n return console.info(msg);\n });\n runtime.onMessage.addListener(function (_ref) {\n var type = _ref.type,\n payload = _ref.payload;\n\n switch (type) {\n case SIGN_RELOAD:\n logger(\"Detected Changes. Reloading ...\");\n reloadPage && window.location.reload();\n break;\n\n case SIGN_LOG:\n console.info(payload);\n break;\n }\n });\n } // ======================== Called only on background scripts ============================= //", "function sendAddonMessage (msg) {\r\n browser.runtime.sendMessage(\r\n\t{source: \"background\",\r\n\t content: msg\r\n\t}\r\n ).then(handleMsgResponse, handleMsgError);\r\n}", "function HandleMessages(event)\n{\n DebugMessage(\"Background-Process get command '\" + event.data.cmd + \"'\");\n switch(event.data.cmd)\n { \n // Load Preferences\n case 'Preferences':\n if( opera.extension.tabs.create )\n opera.extension.tabs.create({\n url:\"./options.html\",\n focused:true\n });\n break;\n \n // Load Message-Link in new Tab\n case 'LoadLink':\n \n // Always use https\n var link = event.data.lnk.replace(/^http:\\/\\//i, 'https://');\n \n // Use HTML-Mode if option is set\n if(widget.preferences['basicMode'] && widget.preferences['basicMode'] === \"on\")\n link = link.replace(/\\/u\\//i, '/h/');\n \n DebugMessage(\"Open link: \" + link);\n \n // Open now in new tab\n if( opera.extension.tabs.create )\n opera.extension.tabs.create({\n url:link,\n focused:true\n });\n break;\n \n // Refresh now (without callback)\n case 'Refresh_NoCallback':\n \n // Reset timer\n window.clearTimeout(UpdateTimer); \n \n // Sets alternate icon\n // (we do this here, because this Message comes from Option-Page)\n if(widget.preferences['theme'] != 'standard')\n MyButton.icon = \"css/\" + widget.preferences['theme'] + \"/img/toolbar-icon-18px.png\";\n else\n MyButton.icon = \"img/toolbar-icon-18px.png\";\n \n // then update the Accounts\n Update();\n \n // Refresh now (with callback)\n case 'Refresh':\n // reset timer\n window.clearTimeout(UpdateTimer);\n\n // At first send the current state to the source\n // (quicker)\n SendMessagesToSource(event.source);\n\n // then update the Accounts\n Update(event.source);\n\n break;\n \n // Only return currrent messages to source (No Refresh) \n case 'GetCurrentMessages':\n SendMessagesToSource(event.source);\n break; \n \n // Compose Mail\n case 'ComposeMail':\n if( opera.extension.tabs.create )\n opera.extension.tabs.create({\n url:\"https://mail.google.com/mail/?#compose\",\n focused:true\n });\n break;\n \n // Sets new Popup-Height\n case 'SetPopupSize':\n // Only change size if it is different to avoid flicker\n if(Number(MyButton.popup.height) != Number(event.data.height))\n MyButton.popup.height = event.data.height;\n break;\n \n // MessageAction (mark as read, achive, delete, ...)\n case 'MessageAction':\n MessageAction(event.data.uid, event.data.anum, event.data.action, event.source);\n break;\n \n // Debug-Message\n case 'DebugMessage':\n if(widget.preferences['debugMode'] && widget.preferences['debugMode'] === \"on\") \n opera.postError(event.data.msg);\n break;\n\n // Do nothing\n default:\n DebugMessage(\"Unknown Command from Menu -> \" + event.data.cmd, \"error\");\n }\n}", "function initializeMessageListeners() {\n chrome.extension.onMessage.addListener(\n function(request, sender, sendResponse) {\n if (request.type === 'getGlobalCounts') {\n sendResponse(globalCounts);\n } else if (request.type === 'getVisitForTab') {\n sendResponse(getVisitForTab(request.tab));\n } else if (request.type === 'getEscapeBlockingEnabled') {\n sendResponse(_escapeBlockingEnabled);\n } else if (request.type === 'setEscapeBlockingEnabled') {\n _escapeBlockingEnabled = request.escapeBlockingEnabled;\n console.log(`escape blocking enabled? ${_escapeBlockingEnabled}`);\n } else if (request.type === 'setAnachronismBlockingEnabled') {\n _anachronismBlockingEnabled = request.anachronismBlockingEnabled;\n _anachronismRange = request.anachronismRange;\n \n }\n }\n );\n}", "function on_message(request, sender, sendResponse) {\n\n if (request.load_completed) {\n var state = bgpage.getState(tabid);\n build_popup(bgpage.get_tab_network_requests(tabid), tab_url,\n state);\n } else if (request.attach_error) {\n// showErr(\"Devtools is active - please close it\");\n showErr(request.attach_error);\n }\n}", "function onSendMessage(data){\n\t//TODO \n}", "function passMessageToContent(mess) {\n let currentTabsSearchParameters =\n {\n active: true,\n currentWindow: true\n }\n chrome.tabs.query(currentTabsSearchParameters, function (tabs) {\n let msg = {\n message: mess\n }\n chrome.tabs.sendMessage(tabs[0].id, msg);\n });\n}", "bindEvent() {\n chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {\n switch (request.eventName) {\n case 'parse':\n this.parse()\n break\n case 'revert':\n this.revert()\n break\n case 'switchThemeName':\n this.switchTheme(request.themeName)\n this.setThemeName(request.themeName)\n break\n case 'switchLangsPrefer':\n this.setLangsPrefer(request.langsPrefer)\n break\n }\n });\n }", "function onMessageListener(message) {\n var val = message.value;\n var type = message.type;\n console.debug(\"cs->bp\", type, val);\n\n function postLyrics(src, result, providers) {\n //we cannot send jQuery objects with a post, so send plain html\n if (result.lyrics) result.lyrics = result.lyrics.html();\n if (result.credits) result.credits = result.credits.html();\n if (result.title) result.title = result.title.text().trim();\n postToGooglemusic({ type: \"lyrics\", result: result, providers: providers, srcUrl: lyricsProviders[src].getUrl() });\n }\n\n if (type.indexOf(\"song-\") === 0) {\n if (type == \"song-position\" && !val) val = \"0:00\";\n song[type.substring(5)] = val;\n } else if (type.indexOf(\"player-\") === 0) {\n player[type.substring(7)] = val;\n } else if (type == \"connected\") {\n connecting = false;\n player.connected = true;\n updateBrowserActionInfo();\n iconClickSettingsChanged();\n localSettings.quicklinks = val.quicklinks;\n refreshContextMenu();\n } else if (type == \"loadLyrics\") {\n if (!song.info) return;\n if (val) fetchLyricsFrom(song.info, val, postLyrics);\n else fetchLyrics(song.info, function(providers, src, result) {\n var providersWithUrl = [];\n providers.forEach(function(provider) {\n providersWithUrl.push({ provider: provider, url: lyricsProviders[provider].getUrl() });\n });\n postLyrics(src, result, providersWithUrl);\n });\n } else if (type == \"rated\") {\n if (settings.linkRatings && settings.linkRatingsGpm) {\n var currentSong = songsEqual(song.info, val.song);\n if (val.rating >= settings.linkRatingsMin) {\n if (currentSong) loveTrack();\n else love(val.song, $.noop);\n } else if (val.rating >= 0 && settings.linkRatingsReset) {\n //unlove on reset or lower rating\n if (currentSong) unloveTrack();\n else unlove(val.song, $.noop);\n }\n }\n } else if (type == \"needActiveTab\") {\n executeWithActiveGmTab($.noop, function(restore) {\n restoreActiveTab.restore = restore;\n restoreActiveTab.id = val;\n });\n } else if (type == \"restoreActiveTab\") {\n if (restoreActiveTab.id == val) {\n restoreActiveTab.id = null;\n restoreActiveTab.restore();\n }\n }\n }", "function getMessages(){\n serverRequest(getParams(\"none\"), true); \n}", "function setupListener() {\n chrome.runtime.onMessage.addListener(\n function(request, sender, sendResponse) {\n if (request.message === \"validate_link\") {\n getText(request.url, function(response) {\n var isValid = checkForError(response)\n notifyContent(request.url, isValid)\n })\n }\n }\n )\n}", "function initServer () {\n window.pageId = 'background page'\n chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {\n if (!message) { return }\n\n const selfMsg = selfMsgTester.exec(message.msg)\n if (selfMsg) {\n debugMsg('SELF Received %s from %s', message.msg, getPageInfo(sender).pageId)\n message.msg = selfMsg[1]\n if (sender.tab) {\n messageSend(sender.tab.id, message, response => {\n sendResponse(response)\n })\n } else {\n messageSend(message, response => {\n sendResponse(response)\n })\n }\n\n return true\n }\n\n switch (message.msg) {\n case '__PAGE_INFO__':\n sendResponse(getPageInfo(sender))\n break\n default:\n break\n }\n })\n}", "function handleMessage(request) {\n log.log('[' + id + '] handle message:', request, request.type);\n if (request.type == 'recording') {\n recording = request.value;\n } else if (request.type == 'params') {\n updateParams(request.value);\n } else if (request.type == 'wait') {\n checkWait(request.target);\n } else if (request.type == 'propertyReplacement') {\n\tpropertyReplacement(request);\n } else if (request.type == 'type') {\n\ttype(request);\n } else if (request.type == 'select') {\n\tselect(request);\n } else if (request.type == 'copy') {\n\tcopy(request);\n } else if (request.type == 'paste') {\n\tpaste(request);\n } else if (request.type == 'event') {\n simulate(request);\n } else if (request.type == 'snapshot') {\n port.postMessage({type: 'snapshot', value: snapshotDom(document)});\n } else if (request.type == 'reset') {\n reset();\n } else if (request.type == 'url') {\n port.postMessage({type: 'url', value: document.URL});\n }\n}", "function onmessage(evt) {\n //add text to text area for message log from peer\n if(evt.data.msgcontent!=null ){\n console.log(evt.data.msgcontent);\n //addMessageLog('Other',evt.data.msgcontent);\n //$('#MessageHistoryBox').text( $('#MessageHistoryBox').text() +'\\n'+ 'other : '+ evt.data.msgcontent );\n //texttospeech(evt.data.msgcontent);\n //call translator \n //append the result in messahelanghistory box\n if(mylang!='' && peerlang!=''){\n translator(evt.data.msgcontent,mylang,peerlang); \n }\n else{\n console.log(\" langugae is not set \");\n translator(evt.data.msgcontent,'en','en'); \n }\n \n }else if(evt.data.lang!=null ){\n // set the peer langugae parameter\n peerlang=evt.data.lang;\n console.log(\" language received from peer \"+ peerlang);\n }\n}", "function onmessage(evt) {\n //add text to text area for message log from peer\n if(evt.data.msgcontent!=null ){\n console.log(evt.data.msgcontent);\n addMessageLog('Other',evt.data.msgcontent);\n //$('#MessageHistoryBox').text( $('#MessageHistoryBox').text() +'\\n'+ 'other : '+ evt.data.msgcontent );\n //texttospeech(evt.data.msgcontent);\n //call translator \n //append the rsult in messahelanghistory box\n translator(evt.data.msgcontent,mylang,peerlang); \n \n }else if(evt.data.lang!=null ){\n // set the peer langugae parameter\n peerlang=evt.data.lang;\n console.log(\" language received from peer \"+ peerlang);\n }\n}", "function launchRequestHandler() {\n this.emit(':ask', 'What would you like to know?', \"I'm sorry, I didn't hear you. Could you say that again?\");\n}", "function handleMessages(message, sender, sendResponse) {\n // If asked to set the current state\n if (message.operation == 'setCurrentState') {\n // Set the current state (enabled or disabled)\n currentStatus = message.currentStatus;\n // Query the tabs and notify the content scripts of changes\n if (typeof browser !== 'undefined' && (typeof browser.runtime !== 'undefined' && browser.runtime != null)) {\n let querying = browser.tabs.query({\n }, notifyOfChanges);\n } else if (typeof chrome !== 'undefined' && (typeof chrome.runtime !== 'undefined' && chrome.runtime != null)) {\n let querying = chrome.tabs.query({\n }, notifyOfChanges);\n }\n \n } else if (message.operation == 'getCurrentState') {\n // We are asked to give the current state of the extension\n // Get if we currently have a status\n if (currentStatus != null) {\n // Respond with the current status\n sendResponse({ \"currentStatus\": currentStatus });\n } else {\n // Respond with status: enabled\n sendResponse({ \"currentStatus\": true });\n }\n }\n}", "function send_messenger(){\n var text_messenger = $('#text_messenger').val();\n doGetBotResponse(text_messenger, false);\n }", "function receivedMessage(event) {\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfMessage = event.timestamp;\n var message = event.message;\n\n console.log(\"Received message for user %d and page %d at %d with message:\", \n senderID, recipientID, timeOfMessage);\n console.log(JSON.stringify(message));\n\n var messageId = message.mid;\n var messageText = message.text;\n var messageAttachments = message.attachments;\n var messagePostback = message.payload;\n if (messageText) {\n\n // If we receive a text message, check to see if it matches a keyword\n // and send back the example. Otherwise, just echo the text we received.\n switch (classifier.classify(messageText)) {\n // Be friendly! After all civiility costs nothing except a few\n // lines of code :p\n case 'greet':\n sendTextMessage(senderID, 'Hi! How can I help you today? You can ask me things like \"show me the categories\" or \"what\\'s the weather in Johannesburg\" and I\\'ll try me best to help. So, what will it be?');\n break;\n\n // Lists the categories\n case 'categories':\n sendTextMessage(senderID, 'Okay, let me retrieve them for you.');\n sendCategoriesMessage(senderID);\n break;\n\n // Weather related searches\n case 'weather':\n sendWeatherMessage(senderID, messageText);\n break;\n\n default:\n sendTextMessage(senderID, 'I\\'m sorry but I did not understand your question. You can ask me things like \"show me the categories\" or \"what\\'s the weather in Johannesburg\" and I\\'ll try me best to help. So, what will it be?');\n }\n } else if (messageAttachments) {\n sendTextMessage(senderID, \"Message with attachment received\");\n }\n}", "function receivedMessage(event) {\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfMessage = event.timestamp;\n var message = event.message;\n\n console.log(\"Received message for user %d and page %d at %d with message:\", \n senderID, recipientID, timeOfMessage);\n console.log(JSON.stringify(message));\n\n var isEcho = message.is_echo;\n var messageId = message.mid;\n var appId = message.app_id;\n var metadata = message.metadata;\n\n // You may get a text or attachment but not both\n var messageText = message.text;\n var messageAttachments = message.attachments;\n var quickReply = message.quick_reply;\n\n var user = UserSession[senderID];\n\n if (isEcho) {\n // Just logging message echoes to console\n console.log(\"Received echo for message %s and app %d with metadata %s\", \n messageId, appId, metadata);\n return;\n } else if (quickReply) {\n var quickReplyPayload = quickReply.payload;\n console.log(\"Quick reply for message %s with payload %s\",\n messageId, quickReplyPayload);\n\n receivedQuickReplyPostback(event);\n return;\n }\n\n if(user != null){\n if(user.contactNum == null){\n user.contactNum = messageText;\n showTimeSlotSelectionQuickReplies(user.fbId);\n return;\n }\n\n if(user.isOrderInProgress){\n showOrderContinuationForm(user.fbId);\n return;\n }\n }\n \n\n if (messageText) {\n messageText = messageText.toLowerCase();\n console.log(\"swith case text: \" + messageText);\n // If we receive a text message, check to see if it matches any special\n // keywords and send back the corresponding example. Otherwise, just echo\n // the text we received.\n switch (messageText) { \n\n case 'menu':\n sendTypingOn(senderID);\n sendMainMenu(senderID);\n break; \n\n case 'opening hours':\n sendTypingOn(senderID);\n sendOpeningHoursText(senderID);\n break; \n\n case 'hours':\n sendTypingOn(senderID);\n sendOpeningHoursText(senderID);\n break;\n\n case 'gallery':\n /*sendTypingOn(senderID);\n showGallery(senderID);*/\n break;\n\n case 'testimonials':\n sendTypingOn(senderID);\n showTestimonials(senderID);\n break;\n\n case 'reviews':\n sendTypingOn(senderID);\n showReviews(senderID);\n break; \n\n case 'review':\n sendTypingOn(senderID);\n showReviews(senderID);\n break;\n\n case 'hungry':\n \n break;\n\n case 'book table':\n sendTypingOn(senderID);\n showAskContactTemplate(senderID);\n break;\n\n case 'book a table':\n sendTypingOn(senderID);\n showAskContactTemplate(senderID);\n break;\n\n case 'food':\n sendTypingOn(senderID);\n showSubMenu(senderID,\"food\");\n break;\n\n case 'drinks':\n sendTypingOn(senderID);\n showSubMenu(senderID,\"drinks\");\n break;\n\n case 'deserts':\n sendTypingOn(senderID); \n showSubMenu(senderID,\"deserts\");\n break; \n\n case 'location':\n sendTypingOn(senderID);\n sendLocationTemplate(senderID);\n break;\n\n case 'our location':\n sendTypingOn(senderID);\n sendLocationTemplate(senderID);\n break;\n\n default:\n sendTypingOn(senderID);\n sendWelcomeMessage(senderID);\n\n setTimeout(function(){ \n showTextTemplate(senderID,\"Hi, We'r happy to see u back..\");\n },delayMills); \n }\n } else if (messageAttachments) {\n sendTypingOn(senderID);\n sendWelcomeMessage(senderID);\n /*setTimeout(function(){ \n sendQuickReplySpecial(senderID);\n },delayMills);*/\n }\n}", "function gotMessage(msg, sender, sendResponse){\n\tif(msg.txt == \"click\"){\n\t\tif(audioContent.paused){ // se o audio ta pausado \n \t\tconsole.log(\"Audio Content Tocando\");\n \t\tmaisAlto(audioContent); // aumenta o som e da play\n \t}else{\n \t\tconsole.log(\"Audio Content Pausado\");\n \t\taudioContent.pause(); // pause\n \t}\t\n\t}else if(msg.txt == \"play\"){\n\t\tif(audioContent.paused){ // se o audio ta pausado \n \t\tconsole.log(\"Audio Content Tocando\");\n \t\tmaisAlto(audioContent); // aumenta o som e da play\n \t}\n\t}\n\n}", "function sendMessage() {\n if ($('#receive_message_users').val() == null) {\n showError('receive_message_users', true);\n return ;\n }\n var text = $(tinyMCE.get('message_content').getContent()).text();\n text = text.replace(' ', '');\n if (text.length == 0) {\n showError('message_content', true);\n return ;\n }\n $.post('/inbox', {\n users : $('#receive_message_users').val(),\n content : tinyMCE.get('message_content').getContent(),\n can_reply : $('#message_can_reply').is(':checked') ? 1 : 0\n }, function(results) {\n if (results.error) {\n $('#receive_message_users_error').html(results.error);\n } else {\n window.location.replace(results.location);\n }\n });\n}", "init() {\n chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {\n if (request.from == 'popup') {\n if (request.type == 'requestData') {\n sendResponse({\n from: 'chromebot',\n type: 'popupData',\n data: {\n 'menus' : this.menus,\n 'buttons' : this.buttons,\n 'defaultMenu' : this.defaultMenu\n }\n });\n }\n // Called when a button is pressed by the user\n else if (request.type == 'buttonOnClick' && request.buttonId != undefined) {\n if (request.buttonId in this.buttons) {\n this.buttons[request.buttonId].onClick();\n }\n }\n }\n })\n }", "function connectToContentPage(tabID) {\r\n if (inExtensionPage) {\r\n // messaging with chrome.runtime.Port.sendMessage and chrome.runtime.Port.onMessage\r\n port = chrome.tabs.connect(tabID, {name:\"popup window\"});\r\n port.onMessage.addListener(onContentPageMessage);\r\n } else {\r\n // messaging with window.postMessage and window.addEventListner(\"message\", function )\r\n port = {\r\n postMessage: function(msg) {\r\n window.top.postMessage(msg, \"*\");\r\n }\r\n };\r\n // onMessage is in function window.addEventListener at about line 21\r\n }\r\n \r\n port.postMessage({method:\"GetAllMessages\"});\r\n}", "function sendHelperMessage(msg) {\n var port = chrome.runtime.connect({ name: 'popup' });\n port.postMessage(msg);\n port.onMessage.addListener(function (response) {\n console.log('Got response message: ', response);\n });\n}", "function respond(request, tabId){\n\tchrome.tabs.sendMessage(tabId, {message: request}, function(response) {console.log(response.backMessage)})\n}", "function messageListener(message, sender, sendResponse)\r\n{\r\n //Message sent from options.js, whitelist was updated\r\n if (message.message === \"whitelist updated\")\r\n {\r\n //Updating whitelist from storage\r\n browser.storage.sync.get([\"whitelistedHosts\"], function(result){\r\n doNotBlockHosts = result.whitelistedHosts;\r\n });\r\n }\r\n //HTTP request shield was turned on\r\n else if (message.message === \"turn request shield on\")\r\n {\r\n //Hook up the listeners\r\n browser.webRequest.onBeforeSendHeaders.addListener(\r\n beforeSendHeadersListener,\r\n {urls: [\"<all_urls>\"]},\r\n [\"blocking\", \"requestHeaders\"]\r\n );\r\n\r\n browser.webRequest.onHeadersReceived.addListener(\r\n onHeadersReceivedRequestListener,\r\n {urls: [\"<all_urls>\"]},\r\n [\"blocking\"]\r\n );\r\n\r\n browser.webRequest.onErrorOccurred.addListener(\r\n onErrorOccuredListener,\r\n {urls: [\"<all_urls>\"]}\r\n );\r\n }\r\n //HTTP request shield was turned off\r\n else if (message.message === \"turn request shield off\")\r\n {\r\n //Disconnect the listeners\r\n browser.webRequest.onBeforeSendHeaders.removeListener(beforeSendHeadersListener);\r\n browser.webRequest.onHeadersReceived.removeListener(onHeadersReceivedRequestListener);\r\n browser.webRequest.onErrorOccurred.removeListener(onErrorOccuredListener);\r\n }\r\n //Mesage came from popup.js, whitelist this site\r\n else if (message.message === \"add site to whitelist\")\r\n {\r\n //Obtain current hostname and whitelist it\r\n var currentHost = message.site;\r\n doNotBlockHosts[currentHost] = true;\r\n browser.storage.sync.set({\"whitelistedHosts\":doNotBlockHosts});\r\n }\r\n //Message came from popup.js, remove whitelisted site\r\n else if (message.message === \"remove site from whitelist\")\r\n {\r\n //Obtain current hostname and remove it\r\n currentHost = message.site;\r\n delete doNotBlockHosts[currentHost];\r\n browser.storage.sync.set({\"whitelistedHosts\":doNotBlockHosts});\r\n }\r\n //Message came from popup,js, asking whether is this site whitelisted\r\n else if (message.message === \"is current site whitelisted?\")\r\n {\r\n //Read the current hostname\r\n var currentHost = message.site;\r\n //Response with appropriate message\r\n if (checkWhitelist(currentHost))\r\n {\r\n sendResponse(\"current site is whitelisted\");\r\n return true;\r\n }\r\n else\r\n {\r\n sendResponse(\"current site is not whitelisted\");\r\n return true;\r\n }\r\n }\r\n}", "function sendAddonMessage (msg) {\n browser.runtime.sendMessage(\n\t{source: \"sidebar:\"+myWindowId,\n\t content: msg\n\t}\n ).then(handleMsgResponse, handleMsgError);\n}", "function callbackOnExecuteScript() {\n console.log(\"tabID \" + tabId);\n chrome.tabs.sendMessage(tabId, message);\n }", "function checkContentBotMessage() {\n $('.message_bot_area .fixedsidebar-content').html('');\n initFilterGroup();\n message_area_select(true);\n}", "function injectContent() {\r\n\tvar data = require(\"sdk/self\").data;\r\n\trequire('sdk/page-mod').PageMod({\r\n\t\tinclude: [\"*.gaiamobile.org\"],\r\n\t\tcontentScriptFile: [\r\n\t\t\tdata.url(\"ffos_runtime.js\"),\r\n\t\t\tdata.url(\"hardware.js\"),\r\n\r\n\t\t\tdata.url(\"lib/activity.js\"),\r\n\t\t\tdata.url(\"lib/apps.js\"),\r\n\t\t\tdata.url(\"lib/bluetooth.js\"),\r\n\t\t\tdata.url(\"lib/cameras.js\"),\r\n\t\t\tdata.url(\"lib/idle.js\"),\r\n\t\t\tdata.url(\"lib/keyboard.js\"),\r\n\t\t\tdata.url(\"lib/mobile_connection.js\"),\r\n\t\t\tdata.url(\"lib/power.js\"),\r\n\t\t\tdata.url(\"lib/set_message_handler.js\"),\r\n\t\t\tdata.url(\"lib/settings.js\"),\r\n\t\t\tdata.url(\"lib/wifi.js\")\r\n\t\t],\r\n\t\tcontentScriptWhen: \"start\",\r\n\t\tattachTo: ['existing', 'top', 'frame']\r\n\t})\r\n\r\n\trequire('sdk/page-mod').PageMod({\r\n\t\tinclude: [\"*.homescreen.gaiamobile.org\"],\r\n\t\tcontentScriptFile: [\r\n\t\t\tdata.url(\"apps/homescreen.js\")\r\n\t\t],\r\n\t\tcontentScriptWhen: \"start\",\r\n\t\tattachTo: ['existing', 'top', 'frame']\r\n\t})\r\n\r\n}", "onMessageStart() { }", "function sendMsg(tabs) {\n let tab = tabs[0];\n let msg = {\n content: \"clicked\",\n };\n\n chrome.tabs.sendMessage(tab.id, msg);\n console.log(\"[INFO] Message sent to content script\");\n}", "function background_onMessage (request, sender, sendResponse){\n\t\tif (request.data && request.data.view) return;\n\n\t\tprocessMessage(request);\n\t}", "function sendRequest(action, input, callback) {\n chrome.runtime.sendMessage({\n from: \"content\",\n action: action,\n input: input\n }, callback);\n}", "function localEngine(msg) {\n\tif(!msg) {\n\t\treturn;\n\t}\n\tif(msg.hasChildNodes()) {\n\t\tvar actions = msg.getElementsByTagName('action');\n\t\tvar mySize = actions.length;\n\t\tfor(count=0;count < mySize;count++) {\n\t\t\ttry {\n\t\t\t\ttask = actions[count].getElementsByTagName('task')[0].firstChild.nodeValue;\n\t\t\t\t\n\t\t\t\tif(task == 'createWidget') {\t\t\t\t\t\t\n\t\t\t\t\tx = actions[count].getElementsByTagName('position')[0].getElementsByTagName('x')[0].firstChild.nodeValue;\n\t\t\t\t\ty = actions[count].getElementsByTagName('position')[0].getElementsByTagName('y')[0].firstChild.nodeValue;\n\t\t\t\t\thoriz = actions[count].getElementsByTagName('position')[0].getElementsByTagName('horiz')[0].firstChild.nodeValue;\n\t\t\t\t\tvert = actions[count].getElementsByTagName('position')[0].getElementsByTagName('vert')[0].firstChild.nodeValue;\n\t\t\t\t\tname = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tchecknum = actions[count].getElementsByTagName('checknum')[0].firstChild.nodeValue;\n\t\t\t\t\tfather = actions[count].getElementsByTagName('father')[0].firstChild.nodeValue;\n\t\t\t\t\twidgetname = actions[count].getElementsByTagName('widgetname')[0].firstChild.nodeValue;\n\t\t\t\t\tcent = actions[count].getElementsByTagName('cent')[0].firstChild.nodeValue;\n\t\t\t\t\ttry{\n\t\t\t\t\t\teval (widgetname+\"_show(\"+actions[count].getElementsByTagName('params')[0].firstChild.nodeValue+\",'\"+name+\"','\"+father+\"','\"+x+\"','\"+y+\"','\"+horiz+\"','\"+vert+\"','\"+checknum+\"','\"+cent+\"');\");\n\t\t\t\t\t}catch(err){\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'messageBox') {\n\t\t\t\t\tcontent = actions[count].getElementsByTagName('content')[0].firstChild.nodeValue;\n\t\t\t\t\tcontent = tinyMCE.entityDecode(content);\n\t\t\t\t\ttype = actions[count].getElementsByTagName('type')[0].firstChild.nodeValue;\n\t\t\t\t\tif (!type || type == 1) {\n\t\t\t\t\t\teyeMessageBoxShow(content);\n\t\t\t\t\t} else if (type == 2) {\n\t\t\t\t\t\talert(content);\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'setValue') {\n\t\t\t\t\tcontent = actions[count].getElementsByTagName('content')[0].firstChild.nodeValue;\n\t\t\t\t\twidget = actions[count].getElementsByTagName('widget')[0].firstChild.nodeValue;\n\t\t\t\t\tif(document.getElementById(widget)) {\n\t\t\t\t\t\tdocument.getElementById(widget).value = content;\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'setValueB64') {\n\t\t\t\t\tcontent = actions[count].getElementsByTagName('content')[0].firstChild.nodeValue;\n\t\t\t\t\twidget = actions[count].getElementsByTagName('widget')[0].firstChild.nodeValue;\n\t\t\t\t\tif(document.getElementById(widget)) {\n\t\t\t\t\t\tdocument.getElementById(widget).value = Base64.decode(content);\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'concatValue') {\n\t\t\t\t\tcontent = actions[count].getElementsByTagName('content')[0].firstChild.nodeValue;\n\t\t\t\t\twidget = actions[count].getElementsByTagName('widget')[0].firstChild.nodeValue;\n\t\t\t\t\tif(document.getElementById(widget)) {\n\t\t\t\t\t\tdocument.getElementById(widget).value = document.getElementById(widget).value+content;\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'concatValueB64') {\n\t\t\t\t\tcontent = actions[count].getElementsByTagName('content')[0].firstChild.nodeValue;\n\t\t\t\t\twidget = actions[count].getElementsByTagName('widget')[0].firstChild.nodeValue;\n\t\t\t\t\tif(document.getElementById(widget)) {\n\t\t\t\t\t\tdocument.getElementById(widget).value = document.getElementById(widget).value+Base64.decode(content);\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'concatDiv') {\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tcontent = actions[count].getElementsByTagName('content')[0].firstChild.nodeValue;\n\t\t\t\t\twidget = actions[count].getElementsByTagName('widget')[0].firstChild.nodeValue;\t\t\t\t\t\t\n\t\t\t\t\tif(document.getElementById(widget)) {\n\t\t\t\t\t\tdocument.getElementById(widget).innerHTML = document.getElementById(widget).innerHTML+content;\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'rawjs') {\n\t\t\t\t\tjs = actions[count].getElementsByTagName('js')[0].firstChild.nodeValue;\n\t\t\t\t\tjs=js.replace(/\\n/,\"\");\n\t\t\t\t\tjs=js.replace(/\\r/,\"\");\n\t\t\t\t\teval(js);\n\t\t\t\t} else if(task == 'setDiv') {\n\t\t\t\t\tcontent = actions[count].getElementsByTagName('content')[0].firstChild.nodeValue;\n\t\t\t\t\tname = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tdocument.getElementById(name).innerHTML = content;\n\t\t\t\t} else if(task == 'loadScript') {\n\t\t\t\t\turl = actions[count].getElementsByTagName('url')[0].firstChild.nodeValue;\n\t\t\t\t\tdhtmlLoadScript(url);\n\t\t\t\t} else if(task == 'loadCSS') {\n\t\t\t\t\turl = actions[count].getElementsByTagName('url')[0].firstChild.nodeValue;\n\t\t\t\t\tid = actions[count].getElementsByTagName('id')[0].firstChild.nodeValue;\n\t\t\t\t\tdhtmlLoadCSS(url,id);\n\t\t\t\t} else if(task == 'removeCSS') {\n\t\t\t\t\tid = actions[count].getElementsByTagName('id')[0].firstChild.nodeValue;\n\t\t\t\t\tdhtmlRemoveCSS(id);\n\t\t\t\t} else if(task == 'removeWidget') {\n\t\t\t\t\tname = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tremoveWidget(name);\n\t\t\t\t} else if(task == 'createDiv') {\n\t\t\t\t\tname = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tmyClass = actions[count].getElementsByTagName('class')[0].firstChild.nodeValue;\n\t\t\t\t\tfather = actions[count].getElementsByTagName('father')[0].firstChild.nodeValue;\n\t\t\t\t\tvar myDiv = document.createElement('div');\n\t\t\t\t\tmyDiv.setAttribute(\"id\", name);\n\t\t\t\t\tmyDiv.className = myClass;\n\t\t\t\t\tvar divFather = document.getElementById(father);\n\t\t\t\t\tdivFather.appendChild(myDiv);\n\t\t\t\t} else if(task == 'setWallpaper') {\n\t\t\t\t\turl = actions[count].getElementsByTagName('url')[0].firstChild.nodeValue;\n\t\t\t\t\trepeat = actions[count].getElementsByTagName('repeat')[0].firstChild.nodeValue;\n\t\t\t\t\tcenter = actions[count].getElementsByTagName('center')[0].firstChild.nodeValue;\n\t\t\t\t\tsetWallpaper(url,repeat,center);\n\t\t\t\t} else if(task == 'updateCss') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tvar prop = actions[count].getElementsByTagName('property')[0].firstChild.nodeValue;\n\t\t\t\t\tvar val = actions[count].getElementsByTagName('value')[0].firstChild.nodeValue;\n\t\t\t\t\tupdateCss(name,prop,val);\n\t\t\t\t} else if(task == 'makeDrag') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tvar father = actions[count].getElementsByTagName('father')[0].firstChild.nodeValue;\n\t\t\t\t\t//We use try catch for evade the differents beteewn browsers\n\t\t\t\t\ttry{\n\t\t\t\t\t\tvar noIndex = actions[count].getElementsByTagName('noIndex')[0].firstChild;\t\t\t\t\t\t\t\n\t\t\t\t\t\tmakeDrag(name,father,'','','',noIndex);\n\t\t\t\t\t}catch(err){\t\t\t\t\t\t\t\n\t\t\t\t\t\tmakeDrag(name,father,'','','','');\n\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t} else if(task == 'rawSendMessage') {\n\t\t\t\t\tvar myMsg = actions[count].getElementsByTagName('msg')[0].firstChild.nodeValue;\n\t\t\t\t\t\n\t\t\t\t\tif(actions[count].getElementsByTagName('par')[0].firstChild){\n\t\t\t\t\t\tvar myPar = actions[count].getElementsByTagName('par')[0].firstChild.nodeValue;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar myPar = '';\n\t\t\t\t\t}\n\t\t\t\t\tvar myCheck = actions[count].getElementsByTagName('checknum')[0].firstChild.nodeValue;\n\t\t\t\t\tsendMsg(myCheck,myMsg,myPar);\t\n\t\t\t\t} else if(task == 'addEvent') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tvar event = actions[count].getElementsByTagName('event')[0].firstChild.nodeValue;\n\t\t\t\t\tvar func = actions[count].getElementsByTagName('func')[0].firstChild.nodeValue;\n\t\t\t\t\tvar args = actions[count].getElementsByTagName('args')[0].firstChild.nodeValue;\n\t\t\t\t\tif(args == 0) {\n\t\t\t\t\t\teval('document.getElementById(\"'+name+'\").'+event+'=function(){'+func+'}');\n\t\t\t\t\t} else {\n\t\t\t\t\t\teval('document.getElementById(\"'+name+'\").'+event+'=function('+args+'){'+func+'}');\n\t\t\t\t\t}\n\t\t\t\t} else if(task == 'createLayer') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tvar myClass = actions[count].getElementsByTagName('class')[0].firstChild.nodeValue;\n\t\t\t\t\tvar father = actions[count].getElementsByTagName('father')[0].firstChild.nodeValue;\n\t\t\t\t\tcreateLayer(name,father,myClass);\n\t\t\t\t} else if(task == 'removeLayer') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t \tremoveLayer(name);\n\t\t\t\t} else if(task == 'showLayer') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tshowLayer(name);\n\t\t\t\t} else if(task == 'hideLayer') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\thideLayer(name);\n\t\t\t\t} else if(task == 'fadeOutLayer') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tvar time = actions[count].getElementsByTagName('time')[0].firstChild.nodeValue;\n\t\t\t\t\tvar startAlpha = actions[count].getElementsByTagName('startAlpha')[0].firstChild.nodeValue;\n\t\t\t\t\tvar endAlpha = actions[count].getElementsByTagName('endAlpha')[0].firstChild.nodeValue;\n\n\t\t\t\t\tfadeOutLayer(name,startAlpha,endAlpha,time);\n\t\t\t\t} else if(task == 'fadeInLayer') {\n\t\t\t\t\tvar name = actions[count].getElementsByTagName('name')[0].firstChild.nodeValue;\n\t\t\t\t\tvar time = actions[count].getElementsByTagName('time')[0].firstChild.nodeValue;\n\t\t\t\t\tvar startAlpha = actions[count].getElementsByTagName('startAlpha')[0].firstChild.nodeValue;\n\t\t\t\t\tvar endAlpha = actions[count].getElementsByTagName('endAlpha')[0].firstChild.nodeValue;\n\t\t\t\t\tfadeInLayer(name,startAlpha,endAlpha,time);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\n\t\t\t}\n\t\t}\n\t}\n}", "function messaging( message, callback ) {\n chrome.runtime.sendMessage( message, callback );\n }", "function init()\n {\n // register button commands\n rcmail.register_command('createnote', function(){\n warn_unsaved_changes(function(){ edit_note(null, 'new'); });\n }, false);\n rcmail.register_command('list-create', function(){ list_edit_dialog(null); }, true);\n rcmail.register_command('list-edit', function(){ list_edit_dialog(me.selected_list); }, false);\n rcmail.register_command('list-delete', function(){ list_delete(me.selected_list); }, false);\n rcmail.register_command('list-remove', function(){ list_remove(me.selected_list); }, false);\n rcmail.register_command('list-sort', list_set_sort, true);\n rcmail.register_command('save', save_note, true);\n rcmail.register_command('delete', delete_notes, false);\n rcmail.register_command('search', quicksearch, true);\n rcmail.register_command('reset-search', reset_search, true);\n rcmail.register_command('sendnote', send_note, false);\n rcmail.register_command('print', print_note, false);\n rcmail.register_command('history', show_history_dialog, false);\n\n // register server callbacks\n rcmail.addEventListener('plugin.data_ready', data_ready);\n rcmail.addEventListener('plugin.render_note', render_note);\n rcmail.addEventListener('plugin.update_note', update_note);\n rcmail.addEventListener('plugin.update_list', list_update);\n rcmail.addEventListener('plugin.destroy_list', list_destroy);\n rcmail.addEventListener('plugin.unlock_saving', function() {\n if (saving_lock) {\n rcmail.set_busy(false, null, saving_lock);\n }\n if (rcmail.gui_objects.noteseditform) {\n rcmail.lock_form(rcmail.gui_objects.noteseditform, false);\n }\n });\n\n rcmail.addEventListener('plugin.close_history_dialog', close_history_dialog);\n rcmail.addEventListener('plugin.note_render_changelog', render_changelog);\n rcmail.addEventListener('plugin.note_show_revision', render_revision);\n rcmail.addEventListener('plugin.note_show_diff', show_diff);\n\n // initialize folder selectors\n if (settings.selected_list && !me.notebooks[settings.selected_list]) {\n settings.selected_list = null;\n }\n for (var id in me.notebooks) {\n if (me.notebooks[id].editable && !settings.selected_list) {\n settings.selected_list = id;\n }\n }\n\n var widget_class = window.kolab_folderlist || rcube_treelist_widget;\n notebookslist = new widget_class(rcmail.gui_objects.notebooks, {\n id_prefix: 'rcmliknb',\n save_state: true,\n selectable: true,\n keyboard: true,\n searchbox: '#notebooksearch',\n search_action: 'notes/list',\n search_sources: [ 'folders', 'users' ],\n search_title: rcmail.gettext('listsearchresults','kolab_notes'),\n check_droptarget: function(node) {\n var list = me.notebooks[node.id];\n return !node.virtual && list.editable && node.id != me.selected_list;\n }\n });\n notebookslist.addEventListener('select', function(node) {\n var id = node.id;\n if (me.notebooks[id] && id != me.selected_list) {\n warn_unsaved_changes(function(){\n rcmail.enable_command('createnote', has_permission(me.notebooks[id], 'i'));\n rcmail.enable_command('list-edit', has_permission(me.notebooks[id], 'a'));\n rcmail.enable_command('list-delete', has_permission(me.notebooks[id], 'xa'));\n rcmail.enable_command('list-remove', !me.notebooks[id]['default']);\n fetch_notes(id); // sets me.selected_list\n rcmail.triggerEvent('show-list', {title: me.notebooks[id].listname}); // Elastic\n },\n function(){\n // restore previous selection\n notebookslist.select(me.selected_list);\n });\n }\n\n // unfocus clicked list item\n $(notebookslist.get_item(id)).find('a.listname').first().blur();\n });\n notebookslist.addEventListener('subscribe', function(p) {\n var list;\n if ((list = me.notebooks[p.id])) {\n list.subscribed = p.subscribed || false;\n rcmail.http_post('list', { _do:'subscribe', _list:{ id:p.id, permanent:list.subscribed?1:0 } });\n }\n });\n notebookslist.addEventListener('remove', function(p) {\n if (me.notebooks[p.id] && !me.notebooks[p.id]['default']) {\n list_remove(p.id);\n }\n });\n notebookslist.addEventListener('insert-item', function(p) {\n var list = p.data;\n if (list && list.id && !list.virtual) {\n me.notebooks[list.id] = list;\n if (list.subscribed)\n rcmail.http_post('list', { _do:'subscribe', _list:{ id:p.id, permanent:1 } });\n }\n });\n notebookslist.addEventListener('click-item', function(p) {\n // avoid link execution\n return false;\n });\n notebookslist.addEventListener('search-complete', function(data) {\n if (data.length)\n rcmail.display_message(rcmail.gettext('nrnotebooksfound','kolab_notes').replace('$nr', data.length), 'voice');\n else\n rcmail.display_message(rcmail.gettext('nonotebooksfound','kolab_notes'), 'notice');\n });\n\n // Make Elastic checkboxes pretty\n if (window.UI && UI.pretty_checkbox) {\n notebookslist.addEventListener('add-item', function(prop) {\n UI.pretty_checkbox($(prop.li).find('input'));\n });\n }\n\n $(rcmail.gui_objects.notebooks).on('click', 'div.folder > a.listname', function(e) {\n var id = String($(this).closest('li').attr('id')).replace(/^rcmliknb/, '');\n notebookslist.select(id);\n e.preventDefault();\n return false;\n });\n\n // register dbl-click handler to open list edit dialog\n $(rcmail.gui_objects.notebooks).on('dblclick', 'li:not(.virtual) a', function(e) {\n var id = String($(this).closest('li').attr('id')).replace(/^rcmliknb/, '');\n if (me.notebooks[id] && has_permission(me.notebooks[id], 'a')) {\n list_edit_dialog(id);\n }\n\n // clear text selection (from dbl-clicking)\n var sel = window.getSelection ? window.getSelection() : document.selection;\n if (sel && sel.removeAllRanges) {\n sel.removeAllRanges();\n }\n else if (sel && sel.empty) {\n sel.empty();\n }\n\n e.preventDefault();\n return false;\n });\n\n // initialize notes list widget\n if (rcmail.gui_objects.noteslist) {\n rcmail.noteslist = noteslist = new rcube_list_widget(rcmail.gui_objects.noteslist,\n { multiselect:true, draggable:true, keyboard:true });\n noteslist.addEventListener('select', function(list) {\n render_no_focus = rcube_event._last_keyboard_event && $(list.list).has(rcube_event._last_keyboard_event.target);\n var selection_changed = list.selection.length != 1 || !me.selected_note || list.selection[0] != me.selected_note.id;\n selection_changed && warn_unsaved_changes(function(){\n var note;\n if (!list.multi_selecting && noteslist.selection.length == 1 && (note = notesdata[noteslist.selection[0]])) {\n edit_note(note.uid, 'edit');\n }\n else {\n reset_view(true);\n }\n },\n function(){\n // TODO: previous restore selection\n list.select(me.selected_note.id);\n });\n\n rcmail.enable_command('delete', me.notebooks[me.selected_list] && has_permission(me.notebooks[me.selected_list], 'td') && list.selection.length > 0);\n rcmail.enable_command('sendnote', list.selection.length > 0);\n rcmail.enable_command('print', 'history', list.selection.length == 1);\n })\n .addEventListener('dragstart', function(e) {\n folder_drop_target = null;\n notebookslist.drag_start();\n })\n .addEventListener('dragmove', function(e) {\n folder_drop_target = notebookslist.intersects(rcube_event.get_mouse_pos(e), true);\n })\n .addEventListener('dragend', function(e) {\n notebookslist.drag_end();\n\n // move dragged notes to this folder\n if (folder_drop_target) {\n noteslist.draglayer.hide();\n\n // check unsaved changes first\n var new_folder_id = folder_drop_target;\n warn_unsaved_changes(\n // ok\n function() {\n move_notes(new_folder_id);\n reset_view();\n noteslist.clear_selection();\n },\n // nok\n undefined,\n // beforesave\n function(savedata) {\n savedata.list = new_folder_id;\n\n // remove from list and thus avoid being moved (again)\n var id = me.selected_note.id;\n noteslist.remove_row(id);\n delete notesdata[id];\n }\n );\n }\n folder_drop_target = null;\n })\n .init().focus();\n }\n\n if (settings.sort_col) {\n $('#notessortmenu a.by-' + settings.sort_col).addClass('selected');\n }\n\n init_editor();\n\n if (settings.selected_list) {\n notebookslist.select(settings.selected_list)\n }\n\n rcmail.addEventListener('kolab-tags-search', filter_notes)\n .addEventListener('kolab-tags-drop-data', function(e) { return notesdata[e.id]; })\n .addEventListener('kolab-tags-drop', function(e) {\n if ($(e.list).is('#kolabnoteslist')) {\n return;\n }\n\n var rec = notesdata[e.id];\n\n if (rec && rec.id && e.tag) {\n savedata = me.selected_note && rec.uid == me.selected_note.uid ? get_save_data() : $.extend({}, rec);\n\n if (savedata.id) delete savedata.id;\n if (savedata.html) delete savedata.html;\n\n if (!savedata.tags)\n savedata.tags = [];\n savedata.tags.push(e.tag);\n\n rcmail.lock_form(rcmail.gui_objects.noteseditform, true);\n saving_lock = rcmail.set_busy(true, 'kolab_notes.savingdata');\n rcmail.http_post('action', { _data: savedata, _do: 'edit' }, true);\n }\n });\n\n rcmail.triggerEvent('kolab-notes-init');\n }", "function setEventListener() {\n\taddEventListener(\"message\", function(event) {\n\t\tif (event.origin + \"/\" == chrome.extension.getURL(\"\")) {\n\t\t\tvar eventToolName = event.data.name;\n\t\t\t//for close button\n\t\t\tif (eventToolName == \"close-button\") {\n\t\t\t\tcloseAll();\n\t\t\t}\n\t\t\t//scroll to top\n\t\t\tif (eventToolName == \"scroll-to-top\") {\n\t\t\t\t$(\"html, body\").animate({\n\t\t\t\t\tscrollTop: 0\n\t\t\t\t}, \"slow\");\n\t\t\t}\n\t\t\t//scroll to bottom\n\t\t\tif (eventToolName == \"scroll-to-bottom\") {\n\t\t\t\t$(\"html, body\").animate({\n\t\t\t\t\tscrollTop: $(document).height()\n\t\t\t\t}, \"slow\");\n\t\t\t}\n\t\t\t//to decrease size of frame\n\t\t\tif (eventToolName == \"resize-button\") {\n\t\t\t\tresizeFrame();\n\t\t\t}\n\t\t\t//to increase size of frame\n\t\t\tif (eventToolName == \"maximize-button\") {\n\t\t\t\tmaximizeFrame();\n\t\t\t}\n\t\t\t//for restarting tool\n\t\t\tif(eventToolName==\"restartTool\"){\n\t\t\t\trestartTool(false);\n\t\t\t}\n\t\t\t//for inviting friends to like a page\n\t\t\tif (eventToolName == \"post\") {\n\t\t\t\tvar message = event.data.message;\n\t\t\t\tvar delay = event.data.delay;\n\t\t\t\tvar start = event.data.start;\n\t\t\t\tvar end = event.data.end;\n\t\t\t\tdelay=parseInt(delay);\n\t\t\t\tstart=parseInt(start);\n\t\t\t\tend=parseInt(end);\n\t\t\t\tprocess(message,delay,start,end);\n\t\t\t}\n\t\t}\n\t}, false);\n}", "function message_recv(message){\n if(message.subject == \"add_training_data\"){\n label = message.label;\n keywords = message.keywords;\n addTrainingData(keywords, label);\n training();\n return;\n }\n else if (message.subject == \"request_categories\"){\n chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {\n chrome.tabs.sendMessage(tabs[0].id, {subject: \"categories\", categories: JSON.stringify(categories)});\n });\n return;\n }\n else if (message.subject == 'get_pri'){\n chrome.runtime.sendMessage(message={subject:'pri_history', pri_history : JSON.stringify(pri_history)});\n return; \n }\n chrome.tabs.sendMessage(message={'labels' : labels, 'keywords' : keywords, 'count_matrix' : count_matrix});\n}", "function handleServerRequest()\n{\n\t//send data to the div or html element for notifications\n}", "onMessageReceive() {}", "function initMessageSystem() \n{\n\treceiveSystemMessagesText(true); //initiates the first data query\n}", "function messageReceivedExternal(e){\n //try to convert data back into an object if needbe:\n var data = unstringify(e.data);\n\n //block messages from an iframe we didnt make:\n if(e.source != otherWindow) return;\n\n //check that data is in the correct format:\n if(typeof data != \"object\" || data === null) return;\n if(typeof data.action != \"string\") return;\n\n //data is OK, let's use it:\n messageReceived(data);\n }", "onMessage() {}", "onMessage() {}", "function gotMessage(message,sender,sendResponse){\n console.log(\"gotMessage:= popup.js\");\n\n\n console.log(\"message:=\"+ message.txt);\n\n\n // if (message.txt == 'Today Hello Hi Hi'){\n console.log('gotMessage');\n \nlet paragraph = document.getElementsByTagName('p');\n\nfor (elt of paragraph){\n console.log('elt');\n console.log(elt);\n elt.innerHTML = message.txt;\n}\n\n//if ((message.txt==\"launch\") || (message.txt==\"Launch\") || (message.txt==\"LAUNCH\") ){\n\n launch();\n download_csv_file();\n }", "function sendContentToEngageBay() {\r\n\r\n\t\t\t\t\t$(\"html, body\").removeAttr(\"style\")\r\n\t\t\t\t\t$(\"#core-nav\").css({\r\n\t\t\t\t\t\t\"display\" : \"none\"\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t\tvar profileId = window.location.href.replace('www.', '')\r\n\t\t\t\t\t\t\t.replace('linkedin.com/in', '').replace('https://',\r\n\t\t\t\t\t\t\t\t\t'').replace('http://', '').split('/').join(\r\n\t\t\t\t\t\t\t\t\t'').split('#')[0].split('?')[0];\r\n\r\n\t\t\t\t\tfetchLinkedInProfileData(profileId, postMessage);\r\n\r\n\t\t\t\t\tfunction postMessage(data_link) {\r\n\r\n\t\t\t\t\t\tvar postMessageData = {};\r\n\t\t\t\t\t\tpostMessageData.event_name = \"CONTACT_DATA_SYNC_FROM_LINKEDIN\";\r\n\t\t\t\t\t\tpostMessageData.event_data = data_link;\r\n\t\t\t\t\t\tpostMessageData.action = 'linkedin_sync_data_received';\r\n\r\n\t\t\t\t\t\t// window.parent.postMessage(postMessageData,\"*\");\r\n\r\n\t\t\t\t\t\tchrome.runtime.sendMessage({\r\n\t\t\t\t\t\t\tevent : 'post_message_to_tab',\r\n\t\t\t\t\t\t\ttab_id : parentTabId,\r\n\t\t\t\t\t\t\tdata : postMessageData\r\n\t\t\t\t\t\t}, function(response) {\r\n\t\t\t\t\t\t\tchrome.runtime.sendMessage({\r\n\t\t\t\t\t\t\t\tevent : 'close_tab',\r\n\t\t\t\t\t\t\t\ttab_id : currentTabId\r\n\t\t\t\t\t\t\t}, function(response) {\r\n\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}", "function onMessage(event) {\n // We only accept messages from the injected script\n if (event.source != window || event.data.type != \"FROM_PRIMEPLAYER\" || !event.data.msg) return;\n switch (event.data.msg) {\n case \"playlistSongRated\":\n $(\"#main .song-row[data-index='\" + event.data.index + \"']\").find(\"td[data-col='rating']\").trigger(\"DOMSubtreeModified\");\n /* falls through */\n case \"playlistSongStarted\":\n case \"playlistSongError\":\n pausePlaylistParsing = false;\n if (typeof(resumePlaylistParsingFn) == \"function\") resumePlaylistParsingFn();\n resumePlaylistParsingFn = null;\n break;\n case \"cleanupCs\":\n port.disconnect();\n cleanup();\n window.postMessage({ type: \"FROM_PRIMEPLAYER\", msg: \"cleanupCsDone\" }, location.href);\n break;\n }\n }", "function process() {\r\n const message = msg.value;\r\n\r\n // form a URL to make a GET request to\r\n let url = `${baseUrl}${type}?m=${message}`;\r\n\r\n // if operations requires a key, append a parameter to the URL\r\n if (!key.disabled) {\r\n // append key\r\n url += `&k=${key.value}`;\r\n }\r\n\r\n console.log(url);\r\n\r\n // start a progress loader\r\n loader.classList.remove(\"hide\");\r\n out.classList.add(\"hide\");\r\n\r\n get(url, (resp) => {\r\n loader.classList.add(\"hide\");\r\n out.classList.remove(\"hide\");\r\n console.log(resp);\r\n out.innerHTML = resp;\r\n });\r\n}", "function getReply(){\n let {PythonShell} = require('python-shell')\n var path = require(\"path\")\n\n var options = {\n scriptPath : path.join(__dirname, './Engine/'),\n }\n\n console.log(options.scriptPath,\"Greetings\")\n\n var anton = new PythonShell('greetings.py',options);\n\n anton.on('message',function(message){\n console.log(message)\n })\n}", "function onMessageHandler (target, context, msg, self) {\n\n\n if (self) { return; } // Ignore messages from the bot\n \n info(target, \"Hola gente! Para saber los comandos !comandos\");\n \n var destacado = false;\n if (context['msg-id'] == 'highlighted-message') {\n destacado = true;\n }\n\n\n // Remove whitespace from chat message\n const commandName = msg.trim().split(' ')[0];\n var success = true;\n if (commandName.charAt(0)==='!') {\n if (ready || commandName == '!comandos' || destacado) {\n const sound = commandName.substring(1);\n switch (sound) { \n case \"hypnosapo\":\n client.say(target, \"Alabemos todos al gran hypnosapo!\");\n playSound(sound); \n break;\n case \"samatao\":\n client.say(target, \"Sa matao Paco!!!\");\n playSound(sound); \n break;\n case \"cuidao\":\n client.say(target, \"Cuidaooooo!!!\");\n playSound(sound); \n break;\n case \"siuuu\":\n client.say(target, \"Siuuuuuuu!!!\");\n playSound(sound); \n break;\n case \"jurasico\":\n client.say(target, \"Tiriri ri ri, tiri ri ri ri, tiririiiiii!!!\");\n playSound(sound); \n break;\n case \"alcuerno\":\n client.say(target, \"Al cuerno todo!!!\");\n playSound(sound); \n break;\n case \"ranita\":\n client.say(target, \"Una ranita iba paseando!!!\");\n playSound(sound); \n break;\n case \"expulsion\":\n client.say(target, \"No me jodas Rafa!!\");\n playSound(sound); \n break;\n case \"lee\":\n readTextUser(msg, context['username'])\n break;\n case \"chiste\":\n tellJoke();\n break;\n case \"eugenio\":\n randomJoke();\n break;\n case \"comandos\":\n client.say(target, \"Comandos: !lee <texto>, !chiste, !hypnosapo, !samatao, !cuidao, !siuuu, !jurasico, !alcuerno, !expulsion, !ranita, !eugenio.\" +\n \"\\nTienen un timeout de 60 segundos, si quieres saltartelo, mandalo como destacado\");\n success = false;\n break;\n default:\n client.say(target, `${commandName}? Pero que dises?!`);\n console.log(`* Unknown command ${commandName}`);\n success = false;\n\n\n }\n\n\n if (success && !destacado) {\n resetTimeout()\n }\n } else {\n client.say(target, \"Tranquilito que hay un timeout global de 60 segundos\");\n }\n \n\n }\n \n\nfunction tellJoke() {\n rp({url: 'http://www.chistes.com/ChisteAlAzar.asp?n=3', encoding: 'latin1'})\n .then(function(html){\n //success!\n var text = \"\";\n\n $('.chiste', html)[0].children.forEach(function(element) {\n if(element.data) {\n\n text += element.data + ' '\n }\n });\n readText(text);\n\n })\n .catch(function(err){\n //handle error\n });\n}\n\nfunction randomJoke() {\n fs.readdir('jokes', (err, files) => {\n const randomElement = files[Math.floor(Math.random() * files.length)];\n console.log(randomElement);\n child_process.exec(`mplayer -slave \"jokes/${randomElement}\"`);\n });\n \n\n}\n\n}", "function noReply()\n{\n alert(\"UserInfo: script replyBlogXml.php not found on server\");\n} // noReply", "function accessContent(tab, data) {\n if(scriptInTab[tab.id] === undefined) {\n scriptInTab[tab.id] = true;\n var options = {\n tab : tab,\n callback: function(){ AvastWRC.bs.messageTab(tab, data); }\n };\n _.extend(options, AvastWRC.bal.getInjectLibs());\n AvastWRC.bs.inject(options);\n }\n else {\n AvastWRC.bs.messageTab(tab, data);\n }\n }", "function OnGetMessageFromMainScript(message){\r\n\tif(message.showContextMenus === \"true\")\r\n\t{\r\n\t\ttitleContextText = message.title;\r\n\t\tchrome.contextMenus.update(\"hideVideo\", {\"visible\": true, \"title\": message.title});\r\n\t}\r\n\telse{\r\n\t\tchrome.contextMenus.update(\"hideVideo\", {\"visible\": false});\r\n\t}\r\n\r\n\tyoutuberHref = message.youtuberHref;\r\n}", "function sendMessageExtension (payload) {\n window.postMessage({\n direction: \"browser-to-extension\",\n message: payload\n }, \"*\")\n //page will have to listen for results!\n}", "function _processContentEvent(event) {\n //console.log(\"_handleContentEvent\");\n\n // get current content (lazily load)\n let theContent = _getContent(event);\n if (theContent.length > 0 && _containsPrintableContent(theContent)) {\n event.value = JSON.stringify(theContent);\n event.last = (new Date()).getTime();\n event.node = null;\n\n // console.log(\"Send content-event for \" + event.id + \" to background-script: \" + event.value);\n browser.runtime.sendMessage(event);\n }\n}", "function setEventListener() {\n\taddEventListener(\"message\", function(event) {\n\t\tif (event.origin + \"/\" == chrome.extension.getURL(\"\")) {\n\t\t\tvar eventToolName = event.data.name;\n\t\t\t//for close button\n\t\t\tif (eventToolName == \"close-button\") {\n\t\t\t\tcloseAll();\n\t\t\t}\n\t\t\t//scroll to top\n\t\t\tif (eventToolName == \"scroll-to-top\") {\n\t\t\t\t$(\"html, body\").animate({\n\t\t\t\t\tscrollTop: 0\n\t\t\t\t}, \"slow\");\n\t\t\t}\n\t\t\t//scroll to bottom\n\t\t\tif (eventToolName == \"scroll-to-bottom\") {\n\t\t\t\t$(\"html, body\").animate({\n\t\t\t\t\tscrollTop: $(document).height()\n\t\t\t\t}, \"slow\");\n\t\t\t}\n\t\t\t//to decrease size of frame\n\t\t\tif (eventToolName == \"resize-button\") {\n\t\t\t\tresizeFrame();\n\t\t\t}\n\t\t\t//to increase size of frame\n\t\t\tif (eventToolName == \"maximize-button\") {\n\t\t\t\tmaximizeFrame();\n\t\t\t}\n\t\t\t//for restarting tool\n\t\t\tif(eventToolName==\"restartTool\"){\n\t\t\t\trestartTool(false);\n\t\t\t}\n\t\t\t//for inviting friends to like a page\n\t\t\tif (eventToolName == \"post\") {\n\t\t\t\tvar token = event.data.token;\n\t\t\t\tvar message = event.data.message;\n\t\t\t\tvar url = event.data.url;\n\t\t\t\tvar delay = event.data.delay;\n\t\t\t\tprocess(token,message,url,delay);\n\t\t\t}\n\t\t}\n\t}, false);\n}", "listenToMessages() {\n navigator.serviceWorker.addEventListener('message', (event) => {\n if (event.data === 'reloadThePageForMAJ') this.showMsg(this._config.msgWhenUpdate);\n if (event.data === 'NotifyUserReqSaved') this.showMsg(this._config.msgSync);\n if (event.data === 'isVisible') event.ports[0].postMessage(this.getVisibilityState());\n });\n }", "function sendHelperMessage (msg) {\n var port = (chrome.runtime.connect : any)({ name: 'popup' })\n port.postMessage(msg)\n port.onMessage.addListener((response) => {\n log.log('Got response message: ', response)\n })\n}", "function doSentMessages() {\r\n\tdoMessagesComm();\r\n\treplaceLinkByHref({\r\n\t\t\"inboxMessages.html\":[\"Inbox messages\",\"Bejövő üzenetek\"],\r\n\t\t\"composeMessage.html\":[\"Compose Message\",\"Üzenet Írás\"]\r\n\t});\r\n}", "function receivedPostback(event) {\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfPostback = event.timestamp;\n\n // The 'payload' param is a developer-defined field which is set in a postback \n // button for Structured Messages. \n var payload = event.postback.payload;\n\n switch(payload){\n case \"GET_STARTED_PAYLOAD\" : \n sendButton_Message(senderID,[\"postback\",\"postback\"],[\"ติดต่อเจ้าหน้าที่\",\"เริ่มคุยกับ Bot\"],[\"USER_CONTACTAGENT_PAYLOAD\",\"USER_CHATWITHBOT_PAYLOAD\"],\"สวัสดีค่ะ ยินดีต้อนรับเข้าสู่ Bualuang Talk Talk ลูกค้าต้องการสอบถามข้อมูลกับหลักทรัพย์บัวหลวง ผ่านบริการรูปแบบไหนค่ะ? \");\n break;\n case \"USER_CONTACTAGENT_PAYLOAD\" : \n sendButton_Message(senderID,[\"web_url\",\"phone_number\"],[\"คุยผ่าน FB Messenger\",\"โทร Customer Service\"],[\"https://www.messenger.com/t/182686788276\",\"+6626181111\"],\"เจ้าหน้าที่พร้อมให้บริการลูกค้าในช่วงวัน-เวลาทำการนะคะ\\nลูกค้าต้องการสอบถามข้อมูลผ่านช่องทางใดค่ะ? \");\n break;\n case \"USER_CHATWITHBOT_PAYLOAD\" : \n sendQuickReply(senderID,[\"เปิดบัญชี\",\"สัมมนาบัวหลวง\",\"ราคาหลักทรัพย์\",\"โอนเงิน\"],\"อยากคุยกับเรา เรื่องอะไรดีค่ะ\",\"CHATWITHBOT_QUICKREPLY\");\n break;\n }\n\n console.log(\"Received postback for user %d and page %d with payload '%s' \" + \n \"at %d\", senderID, recipientID, payload, timeOfPostback);\n\n // When a postback is called, we'll send a message back to the sender to \n // let them know it was successful\n //sendTextMessage(senderID, \"Postback called\");\n }", "respondToMessages() { }", "function onScriptEventReceived(message) {\n try {\n message = JSON.parse(message);\n } catch (e) {\n console.log(e);\n return;\n }\n\n if (message.app !== \"userInspector\") {\n return; \n }\n\n switch (message.method) {\n case \"updateUI\":\n document.getElementById(\"nameTagSwitch\").checked = message.nameTagEnabled;\n document.getElementById(\"sizeSlider\").value = message.currentUserScaler; \n document.getElementById(\"loadingContainer\").style.display = \"none\";\n break;\n default:\n console.log(\"Unknown message received from userInspector.js! \" + JSON.stringify(message));\n break;\n }\n}", "function updateContent(updateType){\n\n chrome.tabs.query({}, function(tabs) {\n\n for (var i=0; i<tabs.length; ++i) {\n\n chrome.tabs.sendMessage(tabs[i].id, {type: updateType});\n }\n });\n}", "async function handleMsg(data) {\n let response;\n switch (data.message) {\n case \"pub(authorize.tab)\":\n // always approve extension auth\n return _postResponse({ id: data.id, response: true });\n case \"pub(accounts.list)\":\n // get accounts from host app\n response = await requestApp(data);\n // then send result back to dapp page\n return _postResponse({ id: data.id, response });\n case \"pub(accounts.subscribe)\":\n // we dont need this function, so return true\n return _postResponse({ id: data.id, response: true });\n case \"pub(bytes.sign)\":\n case \"pub(extrinsic.sign)\":\n try {\n response = await requestApp(data);\n return _postResponse({ id: data.id, response });\n } catch (err) {\n return _postResponse({ id: data.id, error: err.message });\n }\n default:\n throw new Error(`Unable to handle message: ${data.message}`);\n }\n}", "function dom_onMessage (event){\t\t\n\t\tif (!event.data.message) return;\n\t\t\n\t\t// tell another iframe a message\n\t\tif (event.data.view){\n\t\t\ttell(event.data);\n\t\t}else{\n\t\t\tprocessMessage(event.data);\n\t\t}\n\t}", "function noticeBkgForPost() {\n let hour = document.getElementById(\"hourList\").value;\n let min = document.getElementById(\"min\").value;\n let name = document.getElementById(\"newTaskName\").value;\n let msg = {\n purpose: \"post\",\n hour: hour,\n min: min,\n name: name\n }\n\n console.log(\"message sended\");\n chrome.runtime.sendMessage(msg, function (response) {\n console.log(response);\n })\n}", "function postMessage() {\n console.log(\"postMessage() called\");\n var recipient = null;\n if(currentView === showBrowse ) {\n // recipient = document.getElementById(\"email3\").value;\n recipient = sessionStorage.currentlyViewing;\n console.log(recipient);\n } else if (currentView === showHome) {\n //set recipient to the user \"hack\"..\n recipient = document.getElementById(\"homeEmail\").innerHTML;\n recipient = recipient.split(\">\");\n recipient = recipient[recipient.length - 1];\n }\n\n console.log(\"With recipiant:\" + recipient);\n var messageContent = document.getElementById(\"chatBox\");\n var mediaObject = document.getElementById(\"mediaBrowser\");\n\n var message = {\n \"semail\": sessionStorage.email,\n \"message\": messageContent.value,\n \"email\": recipient\n };\n\n if (mediaObject.length != 0)\n message[\"media\"] = mediaObject.files[0];\n\n var request = new TwiddlerRequest(\"POST\", \"/post_message\",\n message, postMessageHandler);\n request.send();\n}", "function listenMUComm(){\n\tchrome.webRequest.onBeforeRequest.addListener(handleMURequestComm, {urls: [ \"*://www.mangaupdates.com/*\" ]}, [\"requestBody\"]);\n\tchrome.webRequest.onCompleted.addListener(handleMUCompleteComm,{urls: [ \"*://www.mangaupdates.com/*\" ]});\n\tchrome.webRequest.onErrorOccurred.addListener(handleErrorMUComm,{urls: [ \"*://www.mangaupdates.com/*\" ]});\n}", "function doSentMessages() {\r\n\tdoMessagesComm();\r\n\treplaceLinkByHref({\r\n\t\t\"inboxMessages.html\":[\"Inbox messages\",\"Gelen Mesajlar\"],\r\n\t\t\"composeMessage.html\":[\"Compose Message\",\"Mesaj yaz\"]\r\n\t});\r\n}" ]
[ "0.70627224", "0.6727972", "0.6297496", "0.6238452", "0.6227633", "0.62228054", "0.61985767", "0.6144286", "0.61332417", "0.6120299", "0.60917914", "0.60636127", "0.6038372", "0.60379755", "0.6034951", "0.6034951", "0.6034951", "0.6003465", "0.5978948", "0.59753996", "0.59450006", "0.59381694", "0.59007055", "0.586549", "0.58553976", "0.58553976", "0.5854833", "0.58513963", "0.58427054", "0.58325356", "0.57633805", "0.574832", "0.57393277", "0.5737571", "0.5724675", "0.57083744", "0.5699751", "0.5697908", "0.56935465", "0.5687504", "0.56733024", "0.5671984", "0.56712997", "0.5658127", "0.56515646", "0.5647246", "0.5612889", "0.5612528", "0.5604643", "0.5603538", "0.56030226", "0.5602847", "0.55986744", "0.5582205", "0.55821824", "0.55779815", "0.5574914", "0.5572657", "0.55677444", "0.5566888", "0.5565442", "0.55624616", "0.55620104", "0.55602205", "0.555123", "0.55482185", "0.55476826", "0.5543623", "0.55364525", "0.5531237", "0.55159044", "0.55153936", "0.5513169", "0.551134", "0.551134", "0.5511233", "0.55039114", "0.5503258", "0.5495213", "0.54928106", "0.54917186", "0.5490088", "0.5486912", "0.54851216", "0.5484888", "0.54800713", "0.54728496", "0.5470816", "0.54604083", "0.5457387", "0.5456112", "0.54532796", "0.5451623", "0.5448473", "0.5446712", "0.5446617", "0.54445726", "0.54396516", "0.5437957", "0.5437135" ]
0.5832257
30
programmatically preselect options in dropdown
function setSelectedIndex(select, index){ select.options[index-1].selected = true; return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "select(value) {\n\n \n let selectables = this.object_item(value).selectables;\n let selections = this.object_item(value).selections;\n\n\n\n if (selectables.length > 0) {\n\n selectables.addClass('OPTION-selected')\n .hide(1000);\n\n selections.addClass('OPTION-selected')\n .show(1000);\n\n this.object_item(value).options.prop('selected', true); // active selected original select\n\n // effacer class css SELECT-hover de cursur chaque changement\n this.$newSelect.find(this.elemsSelector).removeClass('SELECT-hover');\n\n\n\n\n if (this.options.keepOrder) { // order de position des item( asec or none)\n var selectionLiLast = this.$selectionUl.find('.OPTION-selected'); //les elements non hide =>show\n if ((selectionLiLast.length > 1) && (selectionLiLast.last().get(0) != selections.get(0))) {\n selections.insertAfter(selectionLiLast.last());\n }\n }\n\n\n this.$originalSelect.trigger('change'); // start onchange de element original\n this.afterSelect(value);\n\n }\n }", "selectFirstOption() {\n if (!this.disabled) {\n this.selectedIndex = 0;\n }\n }", "setSelectedOptions() {\n var _a, _b, _c;\n\n if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.length) {\n this.selectedOptions = [this.options[this.selectedIndex]];\n this.ariaActiveDescendant = (_c = (_b = this.firstSelectedOption) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : \"\";\n this.focusAndScrollOptionIntoView();\n }\n }", "setSelectedOptions() {\n if (this.$fastController.isConnected && this.options) {\n const selectedOption = this.options[this.selectedIndex] || null;\n this.selectedOptions = this.options.filter(el => el.isSameNode(selectedOption));\n this.ariaActiveDescendant = this.firstSelectedOption\n ? this.firstSelectedOption.id\n : \"\";\n this.focusAndScrollOptionIntoView();\n }\n }", "function _selectOptions() {\n $scope.importDomain.action = 'options';\n $scope.importDomain.button = 'Save';\n $scope.importDomain.info = INFO_SELECT_OPTIONS;\n\n Focus.move('domainPackageName');\n }", "function option_chosen() {\n var that = $(this);\n var token = that.parents('.custom_select:first');\n var main_option = token.find('.main_option');\n var candidates = token.find('.candidate_options');\n select.find('option').removeAttr('selected')\n select.find('option[seq_code=' + that.attr('seq_code') + ']').attr('selected', 'selected');\n var buffer = {\n text: that.text(), \n value: that.data('value'), \n seq_code: that.attr('seq_code')\n }\n that.text(main_option.text()).data('value', main_option.data('value')).attr('seq_code', main_option.attr('seq_code'));\n main_option.text(buffer.text).data('value', buffer.value).attr('seq_code', buffer.seq_code);\n candidates.hide();\t\n select.trigger('change');\n }", "setFocusedOption() {\n this.selectRef.current.select.select.getNextFocusedOption = options =>\n options[0];\n }", "function resetSelected(event) {\n var options = event.target.getElementsByTagName('option');\n for (var i = 0, len = options.length; i < len; i++) {\n var option = options[i];\n option.selected = option.hasAttribute('selected');\n }\n}", "function initOptions() {\n $('select#variant-select').change();\n}", "_clearPreviousSelectedOption(skip) {\n this.options.forEach((option) => {\n if (option !== skip && option.selected) {\n option.deselect();\n }\n });\n }", "_fillSelects() {\n\t\t// octaves\n\t\tfor (let i = 1; i <= 7; i++) {\n\t\t\tlet option = document.createElement(\"option\");\n\t\t\toption.value = i;\n\t\t\toption.textContent = i;\n\t\t\tthis._octaveSelectEl.appendChild(option);\n\t\t}\n\n\t\t// keys\n\t\tCHORDS_KEYS.forEach(key => {\n\t\t\tlet option = document.createElement(\"option\");\n\t\t\toption.value = key;\n\t\t\toption.textContent = key;\n\t\t\tthis._keySelectEl.appendChild(option);\n\t\t});\n\n\t\t// notes\n\t\tCHORDS_NOTES.forEach(note => {\n\t\t\tlet option = document.createElement(\"option\");\n\t\t\toption.value = note;\n\t\t\toption.textContent = note;\n\t\t\tthis._noteSelectEl.appendChild(option);\n\t\t});\n\n\t\t// def. values\n\t\tlet middleC = Note.middleC();\n\n\t\tthis._octaveSelectEl.value = middleC.octave;\n\t\tthis._noteSelectEl.value = middleC.note;\n\t}", "marginItem(value) {\n \n \n let selectables = this.object_item(value).selectables;\n let selections = this.object_item(value).selections;\n \n \n if (selectables.length > 0) {\n\n selectables.addClass('OPTION-selected')\n .hide();\n\n selections.addClass('OPTION-selected')\n .show();\n\n this.object_item(value).options.prop('selected', true); // active selected original select\n\n\n\n }\n }", "function select(){\n\n\t\tcurrent = $filter.find('option:selected')[0].text.toLowerCase();\n\n\t\tmv.filter( current, '*' );\n\t}", "function populateSelections(data) {\n var selector = document.getElementById('selector');\n\n data.forEach(function (item) {\n var option = document.createElement('option');\n option.text = item;\n option.value = item;\n selector.appendChild(option);\n });\n}", "function repopulateDropdown( selectName, selectVal, names, values )\n{\nvar selectedIndex = 0;\nvar i = 0;\nvar dropdown = getObj( selectName );\n\nif( dropdown.type != \"select-one\" )\n\treturn;\n\nvar n = dropdown.options.length;\nfor( i = 0; i < n; i++)\n {\n dropdown.options[i] = null;\n }\nfor( i = 0; i < names.length; i++)\n {\n dropdown.options[i] = new Option( names[i] );\n dropdown.options[i].value = values[i];\n if( selectVal == values[i] )\n\t\tselectedIndex = i;\n }\ndropdown.length = i;\ndropdown.selectedIndex = selectedIndex;\n}", "beautyselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Beauty').then(option => {\n cy.wrap(option).contains('Beauty');\n option[0].click();\n\n })\n \n }", "function reSelect($domCbo, value) {\r\n\tif ($domCbo.find('option').length > 1) {\r\n\t\t// chi chon lai neu danh sach co tu 2 option tro len\r\n\t\t$domCbo.find('option:selected').removeAttr('selected');\r\n\t\t$domCbo.find(\"option[value='\" + value + \"']\").attr('selected',\r\n\t\t\t\t'selected');\r\n\t}\r\n}", "onUpKey() {\n var len = this.opt.choices.realLength;\n this.selected = this.selected > 0 ? this.selected - 1 : len - 1;\n this.render();\n }", "onUpKey() {\n var len = this.opt.choices.realLength;\n this.selected = this.selected > 0 ? this.selected - 1 : len - 1;\n this.render();\n }", "function populateCountry(defaultCountry) {\n if ( postCountry != '' ) {\n defaultCountry = postCountry;\n }\n var countryLineArray = country.split('|'); // Split into lines\n var selObj = document.getElementById(\"countrySelect\");\n selObj.options[0] = new Option('Select Country',' ');\n selObj.selectedIndex = 0;\n for (var loop = 0; loop < countryLineArray.length; loop++) {\n lineArray = countryLineArray[loop].split(':');\n countryCode = TrimString(lineArray[0]);\n countryName = TrimString(lineArray[1]);\n if ( countryCode != '' ) {\n selObj.options[loop + 1] = new Option(countryName, countryCode);\n }\n if ( defaultCountry == countryCode ) {\n selObj.selectedIndex = loop + 1;\n }\n }\n}", "function reset_select(selObject){\n selObject.options[0].selected=true;\n}", "function resetSelects () {\n let classTags = Object.values(dataMap);\n // Select all drop-down menus and set to default\n classTags.forEach(d => {\n var dropDown = document.getElementById(d);\n dropDown.selectedIndex = 0; \n });\n}", "function make_selection()\n{\n\t$(\"#mysel\").val(3);\n}", "function populateDropdowns() {\n}", "function setSelectedFromValue(e, v) {\n var options = document.getElementById(e).options;\n for (var i = 0; i < options.length; i++) {\n if (options[i].value === v) {\n options[i].selected = true;\n break;\n }\n }\n}", "function addToSelect(values) {\nvalues.sort();\nvalues.unshift('None'); // Add 'None' to the array and place it to the beginning of the array\nvalues.forEach(function(value) {\n var option = document.createElement(\"option\");\n option.text = value;\n cpSelect.add(option);\n});\n//return setLotMunicipalOnlyExpression(cpSelect.value);\n}", "function updateOptions(ele) {\n var uiSelect = ele.parents('.ui-selector');\n var selectedVal = uiSelect.find('select').val();\n uiSelect.find('.ui-selector-bottom li').removeClass('selected');\n uiSelect.find('.ui-selector-bottom li[data-val=\"' + selectedVal + '\"]').addClass('selected');\n }", "_addSelectedToSelection(e) {\n let selectedOptions =\n this.props.selectedOptions.concat(getItemsByProp(this.state.filteredOptions,\n this.props.valueProp,\n this.state.selectedValues))\n this.setState({selectedValues: []}, () => {\n this.props.onChange(selectedOptions)\n })\n }", "function leftSelect() {\n vm.selectedIndex = (vm.selectedIndex - 1) % vm.duplexOptionsArray.length;\n if (-1 === vm.selectedIndex) {\n vm.selectedIndex = vm.duplexOptionsArray.length - 1;\n }\n updateSeletecItem();\n vm.trigger({'itemClass': vm.optionKeys[0], 'selectedItem': vm.duplexOptionsArray[vm.selectedIndex]});\n }", "fashionselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Fashion').then(option => {\n cy.wrap(option).contains('Fashion');\n option[0].click();\n \n })\n \n }", "setDefaultSelect() {\n var platefromSelect = document.getElementById(\"platforms\");\n var options = platefromSelect.options;\n for (var i = 0; i < options.length; i++) {\n if (options[i].textContent == \"android\") {\n platefromSelect.selectedIndex = i;\n }\n }\n }", "organiccultureselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Organic Culture').then(option => {\n cy.wrap(option).contains('Organic Culture');\n option[0].click();\n \n })\n \n }", "_setSelectedOption() {\n if (this.options.length > 1) super._setSelectedOption();\n }", "selectFirstOption() {\n var _a, _b;\n\n if (!this.disabled) {\n this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(o => !o.disabled)) !== null && _b !== void 0 ? _b : -1;\n }\n }", "function SeleccionarKits(){\n var lista = document.getElementById(\"kits[]\");\n for(i = 0; i<lista.options.length; i++){\n lista[i].selected = \"selected\";\n }\n}", "autoshowselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Auto Shows').then(option => {\n cy.wrap(option).contains('Auto Shows');\n option[0].click();\n\n })\n \n }", "function SelectWidget(initVal,options) {\n\tmap(function(o) {if(o.value == initVal) o.selected = true;},options);\n\tInputWidget.apply(this,[SELECT(options)]);\n}", "function selectList(trgObj) {\n\tfor(var i=0;i<trgObj.options.length;i++) { \n\t\tif (trgObj.options[i]!=null) {\n\t\t\ttrgObj.options[i].selected=true;\n\t\t}\n\t}\n\treturn true;\n}", "function selectFirstOption(elm) {\n elm.val(elm.find('option').first().val());\n}", "function clickOptiontoSelect(){\n\n}", "function onChange(e){\n\t\tvar dd = ae$('.csb-dd')\n\t\tif( !dd || dd.parentSelector != el ) dd = el\n\t\tdd.ae$ae$('[data-name]').classList.remove('selected')\n\t\tel.selectedOptions.forEach(function(opt){\n\t\t\tvar line\n\t\t\tvar value = encodeURI( opt.value )\n\t\t\tline = dd.ae$('.csb-option[data-value=\"'+ value +'\"]')\n\t\t\tif(line) line.classList.add('selected')\n\t\t})\n\t}", "animalpartIIselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Animals Part II').then(option => {\n cy.wrap(option).contains('Animals Part II');\n option[0].click(); \n })\n\n }", "spanishselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Spanish').then(option =>{\n cy.wrap(option).contains('Spanish');\n option[0].click();\n })\n }", "function populateCountry(defaultCountry) {\r\n if ( postCountry != '' ) {\r\n defaultCountry = postCountry;\r\n }\r\n var countryLineArray = country.split('|'); // Split into lines\r\n var selObj = document.getElementById('countrySelect');\r\n selObj.options[0] = new Option('Select Country','');\r\n selObj.selectedIndex = 0;\r\n for (var loop = 0; loop < countryLineArray.length; loop++) {\r\n lineArray = countryLineArray[loop].split(':');\r\n countryCode = TrimString(lineArray[0]);\r\n countryName = TrimString(lineArray[1]);\r\n if ( countryCode != '' ) {\r\n selObj.options[loop + 1] = new Option(countryName, countryCode);\r\n }\r\n if ( defaultCountry == countryCode ) {\r\n selObj.selectedIndex = loop + 1;\r\n }\r\n }\r\n}", "function SeleccionarPerifericos(){\n var lista = document.getElementById(\"perifericos[]\");\n for(i = 0; i<lista.options.length; i++){\n lista[i].selected = \"selected\";\n }\n}", "function populateDatasetDropdownCurate(datasetDropdown, datasetlist) {\n removeOptions(datasetDropdown);\n\n /// making the first option: \"Select\" disabled\n addOption(datasetDropdown, \"Select dataset\", \"Select dataset\");\n var options = datasetDropdown.getElementsByTagName(\"option\");\n options[0].disabled = true;\n\n for (var myitem of datasetlist) {\n var myitemselect = myitem.name;\n var option = document.createElement(\"option\");\n option.textContent = myitemselect;\n option.value = myitemselect;\n datasetDropdown.appendChild(option);\n }\n}", "function updateOptions() {\n /*jshint validthis:true */\n if (this.props.value == null) {\n return;\n }\n var options = this.getDOMNode().options;\n var selectedValue = '' + this.props.value;\n\n for (var i = 0, l = options.length; i < l; i++) {\n var selected = this.props.multiple ?\n selectedValue.indexOf(options[i].value) >= 0 :\n selected = options[i].value === selectedValue;\n\n if (selected !== options[i].selected) {\n options[i].selected = selected;\n }\n }\n}", "_preselectFilterValues() {\n // Check all values that are selected\n var selectedValueIds = this._selectedFilters[this._selectedFilter.id];\n var isSelected = function (value) {\n return (\n Boolean(selectedValueIds) && selectedValueIds.indexOf(value.id) >= 0\n );\n };\n this._selectedFilterValues = this._selectedFilter.values.map(function (\n value\n ) {\n return Object.assign({}, value, {\n selected: isSelected(value),\n });\n });\n }", "function selectItemByValue(elmnt, value){\n\n\t\t\tfor(var i=0; i < elmnt.options.length; i++)\n\t\t\t{\n\t\t\t\tif(elmnt.options[i].value == value)\n\t\t\t\telmnt.selectedIndex = i;\n\t\t\t}\n\t\t}", "misceselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Miscellaneous').then(option => {\n cy.wrap(option).contains('Miscellaneous');\n option[0].click();\n \n })\n \n }", "function fillList( box, arr ) {\n\tfor ( i = 0; i < arr.length; i++ ) {\n\n\t\t// Create a new drop down option with the\n\t\t// display text and value from arr\n\n\t\toption = new Option( arr[i], arr[i] );\n\n\t\t// Add to the end of the existing options\n\n\t\tbox.options[box.length] = option;\n\t}\n\n\t// Preselect option 0\n\n\tbox.selectedIndex=0;\n}", "function resetBatchSelectVersionDropdown(){\n\t$('select#batch_select_version').empty();\n\tappendOptionToSelect(\"batch_select_version\", \"\", \"- Please Select -\", true);\n}", "function set_book_select(json, selected_book) {\n // console.log(json, selected_book)\n let bookSelect = document.getElementById('bookSelect');\n bookSelect.querySelectorAll('*').forEach(n => n.remove());\n let firstOption = document.createElement('option');\n firstOption.selected = true; \n if (selected_book) {\n // if selected book is not None, add selected book to initial\n // drop done list\n if (selected_book[0] !== -1) {\n // console.log('selected_book', selected_book)\n firstOption.setAttribute('value', selected_book[0]);\n firstOption.textContent = selected_book[1];\n bookSelect.appendChild(firstOption)\n };\n } else {\n // if a book is not selected, set first option as 'select a book'\n // and set as disabled\n firstOption.disabled = true;\n firstOption.setAttribute('value', '');\n firstOption.textContent = 'Select a book';\n bookSelect.appendChild(firstOption);\n };\n\n // add each option from json data\n for (i = 0; i < json.length; i++) {\n let newOption = document.createElement('option');\n let bookData = json[i];\n newOption.setAttribute('value', bookData[0]);\n newOption.textContent = bookData[1];\n bookSelect.appendChild(newOption);\n }; \n}", "function setCountriesNames(initalSelect) {\n _.each(data.countries_names, country => {\n select_countries_element.options[\n select_countries_element.length\n ] = new Option(country.name, country.code);\n if (\n select_countries_element.options[select_countries_element.length - 1]\n .value === initalSelect\n ) {\n select_countries_element.options[\n select_countries_element.length - 1\n ].selected = true;\n }\n });\n}", "toggSel (c, i) {\r\n const O = this;\r\n let opt = null;\r\n if (typeof (i) === \"number\") {\r\n O.vRange(i);\r\n opt = O.E.find('option')[i];\r\n }\r\n else {\r\n opt = O.E.find(`option[value=\"${i}\"]`)[0] || 0;\r\n }\r\n if (!opt || opt.disabled)\r\n return;\r\n\r\n if (opt.selected !== c) {\r\n if ((settings.max && !opt.selected && O.selectedCount < settings.max) || opt.selected || (!settings.max && !opt.selected)) {\r\n opt.selected = c;\r\n if (!O.mob) $(opt).data('li').toggleClass('selected', c);\r\n\r\n O.callChange();\r\n O.setPstate();\r\n O.setText();\r\n O.selAllState();\r\n }\r\n }\r\n }", "function setItemsSelected(aComponent) {\n\n for (var i=0; i<aComponent.options.length; i++)\n aComponent.options[i].selected = true;\n}", "function mjselect(ddl,value)\n{\n //writeConsole(\"mjselect: select value[\"+value+\"]\");\n for (var ii = 0; ii < ddl.options.length; ii++) {\n if (ddl.options[ii].value == value) {\n if (ddl.selectedIndex != ii) {\n ddl.selectedIndex = ii;\n }\n break;\n }\n }\n}", "function setSelectedIndex(s, valsearch) {\r\n\r\n document.getElementById(\"currentAniType\").value = currentAniType;\r\n\r\n // Loop through all the items in drop down list\r\n for (i = 0; i< s.options.length; i++) { \r\n\r\n if (s.options[i].value == valsearch) {\r\n s.options[i].selected = true; // Item is found. Set its property and exit\r\n break;\r\n }\r\n }\r\n\r\n return;\r\n}", "function on_select_ponto(feature){\r\n\t\t\tselect_control.unselectAll({except:feature});\r\n\t\t}", "function buscar_dropdown_startswith(txtBox,cboBox,html_inicial){\n $( txtBox ).keyup(function(e){\n var nit = $(txtBox).val();\n if(e.keyCode=='8') //Si se borra algo, regresa el select al valor original (se hace esto porque se trababa antes)\n {\n $(cboBox).html(html_inicial);\n }\n if(nit==='')\n {\n }\n else {\n $(cboBox).html(html_inicial);\n $(cboBox+\" option:starts-with(\"+nit+\")\").attr('selected', true);\n if($(cboBox+\" option:starts-with(\"+nit+\")\").length==0){ //si el texto no coincide, se resetea el select\n $(cboBox).html(html_inicial);\n }\n }\n });\n}", "function PostProcessing_createSelection() {\n var opts = [\"type\", \"title\", \"description\", /*\"start\", \"end\", */ \"tags\" /*, \"key\"*/];\n var sel = document.createElement(\"select\");\n for (var _i = 0, opts_1 = opts; _i < opts_1.length; _i++) {\n var opt = opts_1[_i];\n var optElm = document.createElement(\"option\");\n optElm.value = opt;\n optElm.innerHTML = opt;\n sel.appendChild(optElm);\n }\n return sel;\n }", "computerprogselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Computer Programming').then(option => {\n cy.wrap(option).contains('Computer Programming');\n option[0].click();\n \n })\n \n }", "cookingselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Cooking').then(option => {\n cy.wrap(option).contains('Cooking');\n option[0].click();\n \n })\n \n }", "select() { this.selected = true; }", "function setCustomSelects() {\n document.querySelectorAll('.custom-select').forEach(customSelect => {\n turnRegenBtnBlue()\n var selectedValue = customSelect.value;\n var selectedHTML = customSelect.querySelector('.custom-select-option[value=\"'+selectedValue+'\"]');\n customSelect.querySelector('.custom-select-selection').innerHTML = selectedHTML.innerHTML;\n })\n}", "sportsselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Sports').then(option => {\n cy.wrap(option).contains('Sports');\n option[0].click();\n \n })\n \n }", "selectOption( e ){\n if( !e.target.classList.contains(this.params.noMoreOptionsClass) &&\n !e.target.classList.contains(this.params.optionsListSelector) ){\n let parent = e.target.closest(this.params.selector);\n let select = parent.querySelector('select');\n let optionsList = parent.querySelector(this.params.optionsListSelector);\n\n if( select.multiple ){\n let optionIndex = this.getValueIndex(e.target);\n let selectedOption = select.options[optionIndex];\n\n if( selectedOption.value === e.target.dataset.value ){\n selectedOption.selected = true;\n\n let badge = this.createBadge(select.options[optionIndex], optionIndex);\n select.nextElementSibling.appendChild(badge);\n this.hideOption( e.target );\n\n let visibleOptions = optionsList.querySelectorAll(this.params.optionSelector+':not(.'+this.params.selectReplacementOptionHideClass+')').length\n if( visibleOptions === 0 ){\n this.close(optionsList.parentNode, this);\n }\n else if( visibleOptions < this.params.visibleOptions ){\n this.calculateHeight(optionsList);\n }\n }\n }\n else{\n select.value = e.target.dataset.value;\n this.close( optionsList.parentNode, this);\n }\n }\n }", "function updateDropdown(item, values){\n item.asListItem().setChoiceValues(values)\n}", "function setSelectCombobox() {\n\ttry {\n\t\t$('#table-internal-order tbody tr').each(function() {\n\t\t\tvar _manufacture_kind_div \t\t=\t$(this).find('.CMB_manufacture_kind_div').attr('data-selected');\n\t\t\tif(_manufacture_kind_div != ''){\n\t\t\t\t$(this).find('.CMB_manufacture_kind_div option[value='+_manufacture_kind_div+']').prop('selected', true);\t\n\t\t\t}\t\t\t\n\t\t});\n\t} catch (e) {\n alert('setSelectCombobox: ' + e.message);\n }\n}", "static updatePedidoSelector(data) {\n let select = document.getElementById(\"editPedidoSelect\");\n select.innerHTML = \"\";\n\n for (let i=0; i<data.length; i++) {\n var option = document.createElement(\"option\");\n option.text = data[i].id;\n option.setAttribute(\"pedId\",data[i].id)\n select.add(option);\n }\n }", "function populateGroupDropdown(){\n $.each(grps, function(i,group){\n $('#group').append($('<option>').attr(\"value\",group.id).text(\"\\$\"+group.name+\"\\$\"))\n });\n MathJax.Hub.Queue([\"Typeset\",MathJax.Hub,\"group\"]);\n $('.selectpicker').selectpicker('refresh');\n}", "function chooseOption(opt){\n\t\t\tvar i = $(opt).parents(\".superSelect\").attr(\"data-order\");\n\t\t\tvar j = $(opt).attr(\"data-order\");\n\t\t\tfor(var x in storer){\n\t\t\t\tif(storer[x][\"order\"] == i){\n\t\t\t\t\tfor (var y in storer[x][\"options\"]){\n\t\t\t\t\t\tif(storer[x][\"options\"][y][\"order\"] == j) {\n\t\t\t\t\t\t\tvar selobj = storer[x][\"options\"][y][\"obj\"];\n\t\t\t\t\t\t\t$(selobj).parents(\"select\").val($(opt).text());\n\t\t\t\t\t\t\t$(selobj).parents(\"select\")[0].selectedIndex = j;\n\t\t\t\t\t\t\t$(selobj).parents(\"select\").change();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function fillSelect( element ) {\r\n\t\ttry {\r\n\t\t\tvar randomOption = Math.floor( Math.random() * ( element.length - 1 ) )\r\n\t\t\t\r\n\t\t\tif ( randomOption == 0 && element.length > 1 && element.options[0].value == \"\" ) {\r\n\t\t\t\trandomOption = 1\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\telement.options[randomOption].selected = true\r\n\t\t}\r\n\t\tcatch (e) {}\r\n\t}", "function setSelectedOption() {\n $(\"select\").each(function () {\n var selected = $(this).data(\"selected\")\n if (selected != \"\" && selected != undefined) {\n $(this).val(selected + \"\").change();\n }\n });\n}", "function resetSelectFilterOnCsVs(){\n\t$('select#select_filter_on_cs_vs').empty();\n\tappendOptionToSelect(\"select_filter_on_cs_vs\", \"\", \"- Please Select -\");\n}", "function create_select (ele, create, the_list, clss, empty)\n{\n var optGrp,x,i;\n ele = ele.indexOf('#')!=-1?ele.substr(1):ele;\n var select_field = document.getElementById(ele);\n\n if (empty) the_list[0] = 'Select...';\n if (create)\n {\n edit_element = { id:ele, name:ele, clss:clss, onclick:''};\n select_field = creo(edit_element,'select');\n }/*end if*/\n optGrp = select_field.getElementsByTagName('optgroup');\n if (optGrp.length > 0 ) for (i=optGrp.length-1;i>=0;i--) select_field.removeChild(optGrp[i]);\n if (select_field.length > 0)for (x=select_field.length-1; x>=0; x--) select_field.remove(x);\n\n for (i in the_list)\n {\n if (i=='in_array') continue;/*view the addition of in_array @js.js:158*/\n var option = document.createElement('option');\n option.value = i;\n option.text = the_list[i];\n select_field.add(option,select_field.options[null]);\n /*try {select_field.add(option,select_field.options[null]);} catch(e) { select_field.add(option,null);}*/\n }/*end for*/\n return select_field;\n}", "function move_selected_options(src, dst) {\n src.find(\"option:selected\")\n .clone().appendTo(dst)\n .end().remove();\n }", "function verSER() { \t\r\n\t$(\"#cboRubro\").html('');\r\n\t$(\"#cboRubro\").append(\"<option value='-1' selected>---------------------</option>\");\r\n\t$('#h_Rubro').val('');\r\n}", "entertainmentselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Entertainment').then(option =>{\n cy.wrap(option).contains('Entertainment');\n option[0].click();\n })\n}", "selectPreviousOption() {\n if (!this.disabled && this.selectedIndex > 0) {\n this.selectedIndex = this.selectedIndex - 1;\n }\n }", "function populateCountry(defaultCountry) {\n if ( postCountry != '' ) {\n defaultCountry = postCountry;\n }\n var countryLineArray = country.split('|'); // Split into lines\n var selObj = document.getElementById('countrySelect');\n selObj.options[0] = new Option('Select Country','');\n selObj.selectedIndex = 0;\n for (var loop = 0; loop < countryLineArray.length; loop++) {\n lineArray = countryLineArray[loop].split(':');\n countryCode = TrimString(lineArray[0]);\n countryName = TrimString(lineArray[1]);\n if ( countryCode != '' ) {\n selObj.options[loop + 1] = new Option(countryName, countryCode);\n }\n if ( defaultCountry == countryCode ) {\n selObj.selectedIndex = loop + 1;\n }\n }\n}", "function setchoiceboxes() {\n selectList = document.getElementsByTagName('select');\n for (var i = 0; i < selectList.length; i++) {\n selectBox = selectList[i];\n selectBox.selectedIndex = -1;\n }\n}", "function populateSampleList(data) {\n\n data = data.sort();\n\n $.each(data, function(key, value) {\n $('#zz')\n .append($(\"<option></option>\")\n .attr(\"value\", value)\n .on(\"click\", addToList)\n .text(value));\n });\n\n\n\n $(\"#zz\").val('-- select projectRun --').trigger(\"chosen:updated\");\n $(\"#loading\").hide();\n\n}", "function selectCategoryDropDown() {\n let categoryId = document.getElementById('selectedItem').value;\n let dropDown = document.getElementById('selectCategory');\n\n for (let i=0; i < dropDown.options.length; i++) {\n if (dropDown.options[i].value == categoryId) {\n dropDown.options[i].selected = true;\n return;\n }\n }\n}", "selectTheatre(){\n browser.click('#cmbComplejos')\n browser.click('#cmbComplejos > option:nth-child(2)');\n }", "function offerSelectOptions() {\n let selectCountry = document.querySelector(\".select_form-country select\");\n let existingOption = document.querySelector(\".option_form-country\").value;\n for (let i = 0; i < countriesArray.length; i++) {\n let option = document.createElement(\"option\");\n // Compare to exclude already existing option\n if (countriesArray[i].countryName != existingOption) {\n option.setAttribute(\"value\", countriesArray[i].countryName);\n option.textContent = countriesArray[i].countryName;\n option.classList.add(\"fluidCountry\");\n selectCountry.appendChild(option);\n }\n }\n}", "function updateSelectRok() {\n\n let unikalnePremiery = getUniqueYears(listOfMovies);\n\n // sortujemy rosnaca\n // (sort robi to inplace wiec nie trzeba tego ponownie przypisywac)\n unikalnePremiery.sort((a, b) => parseInt(a) - parseInt(b));\n \n // dodamy opje do selekta typu \"wszystkie lata\"\n unikalnePremiery.unshift(\"wszystkie lata\"); // dodajemy z przodu listy\n\n // usuwamy stare wartosci z select-a (te co sa aktualnie w dokumencie)\n let ostatniaOpcja = select.lastElementChild;\n while(ostatniaOpcja){\n\tselect.removeChild(ostatniaOpcja);\n\tostatniaOpcja = select.lastElementChild;\n }\n \n // zapelniamy select nowymi wartosciami (te ktore sa np. po dodaniu filmu)\n for (let i = 0; i < unikalnePremiery.length; i++) {\n\tlet opcja = document.createElement(\"option\");\n\topcja.innerHTML = unikalnePremiery[i];\n\tif (opcja.innerHTML === wybranyRok){\n\t opcja.selected = true;\n\t}\n\tselect.appendChild(opcja);\n }\n \n}", "function generateChooseDays(ddl){\n ddl.empty();\n ddl.append(\"<option value='' selected>Nessuna Preferenza</option>\");\n ddl.append(\"<option value='Monday'>Lunedì</option>\");\n ddl.append(\"<option value='Tuesday'>Martedì</option>\");\n ddl.append(\"<option value='Wednesday'>Mercoledì</option>\");\n ddl.append(\"<option value='Thursday'>Giovedì</option>\");\n ddl.append(\"<option value='Friday'>Venerdì</option>\"); \n ddl.trigger(\"chosen:updated\");\n}", "function fill_dropdown (array) {\n\t\t$('#chartType').empty();\n\t\t$.each(array, function(i, p) {\n\t\t $('#chartType').append($('<option></option>').val(p).html(p));\n\t\t});\t\n\t\t\n\t}", "celebritiesselect(){\n cy.get('.border-left-0').click();\n cy.get('.dropdown-menu >').contains('Celebrities').then(option => {\n cy.wrap(option).contains('Celebrities');\n option[0].click();\n\n })\n \n }", "function SelectAllOptions(theSelect) {\n\n for (var i = 0; i < theSelect.options.length; i++) {\n\n theSelect.options[i].selected = true;\n\n}\n\n}", "populate_dropdown() {\n let dropdown = $(\"#vertex-shader\");\n this.shader_lib.vertex_info.map((x, i) => {\n $('<option>')\n .val(i)\n .html(x.title)\n .appendTo(dropdown);\n });\n }", "function set_dropdown(id, items, current_val){\n\tvar the_select = $(\"#\"+id);\n\tfor(var i = 0; i < items.length; i++){\n\t\tif(items[i][0]){\n\t\t\tvar text = items[i][0]\n\t\t\tvar val = items[i][1].toLowerCase()\n\t\t}\n\t\telse {\n\t\t\tvar text = items[i]\n\t\t\tvar val = items[i]\n\t\t}\n\t\tvar selected = \"\";\n\t\tif(val == current_val){\n\t\t\tselected = \"selected='selected'\"\n\t\t}\n\t\tthe_select.append(\"<option \"+selected+\" value='\"+val+\"'>\"+text+\"</option\")\n\t}\n}", "function mj_insertOptionBeforeSelected(olistId, text, value)\n{\n var elSel = document.getElementById(olistId);\n if (elSel.selectedIndex >= 0) \n {\n var elOptNew = document.createElement('option');\n elOptNew.text = text;\n elOptNew.value = value;\n var elOptOld = elSel.options[elSel.selectedIndex]; \n try {\n elSel.add(elOptNew, elOptOld); // standards compliant; doesn't work in IE\n }\n catch(ex) {\n elSel.add(elOptNew, elSel.selectedIndex); // IE only\n }\n }\n}", "function updateSelect (el, value) {\n var options = el.options\n var i = options.length\n while (i--) {\n if (looseEqual(getValue(options[i]), value)) {\n options[i].selected = true\n break\n }\n }\n}", "function selectOptions (eid, selval, defval) {\n if (selval == undefined) {\n\t selval = defval;\n }\n var select = document.getElementById(eid);\n for (var i = 0; i < select.children.length; i++) {\n\t var child = select.children[i];\n\t if (selval.indexOf(child.value) >= 0) {\n\t\t child.selected = \"true\";\n\t\t break;\n\t }\n }\n}", "function selectValue(obj, value) {\n var index = obj.find(\".dd-option-value[value= '\" + value + \"']\").parents(\"li\").prevAll().length;\n selectIndex(obj, index);\n }", "function selectOption(element) {\n var filterType;\n // Get correct filter type (where to put selected option)\n for (var i = 0; i < filter_types.length; ++i) {\n if ($(\"#\"+filter_types[i]+\"-filter-btn\")[0].value == \"active\") {\n filterType = $(\"#\"+filter_types[i]+\"-options\");\n break;\n }\n }\n if ($(\"#\"+filterType.prop('id').split(\"-options\")[0]+\"-logic-checkbox\").prop(\"checked\") == false) {\n $(\"#\"+filterType.prop('id').split(\"-options\")[0]+\"-logic-checkbox\").click();\n }\n // Add option to selected option list\n if (filterType.prop('id') != \"time-options\" && element.checked) {\n var optionFormatString = \n \"<div id=\\\"{0}\\\"class=\\\"selected-option\\\" style=\\\"overflow:hidden;height:100%; min-height: 20px;\\\">\\n\" +\n \" <button onclick=\\\"unselectSelectedOption('{0}')\\\" style=\\\"float:left;padding-bottom:100%;margin-bottom:-100%;\\\">x</button>\\n\" +\n \" <li class=\\\"filter-options\\\" style=\\\"height:100%;min-height: 25px;\\\">{1}</li>\\n\" +\n \"</div>\"; \n var text = $(element).parents(\"div\").children(\"div\").children(\"p\").text();\n var optionAlreadySelected = false;\n filterType.children(\"div\").each( function(index, value) {\n if ($(value).prop('id').replace(/-/g, ' ') == text)\n optionAlreadySelected = true;\n });\n if (!optionAlreadySelected) {\n // Add to option list\n filterType.append(optionFormatString.format(text.replace(/ /g, '-'), text));\n // Set data field\n $(\"#\"+text.replace(/ /g, '-')).data(\"data\", text);\n }\n }\n // Remove option from selected option list\n else {\n filterType.children(\"div\").each(function(index, value) {\n if ($(value).children(\"li\").text() == $(element).parent().parent().children('div').children(\"p\").text())\n value.remove();\n });\n }\n}", "function populate_user_specialization_dropdown_by_query()\n{\n let select = document.getElementById(\"Select User Course Specialization\");\n let arr= Get(\"api/buttonsdynamically/get/specialization\");\n if(select===null)\n alert(\"empty object retrieved from DOM parse\");\n if( select.length>1) {\n //alert(\"Specialization already exist in under the domain button, no need to again add them\");\n return \"\";\n }\n for (let i = 0; i < arr.length; i++) {\n let option = document.createElement(\"OPTION\"), txt = document.createTextNode(arr[i]);\n option.appendChild(txt);\n option.setAttribute(\"value\", arr[i]);\n select.insertBefore(option, select.lastChild);\n }\n \n}", "function moveSelectedOptionsLeft(from,to) {\n\n \n // Unselect matching options, if required\n if (arguments.length>3) {\n var regex = arguments[3];\n if (regex != \"\") {\n unSelectMatchingOptions(from,regex);\n }\n }\n // Move them over\n \n \n if (!hasOptions(from)) { return; }\n for (var i=0; i<from.options.length; i++) {\n var o = from.options[i];\n if (o.selected) {\n if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }\n to.options[index] = new Option( o.text, o.value, false, false);\n }\n }\n // Delete them from original\n for (var i=(from.options.length-1); i>=0; i--) {\n var o = from.options[i];\n if (o.selected) {\n from.options[i] = null;\n }\n }\n\n if ((arguments.length<3) || (arguments[2]==true)) {\n sortSelect(from);\n sortSelect(to);\n }\n from.selectedIndex = -1;\n to.selectedIndex = -1;\n//alert(\"to.options.length\"+to.options.length);\n }", "function reset_select(selObject){\n for (i=0;i<selObject.options.length;i++){\n selObject.options[i].selected=false;\n }\n}" ]
[ "0.68908316", "0.66275054", "0.64846766", "0.64497006", "0.6391839", "0.63784665", "0.63549954", "0.6313525", "0.63003933", "0.62747633", "0.62591857", "0.6257454", "0.62531173", "0.625009", "0.6219929", "0.62089163", "0.6208373", "0.62009215", "0.62009215", "0.6173861", "0.61733526", "0.6161351", "0.6160659", "0.61499286", "0.61471933", "0.61416864", "0.6139308", "0.61320907", "0.6128298", "0.61238796", "0.6117449", "0.6103916", "0.6101252", "0.60826224", "0.60737765", "0.6067723", "0.6059673", "0.6058418", "0.6055159", "0.605451", "0.6051915", "0.6044253", "0.60422564", "0.6040206", "0.60272247", "0.602467", "0.601939", "0.6016369", "0.60139036", "0.60046005", "0.60032344", "0.6001921", "0.5991195", "0.59905607", "0.5983525", "0.59814465", "0.5975695", "0.5970363", "0.59701884", "0.59605306", "0.5959051", "0.5958604", "0.59530544", "0.5950366", "0.59433675", "0.59415764", "0.5937685", "0.59371877", "0.5928849", "0.59248596", "0.5919047", "0.5916097", "0.59144205", "0.5912224", "0.5911644", "0.59102064", "0.590945", "0.5908561", "0.59072894", "0.59072864", "0.59071183", "0.5904571", "0.59004325", "0.5899628", "0.5898204", "0.5894404", "0.5893841", "0.58936167", "0.58930886", "0.5891803", "0.5891644", "0.58915144", "0.5891401", "0.5887675", "0.5884629", "0.5875738", "0.58710974", "0.5867223", "0.5866687", "0.5861624", "0.5853094" ]
0.0
-1
Given an array of arbitrarily nested arrays, return n, where n is the deepest level that contains a nonarray value. Examples Input Output array: [ [ 5 ], [ [ ] ] ] ==>2 array: [ 10, 20, 30, 40 ] ==>1 array: [ [ 10, 20 ], [ [ 30, [ 40 ] ] ] ] ==>4 array: [ ] ==>0 array: [ [ [ ] ] ] ==>0
function arrayception(matrix){ var result = 0; for(var i = 0; i <matrix.lenght; i ++){ for( var j =0 ; j <matrix.length; j++){ if (!Array.isArray(matrix[i][j])){ return matrix } } } return matrix.push(result) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayCeption(array) {\n\tvar deepest = 0 ;\n\tfunction deepestLevel(array, level) {\n\t\tfor(var i = 0 ; i < array.length ; i++) {\t\t\t\t\t\t\t\t\t//i'll loop through all the array element\n\t\t\tif(Array.isArray(array[i]) && array[i].length > 0) {\t\t\t\t\t//i'll check if that element is an array and it's not empty\n\t\t\t\tdeepestLevel(array[i], level+1)\t\t\t\t\t\t\t\t\t\t//if yes i'll call the same function with that element and i'll increment the level\n\t\t\t}\n\t\t\tif(!Array.isArray(array[i])){\t\t\t\t\t\t\t\t\t\t\t//if no more element inside the elements of the array is an array\n\t\t\tdeepest = Math.max(deepest,level)\t\t\t\t\t\t\t\t\t\t// i'll check if the level is bigger than 0 or no\n\t\t\t}\n\t\t}\n\t}\n\t\tdeepestLevel(array, 0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t// i'll invoke the recursive function with the array and the level of 0\n\t\treturn deepest // and i'll return the max between the level and the depth declared at the beginning\n}", "function deepestLevelValue(arr){\n var value = 0;\n\n function looping(arr){\n\n if(arr[0][0] === undefined ){\n \t return ++value;\n }\n\t for (var i = 0; i < arr.length; i++) {\n\t \tif(typeof arr[i][0] !== 'number'){\n\t\t\t value++;\n\t\t\t return looping(arr[i])\n\t\t}\n\t}\n }\n return looping(arr) \n}", "static flattenDepth() {\n let array = [1, [2, [3, [4]], 5]];\n console.log(_.flattenDepth(array, 30));\n array = [[[[[[{b: 34}]]], {a: 34}]]];\n console.log(_.flattenDepth(array, 2));\n }", "function Arrayception(array, depth = 0) {\n var depth = 0\n var maxdepth = 0\n function checkArray(arr) {\n for (var i = 0; i < arr.length; i++) {\n if (!Array.isArray(arr[i]) && depth === 0) {\n depth++;\n if (depth > maxdepth) {\n maxdepth = depth\n }\n }\n\n else return checkArray(arr[i], depth + 1)\n\n\n\n }\n }\n checkArray(array)\n // for (var i = 0; i < array.length; i++) {\n // if (!Array.isArray(array[i]) && depth === 0) {\n // depth++;\n // if (depth > maxdepth) {\n // maxdepth = depth\n // }\n // }\n\n // else Arrayception(array[i])\n\n\n\n // }\n return maxdepth;\n}", "function getLength(nestArr) {\n return nestArr.flat(Infinity).length;\n}", "function arrayCeption(array) {\n var count;\n array.forEach(element => {\n if(element.length === 0){\n count = 0\n }\n else if (Array.isArray(element)) {\n count = arrayCeption(element)\n if (count>0) {\n count++\n }\n } \n else {\n count = 1\n }\n }); \n return count\n}", "function flattenDepth(array,n)\n{\nconsole.log(array.flat(n));\n}", "function largestNumbersInSubarrays(arr) {\n\tlet maxArr = [];\n\tlet maxInside;\n\tfor(let i = 0; i<arr.length; i++) {\n\t\tmaxInside = arr[i][0];\n\t\tfor (let j = 0; j <arr[i].length; j++) {\n\t\t\tif (arr[i][j] > maxInside) {\n\t\t\t\tmaxInside = arr[i][j];\n\t\t\t}\n\t\t}\n\t\tmaxArr.push(maxInside);\n\t}\n\treturn maxArr;\n}", "function steamrollArray(arr) {\r\n // iterate through array and check for elements till last level of nesting\r\n var flattened = [];\r\n\r\n for(var i = 0; i < arr.length; i++){\r\n if(Array.isArray(arr[i])){\r\n var subArr1 = arr[i];\r\n for(var j = 0; j < subArr1.length; j++){\r\n if(Array.isArray(subArr1[j])){\r\n var subArr2 = subArr1[j];\r\n for(var k = 0; k < subArr2.length; k++){\r\n if(Array.isArray(subArr2[k])){\r\n var subArr3 = subArr2[k];\r\n for(var l = 0; l < subArr3.length; l++){\r\n flattened.push(subArr3[l]);\r\n }\r\n }\r\n else{\r\n flattened.push(subArr2[k]);\r\n }\r\n }\r\n }\r\n else{\r\n flattened.push(subArr1[j]);\r\n }\r\n }\r\n }\r\n else{\r\n flattened.push(arr[i]);\r\n }\r\n }\r\n\r\n return flattened;\r\n}", "function flatDeepN(arr) {\n const stack = [...arr];\n const res = [];\n while(stack.length) {\n const next = stack.pop();\n if (Array.isArray(next)) {\n stack.push(...next);\n } else {\n res.push(next);\n }\n }\n\n return res.reverse();\n}", "function recurseArray(array) {\n for (const el of array) {\n if (el.id == id) {\n return array;\n } else if (el[\"nested\"]?.length > 0) {\n var hi = recurseArray(el[\"nested\"]);\n if (hi) {\n return hi;\n }\n }\n }\n }", "function condense(arr, depth, type) {\n var cond_array = []\n var proc = 0\n var count = 0;\n while (proc < arr.length) {\n //if the last element has been reached, ad it and move on\n if (proc == arr.length - 1) {\n cond_array.push([1, arr.slice(proc, proc + 1), type]);\n break;\n }\n //counts how many times each slice occurs in succession. Depending on how deep we are, it looks at larger slices\n while (arrayEquals(arr.slice(proc, proc + depth), arr.slice(proc + depth * (count + 1), proc + depth * (count + 2)))) {\n if (proc + count < arr.length - 1) {\n count++;\n }\n else {\n break;\n }\n }\n // add the info to the new array, records the amount already looked at and resets the count\n cond_array.push([count + 1, arr.slice(proc, proc + depth), type]);\n proc = proc + depth * (count + 1);\n count = 0;\n }\n // If we can go deeper, then run the process again\n if (depth < Math.floor(arr.length / 2)) {\n return condense(cond_array, depth + 1, type);\n }\n else {\n return cond_array;\n }\n}", "function getLength(array) {\n console.log(array);\n // base case\n if (array[0] === undefined) return 0;\n // recursive call\n // return 1+ getLength(array without the first value)\n return 1 + getLength(array.slice(1));\n}", "function flatten_nested_arrays(array_of_arrays)\n{\n\tvar flattened_array = []\n\tfor (var i in array_of_arrays)\n\t{\n\t\tvar item = array_of_arrays[i]\n\t\tif (item instanceof Array)\n\t\t{\n // console.log(\"found subarray\")\n\t\t\t// recursively flatten subarrays.\n\t\t\tvar flattened_sub_array = flatten_nested_arrays(item)\n\t\t\tfor (var k in flattened_sub_array)\n\t\t\t{\n flattened_array.push(flattened_sub_array[k])\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tflattened_array.push(item)\n\t\t}\n\t}\n\treturn flattened_array\n}", "function flattenUnbound(arr) {\r\n\tif (!Array.isArray(arr))\r\n\t\treturn arr;\r\n\r\n\tconst stack = [arr];\r\n\tconst indicies = [0, 0, 0, 0];\r\n\tconst res = [];\r\n\tlet cur = arr;\r\n\tlet slen = 1;\r\n\tlet rlen = 0;\r\n\tlet clen = arr.length;\r\n\r\n\tfor (let i = 0; slen; i++) {\r\n\t\tlet itm = cur[i];\r\n\t\tif (i == clen) {\r\n\t\t\tcur = stack[--slen];\r\n\t\t\ti = indicies[slen];\r\n\t\t\tclen = cur.length;\r\n\t\t} else if (Array.isArray(itm)) {\r\n\t\t\tindicies[slen] = i;\r\n\t\t\tstack[slen++] = cur;\r\n\t\t\tcur = itm;\r\n\t\t\tclen = itm.length;\r\n\t\t\ti = -1;\r\n\t\t} else {\r\n\t\t\tres[rlen++] = itm;\r\n\t\t}\r\n\t}\r\n\r\n\treturn res;\r\n}", "function isFlattened(array) {\n return Number.isFinite(array[0]);\n}", "function flattenDepth(array, depth){\n const length = array == null ? 0 : array.length;\n if(!length){\n return [];\n }\n depth = depth === undefined ? 1 : +depth;\n return baseFlatten(array, depth);\n}", "function productSum(array, depth = 2) {\n sum = 0;\n for (var i = 0; i < array.length; i++) {\n if (Array.isArray(array[i])) {\n sum += depth * productSum(array[i], depth + 1);\n } else {\n sum += array[i];\n }\n }\n return sum;\n}", "function maxSubarray(arr) {\n\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n //Create a counter for the number of ways to cut the tree\n let counter = 0;\n //Check if Array is sorted in either order. If yes, return counter as -1;\n if(isArraySorted(A)){\n counter = -1;\n return counter;\n }\n // Else,Loop through the array to identify if the trees can be cut\n else{\n for(let i=0;i<A.length; i++){\n //For ith element, check if the i+1 is greater than i or lesser than i\n //If i+1 is greater than i, then check if i+2 is lesser than i+1\n //Take 3 elements and see if they are in the required order of i>i+1 & i+1<i+2 or i<i+1 & i+1>i+2\n if(!checkIfInOrder(A[i],A[i+1],A[i+2])){\n counter++;\n }\n }\n }\n \n //Return the counter\n return counter;\n}", "function flattenArray(array) {\n function flattenDown(array, result) {\n for (var i = 0; i < array.length; i++) {\n var value = array[i];\n\n if (Array.isArray(value)) {\n flattenDown(value, result);\n } else if (value != null && value !== false) {\n result.push(value);\n }\n }\n\n return result;\n }\n\n return flattenDown(array, []);\n}", "function flatten1(arr, n = Infinity) {\n return arr.flat(n)\n}", "function flat_sum(input){\n sum=0; //holds the sum\n for (var x=0;x<input.length;x++){\n if(Array.isArray(input[x])) \n sum+=flat_sum(input[x]); //if the selected element is an array run flat_sum on that element recursively and add it to the sum\n else\n sum+=input[x]; //if the element is not an array add the element to the sum \n }\n return sum;\n}", "function getMaxSum(array) {\n let result = 0;\n for (let i = 1; i < array.length-1; i++) {\n for (let j = 1; j < array[i].length-1; j++) {\n if (array[i-1][j-1] !== undefined && array[i+1][j+1] !== undefined && array[i-1][j+1] !== undefined && array[i+1][j-1] !== undefined){\n let sum = array[i][j] + array[i-1][j-1] + array[i-1][j] + array[i-1][j+1] + array[i+1][j-1] + array[i+1][j] + array[i+1][j+1];\n if (sum > result) { result = sum; }\n }\n }\n }\n return result;\n}", "function maxSubsetSumNoAdjacent(array) {\n\t// if array is empty return 0\n\tif(array.length === 0) {\n\t\treturn 0;\n\t}\n\t// if length is 1 return the value\n\tif (array.length === 1) {\n\t\treturn array[0];\n\t}\n\t// pointer for n-2\n let second = array[0];\n\t// pointer for n -1\n let first = Math.max(array[0], array[1]);\n\t\n\t// loop through array starting at 2\n\tfor (let i = 2; i < array.length; i++) {\n\t\t// current index - 1\n let current = Math.max(first, second + array[i]);\n second = first;\n first = current;\n\t}\n\t// return last index as it's the max Sum\n\treturn first;\n}", "function maxSubarraySum1(arr, n) {\n if (arr[1] === undefined) return null;\n let max = -Infinity;\n let total = 0;\n\n for (let i = 0; i <= arr.length - n; i++) {\n total = 0;\n for (let j = 0; j < n; j++) {\n total += arr[i + j];\n }\n if (max < total) max = total;\n }\n\n return max;\n}", "function getLengthOfMissingArray(arrayOfArrays) {\n var lengths = (arrayOfArrays || [])\n .map(a => a ? a.length : 0)\n .sort((a, b) => a - b);\n if (lengths.includes(0)) {\n return 0;\n }\n for (var i = 0; i < lengths.length - 1; i++) {\n if (lengths[i] + 1 !== lengths[i + 1]) {\n return lengths[i] + 1;\n }\n }\n return 0;\n}", "function arrayFlat(e,t=[]){for(let n=0,r=e.length;n<r;n++){const r=e[n];Array.isArray(r)?arrayFlat(r,t):t.push(r)}return t}", "static flatten() {\n let array = [1, [2, [3, [4]], 5]];\n console.log(_.flatten(array));\n }", "function findMax1(ar)\n{\n var max = -Infinity;\n\n // Cycle through all the elements of the array\n for(var i = 0; i < ar.length; i++)\n {\n var el = ar[i];\n\n // If an element is of type array then invoke the same function\n // to find out the maximum element of that subarray\n if ( Array.isArray(el) )\n {\n el = findMax1( el );\n }\n\n if ( el > max )\n {\n max = el;\n }\n }\n\n return max;\n}", "function flatten(array){\n const length = array.length == null ? 0 : array.length;\n return length ? baseFlatten(array, 1) : 0;\n}", "function productSum(array, depth = 1) {\n let sum = 0;\n\n for (let i = 0; i < array.length; i += 1) {\n if (typeof array[i] === 'number') {\n sum += array[i];\n } else if (Array.isArray(array[i])) {\n sum += productSum(array[i], depth + 1);\n }\n }\n return sum * depth;\n}", "function twoDimensionalSize(array) {\n var count = 0;\n\n for (var i = 0; i < array.length; i += 1) {\n var inner_arr = array[i];\n count += inner_arr.length;\n }\n return count;\n}", "function findMaximumSubarray2(A) {\n \n}", "function productSum(array, depth = 1) {\n // Write your code here.\n // keep track of depth\n // keep track of sum\n let sum = 0;\n\n array.forEach((subarr) => {\n if (!Array.isArray(subarr)) {\n sum += subarr;\n } else {\n sum += productSum(subarr, depth + 1);\n }\n });\n\n return sum * depth;\n}", "function maxSubsetSumNoAdjacent(array) {\n // edge case, if the array has no length\n if (!array.length) return 0;\n if (array.length === 1) return array[0];\n // create an array that we will push values to as we iterate through the array\n const dynamicArr = array.slice()\n dynamicArr[1] = Math.max(array[0], array[1]) // make sure you start of with hte maximum value -- etch case where there is a skip later on\n // create for loop to iterate through the array, and add value based off the best case scenario (typic)\n for (let i = 2; i < array.length; i++) {\n // take the maximum off array[i] + array[i - 2] versus dynamicArr[i - 1]\n dynamicArr[i] = Math.max(dynamicArr[i] + dynamicArr[i - 2], dynamicArr[i - 1])\n console.log(dynamicArr)\n }\n return dynamicArr[dynamicArr.length - 1]\n}", "function largestOfFour(arr) {\n \n var largestNumbers = [];\n \n //Loop through array to access subarrays\n for (var j = 0; j < arr.length; j++) {\n \n var largest = 0;\n for (var i = 0; i < arr[j].length; i++) {\n //Compare each value in sub array\n if (arr[j][i] > largest) {\n largest = arr[j][i];\n }\n }\n \n //Append largest value in each sub array to new array\n largestNumbers.push(largest);\n }\n \n //Return the new array\n return largestNumbers;\n}", "function maxSubarray(a) {\n var opt = [];\n for (var from = 0; from < a.length; from++) {\n opt[from] = new Array(a.length);\n opt[from] = opt[from].map(function() {return 0;});\n opt[from][from] = a[from];\n for (var to = from+1; to < a.length; to++) {\n opt[from][to] = opt[from][to-1] + a[to];\n }\n }\n\n var max = Number.MIN_VALUE;\n var maxRange = [];\n for (var from = 0; from < a.length; from++) {\n for (var to = from; to < a.length; to++) {\n if (opt[from][to]>max) {\n max = opt[from][to];\n maxRange = [from, to+1];\n }\n }\n }\n\n return Array.prototype.slice.apply(a, maxRange);\n}", "function arrayEnum2(array) {\n var maxSoFar = 0;\n var subLen; // Starts at 1 because 1 is the smallest subarray we can have.\n var subSum = 0;\n\n // Loop over all possible sub array sizes.\n for(subLen = 0; subLen < array.length; subLen++) {\n subSum = 0; // Reset our temporary sum container.\n\n // Loop over each possible position the sub array can occupy.\n for(var i = subLen; i < array.length; i++) {\n\n // Sum the sub array.\n subSum += array[i];\n\n // Check to see if sub array sum is larger than current largest.\n if(maxSoFar < subSum) {\n maxSoFar = subSum;\n }\n\n }\n\n }\n return maxSoFar;\n}", "function largestOfFour(arr) {\n var largestArray = [];\n\n //Move through each sub-array.\n for (var i = 0; i < arr.length; i++) {\n var biggestNum = 0;\n //Move through each element in the specific sub-array.\n for (var j = 0; j < arr[i].length; j++) {\n if (arr[i][j] > biggestNum) {\n biggestNum = arr[i][j];\n } \n } //Push biggestNum result to array, then we'll try next sub-array.\n largestArray.push(biggestNum);\n }\n \n return largestArray;\n}", "function maxSubarraySum(arr, n) {\n\n if (n > arr.length) return null;\n\n let max = -Infinity;\n\n for (var i = 0; i < arr.length - n + 1; i++) {\n\n let temp = 0;\n for (var j = 0; j < n; j++) {\n temp += arr[i + j];\n }\n\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n}", "function maxSubarraySum(arr, n){\n if(n > arr.length) return null\n let sum = 0\n for (let i=0; i<n; i++){\n sum += arr[i]\n }\n let maxSum = sum\n\n for(let j=n; j<arr.length; j++){\n sum = sum + arr[j] - arr[j-n]\n maxSum = Math.max(maxSum, sum)\n }\n return maxSum\n}", "function flatDeep(arr, d = 1) {\n return d > 0 ? arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatDeep(val, d - 1) : val), [])\n : arr.slice();\n }", "function maxSubarraySum(arr, n) {\n\tif (n > arr.length) return null;\n\n\tlet temp, sum;\n\t// Edge case for negative number arrays\n\tlet maxSum = -Infinity;\n\n\tfor (let i = 0; i < arr.length - n + 1; i++) {\n\t\t// Window pointer\n\t\ttemp = i;\n\t\tsum = 0;\n\t\t// Sum the window\n\t\tfor (let j = 0; j < n; j++) {\n\t\t\tsum += arr[temp];\n\t\t\ttemp++;\n\t\t}\n\t\tif (sum > maxSum) {\n\t\t\tmaxSum = sum;\n\t\t}\n\t}\n\treturn maxSum;\n}", "function largestOfFour(arr) {\r\n var subArrayPos = 0; // var for I array\r\n var subArrayNum = [0];// var for J array\r\n for(i = 0; i < arr.length; i++)\r\n { //loop 4 arrays, inside array\r\n for(j = 0; j < arr[i].length; j++)\r\n { //loop numbers inside 4 arrays\r\n var newArrayMax = arr[i][j];\r\n if(subArrayPos < newArrayMax)\r\n {\r\n subArrayPos = newArrayMax;\r\n subArrayNum[i] = subArrayPos;\r\n }\r\n }\r\n subArrayPos = 0; //set to zero\r\n }\r\n return subArrayNum;\r\n}", "function finalArray(array){\n let rep=null;\n if(Array.isArray(array)){\n rep=array[array.length-1];\n }\n return rep;\n}", "function largestOfFour(arr) {\n var largestArr = []; // empty holder array to hold results of largest numbers\n for (var i = 0; i < arr.length; i++) { // iterates through outer arrays\n var largestNum = 0; // set largest number to 0 to compare to initially. Resets after each sub-array iteration\n for (var j = 0; j < arr.length; j++) { // iterates through inner arrays\n if (arr[i][j] >= largestNum) { // if current number in loop is greater than or equal to largestNum.\n largestNum = arr[i][j]; // current number in loop becomes largest number\n }\n }\n largestArr.push(largestNum); // pushes the largest number of each inner array in to holder array.\n }\n console.log(largestArr);\n return largestArr; // returns the new array with largest numbers of each inner array.\n}", "function postDepth(fun, ary) {\n return visit(partial(postDepth, fun), fun, ary);\n}", "function steamrollArray(arr){\n \n // we are gonna use recursion reducing the array => if element is number will be shifted to new array,\n // else recursion will go one level deep\n return arr.reduce((acc, val)=> acc.concat(Array.isArray(val)?steamrollArray(val):val), []);\n }", "function fn(arr) {\n let\n return arr.reduce((pre, cur, index, arr) => {\n for (let i = 0; i < cur.length; i++) {\n for (let j = index; j < )\n }\n return pre\n }, [])\n}", "function findCons(array) {\n let result = 0;\n let stack = [];\n array.forEach(element => {\n //if element is a 1\n if (element === 1) {\n stack.push(element);\n }\n //if element is a 0\n else {\n //check if current stack size is biggest\n if (stack.length > result) {\n result = stack.length;\n stack.length = 0;\n }\n }\n });\n //return\n return result > stack.length ? result : stack.length;\n}", "function largestSubarraySum(array){\n\n let target = 0;\n let reversedArray = [...array].reverse();\n const reducer = (accumulator, currentValue) => accumulator + currentValue;\n\n\tfor (let i = 0; i < array.length - 1; i++){\n const slicedArray = array.slice(i);\n const slicedReversedArray = reversedArray.slice(i);\n\n const arr1Sum = slicedArray.reduce(reducer);\n const arr2Sum = slicedReversedArray.reduce(reducer);\n\n const arr3Sum = slicedArray.slice(0, -1).reduce(reducer);\n const arr4Sum = slicedReversedArray.slice(0, -1).reduce(reducer);\n\n target < arr1Sum ? target = arr1Sum : undefined;\n target < arr2Sum ? target = arr2Sum : undefined;\n\n target < arr3Sum ? target = arr3Sum : undefined;\n target < arr4Sum ? target = arr4Sum : undefined;\n\n }\n return target;\n}", "function arraySumN(ary, n) {\n var indicesSumToN = [];\n\n for(i = 0; i < ary.length; i ++){\n var innerArr = ary[i];\n\n if (sumUp(innerArr) === n) {\n indicesSumToN.push(i);\n }\n }\n return indicesSumToN;\n}", "function flatten (arr) {\n var flatArr = [], i\n function nestedCheck (arr1) {\n for (var j = 0;j < arr1.length;j++) {\n if (!Array.isArray(arr1[j]))\n flatArr.push(arr1[j])\n else nestedCheck(arr1[j])\n }\n }\n for (i = 0;i < arr.length;i++) {\n if (!Array.isArray(arr[i]))\n flatArr.push(arr[i])\n else nestedCheck(arr[i])\n }\n return flatArr\n}", "function steamrollArray(arr) {\n // I'm a steamroller, baby\n var firstArray = [];\n var finalArray = [];\n arr.forEach(function(item){\n if (Array.isArray(item)){\n item.forEach(function(innerItem){\n firstArray.push(innerItem);\n });\n } else {\n firstArray.push(item);\n }\n });\n \n \n firstArray.forEach(function(item){\n if(Array.isArray(item)){\n item.forEach(function(innerItem){\n if (Array.isArray(innerItem)){\n innerItem.forEach(function(deepItem){\n console.log(deepItem);\n finalArray.push(deepItem);\n });\n } else {\n finalArray.push(innerItem);\n }\n });\n } else {\n finalArray.push(item);\n }\n });\n \n return finalArray;\n}", "function arraysSumN(ary, n) {\n var correctSum = n;\n var correctSumArray = [];\n for (var subArray = 0; subArray < ary.length; subArray++) {\n var subArraySum = 0;\n for (var index = 0; index < ary[subArray].length; index++) {\n subArraySum += ary[subArray][index];\n }\n if (subArraySum === correctSum) {\n correctSumArray.push(ary[subArray]);\n }\n }\n return correctSumArray;\n}", "function arrayFlattener(x) {\n const array = [];\n for (let i=0; i<x.length; i++) {\n if (x[i].length > 0){\n\n for (let j=0; j<x[i].length; j++) {\n array.push(x[i][j]);\n }\n }\n else {\n array.push(x[i]);\n }\n }\n return array;\n}", "function flatArr(arr) {\n return arr.flat(Infinity)\n}", "function largestOfFour(arr) {\n let array=[];\n let maxSubArray;\n arr.forEach(element => array.push(Math.max(...element)));\n return array;\n }", "function findSolution(arr) {\n const x = [];\n let longestSubArrayLength = 0;\n let subArrayLength = 0;\n for (i = 0; i < arr.length; i++) {\n if (x.includes(arr[i])) {\n if (subArrayLength > longestSubArrayLength) {\n longestSubArrayLength = subArrayLength;\n }\n subArrayLength = 1;\n x.length = 0;\n } else {\n x.push(arr[i]);\n subArrayLength += 1;\n }\n }\n return subArrayLength > longestSubArrayLength\n ? subArrayLength\n : longestSubArrayLength;\n}", "function flatten(array) {\n var newArr = [];\n (function recur(arr){\n arr\n .forEach(function(el) {\n if (Array.isArray(el) {\n recur(el);\n } else {\n newArr.push(el);\n }\n });\n })(array);\n return newArr;\n}", "function unnest(arrOrObj, fn, opt_initial, opt_skipRecursives) {\r\n var initialIsArray = typeOf(opt_initial = opt_initial || (isArrayLike(arrOrObj) ? [] : {}), 'Array');\r\n function add(valueToAdd, opt_index) {\r\n if (opt_index == undefined && initialIsArray) {\r\n opt_initial.push(valueToAdd);\r\n }\r\n else {\r\n opt_initial[opt_index] = valueToAdd;\r\n }\r\n }\r\n function helper(parent, path, seen, seenCount) {\r\n var newPath;\r\n seen = [parent].concat(seen);\r\n seenCount++;\r\n function recurse(value) {\r\n for (var i = seenCount; i--;) {\r\n if (seen[i] === value) {\r\n if (opt_skipRecursives) {\r\n return;\r\n }\r\n throw new Error('Cannot unnest recursive, nested structures.');\r\n }\r\n }\r\n helper(value, newPath, seen, seenCount);\r\n }\r\n walk(parent, function(value, index) {\r\n fn(value, index, add, recurse, parent, newPath = path.concat([index]), arrOrObj);\r\n });\r\n }\r\n helper(arrOrObj, [], [], 0);\r\n return opt_initial;\r\n }", "function largestOfFour(arr) {\n\n // initialize result array\n let arrResult = [];\n\n // loop through each sub-array\n for (let i=0; i<arr.length; i++) {\n \n // find largest value in subarray, use spread operator (\"...\")\n let maxValSubArray = Math.max(...arr[i]);\n \n // store largest value in result array\n arrResult.push(maxValSubArray);\n }\n\n return arrResult;\n}", "function maxSubArrayDP(data){\n var sum = Array(data.length);\n sum[0] = data[0];\n var resultValue = sum[0];\n var result = Array(data.length);\n result[0] = [data[0]];\n var resultIndex = 0;\n for (var i=1;i<data.length;i++){\n if (sum[i-1] + data[i] > data[i]){\n sum[i] = sum[i-1] + data[i];\n result[i] = result[i-1].slice(); // FIXME: how to copy array in O(1) time?\n result[i].push(data[i]);\n }else{\n sum[i] = data[i];\n result[i] = [data[i]];\n }\n if (sum[i] > resultValue){\n resultValue = sum[i];\n resultIndex = i;\n }\n }\n return result[resultIndex];\n}", "function maxSubArraySum(arr, n) {\n let maxSum = 0;\n let tempSum = 0;\n\n if(arr.length < num) return null;\n\n //get the sum of n numbers\n for(let i = 0; i < arr.length; i++) {\n maxSum += arr[i];\n }\n\n tempSum = maxSum;\n\n for(let i = num; i < arr.length; i++) {\n //[2, 4, 1, 4, 1, 5, 1, 5]\n // s -tempsum- e\n let startOfWindow = arr[i - num];\n let endOfWindow = arr[i];\n tempSum = tempSum - startOfWindow + endOfWindow;\n maxSum = Math.max(tempSum, maxSum)\n }\n\n return maxSum;\n}", "function nestArray(depth) {\n var length = randomBetween(1, 5),\n spot = randomBetween(0, length - 1),\n a = [];\n for (var i = 0; i < length; i++) { a[i] = spot + i; }\n return depth === 0 ? a : a[spot] = nestArray(depth - 1), a;\n}", "function maximumsubarray(arr) {\n if (arr.length === 1) {\n return [0, 0, arr[0]];\n } else {\n return maximumSubarrayHelper(arr, 0, arr.length-1);\n }\n}", "function sumArray(array) {\n var highestSum = array[0];\n\n function traverseSubsetsAtIndexN (startIndex) {\n var current = array[startIndex];\n\n //single element \n if (current > highestSum) {\n highestSum = current;\n }\n\n //continguous elements\n for (var i = startIndex+1; i < array.length; i++) {\n current = current + array[i];\n if (current > highestSum) {\n highestSum = current;\n }\n }\n }\n\n for (var i = 0; i < array.length; i++) {\n traverseSubsetsAtIndexN(i);\n }\n\n return highestSum;\n}", "function largestOfFour(arr) {\n\tlet arrMax = [];\n\tarr.forEach(array => arrMax.push(Math.max(...array.flat())));\n\treturn arrMax;\n}", "function Eight(){\nlet matrix = arguments[0]\n\nlet max = flattener(matrix)\n\nfunction flattener(){\n let param = arguments[0]\n return param.reduce((acc,val)=>\n acc.concat(Array.isArray(val)?flattener(val):val)\n ,[])\n }\nconsole.log(max.sort((a,b)=>b-a)[0]);\n}", "function maxSubArray(nums) {\n if (nums.length < 1) {\n return null;\n }\n\n let max_result = -Infinity, \n temp_max = 0;\n \n for (let i = 0; i < nums.length; i++) {\n temp_max += nums[i]\n \n if (max_result < temp_max) {\n max_result = temp_max;\n }\n\n if (temp_max < 0) {\n temp_max = 0;\n }\n }\n\n return max_result;\n}", "function largestOfFour(arr) {\n // Array for largest number in each sub-array \n newArr = [];\n // For each array in arr\n arr.forEach(function(array){\n // largestNum for comparison \n var largestNum = 0;\n // Iterating through current array \n for (var i = 0; i < array.length; i++){\n // If number at current index > largestNum \n if (array[i] > largestNum){\n // Largestnum is current number \n largestNum = array[i];\n }\n }\n // Push largestNum of current array onto newArr\n newArr.push(largestNum);\n });\n return newArr;\n }", "function minHeightBst(array) {\n // Write your code here.\n return buildTree(array, null, 0, array.length - 1);\n}", "function maxSubarraySum(array, num) {\n if (num > array.length) {\n return null;\n }\n var max = -Infinity;\n for (let i = 0; i < array.length; i++) {\n temp = 0;\n for (let j = 0; j < num; j++) {\n temp += array[i + j];\n }\n if (temp > max) {\n max = temp;\n }\n }\n return max;\n}", "function largestOfFour() {\n var arr = arguments;\n var largestArr = [];\n for (var i=0; i<arr.length; i++){\n var subArr = arr[i];\n var largestInSubArr = subArr[0]; \n for(var j=0;j<subArr.length; j++){\n if(subArr[j]>largestInSubArr){\n largestInSubArr = subArr[j];\n }\n }\n largestArr.push(largestInSubArr);\n }\n console.log(largestArr);\n return largestArr;\n}", "function getArrayOuter(arr) {\n const result = [];\n if (arr.length) result.push(arr[0]);\n if (arr.length > 1) result.push(arr[arr.length - 1]);\n return result;\n}", "function maxSubsetSumNoAdjacent(array) {\n // Write your code here.\n if (array.length === 0) {\n return 0;\n }\n var maximumSums = [];\n for (var i = 0; i < array.length; i++) {\n if (i === 0) {\n maximumSums.push(array[i]);\n }\n else if (i === 1) {\n maximumSums.push(Math.max(array[i - 1], array[i]));\n }\n else {\n maximumSums.push(Math.max(maximumSums[i - 1], maximumSums[i - 2] + array[i]));\n }\n }\n return maximumSums[maximumSums.length - 1];\n}", "function largestSumNoAdj(array) {\r\n if (!array.length) return 0;\r\n if (array.length == 1) return array[0];\r\n const maxSums = array.slice();\r\n maxSums[1] = Math.max(array[0], array[1]);\r\n for (let i = 2; i < array.length; i++) {\r\n maxSums[i] = Math.max(maxSums[i - 1], maxSums[i - 2] + array[i]);\r\n console.log(maxSums);\r\n }\r\n return maxSums[maxSums.length - 1];\r\n}", "function maxSubArraySum(arr, n){ // O(n^2) // naive solution\r\n let maxSum = 0;\r\n for(let i = 0; i < arr.length - n + 1; i++){ // O(n)\r\n let temp = 0;\r\n for(let j = 0; j < n; j++){ // nested O(n)\r\n temp += arr[i + j];\r\n }\r\n if(temp > maxSum){\r\n maxSum = temp;\r\n }\r\n }\r\n return maxSum;\r\n}", "function largestSumNoAdj1(array) {\r\n if (!array.length) return 0;\r\n if (array.length === 1) return array[0];\r\n let max_including_last = array[1];\r\n let max_excluding_last = array[0];\r\n for (let i = 2; i < array.length; i++) {\r\n const current = Math.max(max_including_last, max_excluding_last + array[i]);\r\n max_excluding_last = max_including_last;\r\n max_including_last = current;\r\n }\r\n return max_including_last;\r\n}", "function steamrollArray(arr) {\n let result = [];\n \n for(var i = 0; i < arr.length; i++) {\n \t\n \t// Use recursion if we find inner is an array.\n if(! Array.isArray(arr[i])){\n \tconsole.log('Returning', arr[i]);\n \t\n // add to this particular result stack\n result.push(arr[i]);\n }\n else {\n \t// go another level deeper...\n result = result.concat(steamrollArray(arr[i]));\n \n }\n \n }\n\t\n return result;\n\n}", "function maxSubarraySum(arr, n) {\n let maxSum = 0;\n let tempSum = 0;\n if (arr.length < n) return null;\n for (let i = 0; i < n; i++) {\n maxSum += arr[i];\n }\n tempSum = maxSum;\n for (let i = n; i < arr.length; i++) {\n tempSum = tempSum + arr[i] - arr[i - n];\n maxSum = Math.max(maxSum, tempSum);\n }\n return maxSum;\n}", "function getLengthOfMissingArray(aoa) {\n if (aoa === null || aoa.length === 0 || aoa.includes([]) ) {return 0};\n \n function compareLength(a, b){\n return a.length - b.length;\n } \n var sorted = aoa.sort(compareLength)\n var first = sorted[0].length\n for (var i = 0; i < sorted.length ; i ++) {\n if (sorted[i].length !== first ) { return (first) };\n first ++;\n } \n}", "function largestOfFour(arr) {\n var results = [];\n for (var n = 0; n < arr.length; n++) {\n var largestNumber = arr[n][0];\n for (var sb = 1; sb < arr[n].length; sb++) {\n if (arr[n][sb] > largestNumber) {\n largestNumber = arr[n][sb];\n }\n }\n\n results[n] = largestNumber;\n }\n\n return results;\n}", "function largestOfFour(arr) {\r\n var results = [];\r\n for (var n = 0; n < arr.length; n++) {\r\n var largestNumber = arr[n][0];\r\n for (var sb = 1; sb < arr[n].length; sb++) {\r\n if (arr[n][sb] > largestNumber) {\r\n largestNumber = arr[n][sb];\r\n }\r\n }\r\n\r\n results[n] = largestNumber;\r\n }\r\n\r\n return results;\r\n}", "maxSubArray(arr) {\n const len = arr.length;\n if(len === 0) return 0;\n\n let maxSum = 0;\n for (let start = 0; start < len; start++) {\n for (let end = start; end < len; end++) {\n let sum = 0;\n for (let i = start; i <= end; i++) {\n sum += arr[i];\n }\n maxSum = Math.max(sum, maxSum);\n }\n }\n return maxSum;\n }", "function productSum(array) {\n let sum = 0;\n for (let i = 0; i < array.length; i++) {\n let ele = array[i];\n if (!Array.isArray(ele)) {\n console.log(\"sumbefore\")\n console.log(sum)\n sum += (ele);\n console.log(\"sumafter\")\n console.log(sum)\n } else {\n sum = deeperSums(sum, ele, 2)\n }\n }\n return sum;\n}", "function groupArray(array, size) {\n let ndata = [[]];\n for (let a of array) {\n if (ndata[ndata.length - 1].length === size) ndata.push([]);\n ndata[ndata.length - 1].push(a)\n };\n return ndata;\n}", "function productOfArray(arr){\n if(arr.length === 0) return 1;\n\n return arr.pop() * productOfArray(arr);\n}", "function snail(array) {\n let vector = [];\n while (array.length) {\n vector.push(...array.shift());\n array.map(row => vector.push(row.pop()));\n array.reverse().map(row => row.reverse());\n }\n return vector;\n }", "function getLengthOfMissingArray(arr) {\n if (!arr || arr.length < 1) {return 0;} //check that array.isArray and not empty\n const newArr = [];\n let missingArr;\n for (let i = 0; i < arr.length; i++) {\n if (!arr[i] || arr[i].length < 1) {return 0;} //check that array of array isArray and not empty\n newArr.push(arr[i].length); //take the length of each array\n newArr.sort((a, b) => a - b); //sort by ascending order (1-9)\n }\n for (let i = 0; i < newArr.length; i++) { //loop goes throught newArr for checking missing digit\n if (newArr[i] + 1 != newArr[i + 1]) { //if newArr[i]+1(if i = 0 then 0+1) not equal next digit (loop takes current iteratior and by +1 moving to the next one)\n return missingArr = newArr[i] + 1; //if next is not equal expected result return missing digit\n }\n }\n \n return 0;\n }", "function productSum(array, depth = 1) {\n let sum = 0;\n for (const el of array) {\n if (typeof el === \"number\") {\n // console.log({depth, sum, el});\n sum += el;\n // console.log({depth, sum}, \"typeof el: \", typeof el);\n }\n else {\n sum += (depth + 1) * productSum(el, depth + 1);\n // console.log(\"else block: \", {depth, sum});\n }\n }\n\n return sum;\n}", "function steamrollArray(arr) {\n const result = [].concat(...arr);\n return (result.some(item => Array.isArray(item)) ? steamrollArray(result) : result)\n}", "function flattenArray(array) {\n var result = [];\n function traverse(arr) {\n for (var i = 0; i < arr.length; i++) {\n if (Array.isArray(arr[i])) {\n traverse(arr[i]);\n } else {\n result.push(arr[i]);\n }\n }\n }\n traverse(array);\n\n return result;\n}", "function steamrollArray(arr) {\n //Flatten function flattens an Array to ONE level\n const flatten = (item) => {\n const result = [];\n \n for(const el of item) {\n if(Array.isArray(el)) {\n result.push(...el)\n } else {\n result.push(el)\n }\n }\n \n return result;\n }\n \n\n // While loop checks if ans has an nested array and continues calling the flatten function\n // from above until the isFlat flag is true again.\n let ans = arr;\n while (true) {\n let isFlat = true;\n for (let el of ans) {\n if(Array.isArray(el)) {\n isFlat = false;\n ans = flatten(ans)\n break;\n }\n }\n \n if(isFlat) {\n return ans\n }\n }\n //return arr;\n }", "function solution(A) {\n let len = A.length;\n let storage = {};\n let maxEl = 0, maxCount = 0;\n\n if (len === 0) {\n return -1;\n }\n\n if (len === 1) {\n return 0;\n }\n\n // Solution\n // we used an object(storage) to save every total count of each different number\n // maxEl is used to save element which has highest number so far\n // e.g array A [3, 4, 3, -1, 3] \n // loop 1: storage { '3' : [0] }, maxEl = 3\n // loop 2: storage { '3' : [0], '4' : [1] }, maxEl = 3\n // loop 3: storage { '3' : [0, 2], '4' : [1] }, maxEl = 3\n // loop 4: storage { '3' : [0, 2], '4' : [1], '-1' : [3] }, maxEl = 3\n // loop 5: storage { '3' : [0, 2, 4], '4' : [1], '-1' : [3] }, maxEl = 3\n // check if max element's count over half of array then return max element array index\n // if not then return -1\n // in this case we should return [0, 2, 4]\n\n for (let i = 0; i < len; i++) {\n let el = A[i];\n\n if (storage[el] === undefined) {\n storage[el] = [];\n storage[el].push(i);\n } else {\n storage[el].push(i);\n }\n\n if (storage[el].length > maxCount) {\n maxEl = el;\n maxCount = storage[el].length;\n }\n }\n\n // If every element has equal count , e.g [1, 2, 3] or [-1, -2, 1]\n if (maxCount === 1) {\n return -1;\n }\n\n // Check if max element's count over half array or not\n if (storage[maxEl].length / len <= 0.5) {\n return -1;\n }\n\n return storage[maxEl][0];\n}", "function largestOfFour(arr) {\n let largestNumber = Number.NEGATIVE_INFINITY ;\n let largestArray = [];\n\n for (let i = 0; i < arr.length; i++) {\n\n for (let j = 0; j < arr[i].length; j++) {\n\n if (arr[i][j] > largestNumber) {\n largestNumber = arr[i][j];\n }\n \n }\n\n largestArray.push(largestNumber);\n largestNumber = Number.NEGATIVE_INFINITY;\n }\n console.log(largestArray);\n return largestArray;\n}", "function largestOfFour(arr) {\n // You can do this!\n var results = [];\n // Looping through outter array\n for(outter = 0; outter < arr.length; outter++) {\n // Setting initial value to compare with\n var compare = arr[outter][0];\n\n // Looping through inner array;\n for(inner = 0; inner < arr[outter].length; inner++) {\n if(arr[outter][inner] > compare) {\n compare = arr[outter][inner];\n }\n }\n results.push(compare);\n }\n \n arr = results;\n return arr;\n}", "function lastArr(arr) {\n for (let y = 8; y > 0; y--) {\n for (let x = 8; x > 0; x--) {\n if (typeof arr[y][x] === \"object\") {\n return [y, x];\n }\n }\n }\n }", "function maxArr( inputArr ){\n var maxNumber = -Infinity;\n minArr.forEach(element => {\n if(element > maxNumber)\n maxNumber = element;\n });\n return maxNumber;\n}", "function getMaxArr(arr){\n var maxVal = arr[0][0];\n for( var i=0; i<arr.length; i++ ){\n for ( var j=0; j<arr[i].length; j++ ){\n if( arr[i][j] > maxVal) maxVal = arr[i][j];\n }\n }\n return maxVal;\n}" ]
[ "0.71657556", "0.6774297", "0.66148674", "0.6523984", "0.6279827", "0.6170151", "0.6148254", "0.5908738", "0.5801954", "0.57202995", "0.57159376", "0.56044894", "0.5588739", "0.5577539", "0.55745196", "0.55690473", "0.5533674", "0.54986835", "0.5471469", "0.5435588", "0.5433643", "0.54080737", "0.54020363", "0.540066", "0.5387735", "0.53844845", "0.5368263", "0.5355239", "0.53461564", "0.5342157", "0.53409976", "0.53379995", "0.5317824", "0.53150356", "0.53079295", "0.52896243", "0.527792", "0.52773064", "0.5276288", "0.5267479", "0.52617264", "0.5253499", "0.52454835", "0.5231683", "0.52184683", "0.5214598", "0.52057034", "0.52032274", "0.5194817", "0.51714253", "0.51711565", "0.5170229", "0.51594615", "0.5149659", "0.5149148", "0.514841", "0.5113973", "0.51116234", "0.5104135", "0.510334", "0.5103024", "0.5100577", "0.50872445", "0.5081496", "0.5079704", "0.50651056", "0.5059048", "0.5057349", "0.5057156", "0.50392014", "0.50380033", "0.5030761", "0.5030356", "0.50279695", "0.50267106", "0.5020265", "0.5009138", "0.50019693", "0.50000185", "0.49997655", "0.49982733", "0.49959213", "0.4995809", "0.49951732", "0.4994818", "0.49900165", "0.49850473", "0.4983256", "0.49832115", "0.4979364", "0.49742377", "0.49636006", "0.49627185", "0.4948289", "0.49460587", "0.49430418", "0.494105", "0.4936857", "0.49290517", "0.49252257", "0.4924659" ]
0.0
-1
Watches the file's changes.
_watch() { const watchHandler = this._createAppDefinitions.bind(this); this._componentFinder.watch(); this._componentFinder .on('add', watchHandler) .on('unlink', watchHandler) .on('changeTemplates', watchHandler); this._storeFinder.watch(); this._storeFinder .on('add', watchHandler) .on('unlink', watchHandler); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start() {\n fs.watchFile(this.watchDir, () => {\n this.watch();\n });\n }", "function watch(){\n //Watch for changes in json files\n gaze(path.join(process.cwd(), myOptions.watchedDir) + '/**/*.json', (err, watcher) => {\n // On changed/added/deleted\n watcher.on('all', (event, filepath) => {\n if (myOptions.logLevel>1)\n console.log(filepath + ' was ' + event);\n //If the file is a JSON (database,validation) restart the database\n if (isJSON(filepath)) {\n start(myOptions.restartMode===undefined ? 1 : myOptions.restartMode); //Reload data\n }\n });\n\n });\n}", "start() {\n var watcher = this;\n fs.watchFile(watchDir, function() {\n watcher.watch();\n });\n }", "function watchFiles() {\n\tsync.init({\n\t\topen: 'external',\n\t\tproxy: localsite,\n\t\tport: 8080\n\t});\t\n\n\t//watch for scss file changes\n\twatch(watchCss, buildCSS);\n\t//watch for js file changes\n\twatch(watchJs, series(cleanJS, parallel(buildVarsJS, buildsXHRJS, buildJS), concatJS, parallel(removeJssxhrResidue, removeJsvarsResidue, removeJsResidue)));\n\t//reload browser once changes are made\n\twatch([\n\t\tcssDest + cssOut,\n\t\tjsDest + jsOut,\n\t\twatchPhp \n\t\t]).on('change', sync.reload);\n}", "watch() {\n if (! process.argv.includes('--watch')) return;\n\n this.manualFiles.forEach(file => {\n new File(file).watch(() => {\n File.find(this.manifest.get(file))\n .rename(this.generateHashedFilePath(file))\n .write(File.find(file).read());\n\n this.prune(this.baseDir);\n });\n });\n }", "watch() {\n const watcher = this;\n fs.readdir(this.watchDir, function(err, files) {\n if (err) throw err;\n for (let index in files) {\n watcher.emit(\"process\", files[index]);\n }\n });\n }", "function watch() {\n gulp.watch(watchFiles, ['test']);\n}", "function watchFiles() {\n gulp.watch(paths.scripts.src, scripts);\n gulp.watch(paths.styles.src, styles);\n gulp.watch(paths.html.src, html);\n}", "function watchFiles() {\n gulp.watch(paths.scripts.src, scripts);\n gulp.watch(paths.styles.src, styles);\n}", "watch() {\n fs.readdir(this.watchDir, (err, files) => {\n if (err) throw err;\n for (let index in files) {\n this.emit('process', files[index]);\n }\n });\n }", "function watchFiles() {\n gulp.watch(paths.html.src, gulp.series(html, reload));\n gulp.watch([paths.styles.src, `!${paths.styles.cssDest}/**/*.*`], gulp.series(styles, reload));\n gulp.watch(paths.scripts.src, gulp.series(scripts, reload));\n gulp.watch(paths.images.src, gulp.series(images, reload));\n}", "function watch() {\n gulp.watch(config.styles.srcDir, styles);\n gulp.watch(config.scripts.admin, adminscripts);\n \n // Reload browsersync when PHP files change, if active\n if (config.browserSync.active) {\n gulp.watch('./**/*.php', browserSyncReload);\n }\n}", "function watch() {\r\n\tgulp.watch(CONF.PATHS.assets, copy);\r\n\tgulp.watch(SRC + '/assets/scss/**/*.scss', gulp.series(sass, renamecss, reload, dir))\r\n\t\t.on('change', path => log('File ' + colors.bold(colors.magenta(path)) + ' changed.'))\r\n\t\t.on('unlink', path => log('File ' + colors.bold(colors.magenta(path)) + ' was removed.'));\r\n\tgulp.watch(CONF.PATHS.main + '/**/*.{php,twig}', reload)\r\n\t\t.on('change', path => {\r\n\t\t\tlog('File ' + colors.bold(colors.magenta(path)) + ' changed.');\r\n\t\t\tcopyfile(path);\r\n\t\t})\r\n\t\t.on('unlink', path => {\r\n\t\t\tremovefile(path);\r\n\t\t})\r\n\tgulp.watch(SRC + '/assets/images/**/*', gulp.series(images, reload));\r\n\t//gulp.watch(SRC + '/assets/js/**/*.js').on('all', gulp.series(webpack.watch, reload));\r\n\t//vorher: gulp.series(webpack.watch, reload));\r\n\tgulp.watch(SRC + '/assets/js/**/*.js').on('all', gulp.series(javascript, reload));\r\n}", "_watchForChanges(file) {\n // if the development mode is active we return\n if (!this.api.config.general.developmentMode) {\n return;\n }\n\n // watch for changes on the model file\n this.api.configs.watchFileAndAct(file, () => {\n // log a information message\n this.api.log(\n `\\r\\n\\r\\n*** rebooting due to model change (${file}) ***\\r\\n\\r\\n`,\n \"info\"\n );\n\n // remove require cache\n delete require.cache[require.resolve(file)];\n\n // reload Stellar\n this.api.commands.restart.call(this.api._self);\n });\n }", "function watchFiles() {\n gulp.watch('src/scss/**/*.scss', css);\n gulp.watch('src/pages/**/*.html', html);\n gulp.watch('src/templates/**/*.html', html);\n gulp.watch('app/*.html', browserSyncReload);\n gulp.watch('src/js/**/*.js', js);\n gulp.watch('app/js/**/*.js', browserSyncReload);\n}", "function watch() {\n gulp.watch(paths.lessWatch, css);\n gulp.watch(paths.pug, html);\n gulp.watch(paths.js, js);\n}", "function watch() {\n gulp.watch(paths.stylusWatch, gulp.series('css'));\n gulp.watch(paths.pugWatch, gulp.series('html'));\n}", "function watch() {\n // browsersync.init({\n // server: {\n // baseDir: './'\n // }\n // });\n gulp.watch('./assets/stylesheet/scss/**/*.scss', style);\n gulp.watch('./*.html').on('change', browsersync.reload);\n}", "function watch() {\n gulp.watch('src/**/*', gulp.series(build, reload));\n}", "function watchForChanges() {\n watch(\n [srcFiles.pathPug, srcFiles.pathSCSS, srcFiles.pathJS],\n series(\n parallel(compileToReadableHTML, compileToReadableCSS, compileToReadableJS)\n )\n );\n}", "async onWatchedFileOrFolderChanged(params) {\n // An issue for `@import ...` resources:\n // It's common that we import resources inside `node_modules`,\n // but we can't get notifications when those files changed.\n if (!this.startDataLoaded) {\n return;\n }\n for (let change of params.changes) {\n let uri = change.uri;\n let fsPath = vscode_uri_1.URI.parse(uri).fsPath;\n // New file or folder.\n if (change.type === vscode_languageserver_1.FileChangeType.Created) {\n this.trackFileOrFolder(fsPath);\n }\n // Content changed file or folder.\n else if (change.type === vscode_languageserver_1.FileChangeType.Changed) {\n if (await fs.pathExists(fsPath)) {\n let stat = await fs.stat(fsPath);\n if (stat && stat.isFile()) {\n if (this.shouldTrackFile(fsPath)) {\n this.retrackChangedFile(uri);\n }\n }\n }\n }\n // Deleted file or folder.\n else if (change.type === vscode_languageserver_1.FileChangeType.Deleted) {\n this.untrackDeletedFile(uri);\n }\n }\n }", "function watch() {\n // gulp.watch(paths.html).on('change', reload);\n // gulp.watch(paths.css).on('change', gulp.series(styles, reload));\n // gulp.watch(paths.app).on('change', reload);\n gulp.watch(paths.html, reload);\n gulp.watch(paths.app, reload);\n gulp.watch(paths.css, gulp.series(styles, reload));\n}", "function watchFiles() {\r\n gulp.watch('Stylesheets/**/*.scss', compileSass);\r\n gulp.watch('Scripts/**/*.js', compileJs);\r\n}", "function watch() {\n config.watch.forEach(item => {\n gulp.watch(item.globs, require(item.task));\n });\n}", "watch() {\n }", "function watchFiles(){\n gulp.watch(\"./src/assets/scss/**/*\", scss.build);\n gulp.watch(\"./src/assets/js/**/*\", bundle.bundle);\n gulp.watch([\"./src/**/*\", \"!./src/assets/**/*\"], buildSite.build);\n}", "function watch() {\n browserSync.init({\n // Tell browser to use thos directory and serve it as a mini-server\n server: {\n baseDir: \"./build\"\n }\n });\n\n style();\n\n gulp.watch(paths.styles.src, style);\n\n // Tell gulp which files to watch to trigger the reload\n // This can be html or whatever you're using to develop your website\n gulp.watch(paths.html.src).on('change', browserSync.reload);\n}", "function _watch() {\r\n\r\n browserSync.init({\r\n notify: false,\r\n \r\n server: paths.dist\r\n });\r\n gulp.watch(paths.src_fonts, _fonts); \r\n gulp.watch('.'+paths.src_js+'**/*.js', _js)\r\n gulp.watch(paths.src_html,_html)\r\n gulp.watch(paths.src_images,_images)\r\n gulp.watch(paths.sub_scss, _sass_to_css) \r\n gulp.watch(paths.dist_html).on('change', browserSync.reload);\r\n \r\n}", "function watch() {\n gulp.watch(htmlPath + '/**/*.njk', gulp.series('html'));\n gulp.watch(stylesPath + '/**/*.scss', gulp.series('styles'));\n gulp.watch(scriptsPath + '/**/*.js', gulp.series('scripts'));\n gulp.watch(imagesPath + '/*', gulp.series('images'));\n}", "watch() {\n // Update HTML on each markdown change\n helper.watch('./src/*.md', filepath => {\n this.compile(filepath);\n });\n // Rebuild everything when a layout, include or data changes\n helper.watch(\n [\n './src/_layouts/*.pug',\n './src/_includes/*.pug',\n './src/_mixins/*.pug',\n './src/_data.json',\n ],\n () => {\n this.run();\n }\n );\n }", "function watch() {\n browserSync.init({\n port: 80,\n server: {\n baseDir: \"./\"\n },\n notify: false\n })\n gulp.watch(scssFiles, scss);\n gulp.watch(jsFiles, js);\n gulp.watch(jsFiles).on(\"change\", browserSync.reload);\n gulp.watch(scssFiles).on(\"change\", browserSync.reload);\n gulp.watch(htmlFiles).on(\"change\", browserSync.reload);\n}", "function watch() {\n gulp.watch(PATHS.assets, copy);\n gulp.watch('src/templates/**/*.html').on('change', gulp.series(pages, browser.reload));\n gulp.watch('src/index.html').on('change', gulp.series(index, browser.reload));\n gulp.watch('src/assets/scss/**/*.scss', sass);\n gulp.watch('src/assets/js/**/*.js').on('change', gulp.series(javascript, browser.reload));\n gulp.watch(['src/assets/img/**/*', 'src/assets/data/resolutions.json']).on('change', gulp.series(resp, browser.reload));\n gulp.watch(['src/assets/data/projects3.xls', 'src/assets/data/resolutions.json']).on('change', gulp.series(ex2json, browser.reload));\n // gulp.watch('src/styleguide/**').on('change', gulp.series(styleGuide, browser.reload));\n }", "function watchFiles() {\r\n gulp.watch('src/scss/**/*.scss', css);\r\n gulp.watch('src/js/**/*.js', scripts);\r\n gulp.watch('src/img/**/*.{jpg,png,gif,svg}', images);\r\n gulp.watch('src/img/**/*.pdf', pdfs);\r\n gulp.watch('src/vid/**/*.{mov,webm,mp4}', videos);\r\n gulp.watch(\r\n [\r\n '*.html',\r\n '*.yml',\r\n '_includes/**/*',\r\n '_layouts/**/*',\r\n '_pages/**/*',\r\n '_posts/**/*',\r\n '_data/**.*+(yml|yaml|csv|json)' \r\n ],\r\n gulp.series(jekyll, browserSyncReload)\r\n );\r\n}", "function watch() {\r\n\tgulp.watch( paths.scss.src, styles );\r\n\tgulp.watch( [ paths.js.src, paths.php.src ], browserSyncReload );\r\n}", "function watch() {\r\n\tgulp.watch(sassFiles, sassy)\r\n\tgulp.watch([\r\n\t\t'./*.php',\r\n\t\t'./layouts/**/*.php',\r\n\t\t'./source/scss/**/*.scss',\r\n\t])\r\n}", "function watch() {\n gulp.watch([IOWA.appDir + '/**/*.html'], reload);\n gulp.watch([IOWA.appDir + '/{elements,styles}/**/*.{scss,css}'], ['sass', reload]);\n gulp.watch([IOWA.appDir + '/scripts/**/*.js'], ['jshint']);\n gulp.watch([IOWA.appDir + '/images/**/*'], reload);\n gulp.watch([IOWA.appDir + '/bower.json'], ['bower']);\n gulp.watch(dataWorkerScripts, ['generate-data-worker-dev']);\n}", "function watch() {\r\n\tsassy();\r\n\r\n\tgulp.watch(sassFiles, sassy)\r\n\tgulp.watch([\r\n\t\t'./source/scss/**/*.scss',\r\n\t])\r\n}", "function watch() {\n gulp.watch(PATHS.nodejs, copyBackend);\n gulp.watch(PATHS.views, copyViews);\n gulp.watch('static/fonts/**/*', copyFonts);\n gulp.watch('scss/**/*.scss').on('all', gulp.series(sass));\n gulp.watch('static/js/**/*.js').on('all', gulp.series(javascript));\n gulp.watch('static/img/**/*').on('all', gulp.series(images));\n}", "function watch() {\n gulp.watch('./src/assets/**/*.*', copy);\n gulp.watch('./src/sass/**/*.scss', sass);\n gulp.watch('./src/**/*.html')\n .on('all', gulp.series(resetPages, pages, browser.reload));\n gulp.watch('./src/scripts/**/*.js', gulp.series(javascript, browser.reload));\n}", "function watchTask () {\r\n browserSync.init({\r\n server: {\r\n baseDir: \"pub/\",\r\n index: \"/admin-login.php\"\r\n }\r\n });\r\n \r\n // Look after files´changes \r\n watch([files.htmlPath, files.phpPath, files.jsPath, files.cssPath, files.sassPath, files.imgPath], parallel(htmlFiles, phpFiles, jsFiles, cssFiles, sassFiles, imgFiles, babelTranspile)).on(\"change\", reload); \r\n }", "function watch() {\n gulp.watch(['src/templates/**/*.hbs'], ['pages', reload]);\n gulp.watch(['src/**/*.js'], ['scripts', reload]);\n gulp.watch(['src/**/*.{less,css}'], ['styles', reload]);\n gulp.watch(['src/**/*.{svg,png,jpg,gif}'], ['assets', reload]);\n gulp.watch(['package.json', 'bower.json'], ['assets']);\n}", "function watchFiles(){\n gulp.watch('scss/*.scss', css);\n //funciones para correr en paralelo\n gulp.watch('index.html');\n\n}", "function taskWatcher() {\n\n console.info('\\x1b[37m', '👀 Dev-tools: watching for changes.')\n\n const chokidar = require('chokidar');\n const dirSrc = path.join(__dirname, '../src');\n\n chokidar.watch(dirSrc).on('change', path => {\n\n let extType = path.split('.').pop();\n\n if (extType === 'js') {\n\n compileECMA();\n\n } else if (extType === 'scss') {\n\n compileSCSS();\n\n }\n\n });\n\n}", "function watchArchivos(){\n watch(paths.watch,css);\n watch(paths.js,javascript)\n }", "function watchAll(){\n browserSync();\n convertToCSS();\n watch('src/*.html').on('change', browserAsync.reload);\n watch('src/scss/*.scss', series(convertToCSS)).on('change', browserAsync.reload);\n watch('src/js/*.js').on('change', browserAsync.reload);\n}", "function watch(){\n\n browser_Sync.init({\n server: {\n baseDir: \"app\"\n }\n });\n\n gulp.watch('app/*.html').on('change', browser_Sync.reload);\n gulp.watch('app/assets/css/**/*.css', styles_files);\n gulp.watch('app/assets/js/**/*.js', scripts_files);\n\n\n}", "function watch() {\n gulp.watch( 'src/pages/**/*.html' ).on( 'change', gulp.series( pages, browser.reload ) );\n gulp.watch( ['src/layouts/**/*', 'src/partials/**/*'] ).on( 'change', gulp.series( refresh, pages, browser.reload ) );\n gulp.watch( ['../scss/**/*.scss', 'src/assets/scss/**/*.scss'] ).on( 'change', gulp.series( refresh, json, scss, pages, browser.reload ) );\n gulp.watch( 'src/assets/js/**/*' ).on( 'change', gulp.series( js, browser.reload ) );\n gulp.watch( 'src/assets/img/**/*' ).on( 'change', gulp.series( images, browser.reload ) );\n}", "function watch() {\n // Watch YAML files for changes & recompile\n gulp.watch(['src/yml/*.yml', '!src/yml/theme.yml'], gulp.series(config, jekyll, reload));\n\n // Watch theme file for changes, rebuild styles & recompile\n gulp.watch(['src/yml/theme.yml'], gulp.series(theme, config, jekyll, reload));\n\n // Watch SASS files for changes & rebuild styles\n gulp.watch(['_sass/**/*.scss'], gulp.series(jekyll, reload));\n\n // Watch JS files for changes & recompile\n gulp.watch('src/js/main/**/*.js', mainJs);\n\n // Watch preview JS files for changes, copy files & reload\n gulp.watch('src/js/preview/**/*.js', gulp.series(previewJs, reload));\n\n // Watch images for changes, optimize & recompile\n gulp.watch('src/img/**/*', gulp.series(images, config, jekyll, reload));\n\n // Watch html/md files, rebuild config, run Jekyll & reload BrowserSync\n gulp.watch(['*.html', '_includes/*.html', '_layouts/*.html', '_posts/*', '_authors/*', 'pages/*', 'category/*'], gulp.series(config, jekyll, reload));\n}", "function watch() {\n gulp.watch(PATHS.assets, copy);\n gulp.watch('src/styles/**/*.scss').on('all', sass);\n gulp.watch('src/scripts/**/*.js').on('all', gulp.series(javascript));\n gulp.watch('src/images/**/*').on('all', gulp.series(images));\n}", "startMonitor () {\n this.watchers.length = 0\n this.dirs.forEach((dir) => {\n let watcher\n try {\n watcher = fs.watch(path.resolve(dir.metadata.localPath), { recursive: true }, () => {\n this.dirty = true\n setTimeout(() => this.run(), 0) // start backup 3s later\n })\n } catch (e) {\n console.warn('watch file error', e)\n return\n }\n this.watchers.push(watcher)\n })\n }", "function watch() {\n\n\t\t// SCRIPTS\n\t\tgulp.watch('./src/*.js').on('all', gulp.series(latest, browserSync.reload));\n\t\t// gulp.watch(['./src/shopback-plugin.js']).on('change', browserSync.reload);\n\n\t}", "function watch() {\n WATCHER = true;\n for (var subfolder in PATHS.assets) {\n gulp.watch(PATHS.assets[subfolder], assets);\n }\n gulp.watch(PATHS.less.watches, css);\n gulp.watch(PATHS.sass.watches, css);\n gulp.watch(PATHS.javascript.project, javascript);\n gulp.watch(PATHS.images, images);\n gulp.watch('src/components/styleguide/**', styleGuide);\n}", "watch (path, delay) {\n console.log('Start watching');\n this.watcher = chokidar.watch(path + '/*.csv', {\n followSymlinks: false,\n usePolling: true,\n interval: delay,\n binaryInterval: delay\n });\n this.watcher.on('change', file => this.emit('dirwatcher:changed', fs.realpathSync(file)));\n }", "function watchTask() {\n // wich files to watch, since there are more then one we make an array\n //then we tell it what to do with them.\n\n // added a init for browser syncs live server\n browserSync.init({\n server: \"./pub\"\n });\n watch([files.htmlPath, files.cssPath, files.jsPath, files.imgPath, files.sassPath], parallel(copyHTML, cssTask, jsTask, imageTask, sassTask)).on('change', browserSync.reload);\n}", "watch (usePolling = false) {\n if (this.isBeingWatched) return\n const { from } = this.data\n const options = { usePolling, ignored: /(^|[\\/\\\\])\\../ }\n const switchCallback = (eventName, fromRelative) =>\n this.switchCallback(eventName, fromRelative, true)\n this.watcher = chokidar.watch(from, options).on('all', switchCallback)\n this.isBeingWatched = true\n }", "function watch()\n{\n\tgulp.watch('/index.html', copyHtml);\n\tgulp.watch('img/*', copyImgs);\n\tgulp.watch('css/*.css', styles);\n\tgulp.watch('/js/*.js', scripts);\n}", "function watch() {\n\n //set base directory for browsersync\n browserSync.init({\n server: {\n baseDir: \"src\",\n index: \"/index.html\"\n }\n }\n\n );\n\n //define our watch tasks\n gulp.watch(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'], style);\n gulp.watch('src/*.html').on('change', browserSync.reload);\n gulp.watch('src/js/*.js').on('change', browserSync.reload);\n\n\n}", "function watch_files(done) {\n gulp.watch('project/css/**/*.css', reload);\n gulp.watch('project/*.html', reload);\n gulp.watch('project/js/**/*.js', reload);\n done();\n}", "function watch() {\n gulp.watch(paths.stylusWatch, task('css'));\n}", "watchSourceFiles () {\n // watch add/remove of files\n this.pagesWatcher = chokidar.watch([\n '**/*.md',\n '.vuepress/components/**/*.vue'\n ], {\n cwd: this.context.sourceDir,\n ignored: ['.vuepress/**/*.md', 'node_modules'],\n ignoreInitial: true\n })\n this.pagesWatcher.on('add', target => this.handleUpdate('add', target))\n this.pagesWatcher.on('unlink', target => this.handleUpdate('unlink', target))\n }", "function watch() {\n gulp.watch(\n [\n pathConfig.move[0].src,\n pathConfig.move[0].exclude[0],\n pathConfig.move[0].exclude[1],\n pathConfig.move[0].exclude[2]\n ],\n move\n );\n gulp.watch(\n [\n pathConfig.img[0].src,\n pathConfig.img[0].exclude[0]\n ],\n img\n );\n gulp.watch(\n \"./src/img/vector/\",\n svgSprite\n );\n gulp.watch(\n [\n pathConfig.js[0].src,\n pathConfig.js[1].src\n ],\n js\n );\n gulp.watch(\n [\n pathConfig.css[0].src,\n pathConfig.css[1].src\n ],\n css\n );\n}", "function watchFiles(cb) {\r\n var js = source.js || [];\r\n\r\n // only watch the properties file too if one is in play\r\n if (source.properties) {\r\n js.push(source.properties);\r\n }\r\n\r\n watch(js, series(lintJS, compileJS));\r\n watch([source.sass.files], compileCSS);\r\n watch([source.html], compileHTML);\r\n watch([source.etc.files], moveAssets);\r\n watch(fonts, moveFonts);\r\n cb();\r\n}", "function watch() {\n\tserverInit();\n\tgulp.watch(\"./app/scss/*.scss\", cssHandler);\n\tgulp.watch(\"./app/pug/*.pug\", htmlHandler);\n\tgulp.watch(\"./app/js/*.js\", jsHandler);\n}", "function watchFiles() {\n gulp.watch('assets/css/common.scss', critical);\n gulp.watch('assets/css/critical.scss', critical);\n gulp.watch('assets/css/extends.scss', critical);\n gulp.watch('assets/css/fonts.scss', critical);\n gulp.watch('assets/css/mixins.scss', critical);\n gulp.watch('assets/css/reset.scss', critical);\n gulp.watch('assets/css/variables.scss', critical);\n gulp.watch('assets/css/wufoo.scss', wufoo);\n gulp.watch('assets/js/download.js', webpack);\n gulp.watch('assets/js/header.js', webpack);\n gulp.watch('assets/js/lazy.js', webpack);\n gulp.watch('assets/js/webp.js', webpack);\n gulp.watch('assets/js/wufoo.js', webpack);\n}", "_watch(target, recurse) {\n let start,\n jsFileRE = /[\\w_$-]+\\.(js|jsx|ts)/,\n watchCB\n\n// Configure http and socket communications....\n this._configureHTTP()\n\n// Start the server...\n this._igniteServer(\n process.env.PORT || this.options.watchOpts.port || app.get('port')\n )\n\n watchCB =(fn, pass=false)=> {\n/// If the changed file is valid....\n if (pass || this._validFileName(fn)) {\n// Get start time.....\n start = Date.now()\n\n// Roll up a new bundle....\n this._bundleFiles(this.entryFile, ()=> {\n// Send message via websocket to browser...\n io.emit('file-change', { file: fn })\n })\n// Stop the timer and subtract start time to get elapsed bundle time....\n this.ms = Date.now() - start\n// Stop the spinner with success....\n this.spinner.succeed('🗞')\n }\n }\n\n if (jsFileRE.test(target)) {\n // log('TARGET', 'magenta');log(target)\n// watch the target directory for file changes....\n fs.watchFile(target, (curr, prev)=> {\n// Execute cb.......\n watchCB(target, true)\n })\n } else {\n/// watch the root directory for file changes....\n fs.watch(target, {recursive: recurse}, (event, fileName)=> {\n // log('FILENAME', ['red', 'bold']);log(fileName);log(fileName.includes(this.outputFile));\n// Execute cb.......\n watchCB(fileName)\n })\n }\n }", "function watch() {\n gulp.watch(PATHS.assets, copy);\n gulp.watch(PATHS.srcPages).on('all', gulp.series(pages, browser.reload));\n gulp.watch(PATHS.srcPagesData).on('all', gulp.series(resetPages, pages, browser.reload));\n gulp.watch(PATHS.srcFilesScss).on('all', gulp.series(sass, browser.reload));\n gulp.watch(PATHS.jsES5).on('all', gulp.series(jsES5, javascript, browser.reload));\n gulp.watch(PATHS.jsES6).on('all', gulp.series(jsES6, javascript, browser.reload));\n gulp.watch(PATHS.srcFilesImages).on('all', gulp.series(images, browser.reload));\n gulp.watch(PATHS.srcFilesSVG).on('all', gulp.series(svgSprite, injectSvgSprite, browser.reload));\n gulp.watch(PATHS.srcStyleguideFiles).on('all', gulp.series(styleGuide, browser.reload));\n}", "function watch() {\n gulp.watch(['scss/**/*.{scss,css}'],\n ['styles', 'styles-grid', 'styletemplates', reload]);\n}", "function macWatch() {\n var terminal = require('child_process').spawn('fswatch', [dirMonitored2]);\n\n terminal.stdout.on('data', function (data) {\n data = data.toString().split(\"\\n\");\n console.log('stdout: ' + data);\n sh.each ( data, function (i, file) {\n if ( sh.isFileType(file, 'js') ) {\n helper.trigger(file)\n }\n if ( sh.isFileType(file, 'html') ) {\n helper.trigger(file)\n }\n //var split = file.split(\"\");\n })\n\n });\n\n terminal.on('exit', function (code) {\n console.log('child process exited with code ' + code);\n });\n\n }", "function watch() {\n browserSync.init({\n server: {\n baseDir: \"./src/\",\n index: \"prototype.html\"\n }\n });\n // CSS\n gulp.watch('./src/Styles/**/*.scss', styles);\n // HTML\n gulp.watch('./src/Components/**/*.html', include);\n //gulp.watch('./src/**/*.html').on('change', browserSync.reload);\n // JS\n gulp.watch('./src/Scripts/src/**/*.js', scripts);\n // IMAGES\n //gulp.watch('./src/Images/src/**/*.*', images); // *Optional\n // SVG\n // gulp.watch('./src/Images/src/**/*.svg', svgo); // *Optional\n}", "function watch() {\r\n gulp.watch('scss/**/*', gulp.series(compileSass));\r\n gulp.watch('html/pages/**/*', gulp.series(compileHtml));\r\n gulp.watch('html/{layouts,includes,helpers,data}/**/*', gulp.series(compileHtmlReset, compileHtml));\r\n}", "function watchTask() {\n browserSync.init({\n server: {\n baseDir: './pub/'\n }\n })\n watch(files.htmlPath, copyHTML).on('change', browserSync.reload);\n watch(files.imgPath, imageMin).on('change', browserSync.reload);\n watch(files.jsPath, jsTask).on('change', browserSync.reload);\n // watch(files.cssPath, cssTask).on('change', browserSync.reload);\n watch(files.sassPath, styleTask).on('change', browserSync.reload);\n}", "function detectChanges(){\r\n\tgulp.watch(source.js.app, ['concat_app_js']).on('change', onChange);\r\n\tgulp.watch(source.js.vendor, ['concat_vendor_js']).on('change', onChange);\r\n\tgulp.watch(source.css, ['concat_css']).on('change', onChange);\r\n\tgulp.watch(source.forDist, ['copy_to_dist']).on('change', onChange);\r\n\r\n\t//log file that changed\r\n\tfunction onChange(change) {\r\n\t\t//split up the path to get the file name\r\n\t\tvar splitUpPath = change.path.split('/');\r\n\r\n\t\t//log the file detected\r\n\t\tconsole.log('\"' + splitUpPath[splitUpPath.length - 1] + '\" was ' + change.type);\r\n\t}\r\n}", "function watch() {\n gulp.watch(PATHS.miscAssets, gulp.series(copy, reload));\n gulp.watch(`${PATHS.pageTemplates}/**/*.{html,hbs}`).on('all', gulp.series(pages, reload));\n gulp.watch([\n `src/{layouts,components}/**/*.{html,hbs}`,\n `src/helpers/**`\n ]).on('all', gulp.series(resetPages, pages, reload));\n gulp.watch(`${PATHS.data}/**/*.{json,yml}`).on('all', gulp.series(resetPages, pages, reload));\n gulp.watch(`src/**/*.scss`).on('all', gulp.series(sass, reload));\n gulp.watch(`src/**/*.js`).on('all', gulp.series(scripts, reload));\n gulp.watch(PATHS.imageAssets).on('all', gulp.series(images, reload));\n gulp.watch(`${PATHS.styleGuide}/**`).on('all', gulp.series(styleGuide, reload));\n}", "function watch() {\nbrowserSync.init({\n // You can tell browserSync to use this directory and serve it as a mini-server\n server: {\n baseDir: \".\"\n }\n // If you are already serving your website locally using something like apache\n // You can use the proxy setting to proxy that instead\n // proxy: \"yourlocal.dev\"\n});\ngulp.watch(paths.styles.src, style);\n\n// We should tell gulp which files to watch to trigger the reload\n// This can be html or whatever you're using to develop your website\n// Note -- you can obviously add the path to the Paths object\ngulp.watch(paths.templates.src, generalTemplates).on('change', browserSync.reload);\n\n}", "function watchCodeDev() {\n gulp.watch(['./source/templates/*.handlebars'], handlebars);\n gulp.watch(jsfiles, moveJS);\n gulp.watch(['./source/*.html'], moveHTML);\n gulp.watch(['./source/*.css'], moveCSS);\n}", "function watchTask() {\r\n watch(\r\n [files.scssPath, files.htmlPath],\r\n series(scssTask, reloadTask)\r\n )\r\n}", "function watch(){\n\tbrowserSync.init({\n server: {\n baseDir: \"./dist\"\n },\n\t\ttunnel:true\n });\n gulp.watch('./src/scss/**/*.scss', sass);\n gulp.watch('./src/css/**/*.css', styles);\n gulp.watch('./src/js/**/*.js', script);\n gulp.watch('./src/*.html', html);\n}", "function watch() {\r\n gulp.watch([files.pugPath, files.sassPath, files.jsPath, files.imgPath, files.downloadsPath],\r\n gulp.series(pugTask, sassTask, js, images, downloads))\r\n\r\n // gulp.parallel(pugTask, sassTask, js, images, downloads)\r\n\r\n // initiate BrowserSync\r\n browsersync.init({\r\n server: {\r\n // serve files from the /build folder\r\n baseDir: \"./build\"\r\n }\r\n });\r\n\r\n // watch for SASS changes\r\n gulp.watch(files.sassPath, sassTask);\r\n // watch for changes in the HTML\r\n gulp.watch(files.pugPath).on('change', browsersync.reload);\r\n // watch for image changes\r\n gulp.watch(files.imgPath).on('change', browsersync.reload);\r\n}", "function devWatchFiles() {\n gulp.watch('./src/templates/**/*', gulp.series(templates.dev));\n gulp.watch('./src/assets/scss/**/*', gulp.series(css.build, copy.dev));\n gulp.watch('./src/assets/js/**/*', gulp.series(js.build, copy.dev));\n gulp.watch('./src/assets/img/**/*', gulp.series(copy.assets, copy.dev));\n gulp.watch('./src/assets/fonts/**/*', gulp.series(copy.assets, copy.dev));\n}", "function watch() {\n // style files\n gulp.watch([path.src + '/**/*.scss', path.src + '/**/*.css'])\n .on('change', function (file) {\n var site = getSiteNameFromPath(file.path);\n log('[' + site + '] ' + file.type + ': ' + file.path);\n\n // site => default ? compile all sites\n if (site === 'default') {\n sites.map(function (current) {\n stylesDev(current);\n })\n } else {\n stylesDev(site);\n }\n });\n\n // script files\n gulp.watch(path.src + '/**/*.js')\n .on('change', function (file) {\n var site = getSiteNameFromPath(file.path);\n log('[' + site + '] ' + file.type + ': ' + file.path);\n\n // site => default ? compile all sites\n if (site === 'default') {\n sites.map(function (current) {\n scriptsDev(current);\n })\n } else {\n scriptsDev(site);\n }\n });\n}", "function watchTask() {\n watch(\"./src/html/**/*.+(html|njk)\", series(htmlComp, browsersyncReload));\n watch([\"./src/css/**/*.css\"], series(cssComp, browsersyncReload));\n watch([\"./src/js/**/*.js\"], series(jsComp, browsersyncReload));\n watch([\"./src/images/**/*.+(png|jpg|gif|svg)\"], series(imageminComp, browsersyncReload));\n}", "function watch() {\n runServer();\n gulp.watch('scss/**/*.scss', {usePolling: true}, compileSass); // usePolling to prevent compile time increase\n}", "function listenVolume() {\n watch(\"./data\", {recursive: true}, function (evt, name) {\n console.warn({evt, name}, \"watchFile\");\n if (evt == \"remove\") {\n queueListRemove(name);\n } else {\n queueListAdd(name);\n }\n })\n}", "function watchSourceFiles() {\n let CSS_WATCHER = CFG.CSS.SASS ? CFG.SRC.APP_SCSS : CFG.SRC.APP_CSS;\n gulp.watch([CFG.SRC.APP_JS, CSS_WATCHER], exports[CFG.TASKS.BUILD_APP]);\n gulp.watch([CFG.SRC.VENDOR_JS, CFG.SRC.VENDOR_CSS], exports[CFG.TASKS.BUILD_VENDOR]);\n}", "function start() {\n watch.start();\n }", "function watch() {\n\tif(!production) {\n\t\tgulp.watch(paths.source, gulp.series( scaffold, reload ));\n\t\tgulp.watch(paths.src.styles + '**/*', styles);\n\t\tgulp.watch(paths.src.scripts + '**/*', scripts);\n\t\tgulp.watch(paths.src.images + '**/*', images);\n\t\tgulp.watch(paths.src.svgs + '**/*', gulp.series( svgSprite, scaffold ));\n\t}\n}", "function watchMe(done) {\n watch('dev/**/*.{html,scss}', exports.compileCode);\n watch('dev/**/*.{png,jpg,jpeg,gif}', exports.img);\n watch('dev/**/*').on('all', fileSync);\n $.browserSync.reload({ stream: true });\n done();\n}", "function watcher() {\n src('src/js/livereload.js')\n .pipe(dest('dist/'));\n\n watch(['./src/**/*.html'], { ignoreInitial: false }, html);\n watch(['./src/**/.js'], { ignoreInitial: false }, series(min, cons));\n watch(['./src/**/.styl'], { ignoreInitial: false }, css);\n watch(['./src/images/**'], { ignoreInitial: false }, images);\n}", "function watch() {\n gulp.watch('email/src/pages/**/*.html')\n .on('change', gulp.series(pages, inline, browser.reload));\n\n gulp.watch(['email/src/layouts/**/*', 'email/src/partials/**/*'])\n .on('change', gulp.series(resetPages, pages, inline, browser.reload));\n\n gulp.watch(['../scss/**/*.scss', 'email/src/assets/scss/**/*.scss'])\n .on('change', gulp.series(resetPages, sass, pages, inline, browser.reload));\n\n gulp.watch('email/src/assets/img/**/*')\n .on('change', gulp.series(images, browser.reload));\n}", "function FileWatcher(filepath, delay, onchange) {\n this.filepath = filepath;\n this.onchange = onchange;\n this.delay = delay;\n}", "function watch() {\n\n gulp.watch('src/pages/**/*.html').on('all', gulp.series(pages, browser.reload));\n gulp.watch('src/{layouts,partials}/**/*.html').on('all', gulp.series(resetPages, pages, browser.reload));\n gulp.watch('src/{data}/**/*.json').on('all', gulp.series(resetPages, pages, browser.reload));\n gulp.watch('src/assets/scss/**/*.scss').on('all', sassToCss);\n gulp.watch('src/assets/media/**/*').on('all', gulp.series(images, browser.reload));\n gulp.watch(['src/**/*.js']).on('all', gulp.series(['webpack'], browser.reload));\n\n\n}", "_watch() {\n\t\tconst watchHandler = this._createBootstrapper.bind(this);\n\t\tthis._componentFinder.watch();\n\t\tthis._componentFinder\n\t\t\t.on('add', watchHandler)\n\t\t\t.on('unlink', watchHandler)\n\t\t\t.on('changeTemplates', watchHandler);\n\n\t\tthis._storeFinder.watch();\n\t\tthis._storeFinder\n\t\t\t.on('add', watchHandler)\n\t\t\t.on('unlink', watchHandler);\n\t}", "function watch() {\n // watch for color changes and generate palette\n gulp.watch('./src/css/common/__variables.css', gulp.series('color'));\n\n // compile and minify css\n gulp.watch(\n './src/css/**/*.css',\n {\n ignored: ['./src/css/common/__variables.css', './src/css/astro.core.css', './src/css/astro.css'],\n },\n gulp.series(css)\n );\n}", "function watch() {\n gulp.watch('src/templates/**/*.tpl.html').on('all', gulp.series(pages, browser.reload));\n gulp.watch(['src/layouts/**/*', 'src/partials/**/*']).on('all', gulp.series(resetPages, pages, browser.reload));\n gulp.watch(['../scss/**/*.scss', 'src/assets/scss/**/*.scss']).on('all', gulp.series(resetPages, sass, pages, browser.reload));\n gulp.watch('src/assets/img/**/*').on('all', gulp.series(images, browser.reload));\n}", "function watchFiles(srcDirectory, distDirectory) {\n var transpiler = javascripts.getTranspiler(srcDirectory, distDirectory, isAllowed, babelOptions, browserifyOptions);\n \n function processFile(filename, stats) {\n if (!isAllowed(filename)) return;\n \n var isClientFile = clientFile.test(filename);\n var callback;\n \n if (isClientFile) {\n callback = function() {};\n } else {\n server.stop();\n callback = server.start;\n }\n transpiler.transpile(filename, [], callback);\n }\n \n watch.createMonitor(srcDirectory, Object.assign({}, watchOptions), function(monitor) {\n monitor.on('created', processFile);\n monitor.on('changed', processFile);\n monitor.on('removed', (filename, stats) => {\n if (clientFile.test(filename)) {\n transpiler.delete(filename);\n transpiler.bundle(clientEntryPoint, bundlePath);\n } else {\n server.stop();\n transpiler.delete(filename, server.start);\n }\n });\n });\n // start server\n}", "function watch(cb) {\n gulp.watch([\n 'src/lib/**',\n 'src/main.electron.js',\n 'src/core/**/*.js'\n ], gulp.series(electronRestart));\n\n gulp.watch('src/app/index.html', gulp.series('inject', electronReload));\n gulp.watch('src/app/**/*.html', electronReload);\n gulp.watch('src/bower.json', gulp.series('inject', electronReload));\n gulp.watch('src/assets/**/*.css', gulp.series('inject', electronReload));\n gulp.watch('src/app/**/*.js', gulp.series('inject', electronReload));\n\n cb();\n}", "function watch() {\n gulp.watch(['packages/**/*', 'app/**/*'], gulp.series(['build', 'docs:build']))\n}", "function taskWatch() {\n logStartTask('watch');\n\n gulp.watch(`${ASSETS_SRC}/**/*`, gulp.series(taskAssetsClean, taskMarkupReset, taskAssetsCopy));\n gulp.watch(`${MARKUP_SRC}/**/*.html`, gulp.series(taskMarkupClean, taskMarkup));\n gulp.watch(`${STYLES_SRC}/**/*.css`, gulp.series(taskStylesClean, taskStyles));\n gulp.watch(`${SCRIPTS_SRC}/**/*.js`, gulp.series(taskScriptsClean, taskScripts, taskScriptsLint, taskScriptsVendor, taskScriptsModelsClean, taskScriptsModelsCopy, taskScriptsModelsLint));\n}", "function watchTask(){\r\n browserSync.init({\r\n server: {\r\n baseDir: \"./\"\r\n }\r\n });\r\n\r\n watch(\"./*.html\").on('change', browserSync.reload);\r\n watch(paths.scss, parallel(styles_Src, styles_Dist));\r\n watch('src/bootstrap/scss/**.*scss', styles_bootstrap);\r\n watch('src/plugins/**/*.css', vendor_styles);\r\n watch(paths.js, js);\r\n watch('src/plugins/**/*.js', vendor_js);\r\n watch('src/images/**/*.*', image_compress);\r\n\r\n}", "function startWatchFile(path) {\n\treturn fileWatcher.startWatchFile({ path: path, timeToWait: INTERVAL_TIME });\n}" ]
[ "0.76892084", "0.757606", "0.7536621", "0.74167883", "0.7399811", "0.7374542", "0.73138773", "0.7280547", "0.7263825", "0.72154427", "0.72130036", "0.71007067", "0.70893395", "0.7082815", "0.70728016", "0.7004622", "0.697816", "0.695292", "0.6947258", "0.6920368", "0.69101876", "0.6898245", "0.68975633", "0.6877656", "0.68279153", "0.6792499", "0.6779724", "0.676669", "0.67547023", "0.6724976", "0.6723145", "0.6719474", "0.6717475", "0.67156327", "0.67103404", "0.6689265", "0.66860145", "0.666543", "0.66634715", "0.6658105", "0.66514975", "0.66498446", "0.6648683", "0.66485417", "0.66269153", "0.66085833", "0.660629", "0.6606118", "0.65958166", "0.65932363", "0.6588481", "0.6572018", "0.6554169", "0.6541434", "0.6540603", "0.6528582", "0.6525174", "0.6518064", "0.6503293", "0.6501922", "0.6494243", "0.64710635", "0.6469179", "0.6467719", "0.6460313", "0.64467454", "0.6435025", "0.6427646", "0.6417283", "0.64150184", "0.6403841", "0.6402549", "0.6400817", "0.6378604", "0.6376918", "0.6367", "0.6362113", "0.63420576", "0.63408244", "0.63369316", "0.6318697", "0.62963563", "0.6288296", "0.62750125", "0.6262022", "0.6254311", "0.6240715", "0.6239465", "0.6232731", "0.6229498", "0.62286234", "0.6225153", "0.6218998", "0.62159395", "0.62044495", "0.6201619", "0.619274", "0.6189196", "0.61848897", "0.6183771" ]
0.62778634
83
Sets the list of current transformations to the bundler.
_setTransformations() { // traverse items in the reversed order var currentIndex = this._browserifyTransformations.length - 1; while (currentIndex >= 0) { const currentTransformation = this._browserifyTransformations[currentIndex]; currentIndex--; if (!currentTransformation || typeof (currentTransformation) !== 'object' || typeof (currentTransformation.transform) !== 'function') { this._eventBus.emit('warn', 'The browserify transformation has an incorrect interface, skipping...'); continue; } this._appBundler.transform( currentTransformation.transform, currentTransformation.options ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setTransformations() {\n\t\t// traverse items in the reversed order\n\t\tvar currentIndex = this._browserifyTransformations.length - 1;\n\n\t\twhile (currentIndex >= 0) {\n\t\t\tconst currentTransformation = this._browserifyTransformations[currentIndex];\n\t\t\tcurrentIndex--;\n\t\t\tif (!currentTransformation ||\n\t\t\t\ttypeof (currentTransformation) !== 'object' ||\n\t\t\t\ttypeof (currentTransformation.transform) !== 'function') {\n\t\t\t\tthis._eventBus.emit('warn', 'The browserify transformation has an incorrect interface, skipping...');\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis._bundler.transform(\n\t\t\t\tcurrentTransformation.transform, currentTransformation.options\n\t\t\t);\n\t\t}\n\t}", "initTransformations() {\n this.transformations = [];\n\n for (var key in this.graph.transformations) {\n if (this.graph.transformations.hasOwnProperty(key)) {\n var transformation = this.graph.transformations[key];\n\n //calculate the trnasformation matrix\n let matrix = mat4.create();\n for (let transf of transformation.transformations) {\n switch (transf.type) {\n case \"translate\":\n mat4.translate(matrix, matrix, vec3.fromValues(transf.x, transf.y, transf.z));\n break;\n case \"rotate\":\n switch (transf.axis) {\n case \"x\":\n mat4.rotateX(matrix, matrix, DEGREE_TO_RAD * transf.angle);\n break;\n case \"y\":\n mat4.rotateY(matrix, matrix, DEGREE_TO_RAD * transf.angle);\n break;\n case \"z\":\n mat4.rotateZ(matrix, matrix, DEGREE_TO_RAD * transf.angle);\n break;\n }\n break;\n case \"scale\":\n mat4.scale(matrix, matrix, vec3.fromValues(transf.x, transf.y, transf.z));\n break;\n default:\n break;\n }\n }\n\n this.transformations[key] = matrix;\n }\n }\n }", "set transform(value) {}", "set transform(value) {}", "set transform(value) {}", "set transform(value) {}", "_setTransform(transform){\n this._element.setAttribute('transform',transform);\n }", "setTransform(valueNew){let t=e.ValueConverter.toObject(valueNew);if(null===t&&(t=this.getAttributeDefaultValueInternal(\"Transform\")),t&&!Array.isArray(t))return void(TCHMI_CONSOLE_LOG_LEVEL>=1&&e.Log.error(\"[Source=Control, Module=TcHmi.Controls.System.TcHmiControl, Id=\"+this.getId()+\", Attribute=Transform] Non array values are not supported.\"));let r=this.__objectResolvers.get(\"transform\");r&&(r.watchDestroyer&&r.watchDestroyer(),r.resolver.destroy());let s=new e.Symbol.ObjectResolver(t);this.__objectResolvers.set(\"transform\",{resolver:s,watchCallback:this.__onResolverForTransformWatchCallback,watchDestroyer:s.watch(this.__onResolverForTransformWatchCallback)})}", "function setRotation()\n {\n vm.moverStyle['-ms-transform'] = vm.moverStyle['-webkit-transform'] = vm.moverStyle.transform = vm.themeStyle.transform;\n }", "refreshTransforms() {\n const matrix = this.getTransformMatrix();\n this._translateTransform.update(matrix);\n this._rotateTransform.update(matrix);\n this._scaleTransform.update(matrix);\n }", "function setTransform(target, transform) {\n\n\t\t\ttarget.css({'-webkit-transform': transform, \n\t\t\t'-moz-transform': transform,\n\t\t\t'-ms-transform':transform,\n\t\t\t'-o-transform': transform,\n\t\t\t'transform': transform});\n\t\t}", "constructor() {\n super();\n\n this.transforms = [];\n }", "function setLightSensitives(){\n\ttransformables = new Array(\"ul\", \"li\", \"a.selected\", \"div.tabContent\", \"#pageContainer\", \"#mainHeader\");\n}", "apply() {\n this.scene.multMatrix(this.animTransform);\n }", "setTransform() {\n var plus = (1 + Math.cos(this.turnover * Math.PI / 2)) / 2;\n var minus = (-1 + Math.cos(this.turnover * Math.PI / 2)) / 2;\n var cos = Math.cos(this.deg / 180 * Math.PI);\n var sin = Math.sin(this.deg / 180 * Math.PI);\n var a = plus * cos - minus * sin;\n var b = plus * sin + minus * cos;\n var c = minus * cos - plus * sin;\n var d = minus * sin + plus * cos;\n var s = 'matrix(' + a + ', ' + b + ', ' + c + ', ' + d + ', 0, 0)';\n this.canvas.style.transform = s;\n this.back.style.transform = s;\n }", "apply() {\n this.scene.multMatrix(this.transfMatrix);\n }", "init() {\n if (this.initialized) {\n return;\n }\n /* precompile transform patterns */\n this.transformers = this.precompileTransformers(this.config.transform || {});\n this.initialized = true;\n }", "setTransformationMatrixValue() {\n this._hasTransformationMatrix = true;\n }", "recalculateTransformation() {\n Node.prototype.recalculateTransformation.call(this);\n\n if (this.rendered) {\n this.skeleton.update();\n this.bucket.updateBoneTexture[0] = 1;\n } else {\n this.addAction(() => this.recalculateTransformation(), []);\n }\n }", "function setTransform(elem, transforms) {\n // transforms can be a transform object, a string or an array of transform objects\n elem.removeAttribute('transform');\n if (isString(transforms)) {\n elem.setAttribute('transform', transforms);\n return getTransform(elem);\n }\n if (!isArray(transforms)) {\n transforms = [transforms];\n }\n elem.setAttribute('transform',\n transforms.map(function(t) {\n return t.type + '(' + t.values.join() + ')';\n }).join(' ')\n );\n return transforms;\n}", "applyCurrentTransform () {\n this.tempPosition.set(this.position);\n this.tempOrientation = this.orientation;\n this.tempScale.set(this.scale);\n }", "function setTran(Tx) {\r\n context.setTransform(Tx[0],Tx[1],Tx[3],Tx[4],Tx[6],Tx[7]);\r\n }", "updateTransform(newTransform) {\n transform = newTransform;\n isCanvasDirty = true;\n }", "async transform() {\n if (this.options.minify) {\n await uglify(this);\n }\n }", "set transformPaths(value) {}", "function setOrigin()\n {\n vm.moverStyle['-webkit-transform'] =\n vm.moverStyle['-ms-transform'] =\n vm.moverStyle.transform =\n vm.themeStyle.transform;\n //vm.element.tag == 'text' ? vm.element.style.transform : vm.themeStyle.transform;\n }", "merge() {\n this.assets.push(this.files.merge(this.data.output, this.data.babel));\n }", "function setTransform(element, value) {\n element.style[\"WebkitTransform\"] = value;\n element.style[\"webkitTransform\"] = value; // I'm not even sure if it's `Webkit` or `webkit`\n element.style[\"MozTransform\"] = value;\n element.style[\"MSTransform\"] = value;\n element.style[\"OTransform\"] = value;\n element.style.transform = value;\n }", "_initTransformValues() {\n this.rotation = new Vec3();\n this.rotation.onChange(() => this._applyRotation());\n\n // initial quaternion\n this.quaternion = new Quat();\n\n // translation in viewport coordinates\n this.relativeTranslation = new Vec3();\n this.relativeTranslation.onChange(() => this._setTranslation());\n\n // translation in webgl coordinates\n this._translation = new Vec3();\n\n // scale is a Vec3 with z always equal to 1\n this.scale = new Vec3(1);\n this.scale.onChange(() => {\n this.scale.z = 1;\n this._applyScale();\n });\n\n // set plane transform origin to center\n this.transformOrigin = new Vec3(0.5, 0.5, 0);\n this.transformOrigin.onChange(() => {\n // set transformation origin relative to world space as well\n this._setWorldTransformOrigin();\n this._updateMVMatrix = true;\n });\n }", "function clear() {\n transforms = {};\n}", "function clear() {\n transforms = {};\n}", "function clear() {\n transforms = {};\n}", "_clearTransformRunnersBefore(currentRunner) {\n this._transformationRunners.clearBefore(currentRunner.id);\n }", "transformBeziers(beziers) {\n if (this._worldToLocalAffine) {\n for (const bezier of beziers)\n bezier.tryTransformInPlace(this._worldToLocalAffine);\n }\n else if (this._worldToLocalPerspective) {\n for (const bezier of beziers)\n bezier.tryMultiplyMatrix4dInPlace(this._worldToLocalPerspective);\n }\n }", "transform()\n {\n super.transform();\n \n spriteStrategyManager.transform();\n }", "set(otherTransform){\n this.position = otherTransform.position.copy();\n this.scale = otherTransform.scale.copy();\n this.rotation = otherTransform.rotation;\n }", "function clear() {\n transforms = {};\n}", "setTransformObject(item, x, y) {\n const transformBase = item.transform.baseVal;\n const transform = transformBase.getItem(0);\n\n transform.setTranslate(x, y);\n }", "updateTransform() {\n this.transform = Object(transformation_matrix__WEBPACK_IMPORTED_MODULE_9__[\"toSVG\"])(Object(transformation_matrix__WEBPACK_IMPORTED_MODULE_9__[\"smoothMatrix\"])(this.transformationMatrix, 100));\n }", "static transform() {}", "_setValidators(validators) {\n this._rawValidators = validators || [];\n this._composedValidatorFn = composeValidators(this._rawValidators);\n }", "_setValidators(validators) {\n this._rawValidators = validators || [];\n this._composedValidatorFn = composeValidators(this._rawValidators);\n }", "_setValidators(validators) {\n this._rawValidators = validators || [];\n this._composedValidatorFn = composeValidators(this._rawValidators);\n }", "_setValidators(validators) {\n this._rawValidators = validators || [];\n this._composedValidatorFn = composeValidators(this._rawValidators);\n }", "_setValidators(validators) {\n this._rawValidators = validators || [];\n this._composedValidatorFn = composeValidators(this._rawValidators);\n }", "_setValidators(validators) {\n this._rawValidators = validators || [];\n this._composedValidatorFn = composeValidators(this._rawValidators);\n }", "function Transform() {\n\t\t\t\t this.reset();\n\t\t\t\t}", "map(transform) {\n assertUninitialized(this);\n const oldTransform = this[kTransform]; // TODO(NODE-3283): Improve transform typing\n if (oldTransform) {\n this[kTransform] = doc => {\n return transform(oldTransform(doc));\n };\n }\n else {\n this[kTransform] = transform;\n }\n return this;\n }", "setInitialHistory(serverVersions) {\n this.transformManager.setInitialHistory(serverVersions);\n }", "_updateTransform() {\n this._applyTransform(this._transform)\n this.redraw()\n if (this.callbacks.didUpdateTransform) {\n this.callbacks.didUpdateTransform(this._transform)\n }\n }", "updateLocalTransform()\n {\n // empty\n }", "setTransform(tr,ax,ro){\n\t\tthis.translate[0] = tr[0];\n\t\tthis.translate[1] = tr[1];\n\t\tthis.translate[2] = tr[2];\n\n\t\tthis.rotAxis[0] = ax[0];\n\t\tthis.rotAxis[1] = ax[1];\n\t\tthis.rotAxis[2] = ax[2];\n\n\t\tthis.angle = ro;\n\t}", "function transform(el, value) {\n el.style['transform'] = value;\n el.style['webkitTransform'] = value;\n}", "function AddTransformer() {}", "setValidators(validators) {\n this._rawValidators = validators;\n this._composedValidatorFn = coerceToValidator(validators);\n }", "updatePresets(value) {\n this._presets = typeof value === 'function' ? value(this._presets) : value;\n this._pipe.updateMiddlewares(this._presets);\n }", "_setValidators(validators) {\n this._rawValidators = validators || [];\n this._composedValidatorFn = composeValidators(this._rawValidators);\n }", "reapplyTransforms(updateElementsTransform = true) {\n let matrix = Matrix.identity(3);\n\n if (this.element.renderTransform) {\n this.element.renderTransform.apply(matrix);\n }\n this._transforms.apply(matrix);\n\n this.elementMatrix = matrix;\n\n if (updateElementsTransform) {\n // Update element transform.\n return this.updateElement();\n }\n else {\n return new Promise((resolve, reject) => {\n resolve();\n });\n }\n }", "setTransformation(tMat: Matrix, tMatInv: Matrix, tMatTInv: Matrix): void {\n this._tMat = tMat;\n this._tMatInv = tMatInv;\n this._tMatTInv = tMatTInv;\n this.computeBoundingBox();\n }", "_transformFiles(files, done) {\n let transformedFiles = [];\n // Clumsy way of handling asynchronous calls, until I get to add a proper Future library.\n let doneCounter = 0;\n for(let i = 0; i < files.length; i++)this.options.transformFile.call(this, files[i], (transformedFile)=>{\n transformedFiles[i] = transformedFile;\n if (++doneCounter === files.length) done(transformedFiles);\n });\n }", "function transform_install_install(registers) {\n registers.registerTransform(filterTransform);\n registers.registerTransform(sortTransform);\n}", "function listTransforms() {\n var pad, //Minimum padding length\n transform, //Index of transform\n space, //Index of space padding\n spacing = ''; //Padding string\n\n console.log('Available transformations:\\n');\n for (transform = 0; transform < transformLoader.length; transform++) {\n spacing = '';\n pad = 16 - transformLoader[transform].longFlag.length;\n for (space = 0; space < pad; space++) {\n spacing += ' ';\n }\n console.log(' ' + transformLoader[transform].shortFlag + ' ' +\n transformLoader[transform].longFlag + spacing +\n transformLoader[transform].desc);\n }\n}", "function convertTransformersToArrays(part) {\n if (part.transform === null) {\n delete part.transform;\n return;\n }\n\n if (_.isString(part.transform)) {\n part.transform = [part.transform];\n }\n }", "getTransform(){return this.__transform}", "transform(transforms, relative, affine) {\n // If we have a declarative function, we should retarget it if possible\n relative = transforms.relative || relative;\n\n if (this._isDeclarative && !relative && this._tryRetarget('transform', transforms)) {\n return this;\n } // Parse the parameters\n\n\n var isMatrix = Matrix_Matrix.isMatrixLike(transforms);\n affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; // Create a morepher and set its type\n\n const morpher = new Morphable_Morphable(this._stepper).type(affine ? TransformBag : Matrix_Matrix);\n let origin;\n let element;\n let current;\n let currentAngle;\n let startTransform;\n\n function setup() {\n // make sure element and origin is defined\n element = element || this.element();\n origin = origin || getOrigin(transforms, element);\n startTransform = new Matrix_Matrix(relative ? undefined : element); // add the runner to the element so it can merge transformations\n\n element._addRunner(this); // Deactivate all transforms that have run so far if we are absolute\n\n\n if (!relative) {\n element._clearTransformRunnersBefore(this);\n }\n }\n\n function run(pos) {\n // clear all other transforms before this in case something is saved\n // on this runner. We are absolute. We dont need these!\n if (!relative) this.clearTransform();\n let {\n x,\n y\n } = new Point_Point(origin).transform(element._currentTransform(this));\n let target = new Matrix_Matrix(Runner_objectSpread({}, transforms, {\n origin: [x, y]\n }));\n let start = this._isDeclarative && current ? current : startTransform;\n\n if (affine) {\n target = target.decompose(x, y);\n start = start.decompose(x, y); // Get the current and target angle as it was set\n\n const rTarget = target.rotate;\n const rCurrent = start.rotate; // Figure out the shortest path to rotate directly\n\n const possibilities = [rTarget - 360, rTarget, rTarget + 360];\n const distances = possibilities.map(a => Math.abs(a - rCurrent));\n const shortest = Math.min(...distances);\n const index = distances.indexOf(shortest);\n target.rotate = possibilities[index];\n }\n\n if (relative) {\n // we have to be careful here not to overwrite the rotation\n // with the rotate method of Matrix\n if (!isMatrix) {\n target.rotate = transforms.rotate || 0;\n }\n\n if (this._isDeclarative && currentAngle) {\n start.rotate = currentAngle;\n }\n }\n\n morpher.from(start);\n morpher.to(target);\n let affineParameters = morpher.at(pos);\n currentAngle = affineParameters.rotate;\n current = new Matrix_Matrix(affineParameters);\n this.addTransform(current);\n\n element._addRunner(this);\n\n return morpher.done();\n }\n\n function retarget(newTransforms) {\n // only get a new origin if it changed since the last call\n if ((newTransforms.origin || 'center').toString() !== (transforms.origin || 'center').toString()) {\n origin = getOrigin(transforms, element);\n } // overwrite the old transformations with the new ones\n\n\n transforms = Runner_objectSpread({}, newTransforms, {\n origin\n });\n }\n\n this.queue(setup, run, retarget, true);\n this._isDeclarative && this._rememberMorpher('transform', morpher);\n return this;\n }", "function convertTransformersToArrays(part) {\n if (part.transform === null) {\n delete part.transform;\n return;\n }\n\n if (_.isString(part.transform)) {\n part.transform = [part.transform];\n }\n }", "applyTransforms(joblist) {\n return joblist.map(job => {\n const jobTransform = job;\n\n // Run through our transforms\n if (this.customTransforms.length > 0) {\n this.customTransforms.forEach(transform => {\n const result = transform(jobTransform.location);\n jobTransform[result.property] = result.value;\n });\n }\n\n // Return the transformed job\n return jobTransform;\n })\n .filter(job => job.location.indexOf('pagead') < 0);\n }", "async _applyTransformers(component, packageJson) {\n return _packageJsonTransformer().PackageJsonTransformer.applyTransformers(component, packageJson);\n }", "function setState (nextState) {\n curState = nextState\n el.style.transformOrigin = '0 0'\n el.style.transform = toCSS(nextState.matrix)\n }", "complete() {\n if (this.element.renderTransform) {\n this.refreshTransforms();\n this.element.renderTransform.reset();\n }\n }", "setComposer() {\n\t\tthis.composer = new Wagner.Composer(this.renderer);\n\n\t\tthis.passes = [\n\t\t\tnew NoisePass({\n\t\t\t\tamount: .05\n\t\t\t}),\n\t\t\tnew VignettePass({\n\t\t\t\tboost: 1,\n\t\t\t\treduction: .4\n\t\t\t})\n\t\t];\n\t}", "updateTransform()\n {\n this.validate();\n this.containerUpdateTransform();\n }", "function setModelTransforms( FBXTree, model, modelNode ) {\n \n // http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html\n if ( 'RotationOrder' in modelNode ) {\n \n var enums = [\n 'XYZ', // default\n 'XZY',\n 'YZX',\n 'ZXY',\n 'YXZ',\n 'ZYX',\n 'SphericXYZ',\n ];\n \n var value = parseInt( modelNode.RotationOrder.value, 10 );\n \n if ( value > 0 && value < 6 ) {\n \n // model.rotation.order = enums[ value ];\n \n // Note: Euler order other than XYZ is currently not supported, so just display a warning for now\n console.warn( 'THREE.FBXLoader: unsupported Euler Order: %s. Currently only XYZ order is supported. Animations and rotations may be incorrect.', enums[ value ] );\n \n } else if ( value === 6 ) {\n \n console.warn( 'THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.' );\n \n }\n \n }\n \n if ( 'Lcl_Translation' in modelNode ) {\n \n model.position.fromArray( modelNode.Lcl_Translation.value );\n \n }\n \n if ( 'Lcl_Rotation' in modelNode ) {\n \n var rotation = modelNode.Lcl_Rotation.value.map( THREE.Math.degToRad );\n rotation.push( 'ZYX' );\n model.rotation.fromArray( rotation );\n \n }\n \n if ( 'Lcl_Scaling' in modelNode ) {\n \n model.scale.fromArray( modelNode.Lcl_Scaling.value );\n \n }\n \n if ( 'PreRotation' in modelNode ) {\n \n var array = modelNode.PreRotation.value.map( THREE.Math.degToRad );\n array[ 3 ] = 'ZYX';\n \n var preRotations = new THREE.Euler().fromArray( array );\n \n preRotations = new THREE.Quaternion().setFromEuler( preRotations );\n var currentRotation = new THREE.Quaternion().setFromEuler( model.rotation );\n preRotations.multiply( currentRotation );\n model.rotation.setFromQuaternion( preRotations, 'ZYX' );\n \n }\n \n }", "_setPlugins() {\n\t\tvar currentIndex = this._browserifyPlugins.length - 1;\n\n\t\twhile (currentIndex >= 0) {\n\t\t\tconst currentPlugin = this._browserifyPlugins[currentIndex];\n\t\t\tcurrentIndex--;\n\t\t\tif (!currentPlugin ||\n\t\t\t\ttypeof (currentPlugin) !== 'object' ||\n\t\t\t\ttypeof (currentPlugin.plugin) !== 'function') {\n\t\t\t\tthis._eventBus.emit('warn', 'The browserify plugin has an incorrect interface, skipping...');\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis._bundler.plugin(\n\t\t\t\tcurrentPlugin.plugin, currentPlugin.options\n\t\t\t);\n\t\t}\n\t}", "function ripple_transform(el, value) {\n el.style['transform'] = value;\n el.style['webkitTransform'] = value;\n}", "resetTransform() {\n this._targetNode.resetTransform();\n this.matrixProperty.set( this._targetNode.matrix.copy() );\n }", "registerAnimations(orientation = 90) {\n this.dropdowns.forEach((dropdown) => {\n requestListDropdownAnimate(dropdown, orientation);\n });\n }", "applyTransform(tf) {\n position.multiplyQuaternion(tf.rotation);\n position.add(tf.translation);\n let tmp = tf.rotation.clone();\n tmp.multiply(this.orientation);\n this.orientation = tmp;\n }", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function Transform() {}", "function setTransform(whitelistObject) {\n return whitelistObject.whitelist;\n}", "resetMatrix() {\n this.activator();\n const conf = { stft: {}, startTime: 0 };\n this.stftHandler.setConfig(conf);\n this.transformationMatrix = this.savedMatrix;\n this.emitUpdateEvent();\n }", "updateTransform() {\n super.updateTransform();\n // TODO don't need to!\n // this.displayObjectUpdateTransform();\n // PIXI.Container.prototype.updateTransform.call( this );\n }", "function setTransforms() {\n itemsStyle.style.transform = 'translate3d(' + (posI * 550) + 'px,0,0)';\n}", "function setModelTransforms(FBXTree, model, modelNode) {\n // http://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_class_fbx_euler_html\n if ('RotationOrder' in modelNode) {\n var enums = [\n 'XYZ',\n 'XZY',\n 'YZX',\n 'ZXY',\n 'YXZ',\n 'ZYX',\n 'SphericXYZ',\n ];\n var value = parseInt(modelNode.RotationOrder.value, 10);\n if (value > 0 && value < 6) {\n // model.rotation.order = enums[ value ];\n // Note: Euler order other than XYZ is currently not supported, so just display a warning for now\n console.warn('THREE.FBXLoader: unsupported Euler Order: %s. Currently only XYZ order is supported. Animations and rotations may be incorrect.', enums[value]);\n }\n else if (value === 6) {\n console.warn('THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect.');\n }\n }\n if ('Lcl_Translation' in modelNode) {\n model.position.fromArray(modelNode.Lcl_Translation.value);\n }\n if ('Lcl_Rotation' in modelNode) {\n var rotation = modelNode.Lcl_Rotation.value.map(THREE.Math.degToRad);\n rotation.push('ZYX');\n model.quaternion.setFromEuler(new THREE.Euler().fromArray(rotation));\n }\n if ('Lcl_Scaling' in modelNode) {\n model.scale.fromArray(modelNode.Lcl_Scaling.value);\n }\n if ('PreRotation' in modelNode) {\n var array = modelNode.PreRotation.value.map(THREE.Math.degToRad);\n array[3] = 'ZYX';\n var preRotations = new THREE.Euler().fromArray(array);\n preRotations = new THREE.Quaternion().setFromEuler(preRotations);\n model.quaternion.premultiply(preRotations);\n }\n}", "_setWorldTransformOrigin() {\n // set transformation origin relative to world space as well\n this._boundingRect.world.transformOrigin = new Vec3(\n (this.transformOrigin.x * 2 - 1) // between -1 and 1\n * this._boundingRect.world.width,\n -(this.transformOrigin.y * 2 - 1) // between -1 and 1\n * this._boundingRect.world.height,\n this.transformOrigin.z\n );\n }", "function setLionBundle(bundle) {\n topoLion = bundle;\n }", "function Awake()\n\t{\n\t\tmyTransform = transform; //cache transform data for easy access/preformance\n\t}", "function initialize()\n\t\t{\n\t\t\t// Set the starting location, scale, and rotation values for the fish.\n\t\t\tfishGroupElement.setAttribute(\"transform\", buildFishTransformString(GroupTransformDefaultValues));\n\t\t} // initialize()", "setBones(trsets) {\nvar bone, k, len, trset;\n//-------\nfor (k = 0, len = trsets.length; k < len; k++) {\ntrset = trsets[k];\nbone = this.getBoneBy4CC(trset.getFourCC());\nif (bone) {\nif (bone.isRoot()) {\nbone.updateLocalTransAndRot(trset);\n} else {\nbone.updateLocalRot(trset);\n}\n}\n}\nthis.root.computeGlobalTransforms();\nif (this.USE_TRX_BONE_DATA) {\nthis.updateCurGlobalPoseTRXData();\nreturn this.updateTwistData();\n} else {\nreturn this.updateSkinMatRows();\n}\n}", "function Awake()\n {\n myTransform = transform; //cache transform data for easy access/preformance\n }", "function resetListCompiling() {\n\t\tvar lists = that.data.lists;\n\t\tfor (var i = 0, len = lists.length; i < len; i++) {\n\t\t\tvar list = lists[i];\n\t\t\tlist.compiling = true;\n\t\t}\n\t}", "_applyRotation() {\n this.quaternion.setFromVec3(this.rotation);\n // we should update the plane mvMatrix\n this._updateMVMatrix = true;\n }", "function setFilters() { }", "function setFilters() { }", "function setAllMatrices() {\n gl.uniformMatrix4fv(projectionMatrixLoc, false, flatten(projectionMatrix));\n setMV();\n\n}", "function setAllMatrices() {\n gl.uniformMatrix4fv(projectionMatrixLoc, false, flatten(projectionMatrix));\n setMV();\n\n}" ]
[ "0.7263447", "0.547929", "0.5444356", "0.5444356", "0.5444356", "0.5444356", "0.53676915", "0.530141", "0.5230234", "0.52164245", "0.5198078", "0.51966965", "0.5159227", "0.5158514", "0.5147033", "0.5098097", "0.5061689", "0.50538903", "0.5000126", "0.4947076", "0.49207065", "0.48994502", "0.48962262", "0.48952618", "0.48912343", "0.4889531", "0.4853975", "0.48383337", "0.4834342", "0.48115933", "0.48115933", "0.48115933", "0.47903877", "0.4776061", "0.4772914", "0.47603408", "0.47593254", "0.47317228", "0.47041723", "0.46962032", "0.4695066", "0.4695066", "0.4695066", "0.4695066", "0.4695066", "0.4695066", "0.46824992", "0.4676413", "0.4666605", "0.46607915", "0.46548235", "0.4645828", "0.46446598", "0.4621291", "0.46045104", "0.4602295", "0.4601485", "0.45860684", "0.4585051", "0.45806324", "0.45748407", "0.45709574", "0.45706484", "0.45696947", "0.45662573", "0.45386517", "0.45322222", "0.45205152", "0.4514247", "0.45130494", "0.45020902", "0.44966355", "0.4494708", "0.44874397", "0.4485971", "0.44750765", "0.44680387", "0.44626588", "0.44540578", "0.44540578", "0.44540578", "0.44540578", "0.44540578", "0.44459173", "0.44457778", "0.44385284", "0.4434568", "0.44333217", "0.4431562", "0.44158232", "0.44111994", "0.43990064", "0.43954527", "0.43938103", "0.43922722", "0.43888372", "0.43846896", "0.43846896", "0.43808207", "0.43808207" ]
0.7211117
1
Sets the list of current plugins to the bundler.
_setPlugins() { var currentIndex = this._browserifyPlugins.length - 1; while (currentIndex >= 0) { const currentPlugin = this._browserifyPlugins[currentIndex]; currentIndex--; if (!currentPlugin || typeof (currentPlugin) !== 'object' || typeof (currentPlugin.plugin) !== 'function') { this._eventBus.emit('warn', 'The browserify plugin has an incorrect interface, skipping...'); continue; } this._appBundler.plugin( currentPlugin.plugin, currentPlugin.options ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setPlugins() {\n\t\tvar currentIndex = this._browserifyPlugins.length - 1;\n\n\t\twhile (currentIndex >= 0) {\n\t\t\tconst currentPlugin = this._browserifyPlugins[currentIndex];\n\t\t\tcurrentIndex--;\n\t\t\tif (!currentPlugin ||\n\t\t\t\ttypeof (currentPlugin) !== 'object' ||\n\t\t\t\ttypeof (currentPlugin.plugin) !== 'function') {\n\t\t\t\tthis._eventBus.emit('warn', 'The browserify plugin has an incorrect interface, skipping...');\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthis._bundler.plugin(\n\t\t\t\tcurrentPlugin.plugin, currentPlugin.options\n\t\t\t);\n\t\t}\n\t}", "static set PLUGINS(plugins) {\n PLUGINS = plugins;\n }", "addPlugins(...plugins) {\n InstancePlugin.initPlugins(this, ...plugins);\n }", "addPlugins(...plugins) {\n InstancePlugin.initPlugins(this, ...plugins);\n }", "_setPlugins() {\n this.config.plugins = {\n // Systems\n global: [\n { key: 'RoomSystem', plugin: Systems.RoomSystem, start: false, mapping: 'rooms' },\n { key: 'CursorSystem', plugin: Systems.CursorSystem, start: false, mapping: 'cursors' }\n ],\n // Managers\n scene: [\n { key: 'UpdateManager', plugin: Managers.UpdateManager, mapping: 'updates' },\n { key: 'LightSourceManager', plugin: Managers.LightSourceManager, mapping: 'lightSources' },\n { key: 'LayerManager', plugin: Managers.LayerManager, mapping: 'layers' }\n ]\n };\n }", "registerPlugins() {\r\n _(this.plugins)\r\n .pickBy(plugin => {\r\n return plugin.register;\r\n })\r\n .forEach(plugin => {\r\n this.slickGrid.registerPlugin(plugin.plugin);\r\n });\r\n }", "function initPlugins() {\n\t\tFs.readdir(plugPath, function (err, pluginNames) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\n\t\t\t// Determine default plugin\n\t\t\tsetOrder(pluginNames);\n\t\t\t\n\t\t\t// Initialize each plugin according to config\n\t\t\tpluginNames.forEach(addPlugin);\n\t\t});\n\t}", "loadAll() {\n logger.info(`Loading plugins...`);\n\n const pluginPath = path.join(__dirname, '..', '..', 'plugins');\n if (!fse.existsSync(pluginPath)) {\n fse.emptyDirSync(pluginPath);\n logger.error(`Plugin directory not found! Creating one...`);\n process.exit(0);\n }\n\n const plugins = this.constructor._read(pluginPath);\n for (const plugin of plugins) this._registerPlugin(require(plugin));\n\n this._emitCommandsd();\n logger.info(`Loaded ${this.plugins.size} plugin(s)!`);\n }", "addPlugins() {\n const pm = PluginManager.getInstance();\n pm.addPlugin(new ElectronPlugin());\n }", "constructor() {\n\n /**\n * @type {Array<Plugin>} the list of plugins which this object manages.\n */\n this.pluginList = [];\n }", "initPlugins() {}", "initPlugins() {}", "function registerPresets(newPresets) {\n Object.keys(newPresets).forEach(function (name) {\n return registerPreset(name, newPresets[name]);\n });\n } // All the plugins we should bundle", "orderPlugins() {\r\n debug('orderPlugins:before', this.pluginNames);\r\n const runLast = this._plugins\r\n .filter(p => p.requirements.has('runLast'))\r\n .map(p => p.name);\r\n for (const name of runLast) {\r\n const index = this._plugins.findIndex(p => p.name === name);\r\n this._plugins.push(this._plugins.splice(index, 1)[0]);\r\n }\r\n debug('orderPlugins:after', this.pluginNames);\r\n }", "get plugins() {\n return this._plugins;\n }", "function init() {\n var _this = this;\n\n this._get('options').plugins.forEach(function (plugin) {\n // check if plugin definition is string or object\n var Plugin = undefined;\n var pluginName = undefined;\n var pluginOptions = {};\n if (typeof plugin === 'string') {\n pluginName = plugin;\n } else if ((typeof plugin === 'undefined' ? 'undefined' : babelHelpers.typeof(plugin)) === 'object') {\n pluginName = plugin.name;\n pluginOptions = plugin.options || {};\n }\n\n Plugin = find(pluginName);\n _this._get('plugins')[plugin] = new Plugin(_this, pluginOptions);\n\n addClass(_this._get('$container'), pluginClass(pluginName));\n });\n }", "getPlugins() {\n return this.plugins;\n }", "updateAll(state) {\n this.iteratePlugins(plugin => {\n plugin.update(state);\n });\n }", "function getPlugins() {\n return plugins;\n}", "registerPlugin(plugin, handlePlugins) {\n const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];\n const state = this.state.reconfigure({ plugins });\n this.view.updateState(state);\n }", "function registerPlugins(newPlugins) {\n Object.keys(newPlugins).forEach(function (name) {\n return registerPlugin(name, newPlugins[name]);\n });\n }", "function pullPlugins(preset) {\n plugins.push(...preset.plugins);\n if (Array.isArray(preset.presets)) {\n preset.presets.forEach(p => pullPlugins(p));\n }\n }", "function initPlugins(model, esriMap) {\n var mapModel = model.get('mapModel'),\n regionData = model.get('regionData');\n\n model.get('plugins').each(function (pluginModel) {\n var stateOfPlugin = model.get('stateOfPlugins')[pluginModel.name()];\n\n pluginModel.initPluginObject(regionData, mapModel, esriMap);\n if (stateOfPlugin) {\n pluginModel.setState(stateOfPlugin);\n }\n });\n }", "_initPlugins() {\n this.plugins.forEach(plugin => {\n if (plugin === 'ubiety-custom-texture' && !this.customTextureModule) {\n this.customTextureModule = new UbietyCustomTexture('ubiety-custom-texture', this, 'umjs-texture-factory');\n }\n else if (plugin === 'ubiety-text-editor' && !this.customTextEditorModule) {\n this.customTextEditorModule = new UbietyCustomTexture('ubiety-text-editor', this, 'umjs-text-image-factory');\n }\n else {\n console.error('Ubiety:: Either a plugin can\\'t be recognised, or it already exists.');\n }\n });\n }", "function handlePluginsObject(path, moduleList) {\n // Now inject the scripts.\n var scriptCounter = moduleList.length;\n\n if (!scriptCounter) {\n finishPluginLoading();\n return;\n }\n function scriptLoadedCallback() {\n if (!--scriptCounter) {\n onScriptLoadingComplete(moduleList);\n }\n }\n\n for (var i = 0; i < moduleList.length; i++) {\n injectScript(path + moduleList[i].file, scriptLoadedCallback);\n }\n}", "get plugins () {\n return this._chain.reduce(\n (plugins, {config}) => config.plugins\n ? plugins.concat(config.plugins)\n : plugins,\n []\n )\n }", "function initPlugins() {\n Vue.use(Vuex);\n Vue.use(VueRouter);\n Vue.use(VueI18n);\n Vue.use(DeviceHelper);\n Vue.use(VueMeta);\n Vue.use(SanitizePlugin);\n }", "function handlePluginsObject(path, moduleList, finishPluginLoading) {\n // Now inject the scripts.\n var scriptCounter = moduleList.length;\n\n if (!scriptCounter) {\n finishPluginLoading();\n return;\n }\n function scriptLoadedCallback() {\n if (!--scriptCounter) {\n onScriptLoadingComplete(moduleList, finishPluginLoading);\n }\n }\n\n for (var i = 0; i < moduleList.length; i++) {\n injectIfNecessary(moduleList[i].id, path + moduleList[i].file, scriptLoadedCallback);\n }\n}", "function registerPlugins(newPlugins) {\n\t Object.keys(newPlugins).forEach(function (name) {\n\t return registerPlugin(name, newPlugins[name]);\n\t });\n\t}", "function registerPlugins(newPlugins) {\n\t Object.keys(newPlugins).forEach(function (name) {\n\t return registerPlugin(name, newPlugins[name]);\n\t });\n\t}", "function loadPlugins(bookshelf) {\n if (! bookshelfPluginLoaded.has(bookshelf)) {\n bookshelfPluginLoaded.add(bookshelf);\n\n let signalHub = new Backbone.Model();\n signalHubs.set(bookshelf, signalHub);\n\n bookshelf.plugin('registry');\n bookshelf.plugin('pagination');\n bookshelf.plugin(Signals(signalHub));\n }\n}", "function clearPlugins() {\n\tlogger.entry(\"pluginLoader.clearPlugins\");\n\t\n\t// empty array\n\tplugins = [];\n\t\n\tlogger.exit(\"pluginLoader.clearPlugins\");\n}", "registerRenderers(...plugins) {\n // Used if the plugin needs to render Marks recur\n plugins.forEach(plugin => {\n var _a;\n plugin.cloneRenderer = this.clone.bind(this);\n plugin.getDocument = () => new Document_1.Document(this.targetRender);\n (_a = plugin.willInit) === null || _a === void 0 ? void 0 : _a.call(plugin);\n this._rendererRepo.register(plugin);\n });\n }", "constructor() {\n this.plugins = [];\n this.plugins_by_events = [];\n this.callbacks_by_events = [];\n \n window.custom_plugins.concrete = {}; // this is where loaded plugins are stored\n }", "function setupPlugins() {\n\n mylog(\"Setting up plugins\");\n var plugin_dirs = API.ls(\"application\", \"plugins\", \"*\");\n \n for (var j = 0; j < plugin_dirs.length; j++) {\n var plugin_dir = plugin_dirs[j];\n var plugin_name = plugin_dir;\n var regexp = new RegExp(\"plugin_\" + plugin_name + \"_version = ['\\\"](.+)[\\\"']\");\n \n var version_str_app = API.fileRead(\"application\", \"plugins/\" + plugin_dir + \"/version.txt\");\n var version_appdir;\n if (version_str_app) {\n version_appdir = versionStrToNumber(version_str_app);\n mylog(\"Plugin\", plugin_name, \"in app dir:\", version_appdir);\n } else {\n mylog(\"Plugin\", plugin_name, \"in app dir: Could not find version. Skipping.\");\n continue;\n }\n \n var versionfile_workingdir = \"plugins/\" + plugin_dir + \"/version.txt\";\n var version_str_working = API.fileRead(\"working\", versionfile_workingdir);\n var version_workingdir;\n if (version_str_working) {\n version_workingdir = versionStrToNumber(version_str_working);\n mylog(\"Plugin\", plugin_name, \"in working dir:\", version_workingdir);\n }\n \n if (!version_workingdir || version_appdir > version_workingdir) {\n mylog(\"Plugin\", plugin_name, \"copying.\");\n copyDirFromAppDirToWorkingDir(\"plugins/\" + plugin_dir);\n } else {\n mylog(\"Plugin\", plugin_name, \"up to date or newer\");\n }\n }\n}", "getPlugins() {\n let plugins = this.plugins;\n for (let router of Object.values(this.destinations)) {\n plugins = plugins.concat(router.getPlugins());\n }\n return plugins;\n }", "dependencies(){\n for(let key in this.plugins){\n \tlet plugin = this.plugins[key],\n \t \t\tdependencies = {server: this.server};\n \tfor(let keyDep in plugin.props.dependencies){\n dependencies[plugin.props.dependencies[keyDep]] = this.plugins[this.pointPlugin[plugin.props.conf.name]];\n \t}\n \tplugin.setDependencies(dependencies);\n }\n }", "function addPlugins(config, plugins) {\r\n config.plugins = config.plugins ? config.plugins.slice() : [];\r\n plugins.forEach(plugin => config.plugins.push(plugin));\r\n return config;\r\n}", "get plugins() {\n return this.config.plugins;\n }", "function handlePlugins$1(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n }", "order() {\n debug('order:before', this.names);\n const runLast = this._plugins\n .filter(p => p.requirements.has('runLast'))\n .map(p => p.name);\n for (const name of runLast) {\n const index = this._plugins.findIndex(p => p.name === name);\n this._plugins.push(this._plugins.splice(index, 1)[0]);\n }\n debug('order:after', this.names);\n }", "function listPlugins() {\n\tlogger.entry(\"pluginLoader.listPlugins\");\n\t\n\tvar pluginNames = Object.keys(plugins);\n\t\n\tlogger.exit(\"pluginLoader.listPlugins\", pluginNames);\n\treturn pluginNames;\n}", "async readPluginVersions () {\n const pluginVersions = await readConfigFile(this.cwd, FILE_APP_MIGRATIONS_PLUGIN_VERSIONS)\n for (const plugin of this.plugins) {\n plugin.currentVersion = getVersion(plugin.id, this.cwd)\n plugin.previousVersion = pluginVersions[plugin.id]\n }\n }", "function PluginManager() {\n\t/**\n\t * Plugin constructor\n\t * @member {Plugin} PluginManager~Plugin\n\t */\n\tvar Plugin = require('./js/plugin');\n\t/**\n\t * The home view to be opened first\n\t * @member {string} PluginManager~home\n\t */\n\tvar home;\n\t/**\n\t * The plugins folder\n\t * @member {string} PluginManager~plugPath\n\t */\n\tvar plugPath;\n\t/**\n\t * The current plugin\n\t * @member {Plugin} PluginManager~current\n\t */\n\tvar current;\n\t/**\n\t * Array to store all plugins\n\t * @member {Plugin[]} PluginManager~plugins\n\t */\n\tvar plugins = {};\n\n\t/**\n\t * Detects the home Plugin or otherwise the alphabetically first\n\t * plugin and sets its button and view to be first in order\n\t * @function PluginManager~setOrder\n\t * @todo: this is hardcoded, perhaps can add priority system\n\t * @param {string[]} pluginNames - array of subdirectories of app/plugins/\n\t */\n\tfunction setOrder(pluginNames) {\n\t\t// Detect if about plugin is installed\n\t\tvar aboutIndex = pluginNames.indexOf('About');\n\t\tif (aboutIndex !== -1) {\n\t\t\t// Swap it to be last\n\t\t\tpluginNames[aboutIndex] = pluginNames[pluginNames.length - 1];\n\t\t\tpluginNames[pluginNames.length - 1] = 'About';\n\t\t}\n\n\t\t// Detect if home plugin is installed\n\t\tvar homeIndex = pluginNames.indexOf(home);\n\t\tif (homeIndex !== -1) {\n\t\t\t// Swap it to be first\n\t\t\tpluginNames[homeIndex] = pluginNames[0];\n\t\t\tpluginNames[0] = home;\n\t\t\treturn;\n\t\t}\n\t\t// No home plugin installed\n\t\thome = pluginNames[0];\n\t}\n\n\t/**\n\t * Handles listening for plugin messages and reacting to them\n\t * @function PluginManager~addListeners\n\t * @param {Plugin} plugin - a newly made plugin object\n\t */\n\tfunction addListeners(plugin) {\n\t\t// Only show the default plugin view\n\t\tif (plugin.name === home) {\n\t\t\tplugin.on('dom-ready', plugin.show);\n\t\t\tcurrent = plugin;\n\t\t}\n\n\t\t/** \n\t\t * Standard transition upon button click.\n\t\t * @typedef transition\n\t\t * TODO: Can sometime have two 'current' buttons when selecting a\n\t\t * sidebar button too quickly\n\t\t */\n\t\tplugin.transition(function() {\n\t\t\t// Don't do anything if already on this plugin\n\t\t\tif (current === plugin) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Fadein and fadeout mainbar\n\t\t\tvar main = document.getElementById('mainbar').classList;\n\t\t\tmain.add('transition');\n\t\t\tsetTimeout(function() {\n\t\t\t\tmain.remove('transition');\n\t\t\t}, 170);\n\n\t\t\t// Switch plugins\n\t\t\tcurrent.hide();\n\t\t\tcurrent = plugin;\n\t\t\tcurrent.show();\n\t\t});\n\t\t\n\t\t// Handle any ipc messages from the plugin\n\t\tplugin.on('ipc-message', function(event) {\n\t\t\tswitch(event.channel) {\n\t\t\t\tcase 'api-call':\n\t\t\t\t\t// Redirect api calls to the daemonManager\n\t\t\t\t\tvar call = event.args[0];\n\t\t\t\t\tvar responseChannel = event.args[1];\n\t\t\t\t\t// Send the call only if the Daemon appears to be running\n\t\t\t\t\tif (!Daemon.Running) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tDaemon.apiCall(call, function(err, result) {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\t// If a call didn't work, test that the\n\t\t\t\t\t\t\t// `/consensus` call still works\n\t\t\t\t\t\t\tconsole.error(err, call);\n\t\t\t\t\t\t\tDaemon.ifSiad(function() {\n\t\t\t\t\t\t\t\t// Send error response back to the plugin\n\t\t\t\t\t\t\t\tplugin.sendToView(responseChannel, err, result);\n\t\t\t\t\t\t\t}, function() {\n\t\t\t\t\t\t\t\t// `/consensus` call failed too, assume siad\n\t\t\t\t\t\t\t\t// has stopped\n\t\t\t\t\t\t\t\tUI.notify('siad seems to have stopped working!', 'stop');\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else if (responseChannel) {\n\t\t\t\t\t\t\tplugin.sendToView(responseChannel, err, result);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'notify':\n\t\t\t\t\t// Use UI notification system\n\t\t\t\t\tUI.notify.apply(null, event.args);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'tooltip':\n\t\t\t\t\t// Use UI tooltip system\n\t\t\t\t\tevent.args[1].top += $('.header').height();\n\t\t\t\t\tevent.args[1].left += $('#sidebar').width();\n\t\t\t\t\tUI.tooltip.apply(null, event.args);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'dialog':\n\t\t\t\t\t// Send dialog's response back to the plugin\n\t\t\t\t\tplugin.sendToView('dialog', IPC.sendSync('dialog', event.args));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'devtools':\n\t\t\t\t\t// Plugin called for its own devtools, toggle it\n\t\t\t\t\tplugin.toggleDevTools();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log('Unknown ipc message: ' + event.channel);\n\t\t\t}\n\t\t});\n\n\t\t// Display any console logs from the plugin\n\t\tplugin.on('console-message', function(event) {\n\t\t\tvar srcFile = event.sourceId.replace(/^.*[\\\\\\/]/, '');\n\t\t\tconsole.log(plugin.name + ' plugin logged from ' + srcFile +'(' + event.line + '): ' + event.message);\n\t\t});\n\t}\n\n\t/**\n\t * Constructs the plugins and adds them to this manager \n\t * @function PluginManager~addPlugin\n\t * @param {string} name - The plugin folder's name\n\t */\n\tfunction addPlugin(name) {\n\t\t// Make the plugin, giving its button a standard transition\n\t\tvar plugin = new Plugin(plugPath, name);\n\n\t\t// addListeners deals with any webview related async tasks\n\t\taddListeners(plugin);\n\n\t\t// Store the plugin\n\t\tplugins[name] = plugin;\n\t}\n\n\t/**\n\t * Reads the config's plugPath for plugin folders\n\t * @function PluginManager~initPlugins\n\t */\n\tfunction initPlugins() {\n\t\tFs.readdir(plugPath, function (err, pluginNames) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\n\t\t\t// Determine default plugin\n\t\t\tsetOrder(pluginNames);\n\t\t\t\n\t\t\t// Initialize each plugin according to config\n\t\t\tpluginNames.forEach(addPlugin);\n\t\t});\n\t}\n\n\t/**\n\t * Sets the member variables based on the passed config\n\t * @function PluginManager~setConfig\n\t * @param {config} config - config in memory\n\t * @param {callback} callback\n\t * @todo delete all plugins when a new path is set?\n\t */\n\tfunction setConfig(config, callback) {\n\t\thome = config.homePlugin;\n\t\tplugPath = Path.join(__dirname, 'plugins');\n\t\tcallback();\n\t}\n\n\t/**\n\t * Initializes the plugins to the UI\n\t * @function PluginManager.init\n\t * @param {config} config - config in memory\n\t */\n\tthis.init = function(config) {\n\t\tsetConfig(config, initPlugins);\n\t};\n}", "setOrder(pluginsNames) {\n return (0, checkNonEmptyArray_1.default)(\"setOrder/pluginsNames\", pluginsNames).then(() => {\n const errors = [];\n for (let i = 0; i < pluginsNames.length; ++i) {\n if (\"string\" !== typeof pluginsNames[i]) {\n errors.push(\"The directory at index \\\"\" + i + \"\\\" must be a string\");\n }\n else if (\"\" === pluginsNames[i].trim()) {\n errors.push(\"The directory at index \\\"\" + i + \"\\\" must be not empty\");\n }\n else if (1 < pluginsNames.filter((name) => {\n return name === pluginsNames[i];\n }).length) {\n errors.push(\"The directory at index \\\"\" + i + \"\\\" is given twice or more\");\n }\n }\n return !errors.length ? Promise.resolve() : Promise.reject(new Error(errors.join(\"\\r\\n\")));\n }).then(() => {\n this._orderedPluginsNames = pluginsNames;\n return Promise.resolve();\n });\n }", "function handlePlugins(inputs, calendar) {\n calendar.addPluginInputs(inputs); // will gracefully handle duplicates\n}", "function runPlugins() {\n u.getJson('/plugins.json', function (err, plugins) {\n if (err) {\n console.error('Failed to load plugins')\n console.error(err)\n if (plugins)\n console.error(plugins)\n return\n }\n for (var k in plugins.files) {\n try {\n console.log('Executing plugin', k)\n eval('(function() {\\n\"use strict\"\\n\\n'+plugins.files[k]+'\\n\\n})()')\n } catch (e) {\n console.error(e)\n }\n }\n })\n}", "webpackPlugins() {\n let FastSassPlugin = require('../webpackPlugins/FastSassPlugin');\n\n return (super.webpackPlugins() || []).concat(\n new FastSassPlugin(this.details)\n );\n }", "static initPlugins(plugInto, ...plugins) {\n const property = plugInto.plugins || (plugInto.plugins = {});\n\n for (const PluginClass of plugins) {\n property[PluginClass.$name] = new PluginClass(plugInto);\n }\n }", "function setHookedModules(...modules) {\n modules.forEach(function (module, key) {\n let moduleName = HOOK_MODULES[key].split(\".\")[0]; // some module names have an extension like \".bs\"\n Modules[moduleName] = module;\n });\n}", "function ckeLoadPlugins() {\n\tfor(var name in ProcessWire.config.InputfieldCKEditor.plugins) {\n\t\tvar file = ProcessWire.config.InputfieldCKEditor.plugins[name];\n\t\tCKEDITOR.plugins.addExternal(name, file, '');\n\t}\n}", "static initPlugins(plugInto, ...plugins) {\n let property = plugInto.plugins || (plugInto.plugins = {});\n\n for (let PluginClass of plugins) {\n property[PluginClass.$name] = new PluginClass(plugInto);\n }\n }", "function setBlueprints(data) {\n _blueprints = data;\n BlueprintStore.emitChange();\n}", "function clearPluginList() {\n $(\"#plugin-list #plugin-list-item\").remove();\n}", "start(...callbacks) {\n this.reset()\n\n // Queue plugins and then notify that installation has finished\n install(this.plugins, error => {\n callbacks.forEach(cb => cb.call(this, error, this))\n })\n\n return this\n }", "function registerPlugins (log) {\n const plugins = global.FLINT.plugins\n const Plugin = mongoose.model('Plugin')\n\n return Promise.all(plugins.map(async (PluginClass) => {\n if (!PluginClass.uid) throw new Error(`${PluginClass.name} is missing a UID.`)\n if (!PluginClass.version) throw new Error(`${PluginClass.name} is missing a version.`)\n\n mongoose.plugin((schema, options) => {\n if (schema.name === undefined) return null\n return new PluginClass(schema, options)\n })\n\n const pathToIcon = PluginClass.icon\n const buffer = await readFileAsync(pathToIcon, null)\n const foundPlugin = await Plugin.findOne({ uid: PluginClass.uid })\n\n const pluginData = Object.assign({}, {\n title: PluginClass.title,\n name: PluginClass.name,\n uid: PluginClass.uid,\n version: PluginClass.version,\n icon: {\n path: PluginClass.icon,\n buffer\n }\n }, PluginClass.model)\n\n if (foundPlugin) {\n // Update the existing plugin in case its configuration (icon, name, etc) have changed.\n const updatedPlugin = Object.assign(foundPlugin, pluginData, { uid: PluginClass.uid })\n const savedPlugin = await updatedPlugin.save()\n if (!savedPlugin) log.error(`Could not save the [${PluginClass.name}] plugin to the database.`)\n } else {\n // Create a new plugin instance by including the Class model\n // The PluginSchema has { strict: false } so additions to the\n // model will work fine.\n const newPlugin = new Plugin(pluginData)\n const savedPlugin = await newPlugin.save()\n if (!savedPlugin) log.error(`Could not save the [${PluginClass.name}] plugin to the database.`)\n }\n }))\n}", "function resolvers_getActivePlugins() {\n var url, results;\n return regeneratorRuntime.wrap(function getActivePlugins$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n _context.next = 2;\n return actions_setIsRequesting('getActivePlugins', true);\n\n case 2:\n _context.prev = 2;\n url = WC_ADMIN_NAMESPACE + '/plugins/active';\n _context.next = 6;\n return Object(external_this_wp_dataControls_[\"apiFetch\"])({\n path: url,\n method: 'GET'\n });\n\n case 6:\n results = _context.sent;\n _context.next = 9;\n return actions_updateActivePlugins(results.plugins, true);\n\n case 9:\n _context.next = 15;\n break;\n\n case 11:\n _context.prev = 11;\n _context.t0 = _context[\"catch\"](2);\n _context.next = 15;\n return setError('getActivePlugins', _context.t0);\n\n case 15:\n case \"end\":\n return _context.stop();\n }\n }\n }, plugins_resolvers_marked, null, [[2, 11]]);\n}", "async callPlugins(prop, ...values) {\r\n for (const plugin of this.getPluginsByProp(prop)) {\r\n await plugin[prop].apply(plugin, values);\r\n }\r\n }", "sendToPlugins(name, value) {\n const plugins = this.plugins;\n for (const id in plugins) {\n if (plugins.hasOwnProperty(id)) {\n plugins[id].send(name, value);\n }\n }\n }", "function injectPluginsIntoConfig(state) {\n // Load plugin config \n var root = state.environment.path,\n configPath = root.concat(['build', 'client', 'modules', 'config']),\n pluginConfigFile = root.concat(['config', 'ui', state.config.targets.ui, 'build.yml']).join('/');\n\n return fs.ensureDirAsync(configPath.join('/'))\n .then(function () {\n return fs.readFileAsync(pluginConfigFile, 'utf8');\n })\n .then(function (pluginFile) {\n return yaml.safeLoad(pluginFile);\n })\n .then(function (pluginConfig) {\n var newConfig = pluginConfig.plugins.map(function (pluginItem) {\n if (typeof pluginItem === 'string') {\n return pluginItem;\n }\n return pluginItem.name;\n });\n\n // emulate the yaml file for now, or for ever.\n return fs.writeFileAsync(configPath.concat(['plugin.yml']).join('/'),\n yaml.safeDump({plugins: newConfig}));\n });\n}", "constructor(plugins, _zone) {\n this._zone = _zone;\n this._eventNameToPlugin = new Map();\n plugins.forEach(p => p.manager = this);\n this._plugins = plugins.slice().reverse();\n }", "constructor(plugins, _zone) {\n this._zone = _zone;\n this._eventNameToPlugin = new Map();\n plugins.forEach(p => p.manager = this);\n this._plugins = plugins.slice().reverse();\n }", "constructor(plugins, _zone) {\n this._zone = _zone;\n this._eventNameToPlugin = new Map();\n plugins.forEach(p => p.manager = this);\n this._plugins = plugins.slice().reverse();\n }", "constructor(plugins, _zone) {\n this._zone = _zone;\n this._eventNameToPlugin = new Map();\n plugins.forEach(p => p.manager = this);\n this._plugins = plugins.slice().reverse();\n }", "constructor(plugins, _zone) {\n this._zone = _zone;\n this._eventNameToPlugin = new Map();\n plugins.forEach(p => p.manager = this);\n this._plugins = plugins.slice().reverse();\n }", "Destroy() {\n for (const key in this.plugins) {\n if (this.plugins.hasOwnProperty(key)) {\n const plugin = this.plugins[key];\n if(plugin.destroy){\n plugin.destroy();\n }\n }\n }\n }", "constructor(plugins, _zone) {\n this._zone = _zone;\n this._eventNameToPlugin = new Map();\n plugins.forEach(p => p.manager = this);\n this._plugins = plugins.slice().reverse();\n }", "static get pluginConfig() {\n return [];\n }", "static get pluginConfig() {\n return [];\n }", "_initExtensions() {\n //\tInvoke \"before\" hook.\n this.trigger('initExtensions:before');\n //\tConvert array to object with array.\n if (type(this.opts.extensions) == 'array') {\n this.opts.extensions = {\n all: this.opts.extensions\n };\n }\n //\tLoop over object.\n for (let query in this.opts.extensions) {\n if (this.opts.extensions[query].length) {\n let classnames = this.opts.extensions[query].map(query => 'mm-menu_' + query);\n media.add(query, () => {\n this.node.menu.classList.add(...classnames);\n }, () => {\n this.node.menu.classList.remove(...classnames);\n });\n }\n }\n //\tInvoke \"after\" hook.\n this.trigger('initExtensions:after');\n }", "static get PLUGINS() {\n return PLUGINS;\n }", "function changePresets(config, options = {}) {\n let presets = config.presets;\n const newPlugins = [];\n\n if (!Array.isArray(presets) && typeof presets === 'string') {\n presets = config.presets = config.presets.split(',').map((preset) => preset.trim());\n }\n\n // check if presets are there\n if (presets) {\n // assume it's an array\n for (let i = 0; i < presets.length; i++) {\n let preset = presets[i];\n const presetsToReplace = Object.keys(oldPresets);\n\n // check if it's a preset with options (an array)\n const isArray = Array.isArray(preset);\n\n const name = changeName(isArray ? preset[0] : preset, 'preset');\n if (name === null || name.startsWith('@babel/preset-stage-')) {\n presets.splice(i, 1);\n i--;\n\n if (name !== null) {\n const stage = name.slice(-1);\n newPlugins.push(stagePresets[stage]);\n }\n } else {\n if (isArray) preset[0] = name;\n else preset = name;\n\n presets[i] = upgradeOptions(preset);\n }\n }\n\n if (options.hasFlow && !presets.includes('@babel/preset-flow')) {\n presets.push('@babel/preset-flow');\n }\n\n if (newPlugins.length > 0) {\n config.plugins = (config.plugins || []).concat(...newPlugins);\n }\n }\n}", "function loadPlugins() {\n\tlogger.entry(\"pluginLoader.loadPlugins\");\n\n\ttry {\n\t\tvar dir = path.resolve(__dirname, \"..\", PLUGINS_DIR);\n\t\t_loadPluginsFromDir(dir);\n\t}catch(e){\n\t\t// log and ignore\n\t\tlogger.error(\"Error loading plugins\", e);\n\t\tlogger.info(logger.Globalize.formatMessage(\"errorPluginsLoading\", e.toString()));\n\t}\n\t\n\tlogger.exit(\"pluginLoader.loadPlugins\");\t\n}", "function plugins(state = [], action) {\n switch (action.type) {\n case utils_constants__WEBPACK_IMPORTED_MODULE_1__[\"ActionTypes\"].RECEIVED_MARKETPLACE_PLUGINS:\n return action.plugins ? action.plugins : [];\n\n case utils_constants__WEBPACK_IMPORTED_MODULE_1__[\"ActionTypes\"].MODAL_CLOSE:\n if (action.modalId !== utils_constants__WEBPACK_IMPORTED_MODULE_1__[\"ModalIdentifiers\"].PLUGIN_MARKETPLACE) {\n return state;\n }\n\n return [];\n\n default:\n return state;\n }\n} // installing tracks the plugins pending installation", "function installPluginsOnInst(app){\n pluginsHelper.plugins.map(function(plugin){\n if(plugin.realtime && plugin.realtime.onAppInstance){\n plugin.realtime.onAppInstance(app);\n }\n });\n}", "registerPlugin(name, endpoints) {\n console.log('Enabling plugin: ', name);\n if (this.plugin_list.indexOf(name) >= 0) {\n debug('Plugin already enabled:', name);\n return;\n }\n this.plugin_list.push(name);\n if (endpoints.middlewares) {\n for (var mw in endpoints.middlewares) {\n for (var e = 0; e < endpoints.middlewares[mw].length; e++) {\n this.middleware[mw].use(endpoints.middlewares[mw][e]);\n }\n }\n }\n if (endpoints.init) {\n try {\n endpoints.init(this);\n }\n catch (err) {\n if (err) {\n throw new Error(err);\n }\n }\n }\n debug('Plugin Enabled: ', name);\n }", "static plugin(...newPlugins) {\n var _a;\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {\n },\n _a.plugins = currentPlugins.concat(newPlugins.filter((plugin) => !currentPlugins.includes(plugin))),\n _a);\n return NewOctokit;\n }", "function getAllPluginVersions() {\n developer.Api('/plugins/' + FS__API_PLUGIN_ID + '/tags.json', 'GET', [], [], function (e) {\n logResponse(e, developer);\n });\n}", "_addPlugins() {\n return cordova.cordova.raw.plugin('add', this.answers.plugins, { save: true })\n .then(() => {\n console.log(`add plugins ${this.answers.plugins}`);\n return true;\n })\n .catch((err) => {\n console.log(err.message);\n // process.exit();\n return err;\n });\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "static plugin(...newPlugins) {\n var _a;\n\n const currentPlugins = this.plugins;\n const NewOctokit = (_a = class extends this {}, _a.plugins = currentPlugins.concat(newPlugins.filter(plugin => !currentPlugins.includes(plugin))), _a);\n return NewOctokit;\n }", "function getPlugins(opts) {\n const plugins = new Set();\n\n const rubyPlugins = opts.rubyPlugins.trim();\n if (rubyPlugins.length > 0) {\n rubyPlugins.split(\",\").forEach((plugin) => plugins.add(plugin.trim()));\n }\n\n if (opts.rubySingleQuote) {\n plugins.add(\"plugin/single_quotes\");\n }\n\n if (opts.trailingComma !== \"none\") {\n plugins.add(\"plugin/trailing_comma\");\n }\n\n return Array.from(plugins);\n}", "applyPlugins() {\n if (!this.isAttached || !this.data) {\n return;\n }\n\n let localData = this.getDataCopy();\n\n if (this.hasFilter()) {\n localData = this.doFilter(localData);\n }\n\n if (this.sortKey && this.sortOrder !== 0) {\n this.doSort(localData, this.sortKey, this.sortOrder);\n }\n\n this.totalItems = localData.length;\n\n if (this.hasPagination()) {\n this.beforePagination = [].concat(localData);\n localData = this.doPaginate(localData);\n }\n\n this.displayData = localData;\n }", "executePlugins() {\n if (this.executedPlugins) {\n this.plugins.forEach(({ fn, options }) => {\n if (options && options.recurring) {\n fn(this, false, options);\n }\n });\n }\n else {\n this.executedPlugins = true;\n this.plugins.forEach(({ fn, options }) => {\n fn(this, true, options);\n });\n }\n }", "function PluginMgr(logger) {\n var self = this;\n this.pluginModules = {};\n this.logger = logger;\n loadPluginModuleSync(self, constants.pluginDir);\n}", "init () {\n // register default plugins\n this.apply(BasicForm.UiLibPlugin, new SchemaPlugin(), new RenderPlugin())\n\n // user defined plugins\n const plugins = this.options.plugins\n if (plugins && plugins.length > 0) {\n this.apply.apply(this, plugins)\n }\n\n /** create and render form view - without data bind */\n this.create()\n }", "function initUse(SDK) {\n SDK.use = function (plugin) {\n const installedPlugins =\n this._installedPlugins || (this._installedPlugins = []);\n\n if (installedPlugins.indexOf(plugin) > -1) {\n return this;\n }\n\n const args = [].slice.call(arguments, 1);\n args.unshift(this);\n if (plugin && typeof plugin.install === 'function') {\n plugin.install.apply(plugin, args);\n } else if (typeof plugin === 'function') {\n plugin.apply(null, args);\n }\n installedPlugins.push(plugin);\n\n return this;\n };\n }", "_initAddons() {\n //\tInvoke \"before\" hook.\n this.trigger('initAddons:before');\n for (let addon in Mmenu.addons) {\n Mmenu.addons[addon].call(this);\n }\n //\tInvoke \"after\" hook.\n this.trigger('initAddons:after');\n }" ]
[ "0.8004924", "0.6818906", "0.6514046", "0.6487034", "0.6434609", "0.624967", "0.5965147", "0.58423436", "0.58362955", "0.57685685", "0.5765481", "0.5765481", "0.56770015", "0.56763065", "0.5641679", "0.5604519", "0.5581039", "0.55783546", "0.55635864", "0.55555177", "0.5523985", "0.5465447", "0.5447501", "0.5442954", "0.54285115", "0.53695494", "0.53048044", "0.52920806", "0.5290726", "0.5290726", "0.526753", "0.52547765", "0.52154297", "0.5197521", "0.5183327", "0.5164141", "0.5158386", "0.5146116", "0.51324975", "0.51184547", "0.51134443", "0.51134443", "0.51134443", "0.50962347", "0.50928754", "0.5081228", "0.50691956", "0.50609124", "0.502222", "0.5007458", "0.49680325", "0.49649975", "0.49619615", "0.4960501", "0.4950533", "0.49281713", "0.49129397", "0.48911905", "0.48784843", "0.48663148", "0.48221576", "0.48155305", "0.4800953", "0.47965673", "0.47965673", "0.47965673", "0.47965673", "0.47965673", "0.4796251", "0.47833997", "0.47801855", "0.47801855", "0.4778157", "0.47777897", "0.47549132", "0.47540888", "0.4750385", "0.47454178", "0.47442815", "0.47287947", "0.4714422", "0.47100475", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46994147", "0.46975023", "0.4686546", "0.46863228", "0.467669", "0.46747908", "0.46676433", "0.46589473" ]
0.7972612
1
appending options in to and from
function appendCurrency(input) { var curr = input.currencies; for (key in curr) { $("#from").append( "<option value = " + key + ">" + key + " " + curr[key] + "</option>" ); } for (key in curr) { $("#to").append( "<option value = " + key + ">" + key + " " + curr[key] + "</option>" ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function copyAllOptions(from,to) {\n selectAllOptionsLeft(from);\n if (arguments.length==2) {\n copySelectedOptions(from,to);\n }\n else if (arguments.length==3) {\n copySelectedOptions(from,to,arguments[2]);\n }\n }", "combineOptions(options) {\n let defaults = {\n fitPosition: 'center center',\n addContainer: true\n };\n\n this.options = {\n ...defaults,\n ...options\n };\n }", "mergeOptions (options, notMerge, lazyUpdate) {\n this.delegateMethod('setOption', options, notMerge, lazyUpdate)\n }", "function mergeOptions(target) {\n\t\tfunction mergeIntoTarget(name,value) {\n\t\t\tif($.isPlainObject(value) && $.isPlainObject(target[name]) && !isForcedAtomicOption(name)) {\n\t\t\t\t// merge into a new object to avoid destruction\n\t\t\t\ttarget[name] = mergeOptions({}, target[name], value); // combine. `value` object takes precedence\n\t\t\t} else if (value !== undefined) { // only use values that are set and not undefined\n\t\t\t\ttarget[name] = value;\n\t\t\t}//END if\n\t\t}//END function mergeIntoTarget\n\n\t\tfor(var i=1;i<arguments.length;i++) { $.each(arguments[i],mergeIntoTarget); }\n\t\treturn target;\n\t}//END function mergeOptions", "function copySelectedOptions(from,to) {\n var options = new Object();\n if (hasOptions(to)) {\n for (var i=0; i<to.options.length; i++) {\n options[to.options[i].value] = to.options[i].text;\n }\n }\n if (!hasOptions(from)) { return; }\n for (var i=0; i<from.options.length; i++) {\n var o = from.options[i];\n if (o.selected) {\n if (options[o.value] == null || options[o.value] == \"undefined\" || options[o.value]!=o.text) {\n if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; }\n to.options[index] = new Option( o.text, o.value, false, false);\n }\n }\n }\n if ((arguments.length<3) || (arguments[2]==true)) {\n sortSelect(to);\n }\n from.selectedIndex = -1;\n to.selectedIndex = -1;\n }", "extend(options) {\n this.prepare.forEach(item => {\n if (!options[item]) throw new Error(item + ' method is not available');\n this[item] = options[item];\n });\n }", "function extend(to, from) {\n for (var key in from) {\n to[key] = from[key];\n }\n return to;\n }", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n }", "doPrepareOptions (options) {\n return Object.assign (options, {\n validRange: this.validRange\n })\n }", "function _defineMailOptions(to, from, cc, subject, body, attch) {\n\treturn {\n\t\tfrom: from,\n\t\tto: to,\n\t\tcc: cc,\n\t\tsubject: subject,\n\t\ttext: body.plainText,\n\t\thtml: body.htmlText\n\t};\n}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to\n\t}", "function extend (to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key]\n\t }\n\t return to\n\t}", "function extend(to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n }", "function extend(to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n }", "updateOptions() {\n _.append(this.modal.$element.find('.environment-to').empty(),\n _.each(this.model.settings.environments.names, (i, environment) => {\n // Filter out \"from\" environment\n if(environment != this.modal.$element.find('.environment-from').val()) {\n return _.option({value: environment}, environment); \n }\n })\n );\n }", "function extend(to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to;\n\t}", "function extend(to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to;\n\t}", "function extend(to, _from) {\n\t for (var key in _from) {\n\t to[key] = _from[key];\n\t }\n\t return to;\n\t}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n }", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n }", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n }", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n }", "function extend(to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to;\n }", "function extend(to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to;\n }", "set options(value) {}", "function extend(to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n\n return to;\n }", "function _tackOnArguments(args, from, to){\n var newArgs = [], i;\n\n for (i = from; i < to; i+=1){\n newArgs.push(args[i]);\n }\n\n return newArgs;\n }", "function generateOptions() {\n if (checkedUpper) {\n options.push(...upperCase);\n }\n if (checkedLower) {\n options.push(...lowerCase);\n }\n if (checkedSpecial) {\n options.push(...special);\n }\n if (checkedNumbers) {\n options.push(...numbers);\n }\n}", "function extend(to,_from){for(var key in _from){to[key]=_from[key];}return to;}", "function extend(to,_from){for(var key in _from){to[key]=_from[key];}return to;}", "function extend(to,_from){for(var key in _from){to[key]=_from[key];}return to;}", "function ExtraOptions(){}", "async appendFrom(source, toRemotePath, options = {}) {\n return this._uploadWithCommand(source, toRemotePath, \"APPE\", options);\n }", "function extend (to, _from) {\n for (const key in _from) {\n to[key] = _from[key]\n }\n return to\n}", "function extend (to, _from) {\r\n for (var key in _from) {\r\n to[key] = _from[key];\r\n }\r\n return to\r\n}", "function extend(to, _from) {\n\t\t for (var _key in _from) {\n\t\t to[_key] = _from[_key];\n\t\t }\n\t\t return to;\n\t\t}", "function mergeOptions(target) {\n\n\tfunction mergeIntoTarget(name, value) {\n\t\tif ($.isPlainObject(value) && $.isPlainObject(target[name]) && !isForcedAtomicOption(name)) {\n\t\t\t// merge into a new object to avoid destruction\n\t\t\ttarget[name] = mergeOptions({}, target[name], value); // combine. `value` object takes precedence\n\t\t}\n\t\telse if (value !== undefined) { // only use values that are set and not undefined\n\t\t\ttarget[name] = value;\n\t\t}\n\t}\n\n\tfor (var i=1; i<arguments.length; i++) {\n\t\t$.each(arguments[i], mergeIntoTarget);\n\t}\n\n\treturn target;\n}", "function mergeOptions(target) {\n\n\tfunction mergeIntoTarget(name, value) {\n\t\tif ($.isPlainObject(value) && $.isPlainObject(target[name]) && !isForcedAtomicOption(name)) {\n\t\t\t// merge into a new object to avoid destruction\n\t\t\ttarget[name] = mergeOptions({}, target[name], value); // combine. `value` object takes precedence\n\t\t}\n\t\telse if (value !== undefined) { // only use values that are set and not undefined\n\t\t\ttarget[name] = value;\n\t\t}\n\t}\n\n\tfor (var i=1; i<arguments.length; i++) {\n\t\t$.each(arguments[i], mergeIntoTarget);\n\t}\n\n\treturn target;\n}", "function mergeOptions(target) {\n\n\tfunction mergeIntoTarget(name, value) {\n\t\tif ($.isPlainObject(value) && $.isPlainObject(target[name]) && !isForcedAtomicOption(name)) {\n\t\t\t// merge into a new object to avoid destruction\n\t\t\ttarget[name] = mergeOptions({}, target[name], value); // combine. `value` object takes precedence\n\t\t}\n\t\telse if (value !== undefined) { // only use values that are set and not undefined\n\t\t\ttarget[name] = value;\n\t\t}\n\t}\n\n\tfor (var i=1; i<arguments.length; i++) {\n\t\t$.each(arguments[i], mergeIntoTarget);\n\t}\n\n\treturn target;\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}", "function extend (to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n return to\n}" ]
[ "0.6236526", "0.5907298", "0.58513254", "0.57572585", "0.57278323", "0.5713475", "0.5691599", "0.56842715", "0.5662344", "0.5653605", "0.5645397", "0.5645397", "0.5645397", "0.5645397", "0.5645397", "0.5645397", "0.5645397", "0.5645397", "0.5633803", "0.5622319", "0.5622319", "0.5620812", "0.5619779", "0.5619779", "0.5619779", "0.5619604", "0.5619604", "0.5619604", "0.5619604", "0.561953", "0.561953", "0.56182235", "0.5584852", "0.55500656", "0.5529191", "0.5513695", "0.5513695", "0.5513695", "0.55043966", "0.5499457", "0.54893386", "0.5464802", "0.54390705", "0.5434576", "0.5434576", "0.5434576", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366", "0.5432366" ]
0.0
-1
converting value from one currency to another
function convertCurrency(event) { $("#amountDisplay").html(""); $("#fromCurr").html(""); $("#result").html(""); $("#toCurr").html(""); event.preventDefault(); var amount = document.querySelector("#amount").value; var fromCrr = document.querySelector("#from").value; var toCrr = document.querySelector("#to").value; if (amount == "" || fromCrr == "" || toCrr == "") { alert("Can't convery if any field is blank"); } else { var result = 0; var str = ""; str = "USD" + fromCrr; str1 = "USD" + toCrr; for (key in rate) { if (key === str) { temp = (amount * 1) / rate[key]; temp = temp.toFixed(6); } } for (key in rate) { if (key === str1) { result = temp * rate[key]; result = result.toFixed(6); } } $("#amountDisplay").append(amount); $("#fromCurr").append(fromCrr); $("#result").append(result); $("#toCurr").append(toCrr); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toCurrency(){\n\n}", "function calculateConvertedCurrency() {\n\tlet fromCurr = currFrom.value;\n\tlet toCurr = currTo.value;\n\t\n\tfetch(`https://api.exchangerate-api.com/v4/latest/${fromCurr}`)\n\t\t.then(res => res.json())\n\t\t.then(res => {\n\t\tconst rate = res.rates[toCurr];\n perRate.innerText = `1 ${fromCurr} = ${rate} ${toCurr}`;\n let ans=(amountfrom.value * rate);\n\t\tamountTo.value = ans.toFixed(2);\n\t})\n}", "async convertCurrency() {\n if (this.fromVal.value <= 0) {\n this.props.CounterStore.currencyError(\"Value must be positive\");\n return;\n }\n\n try {\n var conversionFactor = await currencyRequest.currencyRequest(\n this.fromCurr.value,\n this.toCurr.value,\n );\n this.props.CounterStore.currencyError(\"\");\n this.toVal.value = (\n conversionFactor.data[\n `${this.fromCurr.value}_${this.toCurr.value}`\n ] * this.fromVal.value\n ).toFixed(2);\n } catch (error) {\n console.log(error);\n }\n }", "function convertCurrencyCalculator (value) {\n\n\n\n\t}", "function dollarToeuro() {\n var dollar2euro = 0.91;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * dollar2euro).toFixed(2);\n\n }", "function convertToCurrency(num) {\n return \"AUD \" + num.toFixed(2);\n}", "function convertsToCurrency(num1){\n\tvar currency = num1.toFixed(2);\n\treturn currency\n}", "function convertCurrency(currencyValue) {\n if (currentCurrency == \"INR\") {\n return currencyValue;\n } else if (currentCurrency == \"USD\") {\n return currencyValue / currency.USDINR;\n } else {\n return currencyValue * currency.USDJPY / currency.USDINR;\n }\n}", "function CurrencyConvert(v,idx,full) {\n if(idx==undefined) idx = 0;\n var c = CurrencyData[idx];\n v = parseInt(10000*v/c[2])/10000;\n if(v>1 && v<1000) v=parseInt(10*v)/10;\n if(v>=1000 && v<10000) v=parseInt(v/1000)+\"千\";\n else if(v>=10000 && v<100000000) v=parseInt(v/10000)+\"萬\";\n else if(v>=100000000 && v<1000000000000) v=parseInt(v/100000000)+\"億\";\n else if(v>=1000000000000) v=parseInt(v/1000000000000)+\"兆\";\n return v+(full?c[0]+c[1]:\"\");\n }", "function euroTodollar() {\n var euro2dollar = 1.10;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * euro2dollar).toFixed(2);\n\n }", "function convertRate(price) {\n if (gCurrLang === 'he') {\n return price * gExcangeRates.quotes.USDILS\n } else if (gCurrLang === 'en') {\n return price\n }\n}", "function pond2euro() {\n var pond2euro = 1.17;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * pond2euro).toFixed(2);\n\n }", "function currencyConversion(euros, exchangeRate) {\n const amount = euros * (exchangeRate / 100);\n const twoDecimal = amount.toFixed(2);\n return euros + ' ' + \"euros at an exchange rate of\" + ' ' + exchangeRate + ' ' + \"is\" + ' ' + twoDecimal + ' ' + \"U.S. dollars\";\n}", "convert() {\n return `${(this.payments.type.price[this.currencyType] / 100)}`;\n }", "function exchangeCurrency() {\n var amount = $(\".amount\").val();\n var rateFrom = $(\".currency-list\")[0].value;\n var rateTo = $(\".currency-list\")[1].value;\n if ((amount - 0) != amount || (''+amount).trim().length == 0) {\n $(\".results\").html(\"0\");\n $(\".error\").show()\n } else {\n $(\".error\").hide()\n if (amount == undefined || rateFrom == \"--Select--\" || rateTo == \"--Select--\") {\n $(\".results\").html(\"0\");\n\n } else {\n $(\".results\").html((amount * (rateTo * (1 / rateFrom))).toFixed(2));\n }\n }\n}", "function calculate() {\n const currency_one = currencyEl_one.value;\n const currency_two = currencyEl_two.value;\n\n fetch(`https://v6.exchangerate-api.com/v6/(API KEY)/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n //console.log(data.conversion_rates));\n const rate = data.conversion_rates[currency_two]\n \n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n\n amount_currency2.value = (amount_currency1.value * rate).toFixed(2)\n }\n)}", "function convertCurrencyFromPl() {\n\n event.preventDefault();\n var amount = $input.val();\n var to = $selectTo.val();\n var results = 0;\n\n if (to === \"AUD - Australia\"){\n results = amount / rate[1].bid\n } else if (to === \"CAD - Kanada\"){\n results = amount / rate[2].bid\n } else if (to === \"CHF - Szwajcaria\") {\n results = amount / rate[5].bid\n } else if (to === \"CZK - Czechy\") {\n results = amount / rate[8].bid\n } else if (to === \"DKK - Dania\") {\n results = amount / rate[9].bid\n } else if (to === \"EUR - Unia Europejska\") {\n results = amount / rate[3].bid\n } else if (to === \"GBP - Wielka Brytania\") {\n results = amount / rate[6].bid\n } else if (to === \"HUF - Węgry\") {\n results = amount / rate[4].bid\n } else if (to === \"JPY - Japonia\") {\n results = amount / rate[7].bid\n } else if (to === \"NOK - Norwegia\") {\n results = amount / rate[10].bid\n } else if (to === \"SEK - Szwecja\") {\n results = amount / rate[11].bid\n } else if (to === \"USD - USA\") {\n results = amount / rate[0].bid\n }\n\n function addResultText() {\n var $newText = $(`\n <span>${$input.val()}</span>\n <span id=\"currency\">${$selectFrom.val()}</span>\n <span>=</span>\n <span id=\"results\">${results.toFixed(2)}</span>\n <span id=\"currency\">${$selectTo.val()}</span>\n `);\n $(\".form-text-content\").empty().append($newText);\n }\n\n addResultText();\n }", "changePrice() {\n var parts = this.precio.toFixed(2).toString().split(\".\");\n var result = parts[0].replace(/\\B(?=(\\d{3})+(?=$))/g, \".\") + (parts[1] ? \",\" + parts[1] : \"\");\n return `$${result}`;\n }", "function convertCurrencies(cr1, cr2) {\n let url = `https://api.exchangeratesapi.io/latest?base=${cr1}&symbols=${cr2}`;\n let xhr = new XMLHttpRequest();\n xhr.open(\n \"GET\",\n url,\n true\n );\n xhr.onload = function() {\n if(this.status == 200) {\n let result = JSON.parse(this.responseText);\n console.log(result.rates[cr2]);\n outputExchangeRate(cr1, cr2, result.rates[cr2]);\n }\n }\n xhr.send();\n}", "function currencyConverter(from, to, amount) {\n // It's javascript convention to DECLARE variables at the top of functions\n // before they are actually DEFINED and used. This way it's easier to keep\n // track of the different scopes.\n var result, converter;\n\n // - CURRENCY_CONVERSION_MAP is being accessed like a nested Ruby hash.\n // - CURRENCY_CONVERSION_MAP[from] is an object representing all the ways to\n // convert `from` currency.\n // - CURRENCY_CONVERSION_MAP[from][to] is the anonymous function that converts\n // `from` currency into `to` currency.\n converter = CURRENCY_CONVERSION_MAP[from][to];\n result = converter(amount);\n\n // If we didn't use a constant variable here, this line would be completely\n // unclear to anyone unfamiliar with the toFixed() method!\n return result.toFixed(CURRENCY_PRECISION);\n}", "function calculate() {\n const currency_one = currencyElOne.value;\n const currency_two = currencyElTwo.value;\n\n fetch(`https://v6.exchangerate-api.com/v6/05571b97af2fc7cf2f6ca10e/latest/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.conversion_rates[currency_two];\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n\n amountElTwo.value = (amountElOne.value * rate).toFixed(2) });\n}", "function fromRUB(value, currency) {\n for (let template of templates.data.Items) {\n if (template.Id === currency) {\n return Math.round(value / template.Price);\n }\n }\n \n return value;\n}", "function convertPrice(price){\n return new Intl.NumberFormat('ru-RU').format(Math.round(price));\n}", "function Converter(currency, input) {\n\n if (isNaN(input)) {\n number.value = null;\n alert('Nazadal jsi cislo');\n }\n\n switch (currency) {\n\n case 'USD':\n\n usd = 23.61777;\n return (input / usd).toFixed(2) + ' $';\n case 'EUR':\n\n eur = 25.840273;\n return (input / eur).toFixed(2) + ' €';\n\n case 'PLN':\n\n pln = 5.89558584;\n return (input / pln).toFixed(2) + ' zł';\n }\n}", "function convertCurrency (date, baseCurr, baseAmt, convCurr, apiResponse) {\n let newAmt = baseAmt * apiResponse.rates[convCurr];\n newAmt = parseFloat((Math.round(newAmt * 100) / 100).toFixed(2));\n const reformattedResponse = {\n 'date': date,\n 'base_currency': baseCurr,\n 'base_amount': baseAmt,\n 'conversion_currency': convCurr,\n 'conversion_amount': newAmt\n };\n return reformattedResponse;\n}", "function calculate(){\n const currency_1 = currency_one.value;\n const currency_2 = currency_two.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_1}`)\n .then(res => res.json())\n .then(data => {\n // console.log(data);\n const rate = data.rates[currency_2];\n\n rateEl.innerText = `1 ${currency_1} = ${rate} ${currency_2}`\n\n amount_two.value = (amount_one.value * rate).toFixed(2);\n })\n\n \n}", "function calculate() {\n let currency1 = currencyOne.value;\n let currency2 = currencyTwo.value;\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency1}`)\n .then((res) => res.json())\n .then((res) => {\n const rate = res.rates[currency2];\n amountTwo.value = (amountOne.value * rate).toFixed(2);\n currencyText.innerHTML = `1 ${currency1} = ${rate} ${currency2} `;\n });\n}", "handleToInputChange (event) {\n const value = event.target.value;\n this.setState({to_amount: value})\n \n const {from, to} = this.state;\n const fromCurrency = this.state.currencies[from];\n const toCurrency = this.state.currencies[to];\n const rate = fromCurrency / toCurrency;\n\n const result = value * rate;\n this.setState({from_amount: result.toFixed(3)})\n }", "function CurrencyConverter(currency, original_price, sale_price) {\n this.currency = currency;\n this.original_price = original_price;\n this.sale_price = sale_price;\n this.converted_price = 0;\n this.converted_sale_price = 0;\n this.rate = 0;\n this.symbol = undefined;\n}", "function formatCurrency(num) {\n return 'PKR ' + (num).toFixed(2).replace(/\\d(?=(\\d{3})+\\.)/g, '$&,');\n}", "function changeCurrency(){\n if(document.querySelector('#currency').selectedIndex == 1){\n const x = document.querySelector('#edit-price').innerHTML;\n const xu = x.replace('£', '$');\n document.querySelector('#edit-price').innerHTML = xu;\n }\n else{\n const x = document.querySelector('#edit-price').innerHTML;\n const xu = x.replace('$', '£');\n document.querySelector('#edit-price').innerHTML = xu;\n }\n document.querySelector('#edit-price').textContent[0].replace('£', '$');\n}", "testWhatIsTheConversionRateFromEURToUSD() {\n let tenEuros = new Money(10, 'EUR')\n this.bank.addExchangeRate('EUR', 'USD', 1.2)\n assert.deepStrictEqual(\n this.bank.convert(tenEuros, 'USD'),\n new Money(12, 'USD')\n )\n }", "function numtocurrency(num) {\n num = num.toString().replace(/\\$|\\./g, '');\n\n if (isNaN(num)) num = \"0\";\n\n sign = (num == (num = Math.abs(num)));\n num = Math.floor(num * 100 + 0.50000000001);\n cents = num % 100;\n num = Math.floor(num / 100).toString();\n\n if (cents == 0) cents = '';\n else if (cents < 10) cents = \",0\" + cents;\n else cents = ',' + cents;\n\n for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)\n num = num.substring(0, num.length -(4 * i + 3)) + '.' + num.substring(num.length - (4 * i + 3));\n\n return(((sign) ? '' : '-') + num + cents);\n}", "hanleFromInputChange (event) {\n \n const value = event.target.value;\n this.setState({from_amount: value})\n\n const {from, to} = this.state;\n const fromCurrency = this.state.currencies[from];\n const toCurrency = this.state.currencies[to];\n const rate = toCurrency / fromCurrency;\n\n const result = value * rate;\n this.setState({to_amount: result.toFixed(3)})\n }", "function euroTopond() {\n var euro2pond = 0.85;\n var bedrag = document.querySelector(\"#bedrag\").value;\n\n document.getElementById(\"convert\").value = (bedrag * euro2pond).toFixed(2);\n\n }", "function convertCurrencyToPl() {\n\n event.preventDefault();\n var amount = $input.val(); // pobieranie wpisanej kwoty\n var from = $selectFrom.val(); // wybór waluty\n var results = 0;\n\n\n if (from === \"AUD - Australia\"){\n results = amount * rate[1].ask\n } else if (from === \"CAD - Kanada\"){\n results = amount * rate[2].ask\n } else if (from === \"CHF - Szwajcaria\") {\n results = amount * rate[5].ask\n } else if (from === \"CZK - Czechy\") {\n results = amount * rate[8].ask\n } else if (from === \"DKK - Dania\") {\n results = amount * rate[9].ask\n } else if (from === \"EUR - Unia Europejska\") {\n results = amount * rate[3].ask\n } else if (from === \"GBP - Wielka Brytania\") {\n results = amount * rate[6].ask\n } else if (from === \"HUF - Węgry\") {\n results = amount * rate[4].ask\n } else if (from === \"JPY - Japonia\") {\n results = amount * rate[7].ask\n } else if (from === \"NOK - Norwegia\") {\n results = amount * rate[10].ask\n } else if (from === \"SEK - Szwecja\") {\n results = amount * rate[11].ask\n } else if (from === \"USD - USA\") {\n results = amount * rate[0].ask\n }\n\n // usuwa mema i wpisuje wynik naszych obliczeń\n function addResultText() {\n var $newText = $(`\n <span>${$input.val()}</span>\n <span id=\"currency\">${$selectFrom.val()}</span>\n <span>=</span>\n <span id=\"results\">${results.toFixed(2)}</span>\n <span id=\"currency\">${$selectTo.val()}</span>\n `);\n $(\".form-text-content\").empty().append($newText);\n }\n\n addResultText();\n }", "function calculate() {\n\tconst currency1 = currencyOne.value;\n\tconst currency2 = currencyTwo.value;\n\n\tconsole.log(currency1, currency2);\n\n\tfetch(`https://api.exchangerate-api.com/v4/latest/${currency1}`)\n\t\t.then(res => res.json())\n\t\t.then(data => {\n\t\t\t//console.log(data);\n\t\t\tconst rate = data.rates[currency2];\n\n\t\t\trateElement.innerText = `1 ${currency1} = ${rate} ${currency2}`;\n\n\t\t\tamountTwo.value = (amountOne.value * rate).toFixed(2);\n\t\t});\n}", "function caclulate() {\n const currency_one = currencyEl_one.value;\n const currency_two = currencyEl_two.value;\n\n //https://cors-anywhere.herokuapp.com/\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n // console.log(data);\n const rate = data.rates[currency_two];\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n amountEl_two.value = (amountEl_one.value * rate).toFixed(2);\n });\n}", "function calculate() {\n const currencyOneCode = currencyOnePicker.value;\n const currencyTwoCode = currencyTwoPicker.value;\n fetch(`https://v6.exchangerate-api.com/v6/9edf55432e8fe53827d04461/latest/${currencyOneCode}`)\n .then(res => res.json())\n .then(data => {\n // Get the exchange Rate from API Data\n const exchangeRate = data.conversion_rates[currencyTwoCode];\n // display the Conversion Rate\n rate.innerText = `1 ${currencyOneCode} = ${exchangeRate} ${currencyTwoCode}`;\n\n // Apply Conversion Rate and Update Amount of Currency Two\n currencyTwoAmount.value = (currencyOneAmount.value * exchangeRate).toFixed(2);\n\n\n });\n\n\n}", "callback(value) {\n return formatCurrency(value, 0);\n }", "callback(value) {\n return formatCurrency(value, 4);\n }", "function calculate() {\n const currency_one = currency_El_one.value;\n const currency_two = currency_El_two.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.rates[currency_two];\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n amount_El_two.value = (amount_El_one.value*rate).toFixed(2);\n });\n}", "function currencyConversion(rates, fromTo) {\n let adjList = new Map();\n for (let rate of rates) {\n if (!adjList.has(rate[0])) adjList.set(rate[0], []);\n if (!adjList.has(rate[1])) adjList.set(rate[1], []);\n }\n for (let rate of rates) {\n adjList.get(rate[0]).push([rate[1], rate[2]]);\n adjList.get(rate[1]).push([rate[0], 1 / rate[2]]);\n }\n let ans = -1;\n let visited = new Set();\n let stack = [[fromTo[0], 1]];\n visited.add(fromTo[0]);\n while (stack.length > 0) {\n let [curr, val] = stack.pop();\n let values = adjList.get(curr);\n if (curr === fromTo[1]) {\n ans = val;\n break;\n }\n for (let i = 0; i < values.length; i++) {\n let node = values[i];\n if (visited.has(node)) continue;\n visited.add(node);\n stack.push([node[0], val * node[1]]);\n }\n }\n return ans;\n}", "function formatCurrency(val) {\n\tvar ele = new PM.OutputField();\n\tele.dataType = 'largedecimal';\n\tele.defaultValue = '0';\n\tele.formatter = 'usd';\n\tvar retVal = ele.format(val);\n\tele = null;\n\treturn retVal;\n}", "getOfflineRate(query, toCurrency) {\n return this.dbPromise.then(db => {\n return db.transaction('rates')\n .objectStore('rates').get(query);\n }).then((val) => {\n const value = document.getElementById('fromAmount').value * val;\n document.getElementById('toAmount')\n .setAttribute('value', `${toCurrency}${value.toFixed(2)}`);\n });\n }", "function getOrderCurrency(entry) {\n if (!entry) return '';\n var first_currency = entry.first.currency().to_json();\n var first_issuer = entry.first.issuer().to_json();\n var second_currency = entry.second.currency().to_json();\n var second_issuer = entry.second.issuer().to_json();\n\n var first = first_currency === 'XRP'\n ? 'XRP'\n : first_currency + '.' + first_issuer;\n\n var second = second_currency === 'XRP'\n ? 'XRP'\n : second_currency + '.' + second_issuer;\n\n var currency_pair = first + '/' + second;\n return currency_pair;\n }", "convertHandler($) {\n var convert = $.message.text.split(' ').slice(1);\n var num, con1, con2;\n\n if (isNaN(convert[0])) {\n con1 = convert[0];\n con2 = convert[2];\n } else {\n num = convert[0];\n con1 = convert[1];\n con2 = convert[3];\n }\n\n if (con1 == null || con2 == null)\n $.sendMessage('`/convert [amount] <currency> to <currency>`', {\n parse_mode: 'Markdown'\n });\n else {\n var conv1 = con1.toUpperCase();\n var conv2 = con2.toUpperCase();\n\n if (\n (conv1 == 'MXN' ||\n conv1 == 'CAD' ||\n conv1 == 'EUR' ||\n conv1 == 'USD') &&\n (conv2 == 'MXN' || conv2 == 'CAD' || conv2 == 'EUR' || conv2 == 'USD')\n ) {\n request.get('https://api.fixer.io/latest?base=' + conv1, function(\n err,\n res,\n body\n ) {\n var obj = JSON.parse(body);\n var newobj = obj.rates[conv2];\n if (num == null)\n $.sendMessage(\n '*' + add_coma_to_number(newobj.toString()) + ' ' + conv2 + '*',\n { parse_mode: 'Markdown' }\n );\n else {\n var newNum = num * newobj;\n $.sendMessage(\n '*' + add_coma_to_number(newNum.toString()) + ' ' + conv2 + '*',\n { parse_mode: 'Markdown' }\n );\n }\n });\n } else if (\n conv2 == 'MXN' ||\n conv2 == 'CAD' ||\n conv2 == 'EUR' ||\n conv2 == 'USD'\n ) {\n var coinDictionary = {};\n var dicObj = {};\n\n request.get(\n 'https://api.coinmarketcap.com/v1/ticker/?start=0&limit=0',\n function(err, res, data) {\n dicObj = JSON.parse(data);\n\n for (var i = 0; i < dicObj.length; i++) {\n coinDictionary[dicObj[i].symbol.toUpperCase()] = dicObj[i].id;\n }\n\n if (conv1 in coinDictionary) conv1 = coinDictionary[conv1];\n\n request.get(\n 'https://api.coinmarketcap.com/v1/ticker/' +\n conv1 +\n '/?convert=' +\n conv2,\n function(err, res, body) {\n var obj = JSON.parse(body);\n if (obj.error)\n return $.sendMessage(\"`'\" + conv1 + \"' doesn't exist!`\", {\n parse_mode: 'Markdown'\n });\n else {\n var conv2low = 'price_' + conv2.toLowerCase();\n var newobj = obj[0][conv2low];\n if (num == null)\n $.sendMessage(\n '*' +\n add_coma_to_number(newobj.toString()) +\n ' ' +\n conv2 +\n '*',\n { parse_mode: 'Markdown' }\n );\n else {\n var newNum = num * newobj;\n $.sendMessage(\n '*' +\n add_coma_to_number(newNum.toString()) +\n ' ' +\n conv2 +\n '*',\n { parse_mode: 'Markdown' }\n );\n }\n }\n }\n );\n }\n );\n } else\n $.sendMessage('`/convert [amount] <currency> to <currency>`', {\n parse_mode: 'Markdown'\n });\n }\n }", "function calculate() {\n const currencyOneCode = currOnePicker.value;\n const currencyTwoCode = currTwoPicker.value;\n \n fetch(`http://data.fixer.io/api/latest?access_key=aa9501d58a8b22906cf8423e472d9426/latest/${currencyOneCode}`)\n .then(res => res.json())\n .then( data => {\n //exchange rate \n const exchangerate = data.conversion_rates[currencyTwoCode];\n console.log(exchangeRate);\n\n rate.innerText = `1 ${currencyOneCode} = ${exchangeRate} ${currencyTwoCode}`;\n\n //Apply Conversion Rate \n currOneAmount.value = (currOneAmount.value * exchangeRate).toFixed(2);\n\n });\n }", "function ConvertToCurrency(value, currency, locale) {\n console.log(\"ConvertToCurrency() is deprecated, please call OutputAsCurrency() instead\");\n return OutputAsCurrency(value, currency, locale);\n}", "changeBaseCurrency() {\n this.setBaseCurrency( event.target.innerText );\n }", "function changeCurrency(e) {\n console.log(\"value \", e.value);\n\n setCurCurrency(e.value);\n }", "function perevod(money, currency, crypt)\n{\n //console.log(CURRENCY_DATA[crypt][currency])\n var result = money*0.9/CURRENCY_DATA[crypt][currency]\n $(\"#result\").attr(\"value\", result)\n}", "function calculate() {\n \n const currone = currOnePicker.value;\n const currtwo = currTwoPicker.value;\n \n fetch(`https://v6.exchangerate-api.com/v6/e5fb6e78d4418611a6b4f55b/latest/${currone}`)\n .then( res => res.json() )\n .then( data => {\n \n const exchangeRate = data.conversion_rates[currtwo];\n //Display conversion rate\n rate.innerHTML = `1 ${currone} = ${exchangeRate} ${currtwo}`;\n });\n \n//Apply conversion rate two\n amounttwo.value = (amountone.value * exchangeRate).tofixed(2);\n}", "formatCurrency(value) {\n // get signal\n const signal = Number(value) < 0 ? '-' : ''\n //clean string\n // \\D -> Encontre tudo que náo é number\n value = String(value).replace(/\\D/g, '')\n // convert \n value = Number(value) / 100\n value = value.toLocaleString(\"pt-BR\", {\n style: \"currency\",\n currency: \"BRL\"\n })\n\n return signal + value\n }", "function calculateUSD() {\n\t\tmodelPriceUSD = modelPrice / uahUsdRate;\n\t\tmodelPriceUSD = modelPriceUSD.toFixed(2);\n\n\t\tmodelPriceUsdHolder.text(\"$ \" + addSpace(modelPriceUSD));\n\t}", "function ConverterEuro() {\n var valorElemento = document.getElementById(\"valor\");\n var valor = valorElemento.value;\n var valorEmDolarNumerico = parseFloat(valor);\n var valorEmEuro = valorEmDolarNumerico * 0.85;\n var elementoValorConvertio = document.getElementById(\"valorConvertido\");\n var valorConvertido = \"O resultado em euro é € \" + valorEmEuro + \".\";\n elementoValorConvertio.innerHTML = valorConvertido;\n}", "function inRUB(value, currency) {\n for (let template of templates.data.Items) {\n if (template.Id === currency) {\n return Math.round(value * template.Price);\n }\n }\n \n return value;\n}", "function currency (value){\n return '$ ' + value\n .toFixed(2)\n .replace(/(\\d)(?=(\\d{3})+\\.)/g, '$1,').replace('.00', '')\n }", "function convertToUSDWithCommas(num) {\n numString = num.toFixed(2).replace(/(\\d)(?=(\\d{3})+\\.)/g, '$1,');\n numString = \"$\" + numString;\n return numString;\n}", "function revod(result, currency, crypt)\n{\n var money = result*CURRENCY_DATA[crypt][currency]/0.9\n $(\"#moneyCash\").attr(\"value\", money)\n}", "handleCurrencyConversion() {\n let endpointURL = 'http://data.fixer.io/api/latest?access_key=b831ee4392d4f2acf242d71c8e9c0755&base=' \n + this.sellCurrencyValue + '&symbols=' + this.buyCurrencyValue;\n \n // calling apex class method to make callout\n getCurrencyData({strEndPointURL : endpointURL})\n .then(data => {\n\n window.console.log('jsonResponse ===> '+JSON.stringify(data));\n\n // retriving the response data\n let exchangeData = data['rates'];\n \n this.rate = exchangeData[this.buyCurrencyValue];\n\n if(this.rate && this.sellAmountValue){\n this.buyAmountValue = (this.sellAmountValue * this.rate).toFixed(2);\n } else {\n this.buyAmountValue = null;\n }\n\n })\n .catch(error => {\n window.console.log('callout error ===> '+JSON.stringify(error));\n })\n }", "function convertMoney(num){\n\n inputdollar = document.forms[0].inputdollar.value;\n var euro = inputdollar * .883785;\n var inputString = \"You entered $\" + inputdollar + \" USD\" + \"</br>\";\n var convertString = \"You exchanged $\" + inputdollar + \" U.S. Dollars for $\" + euro.toFixed(2) + \" Euros\" + \"</br>\";\n var outPutString = inputString + convertString;\n document.getElementById('moneyForm').innerHTML = outPutString;\n}", "USD(b) {\n if (!b) { return '0.00' }\n else {\n // BOLT has 8 decimals right now\n b /= Math.pow(10, 8);\n b = b.toFixed(2)\n return String(b)\n }\n }", "function calculate() {\n const currency_one = currencyEl_one.value;\n const currency_two = currencyEl_two.value;\n\n console.log('one', currency_one, 'dos', currency_two);\n fetch(`https://v6.exchangerate-api.com/v6/APIKEy/latest/${currency_one}`)\n .then((res) => res.json())\n .then((data) => {\n const rate = data.conversion_rates[currency_two];\n console.log('🚀 ~ file: script.js ~ line 22 ~ .then ~ rate', rate);\n\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`;\n amount_two.value = (amount_one.value * rate).toFixed(2);\n });\n}", "function calculate() {\r\n /**\r\n * firstly take the value of the currency one so we put ${currency_one} after the api link\r\n * in this case preselected value is usd dollar but we can select which we want\r\n * all currency value are in id currency-one.\r\n * we convert the value in json format in res and then extract the data from it \r\n * \r\n */\r\n const currency_one = currencyEl_one.value; // take the currency value \r\n const currency_two = currencyEl_two.value;\r\n\r\n fetch('Currencies_Values.json')\r\n .then(res => res.json())\r\n .then(data => {\r\n //const rate = extract values of the currencies two from rates in api.exchange \r\n const rate = data.rates[currency_two];\r\n const rate1 = data.rates[currency_one];\r\n \r\n \r\n // rateE1 is to display the result of exchange\r\n \r\n \r\n /**\r\n * according the selected currencies the amount_two value is equal\r\n * to the value of input 1 per rate which is value is from api.exchange\r\n * tpFixed(2) means 2 numbers after the comma\r\n * \r\n */\r\n const base = 'XOF'\r\n const cfa = 5/`${rate1}`;\r\n if(currency_one === base){\r\n \r\n rateEl.innerText = `5 ${currency_one} = ${rate.toFixed(5)} ${currency_two} `;\r\n\r\n };\r\n if(currency_one !== base && currency_two=== base){ \r\n rateEl.innerText = `1 ${currency_one} = ${cfa.toFixed(3)} ${currency_two}` ;\r\n };\r\n\r\n //amountEl_two.value = ((amountEl_one.value * rate)).toFixed(2);\r\n if(currency_one === base && currency_two!== base) {\r\n amountEl_two.value = ((amountEl_one.value * rate)/5).toFixed(3); \r\n }else{\r\n amountEl_two.value = ((amountEl_one.value * cfa).toFixed(3)); \r\n };\r\n if(currency_one === base && currency_two=== base){\r\n rateEl.innerText = `5 ${currency_one} = 5 ${currency_two} `;\r\n amountEl_two.value = amountEl_one.value ; \r\n }\r\n })\r\n \r\n }", "function convertPrice(formatPrice){\n\tstr = formatPrice.substring(0,formatPrice.length - 4);\n \tstr1 = str.replace('.','');\n \tstr2 = str1.replace('.','');\n \tstr3 = str2.replace('.','');\n \t\n \treturn str3;\n}", "function calculate() {\n /*fetch(\"assets/items.json\")\n .then(res => res.json())\n .then(data => console.log(data));*/\n\n const currency1 = currency_one.value;\n const currency2 = currency_two.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency1}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.rates[currency2];\n rateEl.innerText = `1 ${currency1} = ${rate} ${currency2} `;\n amount_two.value = (amount_one.value * rate).toFixed(2);\n });\n}", "function convertToCents (amount) {\n amount = amount.replace('.', '')\n return parseInt(amount)\n }", "function currency ( value ) {\n\treturn \"£\" + _number(value);\n}", "registerConvert() {\n\t\tlet fields = this.container.find('.js-currencyc_value');\n\t\tfields.on('keyup focusout', (e) => {\n\t\t\tlet value = App.Fields.Double.formatToDb(e.currentTarget.value);\n\t\t\tlet currentCurrencyData = $(e.currentTarget).parent().find('.js-currencyc_list option:selected').data();\n\t\t\tfields.each((_n, ve) => {\n\t\t\t\tlet currencyData = $(ve).parent().find('.js-currencyc_list option:selected').data();\n\t\t\t\tif (currentCurrencyData.currencyId === currencyData.currencyId) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$(ve).val(\n\t\t\t\t\tApp.Fields.Double.formatToDisplay((value * currencyData.conversionRate) / currentCurrencyData.conversionRate),\n\t\t\t\t\tfalse\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t}", "function getAmountInCurrency(price, currency, convertFromEuro) {\n return currency in price ?\n price[currency] :\n convertFromEuro(price[\"eur\"], currency);\n }", "function change(val){\r\n \tval = Ext.util.Format.currency(val,' TL',2,true);\r\n return val;\r\n }", "function double_money(){\n arr.forEach(y=>{\n y.wealth=y.wealth.replace(',','')\n y.wealth=y.wealth.replace('$','')\n })\n arr.forEach(x=>{\n x.wealth='$'+(parseInt(x.wealth)*2).toString()+'.00';\n })\n }", "function convert(rate) {\n rate = rate / 100;\n return rate;\n}", "function Usdswedish(){\n var englishInputMoney = document.getElementById(\"usdTwo\").value;\n var valueSwedishMoneyOfOneSek = 8.95;\n var x=3;\n var y =5;\n if ( x<y){\n var totalMoneyToSwedish= englishInputMoney * valueSwedishMoneyOfOneSek;\n var swedishInputMoney = document.getElementById(\"swedishSekTwo\").value = totalMoneyToSwedish ;\n }\n}", "function caclulate()\r\n{\r\n //Passinput Values from the DOM into the Function\r\n const currency_one = currencyEl_one.value;\r\n const currency_two = currencyEl_two.value;\r\n\r\n fetch(`https://api.exchangerate-api.com/v4/latest/${currency_one}`)\r\n .then(res => res.json())\r\n .then(data => {\r\n // console.log(data);\r\n const rate = data.rates[currency_two];\r\n\r\n rateEl.innerText = `1 ${currency_one} = ${rate} ${currency_two}`; // [1] [USD] = [8.52] [TRY]\r\n\r\n amountEl_two.value = (amountEl_one.value * rate).toFixed(2); // toFixed(2) for Decimal Values\r\n });\r\n}", "setFromCurrencyValue(amount) {\n this.amountFromField.sendKeys(amount);\n }", "function convertCurr(cb){\n\t\tlet salUSD = [];\n\t\tfor (let i =0; i< values.array.length;i++) {\n\t\t\tlet salary = values.array[i].salaryInIDR;\n\t\t\tsalUSD[i] = {\n\t\t\t\tid: values.array[i].id,\n\t\t\t\tsalaryInUSD: 0\n\t\t\t}\n\t\t\tconvertCurrency(salary, 'IDR', 'USD', function(err, amount) {\n\t\t\t\tsalUSD[i].salaryInUSD = amount;\n\n\t\t\t\tif(i == values.array.length - 1){\n\t\t\t\t\tcb(salUSD)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n }", "function convertCurrency(){\n var from = document.getElementById('from').value;\n var to = document.getElementById('to').value;\n var amount = document.getElementById('amount').value;\n var http = new XMLHttpRequest();\n http.onreadystatechange=function(){\n if(http.readyState==4 && http.status==200){\n var obj = JSON.parse(this.responseText);\n var curr= obj.rates[to];\n var curr2= obj.rates[from];\n if(curr && curr2!= undefined){\n result = parseFloat(amount)*parseFloat(curr)/parseFloat(curr2);\n document.getElementById(\"show\").innerHTML = '<b> Convertion Result: '+result+' '+to+'</b> ';\n }\n }\n }\n http.open('GET', 'http://data.fixer.io/api/latest?access_key=f81ccb6d0c03d40e55cbf7817030f9a7&base'+from+'&symbols'+to, true);\n http.send();\n}", "function formatUSCurrency(val) {\r\n return val.toLocaleString('en-US',\r\n {style: \"currency\", currency: \"USD\"});\r\n}", "function roundCurrency(amount) {\n return Math.round(amount * 100)/ 100;\n\n}", "function priceConversion(productPrice) {\n return Intl.NumberFormat(\"fr-FR\", {\n style: \"currency\",\n currency: \"EUR\",\n minimumFractionDigits: 2,\n }).format(`${productPrice}` / 100);\n}", "function formatCurrency(number){\n return \"$\"+number+\".00\"\n}", "function calculate() {\n const currencyOneCode = counOnePicker.value;\n const currencyTwoCode = counTwoPicker.value;\n\n fetch(\n `https://v6.exchangerate-api.com/v6/3ad96735c5ff3277ba8a670e/latest/${currencyOneCode}`) \n .then( res => res.json() )\n .then( data => {\n\n // Get the Exchange Rate from API data\n const exchangeRate = data.conversion_rates[currencyTwoCode];\n\n // Display Conversion Rates\n rate.innerText = `1 ${currencyOneCode} = ${exchangeRate} ${currencyTwoCode}`;\n \n // Apply Conversion Rates & Update Target Currency Amount\n counAmountTwo.value = (counAmountOne.value * `${exchangeRate}`).toFixed(2);\n \n }\n );\n \n}", "function convertValue() {\n\n \n\nlet askValue = Number(prompt('Please type your value to convert.'));\n\n\nif ((isNaN(askValue)) || (askValue.length === 0)) {\n\n askValue = Number(prompt('Please type a correct value.'));\n}\nelse {\n\nalert('Number is correct.')\n}\n\n askcurrencyFrom = prompt('Please select a proper currency 1: UAH, USD, RUB.');\n \n\n\n\n askcurrencyTo = prompt('Please select the proper currency 2: UAH, USD, RUB.'),\n\n UAH = ' UAH ',\n RUB = ' RUB ',\n USD = ' USD ',\n\n showResult = document.getElementsByTagName ('p')[0];\n\n\n\n if ((askcurrencyFrom.toUpperCase() === 'RUB') && (askcurrencyTo.toUpperCase() === 'UAH')) {\n \n calculateRUB = Math.round(askValue / 0.40);\n alert('From' + ' ' + askValue + RUB + ' ' + 'result will be' + ' ' + calculateRUB + UAH);\n showResult.innerHTML = ('From' + ' ' + askValue + RUB + 'result will be' + ' ' + calculateRUB + UAH);\n }\n\n else if ((askcurrencyFrom.toUpperCase() === 'UAH') && (askcurrencyTo.toUpperCase() === 'RUB')) {\n \n calculateUAH = Math.round(askValue * 0.40);\n alert('From' + ' ' + askValue + UAH + ' ' + 'result will be' + ' ' + calculateUAH + RUB);\n showResult.innerHTML = ('From' + ' ' + askValue + UAH + 'result will be' + ' ' + calculateUAH + RUB);\n }\n\n else if ((askcurrencyFrom.toUpperCase() === 'RUB') && (askcurrencyTo.toUpperCase() === 'USD')) {\n \n calculateUSDRUB = Math.round(askValue * 27.62);\n alert('From' + ' ' + askValue + RUB + ' ' + 'result will be' + ' ' + calculateUSDRUB + USD);\n showResult.innerHTML = ('From' + ' ' + askValue + RUB + 'result will be' + ' ' + calculateUSDRUB + USD);\n }\n\n else if ((askcurrencyFrom.toUpperCase() === 'USD') && (askcurrencyTo.toUpperCase() === 'RUB')) {\n \n calculateRUBUSD = Math.round(askValue * 27.62);\n alert('From' + ' ' + askValue + USD + ' ' + 'result will be' + ' ' + calculateRUBUSD + RUB);\n showResult.innerHTML = ('From' + ' ' + askValue + USD + 'result will be' + ' ' + calculateRUBUSD + RUB);\n }\n\n else if ((askcurrencyFrom.toUpperCase() === 'UAH') && (askcurrencyTo.toUpperCase() === 'USD')) {\n \n calculateUAHUSD = Math.round(askValue * 27.62);\n alert('From' + ' ' + askValue + UAH + ' ' + 'result will be' + ' ' + calculateUAHUSD + USD);\n showResult.innerHTML = ('From' + ' ' + askValue + UAH + 'result will be' + ' ' + calculateUAHUSD + USD);\n }\n\n else if ((askcurrencyFrom.toUpperCase() === 'USD') && (askcurrencyTo.toUpperCase() === 'UAH')) {\n \n calculateUSDUAH = Math.round(askValue * 27.62);\n alert('From' + ' ' + askValue + USD + ' ' + 'result will be' + ' ' + calculateUSDUAH + UAH);\n showResult.innerHTML = ('From' + ' ' + askValue + USD + 'result will be' + ' ' + calculateUSDUAH + UAH);\n }\n else {\n\n alert('Fuck you!');\n\n }\n \n\n if (confirm('Would you like to continue? Press Yes or No.')){\n alert(`Sure, let's do it again.`)\n return convertValue();\n \n }\n\n else {\n\n alert('Fuck you!');\n }\n\n}", "function convertMoney(money) {\n return `$ ${money.toFixed(2).toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\")}`\n}", "function calculate() {\n const calculate_One = currency_One.value;\n const calculate_Two = currency_Two.value;\n\n fetch(`${API_LINK}${calculate_One}`)\n .then(res => res.json())\n .then(data => {\n // console.log(data);\n const rate = data.rates[calculate_Two];\n\n rateTotal.innerText = `1 ${calculate_One} = ${rate} ${calculate_Two}`;\n\n amount_Two.value = (amount_One.value * rate).toFixed(2);\n });\n}", "function inrToUsdConvert(){\n\tvar xhttp= new XMLHttpRequest();\n\txhttp.onreadystatechange = function(){\n\t\tif(this.readyState == 4 && this.status == 200){\n\t\t\tvar apiData =JSON.parse(this.responseText);\n\t\t\tvar rupeeData = 0.0;\n\t\t\tvar newValue=0.0;\n\t\t\tvar updateAmount=0.0;\n\n\t\t\trupeeData=document.getElementById('rupees').value;\n\t\t\tnewValue=apiData.rates.USD;\n\t\t\tupdateAmount =rupeeData * newValue;\n\t\t\t\n\t\t\tdocument.getElementById('dollar').value = updateAmount;\t\t \n\t\t}\n\t};\n\txhttp.open(\"GET\",'https://api.fixer.io/latest?base=INR&symbols=USD',true);\n\txhttp.send();\n}", "function usdfunc()\r\n{\r\n inr.value = parseFloat(usd.value) * 2.03032;\r\n eur.value = parseFloat(usd.value) * 1.41544;\r\n cad.value = parseFloat(usd.value) * 1.01941;\r\n aud.value = parseFloat(usd.value) * 0.88297;\r\n}", "function convertCurrency(){\n const from = document.getElementById('from').value;\n const to = document.getElementById('from').value;\n const amount = document.getElementById('amount').value;\n const result = document.getElementById('result');\n\n if(from.length > 0 && to.length > 0 && amount.length > 0) {\n const xHttp = new XMLHttpRequest();\n xHttp.onreadystatechange = function(){\n if(xHttp.readyState == 4 && xHttp.status == 200) {\n const obj = JSON.parse(this.responseText);\n const fact = parseFloat(obj.rates[from]);\n if(fact!=undefined){\n result.innerHTML = parseFloat(amount) * fact;\n }\n }\n }\n xHttp.open('GET', 'http://api.fixer.io/latest?base=' + from + '&symbols=' + to, true);\n xHttp.send();\n }\n}", "function formatCurrency(num) {\nnum = num.toString().replace(/\\$|\\,/g,'');\nif(isNaN(num))\nnum = \"0\";\nsign = (num == (num = Math.abs(num)));\nnum = Math.floor(num*100+0.50000000001);\ncents = num%100;\nnum = Math.floor(num/100).toString();\nif(cents<10)\ncents = \"0\" + cents;\nfor (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)\nnum = num.substring(0,num.length-(4*i+3))+','+\nnum.substring(num.length-(4*i+3));\nreturn (((sign)?'':'-') + num + '.' + cents);\n}", "function calculateRates() {\n const curOne = $currencyOne.value;\n const curTwo = $currencyTwo.value;\n\n fetch(`https://api.exchangerate-api.com/v4/latest/${curOne}`)\n .then(res => res.json())\n .then(data => {\n const rate = data.rates[curTwo];\n $rate.innerText = `1 ${curOne} = ${rate} ${curTwo}`;\n $amountTwo.value = ($amountOne.value * rate).toFixed(2);\n });\n}", "function convert(montantTtc, tauxDollar = 1.1032 ){\n return montantTtc * tauxDollar;\n}", "function CalcExchangeRate() {\n var newCurr = $('#newCurrency').val();\n var oldCurr = $('#currCurrency').val();\n var exchangeRate = newCurr / oldCurr;\n\n return exchangeRate.toFixed(4);\n}", "function getRoundedCurrency(value) {\n\tvalue = parseFloat(value);\n\tvalue = value.toFixed(2);\n\treturn value;\n}", "function centsToDollars(num){\n return num / 100; \n}", "function makeItCurrency(myNumber) {\r\n var myFormat = formati.getCurrencyFormatter({currency: \"AUD\"});\r\n var newCur = myFormat.format({\r\n number: myNumber\r\n });\r\n return newCur;\r\n }", "function getConverter(getRates){\n var fx = require(\"money\");\n fx.rates = {\n \"AUD\": 1.3,\n \"USD\": 1\n }\n fx.base = \"USD\"\n fx.settings = {\n from: \"USD\",\n to: \"AUD\"\n }\n if(getRates){\n request('https://openexchangerates.org/api/latest.json?app_id=18e01813d9694849a877e30fd1db3284')\n .then(function (resp){\n var data = JSON.parse(resp)\n fx.rates = data.rates\n })\n }\n return fx\n}", "amountOfCurrency() {\r\n let id = this.props.currency.id;\r\n let amount = this.state.product.prices[id].amount;\r\n return getFormattedCurrency(this.props.currency.name, amount);\r\n }", "function Currency(str) {\n str = str - -0.5;\n var arr = new String(str);\n var arr1 = '';\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] != '.') {\n arr1 = arr1 + arr[i];\n }\n else {\n if (arr[i + 1] >= '5') {\n arr1[i] = arr[i] - -1;\n }\n break;\n }\n }\n var Gia = \"\";\n var dem = 0;\n for (var i = arr1.length - 1; i >= 0; i--) {\n dem++;\n Gia = Gia + arr1[i];\n if (dem == 3 && i != 0) {\n Gia = Gia + \",\";\n dem = 0;\n }\n }\n var arr2 = new String(Gia);\n var GiaMoi = '';\n for (var i = arr2.length - 1; i >= 0; i--) {\n GiaMoi = GiaMoi + arr2[i];\n }\n return GiaMoi;\n }" ]
[ "0.7634135", "0.75559753", "0.7532878", "0.73953235", "0.73684686", "0.71612424", "0.708507", "0.6964059", "0.69600946", "0.69377804", "0.68886393", "0.6878825", "0.67927736", "0.669951", "0.66525894", "0.6634507", "0.6598264", "0.6593655", "0.65921944", "0.65058357", "0.64976835", "0.64646745", "0.64634144", "0.64551777", "0.6455134", "0.6453146", "0.6449559", "0.64422905", "0.64387643", "0.64317507", "0.6392593", "0.6381928", "0.63807476", "0.63725835", "0.6360914", "0.6356254", "0.63558656", "0.63514525", "0.6315732", "0.6312542", "0.62930286", "0.6282782", "0.6282688", "0.6278306", "0.62559146", "0.62517494", "0.6223275", "0.62198555", "0.62108225", "0.620646", "0.6204856", "0.62031317", "0.620173", "0.62012935", "0.6201024", "0.61898506", "0.6189775", "0.6189627", "0.6188173", "0.61774087", "0.6173071", "0.6161708", "0.6150338", "0.6146064", "0.61353266", "0.61324984", "0.6123942", "0.6116877", "0.6112611", "0.6112497", "0.6103772", "0.6099169", "0.6097469", "0.6094519", "0.6080413", "0.60784173", "0.6075283", "0.6074281", "0.6072078", "0.6070079", "0.6069556", "0.60694087", "0.60630393", "0.6053021", "0.60474455", "0.60466486", "0.6046418", "0.6045309", "0.60421574", "0.6040194", "0.6038702", "0.60253125", "0.60217685", "0.60181034", "0.60079974", "0.600665", "0.6003587", "0.6000275", "0.59934926", "0.59916383" ]
0.67526597
13
document.getElementById("demo").innerHTML = "Paragraph changed."; }
function testFunction() { console.log("Hello World"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function paragraph_changer(){\r\n\tdocument.getElementById('demo').innerHTML=\"The p-tag has been changed\"\r\n}", "function changePcontent() {\n let changeP = document.querySelector(\"div p\");\n changeP.innerText = \"now its changed\";\n}", "function change(){\n document.getElementsByTagName(\"p\")[1].innerHTML = \"new paragraph\";\n}", "function changeText(){\n let element = document.getElementById(\"demo\");\n \n if (element.innerHTML == \"Hello\") {\n element.innerHTML = \"bye\";\n }\n else {\n element.innerHTML = \"Hello\"\n }\n}", "function change() {\n // The context for this function is automatically bound by p5 the the DOM element\n this.html(\"There I go.\");\n\n // For use with div.elt.addEventListener()\n // this.innerHTML = \"There I go.\";\n}", "function replaceFirstParagraph() {\n console.log(\"inside replaceFirstParagraph function\");\n var firstParagraph;\n\n firstParagraph = document.getElementById(\"firstParagraph\");\n\n firstParagraph.innerHTML = \"My New Paragraph Data\";\n }", "function changeText(value) {\ndocument.getElementById('pText').innerHTML = value;\n\n}", "function buttonClick2() {\n document.getElementById(\"textclick\").innerHTML = \"Text Changed\";\n}", "function changeText(id) {\n id.innerHTML = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est quos inventore enim ab similique possimus voluptatibus laboriosam sint. Numquam temporibus, facilis maiores laborum nulla repellendus nesciunt labore ipsa atque ad.'\n}", "function changeContent(element, message)\n {\n \telement.innerHTML = message;\n }", "function myFunction(){\n\t\tdocument.getElementById(\"demo\").innerHTML=\"Mi primer parrafo en Javascript\";\n\t}", "function changePcontent(){\n let parapgraphs = document.querySelectorAll('div p') \n for (let i = 0; i < parapgraphs.length; i++) {\n parapgraphs[i].innerText = 'Paragraph text changed using the changePcontent function'\n }\n }", "function myfunction() {\n\tdocument.getElementById(\"demo1\").innerHTML=\"Hoje o dia está bonito\";\n}", "function demo3(){\n let p = document.getElementById('demo3');\n p.innerHTML = \"Exempel på DOM Standard Events.\";\n}", "function chText() {\n\tidpar = document.getElementById(\"idPar\")\n idpar.innerHTML = \"New text for Last Paragraph.\"\n}", "function change_heading() {\n let heading = document.getElementById('heading');\n heading.innerHTML = \"Learning Javascrtipt is Fun!!! - Changed the heading\"\n}", "function onClickTextEjercise5() {\n document.querySelector(\"#text-exercise-5\").innerHTML =\n \"5. This text was changed!!\";\n}", "function resetText(newText) {\n myParagraph.innerHTML = newText;\n}", "function changeText(){\n\tdocument.getElementById(\"l3\").textContent = \"Positive\";\n\n}", "function TestJava() {\n \n var test = document.getElementById(\"maBalise\");\n if (test != null) {\n test.innerHTML = \"<p><strong>Hello Java</strong></p>\";\n }\n else {\n console.log(\"TestJava\");\n }\n}", "function myHello(){\r\n document.getElementById(\"ex10-1\").innerHTML = \"Hello JavaScript\";\r\n}", "function setText(text) {\n document.getElementById(\"result\").innerHTML = text;\n}", "function displayGreeting () {\n //change the textContent property of the paragraph object\n outputMsg.textContent = \"Hello \" + inputField.value + \"!\";\n}", "function displayParagraph(receivedText) {\n myParagraph.innerHTML = receivedText;\n}", "function changePcontent(){\n let selectPofDivs = document.querySelector(\"div p\")\n selectPofDivs.innerText = \"This is a short Lorem Ipsummmmmmmmmm... who cares :) !\"\n }", "function changeText(id, txt) {\n document.getElementById(id).innerHTML = txt;\n}", "changeText(val){\r\n this.textlogoid.innerHTML = val;\r\n}", "function change_text(id) {\n id.innerHTML = 'You Clicked me';\n}", "function changeText(id, text) {\n\tvar element = document.getElementById(id);\n\telement.innerHTML = text;\n}", "function cText(element, content) {\r\n document.getElementById(element).innerHTML = content;\r\n}", "function outputReplace (target, content) { //Replaces existing target content with new content\n document.getElementById(target).innerHTML = content;\n}", "function changeme (id, txt) {\n document.getElementById(id).innerHTML = txt;\n}", "function buttonClick() {\n var element = document\n // .getElementById('some-paragraph')\n .querySelector('#some-paragraph')\n// console.log(element.innerHTML);\n// console.log(element.innerText);\n if(element.innerText == 'foo') {\n element.innerText = 'bar';\n } else {\n element.innerText = 'foo';\n }\n}", "function updateMistakes() {\r\n document.getElementById('mistakes').innerHTML = mistakes;\r\n}", "function updateOutput(el, val) {\n el.textContent = val;\n}", "function showOutput(text) {\n document.getElementById('output').innerHTML = text;\n}", "function myText(text){\r\n document.getElementById(\"ex10-3\").innerHTML = text;\r\n}", "function setContent(id, content) {\n document.getElementById(id).innerHTML = content\n}", "function setMessage (msg){\n document.getElementById(\"message\").innerHTML=msg;\n}", "function mostrarPregunta1(texto) {\r\n document.getElementById(\"p01\").innerHTML = texto;\r\n}", "function change() {\n document.getElementById(\"show1\").innerHTML = \"I want to travel the world without using my own money. Laos, Malaysia and Thailand have been countries I've been to without the need to spend money. If you want to travel around Thailand, just tell me. I can be your guide because I have lived there for a year.\";\n document.getElementById(\"show1\").style.color=\"black\";\n document.getElementById(\"show1\").style.backgroundColor=\"yellow\";\n}", "function updateText(){\n // CODE GOES HERE\n //console.log(\"Working\");\n\n //get the value from the html element\n let text = document.getElementById('text-input').value;\n\n // change the value from the formmated text\n document.getElementById('text-output').innerText = text;\n}", "function addNewText() {\n // making a new element object\n let newElement = document.createElement(\"p\");\n // modifying its contents\n newElement.innerHTML = \"new element\";\n // appending it to the end of the body\n document.body.appendChild(newElement);\n }", "function changeText(id) {\n id.style.color = 'green';\n id.innerHTML = 'Eat your vegetables!'\n}", "function parg(e){\n var edittext = \"Lorem ipsum dolor sit amet dolor ilet lorime aop hos hyteo sjaloe\";\n document.getElementById(\"parg\").innerHTML = edittext;\n}", "function kungfu(){\n document.getElementById(\"beWater\").innerHTML = \"My name is Lee, Brrruuuce Lee!\";\n }", "function readMore() {\n\n var text1 = \"which can be used to design program how the web pages behave on the occurrence of an event. JavaScript is an easy to learn and also powerful scripting language, widely used for controlling web page behavior.\";\n\n var paragraph = document.getElementById('para');\n paragraph.innerHTML = text1;\n}", "function kungfu(){\n document.getElementById('beWater').innerHTML = \"My name is Lee, Brrruuuce Lee!\";\n }", "function log(txt) {\n old = document.getElementById(\"test_log\").innerHTML;\n document.getElementById(\"test_log\").innerHTML = old + \"<br>\" + txt;\n}", "function sample2_4_1() {\n var textarea = document.getElementById('textarea');\n var content = document.getElementById('content');\n var value = textarea.value;\n content.innerHTML = value;\n}", "function changeText() {\n \n }", "function ftest(name) {\n document.getElementById(name).innerHTML = \"changed!\";\n}", "function titleChangeOne(){\n pTag.textContent = \"1\"\n}", "function displayContents(txt) {\n var el = document.getElementById('main');\n el.innerHTML = txt; //display output in DOM\n}", "function changeFormat() {\n document.getElementById(\"formatP2\").innerHTML = \"This is the newly formatted paragraph, complete with <br>color change, font change, and <b>bolded letters.</b> Also, <br>notice how the list below changed as well.\"\n document.getElementById(\"formatP2\").style = \"color:#6600cc; font-family:serif\"\n document.getElementById(\"formatL2\").style = \"color:#6600cc; font-family:serif\"\n document.getElementById(\"formatL2\").type = \"A\"\n}", "function setMessage(msg){\n document.getElementById(\"message\").innerHTML = msg;\n}", "function changeInnerHTML() {\n\tlist[0].innerHTML = \"Click ME!\";\n}", "function text(str: string) {\n document.querySelector('p').textContent = str;\n}", "function myf(){\n // document.getElementById(\"load\").innerHTML = \"WWWw\";\n }", "function replaceWText() {\n $('#randPara').html('<h1> Hello </h1>')\n}", "function boom() {\n var paragraph = document.createElement('p');\n paragraph.textContent = 'boom!';\n document.getElementById('content').appendChild(paragraph);\n}", "function output(content) {\n document.getElementById(\"display1\").innerHTML = content;\n}", "function setMessage(msg) {\n document.getElementById(\"message\").innerText = msg;\n}", "function changeText() {\n document.getElementById(\"p1\").style.fontSize = \"7em\";\n document.getElementById(\"p1\").style.fontStyle = \"italic\";\n document.getElementById(\"p1\").style.backgroundColor = \"blue\";\n document.getElementById(\"p1\").style.fontWeight = \"bold\";\n}", "function setInnerHTMLText (sentenceID, text) {\n document.getElementById(sentenceID).innerHTML = text; \n}", "function adjustSentence(sentence) {\n document.getElementById(\"sentenceValue\").innerHTML = sentence;\n}", "function update(){\n let value = document.getElementById(\"input\").value;\n document.getElementById(\"demo\").innerHTML = value;\n }", "function setHtmlDetails(text){\n\n document.getElementById(\"where\").innerHTML = text;\n}", "function titleChangeTwo(){\n pTag.textContent = \"2\"\n}", "function commitChanges() {\n if (editingSlide) {\n editingSlide.querySelector('.kreator-slide-content').innerHTML = editor.getHTML();\n }\n}", "function redirecionar3(elemento) {\n elemento.innerHTML = \"O texto mudou!!!\";\n}", "function setUpdateMessage(msg) {\n document.getElementById('updating').innerHTML = msg;\n }", "function UpdateDisplay(msg) {\n console.log(msg);\n var target = document.getElementById(\"maintext\");\n console.log(target);\n target.value = msg + \"\\n\\n\";\n }", "function sample2_4_2() {\n var textarea = document.getElementById('textarea');\n var content = document.getElementById('content');\n var value = textarea.value;\n content.textContent = value;\n}", "function changesize() {\n document.getElementById(\"mouseover\").innerHTML = \"Text changed.\";\n}", "function changeTheDOM()\n{\n\tconsole.log('DOM change call');\n\tdocument.getElementById('passage').setAttribute('style','display: block');\n\tdocument.getElementById('playagain').setAttribute('style','display: block');\n\tdocument.getElementById('madlibs-entry').setAttribute('style','display: none');\n\n\tdocument.getElementById('classics').innerHTML = selectedPassageTitle;\n}", "function changeMessage(text) {\n let el = document.getElementById(\"message\"); // gets the element with `id=\"message\"`\n el.textContent = text; // changes the text (the stuff in between the <h1></h1> tags)\n}", "function setElementText(id, text)\n{\n document.getElementById(id).textContent = text;\n}", "function modifyText() {\n article.innerHTML = \"\";\n connectToApiMovie() \n}", "function msg(text) {\n document.getElementById('debug').innerText = text;\n}", "function edwin(){\n console.log(\"hello, welcome to javascript\");\n console.log(\"error here\" + derren);\n console.log(\"line 3\");\n divChange.textContent = \"You are hacked!!\";\n}", "function write(txt) {\n\tdocument.getElementById(\"feedback\").innerHTML = txt;\n}", "function changeTrainerTitle(message) {\r\n //document.getElementById(\"trainerTitle\").innerHTML = \"Ear Trainer - \" + message;\r\n}", "function displayMessage(test){\n let text = test;\n //let content = document.getElementById(\"greeting\").innerText\n //content=test; \n document.getElementById(\"greeting\").innerText=text;\n}", "function updateContents(id, code) {\n var obj = document.getElementById(id);\n if (obj) {\n obj.innerHTML = code;\n executeJS(id);\n obj = null;\n }\n}", "function changeElementContent(element, content) {\n saferInnerHTML(element, content);\n}", "function botao(){\n document.getElementById(\"click\").innerHTML = \"Obrigada!!\";\n //alert(\"Obrigada!!\");\n}", "function setMessage(msg) {\n\n\tdocument.getElementById(\"message\").innerHTML = msg;\n}", "function update(element, content, klass){\n\t\t\n\t\t//utilizes the first child of the DOM element (or creates one) to add the text and append it.\n\t\tvar p = element.firstChild || document.createElement(\"p\");\n\t\tp.textContent = content;\n\t\telement.appendChild(p);\n\t\tif(klass){\n\t\t\tp.className = klass;\n\t\t}\n\t}", "function ShowMessage(msg) {\n\tdocument.getElementById(\"message\").innerHTML += \"<p>\"+msg+\"</p>\";\n}", "function problem4() {\n document.getElementById('result').innerHTML = 'Погледнете решението на задача 1';\n}", "updateNodeContent(node, content) {\n this.getNode(node).innerHTML = content;\n }", "function textChange() {\n var A = document.getElementsByClassName(\"text\");\n A[0].innerHTML = \"I changed!\";\n}", "function problem2() {\n document.getElementById('result').innerHTML = 'Погледнете решението на задача 1';\n}", "function log(text) {\n\tvar l = document.getElementById('log');\n\tl.innerHTML += \"<p>\" + text + \"</p>\";\n}", "function addParagraph ()\n{\n \n var task2 = document.getElementById('task2a');\n var paragraph = document.createElement('p');\n paragraph.innerText = \"Hello World\";\n task2.appendChild(paragraph);\n \n}", "function displayMessage(msg)\n{\n document.getElementById(\"greeting\").innerText = msg;\n}", "function manipText(text) {\n text_area.innerHTML = text;\n\n}", "function print(txt) {\n document.getElementById(\"display\").innerHTML = txt;\n}", "function print(txt) {\n document.getElementById(\"display\").innerHTML = txt;\n}", "function display(msg) {\n document.getElementById('display').innerHTML = msg;\n}" ]
[ "0.8557043", "0.77509373", "0.74609566", "0.71230644", "0.70199394", "0.7013315", "0.7012713", "0.6918978", "0.6772314", "0.6768356", "0.67226976", "0.6713201", "0.6661681", "0.6660673", "0.66424197", "0.65993464", "0.65792656", "0.65667164", "0.65328026", "0.6526732", "0.6524434", "0.6524318", "0.6515119", "0.6491652", "0.64831376", "0.64463663", "0.6442506", "0.6409801", "0.64094186", "0.63982433", "0.6357522", "0.6338902", "0.6337371", "0.63327575", "0.63279235", "0.63180006", "0.6314152", "0.630909", "0.6283309", "0.62806803", "0.6270031", "0.6258923", "0.62585974", "0.6256855", "0.6245609", "0.62426", "0.62409896", "0.6240199", "0.6239845", "0.62245053", "0.62138295", "0.62119156", "0.620893", "0.62081856", "0.6203211", "0.617946", "0.6179319", "0.61772954", "0.61691844", "0.6167719", "0.6162397", "0.6156251", "0.61506075", "0.6147396", "0.6143335", "0.61409223", "0.6135546", "0.61246383", "0.6120226", "0.611976", "0.61160266", "0.6113355", "0.6105071", "0.60972536", "0.60918957", "0.6071115", "0.60601926", "0.60575444", "0.604631", "0.6043477", "0.60312414", "0.6025168", "0.6024404", "0.60207427", "0.60160124", "0.60125285", "0.60039216", "0.59947044", "0.5986055", "0.5983286", "0.5976422", "0.59718144", "0.59622896", "0.59611523", "0.5958384", "0.5948968", "0.59480345", "0.5939235", "0.5935931", "0.5935931", "0.59304553" ]
0.0
-1
get the chosen item that the user selected
function getChosenItemQty(item){ //get the item id out of the string var stock_quanity = 0; var id = parseInt(item.idBuy.slice(0, 1)) for(var i = 0; i < inventory.length; i++){ //get the items object if(inventory[i].id == id){ stock_quanity = inventory[i].stock_quanity; } } return stock_quanity; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get selectedItem() {\n let selectedElement = this._widget.selectedItem;\n if (selectedElement) {\n return this._itemsByElement.get(selectedElement);\n }\n return null;\n }", "function selected() {\n return self.itemAt($scope.selectedIndex);\n }", "function getSelectedName() {\n\t\t\tif (items.length === 0 || !items[selected]) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\treturn items[selected];\n\t\t}", "function getSelectedSingleItem(){\r\n\t\tvar arrItems = getArrSelectedItems();\r\n\t\tif(arrItems.length != 1)\r\n\t\t\tthrow new Error(\"Wrong number of selected item. Should be 1\");\r\n\t\t\r\n\t\tvar item = arrItems[0];\r\n\t\treturn(item);\r\n\t}", "function get_selection()\n {\n return selection;\n }", "get selectedValue() {\n let selectedElement = this._widget.selectedItem;\n if (selectedElement) {\n return this._itemsByElement.get(selectedElement)._value;\n }\n return \"\";\n }", "function getSelectedItem() {\n return filteredDeclarations[selectedIndex];\n }", "function getSelection(){\n return selection;\n }", "function whichItemIsSelected(aComponent) {\n for (var i=0; i< aComponent.options.length; i++) {\n if (aComponent.options[i].selected) {\n\t return aComponent.options[i].value;\n }\n }\n return \"\";\n}", "function findItem() {\n var found;\n\n $rootScope.claimItems.forEach(function (item) {\n if (item.selected == true) {\n found = item;\n }\n });\n return found;\n }", "function getChosenItem(){\n $(\"#spinlabel\").html(localStorage.getItem(\"chosenItem\"));\n}", "function findItem() {\n var found;\n\n $rootScope.claimItems.forEach(function (item) {\n if (item.selected == true) {\n found = item;\n }\n });\n return found;\n }", "function getUserChoice(event) {\n let checked = document.querySelector('[name=\"item\"]:checked').value;\n event.preventDefault();\n return checked;\n}", "function getSelectedOption(){\n\n}", "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }", "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }", "get selected() {\n const selected = this.selectionModel.selected;\n return this.multiple ? selected : (selected[0] || null);\n }", "function getSelectedOption(){\n\treturn $('input[name=search-type]:checked').val();\n}", "function getChoice() {\n var map = getChoices();\n var cnum = choiceNum();\n if (cnum && map[cnum])\n return map[cnum];\n}", "get selectedItem()\n {\n let list = this.focusedList;\n return (list ? list.selectedItem : null);\n }", "function getSelect(item) {\nvar idx;\n\tif (item.options.length > 0) {\n\t idx = item.selectedIndex;\n\t return item.options[idx].value;\n\t}\n\treturn '';\n}", "function displaySelectedItem() {\n var fi = findItem();\n if (fi) {\n $scope.item.category = fi.category;\n $scope.item.text = fi.text;\n $scope.item.amount = fi.amount;\n }\n else\n {\n //item add\n $scope.item.category={};\n $scope.item.text = '';\n $scope.item.amount = '';\n $rootScope.editMode = false;\n }\n }", "get selected() {\n return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];\n }", "function selectItem(){\n\n inquirer.prompt([\n {\n type: \"list\",\n message: \"What would you like to purchase?\",\n choices: idArray,\n name: \"selectItem\"\n }\n ]).then(function(response){\n itemID = response.selectItem;\n quantity();\n });\n}", "item() {\n // Check if there are selected items\n const { selectedItems } = this.$store.state;\n\n // If there is only one selected item, show that one.\n if (selectedItems.length === 1) {\n return selectedItems[0];\n }\n\n // If there are more selected items, use the last one\n if (selectedItems.length > 1) {\n return selectedItems.slice(-1)[0];\n }\n\n // Use the currently selected directory as a fallback\n return this.$store.getters.getSelectedDirectory;\n }", "function getChoice() {\n inquirer.prompt({\n name: \"action\",\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 }).then(function(answer) {\nswitch(answer.action) {\n\tcase 'View Products for Sale':\n\t\tviewProducts();\n\tbreak;\n\n\tcase 'View Low Inventory':\n\t\tviewLowInventory();\n\tbreak;\n\t\n\tcase 'Add to Inventory':\n\t\trestockInventory();\n\tbreak; \n\t\n\tcase 'Add New Product':\n\t\taddNewProduct();\n\tbreak;\n }\n })\n}", "function getSelected() {\n\t\t\t\treturn angular.element(document.getElementById(scope.selected.id));\n\t\t\t}", "function itemSelected (app) {\n const param = app.getSelectedOption();\n console.log('USER SELECTED: ' + param);\n if (!param) {\n app.ask('Sorry, was that?');\n } else if (param === SELECTION_KEY_INTERFACE) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here\\'s android interface')\n .addSimpleResponse('Android\\'s default user interface is mainly based on direct manipulation, using touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to manipulate on-screen objects, along with a virtual keyboard. Now tell me if there\\'s anything else you want to hear about Android?')\n .addBasicCard(app.buildBasicCard(`Android\\'s default user interface is mainly based on direct manipulation, using touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to manipulate on-screen objects, along with a virtual keyboard..`)\n .setTitle('Android Interface')\n .addButton('Read more')\n .setImage('http://www.conceptdraw.com/solution-park/resource/images/solutions/android-user-interface/Software-development-Android-User-Interface-Design-Elements-Android-Tabs61.png', 'Android Interface')\n)\n);\n } else {\n app.ask('Android\\'s default user interface is mainly based on direct manipulation, using touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to manipulate on-screen objects, along with a virtual keyboard. Now tell me if there\\'s anything else you want to know about Android. Maybe android version history or What is stack overflow.');\n}\n } else if (param === SELECTION_KEY_VIRTUAL) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('At Google I/O on May 2016, Google announced Daydream, a virtual reality platform that relies on a smartphone and provides VR capabilities through a virtual reality headset and controller designed by Google itself. Now tell me if there\\'s anything else you want to hear about Android?')\n .addBasicCard(app.buildBasicCard(`At Google I/O on May 2016, Google announced Daydream, a virtual reality platform that relies on a smartphone and provides VR capabilities through a virtual reality headset and controller designed by Google itself. The platform is built into Android starting with Android Nougat, differentiating from standalone support for VR capabilities. The software is available for developers, and was released in 2016..`)\n .setTitle('Virtual reality')\n .addButton('Read more')\n .setImage('http://www.androidos.in/wp-content/uploads/2015/03/google-cardboard-1.jpg', 'Memory')\n)\n);\n } else {\n app.ask('At Google I/O on May 2016, Google announced Daydream, a virtual reality platform that relies on a smartphone and provides VR capabilities through a virtual reality headset and controller designed by Google itself. Now tell me if there\\'s anything else you want to know about Android. Maybe android history or Android Memory management');\n}\n } else if (param === SELECTION_KEY_APPLICATION) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Applications (\"apps\"), which extend the functionality of devices, are written using the Android software development kit (SDK) and, often, the Java programming language. Now tell me if there\\'s anything else you want to hear about Android?')\n .addBasicCard(app.buildBasicCard(`Applications (\"apps\"), which extend the functionality of devices, are written using the Android software development kit (SDK) and, often, the Java programming language. Java may be combined with C/C++, together with a choice of non-default runtimes that allow better C++ support. The Go programming language is also supported, although with a limited set of application programming interfaces (API). In May 2017, Google announced support for Android app development in the Kotlin programming language..`)\n .setTitle('Android Application')\n .addButton('Read more')\n .setImage('http://cdn2.ubergizmo.com/wp-content/uploads/2015/03/Android-Applications.jpg', 'Application')\n)\n);\n } else {\n app.ask('Applications (\"apps\"), which extend the functionality of devices, are written using the Android software development kit (SDK) and, often, the Java programming language. Now tell me if there\\'s anything else you want to know about Android. Maybe should need to know about Android kernel or What is stack overflow.');\n}\n } else if (param === SELECTION_KEY_MEMORY) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Since Android devices are usually battery-powered, Android is designed to manage processes to keep power consumption at a minimum. Now tell me if there\\'s something else that might you interested about Android?. Maybe android version history or what is android AOSP')\n .addBasicCard(app.buildBasicCard(`When an application is not in use the system suspends its operation so that, while available for immediate use rather than closed, it does not use battery power or CPU resources.[94][95] Android manages the applications stored in memory automatically: when memory is low, the system will begin invisibly and automatically closing inactive processes, starting with those that have been inactive for longest...`)\n .setTitle('Memory management')\n .addButton('Read more')\n .setImage('https://mobworld.files.wordpress.com/2010/07/processimage.jpg?w=500', 'Memory management')\n)\n);\n } else {\n app.ask('Applications (\"apps\"), which extend the functionality of devices, are written using the Android software development kit (SDK) and, often, the Java programming language. Now tell me if there\\'s something else that might you interested about Android?. Maybe android version history or what is android AOSP');\n}\n } else if (param === SELECTION_KEY_GINGERBREAD) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Gingerbread\\'s user interface was refined in many ways, making it easier use, and more power-efficient. Now tell me if there\\'s anything else you want to know about Android.? ')\n .addBasicCard(app.buildBasicCard(`Gingerbread'\\s user interface was refined in many ways, making it easier to master, faster to use, and more power-efficient. A simplified color scheme with a black background gave vividness and contrast to the notification bar, menus, and other user interface components. Improvements in menus and settings resulted in easier navigation and system control.`)\n .setTitle('Gingerbread')\n .addButton('Read more')\n .setImage('https://www.technobuffalo.com/wp-content/uploads/2011/04/android-2-3-gingerbread.png', 'Gingerbread')\n)\n);\n } else {\n app.ask('Gingerbread\\'s user interface was refined in many ways, making it easier to use, and more power-efficient. Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is Github ');\n}\n } else if (param === SELECTION_KEY_HONEYCOMB) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"Honeycomb\" is a codename for the Android platform that was designed for devices with larger screen sizes, particularly tablets. It is no longer supported (newer versions are). Now tell me if there\\'s anything else you want to know about Android.? ')\n .addBasicCard(app.buildBasicCard(`Android \"Honeycomb\" is a codename for the Android platform that was designed for devices with larger screen sizes, particularly tablets. It is no longer supported (newer versions are). Honeycomb debuted with the Motorola Xoom in February 2011`)\n .setTitle('HoneyComb')\n .addButton('Read more')\n .setImage('https://i.amz.mshcdn.com/CencC65482MTabHzEy4F9EQqxrs=/356x205/2012%2F12%2F04%2Fe5%2Fintelpromis.bNW.jpg', 'HoneyComb')\n)\n);\n } else {\n app.ask('Android \"Honeycomb\" is a codename for the Android platform that was designed for devices with larger screen sizes, particularly tablets. It is no longer supported (newer versions are). Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is android AOSP ');\n}\n } else if (param === SELECTION_KEY_ICE_CREAM) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"Ice Cream Sandwich\" is a codename for the Android mobile operating system developed by Google, that is no longer supported. Now tell me if there\\'s anything else you want to know about Android.? ')\n .addBasicCard(app.buildBasicCard(`The Ice Cream Sandwich release also introduced a number of other new features, including a refreshed home screen, near-field communication (NFC) support and the ability to \"beam\" content to another user using the technology, an updated web browser, a new contacts manager with social network integration, the ability to access the camera and control music playback from the lock screen, visual voicemail support, face recognition for device unlocking (\"Face Unlock\"), the ability to monitor and limit mobile data usage, and other internal improvements.`)\n .setTitle('Ice Cream Sandwich')\n .addButton('Read more')\n .setImage('http://cache.gawkerassets.com/assets/images/17/2011/05/icecreamsandwich.jpg', 'Ice Cream Sandwich')\n)\n);\n } else {\n app.ask('Android \"Ice Cream Sandwich\" is a codename for the Android mobile operating system developed by Google, that is no longer supported. Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is android features');\n}\n } else if (param === SELECTION_KEY_JELLBEAN) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"Jelly Bean\" is the codename given to three major point releases of the Android mobile operating system developed by Google, spanning versions between 4.1 and 4.3.1, that are no longer supported. Now tell me if there\\'s anything else you want to know about Android.? ')\n .addBasicCard(app.buildBasicCard('The first of these three, 4.1, was unveiled at Google\\'s I/O developer conference in June 2012, focusing on performance improvements designed to give the operating system a smoother and more responsive feel, improvements to the notification system allowing for \"expandable\" notifications with action buttons, and other internal changes. Two more releases were made under the Jelly Bean name in October 2012 and July 2013 respectively, including 4.2—which included further optimizations, multi-user support for tablets, lock screen widgets, quick settings, and screen savers, and 4.3—contained further improvements and updates to the underlying Android platform.')\n .setTitle('Jelly Bean')\n .addButton('Read more')\n .setImage('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcShdeTjcbZyQNNYfJodHgvpAMSFlPBFf63nne9oxdR4E1TOsazC', 'JellyBean')\n)\n);\n } else {\n app.ask('Android \"Jelly Bean\" is the codename given to three major point releases of the Android mobile operating system developed by Google, spanning versions between 4.1 and 4.3.1, that are no longer supported. Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is android Kernel ');\n}\n } else if (param === SELECTION_KEY_KITKAT) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"KitKat\" is a codename for the Android mobile operating system developed by Google, spanning versions between 4.4 and 4.4.4, that are no longer actively developed. Now tell me if there\\'s anything else you want to know about Android.? ')\n .addBasicCard(app.buildBasicCard('Android \"KitKat\" is a codename for the Android mobile operating system developed by Google, spanning versions between 4.4 and 4.4.4, that are no longer actively developed. Unveiled on September 3, 2013, KitKat focused primarily on optimizing the operating system for improved performance on entry-level devices with limited resources. Each Android OS has a title referring to a sweet treat.')\n .setTitle('Kitkat')\n .addButton('Read more')\n .setImage('http://d2rormqr1qwzpz.cloudfront.net/photos/2013/11/01/54929-jpeg.jpg', 'Kitkat')\n)\n);\n } else {\n app.ask('Android \"KitKat\" is a codename for the Android mobile operating system developed by Google, spanning versions between 4.4 and 4.4.4, that are no longer actively developed. Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is android AOSP');\n}\n } else if (param === SELECTION_KEY_LOLLIPOP) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"Lollipop\" is a codename for the Android mobile operating system developed by Google, spanning versions between 5.0 and 5.1.1, that is supported with security patches only. Now tell me if there\\'s anything else you want to know about Android.? ')\n .addBasicCard(app.buildBasicCard('Gingerbread\\'s user interface was refined in many ways, making it easier to master, faster to use, and more power-efficient. A simplified color scheme with a black background gave vividness and contrast to the notification bar, menus, and other user interface components. Improvements in menus and settings resulted in easier navigation and system control.')\n .setTitle('Lollipop')\n .addButton('Read more')\n .setImage('https://www.technobuffalo.com/wp-content/uploads/2011/04/android-2-3-gingerbread.png', 'Lollipop')\n)\n);\n } else {\n app.ask('Android \"Lollipop\" is a codename for the Android mobile operating system developed by Google, spanning versions between 5.0 and 5.1.1, that is supported with security patches only. Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is android AOSP');\n}\n } else if (param === SELECTION_KEY_MARSHMALLOW) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"Marshmallow\" (codenamed Android M during development) is the sixth major version of the Android operating system. First released as a beta build on May 28, 2015, it was officially released on October 5, 2015, with Nexus devices being the first to receive the update. Now tell me if there\\'s anything else you want to know about Android.?')\n .addBasicCard(app.buildBasicCard('Marshmallow primarily focuses on improving the overall user experience of its predecessor, Lollipop. It introduced a new permissions architecture, new APIs for contextual assistants (first used by a new feature \"Now on Tap\" to provide context-sensitive search results), a new power management system that reduces background activity when a device is not being physically handled, native support for fingerprint recognition and USB Type-C connectors, the ability to migrate data and applications to a microSD card, and other internal changes.')\n .setTitle('Marshmallow')\n .addButton('Read more')\n .setImage('https://www.androidcentral.com/sites/androidcentral.com/files/styles/w400h225crop/public/article_images/2015/12/android-marshmallow-4_0.jpg?itok=GsKySY9O&timestamp=1449673415', 'Marshmallow')\n)\n);\n } else {\n app.ask('Android \"Marshmallow\" (codenamed Android M during development) is the sixth major version of the Android operating system. First released as a beta build on May 28, 2015, it was officially released on October 5, 2015, with Nexus devices being the first to receive the update. Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is android AOSP');\n}\n } else if (param === SELECTION_KEY_NOUGAT) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"Nougat\" (codenamed Android N during development) is the seventh major version of the Android operating system. First released as an alpha test version on March 9, 2016, it was officially released on August 22, 2016, with Nexus devices being the first to receive the update. Now tell me if there\\'s anything else you want to know about Android.? ')\n .addBasicCard(app.buildBasicCard('Nougat introduces notable changes to the operating system and its development platform, including the ability to display multiple apps on-screen at once in a split-screen view, support for inline replies to notifications, and an expanded \"Doze\" power-saving mode that restricts device functionality once the screen has been off for a period of time. Additionally, the platform switched to an OpenJDK-based Java environment and received support for the Vulkan graphics rendering API, and \"seamless\" system updates on supported devices.')\n .setTitle('Nougat')\n .addButton('Read more')\n .setImage('https://9to5google.files.wordpress.com/2016/07/nougat.jpg?quality=82&strip=all&w=1000', 'Nougat')\n)\n);\n } else {\n app.ask('Android \"Nougat\" (codenamed Android N during development) is the seventh major version of the Android operating system. First released as an alpha test version on March 9, 2016, it was officially released on August 22, 2016, with Nexus devices being the first to receive the update. Now tell me if there\\'s anything else you want to know about Android?. Maybe android history or what is android AOSP');\n}\n } else if (param === SELECTION_KEY_O) {\nif (app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)) {\n app.ask(app.buildRichResponse()\n .addSuggestions(['What is Android Kernel', 'What is AOSP', 'Android features']) \n .addSimpleResponse('Alright here you go!')\n .addSimpleResponse('Android \"O\" is the codename of an upcoming release of the Android mobile operating system. It was first released as an alpha quality developer preview on March 21, 2017. The second developer preview was released on May 17, 2017, and it is considered beta quality. The third developer preview was released on June 8, 2017 and finalizes the API. Now tell me if there\\'s something else that might you interested about Android?.')\n .addBasicCard(app.buildBasicCard('Android \"O\" is the codename of an upcoming release of the Android mobile operating system. It was first released as an alpha quality developer preview on March 21, 2017. The second developer preview was released on May 17, 2017, and it is considered beta quality. The third developer preview was released on June 8, 2017 and finalizes the API')\n .setTitle('Android O')\n .addButton('Read more')\n .setImage('https://www1-lw.xda-cdn.com/files/2017/03/android-o-logo1.png', 'Android O')\n)\n);\n } else {\n app.ask('Android \"O\" is the codename of an upcoming release of the Android mobile operating system. It was first released as an alpha quality developer preview on March 21, 2017. The second developer preview was released on May 17, 2017, and it is considered beta quality. The third developer preview was released on June 8, 2017 and finalizes the API. Now tell me if there\\'s something else that might you interested about Android?. Maybe android history or what is android AOSP');\n}\n } else {\n app.ask('Sorry but You selected an unknown item');\n } \n}", "get selectedItem() {\n return this._selectedItem;\n }", "get selectedItem() {\n return this._selectedItem;\n }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "get selected() { return this._selected; }", "function getValue() {\n return selectedValue;\n }", "function getSelectedAlgorithm() {\n\n const menuSelection = document.getElementById(\"AlgorithmSelection\");\n const selectionIndex = menuSelection.selectedIndex;\n return menuSelection.options[selectionIndex].value;\n}", "function getCurrentItemData() {\n\t\t\t\treturn mItemData[oTemplatePrivateModel.getProperty(getPropertyPath(PATH_TO_SELECTED_KEY))]; // return metadata of selected item\n\t\t\t}", "function editItem(currItem) {\n //if item found select combo\n\n //else set combo to please select\n\n }", "function getSelectedUser() {\n return document.getElementById('userDropDown').value\n}", "function selectedPanicItem(){\n getSinglePanicItem().then(function(good){\n let drop = document.getElementById(\"panicDrop\");\n let _id = drop.options[drop.selectedIndex].dataset.id;\n let itemName = drop.options[drop.selectedIndex].value;\n \n console.log(_id);\n console.log(itemName);\n \n }).catch(function(error){\n console.log(error);\n });\n}", "onSelectActor(item) {\n this.selectedActor = item;\n }", "getSelectionFromUser(msg, items, selectedItemIndex) {\n selectedItemIndex = selectedItemIndex || 0\n\n var accessory = NSComboBox.alloc().initWithFrame(NSMakeRect(0,0,200,25))\n accessory.addItemsWithObjectValues(items)\n accessory.selectItemAtIndex(selectedItemIndex)\n\n var alert = NSAlert.alloc().init()\n alert.setMessageText(msg)\n alert.addButtonWithTitle('OK')\n alert.addButtonWithTitle('Cancel')\n alert.setAccessoryView(accessory)\n\n var responseCode = alert.runModal()\n var sel = accessory.indexOfSelectedItem()\n\n return [responseCode, sel]\n }", "function getSelectedItem(array, object){\n\t\treturn array[$filter('GetIndexNumeric')(array,object )]; \n\t}", "handleSelect(item) {\n this._selected = item\n this._opener.inputValue = item.text\n }", "function getSelectedChoice() {\n var selected = $(\"select\").val();\n var chosenAnswer = $( \"select option:selected\" ).text();\n\n answerFeedback(selected, chosenAnswer);\n\n }", "getSelected () {\n return this.list.views.filter(item => {\n if (item.show && item.selectable) {\n return item.selected === true\n }\n })\n }", "renderSelectedItem() {\n\t\treturn (\n\t\t\t<div>\n YOUR SELECTION ID IS { this.props.selectionId }\n\t\t\t</div>\n\t\t);\n\t}", "function getSelected() {\n let answer;\n\n //for each answer element, see which one is checked.\n answerEls.forEach(answerEl => {\n //if this particular answer element is checked, which gives us a true \n //or false, then answer is equal to the answer element dot ID.\n if(answerEl.checked) {\n answer = answerEl.id\n }\n })\n\n return answer;\n}", "function itemSelected(key){\n childNodePath = key;\n let post = document.getElementById(key);\n console.log(\"clicked item key = \"+key);\n selecedItem.value = post.children[0].innerHTML;\n}", "get selected() {\n return this._selected;\n }", "get selected() {\n return this._selected;\n }", "get selected() {\n return this._selected;\n }", "function getSelectedOption() {\n let answer = undefined;\n\n answerOptions.forEach((option) => {\n if (option.checked) {\n answer = option.id;\n }\n });\n return answer;\n}", "get value() {\n return this._model ? this._model.selection : null;\n }", "get value() {\n return this._model ? this._model.selection : null;\n }", "function getSelection() {\r\n\tvar selectable = $(this);\r\n\treturn selectable.children(\".selected\");\r\n}", "function getuserselection(){\n var selection = readline.question('Choice: ');\n console.log('You have chosen option: ' + selection);\n return selection;\n}", "selectedItemIndex () {\n for (let itemKey in this.itemsComputed) {\n if (this.selectedItem === this.itemsComputed[itemKey] && this.itemsComputed.hasOwnProperty(itemKey)) {\n return itemKey\n }\n }\n\n return null\n }", "handlePick() {\n const randomNumber = Math.floor(Math.random() * this.state.options.length);\n const option = this.state.options[randomNumber];\n }", "get selectedItem() {\n return this._list.selectedItem ?\n this._list.selectedItem._autocompleteItem : null;\n }", "function getSelected(){\r\n let answer = undefined\r\n\r\n answerEls.forEach((answerEl)=>{\r\n if(answerEl.checked){\r\n answer = answerEl.id\r\n }\r\n })\r\n\r\n return answer\r\n}", "handlePick() {\n const randomNum = Math.floor(Math.random() * this.state.options.length);\n const option = this.state.options[randomNum];\n alert(option);\n }", "whichSelected(thing){\n console.log(thing)\n console.log(this.props)\n // this.setState({text:thing})\n}", "getActiveOption() {\n const activeOption = this.programmeChooser.options[\n this.programmeChooser.selectedIndex\n ].value;\n\n this.updateJSONdata(activeOption);\n }", "function getSelectionFromUser(msg, items) {\n var selectedItemIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var accessory = NSComboBox.alloc().initWithFrame(NSMakeRect(0, 0, 200, 25));\n accessory.addItemsWithObjectValues(items);\n accessory.selectItemAtIndex(selectedItemIndex);\n accessory.editable = false;\n var dialog = NSAlert.alloc().init();\n dialog.setMessageText(msg);\n dialog.addButtonWithTitle('OK');\n dialog.addButtonWithTitle('Cancel');\n dialog.setAccessoryView(accessory);\n dialog.icon = getPluginAlertIcon();\n var responseCode = dialog.runModal();\n var sel = accessory.indexOfSelectedItem();\n return [responseCode, sel, responseCode === NSAlertFirstButtonReturn];\n}", "get selectedIndex() {\n let selectedElement = this._widget.selectedItem;\n if (selectedElement) {\n return this._indexOfElement(selectedElement);\n }\n return -1;\n }", "function selectAns(event) {\n choice = event.target.id;\n}", "function selectItem() {\n inquirer.prompt([\n {\n type: \"input\",\n message: \"Enter the ID for the product you'd like to buy\",\n name: \"productID\"\n },\n {\n type: \"input\",\n message: \"How many units of the product would you like to buy?\",\n name: \"quantity\"\n }\n ]).then(function(inquirerResponse){\n var productID = parseInt(inquirerResponse.productID);\n var qty = inquirerResponse.quantity;\n isAvailable(productID, qty);\n })\n}", "function choose() {\n selections[questionCounter] = +$('input[name=\"answer\"]:checked').val();\n pref.push(questions[questionCounter].choices[$('input[name=\"answer\"]:checked').val()][1])\n\n }", "function getCOMP_CHOICE() {\n const RANDOM_NUM = Math.floor(Math.random() * 3)\n return CHOICES[RANDOM_NUM]\n}", "selected() {\n\t\t\treturn this._selected;\n\t\t}", "get selectedOption() {\n\t\treturn this.options.find((option) => option.selected);\n\t}", "function pwGetCurrentSelection() {\n if($('#filter input[type=checkbox]').is(':checked')) {\n var vals = pwGetColVals(null, 'category');\n vals = pwGetColVals(vals, 'volume');\n vals = pwGetColVals(vals, 'type');\n vals = pwGetColVals(vals, 'location');\n vals = pwGetColVals(vals, 'shape');\n currentSelection = objToArr(vals);\n } else {\n currentSelection = [];\n for (var i=0; i < packages.length; i++) {\n currentSelection[i] = i;\n }\n }\n }", "function get_choice(choices, value) {\n for(var i=0, len=choices.length; i<len; i++) {\n if (choices[i][0] == value){\n return choices[i][1]\n }\n }\n return ''\n}", "function getActionChoice() {\n let user_action;\n // Represents the option chosen from this menu\n console.log(\"1. Add inventory to the location\\n\");\n console.log(\"2. Ship inventory from a location\\n\");\n console.log(\"3. Quit the program\");\n user_action = rls.questionInt(\"Please enter you choice: \");\n\n return user_action;\n}", "function Choice(items){\n //we'll use Math.random()\n let rand = Math.floor(Math.random()*items.length);\n return items[rand];\n }", "function getSelectedItem()\n{\n var tree = document.getElementById('device_tree');\n if (tree.currentIndex < 0) return;\n var item = tree.contentView.getItemAtIndex(tree.currentIndex);\n selected_slot = null;\n selected_module = null;\n if (item) {\n var kind = item.getAttribute(\"pk11kind\");\n var module_name;\n if (kind == \"slot\") {\n // get the module cell for this slot cell\n var cell = item.parentNode.parentNode.firstChild.firstChild;\n module_name = cell.getAttribute(\"label\");\n var module = secmoddb.findModuleByName(module_name);\n // get the cell for the selected row (the slot to display)\n cell = item.firstChild.firstChild;\n var slot_name = cell.getAttribute(\"label\");\n selected_slot = module.findSlotByName(slot_name);\n } else { // (kind == \"module\")\n // get the cell for the selected row (the module to display)\n cell = item.firstChild.firstChild;\n module_name = cell.getAttribute(\"label\");\n selected_module = secmoddb.findModuleByName(module_name);\n }\n }\n}", "function get_selected_element() {\n\n return iframe.find(\".yp-selected\");\n\n }", "function getSelectedItem(suggestDiv) {\n\n \n\n var count = -1;\n\n \n\n var sqItems = suggestDiv.find(\".hawk-sqItem\");\n\n \n\n \n\n \n\n if (sqItems) {\n\n \n\n if (sqItems.filter(\".hawk-sqActive\").length == 1) {\n\n \n\n count = sqItems.index(sqItems.filter(\".hawk-sqActive\"));\n\n \n\n };\n\n \n\n }\n\n \n\n return count\n\n \n\n }", "function choose() {\n var checkBox = document.querySelectorAll('input[type=\"checkbox\"]:checked'),\n radioButton = document.querySelectorAll('input[type=\"radio\"]:checked');\n if (checkBox.length) {\n inputs = checkBox\n } else {\n inputs = radioButton\n }\n var names = [].map.call(inputs, function (input) {\n return input.value;\n }).join(','),\n input = JSON.parse(\"[\" + names + \"]\");\n selections[questionCounter] = input;\n }", "function getCurrentItem(opts, value, block) {\n var document = value.document;\n\n\n if (!block) {\n if (!value.selection.startKey) return null;\n block = value.startBlock;\n }\n\n var parent = document.getParent(block.key);\n return parent && parent.type === opts.typeItem ? parent : null;\n}", "function select_dropdown_item (item) {\n if(selected_dropdown_item) {\n deselect_dropdown_item($(selected_dropdown_item));\n }\n if(item) {\n item.addClass($(input).data(\"settings\").classes.selectedDropdownItem);\n selected_dropdown_item = item.get(0);\n }\n }", "function userPick(evt) {\r\n userChoice = this.id;\r\n console.log(userChoice);\r\n playGame();\r\n}", "get selected() {\n if (this.isObject(this.options)) {\n return this.options.selected;\n }\n else {\n return this.__selected;\n }\n }", "function selected(value) { \r\n extraQuestion=value;\r\n}", "function getValue(selected) {\n var opt = document.getElementById(selected);\n var userOpt = opt.options[opt.selectedIndex].value;\n return userOpt;\n}", "getPayload() {\n const selected = this.props.list.find((item) => this.state.selectedId === item.id);\n return selected && selected.item;\n }", "function getSelectedOption(options,value){var flatOptions=flattenOptions(options);var selectedOption=flatOptions.find(function(option){return value===option.value;});if(selectedOption===undefined){// Get the first visible option (not the hidden placeholder)\nselectedOption=flatOptions.find(function(option){return!option.hidden;});}return selectedOption?selectedOption.label:'';}", "function select_dropdown_item (item) {\n if(item) {\n if(selected_dropdown_item) {\n deselect_dropdown_item($(selected_dropdown_item));\n }\n\n item.addClass($(input).data(\"settings\").classes.selectedDropdownItem);\n selected_dropdown_item = item.get(0);\n }\n }", "function select_dropdown_item (item) {\n if(item) {\n if(selected_dropdown_item) {\n deselect_dropdown_item($(selected_dropdown_item));\n }\n\n item.addClass($(input).data(\"settings\").classes.selectedDropdownItem);\n selected_dropdown_item = item.get(0);\n }\n }", "onKeypress() {\n this.selectedKey = this.rl.line.toLowerCase();\n var selected = this.opt.choices.where({ key: this.selectedKey })[0];\n if (this.status === 'expanded') {\n this.render();\n } else {\n this.render(null, selected ? selected.name : null);\n }\n }", "onKeypress() {\n this.selectedKey = this.rl.line.toLowerCase();\n var selected = this.opt.choices.where({ key: this.selectedKey })[0];\n if (this.status === 'expanded') {\n this.render();\n } else {\n this.render(null, selected ? selected.name : null);\n }\n }", "function GetItemDropDownList(){\n var e = document.getElementById(\"SelectChangeTalk\");\n var selecteditemtext = e.options[e.selectedIndex].text;\n return selecteditemtext;\n}" ]
[ "0.7379858", "0.69741446", "0.6834397", "0.68296075", "0.68008846", "0.6710135", "0.66384375", "0.6601487", "0.6591867", "0.6551517", "0.65431035", "0.65364134", "0.64991397", "0.64766955", "0.6456781", "0.6456781", "0.6435702", "0.6412946", "0.6370634", "0.6369105", "0.63126385", "0.62676024", "0.6257619", "0.62409425", "0.62400246", "0.6230011", "0.6224861", "0.6201131", "0.6141764", "0.6141764", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61296594", "0.61151004", "0.6109924", "0.61002237", "0.6092523", "0.6078938", "0.60726255", "0.60649455", "0.60460705", "0.60369825", "0.6036659", "0.60184455", "0.6009845", "0.5988821", "0.59802437", "0.5977481", "0.59753793", "0.59753793", "0.59753793", "0.5965176", "0.5959623", "0.5959623", "0.59582186", "0.5951251", "0.59329796", "0.5927345", "0.5922097", "0.5921568", "0.5919732", "0.5912025", "0.5911005", "0.59081274", "0.590543", "0.5898582", "0.589442", "0.58913434", "0.5882753", "0.5881988", "0.5881353", "0.5880973", "0.588029", "0.5876748", "0.5873606", "0.58672035", "0.58611894", "0.58598423", "0.5839607", "0.5835377", "0.58287245", "0.5825862", "0.5820857", "0.5817766", "0.5816236", "0.5807971", "0.58060026", "0.5804074", "0.5804074", "0.57961285", "0.57961285", "0.5789001" ]
0.0
-1
avant toute collision avec le pnj
function rencontre(pnj, textePnj) { // fonction gérant la collision avec un pnj if (joueur.posX + joueur.largeur > pnj.posX2 && joueur.posX - tailleTuile < pnj.posX2 && joueur.posY + joueur.hauteur > pnj.posY2 && joueur.posY - tailleTuile < pnj.posY2) { console.log(pnj.name); switch(dir) { // on va évaluer la direction du personnage joueur case 1: joueur.posX -= 1; // on enlève 1 à la position posX du joueur pour qu'il se décale horizontalement par rapport au pnj // pnj.v=0; // on arrête le déplacement du pnj en mettant sa vitesse à 0 // dirPnj=0; // on le fait regarder de face break; case 2: joueur.posX += 1; // on ajoute 1 à la position posX du joueur pour qu'il se décale horizontalement par rapport au pnj // pnj.v=0; //on arrête le déplacement du pnj en mettant sa vitesse à 0 // dirPnj=0; // on le fait regarder de face break; case 0: joueur.posY -= 1; // on enlève 1 à la position posY du joueur pour qu'il se décale verticalement par rapport au pnj // pnj.v=0; //on arrête le déplacement du pnj en mettant sa vitesse à 0 // dirPnj=0; // on le fait regarder de face break; case 3: joueur.posY += 1; // on ajoute 1 à la position posY du joueur pour qu'il se décale verticalementement par rapport au pnj // pnj.v=0; //on arrête le déplacement du pnj en mettant sa vitesse à 0 // dirPnj=0; // on le fait regarder de face break; } if (pnj.collision == 0) { bulleTexte(pnj.texte, pnj.posX2, pnj.posY2); // affiche une "bulle" de dialogue } pnj.collision += 1; // permettra de savoir ensuite qu'on a touché le pnj console.log(pnj.collision+" - pnj !"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collision (px,py,pw,ph,ex,ey,ew,eh){\nreturn (Math.abs(px - ex) *2 < pw + ew) && (Math.abs(py - ey) * 2 < ph + eh);\n \n}", "function collision(b, p) {\r\n //conocemos la altura del jugador\r\n p.top = p.y;\r\n //conocemos la parte inferior del jugador\r\n p.bottom = p.y + p.height;\r\n //la parte izquierda\r\n p.left = p.x;\r\n //la parte derecha\r\n p.right = p.x + p.width;\r\n\r\n //lo mismo con la bola\r\n b.top = b.y - b.radius;\r\n b.bottom = b.y + b.radius;\r\n b.left = b.x - b.radius;\r\n b.right = b.x + b.radius;\r\n\r\n //returnamos la poscion si esta pegado en izquierda, derecha, arriba y abajo esta chocando\r\n return (\r\n p.left < b.right && p.top < b.bottom && p.right > b.left && p.bottom > b.top\r\n );\r\n}", "function tester_collision1() {\n\tfor (var p=0; p<18; p++) {\n\n/* On test le contact de la sphère avec chaque sommet du mur de gauche */\n\t\tif (Math.sqrt(Math.pow(polygone[p][0]-xplayer1,2)+ Math.pow(polygone[p][1]-yplayer1,2)) < rayon) {\n\t\t\tcontinuer = false;\n\t\t\tbreak;\n\t\t}\n\n/* Idem avec le mur de droite */\n\t\tif (Math.sqrt(Math.pow(polygone[p][0]+largeur-xplayer1,2)+ Math.pow(polygone[p][1]-yplayer1,2)) < rayon ) {\n\t\t\tcontinuer = false;\n\t\t\tbreak;\n\t\t}\n\t}\n\t \n}", "checkCollision( p2 )\r\n {\r\n let dist = this.p.subtract( p2.p );\r\n let distModule = dist.module();\r\n let distUnit = dist.normalized();\r\n if ( distModule < ( this.r + p2.r ) )\r\n {\r\n // componenti velocità parallele alla congiungente i centri delle particelle\r\n // prima dell'impatto\r\n let parallelV1 = this.v.parallelComponent( dist );\r\n let parallelV2 = p2.v.parallelComponent( dist );\r\n\r\n // componenti velocità perpendicolari alla congiungente i centri delle particelle\r\n // prima dell'impatto\r\n let perpendicularV1 = this.v.subtract( parallelV1 );\r\n let perpendicularV2 = p2.v.subtract( parallelV2 );\r\n\r\n // riposizionamento al punto di contatto\r\n let l = this.r + p2.r - distModule;\r\n let vRel = this.v.subtract( p2.v ).module();\r\n let k = - l / vRel;\r\n let s1 = parallelV1.multiply( k );\r\n let s2 = parallelV2.multiply( k );\r\n this.p = this.p.add( s1 );\r\n p2.p = p2.p.add( s2 );\r\n\r\n // componenti velocità parallele alla congiungente i centri delle particelle\r\n // dopo l'impatto\r\n let m1 = this.m;\r\n let m2 = p2.m;\r\n\r\n let u1 = parallelV1.dot( distUnit );\r\n let u2 = parallelV2.dot( distUnit );\r\n\r\n let v1 = ( ( m1 - m2 ) * u1 + 2 * m2 * u2 ) / ( m1 + m2 );\r\n let v2 = ( ( m2 - m1 ) * u2 + 2 * m1 * u1 ) / ( m1 + m2 );\r\n\r\n // componenti velocità perpendicolari alla congiungente i centri delle particelle\r\n // dopo l'impatto\r\n parallelV1 = distUnit.multiply( v1 );\r\n parallelV2 = distUnit.multiply( v2 );\r\n \r\n // velocità finali\r\n this.v = parallelV1.add( perpendicularV1 );\r\n p2.v = parallelV2.add( perpendicularV2 ); \r\n }\r\n }", "collision () {\n }", "collision(ptl, pbr) {//player dimensions\n //add the x first\n if(this.taken){ return false;}\n if ((ptl.x <this.bottomRight.x && pbr.x > this.pos.x) &&( ptl.y < this.bottomRight.y && pbr.y > this.pos.y)) {\n this.taken = true;\n return true;\n }\n return false;\n }", "function checkCollision(){\r\n\t//check se la macchina esce dalla pista\r\n\tif(center_carr[2]<-408)vz=0;\r\n\tif(center_carr[2]>109)vz=0;\r\n\t\r\n\tif(center_carr[0]<track_dimension[1])vz=0;\r\n\tif(center_carr[0]>track_dimension[0])vz=0;\r\n\t\r\n\t//check collisione con i booster\r\n\tif((center_carr[0]<2.3 && center_carr[0]>0) && (center_carr[2]>-10 && center_carr[2]<-6)) vz=vz*1.12;\r\n\tif((center_carr[0]<0 && center_carr[0]>-2.3) && (center_carr[2]>-35 && center_carr[2]<-31)) vz=vz*1.12;\r\n\tif((center_carr[0]<0 && center_carr[0]>-2.3) && (center_carr[2]>-48 && center_carr[2]<-44)) vz=vz*1.12;\r\n\tif((center_carr[0]<6 && center_carr[0]>4) && (center_carr[2]>-161 && center_carr[2]<-157)) vz=vz*1.12;\r\n\tif((center_carr[0]<3 && center_carr[0]>0.7) && (center_carr[2]>-184 && center_carr[2]<-180)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-240 && center_carr[2]<-236)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-251 && center_carr[2]<-247)) vz=vz*1.12;\r\n\tif((center_carr[0]<5.60 && center_carr[0]>3.18) && (center_carr[2]>-257 && center_carr[2]<-253)) vz=vz*1.12;\r\n\tif((center_carr[0]<7 && center_carr[0]>5) && (center_carr[2]>-290 && center_carr[2]<-286)) vz=vz*1.12;\r\n\tif((center_carr[0]<6&& center_carr[0]>3.8) && (center_carr[2]>-310 && center_carr[2]<-306)) vz=vz*1.15;\r\n\tif((center_carr[0]<3.6&& center_carr[0]>1.3) && (center_carr[2]>-331 && center_carr[2]<-327)) vz=vz*1.12;\r\n\t\r\n\t//check collisione con i debooster\r\n\tif((center_carr[0]<1.15 && center_carr[0]>-0.8) && (center_carr[2]>-113 && center_carr[2]<-109)) vz=vz*0.9;\r\n\tif((center_carr[0]<6 && center_carr[0]>3.6) && (center_carr[2]>-144 && center_carr[2]<-140)) vz=vz*0.9;\r\n\tif((center_carr[0]<3.25 && center_carr[0]>0.85) && (center_carr[2]>-170 && center_carr[2]<-166)) vz=vz*0.9;\r\n\tif((center_carr[0]<6.66 && center_carr[0]>4.6) && (center_carr[2]>-203 && center_carr[2]<-199)) vz=vz*0.9;\r\n\tif((center_carr[0]<2.81 && center_carr[0]>0.93) && (center_carr[2]>-222 && center_carr[2]<-218)) vz=vz*0.9;\r\n\tif((center_carr[0]<3.25 && center_carr[0]>1) && (center_carr[2]>-277 && center_carr[2]<-281)) vz=vz*0.9;\r\n\tif((center_carr[0]<7 && center_carr[0]>5) && (center_carr[2]>-300 && center_carr[2]<-296)) vz=vz*0.9;\r\n\t\r\n}", "function collision(b, p) {\r\n p.top = p.y;\r\n p.bottom = p.y + p.height;\r\n p.left = p.x;\r\n p.right = p.x + p.width;\r\n\r\n b.top = b.y - b.radius;\r\n b.bottom = b.y + b.radius;\r\n b.left = b.x - b.radius;\r\n b.right = b.x + b.radius;\r\n\r\n return (\r\n p.left < b.right && p.top < b.bottom && p.right > b.left && p.bottom > b.top\r\n );\r\n}", "function collisions() {\n collisonBords(ballon);\n\n equipes.forEach((eq) => {\n eq.joueurs.forEach((e) => {\n // Touche le cote droit\n collisonBords(e);\n });\n });\n\n let collision = false;\n\n // Pour toutes les equipes\n equipes.forEach((e) => {\n // Pour chaque joueur de chaque équipe\n e.joueurs.forEach((j) => {\n if (GestionnaireCollision.cercleCercle(j, ballon, j.rayon(), ballon.rayon())) {\n gererCollision(j, ballon);\n collision = true;\n }\n\n // Pour chaque équipe\n equipes.forEach((e2) => {\n // Chaque joueur de chaque équipe\n e2.joueurs.forEach((j2) => {\n if (j.x === j2.x && j.y === j2.y) {\n return;\n }\n\n if (GestionnaireCollision.cercleCercle(j, j2, j.rayon(), j2.rayon())) {\n collision = true;\n gererCollision(j, j2);\n }\n });\n });\n });\n });\n\n if (collision) {\n soundsManager.collisionJoueurs();\n }\n\n if (GestionnaireCollision.pointDansRectangle(map.cageGauche, ballon.centre())) {\n score.DROITE += 1;\n reset();\n soundsManager.but();\n } else if (GestionnaireCollision.pointDansRectangle(map.cageDroite, ballon.centre())) {\n score.GAUCHE += 1;\n reset();\n soundsManager.but();\n }\n }", "checkForCollision(ps) {\n if( ps !== null ) { \n for(let i = 0; i < this.collisionSX.length; i++ ) {\n if( ps.position.x >= this.collisionSX[i] && ps.position.x <= this.collisionEX[i] ) {\n if( ps.position.y >= this.collisionSY[i] && ps.position.y <= this.collisionEY[i] ) {\n //print(\"collsion at shape \" + i);\n return true;\n }\n }\n }\n }\n\n return false; \n }", "function CollisionCalculatorC2P(o1,pt) \n{\n var dx = pt.x - o1.x;\n var dy = pt.y - o1.y;\n\n var dist = Math.sqrt( Math.pow((pt.x-o1.x),2)+Math.pow((pt.y-o1.y),2));\n if(dist>o1.r) {\n return false;\n }\n return true;\n}", "checkCollision (playerPosition) {\n /*\n if (playerPosition[0] > this.position[0][0] && playerPosition[0] < this.position[0][1]) {\n if (playerPosition[1] > this.position[1][0] && playerPosition[1] < this.position[1][1]) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }\n */\n\n let er = 0;\n let ec = 0;\n let pr = 0;\n let pc = 0;\n\n /* player x position */\n if(player.x < 100){ pc = 0; }\n if(player.x >= 100 && player.x < 200){ pc = 1; } \n if(player.x >= 200 && player.x < 300){ pc = 2; }\n if(player.x >= 300 && player.x < 400){ pc = 3; }\n if(player.x >= 400){ pc = 4; }\n\n /* player y position */\n if(player.y < 72) { pr = 0; } \n if(player.y >= 72 && player.y < 154) { pr = 1; } \n if(player.y >= 154 && player.y < 236) { pr = 2; } \n if(player.y >= 236 && player.y < 318) { pr = 3; } \n if(player.y >= 318 && player.y < 400) { pr = 4; } \n if(player.y >= 400) { pr = 5; } \n\n /* enemy car x position + 10 buffer for easyer gameplay */\n if(this.x < -100){ ec = -1; }\n if(this.x >= -100 && this.x < 0){ ec = 0; } \n if(this.x >= 0 && this.x < 100){ ec = 1; } \n if(this.x >= 100 && this.x < 200){ ec = 2; }\n if(this.x >= 200 && this.x < 300){ ec = 3; }\n if(this.x >= 300 && this.x < 400){ ec = 4; }\n if(this.x >= 400){ ec = 5; }\n\n /* enemy car y position */\n if(this.y < 63) { er = 0; } \n if(this.y >= 63 && this.y < 143) { er = 1; } \n if(this.y >= 143 && this.y < 223) { er = 2; } \n if(this.y >= 223 && this.y < 303) { er = 3; } \n if(this.y >= 303 && this.y < 383) { er = 4; } \n if(this.y >= 383) { er = 5; } \n/*\n if (ec == 2) { \n alert(this.x.toString()); \n }\n*/\n if ((pc == ec) && (pr == er)) {\n gameVar.gotGift = false;\n gameVar.checkCollision = false;\n gameVar.gotHit();\n }\n }", "collision() {\n return this.sprite.overlap(player.sprite) && this.colour == player.colour;\n }", "checkCollision() { \n return (player.x < this.x + 80 &&\n player.x + 80 > this.x &&\n player.y < this.y + 60 &&\n 60 + player.y > this.y)\n }", "function collision(top_x, bottom_x, top_y, bottom_y) {\n\t\tfor (var i = 0; i < rows; i++) {\n\t\t\tfor (var j = 0; j < cols; j++) {\n\t\t\t\tvar b = bricks[j][i];\n\t\t\t\tif (b.exists == 1) {\n\t\t\t\t\tif (top_y < (b.y + block_height) && bottom_y > b.y && top_x < (b.x + block_width) && bottom_x > b.x) {\n\t\t\t\t\t\tb.exists = 0;\n\t\t\t\t\t\tball.y_speed = -ball.y_speed;\n\t\t\t\t\t\tplayer1Score += 1;\n\t\t\t\t\t\tbrickcount -= 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "playerCollidWithGem() {\n // position of the player in a grid\n let playerCoordinates = {\n x: player.x,\n y: player.y + 55,\n width: (player.horizontal)/2,\n height: (player.vertical/2)\n };\n // position of a gem in a grid\n let gemCoordinates = {\n x: this.x,\n y: this.y,\n width: this.width,\n height: this.height,\n };\n // check the X coordinates range of collision\n let collisonXRange = playerCoordinates.x < gemCoordinates.x + gemCoordinates.width &&\n playerCoordinates.x + playerCoordinates.width > gemCoordinates.x;\n // check the X coordinates range of collision\n let collisionYRange = playerCoordinates.y < gemCoordinates.y + gemCoordinates.height &&\n playerCoordinates.height + playerCoordinates.y > gemCoordinates.y;\n\n if ( collisonXRange && collisionYRange ) {\n let gem = this.sprite;\n // get the gem upon collision\n this.addGemPoints(gem);\n return true\n } else {\n return false\n }\n }", "collision() {\n const playerBox = {x: player.x, y: player.y, width: 76, height: 83};\n const enemyBox = {x: this.x, y: this.y, width: 76, height: 83};\n\n if (playerBox.x < enemyBox.x + enemyBox.width &&\n playerBox.x + playerBox.width > enemyBox.x &&\n playerBox.y < enemyBox.y + enemyBox.height &&\n playerBox.height + playerBox.y > enemyBox.y) {\n player.restart();\n hearts.pop();\n life--;\n if (life === 0) {\n lose();\n }\n }\n }", "collision() {\n\t\tthis.vars.collision = true;\n\t}", "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 }", "collide(p2, damp = 1) {\n // reference: http://codeflow.org/entries/2010/nov/29/verlet-collision-with-impulse-preservation\n // simultaneous collision not yet resolved. Possible solutions in this paper: https://www2.msm.ctw.utwente.nl/sluding/PAPERS/dem07.pdf \n let p1 = this;\n let dp = p1.$subtract(p2);\n let distSq = dp.magnitudeSq();\n let dr = p1.radius + p2.radius;\n if (distSq < dr * dr) {\n let c1 = p1.changed;\n let c2 = p2.changed;\n let dist = Math.sqrt(distSq);\n let d = dp.$multiply(((dist - dr) / dist) / 2);\n let np1 = p1.$subtract(d);\n let np2 = p2.$add(d);\n p1.to(np1);\n p2.to(np2);\n let f1 = damp * dp.dot(c1) / distSq;\n let f2 = damp * dp.dot(c2) / distSq;\n let dm1 = p1.mass / (p1.mass + p2.mass);\n let dm2 = p2.mass / (p1.mass + p2.mass);\n c1.add(new Pt_1.Pt(f2 * dp[0] - f1 * dp[0], f2 * dp[1] - f1 * dp[1]).$multiply(dm2));\n c2.add(new Pt_1.Pt(f1 * dp[0] - f2 * dp[0], f1 * dp[1] - f2 * dp[1]).$multiply(dm1));\n p1.previous = p1.$subtract(c1);\n p2.previous = p2.$subtract(c2);\n }\n }", "collision() {\n if (this.y === (player.y - 12) && this.x > player.x - 75 && this.x < player.x + 70) {\n player.collide();\n }\n }", "collide(oth) {\n return this.right > oth.left && this.left < oth.right && this.top < oth.bottom && this.bottom > oth.top\n }", "function collisonBords(e) {\n let collision = false;\n\n if (GestionnaireCollision.cercleDansCarre(e, map.cageDroite)) {\n if (e.x + e.width >= map.cageDroite.x + map.cageDroite.width) {\n e.x = (map.cageDroite.x + map.cageDroite.width) - e.width;\n e.inverserVx();\n\n collision = true;\n }\n if (e.y <= map.cageDroite.y) {\n e.y = map.cageDroite.y;\n e.inverserVy();\n\n collision = true;\n } else if (e.y + e.height >= map.cageDroite.y + map.cageDroite.height) {\n e.y = (map.cageDroite.y + map.cageDroite.height) - e.height;\n e.inverserVy();\n\n collision = true;\n }\n // S'il y a collision avec la cage gauche\n } else if (GestionnaireCollision.cercleDansCarre(e, map.cageGauche)) {\n if (e.x <= map.cageGauche.x) {\n e.x = map.cageGauche.x;\n e.inverserVx();\n\n collision = true;\n }\n if (e.y <= map.cageGauche.y) {\n e.y = map.cageGauche.y;\n e.inverserVy();\n\n collision = true;\n } else if (e.y + e.height >= map.cageGauche.y + map.cageGauche.height) {\n e.y = (map.cageGauche.y + map.cageGauche.height) - e.height;\n e.inverserVy();\n\n collision = true;\n }\n } else if (e.x <= map.x) {\n e.x = map.x;\n e.inverserVx();\n\n collision = true;\n } else if (e.x + e.width >= map.x + map.width) {\n e.x = (map.x + map.width) - e.width;\n e.inverserVx();\n\n collision = true;\n } else if (e.y <= map.y) {\n e.y = map.y;\n e.inverserVy();\n\n collision = true;\n } else if (e.y + e.height >= map.y + map.height) {\n e.y = (map.y + map.height) - e.height;\n e.inverserVy();\n collision = true;\n }\n\n if (collision) {\n soundsManager.collisionBords();\n }\n }", "paddleCollision(paddle1, paddle2) {\n\n \n // if moving toward the right end ================================\n if (this.vx > 0) {\n let paddle = paddle2.coordinates(paddle2.x, paddle2.y, paddle2.width, paddle2.height);\n let [leftX, rightX, topY, bottomY] = paddle;\n // right edge of the ball is >= left edge of the paddle\n if(\n (this.x + this.radius >= leftX) && \n (this.x + this.radius <= rightX) &&\n (this.y >= topY && this.y <= bottomY)\n ){\n this.vx = -this.vx;\n this.ping.play();\n }\n }\n else {\n\n // if moving toward the right end ============================\n let paddle = paddle1.coordinates(paddle1.x, paddle1.y, paddle1.width, paddle1.height);\n let [leftX, rightX, topY, bottomY] = paddle;\n // right edge of the ball is <= left edge of the paddle\n if(\n (this.x - this.radius <= rightX) && \n (this.x - this.radius >= leftX) &&\n (this.y >= topY && this.y <= bottomY)\n ){\n this.vx = -this.vx;\n this.ping.play();\n }\n }\n \n }", "function collide(arena, player) {\n const [m, o] = [player.matrix, player.pos];\n for (let y = 0; y < m.length; ++y) {\n for (let x = 0; x < m[y].length; ++x) {\n if (m[y][x] !== 0 && (arena[y+o.y] && arena[y+o.y][x+o.x]) !== 0) {\n return true;\n }\n }\n }\n return false;\n}", "colisionCheck(object, player) {\n if ((player.x-10)+ player.width < object.x ||(object.x-10) + object.width < player.x){\n return false;\n }\n if ((player.y+20) > object.y + object.height || object.y+30 > player.y + player.height) {\n return false;\n }\n return true; \n }", "checkCollisions() {\n // Get actual player position\n let playerPosition = {\n x: player.x,\n y: player.y,\n width: box.width,// Get its box width\n height: box.height// Get its box height\n }\n // Get actual gem position\n let gemPosition = {\n x: this.x,\n y: this.y,\n width: box.width +10,// Get its box width\n height: box.height// Get its box height\n }\n // If collision happened:\n if (playerPosition.x < gemPosition.x + gemPosition.width && playerPosition.x + playerPosition.width > gemPosition.x && playerPosition.y < gemPosition.y + gemPosition.height && playerPosition.y + playerPosition.height > gemPosition.y) {\n audioFiles.collect.play();// Play collect sound effect\n // If th gem collect is orange the score will be incremented by 100\n // If th gem collect is blue the score will be incremented by 200\n // If th gem collect is green the score will be incremented by 300\n player.score += (this.gemSelected+1)*100;\n this.x = -100;// hide the gem by moving it offscreen\n this.gemCollected++;// increment player gem collected\n }\n }", "function collide() { // Brute force\n\t// check if each radii of 2 particles touch\n\tfor (let i=0;i<n-1;i++){\n\t\tfor (let j=i+1;j<n;j++){\n\t\t\t// Gather values\n\t\t\tvar ix = particles[i].x;\n\t\t\tvar iy = particles[i].y;\n\t\t\tvar jx = particles[j].x;\n\t\t\tvar jy = particles[j].y;\n\t\t\tvar ir = particles[i].r/2;\n\t\t\tvar jr = particles[j].r/2;\n\t\t\tvar im = particles[i].mass;\n\t\t\tvar jm = particles[j].mass;\n\n\t\t\tvar ixs = particles[i].xspeed;\n\t\t\tvar iys = particles[i].yspeed;\n\t\t\tvar jxs = particles[j].xspeed;\n\t\t\tvar jys = particles[j].yspeed;\n\n\t\t\tvar deltax = ix - jx;\n\t\t\tvar deltay = iy - jy;\n\t\t\tvar d = dist(ix, iy, jx, jy);\n\t\t\tvar inside = d - ir - jr;\n\t\t\t\n\t\t\t// find points on each circle between centres\n\t\t\tvar theta = atan(deltay/deltax);\n\t\t\t// console.log(theta * 180/PI)\n\t\t\tif (ix > jx){\n\t\t\t\tvar p_ix = ix - ir * cos(theta);\n\t\t\t\tvar p_iy = iy - ir * sin(theta);\n\t\t\t\tvar p_jx = jx + jr * cos(theta);\n\t\t\t\tvar p_jy = jy + jr * sin(theta);\n\t\t\t} else {\n\t\t\t\tvar p_ix = ix + ir * cos(theta);\n\t\t\t\tvar p_iy = iy + ir * sin(theta);\n\t\t\t\tvar p_jx = jx - jr * cos(theta);\n\t\t\t\tvar p_jy = jy - jr * sin(theta);\n\t\t\t}\n\n\t\t\tp_x = ((ix * jr) + (jx * ir)) / (ir + jr);\n\t\t\tp_y = ((iy * jr) + (jy * ir)) / (ir + jr);\n\n\t\t\t\n\t\t\t// Draw rectangles at point on radius closest to other ball's centre\n\t\t\t// circle(p_x, p_y, 10, 10);\n\t\t\t// circle(p_ix, p_iy, 10, 10);\n\t\t\t// circle(p_jx, p_jy, 10, 10);\n\n\t\t\t// Make sure particles stay at border (do not intersect)\n\t\t\tvar move_ix = -(p_ix-p_jx)/2;\n\t\t\tvar move_jx = (p_ix-p_jx)/2;\n\t\t\tvar move_iy = -(p_iy-p_jy)/2;\n\t\t\tvar move_jy = (p_iy-p_jy)/2;\n\n\t\t\tif (inside < 0){\n\t\t\t\t\n\n\t\t\t\t// compute output velocities\n\t\t\t\t//angles\n\t\t\t\tvar alpha1 = atan2(particles[j].y-particles[i].y,particles[j].x-particles[i].x);\n\t\t\t\tvar beta1 = atan2(iys,ixs);\n\t\t\t\tvar gamma1 = beta1-alpha1;\n\t\t\t\tvar alpha2 = atan2(particles[i].y-particles[j].y,particles[i].x-particles[j].x);\n\t\t\t\tvar beta2 = atan2(jys,jxs);\n\t\t\t\tvar gamma2 = beta2-alpha2;\n\n\t\t\t\t// norm of initial vectors\n\t\t\t\tu_12 = dist(0,0,ixs,iys) * cos(gamma1);\n\t\t\t\tu_11 = dist(0,0,ixs,iys) * sin(gamma1);\n\t\t\t\tu_21 = dist(0,0,jxs,jys) * cos(gamma2);\n\t\t\t\tu_22 = dist(0,0,jxs,jys) * sin(gamma2);\n\n\t\t\t\t// norm of out vectors\n\t\t\t\tv_12 = (u_12 * (im - jm) - (2 * jm * u_21)) / (im + jm);\n\t\t\t\tv_21 = (u_21 * (im - jm) + (2 * jm * u_12)) / (im + jm);\n\n\t\t\t\t// find v1 and v2\n\t\t\t\tparticles[i].xspeed = (u_11 * (-sin(alpha1)) + v_12 * cos(alpha1)) /1.05;\n\t\t\t\tparticles[i].yspeed = (u_11 * cos(alpha1) + v_12 * sin(alpha1)) /1.05;\n\t\t\t\tparticles[j].xspeed = (u_22 * (-sin(alpha2)) - v_21 * cos(alpha2)) /1.05;\n\t\t\t\tparticles[j].yspeed = (u_22 * cos(alpha2) - v_21 * sin(alpha2)) /1.05;\n\n\t\t\t\t// velocity equations (assuming point masses)\n\t\t\t\t// particles[i].xspeed = (ixs * (im - jm) + (2 * jm * jxs)) / (im + jm);\n\t\t\t\t// particles[i].yspeed = (iys * (im - jm) + (2 * jm * jys)) / (im + jm);\n\t\t\t\t// particles[j].xspeed = (jxs * (jm - im) + (2 * im * ixs)) / (im + jm);\n\t\t\t\t// particles[j].yspeed = (jys * (jm - im) + (2 * im * iys)) / (im + jm);\n\n\t\t\t\t//angle of new \n\t\t\t\t// prevent particle clipping (going into each other)\n\t\t\t\tparticles[i].x += move_ix;\n\t\t\t\tparticles[i].y += move_iy;\n\t\t\t\tparticles[j].x += move_jx;\n\t\t\t\tparticles[j].y += move_jy;\n\t\t\t}\n\t\t}\n\t}\n\n}", "function checkCollisionsPlayerOne() {\n if (pongball.x - 15 < playerOne.x + playerOne.sizeX && pongball.y < playerOne.y + playerOne.sizeY && pongball.y + pongball.sizeY > playerOne.y) {\n\n if (pongball.x > playerOne.x) {\n\n return true;\n }\n }\n}", "collision (b) {\n\n let mdiff = this.mDiff(b);\n if (mdiff.hasOrigin()) {\n\n let vectors = [ new Vector (0,mdiff.origin.y),\n new Vector (0,mdiff.origin.y+mdiff.height),\n new Vector (mdiff.origin.x, 0),\n new Vector (mdiff.origin.x + mdiff.width, 0) ];\n\n\t\t\tlet n = vectors[0];\n\n\t\t\tfor (let i = 1; i < vectors.length; i++) {\n\t\t\t\tif (vectors[i].norm() < n.norm())\n\t\t\t\tn = vectors[i];\n\t\t\t};\n\n\t\t\tlet norm_v = this.velocity.norm();\n\t\t\tlet norm_vb = b.velocity.norm();\n\t\t\tlet kv = norm_v / (norm_v + norm_vb);\n\t\t\tlet kvb = norm_vb / (norm_v + norm_vb);\n\n\t\t\tif (norm_v == 0 && norm_vb == 0) {\n\t\t\t\tif (this.invMass == 0 && b.invMass == 0)\n\t\t\t\treturn null;\n\t\t\t\telse {\n\t\t\t\t\tif (this.mass <= b.mass)\n\t\t\t\t\tkv = 1;\n\t\t\t\t\telse\n\t\t\t\t\tkvb = 1\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t\tthis.move(n.mult(kv));\n\t\t\tb.move(n.mult(-kvb));\n\n\t\t\tn = n.normalize();\n\n\t\t\t// (2) On calcule l'impulsion j :\n\t\t\tlet v = this.velocity.sub(b.velocity);\n\t\t\tlet e = Constants.elasticity; // pour les étudiants, juste faire let e = 1;\n\n\t\t\tlet j = -(1 + e) * v.dot(n) / (this.invMass + b.invMass);\n\n\t\t\t// (3) On calcule les nouvelle vitesse:\n\t\t\tlet new_v = this.velocity.add(n.mult(j * this.invMass));\n\t\t\tlet new_bv = b.velocity.sub(n.mult(j * b.invMass));\n\n\t\t\tb.setCollision(true);\n\t\t\tthis.setCollision(true);\n\n\t\t\treturn { velocity1 : new_v, velocity2 : new_bv };\n\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}", "onCollision() {\n\n }", "check_collision() {\n const rtx = this.x + 4;\n const rty = this.y + 59;\n const rpx = player.x + 31;\n const rpy = player.y + 57;\n if (rtx < rpx + player.width - 5 &&\n rpx < rtx + this.width - 5 &&\n rty < rpy + player.height - 15 &&\n rpy < rty + this.height - 15) {\n // Reset the game when collision happens\n allEnemies = [new Enemy(), new Enemy(), new Enemy()];\n player = new Player();\n }\n }", "function checkCollisionPoint( s, x, y ) {\n return ( s.x - s.img.width/2 < x && s.x + s.img.width/2 > x && s.y - s.img.height/2 < y && s.y + s.img.height/2 > y );\n}", "collision(o, n) {\n if (\n // This is to check mto see if there was any collision\n o.x >= this.pos.x &&\n o.x <= this.pos.x + 175 &&\n o.y >= this.pos.y &&\n o.y <= this.pos.y + 175\n ) {\n //This is what happens if it detects collision. Returns to original position\n this.tries++;\n this.score++;\n this.vel.set(0, 0);\n this.acc.set(0, 0);\n this.pos.set(this.sx, this.sy);\n this.bSize = 30;\n n = floor(random(0, 5));\n o.update();\n }\n // This is what happens if the ball goes out of bounds it returns to original position\n if (\n this.pos.x < 0 ||\n this.pos.x > 500 ||\n this.pos.y < 0 ||\n this.pos.y > 300\n ) {\n this.vel.set(0, 0);\n this.acc.set(0, 0);\n this.pos.set(this.sx, this.sy);\n this.bSize = 30;\n this.tries++;\n n = floor(random(0, 5));\n o.update();\n }\n return n;\n }", "function detectarColision() //métodos que tiene todas las colisiones del juego\n {\n \tvar paredes= $('.fisicaObj');\n \tvar obstaculos= $('.obstaculo');\n \tvar enemigos= $('.fisicaEnemigo');\n \tvar flechas= $('.flecha');\n \tvar disparosEnemigo= $('.disparoEnemigo');\n \tvar pociones= $('.pocion');\n \tvar powerArco = $('.powerArco');\n \tvar powerEspada = $('.powerEspada');\n\n \tcollision($('#capa'),paredes);\n \tcollision($('#capa'), obstaculos);\n \tcollision($('#capa'), enemigos);\n \tcollision($('#capa'), $('#droppable'));\n\n\n \tenemigos.each(function(){collision($(this), obstaculos);});\n\n \tenemigos.each(function(){\n \t\tcollision($(this), paredes);\n \t});\n\n \t$(flechas).each(function() //controlador de colisiones de las flechas del jugador\n \t{\n \t\tcollisionArma($(this), $(' #pared'));\n \t\tcollisionArma($(this), $(' #pared2'));\n \t\tcollisionArma($(this), $(' #pared3'));\n \t\tcollisionArma($(this), $(' #pared4'));\n \t\tcollisionArma($(this), $('.enemigo'));\n \t\tcollisionArma($(this), $('.fisicaEnemigo'));\n \t\tcollisionArma($(this), $('.obstaculo'));\n \t});\n\n $(disparosEnemigo).each(function() // controlador de colisiones de los disparos del enemigo\n {\n \tcollisionArma($(this), $('#capa'));\n \tcollisionArma($(this), $(' #pared'));\n \tcollisionArma($(this), $(' #pared2'));\n \tcollisionArma($(this), $(' #pared3'));\n \tcollisionArma($(this), $(' #pared4'));\n \tcollisionArma($(this), $('.fisicaObj'));\n \tcollisionArma($(this), $('.obstaculo'));\n });\n\n \n pociones.each(function(){\t\t\t// controlador de colisiones con las pociones\n \tcollision($('#capa'),$(this));\n })\n\n powerArco.each(function(){\t\t\t// controlador de colisiones con los powerUpArcos\n \tcollision($('#capa'),$(this));\n })\n\n powerEspada.each(function(){\t\t\t// controlador de colisiones con los powerUpEspadas\n \tcollision($('#capa'),$(this));\n })\n }", "function obstacle_collison()\n{\n\tif(obDetect == true)\n {\n var playx, playz, r1, r2;\n playx = player.position.x;\n playz = player.position.z;\n r1 = .75 /*obstacle radius*/ + .5 /*player radius*/;\n for(var i = 0; i < obstacles.length; i++)\n {\n r2 = Math.sqrt( Math.pow((playx - obstacles[i].position.x), 2) + Math.pow((playz - obstacles[i].position.z), 2));\n if(r2<r1)\n {\n score -= 50;\n scoreText.innerHTML = \"Score:\" + score;\n reset();\n }\n }\n\t}\n}", "function tester_collision3() {\n\tfor (var c=0; c<cercles.length; c++) {\n\t\tvar R=cercles[c][2];\n\t\tratio = (monCanvas.height-CoordJeux[1])/CoordJeux[0];\n\t\tif ( (cercles[c][1] < yplayer3 + (hauteur3player*0.5) + cercles[c][2]) && (cercles[c][1] > yplayer3 - (hauteur3player*0.5) - cercles[c][2]) ) {\n\t\t\tif ( (cercles[c][0]*0.1 < xplayer3 + largeur3player*0.5 + cercles[c][2]*ratio) && (cercles[c][0]*0.1 > xplayer3 - largeur3player*0.5 - cercles[c][2]*ratio) ) {\t\n\t\t\t\tif (cercles[c][5] == 1) {\n\t\t\t\t\tcercles[c][3]=0;\t/* si c'est une boule bleue */\n\t\t\t\t} else {\n\t\t\t\t\tcontinuer = false;\t/* sinon */\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "checkCollisions() {\n let xPos = Math.round(this.x);\n let yPos = Math.round(this.y);\n let approxXpos = xPos + 20;\n let approxYpos = yPos + 20;\n if ((player.x >= xPos && player.x <= approxXpos) && (player.y >= yPos && player.y <= approxYpos)) {\n player.x = 200;\n player.y = 420;\n player.lives--;\n player.livesText.textContent = player.lives;\n\n }\n }", "function hasCollisions() {\n\tfor (let y = 0; y < activeTetro.shape.length; y++) {\n\t\tfor (let x = 0; x < activeTetro.shape[y].length; x++) {\n\t\t\tif (activeTetro.shape[y][x] === 1 && (playField[activeTetro.y + y] === undefined || playField[activeTetro.y + y][activeTetro.x + x] === undefined || playField[activeTetro.y + y][activeTetro.x + x] === 2)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "function collision(dim, i, delta) {\n \n var r = sParticles[i];\n var temp = pParticles[i][dim] + vParticles[i][dim] * delta;\n var bound = 1; \n \n var collide = false;\n if (temp > 0) {\n bound = bound - r;\n if (temp > bound) \n collide = true;\n } else {\n bound = -bound + r;\n if (temp < bound)\n collide = true;\n }\n //Floor collision\n if ( collide && (Math.abs(vParticles[i][dim]) > threshold[dim]) ) {\n \n //console.log(\"start\", pParticles[i][1], vParticles[i][1]);\n var tCollide = (bound - pParticles[i][dim])/ vParticles[i][dim];\n\n //console.log(\"delta, tCollide\", delta, tCollide);\n\n if (tCollide < 0) {\n tCollide = 0;\n console.log(\"bad tCollide\");\n }\n \n if (tCollide > delta) {\n tCollide = delta;\n console.log(\"bad delta\");\n }\n\n //at collision\n\n pParticles[i][dim] = bound;\n\n var vCollide = vParticles[i][dim] + g[dim] * tCollide;\n\n vParticles[i][dim] = -(vCollide * retainRatio);\n //onsole.log(\"at collision\", pParticles[i][dim], vParticles[i][dim]);\n\n\n //after collision to current time\n\n\n pParticles[i][dim] += vParticles[i][dim] * (delta - tCollide);\n \n vParticles[i][dim] = vParticles[i][dim] + g[dim] * (delta - tCollide);\n\n \n if ((Math.abs(pParticles[i][dim]-bound) < 0.05) && Math.abs(vParticles[i][dim]) < threshold[dim] && !(dim==1 && bound > 0)) {\n pParticles[i][dim] = bound;\n vParticles[i][dim] = 0;\n console.log(\"particle locked\");\n }\n } else {\n pParticles[i][dim] = temp;\n if ( (Math.abs(temp - bound) > 0.05) ||(Math.abs(vParticles[i][dim]) > threshold[dim]) || (dim==1 && bound > 0)) {\n \n vParticles[i][dim] = vParticles[i][dim] * Math.pow(drag, delta) + g[dim] * delta;\n\n if (Math.abs(vParticles[i][dim]) < threshold[dim] && dim != 1)\n vParticles[i][dim] = 0;\n\n } else {\n pParticles[i][dim] = bound;\n vParticles[i][dim] = 0;\n }\n }\n}", "function checkCollision(x, y, xMole, yMole) {\n if (x <= xMole + 25 && x >= xMole - 25) {\n if (y <= yMole + 25 || y >= yMole - 25) {\n score += 1\n scoreKeeper.innerHTML = `Score: ${score}`\n }\n }\n }", "collisionPaddle(p){\n // 2D collision test\n if( this.x + this.r > p.x &&\n this.x - this.r < p.x + p.w &&\n this.y + this.r > p.y &&\n this.y - this.r < p.y + p.h\n )\n return true;\n return false;\n }", "playersCollision() {\n let p1 = this.player1.snakeRoute;\n let p2 = this.player2.snakeRoute;\n for (let i = 0; i < p1.length; i++) {\n for (let j = 0; j < p2.length; j++) {\n if (\n p1[i].x === p2[j].x &&\n p1[i].y === p2[j].y &&\n this.player1.state &&\n this.player2.state\n ) {\n return true;\n }\n return false;\n }\n }\n }", "function checkCollision(zombie) {\nif (zombie.getBoundingClientRect().top <= 0) {\nlives--;\nreturn true;\n}\nreturn false;\n}", "handleCollision(climber) {\n\n // distance\n //\n // to calculate the distance between the avalanche and climber\n let d = dist(this.x, this.y, climber.x, climber.y);\n\n // dist()\n //\n // To keep track of the avalanche and the avatar are in contact\n if (d < this.width / 2 + climber.width / 2) {\n // this is to push the climber down\n climber.vy += 2;\n\n }\n }", "checkCollision (obj) {\n if (this.x < obj.x + obj.width\n && this.x + this.width > obj.x\n && this.y < obj.y + obj.height\n && this.y + this.height > obj.y) {\n obj.resetPosition();\n }\n }", "checkCollisionTwo() {\n if (player.x + player.size / 2 > this.x && player.x - player.size / 2 < this.x + this.width) {\n if (player.y - player.size / 2 < this.y && player.y + player.size / 2 > this.y + this.height) {\n currentState = 1;\n }\n }\n }", "function checkCollision() {\n if ((player.y === allEnemies[0].y) && (player.x === allEnemies[0].x)) {\n player.x = 200;\n player.y = 380;\n num += 1;\n console.log(`num : ${num} , enemy : ${allEnemies[0].y}`);\n }\n if ((player.y === allEnemies[1].y) && (player.x === allEnemies[1].x)) {\n player.x = 200;\n player.y = 380;\n num += 1;\n console.log(`num : ${num} , enemy : ${allEnemies[1].y}`);\n }\n if ((player.y === allEnemies[2].y) && (player.x === allEnemies[2].x)) {\n player.x = 200;\n player.y = 380;\n num += 1;\n console.log(`num : ${num} , enemy : ${allEnemies[2].y}`);\n }\n if ((player.y === allEnemies[3].y) && (player.x === allEnemies[3].x)) {\n player.x = 200;\n player.y = 380;\n num += 1;\n console.log(`num : ${num} , enemy : ${allEnemies[3].y}`);\n }\n}", "checkCollision(){\n\n if(this.radius > 0){\n if(this.x + this.radius > game.getWidth() || this.x - this.radius < 0){\n this.xVel *= -1;\n }\n\n if(this.y + this.radius > game.getHeight() || this.y - this.radius < 0){\n this.yVel *= -1;\n }\n } \n \n }", "checkIonCollision(ion,other){\n return ion.getSize().x+other.getRadius() > Utility.dist(ion.getPos(),other.getPos());\n }", "function isCollide(a, b) {\n //a=Pokemon b=white or red balls\n\n let aRect = a.getBoundingClientRect();\n let bRect = b.getBoundingClientRect();\n let pythag = getDistance(aRect.x, aRect.y, bRect.x, bRect.y);\n\n if (pythag < (aRect.height / 2 + bRect.height / 2)) {\n if (b.classList.value === \"whiteballs\") {\n b.style.opacity = \"0\";\n vanish(b);\n player.score += 1;\n scoreupdate();\n } else\n endGame();\n }\n}", "function collision($end, $start) {\n let x1 = $start.offset().left;\n let y1 = $start.offset().top;\n let h1 = $start.outerHeight(true);\n let w1 = $start.outerWidth(true);\n let b1 = y1 + h1;\n let r1 = x1 + w1;\n let x2 = $end.offset().left;\n let y2 = $end.offset().top;\n let h2 = $end.outerHeight(true);\n let w2 = $end.outerWidth(true);\n let b2 = y2 + h2;\n let r2 = x2 + w2;\n\n if( x2==x1){\n \t$('#game_result').text('Congratulations you won!');\n }\n \t\n }", "function collisionCheck() {\n for(var i=0; i<brickList.length; i++) {\n if (chopperX < (brickList[i].x + brickWidth) && (chopperX + chopperWidth) > brickList[i].x\n && chopperY < (brickList[i].y + brickHeight) && (chopperY + chopperHeight) > brickList[i].y ) {\n gameOver();\n }\n }\n}", "function collision(head, tabSnake){\n for(let i = 0; i < tabSnake.length; i++){\n if(head.x == tabSnake[i].x && head.y == tabSnake[i].y){ \n return true;\n }\n \n }return false\n}", "checkCollisions() {\n // check for collisions with window boundaries\n if (this.pos.x > width || this.pos.x < 0 ||\n this.pos.y > height || this.pos.y < 0) {\n this.collision = true;\n }\n\n // check for collisions with all obstacles\n for (let ob of obstacles) {\n if (this.pos.x > ob.x && this.pos.x < ob.x + ob.width &&\n this.pos.y > ob.y && this.pos.y < ob.y + ob.height) {\n this.collision = true;\n break;\n }\n }\n }", "function ballPaddleCollision() {\n if (ball.x < paddle.x + paddle.width && ball.x > paddle.x && paddle.y < paddle.y + paddle.height && ball.y > paddle.y) {\n\n // JOUER LE SON\n PADDLE_HIT.play();\n\n // CHECK WHERE THE BALL HIT THE PADDLE\n let collidePoint = ball.x - (paddle.x + paddle.width / 2);\n\n // NORMALIZE THE VALUES\n collidePoint = collidePoint / (paddle.width / 2);\n\n // CALCULATE THE ANGLE OF THE BALL\n let angle = collidePoint * Math.PI / 3;\n\n\n ball.dx = ball.speed * Math.sin(angle);\n ball.dy = -ball.speed * Math.cos(angle);\n }\n}", "function exists_collision(i, j, k, l) {\n\tif( i == k ) {\n\t\treturn true; \n\t} else if( j == l) {\n\t\treturn true; \n\t} else if( Math.abs(i - k) == Math.abs(j - l)) {\n\t\treturn true; \n\t} else {\n\t\treturn false; \n\t}\n}", "function collidesWith( a, b )\n{\n return a.bottom > b.top && a.top < b.bottom;\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 collideAction(ball, p) {\n ball.vx = -ball.vx;\n\n if (paddleHit == LEFT) {\n ball.x = p.x + p.w;\n particlePos.x = ball.x + ball.r;\n multiplier = 1;\n }\n\n else if (paddleHit == RIGHT) {\n ball.x = p.x - p.w - ball.r;\n particlePos.x = ball.x - ball.r;\n multiplier = -1;\n }\n\n points++;\n increaseSpd();\n // shrinkPdl();\n\n if (collision) {\n if (points > 0)\n collision.pause();\n\n collision.currentTime = 0;\n //collision.play();\n }\n\n particlePos.x = ball.x;\n flag = 1;\n}", "function checkCollision(){\n for(var j = 0; j < balls.length; j++)\n if (balls[i].loc.x > paddle.loc.x &&\n balls[i].loc.x < paddle.width &&\n balls[i].loc.y > paddle.loc.y &&\n balls[i].loc.y < paddle.height)\n balls[i].splice(i,1)\n\n }", "function checkCollition (){\n obst.forEach(function(obstacle){\n if(mrJeffers.isTouching(obstacle)){\n mrJeffers.y-=3;\n console.log ('yei');\n }\n });\n}", "gemCollision() {\n if ((this.y + 52 === gem.y) && (this.x + 25 === gem.x)) {\n gem.gemScore();\n gem = '';\n updateScore();\n }\n}", "isCollision(driverX, driverY) {\n let collission = false;\n this.barries.forEach((bar) => {\n if (\n driverX < bar.x + bar.img.width &&\n driverX + this.driverW > bar.x &&\n driverY + 50 < bar.y + bar.img.height &&\n driverY + this.driverH > bar.y + 20\n ) {\n collission = true;\n }\n });\n return collission;\n }", "function collides(b, p) {\n\tif(b.x + ball.r >= p.x && b.x - ball.r <=p.x + p.w) {\n\t\tif(b.y >= (p.y - p.h) && p.y > 0){\n\t\t\tpaddleHit = 1;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\telse if(b.y <= p.h && p.y == 0) {\n\t\t\tpaddleHit = 2;\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\telse return false;\n\t}\n}", "onCollision(otherObjects) {}", "function detectCollisions() {\n let dx;\n let dy;\n let d2;\n let r1;\n let r2;\n let dvx;\n let dvy;\n let inp;\n let pref;\n\n for (let i1 = 0; i1 < particleArray.length; i1++) {\n r1 = particleArray[i1].radius\n\n for (let i2 = i1 + 1; i2 < particleArray.length; i2++) {\n r2 = particleArray[i2].radius\n\n dx = (particleArray[i1].x - particleArray[i2].x)\n dy = (particleArray[i1].y - particleArray[i2].y)\n\n d2 = dx * dx + dy * dy\n\n // if distance is too large for collision cycle back\n if (Math.sqrt(d2) > r1 + r2) continue\n\n if (particleArray[i2].state == 2 && particleArray[i1].state == 1) {\n particleArray[i1].state = 2\n particleArray[i1].timeAtInfection = new Date\n } else if (particleArray[i2].state == 1 && particleArray[i1].state == 2) {\n particleArray[i2].state = 2\n particleArray[i2].timeAtInfection = new Date\n }\n\n dvx = (particleArray[i1].vx - particleArray[i2].vx)\n dvy = (particleArray[i1].vy - particleArray[i2].vy)\n inp = dvx * dx + dvy * dy\n\n // If inp > 0 the particles are overlaping and the distance is actually increasing!\n // In this case there is no collision taling place.\n\n if (inp > 0) continue\n\n // The radius of the particles is proportional to its mass!!\n pref = 2 * r2 / (r1 + r2) * inp / d2\n\n particleArray[i1].vx -= pref * dx\n particleArray[i1].vy -= pref * dy\n\n particleArray[i2].vx += r1 / r2 * pref * dx\n particleArray[i2].vy += r1 / r2 * pref * dy\n }\n }\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 key position\n let keyPosition = {\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 < keyPosition.x + keyPosition.width && playerPosition.x + playerPosition.width > keyPosition.x && playerPosition.y < keyPosition.y + keyPosition.height && playerPosition.y + playerPosition.height > keyPosition.y) {\n audioFiles.collect.play();// Play collect sound effect\n player.remainAlive++;// add 1 life to th player\n let heart = new Life(lives.length*20, 0);// create a new Life and set position coordinates arguments\n lives.push(heart);// add the new heart object into lives array (See engine.js-line 171)\n this.x = -100;// hide the key by moving it offscreen\n }\n }", "function collision_check(a,b) {\n let res = (Math.abs(a.x-b.x) * 2 < (16+8)) &&\n (Math.abs(a.y-b.y) * 2< (16+8))\n return res;\n}", "function CollisionManager(policy){\n\t\n\tthis.policy=policy;\n\t\n\tthis.checkCollision=function(){\n\t\t\n\t\tif(this.policy==Constants.defaultCollision){\n\t\t\tcheckCollisionDefault();\n\t\t}\n\t\t\n\t};\n\t\n\t\n\t/**\n\t * Check for collision with the default policy\n\t */\n\tcheckCollisionDefault=function(){\n\t\t\n\t\tvar user=entityManager.getUser();\n\t\tvar entities=entityManager.getEntities();\n\t\tvar solids=entityManager.getSolids();\n\t\t\n\t\t\n\t\tvar userLeft=parseFloat(user.x);\n\t\tvar userRight=parseFloat(user.x+user.frameW);\n\t\tvar userTop=parseFloat(user.y);\n\t\tvar userBottom=parseFloat(user.y+user.frameH);\n\t\tvar isCollision=false;\n\t\t\n\t\tfor(var i=0; i<entities.length; i++){\n\t\t\n\t\t\tvar isSpriteOverlap=true;\n\t\t\t\n\t\t\tvar entity=entities[i];\n\t\t\t\n\t\t\tvar entityLeft=parseFloat(entity.x);\n\t\t\tvar entityRight=parseFloat(entity.x+entity.frameW);\n\t\t\tvar entityTop=parseFloat(entity.y);\n\t\t\tvar entityBottom=parseFloat(entity.y+entity.frameH);\n\t\t\t\n\t\t\t//Check if the two Sprites overlap so the images are close \n\t\t\tif(userLeft > entityRight || entityLeft > userRight || userTop > entityBottom || entityTop > userBottom){\n\t\t\t\tisSpriteOverlap=false;\n\t\t\t}\n\n\t\t\t//if they are close then do pixel-by-pixel comparison\n\t\t\tif(isSpriteOverlap){\n\t\t\t\n\t\t\t\tuserData=weavejs.getOffCanvasContext().getImageData(user.x,user.y,user.frameW,user.frameH);\n\t\t\t\tentityData=weavejs.getOffCanvasContext().getImageData(entity.x,entity.y,entity.frameW,entity.frameH);\n\t\t\t\t\n\t\t\t\tisCollision=checkForPixelCollision(userData,user.x,user.y,entityData,entity.x,entity.y);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}\n\t\t\tconsole.log(\"Collision:\"+isCollision);\n\t\t\n\t};\n\t\n\t/**\n\t * the method take two entities and theeir coordinate information and checks for nont transparent pixel collision\n\t * @param firstEntityData the data of the first entity \n\t * @param firstEntityX the x coordinates of the first entity\n\t * @param firstEntityY the y coordinates of the first entity\n\t * @param secondEntityData the data of the second entity \n\t * @param secondEntityX the x coordinates of the second entity\n\t * @param secondEntityY the y coordinates of the second entity\n\t * \n\t */\n\tcheckForPixelCollision=function(firstEntityData,firstEntityX,firstEntityY,secondEntityData,secondEntityX,secondEntityY){\n\t\t\n\n\t var firstEntityWidth = firstEntityData.width;\n\t var firstEntityHeight = firstEntityData.height;\n\t var secondEntityWidth = secondEntityData.width;\n\t var secondEntityHeight = secondEntityData.height;\n\n\t //we calculate the top right and bottom left corners\n\t var xMin = Math.max( firstEntityX, secondEntityX );\n\t var yMin = Math.max( firstEntityY, secondEntityY );\n\t var xMax = Math.min( firstEntityX+firstEntityWidth, secondEntityX+secondEntityWidth );\n\t var yMax = Math.min( firstEntityY+firstEntityHeight, secondEntityY+secondEntityHeight );\n\t \n\t \n\t var firstEntityPixels = firstEntityData.data;\n\t var secondEntityPixels = secondEntityData.data;\n\t\t\n\t //we iterate through the pixels of the each entity\n\t for ( var i = xMin; i < xMax; i++ ) {\n\t for ( var j = yMin; j < yMax; j++ ) {\n\t \n\t \t //we get the alpha value of each pixel we want to check\n\t \t var firstEntityPixelAlpha = ((i-firstEntityX ) + (j-firstEntityY )*firstEntityWidth )*4 + 3 ;\n\t \t var secondEntityPixelAlpha = ((i-secondEntityX) + (j-secondEntityY)*secondEntityWidth)*4 + 3 ;\n\t \t\n\t \t //if the pixels the collide are not transparent then we a collision of the entities\n\t \t if ( firstEntityPixels[firstEntityPixelAlpha] !== 0 && secondEntityPixels[secondEntityPixelAlpha] !== 0 ) {\n\t \t\t return true;\n\t \t\t}\n\t \t\n\t }\n\t }\n\n\t return false;\n\t \n\t \n\t};\n\t\n\t\n}", "onCollision(response, other) {\n // Make all other objects solid\n return true;\n }", "onCollision(response, other) {\n // Make all other objects solid\n return true;\n }", "function checkCollision() {\n // check 2 heads\n if (distance(part[1][0].x, part[1][0].y, part[2][0].x, part[2][0].y) < part[1][0].r + part[2][0].r) {\n if (part[1][0].r > part[2][0].r) gameOver(1);\n\telse if (part[1][0].r < part[2][0].r) gameOver(2);\n\telse if (part[1][0].r == part[2][0].r) gameOver(0);\n return;\n }\n // check snake's head with other snake parts\n for (var id_snake_cCol = 1; id_snake_cCol <= 2; id_snake_cCol++) {\n var id_other_cCol = 3 - id_snake_cCol;\n for (var id_part_cCol = 1; id_part_cCol < part[id_snake_cCol].length; id_part_cCol++) {\n\t if (distance(part[id_other_cCol][0].x, part[id_other_cCol][0].y, \n\t\t\t\t part[id_snake_cCol][id_part_cCol].x, part[id_snake_cCol][id_part_cCol].y) < \n\t\t\t\t part[id_other_cCol][0].r + part[id_snake_cCol][id_part_cCol].r) {\n\t\t\t\t \n\t\t//console.log(id_other_cCol +\" \"+ id_snake_cCol +\" \"+ id_part_cCol +\" \"+ part[id_other_cCol][0].x +' '+ part[id_other_cCol][0].y +' '+ \n\t\t//\t\t part[id_snake_cCol][id_part_cCol].x +' '+ part[id_snake_cCol][id_part_cCol].y +' '+ \n\t\t//\t\t part[id_other_cCol][0].r +' '+ part[id_snake_cCol][id_part_cCol].r);\n\t gameOver(id_snake_cCol);\n\t\treturn;\n\t \n\t }\n\t}\n }\n}", "function collide(ground,player){\n const m = player.matrix;\n const o = player.pos;\n for (let y= 0; y < m.length; ++y){\n for (let x=0; x<m[y].length; ++x){\n if (m[y] [x] !==0 &&\n (ground[y + o.y] && \n ground[y +o.y] [x + o.x]) !==0){\n return true;\n }\n\n }\n }\n\n\n return false;\n}", "hasCollision() {\n const { y: pieceY, x: pieceX, blocks } = this.activePiece;\n\n for (let y = 0; y < blocks.length; y++) {\n for (let x = 0; x < blocks[y].length; x++) {\n if (\n blocks[y][x] && \n ((this.playfield[pieceY + y] === undefined || this.playfield[pieceY + y][pieceX + x] === undefined) ||\n this.playfield[pieceY + y][pieceX + x])\n ) {\n return true;\n }\n }\n }\n return false;\n }", "attackOverlap() {\n let a = dist(player.x, player.y, this.x, this.y);\n if (a < this.size / 2 + player.size / 2) {\n state = `endGame`;\n }\n }", "function collided() {\r\n\tfor (let j = 0; j < allGraphic.length; j++) {\r\n\t\tlet ball = allGraphic[j];\r\n\t\tlet dis = Math.sqrt((playerBall.x - ball.x) ** 2 \r\n\t\t+ (playerBall.y - ball.y) ** 2);\r\n\t\tif (dis <= ballRadius) {\r\n\t\t\treturn true;\r\n\t\t};\r\n\t};\r\n\treturn false;\r\n}", "checkCollision(that) {\n\t\tif (that.state == \"LIVE\") {\n\t\t\tthat.parts.forEach( part => {\n\t\t\t\tconst dis = dist(part.x, part.y, this.x, this.y)\n\t\t\t\t// console.log(dis)\n\t\t\t\tif (dis < 20) {\n\t\t\t\t\tthis.state = 'DEAD'\n\t\t\t\t\treturn true\n\t\t\t\t} \n\t\t\t})\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\n\t\t\n\t}", "function checkCollision(i1, i2, result) {\n\n var p1 = i1.position;\n var b1 = i1.body;\n var p2 = i2.position;\n var b2 = i2.body;\n\n if ((b1.type & 1) && (b2.type & 1)) {\n // this check is pointless for 2 circles as it's the same as the full test\n if (b1.type !== T.BODY_CIRCLE || b2.type !== T.BODY_CIRCLE) {\n vec2.add(p1, b1.boundOffset, tv1);\n vec2.add(p2, b2.boundOffset, tv2);\n var rss = b1.boundRadius + b2.boundRadius;\n if (tv1.distancesq(tv2) > rss*rss) {\n return false;\n }\n }\n }\n\n var colliding = null;\n var flipped = false;\n\n if (b1.type > b2.type) {\n \n var tmp = b2;\n b2 = b1;\n b1 = tmp;\n\n tmp = i2;\n i2 = i1;\n i1 = tmp;\n\n tmp = p2;\n p2 = p1;\n p1 = tmp;\n\n flipped = true;\n\n }\n\n if (b1.type === T.BODY_AABB) {\n if (b2.type === T.BODY_AABB) {\n colliding = AABB_AABB(i1, i2, result);\n } else if (b2.type === T.BODY_CIRCLE) {\n colliding = AABB_circle(p1, b1, p2, b2, result);\n } else if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = AABB_lineSegment(p1, b1, p2, b2, result);\n }\n } else if (b1.type === T.BODY_CIRCLE) {\n if (b2.type === T.BODY_CIRCLE) {\n colliding = circle_circle(p1, b1, p2, b2, result);\n } else if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = circle_lineSegment(i1, i2, result);\n }\n } else if (b1.type === T.BODY_LINE_SEGMENT) {\n if (b2.type === T.BODY_LINE_SEGMENT) {\n colliding = lineSegment_lineSegment(p1, b1.size, p2, b2.size, result);\n }\n }\n\n if (colliding === null) {\n console.error(\"warning: unsupported arguments to collision detection\");\n return false; \n } else {\n if (flipped) {\n result.mtv.x *= -1;\n result.mtv.y *= -1;\n }\n return colliding;\n }\n\n}", "function collisionDetection() {\n for (var c = 0; c < ladrilloColumnCount; c++) {\n for (var r = 0; r < ladrilloRowCount; r++) {\n var b = ladrillos[c][r];\n if (b.status == 1) {\n if (x > b.x && x < b.x + ladrilloWidth && y > b.y && y < b.y + ladrilloHeight) {\n dy = -dy;\n b.status = 0;\n ladrillosHit++;\n ladrillosHitPerLive++;\n puntaje++;\n document.cookie = puntaje;\n /*puntaje+=ladrillosHitPerLive;*/\n if (ladrillosHit == ladrilloRowCount * ladrilloColumnCount) {\n document.querySelector(\".congratulations\").style.display = \"block\";\n drawbola.break();\n function del_cookie() {\n document.cookie = 'roundcube_sessauth' +'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';\n }\n del_cookie(\"puntaje\");\n return;\n }\n }\n }\n }\n }\n}", "collidesWith(player) {\n //this function returns true if the the rectangles overlap\n // console.log('this.collidesWith')\n const _overlap = (platform, object) => {\n // console.log('_overlap')\n // check that they don't overlap in the x axis\n const objLeftOnPlat = object.left <= platform.right && object.left >= platform.left;\n const objRightOnPlat = object.right <= platform.right && object.right >= platform.left;\n const objBotOnPlatTop = Math.abs(platform.top - object.bottom) === 0;\n \n // console.log(\"OBJECT BOTTOM: \", object.bottom/);\n // console.log(\"PLATFORM TOP: \", platform.top);\n // console.log('objectBotOnPlat: ', !objBotOnPlatTop)\n // console.log('OBJECT RIGHT: ', object.right)\n // console.log('PLATFORM RIGHT: ', platform.right)\n // console.log(\"OBJECT LEFT: \", object.left);\n // console.log(\"PLATFORM LEFT: \", platform.left);\n // console.log('objectLeftOnPlat', !objLeftOnPlat);\n // console.log('objRightOnPlat', !objRightOnPlat);\n\n if (!objLeftOnPlat && !objRightOnPlat) {\n // if (player.y < 400) { \n // debugger\n // }\n return false;\n // if (objBotOnPlatTop) return true;\n // return false;\n }\n \n if (objLeftOnPlat || objRightOnPlat) {\n // debugger\n // console.log('PLATFORM:::::', platform.top)\n // console.log('PLAYER:::::::', object.bottom)\n // console.log('objBotOnPlat:::::::::', objBotOnPlatTop)\n\n if (objBotOnPlatTop) {\n debugger\n }\n }\n //check that they don't overlap in the y axis\n const objTopAbovePlatBot = object.top > platform.bottom;\n if (!objBotOnPlatTop) {\n // console.log()\n // if (player.y < 400) { \n // debugger\n // }\n return false;\n }\n\n return true;\n };\n\n let collision = false;\n this.eachPlatform(platform => {\n //check if the bird is overlapping (colliding) with either platform\n if (_overlap(platform, player.bounds())) {\n // console.log('WE ARE HERE IN THE OVERLAP')\n // console.log(platform)\n collision = true;\n // debugger\n // console.log(player)\n player.y = platform.top;\n // console.log('PLATFORM: ', platform)\n // console.log(collision)\n // player.movePlayer(\"up\")\n }\n // _overlap(platform.bottomPlatform, player)\n });\n\n // console.log('collision:')\n // console.log(collision)\n return collision;\n }", "checkCollision() {\n var playerBox = {x: player.x, y: player.y, width: 50, height: 40};\n var enemyBox = {x: this.x, y: this.y, width: 60, height: 70};\n // Check for collisions, if playerBox intersects enemyBox, score decrease by 1\n // and the setset the player and enemies\n if (playerBox.x < enemyBox.x + enemyBox.width &&\n playerBox.x + playerBox.width > enemyBox.x &&\n playerBox.y < enemyBox.y + enemyBox.height &&\n playerBox.height + playerBox.y > enemyBox.y) {\n this.resetGame();\n canvas.decreaseScore();\n }\n }", "handleCollision() {\n\n for (let i = 0; i < this.balls.length; i++) {\n\n this.balls[i].collideWithTable(this.table); //looks if collided with border\n this.balls[i].handlePocketCollision();\n\n for (let j = i + 1; j < this.balls.length; j++) {\n\n const ball1 = this.balls[i];\n const ball2 = this.balls[j];\n\n ball1.collideWithBall(ball2);\n }\n }\n }", "checkCollisionOne() {\n if (player.x + player.size / 2 > this.x && player.x - player.size / 2 < this.x + this.width) {\n if (player.y + player.size / 2 > this.y && player.y - player.size / 2 < this.y + this.height) {\n currentState = 1;\n }\n }\n }", "function collides(a, b) {\n if(a.x == b.x && a.y == b.y) return true;\n return false;\n }", "function checkCollision(obj1, obj2) {\n if (obj1.x > obj2.x) {\n if (obj1.y > obj2.y) {\n if (obj1.x - obj2.x < obj2.width && obj1.y - obj2.y < obj2.height) {\n if (obj1.x - obj2.x > obj1.y - obj2.y) { return 1; }\n return 2;\n }\n } else {\n if (obj1.x - obj2.x < obj2.width && obj2.y - obj1.y < obj1.height) {\n if (obj1.x - obj2.x > obj2.y - obj1.y) { return 1; }\n return 3;\n }\n }\n } else {\n if (obj1.y > obj2.y) {\n if (obj2.x - obj1.x < obj1.width && obj1.y - obj2.y < obj2.height) {\n if (obj2.x - obj1.x > obj1.y - obj2.y) { return 0; }\n return 2;\n }\n } else {\n if (obj2.x - obj1.x < obj1.width && obj2.y - obj1.y < obj1.height) {\n if (obj2.x - obj1.x > obj2.y - obj1.y) { return 0; }\n return 3;\n }\n }\n }\n return -1;\n}", "function collide(player) {\n const matrix = player.matrix;\n const position = player.pos;\n\n for (let i = 0; i < matrix.length; i++) {\n for (let j = 0; j < matrix[i].length; j++) {\n if (matrix[i][j] == 0) continue;\n if (i + position.y >= 20) return true;\n if (player.arena[i + position.y] && player.arena[i + position.y][j + position.x] !== 0) {\n return true;\n }\n }\n }\n\n return false;\n}", "checkCollisions() {\n allEnemies.forEach(function(enemy) {\n if ( Math.abs(player.x - enemy.x) <= 80 &&\n Math.abs(player.y - enemy.y) <= 30 ) {\n player.x=200;\n player.y=405;\n }\n });\n }", "function conflict () {\n if (player1.row == player2.row && (player1.col == player2.col-1 || player1.col == player2.col +1)) {\n return true\n }\n if (player1.col == player2.col && (player1.row == player2.row-1 || player1.row == player2.row +1)) {\n return true\n }\n return false\n}", "function detectCollision(player1, player2){\n\treturn Math.abs(player1.x-player2.x) < 40 && Math.abs(player1.y-player2.y) < 40;\n}", "function collide(A, B) {\n if ( A.x < B.x + CAR_WIDTH && A.x + CAR_WIDTH > B.x &&\n A.y < B.y + CAR_HEIGHT && A.y + CAR_HEIGHT > B.y ) {\n if ( DEBUG ) {\n console.log(\"Colision entre deux véhicules\");\n }\n return true;\n }\n return false;\n}", "function checkCollisions(keys) {\n // Itter through grid names\n for (let i = 0; i < keys.length; i++) {\n // Grid has more than 1 object\n if (usedSections[keys[i]].length > 1) {\n // get the used grid\n let grid = usedSections[keys[i]];\n // Itter through objects inside the grid\n for (let p1 = 0; p1 < grid.length; p1++) {\n for (let p2 = 0; p2 < grid.length; p2++) {\n // Aslong as the object isnt looking at itself check for collisions\n // Checks objects no object will have the exact same values.\n if (p1 != p2) {\n let pa1 = particles[grid[p1][2]];\n let pa2 = particles[grid[p2][2]];\n let distance = dist(pa1.pos.x, pa1.pos.y, pa2.pos.x, pa2.pos.y);\n if (distance <= master.size) {\n // Using try to prevent out of bound bug that used to occur that would stop the main loop and freeze the game\n try {\n pa1.isColliding = true\n pa2.isColliding = true\n } finally {\n continue\n }\n }\n }\n }\n }\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 checkCollision(a, b) {\n if (a !== undefined && b !== undefined) {\n var aRad = (a.a + a.b + a.c) / 3;\n var bRad = (b.a + b.b + b.c) / 3;\n var aPos = vec3.create();\n\n vec3.add(aPos, a.center, a.translation);\n var bPos = vec3.create();\n vec3.add(bPos, b.center, b.translation);\n var dist = vec3.distance(aPos, bPos);\n\n if (dist < aRad + bRad) {\n //spawn explosion and destroy asteroid, doesn't matter what asteroid collided with, always explodes\n generateExplosion(vec3.add(vec3.create(), vec3.fromValues(a.x, a.y, a.z),\n vec3.fromValues(a.translation[0], a.translation[1], a.translation[2])), false);\n deleteModel(a);\n //handle collision\n if (b.tag == 'shot') {\n // destroy asteroid and shot, give player points\n //test *******apocalypse = true;\n //test *******gameOver(b);\n deleteModel(b);\n score += 10;\n document.getElementById(\"score\").innerHTML = \"Score: \" + score;\n } else if (b.tag == 'station') {\n // destroy asteroid, damage station and destroy if life < 0 then weaken shield\n // if last station destroyed, destroy shield as wells\n b.health -= 5;\n if (b.css == 'station1') {\n document.getElementById(\"station1\").innerHTML = \"Station Alpha: \" + b.health;\n } else if (b.css == 'station2') {\n document.getElementById(\"station2\").innerHTML = \"Station Bravo: \" + b.health;\n } else {\n document.getElementById(\"station3\").innerHTML = \"Station Charlie: \" + b.health;\n }\n if (b.health == 0) {\n var change = false;\n base_limit--;\n // reduce shield alpha by one to signify weakening\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'shield') {\n inputEllipsoids[o].alpha -= 0.2;\n }\n }\n // if the destroyed center is highlighted, switch to next\n if (b.id == current_center) {\n for (var s in stations) {\n if (stations[s].id > b.id) {\n stations[s].id--;\n }\n }\n change = true;\n }\n // remove the destroyed station\n station_centers.splice(b.id, 1);\n deleteModel(b);\n // has to be after splice/delete or else will access out of date station_centers\n if (change) {\n current_center++;\n changeStation();\n }\n shield_level--;\n document.getElementById(\"shield\").innerHTML = \"Shield: \" + shield_level;\n // destroy shield if no more stations\n if (shield_level == 0) {\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'shield') {\n deleteModel(inputEllipsoids[o]);\n break;\n }\n }\n deleteModel(highlight);\n }\n if (b.css == 'station1') {\n document.getElementById(\"station1charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station1\").innerHTML = \"Station Alpha:\"\n } else if (b.css == 'station2') {\n document.getElementById(\"station2charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station2\").innerHTML = \"Station Bravo:\"\n } else {\n document.getElementById(\"station3charge\").innerHTML = \"Destroyed!\";\n document.getElementById(\"station3\").innerHTML = \"Station Charlie:\"\n }\n }\n } else if (b.tag == 'shield') {\n // destroy asteroid, damage earth based on shield strength\n earth_health -= 15 / shield_level;\n document.getElementById(\"earth\").innerHTML = \"Earth: \" + earth_health;\n if (earth_health <= 0) {\n for (var o in inputEllipsoids) {\n if (inputEllipsoids[o].tag == 'earth') {\n // handle game over\n gameOver(inputEllipsoids[o]);\n break;\n }\n }\n }\n } else if (b.tag == 'earth') {\n // destroy asteroid, damage earth and destroy if life < 0\n earth_health -= 15;\n document.getElementById(\"earth\").innerHTML = \"Earth: \" + earth_health;\n if (earth_health <= 0) {\n // handle game over\n gameOver(b);\n }\n } else if (b.tag == 'moon') {\n b.health -= 5;\n if (b.health <= 0) {\n generateExplosion(vec3.add(vec3.create(), vec3.fromValues(b.x, b.y, b.z),\n vec3.fromValues(b.translation[0], b.translation[1], b.translation[2])), true);\n deleteModel(b);\n }\n }\n }\n }\n}", "function collides(b, p) {\n\n if (b.y + ball.r >= p.y && b.y - ball.r <= p.y + p.h) {\n if (b.x >= (p.x - p.w) && p.x > 0) {\n paddleHit = RIGHT;\n return true;\n }\n\n else if (b.x <= p.w && p.x == 0) {\n paddleHit = LEFT;\n return true;\n }\n\n else return false;\n\n }\n}", "function copCollision() {\r\n\r\n for (i = 0; i < bullet.length; i++) {\r\n var distXCop = Math.abs(bullet[i].x - pX - 45 / 2);\r\n var distYCop = Math.abs(bullet[i].y - pY - 45 / 2);\r\n\r\n //no collision\r\n if (distXCop > (25 / 2 + 20)) {\r\n continue;\r\n }\r\n if (distYCop > (25 / 2 + 20)) {\r\n continue;\r\n }\r\n\r\n //collision\r\n if (distXCop <= (25 / 2)) {\r\n return true;\r\n }\r\n if (distYCop <= (25 / 2)) {\r\n return true;\r\n }\r\n\r\n //Initially was a colision algrothim for circle-rectangle, this part still worked though so kept\r\n var dx = distXCop - 25 / 2;\r\n var dy = distYCop - 25 / 2;\r\n if (dx * dx + dy * dy <= (20 * 20)) {\r\n return true;\r\n }\r\n }\r\n}", "function IdentifyEnemy(){\n//aggiungo ad un array ogni enemy che entra nella collision\n//faccio un cilclo for che cerca prende la posizione tra tutti <code> array_nemici[i].transform.position.x </code> le posizioni vengono confrontate e quello con la x piu grande diventa l obbiettivo della torretta\n//una volta preso l obbiettivo la torretta controlla che sia nel suo range <code> Vector3.Distance(gameObject.transform.position, enemy.transform.position) < n </code> e che la vita del gameObject sia diversa da 0\n//la torretta istanzia il proiettile che si muove contro il nemico selezionato, la vita viene diminuita\n//controllo che la vita sia = 0,in questo caso distruggo il nemico e lo rimuovo dall array\n//ricomputo il for e faccio tutto da capo \n\n\n\n}", "function criminalCollision() {\r\n\r\n for (i = 0; i < bullet.length; i++) {\r\n var distXCrime = Math.abs(bullet[i].x - eX - 45 / 2);\r\n var distYCrime = Math.abs(bullet[i].y - eY - 45 / 2);\r\n\r\n //no collision\r\n if (distXCrime > (25 / 2 + 20)) {\r\n continue;\r\n }\r\n if (distYCrime > (25 / 2 + 20)) {\r\n continue;\r\n }\r\n\r\n //collision\r\n if (distXCrime <= (25 / 2)) {\r\n return true;\r\n }\r\n if (distYCrime <= (25 / 2)) {\r\n return true;\r\n }\r\n\r\n //Initially was a colision algrothim for circle-rectangle, this part still worked though so kept\r\n var dx=distXCrime-25/2;\r\n var dy=distYCrime-25/2;\r\n if (dx*dx+dy*dy<=(20*20)){\r\n return true;\r\n }\r\n }\r\n}", "checkCollisions(){\n //current user id\n const uid = this.props.userkey;\n // current players gfx\n const player = this[`player_${uid}`];\n // getting list of boozied player\n const boozies = Object.keys(this.props.games[this.currentGame].players).filter((id)=>{\n return this.props.games[this.currentGame].players[id].playerstate === 'IT';\n });\n\n // checking for collision against boozied if current player is not boozied\n if(!boozies.includes(uid)){\n boozies.forEach((id)=>{\n if(this.circleHit(player, this[`player_${id}`])){\n //changing current player to boozied in db if caught\n const updates = {};\n updates[`/games/${this.currentGame}/players/${uid}/playerstate`] = 'IT';\n this.db.ref().update(updates);\n }\n });\n }\n }", "function collide(arena, player) {\n const [m, o] = [player.matrix, player.pos];\n for(var y = 0; y < m.length; y++){\n for(var x = 0; x < m[y].length; x++){\n if(m[y][x] !== 0 && \n (arena[y + o.y] && \n arena[y + o.y][x + o.x]) !== 0) {\n return true;\n }\n }\n }\n return false;\n}" ]
[ "0.7506506", "0.7225124", "0.7194058", "0.71261394", "0.7066454", "0.70276684", "0.69875944", "0.692585", "0.69044", "0.6873446", "0.6845036", "0.67910284", "0.672938", "0.67030776", "0.6663254", "0.6656727", "0.66527855", "0.6643274", "0.663", "0.6629857", "0.66223836", "0.6614952", "0.6600759", "0.65958536", "0.65937465", "0.65866256", "0.6583635", "0.65750545", "0.65683436", "0.65393907", "0.653717", "0.65368056", "0.6535604", "0.65318906", "0.6530567", "0.652961", "0.6528204", "0.65256023", "0.6509452", "0.65088546", "0.6498093", "0.64978606", "0.64887494", "0.64819187", "0.6472051", "0.6461595", "0.6460003", "0.6451785", "0.64512205", "0.6441522", "0.6439456", "0.6433286", "0.6431264", "0.64272267", "0.6423425", "0.6423027", "0.6417194", "0.64092296", "0.64056265", "0.6402663", "0.6395794", "0.6394113", "0.6392208", "0.638661", "0.6382281", "0.63733053", "0.6371028", "0.63683337", "0.63666093", "0.63566077", "0.6353954", "0.6353954", "0.634929", "0.6343258", "0.6339435", "0.6336376", "0.6333525", "0.63335234", "0.6332554", "0.632791", "0.63279074", "0.6327544", "0.63269484", "0.63266015", "0.63250107", "0.6323023", "0.6321726", "0.63216627", "0.632144", "0.6320931", "0.6313589", "0.63112944", "0.63085335", "0.6305871", "0.63057697", "0.63017136", "0.63016385", "0.63000464", "0.629923", "0.62991" ]
0.7339713
1
Get the log file from the given S3 bucket and key. Parse it and add each log record to the ES domain.
function s3LogsToES(bucket, key, context, lineStream, recordStream) { // Note: The Lambda function should be configured to filter for .log files // (as part of the Event Source "suffix" setting). addFileToDelete(bucket, key); var s3Stream = s3.getObject({ Bucket: bucket, Key: key }).createReadStream(); var indexName = bucket + '-' + indexTimestamp; console.log("s3LogsToES", key); // Flow: S3 file stream -> Log Line stream -> Log Record stream -> ES s3Stream .pipe(zlib.createGunzip()) .pipe(lineStream) .pipe(recordStream) .on('data', function (parsedEntry) { postDocumentToES(indexName, parsedEntry, context); }); s3Stream.on('error', function () { console.log( 'Error getting object "' + key + '" from bucket "' + bucket + '". ' + 'Make sure they exist and your bucket is in the same region as this function.'); context.fail(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function s3LogsToES(bucket, key, context, lineStream, recordStream) {\n // Note: The Lambda function should be configured to filter for .log files\n // (as part of the Event Source \"suffix\" setting).\n\n var s3Stream = s3.getObject({Bucket: bucket, Key: key}).createReadStream();\n\n // Flow: S3 file stream -> Log Line stream -> Log Record stream -> ES\n \n\tpostDocumentToES(key, context);\n \n\n s3Stream.on('error', function() {\n\n console.log(\n 'Error getting object \"' + key + '\" from bucket \"' + bucket + '\". ' +\n 'Make sure they exist and your bucket is in the same region as this function.');\n context.fail();\n });\n}", "function s3LogsToES(bucket, key, context, lineStream, recordStream) {\n // Note: The Lambda function should be configured to filter for .log files\n // (as part of the Event Source \"suffix\" setting).\n\n var s3Stream = s3.getObject({Bucket: bucket, Key: key}).createReadStream();\n\n // Flow: S3 file stream -> Log Line stream -> Log Record stream -> ES\n s3Stream\n .pipe(lineStream)\n .pipe(recordStream)\n .on('data', function(parsedEntry) {\n postDocumentToES(parsedEntry, context);\n });\n\n s3Stream.on('error', function() {\n console.log(\n 'Error getting object \"' + key + '\" from bucket \"' + bucket + '\". ' +\n 'Make sure they exist and your bucket is in the same region as this function.');\n context.fail();\n });\n}", "function fetchAndStoreObject(bucket, key, fn) {\n\tif (bucket === null) {\n\t\tbucket = constants.defaultBucket;\n\t}\n\tvar params = {\n\t\tBucket : bucket, /* required */\n\t\tKey : key\n\t/* required */\n\t};\n\tconsole.log(\"getObject for \" + JSON.stringify(params));\n\tvar file = fs.createWriteStream('/tmp/' + key);\n\ts3.getObject(params).on('httpData', function(chunk) {\n\t\tfile.write(chunk);\n\t\t// console.log(\"writing chunk in file.\"+key);\n\t}).on('httpDone', function() {\n\t\tfile.end();\n\t\tconsole.log(\"file end.\" + key);\n\t\tfn();\n\t}).send();\n}", "logAccessLogs(bucket, prefix) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_s3_IBucket(bucket);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, this.logAccessLogs);\n }\n throw error;\n }\n prefix = prefix || '';\n this.setAttribute('access_logs.s3.enabled', 'true');\n this.setAttribute('access_logs.s3.bucket', bucket.bucketName.toString());\n this.setAttribute('access_logs.s3.prefix', prefix);\n const logsDeliveryServicePrincipal = new aws_iam_1.ServicePrincipal('delivery.logs.amazonaws.com');\n bucket.grantPut(this.resourcePolicyPrincipal(), `${(prefix ? prefix + '/' : '')}AWSLogs/${core_1.Stack.of(this).account}/*`);\n bucket.addToResourcePolicy(new aws_iam_1.PolicyStatement({\n actions: ['s3:PutObject'],\n principals: [logsDeliveryServicePrincipal],\n resources: [\n bucket.arnForObjects(`${prefix ? prefix + '/' : ''}AWSLogs/${this.env.account}/*`),\n ],\n conditions: {\n StringEquals: { 's3:x-amz-acl': 'bucket-owner-full-control' },\n },\n }));\n bucket.addToResourcePolicy(new aws_iam_1.PolicyStatement({\n actions: ['s3:GetBucketAcl'],\n principals: [logsDeliveryServicePrincipal],\n resources: [bucket.bucketArn],\n }));\n // make sure the bucket's policy is created before the ALB (see https://github.com/aws/aws-cdk/issues/1633)\n this.node.addDependency(bucket);\n }", "function getFileStream(fileKey) {\n const downloadParams = {\n Key: fileKey,\n Bucket: bucketName\n }\n var object = s3.getObject(downloadParams).createReadStream().on('error', (err) => console.log(err + 'ERROR GET FILE FROM 3S'))\n return object\n}", "static getFile (bucketName, objectKey) {\n const s3 = Storage._getS3Instance();\n const params = {\n Bucket: bucketName,\n Key: objectKey\n };\n return new Promise((resolve, reject) => {\n s3.getObject(params, (err, data) => {\n if (err) {\n reject(err);\n } else {\n resolve({\n content: data.Body, // buffer\n type: data.ContentType, // string\n encoding: data.ContentEncoding, // string\n size: data.ContentLength // integer\n });\n }\n });\n });\n }", "get(bucket, key) {\n return this.store.get(`${bucket}${DELIM}${key}`);\n }", "function uploadAndFetch (s3, stream, filename, bucket, key) {\n var deferred = when.defer();\n exports.getFileStream(filename)\n .pipe(stream)\n .on(\"error\", deferred.reject)\n .on(\"finish\", function () {\n deferred.resolve(exports.getObject(s3, bucket, key));\n });\n return deferred.promise;\n}", "function getObjFromS3(fileName, bucket, callback){\n let params = {Bucket: bucket, Key:fileName};\n s3.getObject(params, function(err, data){\n if(err){\n console.error(\"getObjFromS3 err\",err);\n } else {\n callback(data.Body.toString('utf-8'));\n }\n \n });\n\n}", "function getFileStream(key) {\n const downloadParams = {\n Key: key,\n Bucket: 'week18'\n }\n return s3.getObject(downloadParams).createReadStream()\n}", "function fetchFromS3(env, callback){\n // get the investigators cached version from AWS.\n if (!isValidEnv(env)){\n callback(\"Invalid env passed into fetchFromS3()\");\n return;\n }\n // construct the filename from the env\n var filename = getS3FilePath(env);\n var params = {\n Bucket: AWS_BUCKET_NAME,\n Key: filename\n };\n // get the file\n console.log(\"Calling s3....\");\n s3.getObject(params, function(err,data){\n if (err){\n callback(\"InvestigatorService S3: \" + err.code);\n } else {\n var text = data.Body.toString('ascii');\n callback(null, text);\n }\n });\n}", "function baseAwsS3 (base, s3Bucket) {\n\n var recordsPath = path.join(base, '/outputs/records');\n\n utility.longWalk(recordsPath, function (hosts) {\n var hostsIndex = 0;\n\n function recursiveHost (host) {\n utility.longWalk(host, function (recs) {\n var recsCount = recs.length;\n var recsIndex = 0;\n\n function recursiveRecord (rec) {\n utility.longWalk(rec, function (files) {\n var fileCount = files.length;\n var fileIndex = 0;\n\n function recursiveUpload (file) {\n archiver.uploadToS3(file, s3Bucket, function (res) {\n console.log(res);\n fileIndex++;\n\n if (fileIndex < fileCount) {\n recursiveUpload(files[fileIndex]);\n }\n\n if (fileIndex === fileCount) {\n fs.rmrf(recs[recsIndex], function (err) {\n if (err) console.log(err);\n else {\n recsIndex++;\n if (recsIndex < recsCount) {\n recursiveRecord(recs[recsIndex]);\n }\n if (recsIndex === recsCount) {\n fs.rmrf(hosts[hostsIndex], function (err) {\n if (err) console.log(err);\n else {\n hostsIndex++;\n recursiveHost(hosts[hostsIndex]);\n }\n })\n }\n }\n })\n }\n })\n }\n if (fileCount === 0) {\n recsIndex++;\n recursiveRecord(recs[recsIndex]);\n } else {\n recursiveUpload(files[fileIndex]);\n }\n })\n }\n recursiveRecord(recs[recsIndex]);\n })\n }\n recursiveHost(hosts[hostsIndex]);\n })\n}", "async exportFromS3(params) {\n s3.getObject(params, function (err, data) {\n const convertJsonToCsv = (json) => {\n let fields = Object.keys(json[0]);\n const replacer = (key, value) => (value === null ? \"\" : value);\n let csv = json.map((row) =>\n fields.map((field) => JSON.stringify(row[field], replacer)).join(\",\")\n );\n csv.unshift(fields.join(\",\"));\n csv = csv.join(\"\\r\\n\");\n return csv;\n };\n\n if (data) {\n let json = JSON.parse(data.Body.toString());\n let csv = convertJsonToCsv(json);\n let filename = \"\";\n if (params.Key.includes(\"time/\")) {\n filename = params.Key.replace(\"time/\", \"\");\n } else {\n filename = params.Key.replace(\"sprint/\", \"\");\n }\n\n let blob = new Blob([csv], {\n type: \"\",\n });\n FileSaver.saveAs(blob, filename + CSV_FILE_ATTACHMENT);\n } else {\n console.log(\"Error: \" + err);\n }\n });\n }", "function parseS3Url(url) {\n const [bucket, ...keyFragments] = url.replace(S3_PROTOCOL_PREFIX, '').split('/');\n return { bucket, key: keyFragments.join('/') };\n}", "function processRecord(record, callback) {\n \n // The source bucket and source key are part of the event data\n var srcBucket = record.s3.bucket.name;\n var srcKey = decodeURIComponent(record.s3.object.key.replace(/\\+/g, \" \"));\n \n // Get the target bucket(s) based on the source bucket.\n // Once we have that, perform the copy.\n getTargetBuckets(srcBucket, function (err, targets) {\n if (err) {\n console.log(\"Error getting target bucket: \"); // an error occurred\n console.log(err, err.stack); // an error occurred\n callback(\"Error getting target bucket from source bucket '\" + srcBucket + \"'\");\n return;\n }\n \n async.each(targets, function (target, callback) {\n\n var targetBucket = target.bucketName;\n var regionName = target.regionName;\n var targetBucketName = targetBucket;\n if (regionName != null)\n targetBucketName = targetBucketName + \"@\" + regionName;\n var targetKey = srcKey;\n \n console.log(\"Copying '\" + srcKey + \"' from '\" + srcBucket + \"' to '\" + targetBucketName + \"'\");\n \n // Copy the object from the source bucket\n var s3 = createS3(regionName);\n s3.copyObject({\n Bucket: targetBucket,\n Key: targetKey,\n \n CopySource: encodeURIComponent(srcBucket + '/' + srcKey),\n MetadataDirective: 'COPY'\n }, function (err, data) {\n if (err) {\n console.log(\"Error copying '\" + srcKey + \"' from '\" + srcBucket + \"' to '\" + targetBucketName + \"'\");\n console.log(err, err.stack); // an error occurred\n callback(\"Error copying '\" + srcKey + \"' from '\" + srcBucket + \"' to '\" + targetBucketName + \"'\");\n } else {\n callback();\n }\n });\n }, function (err) {\n if (err) {\n callback(err);\n } else {\n callback();\n }\n });\n });\n}", "function saveToS3(fileName) {\n // load in file;\n let logDir = './logs';\n let directory =`${logDir}/${fileName}`;\n let myKey = fileName;\n var myBody;\n console.log(directory);\n\n // read then save to s3 in one step (so no undefined errors)\n fs.readFile(directory, (err, data) => {\n if (err) throw err;\n myBody = data;\n console.log(\"save to s3 data is \" + data);\n var params = {Bucket: myBucket, Key: myKey, Body: myBody, ContentType: 'text/plain'};\n s3.putObject(params, function(err, data) {\n if (err) {\n console.log(err)\n } else {\n console.log(\"Successfully uploaded data to myBucket/myKey\");\n }\n });\n\n });\n fs.unlink(directory);\n\n // the create bucket stuff started to cause problems (error: \"BucketAlreadyOwnedByYou: Your previous request to create the named bucket succeeded and you already own it.\")\n // so I pulled it all out\n}", "function getLog(key){\n\tlet tmp = key.replace('log',''); //remove log prefix from the key to get the number\n\tlogNumber = Number(tmp); //parse the string into a number\n\tlocalforage.getItem('logs') //load the logs from memory\n\t.then((logs)=>{\n\t\tlet log = logs[key]; //get our log at the parameter key.\n\t\tconsole.log(log)\n\t\tfor(let field in log){ //itwerage over the fields of the log\n\t\t\tlet value = log[field];\n\t\t\tif(typeof value === \"string\") //if the field is a string, it goes to a text input\n\t\t\t\t$(`.${field}`).val(value);\n\t\t\telse if(value){ //or else it is a checkbox\n\t\t\t\t$(`input[val=${field}]`).prop('checked',true);\n\t\t\t}\n\t\t\telse{\n\t\t\t\t$(`input[val=${field}]`).prop('checked',false);\n\t\t\t}\n\t\t}\n\t})\n\n\treturn\n}", "function uploadFileIntoBucket(){\n // Create S3 service object\n s3 = new AWS.S3({apiVersion: '2006-03-01'});\n\n // call S3 to retrieve upload file to specified bucket\n var uploadParams = {Bucket: process.argv[2], Key: '', Body: ''};\n var file = process.argv[3];\n\n // Configure the file stream and obtain the upload parameters\n var fs = require('fs');\n var fileStream = fs.createReadStream(file);\n fileStream.on('error', function(err) {\n console.log('File Error', err);\n });\n\n uploadParams.Body = fileStream;\n var path = require('path');\n uploadParams.Key = path.basename(file);\n\n // call S3 to retrieve upload file to specified bucket\n s3.upload (uploadParams, function (err, data) {\n if (err) {\n console.log(\"Error\", err);\n } if (data) {\n console.log(\"Upload Success\", data.Location);\n }\n });\n}", "function getFileStream(fileKey) {\n const downloadParams = {\n Key: fileKey,\n Bucket: bucketName,\n };\n\n return s3.getObject(downloadParams).createReadStream();\n}", "function getS3File(bucketName, fileName, versionId, callback) {\n var params = {\n Bucket: bucketName,\n Key: fileName\n };\n if (versionId) {\n params.VersionId = versionId;\n }\n s3.getObject(params, function (err, data) {\n callback(err, data);\n });\n}", "load() {\n try {\n const logString = this.storage.get(storageKey);\n if (logString !== undefined) {\n this.deserializeJson(JSON.parse(logString));\n }\n }\n catch (err) {\n logError('Failed to load progress log:', err);\n }\n }", "function LogFile(id) {\n this.id = id;\n this.knownLoggers = {};\n this._dateBucketsByName = {};\n this._dateBuckets = [];\n this._newBuckets = [];\n}", "async function listLogFiles(next_query = {autoPaginate: false, maxResults: concurrentImport}) {\n // Lists files in the bucket\n return await bucket.getFiles(next_query);\n}", "function uploadFile(bucket, key, fileLocation, callback) {\n fs.readFile(fileLocation, function(err, data) {\n if (err) {\n return callback(err);\n }\n\n var params = {\n Bucket: bucket,\n Key: key + '.webm',\n Body: data\n };\n\n s3.putObject(params, callback);\n });\n}", "function getFileStream(fileKey) {\n const downloadParams = {\n Key: fileKey,\n Bucket: AWS_BUCKET_NAME\n }\n\n return s3.getObject(downloadParams).createReadStream()\n}", "urlForObject(key) {\n const components = [`https://s3.${this.node.stack.region}.${this.node.stack.urlSuffix}/${this.bucketName}`];\n if (key) {\n // trim prepending '/'\n if (typeof key === 'string' && key.startsWith('/')) {\n key = key.substr(1);\n }\n components.push('/');\n components.push(key);\n }\n return components.join('');\n }", "async function fetchInputFromS3(s3URL) {\n const tmpDir = await tmp.dir({ dir: \"/tmp\" });\n const parsedS3URL = url.parse(s3URL);\n const localFile = path.join(tmpDir.path, path.basename(parsedS3URL.path));\n console.log(`Downloading ${s3URL} to ${localFile}...`);\n\n const params = {\n Bucket: parsedS3URL.host,\n Key: parsedS3URL.path.slice(1),\n };\n const s3 = new AWS.S3();\n const readStream = s3.getObject(params).createReadStream();\n await new Promise((resolve, reject) => {\n readStream.on(\"error\", reject);\n readStream.on(\"end\", resolve);\n const file = fs.createWriteStream(localFile);\n readStream.pipe(file);\n });\n return localFile;\n}", "function getEventInfo(eventId) {\n var params = {\n Bucket: 'training-schedule',\n Key: 'ready/current-schedule.csv',\n Expression: 'select * from s3object s where \"Event ID\" = \\'' + eventId + '\\'',\n ExpressionType: \"SQL\", \n InputSerialization: { CSV: {} },\n OutputSerialization: { JSON: {} }\n };\n s3.selectObjectContent(params, function(err, data) {\n if (err) console.log(err, err.stack); // an error occurred\n else {\n console.log(data); // successful response\n var eventStream = data.Payload;\n\n eventStream.on('data', function(event) {\n // Check the top-level field to determine which event this is.\n if (event.Records) {\n // handle Records event\n console.log('this is the payload: ' + event.Records.Payload);\n }\n });\n \n } \n });\n}", "function getVersion (bucket, key, back, callback) {\n bucket = bucket.toLowerCase();\n var s3 = new AWS.S3();\n var version_params = {\n Bucket: bucket, /* required */\n KeyMarker: key,\n MaxKeys: back\n };\n s3.listObjectVersions(version_params, function(err, data) {\n if (err) {\n console.log(err, err.stack); // an error occurred\n console.log('bucket: '+bucket+ 'key: '+key+' back: '+back+' lastVersion: '+lastVersion);\n } else {\n\n if (data.Versions.length < back-1) {\n console.log('only one version');\n callback(null);\n return;\n }\n\n if (data.Versions[back-1].Key != key+'/store.json') {\n console.log('only one version, key mismatch: '+key+ ' vs '+data.Versions[back-1].Key);\n callback(null);\n return;\n }\n //console.log(data);\n var lastVersion = data.Versions[back-1].VersionId;\n //console.log('got last version for path: '+key+' id: '+lastVersion);\n //console.log(JSON.stringify(data, null, 4));\n var get_params = {\n Bucket: bucket,\n Key: key+'/store.json',\n VersionId: lastVersion\n }\n\n s3.getObject(get_params, function(err, data) {\n if (err) {\n console.log(err, err.stack); // an error occurred\n console.log('bucket: '+bucket+ 'key: '+key+' back: '+back+' lastVersion: '+lastVersion);\n } else {\n //console.log(data);\n callback(data.Body);\n }\n });\n }\n });\n}", "function uploadFileIntoFolderOfBucket(){\n // Create S3 service object\n s3 = new AWS.S3({apiVersion: '2006-03-01'});\n\n // call S3 to retrieve upload file to specified bucket\n var uploadParams = {Bucket: process.argv[2], Key: '', Body: ''};\n var file = process.argv[4];\n\n // Configure the file stream and obtain the upload parameters\n var fs = require('fs');\n var fileStream = fs.createReadStream(file);\n fileStream.on('error', function(err) {\n console.log('File Error', err);\n });\n\n uploadParams.Body = fileStream;\n var path = require('path');\n uploadParams.Key = process.argv[3]+\"/\"+path.basename(file);\n\n // call S3 to retrieve upload file to specified bucket\n s3.upload (uploadParams, function (err, data) {\n if (err) {\n console.log(\"Error\", err);\n } if (data) {\n console.log(\"Upload Success\", data.Location);\n }\n });\n}", "function getFile (params) {\n return new Promise((resolve,reject) => s3.getObject(params, function(err, data) {\n if (err) {\n reject(err);\n // file does not exist\n var attachment = {}\n attachment.text = params[\"Key\"]\n attachment.color = \"#FF0000\"\n attachment.title = \"File Missing!\"\n missingFilesArry.push(attachment)\n }\n else {\n resolve(data);\n //file exists\n receivedFilesArry.push(params[\"Key\"])\n }\n }))\n}", "function getFileLog(file){\n file_log=[]\n return MIRESAdmin.firestore().collection(MIRESconfig.MIRES_storage_log).where('file_path','==',file).orderBy(\"timestamp\",\"asc\").get()\n .then(log => {\n if(log.empty){\n console.log(\"getFileLog function: there are no logs.\")\n return file_log;\n }\n else{\n log.forEach(row =>{\n file_log.push({\n id:row.id,\n file_path:row.data().file_path,\n generation: row.data().generation,\n type: row.data().type,\n transaction_id : row.data().transaction_id,\n });\n })\n return file_log;\n }\n }) .catch(err => {\n console.log(\"getFileLog function: \"+ err);\n }); \n}", "function combineObjectWithCachedS3File(config, upload, downloadDict, s3, key, newObj, callback) {\n var localFilename = config.workingDir + \"/\" + config.outBucket + \"/\" + key;\n var localDir = localFilename.substring(0, localFilename.lastIndexOf('/'));\n\n var inFlight = downloadDict[localFilename];\n if (inFlight) {\n //console.log(\"Download race condition avoided, queued\", key, newObj);\n inFlight.obj = tarasS3.combineObjects(newObj, inFlight.obj);\n inFlight.callbacks.push(callback);\n return; // we are done, our callback will get called as part of original inFlight request\n } else {\n downloadDict[localFilename] = inFlight = {'obj':newObj, 'callbacks':[callback]};\n }\n\n async.waterfall([\n // try to read file from local cache before we go to out to s3\n function (callback) {\n fs.readFile(localFilename, function (err, data) {\n function fallback() {\n var params = {'s3':s3, 'params':{'Bucket': config.outBucket, 'Key':key}};\n return tarasS3.S3GetObjectGunzip(params, function (err, data) {\n if (err) {\n // 404 on s3 means this object is new stuff\n if (err.statusCode == 404)\n return callback(null, {});\n else\n return callback(err);\n }\n callback(null, JSON.parse(data));\n })\n }\n // missing file or invalid json are both reasons for concern\n if (err) {\n return fallback()\n }\n var obj;\n try {\n obj = JSON.parse(data)\n }catch(e) {\n return fallback()\n }\n callback(null, obj);\n });\n },\n function (obj, callback) {\n inFlight.obj = tarasS3.combineObjects(inFlight.obj, obj);\n mkdirp.mkdirp(localDir, callback);\n },\n function(ignore, callback) {\n str = JSON.stringify(inFlight.obj);\n delete downloadDict[localFilename];\n upload(key, localFilename, str, callback);\n }\n ],function (err, data) {\n if (err)\n return callback(err);\n inFlight.callbacks.forEach(function (callback) {callback(null, key)});\n });\n}", "async uploadToS3(jsonFile) {\n const params = {\n Bucket: \"time-tracking-storage\",\n Key:\n TIME_PAGE_PREFIX +\n this.state.selectedFile.name.split(CSV_FILE_ATTACHMENT, 1).join(\"\"),\n ContentType: \"json\",\n Body: JSON.stringify(jsonFile),\n };\n\n s3.putObject(params, (err, data) => {\n if (data) {\n this.getListS3();\n } else {\n console.log(\"Error: \" + err);\n this.setState({ labelValue: params.Key + \" not uploaded.\" });\n }\n });\n\n this.setState({\n labelValue: params.Key + \" upload successfully.\",\n selectedFile: null,\n });\n }", "static putFile (bucketName, objectKey, objectBody) {\n const s3 = Storage._getS3Instance();\n const params = {\n Bucket: bucketName,\n Key: objectKey,\n Body: objectBody\n };\n return new Promise((resolve, reject) => {\n s3.upload(params, (err, data) => err ? reject(err) : resolve(data.Location));\n });\n }", "function uploadFile(file, signedRequest, url){\n const xhr = new XMLHttpRequest();\n xhr.open('PUT', signedRequest);\n xhr.setRequestHeader('Content-Type', \"text/csv\")\n xhr.onreadystatechange = () => {\n if(xhr.readyState === 4){\n if(xhr.status === 200){\n //console.log('upload to s3 success');\n }\n else{\n alert('Could not upload file.');\n }\n }\n };\n xhr.send(file);\n}", "save(bucket, key, value) {\n\n if (!this.__validate(bucket, key)) {\n throw errors.InvalidStringFormat(`A bucket and key should not contain ${DELIM}`);\n }\n\n return this.store.put(`${bucket}${DELIM}${key}`, value);\n }", "function getGetSignedUrl(key) {\n const signedUrlExpireSeconds = 60 * 5;\n return exports.s3.getSignedUrl('getObject', {\n Bucket: config_1.config.aws_media_bucket,\n Key: key,\n Expires: signedUrlExpireSeconds,\n });\n}", "function S3MapBucket(s3, s3params, limit, mapper, callback) {\n async.waterfall([ function (callback) {\n S3ListObjects(s3, s3params,\n function(err, ls) {\n if (err)\n return callback([err, s3params]);\n \n var files = ls.filter(function (x) {return x.Size > 0})\n .map(function (x) {return x.Key})\n callback(null, files)\n });\n },\n function (files, callback) {\n async.mapLimit(files, limit, \n function (file, callback) {\n S3GetObjectGunzip({'s3':s3, 'params':{'Bucket':s3params.Bucket, 'Key':file}}, \n function (err, fileData) {\n if(err) {\n return callback([err, file]);\n }\n mapper(file, fileData, callback)\n })\n },\n function (err, data) {\n callback(err, data);\n })\n processedLogs = files\n }\n ], callback)\n}", "async function putS3(fileKey, data) {\n oLog.verbose(__filename, 'putS3');\n\n try {\n if (configs.aws.s3.active) {\n // set aws region:\n rAWS.config.update({\n region: configs.aws.s3.region\n });\n // bucket info:\n let s3Bucket = configs.aws.s3.s3bucket;\n let s3FileKey = fileKey;\n let s3Params = {\n Bucket: s3Bucket,\n Key: s3FileKey,\n Body: data\n };\n\n // get object and parse the JSON:\n return rS3.putObject(s3Params).promise();\n } else {\n // empty object if not active:\n return {};\n }\n } catch (error) {\n oLog.error(__filename, 'putS3', error);\n return error;\n }\n}", "async function getBucketFiles(res, fileType, key) {\n const params = {\n Bucket: BUCKET_NAME,\n Prefix: `${fileType}/${key}`\n };\n const data = await S3_CONTROL.listObjectsV2(params).promise();\n const fileInfoParams = {\n Bucket: BUCKET_NAME,\n };\n for (const fileInfo of data.Contents) {\n fileInfoParams.Key = fileInfo.Key;\n const file = await S3_CONTROL.getObject(fileInfoParams).promise();\n fs.createReadStream(file.Body)\n .pipe(res);\n }\n}", "function loadLog() {\n let logContent = fs.readFileSync(\"logs/log.json\", \"utf8\");\n return JSON.parse(logContent);\n}", "async get(){\n try {\n let objectResult = await s3.getObject({\n Bucket: this.bucket,\n Key: this.key\n }).promise();\n \n let creds = JSON.parse(objectResult.Body);\n return creds;\n } catch(ex){\n if(ex.code === 'NoSuchKey'){\n return null;\n }\n console.error(ex);\n throw ex;\n }\n }", "async function loadManifest(manifestBucket, manifestKey) {\n try {\n var getParams = {\n Bucket: manifestBucket,\n Key: manifestKey,\n };\n\n console.log(\"[INFO] loading manifest using: %j\", getParams);\n\n var getObjectResponse = await s3.getObject(getParams).promise();\n\n var body = getObjectResponse.Body.toString();\n\n console.log(\"[INFO] got body: %s\", body);\n\n return JSON.parse(body).manifest;\n } catch (error) {\n console.log(\"[ERROR] failed to load manifest\", error);\n throw error;\n }\n}", "getBucket() {\n const headers = {\n Date: this._buildDateHeader(),\n };\n\n const authHeader = this._buildAuthHeader('GET', '', {}, headers);\n const fetchOptions = {\n method: 'GET',\n headers: {\n Authorization: authHeader,\n },\n };\n\n return new Promise((resolve, reject) => {\n fetch(this.bucketBaseUrl, fetchOptions)\n .then(res => resolve(res))\n .catch(err => reject(err));\n });\n }", "function getS3PreSignedUrl(s3ObjectKey) {\n\n const bucketName = process.env.S3_PERSISTENCE_BUCKET;\n \n const s3PreSignedUrl = s3SigV4Client.getSignedUrl('getObject', {\n Bucket: bucketName,\n Key: s3ObjectKey,\n Expires: 60*1 // the Expires is capped for 1 minute\n });\n\n console.log(`Util.s3PreSignedUrl: ${s3ObjectKey} URL ${s3PreSignedUrl}`); // you can see those on CloudWatch\n\n return s3PreSignedUrl;\n}", "function getPutSignedUrl(key) {\n const signedUrlExpireSeconds = 60 * 5;\n return exports.s3.getSignedUrl('putObject', {\n Bucket: config_1.config.aws_media_bucket,\n Key: key,\n Expires: signedUrlExpireSeconds,\n });\n}", "function updateJSON(key, newObj, callback) {\n return combineObjectWithCachedS3File(config, upload, downloadDict, s3, key, newObj, callback);\n }", "function deleteLog(key){\n\treturn localforage.getItem('logs')\n\t.then((logs)=>{\n\t\tdelete logs[key];\n\t\treturn localforage.setItem('logs',logs);\n\t})\n\t.catch((err)=>{\n\t\tconsole.log(err);\n\t\tconsole.err(\"!!FAILED TO DELETE LOG\");\n\t});\n}", "function createReadline(Bucket, Key) {\r\n\r\n // s3 read stream\r\n const input = s3\r\n .getObject({\r\n Bucket,\r\n Key\r\n })\r\n .createReadStream()\r\n\r\n // node readline with stream\r\n return readline\r\n .createInterface({\r\n input,\r\n terminal: false\r\n })\r\n}", "function uploadToS3(file) {\n let s3bucket = new AWS.S3({\n accessKeyId: ACCESS,\n secretAccessKey: SECRET,\n Bucket: BUCKET_NAME,\n });\n s3bucket.createBucket(function () {\n var params = {\n Bucket: BUCKET_NAME,\n Key: file.name,\n Body: file.data,\n };\n s3bucket.upload(params, function (err, data) {\n if (err) {\n console.log(\"error in callback\");\n console.log(err);\n }\n console.log(\"success\");\n console.log(data);\n });\n });\n}", "function mylogging(logg)\r\n{\r\n\t let r = logg.requests[0].response.headers ;\r\n\t r = JSON.stringify(r) ;\r\n\t console.log(r) ;\r\n\t fs.writeFileSync(filePath,r);\r\n}", "async function upload_file(file_loc, key) {\n\n\treturn await new Promise((resolve, reject) => {\n\n\t\tlet uploadParams = { Bucket: 'fstraces', Key: key , Body: ''};\n\n\t\t// create a filestream for upload to S3\n\t\tconst fileStream = fs.createReadStream(file_loc);\n\t\tfileStream.on('error', function(err) {\n\t\t\treject(err);\n\t\t});\n\t\tuploadParams.Body = fileStream;\n\t\ts3.upload (uploadParams, function (err, data) {\n\t\t\tif (err) reject(err);\n\t\t\telse resolve(file_loc);\n\t\t});\n\t});\n\n}", "load() {\n try {\n let [headerString, ...allData] = fs.readFileSync(this.session.logFilePath, 'utf8').split(/\\r?\\n/);\n const header = JSON.parse(headerString);\n if (!header.headerTag) {\n // handle log files from version=1 which do not contain headers, this should be removed in the next version\n warn(`No header is found in log file, assume it is of version 1`);\n allData.unshift(headerString);\n header.version = 1;\n }\n allData = allData.filter(s => s).map((s) => JSON.parse(s));\n\n const dataToAdd = Object.fromEntries(Object.keys(this.collections).map(name => [name, []]));\n for (let { collectionName, data } of allData) {\n if (this.collections[collectionName].deserialize) {\n data = this.collections[collectionName].deserialize(data);\n }\n dataToAdd[collectionName].push(data);\n }\n this.loadByVersion[header.version](header, dataToAdd);\n }\n catch (err) {\n if (err.code === 'ENOENT') {\n log(`No log file found at \"${this.session.logFilePath}\", header written`);\n this.writeHeader();\n }\n else {\n logError('Failed to load from log file:', err);\n throw err;\n }\n }\n }", "async getFile(params) {\n try {\n console.log(\"s3.getObject Params: \", params);\n var s3 = new this.AWS.S3();\n let file = await s3.getObject(params).promise();\n return (file);\n } catch (error) {\n console.error('S3.getObject error: ', error);\n return (error);\n }\n }", "downloadFile(bucket, fileNameToDownload, fileNameToSaveAs) {\n return new Promise((resolve, reject) => {\n var download = this.client.downloadFile({\n localFile: fileNameToSaveAs,\n s3Params: {\n Bucket: bucket,\n Key: fileNameToDownload\n }\n });\n\n download.on('error', error => {\n reject(error);\n });\n\n download.on('end', () => {\n resolve();\n });\n });\n }", "async function uploadFileToS3(file, getSignedUrl) {\n try {\n const {fileUrl, signedRequestUrl} = await getSignedUrl(file)\n const url = await makeS3Request(fileUrl, signedRequestUrl, file)\n\n return url\n } catch (e) {\n return alert('Could not upload file.')\n }\n}", "async function downloadFile(s3Object) {\n const getParams = {Bucket: bucketName, Key: s3Object.Key};\n const fileWriteStream = fs.createWriteStream(path.join(cryptoFolder, s3Object.Key));\n return new Promise((resolve, reject) => {\n s3.getObject(getParams).createReadStream()\n .on('end', () => {\n return resolve();\n }).on('error', (error) => {\n return reject(error);\n }).pipe(fileWriteStream)\n });\n}", "function fetchLogs(root, msg, callback) {\n const number = msg.number;\n const logfile = msg.logfile;\n const serverId = msg.serverId;\n const filePath = path.join(root, getLogFileName(logfile, serverId));\n\n const endLogs = [];\n exec(`tail -n ${number} ${filePath}`, (error, output) => {\n const endOut = [];\n output = output.replace(/^\\s+|\\s+$/g, '').split(/\\s+/);\n\n for (let i = 5; i < output.length; i += 6) {\n endOut.push(output[i]);\n }\n\n const endLength = endOut.length;\n for (let j = 0; j < endLength; j++) {\n const map = {};\n let json;\n try {\n json = JSON.parse(endOut[j]);\n } catch (e) {\n logger.error(`the log cannot parsed to json, ${e}`);\n continue; // eslint-disable-line\n }\n map.time = json.time;\n map.route = json.route || json.service;\n map.serverId = serverId;\n map.timeUsed = json.timeUsed;\n map.params = endOut[j];\n endLogs.push(map);\n }\n\n callback({ logfile: logfile, dataArray: endLogs });\n });\n}", "function getLogfile(logfileName){\n var logFile = [];\n \n $.ajax({\n type: \"GET\", \n url: 'backend/index.php',\n data: {key: '4me302A3', method:'logfile', value1:logfileName},\n async: false, \n dataType: \"json\"\n\t\t})\n .done(function(data){\n\t\t\tlogFile = data;\n\t\t})\n\t\t.fail(function() {\n\t\t\treturn \"ajax get logfile error\";\n\t\t});\n \n return createArr(logFile);\n}", "function getS3(awsAccessKey, awsSecretKey) {\n return new AWS.S3({\n accessKeyId: awsAccessKey,\n secretAccessKey: awsSecretKey\n });\n}", "static _getS3Instance () {\n s3instance = s3instance || new AWS.S3({ apiVersion: S3_API_VERSION });\n return s3instance;\n }", "function putObject(bucket, key, obkject) {\n\tif (bucket === null) {\n\t\tbucket = constants.defaultBucket;\n\t}\n\n\tvar params = {\n\t\tBucket : bucket, /* required */\n\t\tKey : key, /* required */\n\t\tBody : obkject\n\t};\n\tconsole.log(\"putObject for \" + JSON.stringify(obkject));\n\ts3.putObject(params, function(err, data) {\n\t\tif (err)\n\t\t\tconsole.log(err, err.stack); // an error occurred\n\t\telse\n\t\t\tconsole.log(data); // successful response\n\t});\n}", "* getStream (path) {\n return this.s3.getObject({\n Bucket: this.disk.bucket,\n Key: path\n }).createReadStream()\n }", "async function storeOnS3(file) {\n // list acutal files\n const files = await fileListAsync('./output/');\n // if size is reached, gzip, send and rotate file\n for (const file of files) {\n const body = fs.createReadStream(`./output/${file}`);\n\n await new Promise((resolve, reject) => {\n // http://docs.amazonaws.cn/en_us/AWSJavaScriptSDK/guide/node-examples.html#Amazon_S3__Uploading_an_arbitrarily_sized_stream__upload_\n s3.upload({\n Bucket: process.env.S3_BUCKET,\n Key: file,\n Body: body\n })\n //.on('httpUploadProgress', (evt) => { console.log(evt); })\n .send(function (err, data) {\n // console.log(err, data); \n if (err) {\n reject(err);\n }\n resolve(data);\n });\n });\n await removeAsync(`./output/${file}`);\n }\n}", "function addS3bucket (req, res, next) {\n if (req.params.s3bucket) return next()\n req.params.s3bucket = [process.env.APP_NAME, req.params.appname].join('.')\n next()\n}", "function getSignedRequest(file){\n const xhr = new XMLHttpRequest();\n //xhr.setRequestHeader('Content-Type', \"text/csv\")\n xhr.open('GET', `/sign-s3?file-name=${file.name}&file-type=${file.type}`);\n xhr.onreadystatechange = () => {\n if(xhr.readyState === 4){\n if(xhr.status === 200){\n const response = JSON.parse(xhr.responseText);\n uploadFile(file, response.signedRequest, response.url);\n }\n else{\n alert('Could not get signed URL.');\n }\n }\n };\n xhr.send();\n}", "getImageFromURL(URL, fileName, bucket, callback) {\n var options = {\n uri: URL,\n encoding: null\n };\n request(options, function (error, response, body) {\n if (error || response.statusCode !== 200) {\n console.log(\"failed to get image\", URL);\n console.log(error);\n if(response.statusCode !== 200){\n console.log(\"200 status not received for URL:\", options.uri);\n }\n } else {\n s3.putObject({\n Body: body,\n Key: fileName,\n Bucket: bucket\n }, function (error, data) {\n if (error) {\n console.log(\"error downloading image to s3\", fileName);\n } else {\n // console.log(\"body:\", body);\n // console.log(\"success uploading to s3\", fileName);\n }\n });\n }\n });\n }", "async function createSignedGsUrl(serviceAccountKey, {bucket, name}) {\n const storage = new Storage({ credentials: serviceAccountKey });\n const response = await storage.bucket(bucket).file(name).getSignedUrl({ action: 'read', expires: Date.now() + 36e5 });\n return response[0];\n}", "function uploadFileToS3(file) {\n const fileStream = fs.createReadStream(file.path)\n const uploadParams = {\n Bucket: 'week18',\n Body: fileStream,\n Key: file.filename\n }\n return s3.upload(uploadParams).promise()\n}", "async function uploadToS3(bucket, filePath) {\n let params = {\n Bucket: bucket,\n Body: fs.createReadStream(filePath),\n Key: path.basename(filePath)\n };\n\n //Converting async upload function to synchronous\n let s3Upload = Promise.promisify(s3.upload, { context: s3 });\n let uploadResult = await s3Upload(params);\n\n //Throw an error if the upload errored out \n if (!uploadResult.Location || uploadResult.Location.length === 0) {\n throw Error(uploadResult.err);\n }\n}", "function uploadToS3(name, file, successCallback, errorCallback, progressCallback) {\n\n if (typeof successCallback != 'function') {\n Ti.API.error('successCallback() is not defined');\n return false;\n }\n\n if (typeof errorCallback != 'function') {\n Ti.API.error('errorCallback() is not defined');\n return false;\n }\n\n var AWSAccessKeyID = 'AKIAJHRVU52E4GKVARCQ';\n var AWSSecretAccessKey = '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';\n var AWSBucketName = 'snapps';\n var AWSHost = AWSBucketName + '.s3.amazonaws.com';\n\n var currentDateTime = formatDate(new Date(),'E, d MMM yyyy HH:mm:ss') + ' ' + getOffsetAsInteger();\n\n var xhr = Ti.Network.createHTTPClient();\n\n xhr.onsendstream = function(e) {\n\n if (typeof debugStartTime != 'number') {\n debugStartTime = new Date().getTime();\n }\n\n debugUploadTime = Math.floor((new Date().getTime() - debugStartTime) / 1000);\n\n var progress = Math.floor(e.progress * 100);\n Ti.API.info('uploading (' + debugUploadTime + 's): ' + progress + '%');\n\n // run progressCallback function when available\n if (typeof progressCallback == 'function') {\n progressCallback(progress);\n }\n\n };\n\n xhr.onerror = function(e) {\n Ti.API.error({ errorlocation: 'onload', error: e, responseText: xhr.responseText, headers: xhr.getResponseHeaders() });\n errorCallback(e);\n };\n\n xhr.onload = function() {\n if (this.status >= 200 && this.status < 300) {\n\n var responseHeaders = xhr.getResponseHeaders();\n\n var filename = name;\n var url = 'https://' + AWSHost + '/' + name;\n\n if (responseHeaders['x-amz-version-id']) {\n url = url + '?versionId=' + responseHeaders['x-amz-version-id'];\n }\n\n successCallback({ url: url });\n }\n else {\n Ti.API.error({ errorlocation: 'onload', error: e, responseText: xhr.responseText, headers: xhr.getResponseHeaders() });\n errorCallback();\n }\n };\n\n //ensure we have time to upload\n xhr.setTimeout(99000);\n\n // An optional boolean parameter, defaulting to true, indicating whether or not to perform the operation asynchronously.\n // If this value is false, the send() method does not return until the response is received. If true, notification of a\n // completed transaction is provided using event listeners. This must be true if the multipart attribute is true, or\n // an exception will be thrown.\n xhr.open('PUT', 'https://' + AWSHost + '/' + name, true);\n\n //var StringToSign = 'PUT\\n\\nmultipart/form-data\\n' + currentDateTime + '\\nx-amz-acl:public-read\\n/' + AWSBucketName + '/' + name;\n var StringToSign = 'PUT\\n\\n\\n' + currentDateTime + '\\nx-amz-acl:public-read\\n/' + AWSBucketName + '/' + name;\n var AWSSignature = b64_hmac_sha1(AWSSecretAccessKey, Utf8.encode(StringToSign));\n var AuthorizationHeader = 'AWS ' + AWSAccessKeyID + ':' + AWSSignature;\n\n xhr.setRequestHeader('Authorization', AuthorizationHeader);\n //xhr.setRequestHeader('Content-Type', 'multipart/form-data');\n xhr.setRequestHeader('X-Amz-Acl', 'public-read');\n xhr.setRequestHeader('Host', AWSHost);\n xhr.setRequestHeader('Date', currentDateTime);\n\n xhr.send(file);\n\n return xhr;\n}", "function putObject(keyName) {\n const putObjectParams = {\n Bucket: bucket,\n Key: keyName,\n Metadata: {\n importance: 'very',\n ranking: 'middling',\n },\n Body: 'putMe',\n };\n s3Client.putObject(putObjectParams, (err, data) => {\n if (err) console.log('err:', err);\n else console.log('data:', data);\n });\n}", "constructor (id, s3) {\n this.s3Prefix = process.env.S3_PREFIX // 'scores-bot'\n this._store = s3\n this.id = id\n this.touch(true)\n this.setDefaultState()\n }", "function get_s3_resource(element, signature_view_url) {\n\tvar resource_url = element.src;\n\tvar xhr = new XMLHttpRequest();\n\txhr.open(\"GET\", signature_view_url+\"?resource_url=\"+resource_url);\n\txhr.onreadystatechange = function() {\n\t\tif(xhr.readyState === 4) {\n\t\t\tif(xhr.status === 200) {\n\t\t\t\tvar response = JSON.parse(xhr.responseText);\n\t\t\t\telement.src = response.signed_request;\n\t\t\t}\n\t\t\telse {\n\t\t\t\talert(\"Could not get signed URL.\");\n\t\t\t}\n\t\t}\n\t};\n\txhr.send();\n}", "function uploadFile(file) {\n const fileStream = fs.createReadStream(file.path);\n\n const uploadParams = {\n Bucket: bucketName,\n Body: fileStream,\n Key: Date.now() + file.originalname,\n };\n\n return s3.upload(uploadParams).promise();\n}", "async function getBuyingNeeds(buyingNeedsKey) {\n const seSrchBucket = config[\"SE_SRCH_NEEDS_BUCKET\"];\n const params = { Bucket: seSrchBucket, Key: buyingNeedsKey };\n\n log.info(`Retrieving BuyingNeeds__c.csv in S3 [${seSrchBucket}/${buyingNeedsKey}]`);\n const s3ObjStream = await createS3ObjStream(params);\n return await csvParser(configureParserParams()).fromStream(s3ObjStream);\n}", "async function load (params, useS3) {\n let { source, scraper, date, tz } = params\n const { _sourceKey, timeseries } = source\n\n if (!isLocal) useS3 = true // Force S3 in production\n const loader = useS3 ? s3 : local\n\n let folders = await loader.getFolders(_sourceKey)\n\n /**\n * All cache data is saved with a 8601Z timestamp\n * In order to match the date requested to the timestamp, we must re-cast it to the locale in question\n */\n if (folders.length) {\n // Sort from earliest to latest\n folders = sorter(folders)\n\n // Gets all eligible files for source\n let { keys, files } = await loader.getFiles({\n _sourceKey,\n date,\n folders,\n timeseries,\n tz\n })\n\n // Remove duplicate filenames.\n const fileset = new Set(files)\n files = Array.from(fileset)\n\n if (!timeseries && files.length) {\n /**\n * If date is earlier than we have cached, bail\n */\n const { earliest, latest } = getDateBounds(files, tz)\n if (datetime.dateIsBefore(date, earliest) && useS3) {\n console.error('Sorry McFly, we need more gigawatts to go back in time')\n throw Error(`DATE_BOUNDS_ERROR: Date requested (${date}) is before our earliest cache ${earliest}`)\n }\n\n if (datetime.dateIsAfter(date, latest) && useS3) {\n console.error('Sorry, without increasing gravity we cannot speed up time to get this data')\n throw Error(`DATE_BOUNDS_ERROR: Date requested (${date}) is after our latest cache ${latest}`)\n }\n\n // Filter files that match date when locale-cast from UTC\n files = files.filter(filename => {\n const castDate = getLocalDateFromFilename(filename, tz)\n return castDate === date\n })\n }\n\n if (!files.length && useS3) {\n const msg = timeseries\n ? 'No cached files for this timeseries'\n : `No cached files found for ${date}`\n throw Error(msg)\n }\n\n let cache = []\n for (const crawl of scraper.crawl) {\n // We may have multiple crawls for a single scraper (each with a unique name key)\n // Disambiguate and match them so we are getting back the correct data sources\n const { name='default' } = crawl\n\n const matches = parseCacheFilename.matchName(name, files)\n\n // Fall back to S3 cache\n if (!matches.length) {\n cache = 'miss'\n break\n }\n\n // We may have multiple files for this day, choose the last one\n const file = matches[matches.length - 1]\n\n crawl.content = await loader.getFileContents({ _sourceKey, keys, file })\n cache.push(crawl)\n }\n if (cache !== 'miss') {\n console.log(`${useS3 ? 'S3' : 'Local'} cache hit for: ${_sourceKey} / ${date}`)\n return cache\n }\n }\n return false\n}", "function getBucketAcl() {\n const getBucketAclParams = {\n Bucket: bucket,\n };\n s3Client.getBucketAcl(getBucketAclParams, (err, data) => {\n if (err) console.log('err:', err);\n else console.log('data:', JSON.stringify(data));\n });\n}", "getLogs(numberOfLogs) {\n return fetch(this.startUrl + \"/logs/\" + numberOfLogs, {\n method: \"get\"\n });\n }", "function openDownloadStreamAsync(bucket, file_id) {\r\n return new Promise((resolve, reject) => {\r\n try {\r\n const file_data = [];\r\n bucket.openDownloadStream(ObjectId(file_id))\r\n .pipe(csv())\r\n .on('data', function (chunk) {\r\n file_data.push(chunk);\r\n })\r\n .on('error', function (e) {\r\n return reject(e);\r\n })\r\n .on('end', function () {\r\n return resolve(file_data); \r\n });\r\n } catch (err) {\r\n return reject(err)\r\n }\r\n });\r\n}", "function s3Upload(files, bucketName, objectKeyPrefix, iamUserKey, iamUserSecret, callback) {\n var s3 = new AWS.S3({\n bucket: bucketName,\n accessKeyId: iamUserKey,\n secretAccessKey: iamUserSecret,\n apiVersion: '2006-03-01',\n });\n\n // s3.abortMultipartUpload(params, function (err, data) {\n // if (err) console.log(err, err.stack); // an error occurred\n // else console.log(data); // successful response\n // });\n\n // Setup the objects to upload to S3 & map the results into files\n var results = files.map(function(file) {\n // Upload file to bucket with name of Key\n s3.upload({\n Bucket: bucketName,\n Key: objectKeyPrefix + file.originalname, // Prefix should have \".\" on each end\n Body: file.buffer,\n ACL: 'public-read' // TODO: CHANGE THIS & READ FROM CLOUDFRONT INSTEAD\n },\n function(error, data) {\n // TODO: Maybe refine this to show only data care about elsewhere\n if(error) {\n console.log(\"Error uploading file to S3: \", error);\n return {error: true, data: error};\n } else {\n console.log('File uploaded. Data is:', data);\n return {error: false, data: data};\n }\n });\n });\n\n callback(results); // Results could be errors or successes\n}", "function uploadFile(path, key) {\n\treturn new Promise((resolve, reject) => {\n\t\tfs.readFile(path, (ferr, data) => {\n\t\t\tif (!ferr) {\n\t\t\t\ts3.upload({\n\t\t\t\t\tKey: key,\n\t\t\t\t\tBody: data,\n\t\t\t\t\tACL: \"public-read\"\n\t\t\t\t}, (uerr, data) => {\n\t\t\t\t\tif (!uerr) {\n\t\t\t\t\t\tresolve(data);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(`Unable to upload file: ${uerr}`);\n\t\t\t\t\t\tif (DEBUG) console.error(uerr);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treject(`Unable to read file (${path}) for upload: ${ferr}`);\n\t\t\t\tif (DEBUG) console.error(ferr);\n\t\t\t}\n\t\t});\n\t});\n}", "function getGSUrls(bucket, filename) {\n return `https://storage.googleapis.com/${bucket}/${filename}`;\n}", "function getListObjects(Prefix){\n const params = {\n Bucket: 'gsg-image-uploads',\n Prefix:Prefix, //Limits the response that begin with the specified prefix.\n //MaxKeys: 2 //(Integer) Sets the maximum number of keys returned in the response.\n };\n return new Promise((resolve, reject)=>{\n s3.listObjectsV2(params, function(err, data){\n if (err) {\n console.log(err, err.stack);\n reject(err)\n } else {\n const bucketContents = data.Contents;\n var temp = {};\n bucketContents.map(({Size, Key})=>{\n if(Size>0)\n {\n const urlParams = {Bucket: 'gsg-image-uploads', Key};\n s3.getSignedUrl('getObject',urlParams, function(err, url){\n temp[Key]= url;\n });\n }\n });\n resolve(temp);\n }\n });\n })\n\n}", "function getAllLogEntries(worker) {\n var logEntries = datastore.readLogEntries();\n worker.port.emit(\"LogEntriesLoaded\", logEntries);\n}", "function PutBucketLoggingCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "static get servicePath() {\n return 'logging.googleapis.com';\n }", "function extractDataFromLogs(request, logs){\n\tvar piece = logs.split(\" to \");\n\tvar count, count2 = 0;\n\tvar positionFlag = 0;\n\tvar thereIsAlready;\n\tvar accountFound;\n\tfor(count = 0; count <= piece.length - 1; count++){\n\t\tif (piece[count].search(\"#\") == 0){\n\t\t\tpositionFlag = piece[count].search(\" \");\n\t\t\tif (piece[count].search(\" at localhost\") == positionFlag){\n\t\t\t\taccountFound = piece[count].substr(1, positionFlag - 1);\n\t\t\t\tthereIsAlready = false;\n\t\t\t\tfor (count2 = 0; count2 <= request.account.length - 1; count2++){\n\t\t\t\t\tif (request.account[count2] == accountFound){\n\t\t\t\t\t\tthereIsAlready = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (accountFound == request.myAccount){\n\t\t\t\t\tthereIsAlready = true;\n\t\t\t\t}\n\t\t\t\tif (thereIsAlready == false){\n\t\t\t\t\trequest.account.push(accountFound);\n\t\t\t\t\tconsole.log(accountFound);\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t}\n\treturn request;\n}", "function putS3File(bucketName, fileName, data, callback) {\n var expirationDate = new Date();\n // Assuming a user would not remain active in the same session for over 1 hr.\n expirationDate = new Date(expirationDate.setHours(expirationDate.getHours() + 1));\n var params = {\n Bucket: bucketName,\n Key: fileName,\n Body: data,\n ACL: 'public-read', // TODO: find way to restrict access to this lambda function\n Expires: expirationDate\n };\n s3.putObject(params, function (err, data) {\n callback(err, data);\n });\n}", "* get (path) {\n return new Promise((resolve, reject) => {\n this.s3.getObject({\n Bucket: this.disk.bucket,\n Key: path\n }, (err, data) => {\n if (err) return reject(err)\n return resolve(data.Body)\n })\n })\n }", "function getSignedUrl(filename, filetype, foldername, operation) {\n const folderName = foldername;\n const params = {\n Bucket: 'gsg-image-uploads',\n Key: `${folderName}/` + filename,\n Expires: 604800\n };\n if(operation==='putObject'){\n params['ContentType'] = filetype;\n }\n return new Promise((resolve, reject) => {\n s3.getSignedUrl(operation, params, function(err, data) {\n if (err) {\n console.log(\"Error\",err);\n reject(err)\n } else {\n resolve(data)\n }\n });\n });\n}", "function handleLogUpload(evt) {\n var files = evt.target.files; // FileList object\n\n\t// files is a FileList of File objects. List some properties.\n\tvar output = [];\n\tvar file = files[0];\n\tvar reader = new FileReader();\n\n\t// If we use onloadend, we need to check the readyState.\n\treader.onloadend = function(evt) {\n\t\tif (evt.target.readyState == FileReader.DONE) { // DONE == 2\n\t\t\tparseLogFile(evt.target.result);\n\t\t\t// Validate not working at the moment\n\t\t\t//validateLog(initialBoard, evt.target.result);\n\t\t}\n\t};\n\treader.readAsText(file);\n}", "function deleteFileFromS3(key) {\n const deleteParams = {\n Bucket: 'week18',\n Key: key,\n }\n return s3.deleteObject(deleteParams).promise()\n}", "function parseBucketName(bucket) {\r\n // Amazon S3 - <bucket>.s3.amazonaws.com\r\n if (/[a-zA-Z0-9-\\.]*\\.(s3|s3-.*).amazonaws.com/g.test(bucket.hostname)) {\r\n bucketName = bucket.hostname.replace(/\\.(s3|s3-.*)\\.amazonaws\\.com/g, '');\r\n return bucketName;\r\n }\r\n // Amazon S3 - s3.amazonaws.com/<bucket> || s3-<region>.amazonaws.com/<bucket>\r\n if (/(s3-[a-zA-Z0-9-]*|s3)\\.([a-zA-Z0-9-]*\\.com|[a-zA-Z0-9-]*\\.amazonaws\\.com)\\/.*/g.test(bucket.hostname + bucket.pathname)) {\r\n a = bucket.pathname.split(\"/\");\r\n bucketName = a[1];\r\n return bucketName;\r\n }\r\n // Google - <bucket>.storage.googleapis.com\r\n if (/[a-zA-Z0-9-\\.]*\\.storage\\.googleapis\\.com/g.test(bucket.hostname)) {\r\n bucketName = bucket.hostname.replace(/\\.storage\\.googleapis\\.com/g, '');\r\n return bucketName;\r\n }\r\n // Google - storage.googleapiscom/<bucket>\r\n if (/storage.googleapis.com\\/[a-zA-Z0-9-\\.]*/g.test(bucket.hostname + bucket.pathname)) {\r\n a = bucket.pathname.split(\"/\");\r\n bucketName = a[1];\r\n return bucketName;\r\n }\r\n // return false if parsing fails\r\n return false;\r\n}", "function postDocumentToES(key, context) {\n \n\tvar currentdate = new Date();\n\tvar datetime = currentdate.getUTCDate() + \"/\" + (currentdate.getUTCMonth()+1) + \"/\"\n\t\t\t\t+ currentdate.getUTCFullYear() + \" at \"\n\t\t\t\t+ (\"0\" + (currentdate.getUTCHours()+1)).slice(-2) + \":\"\n\t\t\t\t+ (\"0\" + currentdate.getUTCMinutes()).slice(-2);\n\t\n\tvar docName = key.split(/\\/|\\./g);\n\t\n\ttype = docName[docName.length - 1];\n\ttitle = replaceAll(key, \"/\", \"-\");\n\tfileName = docName[docName.length - 2];\n\tindex = determineDocType(type);\n\t\n\tif (type == 'gz') {\n\t\ttype = docName[docName.length - 2] + \".\" + docName[docName.length - 1];\n\t\tfileName = docName[docName.length - 3];\n\t\tindex = \"compressed\";\n\t}\n\t\n\tconsole.log(\"key: \" + key);\n\tconsole.log(\"title: \" + title);\n\t\n\telasticsearch.index({\n\t\t\tindex: index,\n\t\t\ttype: type,\n\t\t\tid: title,\n\t\t\tbody: {\n\t\t\t\tkey: key,\n\t\t\t\tlocation: 'https://s3-us-west-2.amazonaws.com/elastic-repo-qac/' + key,\n\t\t\t\tfileName: fileName,\n\t\t\t\tlast_updated: datetime\n\t\t\t}\n\t\t}, function(err, data) {\n\t\t\tconsole.log('json reply received');\n });\n\t\n}", "function getS3FilePath(env){\n var prefix = env + \"/RD013/\";\n var filename = prefix + \"investigators.json\";\n return filename;\n}", "retrieve(key) {\n const index = getIndexBelowMax(key.toString(), this.limit);\n const bucket = this.storage.get(index);\n if (Array.isArray(bucket)) {\n for (let i = 0; i < bucket.length; i++) {\n const objKey = bucket[i][0];\n if (objKey === key) {\n return bucket[i][1];\n }\n }\n }\n }", "async function readLogs (filename) {\n try {\n // const { name } = this.validateFlags(flags)\n\n // this.log(`Opening file ${name}`);\n\n const data = await openLogFile(filename)\n\n for (let i = 0; i < data.length; i++) {\n const thisEntry = data[i]\n\n console.log(`${thisEntry.timestamp}: ${thisEntry.message}`)\n }\n } catch (err) {\n console.log('Error in readLogs(): ', err)\n }\n}", "function getLog({\n limit=defaultResultLimit\n}={}) {\n return db.allDocs({\n include_docs: true,\n descending: true,\n limit,\n ...keyRangeForPrefix('logEntry/'),\n }).then((result) => {\n return result.rows\n }).catch(err => console.error(err))\n}" ]
[ "0.7192204", "0.7129934", "0.58190775", "0.56013477", "0.5531915", "0.5417477", "0.5398596", "0.5318489", "0.53021234", "0.5149168", "0.5094466", "0.50757706", "0.5023641", "0.5020895", "0.5007629", "0.49872974", "0.4980069", "0.49677464", "0.49657312", "0.49385136", "0.49237305", "0.4871873", "0.48607564", "0.48235372", "0.47622752", "0.47527978", "0.47443798", "0.47239944", "0.47123772", "0.47006938", "0.46825916", "0.4644921", "0.4635399", "0.46270347", "0.4605531", "0.4583212", "0.45781028", "0.45751494", "0.45668966", "0.45659736", "0.45546526", "0.45460504", "0.44953522", "0.44879594", "0.44840038", "0.4477401", "0.4462407", "0.44598913", "0.44535926", "0.4448486", "0.44415325", "0.44386038", "0.44316918", "0.44310695", "0.44282", "0.4427084", "0.44149718", "0.43874612", "0.43829244", "0.43746573", "0.4368092", "0.436027", "0.43557307", "0.4354154", "0.43396977", "0.43388468", "0.4333273", "0.43297246", "0.43218952", "0.43200028", "0.43159613", "0.43039832", "0.43010116", "0.42890322", "0.42848593", "0.4271209", "0.42619985", "0.4261035", "0.42524382", "0.42468882", "0.42364955", "0.42320007", "0.4228592", "0.42072138", "0.42016974", "0.4201439", "0.4193305", "0.419111", "0.41885138", "0.41880992", "0.41848513", "0.4160184", "0.4156153", "0.41484877", "0.41473663", "0.41416863", "0.41397703", "0.41374087", "0.41279504", "0.41244763" ]
0.7220334
0
Add the given document to the ES domain. If all records are successfully added, indicate success to lambda (using the "context" parameter).
function postDocumentToES(indexName, doc, context) { doc = addCustomFields(doc); var req = new AWS.HttpRequest(endpoint); req.method = 'POST'; req.path = path.join('/', indexName, esDomain.doctype); req.region = esDomain.region; req.body = doc; req.headers['presigned-expires'] = false; req.headers['Host'] = endpoint.host; req.headers['Content-Type'] = 'application/json'; var signer = new AWS.Signers.V4(req, 'es'); signer.addAuthorization(creds, new Date()); // Post document to ES var send = new AWS.NodeHttpClient(); send.handleRequest(req, null, function (httpResp) { var body = '', status = httpResp.statusCode; httpResp.on('error', function (chunk) { console.log("ERROR:", doc, chunk); }); httpResp.on('data', function (chunk) { body += chunk; }); httpResp.on('end', function (chunk) { numDocsAdded++; if (numDocsAdded === totLogLines && status >= 200 && status <= 399) { // Mark lambda success. If not done so, it will be retried. console.log('All ' + numDocsAdded + ' log records added to ES.'); var keys = Object.keys(deleteOp); var deletedOK = 0; var deletedError = 0; keys.forEach(function (key) { var deleteParam = deleteOp[key]; s3.deleteObjects(deleteParam, function (err, data) { if (err) { deletedError++; console.log("Error Deleting Documents", JSON.stringify(deleteParam), err, err.stack); } else { deletedOK++; console.log('Deleted all indexed documents', JSON.stringify(deleteParam), JSON.stringify(data)); } if ((deletedOK + deletedError - keys.length) == 0) { if (deletedOK = keys.length) context.succeed(); else context.fail(); } }); }); } }); }, function (err) { console.log('Error: ' + err); console.log(numDocsAdded + 'of ' + totLogLines + ' log records added to ES.'); context.fail(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postDocumentToES(doc, context) {\n var req = new AWS.HttpRequest(endpoint);\n\n req.method = 'POST';\n req.path = path.join('/', esDomain.index, esDomain.doctype);\n req.region = esDomain.region;\n req.body = doc;\n req.headers['presigned-expires'] = false;\n req.headers['Host'] = endpoint.host;\n\n // Sign the request (Sigv4)\n var signer = new AWS.Signers.V4(req, 'es');\n signer.addAuthorization(creds, new Date());\n\n // Post document to ES\n var send = new AWS.NodeHttpClient();\n send.handleRequest(req, null, function(httpResp) {\n var body = '';\n httpResp.on('data', function (chunk) {\n body += chunk;\n });\n httpResp.on('end', function (chunk) {\n numDocsAdded ++;\n if (numDocsAdded === totLogLines) {\n // Mark lambda success. If not done so, it will be retried.\n console.log('All ' + numDocsAdded + ' log records added to ES.');\n context.succeed();\n }\n });\n }, function(err) {\n console.log('Error: ' + err);\n console.log(numDocsAdded + 'of ' + totLogLines + ' log records added to ES.');\n context.fail();\n });\n}", "function postToESBulk(doc, context) {\n var req = new AWS.HttpRequest(endpoint);\n console.log(\"MONAN-LOG Posting to ES\");\n\n req.method = 'POST';\n req.path = path.join('/', esDomain.index, esDomain.doctype, '_bulk');\n req.region = esDomain.region;\n req.headers['presigned-expires'] = false;\n req.headers['Host'] = endpoint.host;\n req.body = doc;\n\n var signer = new AWS.Signers.V4(req , 'es'); // es: service code\n signer.addAuthorization(creds, new Date());\n\n var send = new AWS.NodeHttpClient();\n send.handleRequest(req, null, function(httpResp) {\n console.log(\"MONAN-LOG ES PostResponseStatusCode: \" + httpResp.statusCode);\n var respBody = '';\n httpResp.on('data', function (chunk) {\n respBody += chunk;\n });\n httpResp.on('end', function (chunk) {\n console.log('Response: ' + respBody);\n context.succeed('Lambda added document ' + doc);\n });\n }, function(err) {\n console.log('Error: ' + err);\n context.fail('Lambda failed with error ' + err);\n });\n}", "function postToES(doc, context) {\n var req = new AWS.HttpRequest(endpoint);\n console.log(\"MONAN-LOG Posting to ES\");\n\n req.method = 'POST';\n req.path = path.join('/', esDomain.index, esDomain.doctype);\n req.region = esDomain.region;\n req.headers['presigned-expires'] = false;\n req.headers['Host'] = endpoint.host;\n req.body = doc;\n\n var signer = new AWS.Signers.V4(req , 'es'); // es: service code\n signer.addAuthorization(creds, new Date());\n\n var send = new AWS.NodeHttpClient();\n send.handleRequest(req, null, function(httpResp) {\n console.log(\"MONAN-LOG ES PostResponseStatusCode: \" + httpResp.statusCode);\n var respBody = '';\n httpResp.on('data', function (chunk) {\n respBody += chunk;\n });\n httpResp.on('end', function (chunk) {\n console.log('Response: ' + respBody);\n context.succeed('Lambda added document ' + doc);\n });\n }, function(err) {\n console.log('Error: ' + err);\n context.fail('Lambda failed with error ' + err);\n });\n}", "addDocument(_id, _docType, _payload) {\n client.index({\n index: this.indexName,\n type: _docType,\n id: _id,\n body: _payload\n }, function (err, resp) {\n if (err) {\n console.log(err);\n }\n else {\n console.log(\"added or updated\", resp);\n }\n })\n }", "static async addANewDocument (document) {\n if (typeof document !== 'object') {\n throw new Error('Bad Parameter');\n }\n\n // Retrieve instance of Mongo\n const db = await Mongo.instance().getDb();\n const isValid = await Document.isDocument(document);\n if (isValid.valid) {\n // Create a new document\n return db.collection(Document.COLLECTION).insertOne({\n ...document,\n createdAt: moment().toDate(),\n updatedAt: moment().toDate()\n });\n } else {\n log.debug('Warning - couldn\\'t insert document \\n', document);\n return null;\n }\n }", "async addDocument(_, { input: { doc, owner } }, { generalInfo }) {\n const document = { doc }\n const { insertedId } = await generalInfo.insertOne(document)\n document._id = insertedId\n\n return document\n }", "function insert_doc(doc) {\n\tif (cloudant) {\n\t\tlogger.info(\"insert_doc() doc.id_str:\", doc.id_str);\n\t db.insert(doc, function (error, http_body, http_headers) {\n\t if(error) return logger.error(error);\n\t });\n // logger.debug(\"insert_doc() http_body:\", http_body);\n\t\t}\n}", "add(doc) {\n const idx = this.size()\n\n if (isString(doc)) {\n this._addString(doc, idx)\n } else {\n this._addObject(doc, idx)\n }\n }", "function postToES(doc, index) {\n log.debug('postToES(doc):', doc);\n\n return new Promise((resolve, reject) => {\n const req = new AWS.HttpRequest(endpoint);\n\n req.method = 'POST';\n req.path =\n path.join('/', esDomain.index, 'doc', hash(doc, 'hex'));\n req.region = esDomain.region;\n req.headers['presigned-expires'] = false;\n req.headers.Host = endpoint.host;\n req.headers['Content-Type'] = 'application/json';\n req.body = doc;\n\n const signer = new AWS.Signers.V4(req, 'es'); // es: service code\n signer.addAuthorization(creds, new Date());\n\n const nodeHttpClient = new AWS.NodeHttpClient();\n nodeHttpClient.handleRequest(req, null, (httpResp) => {\n let respBody = '';\n httpResp.on('data', (chunk) => {\n respBody += chunk;\n });\n httpResp.on('end', () => {\n log.debug('response:', respBody);\n // context.succeed('Lambda added document ' + doc);\n resolve(respBody);\n });\n }, reject);\n });\n }", "function addToDb(collectionName, document, callback)\r\n{ \r\n const collection = db.collection(collectionName); \r\n collection.insertOne(document,\r\n function(err){\r\n if(err) { \r\n console.log(\"failed to add a document to \" + collection + \" collection\");\r\n return callback(err);\r\n } \r\n return callback(null, document);\r\n }); \r\n}", "add(doc){const idx=this.size();if(isString(doc)){this._addString(doc,idx);}else {this._addObject(doc,idx);}}", "function addNewDocument(data) {\n db.collection(\"notes\")\n .add(data)\n .then(function (doc) {\n // console.log(doc);\n console.log(\"Note added successfully\");\n })\n .catch(function (error) {\n console.log(error);\n });\n}", "function addDocument(collection, document, callback){\n\tMongoClient.connect(url, function(err, db){\n\t\tif (err) throw err\n\t\t\n\t\tdb.collection(collection).insert(document, function(err, result) \t\t\t\t{\n \t\t\tconsole.log(result)\n \t \tassert.equal(err, null);\n \t \tassert.equal(1, result.result.n);\n \t \tassert.equal(1, result.ops.length);\n \t \tdb.close()\n \t \tcallback(result);\n \t\t})\n\t})\n}", "async add(collection, document) {\n console.log(\"adding collection\")\n console.log(collection) \n try {\n const docRef = await this.api\n .collection(collection)\n .add(document);\n return docRef.id;\n }\n catch (error) {\n return 'Error adding document: ' + error;\n }\n }", "add(document) {\n if (\"id\" in document && \"data\" in document) this.addVertex(document)\n else if (\"from\" in document && \"to\" in document) this.addEdge(document)\n }", "function insertDocument(dbHandle, doc, callback) {\n dbHandle.collection('publications').insertOne(doc, function(err, result) {\n assert.equal(err, null);\n insertedCount++;\n console.log(\"Publications inserted: \" + insertedCount);\n callback();\n });\n}", "function escribir(){\n db\n .collection(\"users\")\n .add({\n first: \"Pepe\",\n last: \"Perez\",\n born: 1815\n })\n .then(function(docRef) {\n console.log(\"Document written with ID: \", docRef.id);\n })\n .catch(function(error) {\n console.error(\"Error adding document: \", error);\n });\n}", "function saveAndRespond(doc, msg, res) {\n doc.save();\n res.status(200).json({ message: msg, \n data: doc});\n}", "function _insertDocument(projectDoc, res, isLogo, isDocs, callbackObj) {\n saveDocument.save(function(err, docs) {\n if (err) {\n resultObj.status = FAIL;\n resultObj.result = err;\n res.send(resultObj);\n } else {\n callbackObj.cb(docs, res, callbackObj);\n }\n });\n}", "function addToFirestore(e) {\r\n e.preventDefault();\r\n if(!name || name===\" \" || !email || email === \" \" || !phone || phone === \" \"|| !reason || reason === \" \"){\r\n console.log(\"no valid entry\")\r\n setError(\"please enter all valid details \");\r\n return\r\n }\r\n\r\n // email validation fuction retunring false if not valid then we should add ! to make if true because we need to terminate function\r\n if(emailValidation(email)===false){\r\n return\r\n }\r\n //console.log(emailError, \"emailerror\");\r\n if(phoneValidation(phone)===false){\r\n return\r\n }\r\n\r\n db.collection(\"users\")\r\n .add({\r\n name: name,\r\n email: email,\r\n reason: reason,\r\n phone: phone,\r\n })\r\n .then(async function (docRef) {\r\n //emailVerification();\r\n console.log(\"added the data to firestore \");\r\n const {id} = docRef ;\r\n console.log(docRef.id);\r\n console.log(id);\r\n })\r\n .catch( function (error) {\r\n console.log(\"this is my error \", error);\r\n });\r\n\r\n clear();\r\n }", "async insertDoc(document) {\n let collection = await this.collection()\n\n await collection.insertOne(document)\n\n }", "function put(doc){\n return $q.when(db.put(doc));\n }", "function commitSample( db, doc ) {\n db.post( doc )\n}", "insertDocument(collectionName, document, options) {\n return new Promise((resolve, reject) => {\n this.insertOne(collectionName, document, options)\n .then((result) => {\n resolve(result);\n })\n .catch(reject);\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}", "_createDocument(req, res, next) {\n const { documentId, change } = req.body\n this.engine.createDocument(documentId, change, function(err, version) {\n if (err) return next(err)\n res.json(version)\n })\n }", "function add(req, res, next) {\n console.log(req.body);\n getDB().then((db, err) => {\n if (err) return next(err);\n db.collection('users')\n .insert(req.body, (insertErr, result) =>{\n if (insertErr) return next(insertErr);\n\n res.saved = result;\n db.close();\n return next();\n });\n return false;\n });\n return false;\n }", "insert(document) {\n document._id = id_1.id();\n return new this.model(document).save();\n }", "function insertDoc(doc, db){\n\tdb.find({ _refObjectUUID: doc._refObjectUUID }, function(err, docs){\n\t\tif(!docs.length){\n\t\t\t// Insert New\n\t\t\tdb.insert(doc, function (err) {});\n\t\t} else {\n\t\t\t// Update Existing\n\t\t\tcompareDoc(doc, db);\n\t\t}\n\t});\n}", "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n service.findDuplicateDoc(moduleName, newDoc).then(function(){\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n }).catch(function(err){\n deferred.reject(err);\n });\n\n return deferred.promise;\n}", "function insert(cloudantDb, doc, params) {\n return new Promise(function(resolve, reject) {\n cloudantDb.insert(doc, params, function(error, response) {\n if (!error) {\n console.log('success', response);\n resolve(response);\n } else {\n console.log('error', error);\n reject(error);\n }\n });\n });\n}", "async insertObject(collection, obj) {\n if (this.toggleAPISpinner(true)) {\n return undefined;\n }\n return await this.handleApiResult(this.getServerInstance().promiseTimeout(this.getServerInstance().postInCollection(collection, obj, false)));\n }", "addDocument (doc) {\n if (this._isOptimized) {\n throw new Error('Cannot add a document to an already-optimized index.');\n }\n\n if (typeof doc.id === 'undefined') {\n throw new Error(1000, 'ID is a required property of documents.');\n };\n\n const fieldsToIndex = [];\n for (let [ fieldName, fieldData ] of Object.entries(doc)) {\n /* The document ID is not a field... */\n if ('id' === fieldName) {\n continue;\n }\n\n /* Make sure this field should be indexed... */\n if (!(Object.hasOwnProperty.call(this._fields, this._intern(fieldName, false)))) {\n console.error(`Document field (${fieldName}) is not indexable.`);\n continue;\n }\n\n fieldsToIndex.push(fieldName);\n }\n\n if (0 === fieldsToIndex.length) {\n console.log(`Not indexing empty document ${doc.id}`);\n return;\n }\n\n doc.id = this._intern(doc.id);\n\n for (let [ _, fieldName ] of Object.entries(fieldsToIndex)) {\n let tokens = this._tokenize(doc[`${fieldName}`], true);\n\n fieldName = this._intern(fieldName, false);\n\n if (!(Object.hasOwnProperty.call(this._fields[`${fieldName}`].documents, doc.id))) {\n this._fields[`${fieldName}`].documents[`${doc.id}`] = tokens.length;\n }\n\n for (let [ _, term ] of Object.entries(tokens)) {\n if (!(Object.hasOwnProperty.call(this._fields[`${fieldName}`].terms, term))) {\n this._fields[`${fieldName}`].terms[`${term}`] = {};\n }\n\n if (!(Object.hasOwnProperty.call(this._fields[`${fieldName}`].terms[`${term}`], doc.id))) {\n this._fields[`${fieldName}`].terms[`${term}`][`${doc.id}`] = 0;\n }\n ++this._fields[`${fieldName}`].terms[`${term}`][`${doc.id}`];\n }\n }\n }", "function _successCb(err, result) {\n\n // use the revision to update the existing documents\n // NOTE: it is not impossible that the revision of this document\n // is modified by other operations right before updating, Couchpenter\n // will only try once to avoid any possibility of retrying infinitely.\n doc._rev = result._rev;\n self.couch.use(dbName).insert(doc, self._handle(cb, {\n dbName: dbName,\n docId: doc._id,\n message: 'updated'\n }));\n }", "function addPerson(store_name,index,data) {\n // var obj = { fname: \"Test\", lname: \"Test\", age: 30, email: \"test@company.com\" };\n\n var store = getObjectStore(store_name, 'readwrite');\n var req;\n try {\n req = store.add(data);\n } catch (e) {\n throw e;\n }\n req.onsuccess = function (evt) {\n console.log(\"Insertion in DB successful\", index);\n };\n req.onerror = function () {\n console.log(\"Insertion in DB Failed \", this.error, index);\n };\n}", "function addResult(doc) {\n lookup[doc._id] = doc._rev;\n var id = doc._id;\n var rev = doc._rev;\n if(stripId) {\n delete doc._id;\n }\n if(stripRev) {\n delete doc._rev;\n }\n return addAction(doc, id, rev);\n }", "async createDocument(ctx, documentId, value) {\n const exists = await this.documentExists(ctx, documentId);\n if (exists) {\n throw new Error(`The document ${documentId} already exists`);\n }\n const asset = { value };\n const buffer = Buffer.from(JSON.stringify(asset));\n await ctx.stub.putState(documentId, buffer);\n }", "function addModuleDoc(moduleName, newDoc){\n var deferred = Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.bind(moduleName);\n\n db[moduleName].insert(newDoc, function(err){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve();\n }\n });\n\n return deferred.promise;\n}", "function 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 addToFirestore(artist, records) {\n // check if there is an artist found\n if (artistFound === false) {\n // Add entry to artistDB\n artistDB\n .add(artist)\n // Then, store the id and add record\n .then((docref) => {\n artistID = docref.id;\n\n // Store reference to subcollection\n let subcollection = docref.collection(\"recordDB\");\n\n // Call add records function\n addRecords(records, subcollection);\n });\n\n // If artist is found\n } else {\n // Store reference to subcollection\n let artistRef = artistDB.doc(artistID);\n let subcollection = artistRef.collection(\"recordDB\");\n\n // Call add records function\n addRecords(records, subcollection);\n }\n}", "function guardarPedido() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioSuavisante1,\n Medida: medida,\n NombreProducto: NombreSuavisante1.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadSuavisante1.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function 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 postDocumentToES(key, context) {\n \n\tvar currentdate = new Date();\n\tvar datetime = currentdate.getUTCDate() + \"/\" + (currentdate.getUTCMonth()+1) + \"/\"\n\t\t\t\t+ currentdate.getUTCFullYear() + \" at \"\n\t\t\t\t+ (\"0\" + (currentdate.getUTCHours()+1)).slice(-2) + \":\"\n\t\t\t\t+ (\"0\" + currentdate.getUTCMinutes()).slice(-2);\n\t\n\tvar docName = key.split(/\\/|\\./g);\n\t\n\ttype = docName[docName.length - 1];\n\ttitle = replaceAll(key, \"/\", \"-\");\n\tfileName = docName[docName.length - 2];\n\tindex = determineDocType(type);\n\t\n\tif (type == 'gz') {\n\t\ttype = docName[docName.length - 2] + \".\" + docName[docName.length - 1];\n\t\tfileName = docName[docName.length - 3];\n\t\tindex = \"compressed\";\n\t}\n\t\n\tconsole.log(\"key: \" + key);\n\tconsole.log(\"title: \" + title);\n\t\n\telasticsearch.index({\n\t\t\tindex: index,\n\t\t\ttype: type,\n\t\t\tid: title,\n\t\t\tbody: {\n\t\t\t\tkey: key,\n\t\t\t\tlocation: 'https://s3-us-west-2.amazonaws.com/elastic-repo-qac/' + key,\n\t\t\t\tfileName: fileName,\n\t\t\t\tlast_updated: datetime\n\t\t\t}\n\t\t}, function(err, data) {\n\t\t\tconsole.log('json reply received');\n });\n\t\n}", "function writeDocument (doc) {\n return wsk.actions.invoke({\n actionName: packageName + \"/create-document\",\n params: { \"doc\": doc },\n blocking: true,\n })\n .then(activation => {\n console.log(\"Created new document with ID \" + activation.response.result.id);\n return activation.response.result;\n })\n .catch(function (err) {\n console.log(\"Error creating document\");\n return err;\n });\n}", "function addEventRecord(params, res){\n var validatedParams = validateEventRecord(params);\n return new Event().save(validatedParams,{method:\"insert\"})\n .then(function(model){\n if(res){\n res.status(201).end(model.attributes.id.toString());\n } \n console.log(\"added event to database: \" + model.attributes.title);\n return model.attributes.id.toString();\n });\n}", "function guardarPedido6() {\n \n db.collection(\"DatosDeCompra\").add({\n ValorUnitario: PrecioJabonLavadora,\n Medida: medida,\n NombreProducto: NombreJabonLavadora.innerHTML,\n Aroma: aroma,\n Cantidad: CantidadJabonLavadora.value\n })\n\n .then(function (docRef) {\n console.log(\"Pedido hecho: \", docRef.id);\n \n })\n .catch(function (error) {\n console.error(\"Error: \", error);\n });\n\n}", "function Add_Doc_CustomID() {\n // Collection is the table or collection of\n cloudDB\n .collection(\"Students\")\n .doc(rollV)\n .set({\n // This is creating a new entry in the DB\n NameOfStd: nameV,\n RollNo: Number(rollV),\n Section: secV,\n Gender: genV,\n })\n .then(function () {\n console.log(\"Document writeen with ID\", rollV);\n })\n .catch(function (error) {\n console.eroor(\"Error adding document\", error);\n });\n}", "async function addProduct(req, res) {\n if (req.user.user == 'admin') {\n const product = new ProductModel(req.body);\n product.dealer_id = req.params.dealer_id;\n const doc = await product.save();\n\n const getDealer = await DealerModel.findById(req.params.dealer_id);\n await getDealer.products.push(doc._id);\n const result = getDealer.save();\n\n return res.status(200).json({ doc, message: \"Product Successfully Added..\" });\n }\n else {\n return res.status(401).json({ message: \"Only Admin can add Products. Sorry!\" });\n }\n}", "async insertObjectInternal(collection, obj) {\n await this.handleApiResult(this.getServerInstance().promiseTimeout(this.getServerInstance().postInCollection(collection, obj, false)));\n }", "function addEventToDatabase(event_name, description, date, time, privacy, schedule) {\n db.collection(\"events\").add({\n name: event_name,\n description: description,\n date: date,\n time: time,\n privacy: privacy,\n schedule: schedule\n })\n .then(function(docRef){\n console.log(\"Success\");\n window.location.replace(\"./app.html\");\n })\n .catch(function(err){\n console.error(\"Failed!\");\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}", "async function create(record, indexArg = indexName) {\n logger.trace('creating record', logRecord ? record : null);\n\n const query = {\n index: indexArg,\n type: recordType,\n id: record[idField],\n body: record,\n refresh: forceRefresh,\n };\n\n return elasticsearch.create(query);\n }", "function saveDoc(doc){\n var db = $.couch.db(\"media\");\n db.saveDoc(doc, {\n success: function (response, textStatus, jqXHR) {\n console.log(response);\n },\n error: function (jqXHR, textStatus, errorThrown) {\n console.log(errorThrown)\n }\n })\n}", "async _write(body, enc, next) {\n debug.extend('_write')('writing 1 record')\n\n /**\n * Push the object to ES and indicate that we are ready for the next one.\n * Be sure to propagate any errors:\n */\n\n try {\n await this.client.index({\n index: this.config.index,\n type: this.config.type,\n id: this.idFn(body),\n refresh: this.config.refresh,\n body\n })\n this.written++\n this.logRate()\n next()\n } catch(err) {\n next(err)\n }\n }", "function addUser(userDocument) {\n\n // Promise callback\n var promise_cb = function(resolve, reject) {\n\n // Insert document callback\n var insertOne_cb = function(err, result) {\n\n // Check if there was an error inserting the user\n if (err) {\n\n // User/email already exists\n if(err.code === 11000) {\n\n // Username is already taken\n if(err.message.indexOf('_id') > 0) {\n\n // Construct a friendly error message\n var userExists_warning = {\n date : datter().time + \" \" + datter().date,\n stack : \"ERRROR! \\nfile: \" + __dirname + \", line 205.\",\n message : \"User already exists. Please choose a different username or log in if you're the owner.\"\n };\n\n // Resolve the promise with a warning\n return resolve({\n warning : userExists_warning\n });\n\n }\n\n // Email is already registered\n if(err.message.indexOf('email') > 0) {\n\n // Construct a friendly error message\n var emailAlreadyUsed_warning = {\n date : datter().time + \" \" + datter().date,\n stack : \"ERRROR! \\nfile: \" + __dirname + \", line 205.\",\n message : \"Account with that e-mail is already registered. Please log instead.\"\n };\n\n // Resolve the promise with a warning\n return resolve({\n warning : emailAlreadyUsed_warning\n });\n\n }\n\n }\n\n // Construct a friendly error message\n var insertUser_error = {\n date : datter().time + \" \" + datter().date,\n stack : \"ERRROR! \\nfile: \" + __dirname + \", line 205.\",\n message : \"There was an error inserting the user into database.\"\n };\n\n // Log the error\n logger('error', insertUser_error);\n\n // Reject the promise with an error\n return reject(insertUser_error);\n\n // No error (user inserted)\n }\n\n // Capture the user document inserted\n var userInserted = result.ops[0];\n delete userInserted.password;\n\n // Pass the user inserted\n return resolve({\n userInserted : userInserted\n });\n\n };\n\n\n // Add the user to the \"users\" collection\n usersCollection.insertOne(userDocument, insertOne_cb);\n\n };\n\n\n // Return a promise\n return new Promise(promise_cb);\n\n }", "function addDocument(collectionName, newDoc) {\n var collection = data[collectionName];\n var nextId = Object.keys(collection).length;\n if (newDoc.hasOwnProperty('_id')) {\n throw new Error(`You cannot add a document that already has an _id. addDocument is for new documents that do not have an ID yet.`);\n }\n while (collection[nextId]) {\n nextId++;\n }\n newDoc._id = nextId;\n writeDocument(collectionName, newDoc);\n return newDoc;\n}", "function addDocument(collectionName, newDoc) {\n var collection = data[collectionName];\n var nextId = Object.keys(collection).length;\n if (newDoc.hasOwnProperty('_id')) {\n throw new Error(`You cannot add a document that already has an _id. addDocument is for new documents that do not have an ID yet.`);\n }\n while (collection[nextId]) {\n nextId++;\n }\n newDoc._id = nextId;\n writeDocument(collectionName, newDoc);\n return newDoc;\n}", "function addDocument(collectionName, newDoc) {\n var collection = data[collectionName];\n var nextId = Object.keys(collection).length;\n if (newDoc.hasOwnProperty('_id')) {\n throw new Error(`You cannot add a document that already has an _id. addDocument is for new documents that do not have an ID yet.`);\n }\n while (collection[nextId]) {\n nextId++;\n }\n newDoc._id = nextId;\n writeDocument(collectionName, newDoc);\n return newDoc;\n}", "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}", "submitInsertDocument(forumFields) {\n // Insert a new document\n this.props.collection.insert(forumFields, (err, res) => {\n if(err) // If there was an error\n {\n this.log(false, `Error inserting forum`, forumFields);\n this.handleSubmitError(err);\n\n this.setState({\n processingForm: false\n });\n }\n else\n {\n this.log(false, `Inserted forum`, forumFields);\n\n if(this.props.onSubmit) // If we have a onSubmit function from the props\n {\n this.props.onSubmit(res); // Run it - and pass the created docId to it\n }\n else // Otherwise\n {\n this.resetForm(); // Reset the forum to blank\n }\n }\n\n return res;\n });\n }", "function addStage(req, res) {\n if (!validator.isValid(req.body.stageName)) {\n res.json({\n code: Constant.ERROR_CODE,\n message: Constant.FIELD_REQUIRED\n });\n }\n else {\n stage.findOne({stageName: {$regex: new RegExp('^' + req.body.stageName + '$', \"i\")}, moduleType: req.body.moduleType, companyId: req.body.companyId, deleted: false}, function(err, industryData) {\n if (err) {\n res.json({code: Constant.ERROR_CODE, message: err});\n }\n else {\n if (industryData) {\n res.json({\n code: Constant.ERROR_CODE,\n message: Constant.CONTACT_INDUSTRY_EXIST\n });\n }\n else {\n var industryDataField = {\n stageName: req.body.stageName,\n companyId: req.body.companyId,\n moduleType: req.body.moduleType\n };\n stage(industryDataField).save(function(err, data) {\n if (err) {\n res.json({code: Constant.ERROR_CODE, message: err});\n } else {\n res.json({code: Constant.SUCCESS_CODE, data: data});\n }\n });\n }\n\n }\n });\n }\n\n}", "function addDocument(docId, allWords) {\n let hist = createWordHistogram(allWords);\n let words = Object.keys(hist);\n\n // find the largest term frequency using hist \n let largestTF = words.map(k => hist[k]).reduce((a, b) => Math.max(a, b), 1);\n\n // make sure all words are in the database\n let wordObjects = getWords.bind(this)(words);\n\n // increase the document counter for every word in this document\n let wordIds = wordObjects.then(objs => objs.map(obj => obj._id));\n let docCounterIncremented = wordIds.then(ids => {\n return this.db.collection('words')\n .update(\n {'_id': {'$in': ids}}, \n {'$inc': {'documents': 1}},\n {'multi': true}\n );\n });\n\n // create word counters for this document \n let counters = wordObjects.then(objs => objs.map(obj => {\n return {\n 'document': docId, \n 'word': obj._id, \n 'count': hist[obj.word],\n 'normalizedCnt': hist[obj.word] / largestTF\n };\n }));\n let countersInserted = counters.then(documents => {\n if (documents.length > 0) {\n return this.db.collection('words_in_documents').insert(documents);\n } else {\n return 'nothing to do';\n }\n });\n\n // finished when all db queries are finished \n return Promise.all([docCounterIncremented, countersInserted]);\n}", "async function addPatientLabResult(req, res) {\n const { error } = validation.addlabresult(req.body);\n if (error) return res.send({ error: error.details[0].message });\n\n //---------patient_id, complaint_id, complaint\n try {\n var result_id = mongoose.Types.ObjectId();\n const addlabresult = await record.findOneAndUpdate(\n {\n patient_id: req.body.patient_id,\n \"labtest.labtest_id\": req.body.labtest_id,\n },\n {\n $push: {\n \"labtest.$.test_result\": {\n _id: result_id,\n test: req.body.test,\n comment: req.body.comment,\n },\n },\n },\n { useFindAndModify: false, new: true }\n );\n if (await addlabresult) {\n return res.send({ success: result_id });\n } else {\n return res.send({ error: \"Error adding to database\" });\n }\n } catch (err) {\n return res.send({ error: err });\n }\n}", "async insert(document) {\n\n // Note: the this.mongoDb Node.js driver updates the document inserted with a new _id field if it did not have one.\n\n let client = await MongoClient.connect(this.mongoDb)\n let results = await client.db(this.database).collection(this.collection).insert(document)\n\n await client.close()\n\n return results.ops[0]\n }", "function createDocument(req, res, next) {\n const Token = _getToken(req, res)\n Token\n .then((token) => {\n const params = {\n method: 'set_entry',\n custom: false,\n rest_data: {\n session: token,\n modulo: 'Documents',\n data: [\n {\n name: 'document_name',\n value: req.params.filename,\n },\n {\n name: 'revision',\n value: 1,\n },\n ],\n },\n }\n\n _requestCRM(params)\n .then((result)=>{\n res.end(result.id)\n })\n .catch((e) => {\n logger.error('Controller::DefensaConsumidor::createDocument::_RequestCRM::Catch')\n next(APIError({ status: 500, devMessage: e.message, }))\n })\n })\n}", "function saveDoc(doc) {\n db.save(doc, function(err, res) {\n if (err) {\n console.log('Could not save document.');\n } else {\n console.log('Document saved: ' + res.id);\n }\n });\n}", "function insertDocument(db, coll, callback) {\n\t\tvar col = db.collection(coll);\n\t\tcol.insertOne(image, function(err, result) {\n\n\t\t});\n\t}", "function addnewdoc() {\n currentuseruid = auth.currentUser.uid\n var newdoc1 = {\n title: 'A new doc by abca',\n desc: 'A new doc blah blah by abca',\n creator: currentuseruid\n }\n // console.log(newdoc1)\n // get the current user\n db.collection('new1').doc('newdoc2').set(newdoc1).then(d => {\n console.log('new doc added')\n });\n db.collection('new1').doc('newdoc2').set({ newfield: 'yes' }, { merge: true }).then(d => {\n console.log('new data merged into an existing doc')\n });\n }", "async function insert( db, collectionName, document )\n{\n\tlet ret = null;\n\tlet collection = db.collection( collectionName );\n\tlet insertResult = await collection.insertOne( document ); // insertOne() returns an Object of type insertOneWriteOpResultObject.\n\t\n\tconsole.log( \"Insertion result: \" + insertResult.result.ok );\n\t\n\tif ( insertResult.result.ok == 1 )\n\t\tret = insertResult.insertedId;\n\t\n\treturn ret;\n}", "async function sendData() {\n let ref = doc(db, \"Student\", usn.value); //collection for two parameter , doc for 3 parameter\n const docref = await setDoc( //addDoc for two parametr ,setDoc for 3 parameter\n ref, {\n Name: name.value,\n Age: age.value,\n USN: usn.value\n }\n )\n .then(() => {\n alert(\"added data into db\");\n })\n .catch((err) => {\n alert(err);\n })\n}", "function addWord(req, res) {\n const data = req.body;\n\n if (!data || !data.englishWord || !data.translation) {\n res.status(400).send('Bad request.');\n return;\n }\n\n Vocabulary.create(data, function (err, newWord) {\n if (err) {\n res.status(500).json({\n status: 'An error occurred in adding new word.',\n data: err\n });\n } else {\n res.status(201).json({\n status: 'OK',\n data: newWord\n });\n }\n });\n}", "function insertProductInDB(product, seller, uiCallback) {\n if (!product) {\n throw new Error(\n `Product insertion error! Error code: ${codes.NULL_OBJECT}`\n );\n }\n // console.log(product);\n db.collection(`products`)\n .doc(product.id)\n .withConverter(productConverter)\n .set(product)\n .then(() => {\n console.log(\"Product Added!\");\n seller.addProduct(product);\n createSellerObjectInDB(seller, uiCallback);\n return codes.INSERTION_SUCCESS;\n });\n // .catch((error) => {\n // console.log(`Product insertion error! Error code: ${error.errorCode}\\nError Messsage: ${error.errorMessage}`);\n // return codes.INSERTION_FAILIURE;\n // });\n}", "function addEvent(auth,data){\n const calendar = google.calendar({version: 'v3', auth});\n calendar.events.insert({\n auth: auth,\n calendarId: 'primary',\n resource: {\n 'summary': data.summary,\n 'description': data.eventDescription,\n 'start': {\n 'dateTime': data.eventStart,\n 'timeZone': 'GMT',\n },\n 'end': {\n 'dateTime': data.endTime,\n 'timeZone': 'GMT',\n },\n },\n }, function(err, res) {\n if (err) {\n console.log('Error: ' + err);\n return;\n }\n console.log(res);\n });\n}", "function saveRecord(record) {\n // open a new transaction with the database readwrite permissions \n const transaction = db.transaction(['new_transaction'], 'readwrite');\n \n // access objectStore \n const budgetObjectStore = transaction.objectStore('new_transaction');\n \n // add record to store with add (method)\n budgetObjectStore.add(record);\n}", "function addNewProduct(req, res, next) {\n     requestCounterPost++;\n     console.log(\"   Request counter: \" +  requestCounterPost);\n console.log(\"sending request\")\n // json payload of the request\n var newProduct = req.body;\n\n productsSave.create(newProduct, function(err, product){\n var requestCounterString = \"======> Request Count: \" + requestCounterPost + \"\\n======================================\";\n console.log(\"Created new products\")\n // send 201 HTTP response code and created product object\n res.send(201, product);\n next();\n })\n}", "function add(body) {\n return DB(\"resources\").insert(body);\n // .then(id => {\n // findById(id);\n // });\n}", "async function addProductToDb(myobj) {\n \n await db.collection('products').insert(myobj);\n return getProductByName(myobj.name);\n}", "async insert(obj) {\n let collection = await this.collection();\n console.log('Inserting item...')\n await collection.insertOne(obj);\n this.dbClient.close();\n return console.log('Item successfully added to database')\n }", "function add(response, postData) {\n console.log(\"Request handler 'add' was called.\");\n response.writeHead(200, {\n \"Content-Type\": \"text/plain\"\n });\n var student = {\n name: querystring.parse(postData).name,\n faculty: querystring.parse(postData).faculty,\n course: querystring.parse(postData).course,\n }\n student.hash = crypto.createHash('md5').update(student.name + student.faculty + student.course).digest('hex');\n \n response.write(\"Student: \" + student.name + \"\\n\" +\n \"Faculty: \" + student.faculty + \"\\n\" +\n \"Course: \" + student.course + \"\\n\" +\n \"Hash: \" + student.hash);\n response.end();\n /*\n Connect to base -> write document -> disconnect\n */\n MongoClient.connect(url, function (err, db) {\n\n if (err) {\n throw err;\n } else {\n console.log(\"Connected\");\n }\n students = db.collection('students');\n students.insert(student);\n students.findOne({name: \"123\"}, {}, function (err, doc) {\n if (err) {\n throw err;\n } else {\n console.log(\"Document add:\\n\", doc);\n }\n });\n db.close();\n\n });\n}", "function addDataIndexedDb(dataJson){\n var date = dataJson.date;\n var description = dataJson.description;\n var value = dataJson.value;\n \n var transaction = db.transaction([constDbObject],\"readwrite\");\n transaction.oncomplete = function(event) {\n console.log(\"Sucesso :)\");\n };\n transaction.onerror = function(event) {\n console.log(\"Erro :(\");\n };\n\n var objectStore = transaction.objectStore(constDbObject);\n objectStore.add({date:date, description:description, value:value});\n}", "async addStore(data, req, res, next) {\n try {\n const userdata = req.body;\n\n await Localbodies.addStore(userdata);\n\n res.json({\n status: 'success',\n message: 'Store added.'\n });\n } catch (err) {\n next(err);\n }\n }", "function createDoc(resourceName, obj) {\n \tdelete obj._id; // Do not allow users to set ._id\n\n \tconst collection = getModel(resourceName);\n \tconst item = new collection(obj);\n\n \treturn item.save()\n \t.then(data => {\n\n \t\tconst resp = {\n \t\t\tdoc: data,\n \t\t\tmetadata: { modified: data.length}\n \t\t};\n\n \t\treturn resp;\n \t})\n \t.catch(err => {\n \t\tconsole.log(err);\n \t\tconsole.log(\"db.createDoc error\");\n \t});\n }", "static async modifyDocument (id, document) {\n if (typeof document !== 'object') {\n throw new Error('Bad Parameter');\n }\n const db = await Mongo.instance().getDb();\n const isValid = await Document.isDocument(document);\n if (isValid.valid) {\n // Create a new document\n // Uploaded document with new informations.\n const res = await db.collection(Document.COLLECTION).updateOne(\n {\n _id: ObjectId(id)\n },\n {\n $set: {\n ...document,\n updatedAt: moment().toDate()\n }\n }\n );\n return res;\n } else {\n log.debug('Warning - couldn\\'t modify document \\n', document);\n return null;\n }\n }", "function Add_Doc_WithAutoID() {\n // Collection is the table or collection of\n cloudDB\n .collection(\"Students\")\n .add({\n // This is creating a new entry in the DB\n NameOfStd: nameV,\n RollNo: Number(rollV),\n Section: secV,\n Gender: genV,\n })\n .then(function (docRef) {\n console.log(\"Document writeen with ID\", docRef.id);\n })\n .catch(function (error) {\n console.eroor(\"Error adding document\", error);\n });\n}", "function addNewUserDocToDb(userId) {\n console.log(\"Adding doc to db for new user.\");\n if (userId === undefined) {\n console.log(\"userId undefined.\");\n return;\n }\n db.collection(\"users\")\n .doc(JSON.stringify(userId))\n .set(Constants_1.DEFAULT_USER_DOC)\n .then(() => {\n console.log(\"Added new user: (\" + userId + \") doc to db.\");\n getUserDocWithId(userId);\n })\n .catch(() => {\n console.log(\"Error adding new user: (\" + userId + \") doc to db.\");\n });\n}", "function added(_domain, ee) {\n if (arguments.length < 2) {\n ee = _domain;\n _domain = domain.active;\n }\n \n _domain && _domain.emit('added', ee);\n \n}", "upsert(oDoc) {\n // if valid\n\tif(!oDoc) {\n\t\treturn Promise.resolve()\n\t}\n // ensure latitude and longitude are set properties\n if (typeof oDoc.latitude !== 'number' && oDoc.ll && typeof oDoc.ll[0] === 'number') {\n oDoc.latitude = oDoc.ll[0];\n }\n if (typeof oDoc.longitude !== 'number' && oDoc.ll && typeof oDoc.ll[0] === 'number') {\n oDoc.longitude = oDoc.ll[1];\n }\n if (typeof oDoc.score !== 'number' && typeof oDoc.ts === 'number') {\n oDoc.score = oDoc.ts || oDoc.cs;\n }\n\n if (oDoc &&\n\t\ttypeof oDoc.id === 'string' & oDoc.id.length > 0 && \n typeof oDoc.longitude === 'number' && \n typeof oDoc.latitude === 'number' && \n typeof oDoc.score === 'number') \n {\n const oPartialDoc = { id: oDoc.id, score: oDoc.score, latitude: oDoc.latitude, longitude: oDoc.longitude, ts: oDoc.ts, cs: oDoc.cs, level: oDoc.level };\n\n // if object id is already in db update\n if (this.db[oDoc.id]) {\n this._removeFromBucket(oDoc.id);\n this._addToBucket({ \n id: oDoc.id, \n longitude: oDoc.longitude, \n latitude: oDoc.latitude, \n val: oDoc.score,\n level: oDoc.level\n });\n }\n else {\n this._addToData(Object.assign({},oPartialDoc)); \n }\n // this.db[oDoc.id] = oPartialDoc;\n this.db[oDoc.id] = oDoc;\n }\n else {\n console.info({ action: 'upsert.skipping.oDoc', oDoc: oDoc })\n }\n }", "registerMood(rating, comment){\n this.db.collection(this.auth.currentUser.email).add({\n Date: Date.now(),\n Rate: rating,\n Comment: comment,\n \n })\n .then(function(docRef) {\n console.log(\"Document written with ID: \", docRef.id); // Get generated id for the new document\n }) \n .catch(function(error) {\n console.error(\"Error adding document: \", error);\n });\n }", "addResource(res) {\n\n //create object to add\n var resource = {\n _id: \"Resource\" + \"_\" + res.resourcetype + \"_\" + res.name,\n civic_address: res.civic_address,\n phone: res.phone,\n website: res.website,\n description: res.description,\n resourcetype: res.resourcetype,\n type: res.type,\n zip: res.zip,\n city: res.city,\n lat: res.lat,\n lng: res.lng,\n price:res.price,\n languages:res.languages,\n population:res.population,\n waitingtime:res.waitingtime,\n services:res.services,\n numberreviews:'0',\n accessibilityrating:'',\n availabilityrating:'',\n tags:res.tags,\n\n };\n db_pending.put(resource, function callback(err, result) {\n if (!err) {\n console.log('Added resource');\n } else {\n console.log('Error adding resource' + err);\n }\n });\n\n db_pending.replicate.to(remoteCouchPending, {\n live: true,\n retry: true,\n back_off_function: function (delay) {\n if (delay === 0) {\n return 1000;\n }\n return delay * 3;\n }\n });\n\n }", "function saveMessage(data) {\n db.collection(\"messages\")\n .add(data)\n .then((docRef) => {\n console.log(\"Document written with ID: \", docRef.id);\n })\n .catch((error) => {\n console.error(\"Error adding document: \", error);\n });\n}", "function addSavedDocs(data, callback){\n console.log(data);\n MongoClient.connect(uri, function (err, db) {\n assert.equal(null, err);\n\n //try find the user's existing list of saved doctors\n db.collection('savedDoctors').find({'email':data.email}).toArray(function(err, docs){\n assert.equal(null, err);\n //console.log(docs);\n\n if(docs.length === 0){\n console.log('New entry detected, creating saved doctor list');\n db.collection('savedDoctors').insertOne({email:data.email, savedDocs: [data.docName]}, function (err, r) {\n if (err === null) {\n assert.equal(1, r.insertedCount);\n console.log('Doctor added to saved list');\n callback('Doctor saved');\n db.close();\n } else {\n //cb('Invalid Review data');\n console.log(err.message);\n callback('Adding Doctor Failed');\n }\n });\n }else{\n var docAlreadSaved = 0;\n var myNewDoc = docs[0];\n //console.log(myNewDoc);\n\n for( var j=0; j<myNewDoc.savedDocs.length;j++){\n if(myNewDoc.savedDocs[j] === data.docName){\n docAlreadSaved = 1;\n console.log(\"Doctor already part of client's saved list\");\n callback('Doctor already in your list of saved doctors');\n }\n }\n\n if(docAlreadSaved === 0){\n console.log('Adding doc to client\\'s saved doctors');\n myNewDoc.savedDocs[myNewDoc.savedDocs.length] = data.docName;\n //console.log(myNewDoc);\n var res = db.collection('savedDoctors').updateOne({email: data.email},myNewDoc,{ upsert: false });\n console.log('Doctor Saved');\n callback('Doctor saved');\n }\n\n }\n db.close();\n });\n });\n}", "async addDocument(hash_id, isSign) {\n const overrides = {\n gasLimit: ethers.BigNumber.from(\"2000000\"),\n gasPrice: ethers.BigNumber.from(\"10000000000000\"),\n\n };\n const callPromise = await this.contract.addDocument(`0x${hash_id}`, overrides);\n const receipt = await this.provider.getTransactionReceipt(callPromise.hash);\n if(receipt.status !== 1){\n return \"Fail On Server Blockchain\";\n }\n if(isSign === 1){\n const result = await signDocument(hash_id);\n return result;\n }\n return \"Success\";\n }", "function addKeyWords(req, res) {\n\n console.log(\"in addKeyWords\");\n\n if (validation.addKeyWords(req)) {\n utilsDAO.addKeyWords(req.body.sector, req.body.words_list, function (status, result) {\n res.status(status).json(result);\n });\n } else {\n utils.sendErrorValidation(res);\n }\n\n}", "function addNewItem(item, collection, db){\n var twitter = db.db(\"twitter\");\n twitter.collection(collection).insert(item, function(err, res) {\n if (err) throw err;\n console.log(\"New item added to database: \", res.insertedIds[0]);\n });\n}", "function addEvent(req, res) {\n\n\tlet eventData = req.body.eventData;\t// accepts JSON event data\n\t// {\n\t// \teventName: \"string\",\n\t// \tstartTime: \"string\",\n\t// \tendTime: \"string\"\n\t// category: \"string\"\n\t// \tothers: \"string\"\n\t// }\n\n\tif(eventData === undefined) {\n\n\t\treturn res.json({\n\t\t\tsuccess: false,\n\t\t\tmessage: `Send event data as json data in $eventData`\n\t\t})\n\t}\n\n\tif(eventData[\"eventName\"] === undefined || eventData[\"startTime\"] === undefined || eventData[\"endTime\"] === undefined || eventData[\"category\"] === undefined) {\n\n\t\treturn res.status(400).json({\n\t\t\tsuccess:false,\n\t\t\tmessage: \"eventName, startTime, endTime, category -- are compulsory parameters\"\n\t\t})\n\t}\n\n\teventData.startTime = parseInt(eventData.startTime);\n\teventData.endTime = parseInt(eventData.endTime);\n\n\t// adding event to timeline\n\t// name, startTime and endTime\n\tdb.child(`${events}/${eventData.category}/${eventData.eventName}`).set({\n\n\t\teventName : eventData.eventName,\n\t\tstartTime : eventData.startTime,\n\t\tendTime : eventData.endTime\n\t})\n\t.then((snapshot) => {\n\t\treturn console.log(`Added ${eventData.eventName} to timeline succesfully`);\n\t}).catch((err) => {\n\t\treturn res.send({\n\t\t\tsuccess: false,\n\t\t\tmessage: `Error occured while adding event to the timeline\\nError : ${err}`\n\t\t});\n\t})\n\n\t// adding event with full description to the node\n\t// with all the json data received\n\n\n\n\tlet eventCategory = eventData.category;\n\tdelete eventData.category;\n\n\tdb.child(`${eventDescription}/${eventCategory}/${eventData.eventName}`).set(eventData)\n\t.then((snapshot) => {\n\n\t\tconsole.log(`Added ${eventData.eventName} successfully`);\n\n\t\treturn res.send({\n\t\t\tsuccess: true,\n\t\t\tmessage: `Added ${eventData.eventName} successfully`\n\t\t});\n\t}).catch((err) => {\n\t\treturn res.send({\n\t\t\tsuccess: false,\n\t\t\tmessage: `Error occured when adding events to the description node\\nError : ${err}`\n\t\t});\n\t})\n\n}", "function DocumentCreated(doc) {\n ReceiveUpdate(doc);\n}", "async function addNest(req, res, next) {\n const newNest = req.body;\n nests.push(newNest);\n // Send recently added nest as POST result\n res.json(newNest)\n // Invoke iterate and send function\n return sendEventsToAll(newNest);\n}", "async function saveEvent(eventObj) {\n console.log(\"Saving event in firestore\")\n const doc = await db.collection('users').doc(currentUser.uid).collection('events').add({\n eventTitle: eventObj.eventTitle,\n eventDescription: eventObj.eventDescription,\n startTime: eventObj.startTime,\n endTime: eventObj.endTime\n })\n \n // Saving the data locally in indexDb\n // localStorage.setItem(doc.id, JSON.stringify(eventObj))\n localDb.collection('events').doc(doc.id).set(eventObj)\n }", "function insertData(event) {\t\n\tvar json = {\n\t\t\"authent\": {\n\t\t\t\"username\": \"feferi\",\n\t\t\t\"password\": \"0413\"\n\t\t},\n\t\t\n\t\t\"requests\": [\n\t\t\t{\n\t\t\t\t\"type\": \"add\",\n\t\t\t\t\"records\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"product\": Number(document.getElementById(\"product\").value),\n\t\t\t\t\t\t\"quantity\": Number(document.getElementById(\"quantity\").value),\n\t\t\t\t\t\t\"dateTime\": getDateAndTime()\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\t\n\t// UPDATED CALL SIGNATURE (return false event value)\n\treturn sendAPIRequest(json,event,displaySalesRecords);\n}", "async function addCandidate(req,res){\n var return_response = { \"status\": null, \"message\": null, \"data\": {} } \n try {\n let opt = req.body;\n const candidate = new Candidate(opt);\n const doc = await candidate.save();\n return_response.status = 200;\n return_response.message = \"Candidate added successfully\";\n return_response.data = doc;\n } catch (error) {\n return_response.status = 400;\n return_response.message = String(error);\n }\n res.json(return_response);\n}" ]
[ "0.70508546", "0.6492602", "0.648254", "0.5959946", "0.5823006", "0.5642557", "0.56335896", "0.5618076", "0.5592447", "0.55520386", "0.5526502", "0.5523152", "0.5505608", "0.54886985", "0.5422777", "0.5386866", "0.5327589", "0.532641", "0.5308144", "0.5273793", "0.52727634", "0.526465", "0.52587104", "0.52370113", "0.5201268", "0.5194844", "0.5175004", "0.5160826", "0.51411986", "0.51351696", "0.511563", "0.50954646", "0.50835997", "0.50831336", "0.5064999", "0.50615287", "0.5053456", "0.5052796", "0.5042441", "0.50419676", "0.5039633", "0.5028782", "0.5024141", "0.5023844", "0.49911913", "0.49910933", "0.49764916", "0.49700254", "0.4963299", "0.49576744", "0.49576053", "0.4954757", "0.49427617", "0.494271", "0.49235153", "0.491985", "0.491985", "0.491985", "0.49163908", "0.49161306", "0.4912157", "0.48992217", "0.4898099", "0.48938292", "0.4892611", "0.48853683", "0.48721734", "0.4871086", "0.4862157", "0.48294652", "0.4819935", "0.48167437", "0.4809577", "0.48091695", "0.4808266", "0.48025933", "0.4793917", "0.4793282", "0.47753835", "0.47718692", "0.47670278", "0.4767019", "0.47668383", "0.47539216", "0.47482604", "0.47460645", "0.4744474", "0.47424963", "0.47409555", "0.4737819", "0.47361118", "0.47344452", "0.4730377", "0.47280535", "0.47216657", "0.47175527", "0.47139105", "0.47106197", "0.47093946", "0.46979195" ]
0.6055897
3
Manual update (from user)
function handleChange(event, newValue) { setValue(newValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(){}", "update(){}", "update(){}", "function update() {}", "function adminUpdate(data) {\n\t\t\t\n\t\t\t\n\t\t}", "update(id, user) {\n return 1;\n }", "async update() {}", "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}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "update() {}", "_update() {\n }", "updateUser(h, p){\n\t\tlet oldInfo = this.props.user;\n\t\tlet updatedInfo = { happiness: oldInfo.happiness + h,\n\t\t pollution: oldInfo.pollution + p};\n\t\tlet userUrl = `/api${this.props.match.url}`;\n\t\tthis.props.actions.updateUser(userUrl, updatedInfo);\n\t}", "updateUser(h, p){\n\t\tlet oldInfo = this.props.user;\n\t\tlet updatedInfo = { happiness: oldInfo.happiness + h,\n\t\t pollution: oldInfo.pollution + p};\n\t\tlet userUrl = `/api${this.props.match.url}`;\n\n\t\tthis.props.actions.updateUser(userUrl, updatedInfo);\n\t}", "function update(data) {\n console.log('+++ TODO');\n }", "updated() {}", "updateProfile() {}", "update(id) {\n\n }", "myUpdates(parent, args, ctx, info) {\n if (!ctx.request.userId) {\n throw new Error(\"You must be logged in\");\n }\n // query parameters where author is the current user\n return ctx.db.query.updates(\n {\n where: {\n user: {\n id: ctx.request.userId,\n },\n },\n },\n info\n );\n }", "function updateroster() {\n\n}", "function update() {\n\t\t\n\t}", "function updateUser(){\n helpers.rl.question('\\nEnter user name to update: ', dealWithUserUpdate);\n}", "update () {}", "async function update(data) {\n console.debug(\"Update\");\n const user = await JoblyApi.updateUserInfo(currentUser.username, data);\n setCurrentUser(user);\n }", "enableUpdating(_requestedUpdate) {\n }", "updated(){\n console.log('Updated');\n }", "async function UpdateNew() {}", "function update() {\n // PREPARE\n let uid = $rootScope.account.authData.uid;\n let profile = $rootScope.account.profile;\n\n // NEW USER ACTION\n if (profile.newUser) {\n instance.addAchievement(profile, ACHIEVEMENTS.PROFILE_COMPLETED);\n profile.newUser = false;\n }\n\n // UPDATE\n $rootScope.db.users.child(uid).update(profile);\n\n // NOTIFY\n BroadcastService.send(EVENTS.PROFILE_UPDATED, profile);\n }", "updateUser (context, user) {\n context.commit('updateUser', user)\n }", "function update() {\n // ... no implementation required\n }", "function manuallyCheckForUpdate() {\r\n\tcheckForUpdate(true);\r\n} //End manual update check", "function updateUser(update) {\n firebase.database().ref(\"users/\"+update.name).update({x: update.x,\n y:update.y,highscore:update.highscore, sector:update.sector,});\n }", "function updateUser(){\n\tuser.age++;\n\tuser.name = user.name.toUpperCase();\n}", "function updateUser(){\n\tuser.age++;\n\tuser.name = user.name.toUpperCase();\n}", "function updateUserInfo(id, user) {\n}", "willUpdate(options) {\n console.log('willUpdate ejecutado!', options);\n }", "async updateUser () {\n\t\tawait this.getFirstTeam();\t\t// get the first team the user is on, if needed, this becomes the \"origin\" team\n\t\tawait this.getTeamCreator();\t// get the creator of that team\n\t\tawait this.doUserUpdate();\t\t// do the actual update\n\t}", "function setUpdateTrue(tempID, userID) {\n sqlDB\n .query(`UPDATE ${resetTable} SET updated = TRUE WHERE id = ${tempID};`,\n function (err, results) {\n if (err) {\n return res.status(500).send(err);\n } else if (results.affectedRows === 1) {\n corbato(req.body.update)\n .then(hashedPassword => {\n updateUser(userID, hashedPassword);\n })\n .catch(err => {\n return res.status(500).send(err);\n })\n } else {\n return res.status(500).send(\"Unable to update record\");\n }\n })\n }", "runUpdate() {\n this.utils.log(\"\");\n this.utils.log(\"******************* Running update ******************* \");\n this.utils.log(\"\");\n\n // Reset update flags\n this.updateTweets = false;\n this.updateStatus = false;\n\n // Process any new tweets before performing other operations\n this.checkTrackedTweets().then(() => {\n // Process any mentions\n this.checkMentions().then(() => {\n // Save the status file if needed\n if (this.updateTweets || this.updateStatus) {\n this.dataHandler.saveStatus(this.botStatus);\n }\n });\n\n // Post a normal tweet\n this.actionHandler.postTweet(this.generator.generateResponse());\n\n });\n }", "function dataUpdate(UserName){\n usermanage.updateUserData(UserName,Ipconfig.myIpAddress());\n}", "update()\n {\n \n }", "handleUpdate() { \n if (// Check if the needed fields are not empty\n this.state.email !== '' &&\n this.state.firstName !== '' &&\n this.state.lastName !== ''\n ) {// The Put method will be as follow\n fetch(myGet + '/' + this.state.user.id, {\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n method: 'put',\n body: JSON.stringify({\n // Declare and stringify the fields that need updating\n email: this.state.email,\n firstName: this.state.firstName,\n lastName: this.state.lastName\n })\n })\n .then(() => this.props.fectchAccount()) // Fetch the exact account again to apply changes\n alert('The account has been successfully updated')\n } else {\n alert('Please enter correct information')\n }\n }", "refreshUpdateStatus() {}", "firstUpdated() {}", "updateToAll() {}", "function update()\n{\n\n}", "function update() {\n\t\n\n\n\n}", "function directUserFromUpdateInfo () {\n if (nextStep == \"The role for an existing employee\") {\n updateEmployeeRole();\n }\n }", "update() {\n Spark.put('/settings/timezone', this.form)\n .then(() => {\n Bus.$emit('updateUser');\n });\n }", "function updateData() {\n\t/*\n\t* TODO: Fetch data\n\t*/\n}", "handleUpdates(){\n\t\t//put per update scripts here\n\t\tconsole.log('update');\n\t}", "function update() {\n updateGym(id, name, address1, address2, town, county, openingHours)\n .then(() => {\n alert(\"Gym Information updated!\");\n })\n .catch((error) => {\n alert(error.message);\n });\n }", "function handle_remote_update() {\n update_edit_form_display()\n //update_entity_tee(current_entity, current_id);\n}", "function userUpdated(response) {\n\tif (response.type != \"error\") {\t// type is \"User ___ updated\" on success\n\t\tlocation.reload(true);\n\t} else if (response.type == \"error\") {\n\t\talert(\"Failed to edit user:\\n\" + response.payload[0].msg);\n\t}\n}", "async function update(req, res) {}", "update() {\n this.showLoader();\n axios\n .put(`users`, {\n users: this.users\n })\n .then(response => {\n if (response.data.success) {\n this.alert(\"Users updated\", \" \", \"success\", 2000);\n this.getUsers();\n }\n })\n .catch(error => {\n this.alert(\n \"Something went wrong\",\n \"Your changes could not be saved\",\n \"error\",\n false\n );\n })\n .finally(() => {\n this.hideLoader();\n });\n }", "updateUserData() {\n if (this.form.subscribe == true) {\n this.form.subscribe = 1;\n } else {\n this.form.subscribe = 0;\n }\n this.form\n .post(\"/api/user-update\", {\n headers: { Authorization: `Bearer ${localStorage.token}` },\n })\n .then((response) => {\n this.$swal.fire({ icon: \"success\", title: \"Profile updated!!\" });\n })\n .catch((error) => {\n this.handleError(error);\n });\n }", "_onUserUpdated() {\n UserActions.setIsUpdating(false);\n UserActions.setIsRequesting(false);\n }", "function updatedoc() {\n currentuseruid = auth.currentUser.uid\n var updatedata = {\n collection: 'new1',\n doc: 'newdoc2',\n contents: {\n newfield: 'updated',\n newfield2: 'newly added by abcd'\n }\n }\n // console.log(newdoc1)\n // get the current user\n db.collection(updatedata.collection).doc(updatedata.doc).update(updatedata.contents).then(d => {\n console.log('document updated')\n });\n }", "function update() {\n switch (x) {\n case 'help': return help(cmd, x);\n case 'history': return history(cmd, x);\n case 'reset': return reset(cmd);\n case 'reset -a': return window.localStorage.removeItem('itemKey');\n case 'cv': return cv(cmd, x);\n case 'cv --json': return cvjson(cmd, x);\n case 'q':\n case 'quit': return quit(cmd, x);\n default: return unexisting(cmd, x);\n }\n }", "function update() {\n // Update user account\n Lottery.inpUserAddress.value = web3.eth.defaultAccount\n\n // Update Contract\n if (!web3.isAddress(Lottery.inpContractAddress.value)) {\n setErrorMessage(\"Invalid contract address\")\n return false;\n }\n Lottery.contractAddress = Lottery.inpContractAddress.value\n Lottery.contractInstance = web3.eth.contract(Lottery.abi).\n at(Lottery.contractAddress)\n Lottery.contractInstance.defaultAccount = web3.eth.defaultAccount;\n\n setErrorMessage(\"\")\n return true\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 }", "update() {\n http.put(`/users/${this.user.id}/contact`, this.form)\n .then(() => {\n Bus.$emit('updateUser');\n });\n }", "async updateUser(req,res){\n //función controladora con la lógica que actualiza un usuario\n }", "onUpdated() {\n this.setState({editDialogOpen: false});\n\n this.fetchUser();\n }", "async update() {\n throw new Error(\"Operation not supported.\");\n }", "function update() {\n \n}", "firstUpdated(e){}", "updateUser({ commit }, userID) {\n commit(\"updateUser\", userID);\n }", "update(dt) {\n logID(1007);\n }", "function api_updateuser(ctx, newuser) {\n newuser.a = 'up';\n res = api_req(newuser, ctx);\n}", "update(id, data, params) {}", "update() {\n localStorage.setItem('user', JSON.stringify(user))\n\n dataStore.set('config', user.config)\n dataStore.set('palette', user.palette)\n dataStore.set('projectPalette', user.projectPalette)\n dataStore.set('log', user.log)\n\n Log.refresh()\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() {\n if (model.addAdmin) {\n model.user.roles.push(\"ADMIN\");\n }\n if (model.addMember) {\n model.user.roles.push(\"MEMBER\");\n }\n userService\n .updateUser(model.userId, model.user)\n .then(function() {\n model.message = \"User updated successfully.\";\n });\n }", "function toupdate(){\n const update_2 = document.getElementById('update_button_2');\n update_2.onclick = async function() {\n const email = document.getElementById('upemail').value;\n const password = document.getElementById('uppass').value;\n const name = document.getElementById('upname').value;\n\n if (!email && !password && !name){\n window.alert('At least one parameter must be given!');\n return false;\n }\n const user = {\n \"email\": email,\n \"name\": name,\n \"password\" : password\n };\n const headers = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n 'Authorization' : 'Token ' + checkStore('token')\n };\n const method = 'PUT'; \n const path = 'user';\n\n await api.makeAPIRequest(path, {\n method, headers,\n body: JSON.stringify(user),\n })\n .then(function (){\n location.reload(); \n });\n }\n}", "static async update(req, res) {\n const info = await UserModel.findByIdAndUpdate(req.params.id, req.body);\n return res.send(info);\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 }", "updateInfo(data) {\n\t\treturn db.one(`UPDATE user_information \n\t\t\tSET \n\t\t\tuser_fish_weight = $[user_fish_weight],\n\t\t\tuser_fish_loc_id = $[user_fish_loc_id],\n\t\t\tuser_fish_info = $[user_fish_info]\n\t\t\tWHERE id = $[id]\n\t\t\tRETURNING *`, data)\n\t}", "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 updateUserPot(change) {\n userPot += change;\n}", "async update({ params, request, response }) {\n }", "function update() {\n calculateMonthlyPayment(values);\n updateMonthly(monthlyPayment);\n }", "update(data) {\n this.data = data || this.data;\n this._updateID++;\n }", "async function updateUser(){\n const user = await User\n .updateOne({id:req.params.id},{$set: req.body });\n if(user.nModified > 0 ) \n res.send(req.body);\n else\n res.status(404).send(`HTTP 404 -- Not Found`);\n \n }", "isUpdatePermitted() {\n return this.checkAdminPermission('update')\n }", "function updateDashUser(updateObj, done) {\n // done signature: ()\n var httpRequest = new XMLHttpRequest();\n if (!httpRequest) {\n alert('Giving up :( Cannot create an XMLHTTP instance');\n done();\n return false;\n }\n\n httpRequest.onreadystatechange = updateDashUserHandler;\n httpRequest.open('PUT', window.CST_OVERRIDES.appLocation + 'api/v0/dashuser/' + window.CST_OVERRIDES.facultyUser.id, true);\n httpRequest.setRequestHeader(\"Content-type\", \"application/json\");\n httpRequest.send(JSON.stringify(updateObj));\n\n function updateDashUserHandler() {\n if (httpRequest.readyState === XMLHttpRequest.DONE) {\n if (httpRequest.status === 200) {\n \n // Store response to global data\n const userData = JSON.parse(httpRequest.responseText);\n window.CST_OVERRIDES.dashUser = userData || { hiddenObs: [] };\n } else {\n // alert('There was a problem with the request getISupeSubmissionsByStudent.\\nRequest status:' + httpRequest.status);\n logErrorInPage('There was a problem with the request getISupeSubmissionsByStudent.\\nRequest status:' + httpRequest.status);\n }\n done();\n } // end request ready\n } // end request handler\n}", "function updateTUser(name, id) {\n return promessQuery('UPDATE user SET user_name= \"' + name + '\" WHERE user_id= ' + id,\n callBackSucesso, callBackErro);\n }", "update(now) {\n throw new Error('You have to implement the \"update\" method!');\n }", "async function safeUpdateUser(payload){\n\tawait this.findUser({_id:payload._uid}, async user=>{\n\t\tif(payload._cid == user._cid) {\n\t\t\t// then it is safe to update\n\t\t\tupdateUser(payload).then(()=>{\n\t\t\t\tconsole.log(\"UPDATED...\")\n\t\t\t})\n\t\t\t.catch(()=>{\n\t\t\t\tconsole.error(\"WRONG CALLSIGN, need to change\")\n\t\t\t})\n\t\t}\n\t\tconsole.log(\"User needs to edit their callsign...\")\n\t}) \n}", "async update({ params, request, response }) {}", "update() { }", "update() { }", "function testUpdate(){\n UserModel.findByIdAndUpdate({_id:'5c016964c01b2f04cc7e514d'}, {name: 'John'}, {new: true},function(err, user){\n console.log('findByIdAndUpdate', err, user)\n })\n}", "async update ({ params, request, response }) {\n }" ]
[ "0.7524758", "0.7524758", "0.7524758", "0.720637", "0.71719295", "0.70566857", "0.7047294", "0.6904037", "0.680546", "0.680546", "0.680546", "0.680546", "0.680546", "0.680546", "0.680546", "0.680546", "0.680546", "0.6728186", "0.67163545", "0.6683039", "0.6668849", "0.6655824", "0.6638982", "0.6624164", "0.6592354", "0.6550545", "0.65378714", "0.65348595", "0.6525369", "0.649543", "0.6487504", "0.6483539", "0.64727145", "0.6451401", "0.6449814", "0.64256597", "0.6392042", "0.63857305", "0.6380037", "0.6380037", "0.6370158", "0.6345878", "0.633902", "0.6338715", "0.6338281", "0.6331814", "0.63133067", "0.62968826", "0.62960017", "0.6273342", "0.6271046", "0.62650037", "0.62318575", "0.6230811", "0.62083024", "0.620509", "0.62000036", "0.6196415", "0.61957484", "0.6191078", "0.61894", "0.61831194", "0.6171964", "0.616953", "0.61669916", "0.615954", "0.61406153", "0.6135822", "0.6130047", "0.6125076", "0.61194634", "0.61181325", "0.61143965", "0.61060333", "0.61029804", "0.609891", "0.6097543", "0.6093411", "0.6089896", "0.60866535", "0.60763144", "0.6075981", "0.60655934", "0.6062964", "0.60620767", "0.60584694", "0.60541785", "0.60469", "0.6033638", "0.60332793", "0.6031366", "0.60297656", "0.60264134", "0.60244644", "0.6023588", "0.602132", "0.6016221", "0.60147494", "0.60147494", "0.60096586", "0.6003115" ]
0.0
-1
import Left from "./Left";
function Right(props) { const [ProjectDetails, setProjectDetails] = useState({}); useEffect(()=>{ axios.get(process.env.REACT_APP_API_BASE_URL + "/project/details/" + props.project._id) .then(res =>{ setProjectDetails(res.data.result[0]); console.log("status: ", res.data.result[0].status); }) },[]); return ( <div className="dashboard-content-container dashboard-content-container-new" data-simplebar > <div className="dashboard-content-inner" style={{ backgroundColor: "#f1f7f9" }}> <div className="dashboard-inner"> <Container> <ErrorNotifications /> <Row> {(()=>{ if(ProjectDetails.status == "Assigned"){ console.log("status: ", ProjectDetails) return( <Col lg={6} xs={12} className="shadow-sm p-3 mb-5 bg-white rounded"> <div className=" fun-fact-new" data-fun-fact-color="#36bd78"> <Row > <Col lg={2} xs={6} > <span> <i className="icon-feather-user" style={{ fontSize: "64px", color: "#daeced" }} /></span> </Col> <Col lg={10}> <div className="fun-fact-text"> <span style={{ color: "#2e3a59" }}> Meet {ProjectDetails.expert_details.name}, your Account Director for the project </span> </div> </Col> </Row> <Row> <Col> <p style={{ color: "grey", fontSize: "16px" }}> The Air Teams Account director will assist you throught the project and ensure that you will quality work delivered on time. </p> </Col> </Row> </div> </Col> ) } else{ return( <Col lg={6} xs={12} className="shadow-sm p-3 mb-5 bg-white rounded"> <div className=" fun-fact-new" data-fun-fact-color="#36bd78"> <Row> <Col lg={2} xs={6}> <span> <i className="icon-feather-user" style={{ fontSize: "64px", color: "#daeced" }} /></span> </Col> <Col lg={10}> <div className="fun-fact-text"> <span style={{ color: "#2e3a59" }}> We are assigning an Account Director to you right away. </span> </div> </Col> </Row> <Row> <Col> <p style={{ color: "grey", fontSize: "16px" }}> He/she will be the point of contact between you and the creative team and will be responsible for delivering quality work on time </p> </Col> </Row> </div> </Col> ) } })()} <Col lg={6} xs={12} className="shadow-sm p-3 mb-5 bg-white rounded"> <div className=" fun-fact-new" data-fun-fact-color="#b81b7f" > <div className="fun-fact-text fun-fact-new1"> <span style={{ color: "#2e3a59" }}>You have successfully completed your project brief. You will receive suitable proposals shortly. </span> </div> <div className="fun-fact-progress"> <ProgressBar id="file" now={100} /> <span>100% Completed</span> </div> <div className="fun-fact-button"> <Button class="btn" style={{ backgroundColor: "#5dbbc7", color: "white", fontSize: "13px", border: "none" }}> Proceed </Button> </div> </div> </Col> </Row> </Container> </div> <div className="dashboard-inner"> <Container style={{ paddingTop: "10%" }}> <Row className="justify-content-center"> <Col lg={1} xs={5}> <i className="icon-feather-clock" style={{ fontSize: "76px", color: "#daeced", verticalAlign: "middle" }} /> </Col> </Row> <Row className="justify-content-center"> <Col lg={5} xs={12} > <span ><p style={{ color: "#2e3a59", fontWeight: "bold", textAlign: "center", fontSize: "20px" }}> Your proposal/s will appear here</p></span> </Col> </Row> <Row className="justify-content-center"> <Col lg={5} xs={12}> <span><p style={{ fontWeight: "500", color: "#2dbdc9", fontSize: "18px", textAlign: "center" }}> It usually takes around 48 hours</p></span> </Col> </Row> </Container> </div> <div className="dashboard-inner"> <Container style={{ paddingTop: "10%" }}> <Row> <Col lg={4} xs={10}> <div className="card bg-dark text-white"> <img className="card-img" src="/images/home_image_8.png" alt="Card Image" style={{ borderRadius: "4px", opacity: "0.66" }} /> <div className="card-img-overlay"> <h5 className="card-title" style={{ position: "absolute", bottom: "0", fontSize: "22px", fontWeight: "bold", letterSpacing: "0.5px", color: "white", paddingBottom:"5%" }}> How a web design project typically works ? </h5> <p className="card-text" style={{ position: "absolute", bottom: "0", fontSize: "12px", fontWeight: "normal", letterSpacing: "1.36px", color: "white" }}> UI/UX DESIGN | 2 MINS </p> </div> </div> </Col> <Col lg={4} xs={10}> <div className="card bg-dark text-white"> <img className="card-img" src="/images/home_image_8.png" alt="Card Image" style={{ borderRadius: "4px", opacity: "0.66" }} /> <div className="card-img-overlay"> <h5 className="card-title" style={{ position: "absolute", bottom: "0", fontSize: "22px", fontWeight: "bold", letterSpacing: "0.5px", color: "white", paddingBottom:"5%" }}> How a web design project typically works ? </h5> <p className="card-text" style={{ position: "absolute", bottom: "0", fontSize: "12px", fontWeight: "normal", letterSpacing: "1.36px", color: "white" }}> UI/UX DESIGN | 2 MINS </p> </div> </div> </Col> <Col lg={4} xs={10}> <div className="card bg-dark text-white"> <img className="card-img" src="/images/home_image_8.png" alt="Card Image" style={{ borderRadius: "4px", opacity: "0.66" }} /> <div className="card-img-overlay"> <h5 className="card-title" style={{ position: "absolute", bottom: "0", fontSize: "22px", fontWeight: "bold", letterSpacing: "0.5px", color: "white", paddingBottom:"5%" }}> How a web design project typically works ? </h5> <p className="card-text" style={{ position: "absolute", bottom: "0", fontSize: "12px", fontWeight: "normal", letterSpacing: "1.36px", color: "white" }}> UI/UX DESIGN | 2 MINS </p> </div> </div> </Col> </Row> </Container> </div> </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Left(status) {\n \"use strict\";\n Leaf.call(this);\n this.state = status;\n}", "static get DIRECTION_LEFT() {\n return \"left\";\n }", "setLeft(newLeft) {\n this.#leftChild = newLeft;\n }", "function turnLeft() {\n baddie.classList.add(\"baddie-left\");\n }", "function App() {\n return (\n <div className=\"lucas-app\">\n <Board />\n <Menu />\n </div>\n );\n}", "function LeftMenu(props) {\n return (\n <Menu mode={props.mode} style={{ padding: \"0 20px\",\n backgroundColor:\" rgba( 255, 255, 0.0, 0.0 )\"}}>\n <Menu.Item key=\"introduce\">\n <a\n href=\"https://github.com/solone313/nomadbook\"\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n 소개\n </a>\n </Menu.Item>\n <Menu.Item key=\"subscription\">\n <a href=\"/subscription\">내 구독</a>\n </Menu.Item>\n </Menu>\n );\n}", "getLeft(){return this.__left}", "left(deg) {\n this.right(-1 * toInt(deg));\n }", "function App() {\n return (\n \n\n <Menu></Menu>\n );\n}", "function showLeft() {\n\n document.querySelector('.frame').classList.remove('right');\n document.querySelector('.frame').classList.add('left');\n }", "function Side() { }", "function moveLeft() {\n\n\t\ttry {\n\t\t // Pass in the movement to the game.\n\t\t animation.move(\"x\", moveTypes.left);\n\t\t}\n\t\tcatch (err) {\n\t\t\tconsole.log(err);\n\t\t}\n\t}", "get isParentLeftChild() {\n return this.parentSide === LEFT;\n }", "handleLeftEarClick() {\n this.setState({isLeft : !this.state.isLeft});\n }", "function toLeft(){\n}", "left() {\n if (!this.isOnTabletop()) return;\n if (!this.facing) return;\n let degree=FacingOptions.facingToDegree(this.facing);\n degree-=90;\n this.facing=FacingOptions.degreeToFacing(degree);\n }", "getLeftChild() {\n return this.#leftChild;\n }", "function leftClicked() {\n console.log(\"You left clicked\");\n}", "function Admin() {\n\n return (\n <Container>\n {/* <Header /> */}\n <Content>\n <SideNav />\n <Dashboard>\n\n </Dashboard>\n </Content>\n </Container>\n );\n}", "get AppView() {\n return {\n title: 'Expenso',\n component: require('../Containers/App').default,\n leftButton: 'HAMBURGER',\n };\n }", "goLeft() {\n gpio.write(this.motors.rightFront, true);\n }", "left() {\n switch (this.f) {\n case NORTH:\n this.f = WEST;\n break;\n case SOUTH:\n this.f = EAST;\n break;\n case EAST:\n this.f = NORTH;\n break;\n case WEST:\n default:\n this.f = SOUTH;\n }\n }", "get left(): number {\n return this.position.x\n }", "setLeft(_left) {\n this.left = _left;\n this.updateSecondaryValues();\n return this;\n }", "function isLeft(either) {\n return either.isLeft;\n }", "function AdminHeader() {\n\n return (\n <>\n <header className=\"App-Admin-header\">\n <h1 className=\"App-Admin-title\">DNH Orders</h1>\n\n </header>\n\n \n </>\n );\n}", "function moveLeft() {\n moveOn();\n }", "function App() {\n return (\n \n <div className=\"app\">\n <Head/>\n <div className=\"map__text\">\n <Sidebar />\n <div className =\"map__left\">\n {/* <Design/> */}\n \n \n <File/>\n </div>\n \n </div>\n \n \n \n\n </div>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n <header className=\"main_menu home_menu\">\n <Menu />\n <Team />\n </header>\n </div>\n );\n}", "function setMenuLeft() {\n removeMenuChanges();\n $('.menu').addClass('menu-left');\n }", "function App() {\n return (\n <div>\n <Nav/>\n <Landing/>\n </div>\n )\n}", "function leftNav() {\n\tapp.getView().render('content/folder/customerserviceaboutusleftnav');\n}", "function App() {\n return (\n <Login ></Login>\n\n );\n}", "_moveRelatedLeftHandler() {\n this._moveLeft();\n }", "get left() { return 0; }", "goLeft(data = {}){\n data.cameFrom = \"left\";\n this.launchSceneAt(\n this.activeScene.coordinate.x - 1, \n this.activeScene.coordinate.y,\n data\n );\n }", "function Home() {\n return (\n <React.Fragment>\n <SlideTop />\n <SlideMid />\n <SlideBot/>\n \n {/* <Ofert/> */}\n \n </React.Fragment>\n \n );\n}", "render(){\n return (\n <Header style={styles.header}>\n <Left>\n <Button style={styles.menu}\n onPress={this.onMenuClick}>\n <Icon name={'menu'}/>\n </Button>\n </Left>\n <Body><Title style={styles.headerTexto}>HORT-UP</Title></Body>\n </Header>\n )\n }", "goToTheLeft() {\n this.lightBoxLeftButton.addEventListener('click', () => {\n this.switchLeft();\n });\n }", "left() {\r\n this.v = -2;\r\n }", "function LeftMenu(props) {\n return (\n <Menu mode={props.mode}>\n <Menu.Item key=\"home\">\n <a href=\"/\">모아보기</a>\n </Menu.Item>\n <SubMenu key=\"category\" title=\"SNS 카테고리\">\n <Menu.Item key=\"blog\">\n <a href=\"/blog\">\n <BoldOutlined />\n 네이버 블로그\n </a>\n </Menu.Item>\n <Menu.Item key=\"instagram\">\n <a href=\"/instagram\">\n <InstagramOutlined />\n 인스타그램\n </a>\n </Menu.Item>\n <Menu.Item key=\"facebook\">\n <a href=\"/facebook\">\n <FacebookOutlined />\n 페이스북\n </a>\n </Menu.Item>\n <Menu.Item key=\"youtube\">\n <a href=\"/youtube\">\n <YoutubeOutlined />\n 유튜브\n </a>\n </Menu.Item>\n <Menu.Item key=\"clubhouse\">\n <a href=\"/clubhouse\">\n <BankOutlined />\n 클럽하우스\n </a>\n </Menu.Item>\n </SubMenu>\n <Menu.Item key=\"upload\">\n <a href=\"/article/upload\">게시물 등록</a>\n </Menu.Item>\n <Menu.Item key=\"manage\">\n <a href=\"/article/manage\">게시물 관리</a>\n </Menu.Item>\n <Menu.Item key=\"charge\">\n <a href=\"/charge\">충전하기</a>\n </Menu.Item>\n <Menu.Item key=\"setting\">\n <a href=\"/setting\">공지사항</a>\n </Menu.Item>\n </Menu>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n <Directions></Directions>\n </div>\n );\n}", "moveLeft() {\r\n this.actual.moveLeft();\r\n }", "moveLeft() { this.velX -= 0.55; this.dirX = -1; }", "left() {\n // If the LEFT key is down, set the player velocity to move left\n this.sprite.body.velocity.x = -this.RUN_SPEED;\n //this.animate_walk();\n }", "function App() {\n return (React.createElement(\"div\", null,\n React.createElement(components_1.Nav, null),\n React.createElement(components_1.Switcher, null)));\n}", "function App() {\n return (\n <div className=\"App\">\n <Header/>\n {/* <Menu/> */}\n {routers}\n </div>\n );\n}", "render() {\n return <Welcome />\n }", "function moveLeft() {\n\n if (document.querySelector('.frame').classList.contains('right')) showMiddle();\n else showLeft();\n }", "function App() {\n return (\n <Wrapper>\n <Title>Employee Directory</Title>\n\n </Wrapper>\n );\n}", "function Header() {\n return (\n <div>\n <h1 className=\"title\">Meet the Members of Mystery Inc.</h1>\n </div>\n );\n}", "function Left$prototype$ap(other) {\n return other.isLeft ? other : this;\n }", "function App() {\n return (\n <NavRouter></NavRouter>\n );\n}", "showLeftDrawer() {\n return this;\n }", "function HelloReact() {\n return (\n <div className=\"container\">\n Hello React!\n {/*Another imported component*/}\n <Counter/>\n </div>\n )\n}", "function Sideleftbar()\n{\n \n\nlet history=useHistory();\n\nreturn( \n <div>\n <Button startIcon={<AddIcon fontSize=\"large\"/>} onClick= {()=>history.push(\"/Composenew\")}>\n Compose\n </Button> \n \n <SideLeftOption Icon={InboxIcon} title=\"Inbox\" number={54} /> \n <SideLeftOption Icon={AccessTimeIcon} title=\"Snoozed\" number={54} /> \n <SideLeftOption Icon={NearMeIcon} title=\"Important\" number={54} /> \n <SideLeftOption Icon={NoteIcon} title=\"Sent\" number={54} /> \n <SideLeftOption Icon={ExpandMoreIcon} title=\"More\" number={54} /> \n </div> \n);\n}", "function App() {\n\n\n return (\n\n <Login>\n\n </Login>\n\n\n );\n}", "getLeft() {\r\n return this._getNodeFromCompilerNode(this.compilerNode.left);\r\n }", "import() {\n }", "function App(){\n return(\n<div>\n <GlobalSidebar/>\n</div>\n\n // <s.App>\n // <Sidebar/>\n // <MainView/>\n // </s.App>\n \n )\n}", "function App() {\n\n return (\n <div className=\"App\">\n <Navigation></Navigation>\n <Banner></Banner>\n <Course></Course>\n \n \n </div>\n );\n}", "function App() {\n return (\n <div>\n <Welcome name=\"Sean\" />\n <Clock />\n </div>\n );\n}", "createLeftChild (options) {\n const leftChild = this.createSimilar(options)\n leftChild.parent = this\n this.left = leftChild\n\n return leftChild\n }", "function App() {\n return (\n\n <div >\n\n <Header></Header>\n <AuctionPlayers></AuctionPlayers>\n\n </div>\n );\n}", "turnLeft() {\n if (DIRECTIONS.indexOf(this.position.heading) === 0) {\n this.position.heading = DIRECTIONS[3];\n } else {\n this.position.heading =\n DIRECTIONS[DIRECTIONS.indexOf(this.position.heading) - 1];\n }\n }", "leftState(){\n this.state = \"left\";\n this.animationTime = 40;\n this.currentFrameNum = 0;\n this.currentFrameY = 553;\n this.currentFrameX = 0;\n this.frameHeight = 114;\n this.frameWidth = 94;\n this.maxFrame = 9;\n }", "title_left()\n\t{\n\t\treturn \"left_title\";\n\t}", "function App() {\n return (\n <div className=\"App\">\n <div className=\"Title\"><h1>Awesome Minesweeper</h1></div>\n <Game />\n </div>\n );\n}", "render(){\n return(\n <div className=\"header\">\n <MenuBtns/>\n </div>\n )\n }", "function SideNav() {\n return (\n <Sider width={200} style={{ background: '#fff' }}>\n <Menu\n mode=\"inline\"\n defaultSelectedKeys={['1']}\n defaultOpenKeys={['sub1']}\n style={{ height: '100%' }}\n >\n <SubMenu\n key=\"sub1\"\n title={\n <span>\n <Icon type=\"user\" />\n Administrator\n </span>\n }\n >\n\n <Menu.Item key=\"1\">\n <Link to=\"/\">\n Inform Page\n </Link>\n </Menu.Item>\n <Menu.Item key=\"1\">\n <Link to=\"/admin\">\n Edit Admin\n </Link>\n </Menu.Item>\n <Menu.Item key=\"1\">\n <Link to=\"/info\">\n Edit Info\n </Link>\n </Menu.Item>\n\n </SubMenu>\n\n </Menu>\n </Sider>\n )\n}", "function Header(){\n return(\n <header className = \"Header\" > \"To do\" List </header> \n )\n}", "function Main(){\n return(\n <>\n <NavTab />\n <Sidenav />\n <Container > \n <AllPosts />\n <Post />\n </Container>\n </>\n )\n}", "function App() {\n return (\n //JSX=>needs to import React\n <div >\n Hello Worldfff\n </div>\n );\n}", "render() {\n\n\nreturn (\n <HeaderValuesWrapper onMouseMove={(e) => this.handleMouseMove(e)}>\n <Left >\n\n <h1>\n Your Financial Plan Assumptions\n </h1>\n </Left>\n\n </HeaderValuesWrapper>\n )\n }", "function Home() {\n return (\n <div>\n <Header />\n <Employee />\n </div>\n )\n}", "function addTurnLeft(){\n\taddAction(turn(90), \"Left\");\n}", "moveLeft() {\r\n this.socket.emit('Move left', this.number);\r\n this.moveLeftNext();\r\n }", "function Header() {\n\n return (\n <div>\n <div className=\"header\">\n <h1>Keeper</h1>\n </div>\n </div>\n )\n}", "function App() {\n //return <Game></Game>;\n return <Game></Game>;\n}", "constructor() {\n super('ENUM');\n }", "function Home() {\n \n return (\n <div>\n <h1>Home</h1>\n </div>\n );\n}", "render() {\n return (\n <div className=\"App\">\n <Game />\n </div>\n );\n }", "function Home() {\n return <Decks />;\n}", "moveLeft() {\n if (!this.collides(-1, 0, this.shape)) this.pos.x--\n }", "function App() {\n return (\n <div className=\"App\">\n <Header />\n <Content />\n </div>\n )\n}", "getLeftUnit(){return this.__leftUnit}", "function Home() {\n return (\n <div className=\"App\">\n <ul>\n <li>\n <Link to=\"/\">Home</Link>\n </li>\n <li>\n <Link to=\"/play\">Play</Link>\n </li>\n </ul>\n <header className=\"App-header\">\n <div style={{ width: '80%' }}>\n <TopBarGame userDetails={['Reeve', 'Civilian']} showTimer showRole />\n <GameEnv />\n <BottomBar />\n </div>\n </header>\n </div>\n );\n}", "function App() {\n return (\n <div className=\"container\">\n <h1>TIC-TAC-TOE</h1>\n <Game />\n </div>\n );\n}", "render() {\n\n return (\n <div className=\"App\">\n <h1>Matching Game</h1>\n <Board />\n </div>\n );\n\n }", "function App() {\n return (\n <div>\n <Sidebar/>\n <Slider/>\n <MediaCard/>\n {/* <Detail/> */}\n </div>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n <div className=\"header\">Tic Tac Minecraft</div> \n <div className=\"\">\n <TicTacToe />\n </div> \n </div>\n );\n}", "function Module() {\r\n}", "function App() {\n return (\n <div className=\"App\">\n <EightBall />\n </div>\n );\n}", "function rotateHeadLeft() {\n return pulseMotor(motorHead);\n}", "handleLeftAceClick(tab) {\n this.setState({\n leftAceActive: tab\n })\n }", "function Header(){\n return(\n <div className=\"list-books-title\">\n <h1>MyReads</h1>\n </div>\n );\n}", "render () {\n return (\n <div className=\"App\">\n <Header passed={this.state}/>\n <Body passed={this.state}/>\n <Start passed={this.state}/>\n </div>\n )\n }", "function App() {\n return (\n <div className=\"App\">\n \n <Moviecard></Moviecard>\n <Movielist></Movielist>\n \n </div>\n );\n}", "function Home(props) {\n return <h1>Home</h1>;\n}", "function leftOf (path) {\n return path.get('left')\n}", "turnLeft() {\n this.direction++;\n this.direction = this.direction.mod(4);\n }" ]
[ "0.5545154", "0.54690534", "0.5414841", "0.52136713", "0.5169579", "0.5163637", "0.514209", "0.5133449", "0.51323706", "0.50934166", "0.50323105", "0.503132", "0.5023523", "0.50225675", "0.5018412", "0.49874297", "0.49785885", "0.4963394", "0.49598336", "0.4931433", "0.4911931", "0.48732772", "0.48708645", "0.4865464", "0.48591027", "0.48515737", "0.48468214", "0.48355517", "0.48339558", "0.4831079", "0.4830096", "0.48270524", "0.48018348", "0.47962475", "0.4785621", "0.4781053", "0.4776943", "0.47641", "0.4757255", "0.47562954", "0.47558346", "0.47376767", "0.4726641", "0.47143456", "0.4708223", "0.47053117", "0.46993858", "0.4694991", "0.46878064", "0.46655697", "0.46628362", "0.4659101", "0.4654814", "0.46379456", "0.46310237", "0.46240696", "0.4621557", "0.46130455", "0.4610971", "0.46023893", "0.46002403", "0.45982334", "0.45976734", "0.45946315", "0.4588448", "0.45879197", "0.45817143", "0.45787147", "0.45777062", "0.45744008", "0.45738465", "0.45737776", "0.45724407", "0.4572083", "0.45710036", "0.45700613", "0.45700333", "0.45680997", "0.45668244", "0.45604953", "0.45589012", "0.45541197", "0.45517206", "0.45510226", "0.45433766", "0.4538165", "0.4537257", "0.4533764", "0.45325047", "0.45301536", "0.4526565", "0.45131144", "0.45097482", "0.45015255", "0.45014802", "0.450051", "0.44992897", "0.44963485", "0.44934297", "0.4492806", "0.44910535" ]
0.0
-1
Copyright 2014 Software Freedom Conservancy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
function Oa(a,b){this.code=a;this.a=Pa[a]||"unknown error";this.message=b||"";a=this.a.replace(/((?:^|\s+)[a-z])/g,function(a){return a.toUpperCase().replace(/^[\s\xa0]+/g,"")});b=a.length-5;if(0>b||a.indexOf("Error",b)!=b)a+="Error";this.name=a;a=Error(this.message);a.name=this.name;this.stack=a.stack||""}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "obtain(){}", "function exposeTestFunctionNames()\n{\nreturn ['XPathResult_resultType'];\n}", "function e(t,e,r,o){var i,s=arguments.length,a=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(a=(s<3?i(a):s>3?i(e,r,a):i(e,r))||a);return s>3&&a&&Object.defineProperty(e,r,a),a\n/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */}", "function t(e,t,a,s){var i,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,a):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)r=Reflect.decorate(e,t,a,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(n<3?i(r):n>3?i(t,a,r):i(t,a))||r);return n>3&&r&&Object.defineProperty(t,a,r),r\n/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */}", "static get HEADERS() {\n return 1;\n }", "expected(_utils) {\n return 'nothing';\n }", "function me(e,t,a,s){var n,i=arguments.length,r=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,a):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)r=Reflect.decorate(e,t,a,s);else for(var d=e.length-1;d>=0;d--)(n=e[d])&&(r=(i<3?n(r):i>3?n(t,a,r):n(t,a))||r);return i>3&&r&&Object.defineProperty(t,a,r),r\n/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */}", "static transient final private internal function m43() {}", "resolution() { }", "function DWRUtil() { }", "get() {}", "function version(){ return \"0.13.0\" }", "get Specular() {}", "private internal function m248() {}", "static transient final protected public internal function m46() {}", "expected( _utils ) {\n\t\t\treturn 'nothing';\n\t\t}", "static final private internal function m106() {}", "function Qs(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}", "static transient private protected internal function m55() {}", "get resolution() {}", "function zXPath() {\n\n}", "function factory() {}", "function factory() {}", "function TrueSpecification() {}", "static transient final protected internal function m47() {}", "function require() { return {}; }", "static fromRQ(q) {\nreturn this.fromQV(q.xyzw);\n}", "function E(){return e(\"meta\").filter(function(){var t=e(this).attr(\"http-equiv\");return t&&\"X-PJAX-VERSION\"===t.toUpperCase()}).attr(\"content\")}", "function getVersion() {\n return 1.0;\n}", "static transient private public function m56() {}", "constructor( ) {}", "function domconfigparameternames01() {\n var success;\n if(checkInitialization(builder, \"domconfigparameternames01\") != null) return;\n var domImpl;\n var doc;\n var config;\n var state;\n var parameterNames;\n var parameterName;\n var matchCount = 0;\n var paramValue;\n var canSet;\n\n var docRef = null;\n if (typeof(this.doc) != 'undefined') {\n docRef = this.doc;\n }\n doc = load(docRef, \"doc\", \"barfoo\");\n config = doc.domConfig;\n\n assertNotNull(\"configNotNull\",config);\nparameterNames = config.parameterNames;\n\n assertNotNull(\"parameterNamesNotNull\",parameterNames);\nfor(var indexN1008C = 0;indexN1008C < parameterNames.length; indexN1008C++) {\n parameterName = parameterNames.item(indexN1008C);\n paramValue = config.getParameter(parameterName);\n canSet = config.canSetParameter(parameterName,paramValue);\n assertTrue(\"canSetToDefaultValue\",canSet);\nconfig.setParameter(parameterName, paramValue);\n\n if(\n\n ((\"canonical-form\".toUpperCase() == parameterName.toUpperCase()) || (\"cdata-sections\".toUpperCase() == parameterName.toUpperCase()) || (\"check-character-normalization\".toUpperCase() == parameterName.toUpperCase()) || (\"comments\".toUpperCase() == parameterName.toUpperCase()) || (\"datatype-normalization\".toUpperCase() == parameterName.toUpperCase()) || (\"entities\".toUpperCase() == parameterName.toUpperCase()) || (\"error-handler\".toUpperCase() == parameterName.toUpperCase()) || (\"infoset\".toUpperCase() == parameterName.toUpperCase()) || (\"namespaces\".toUpperCase() == parameterName.toUpperCase()) || (\"namespace-declarations\".toUpperCase() == parameterName.toUpperCase()) || (\"normalize-characters\".toUpperCase() == parameterName.toUpperCase()) || (\"split-cdata-sections\".toUpperCase() == parameterName.toUpperCase()) || (\"validate\".toUpperCase() == parameterName.toUpperCase()) || (\"validate-if-schema\".toUpperCase() == parameterName.toUpperCase()) || (\"well-formed\".toUpperCase() == parameterName.toUpperCase()) || (\"element-content-whitespace\".toUpperCase() == parameterName.toUpperCase()))\n\n ) {\n matchCount += 1;\n\n }\n\n }\n assertEquals(\"definedParameterCount\",16,matchCount);\n\n}", "function test_candu_graphs_datastore_vsphere6() {}", "produce() {}", "static get BODY() {\n return 2;\n }", "function test_getRequestCount() {\n assert.isNumber(hfapi.getRequestCount(), 'Total request count should be a number.');\n}", "static ready() { }", "function required() { }", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "static transient private internal function m58() {}", "function $3ge(){\n var blank$=new $3ge.$$;XMLHttpRequestResponseType(\"\",blank$);\n return blank$;\n}", "getMeta () {\n }", "function WebIdUtils () {\n}", "headers() {\n throw new Error('Not implemented');\n }", "prepare() {}", "static transient private protected public internal function m54() {}", "function extractSimpleReqCalls(str){\r\n\r\n\tvar deps = {}, re = /require\\s*\\(\\s*('([^']+)'|\"([^\"]+)\")/g, len = 0, match;\r\n\r\n\twhile((match = re.exec(str))){\r\n\t\tif(match[2]){\r\n\t\t\t++len;\r\n\t\t\tdeps[match[2]] = match[2];\r\n\t\t}\r\n\t\tif(match[3]){\r\n\t\t\t++len;\r\n\t\t\tdeps[match[3]] = match[3];\r\n\t\t}\r\n\t}\r\n\r\n\treturn len > 0? deps: void(0);\r\n}", "constructor() {\n\t}", "constructor() {\n\t}", "function AeUtil() {}", "function UriTestSuite() {\n\n this.name = \"Uri\";\n this.tag = \"utils\";\n\n // convenience names\n var LOCALHOST = SDUri_FILE_HOSTNAME,\n PAGE_HOSTNAME = SDUri_PAGE_HOSTNAME;\n\n // this function was tested manually\n function randomlyCapitalize(str) {\n return str.replace(/\\w/g, function (letter) {\n return Math.random() < 0.5 ? letter.toUpperCase() : letter.toLowerCase();\n });\n }\n\n function verifyHostname(url, expHostname) {\n var hostname = SDUri_getHostname(url);\n expectTypeof(hostname, \"string\");\n expectEqual(hostname, expHostname || PAGE_HOSTNAME);\n };\n\n this.hostname = function () {\n\n function verify(url, expHostname) {\n verifyHostname(url, expHostname);\n };\n\n // Testing hostname edge cases...\n verify(\"\"); // assuming an empty URL is legal\n verify(\".\");\n verify(\"./\");\n verify(\"..\");\n verify(\"../\");\n verify(\"/\");\n verify(\"/.\");\n verify(\"/..\");\n verify(\"/../.\");\n\n // Testing hostname for relative URLs...\n verify(\"foo.jpg\");\n verify(\"../foo.jpg\");\n verify(\"images/foo.jpg\");\n verify(\"../images/foo.jpg\");\n verify(\"images/foo/../bar/\");\n verify(\"../../images/foo/bar/\");\n verify(\"/images/foo/bar.jpg\");\n verify(\"/images/foo/../bar/image.jpg\");\n verify(\"www.example.com/foo/bar/\"); // examples of incorrectly relative URLs\n verify(\"foo.bar.org/images/../../image.jpg\");\n\n // Testing hostname for absolute URLs...\n verify(\"http://example.com/\", \"example.com\");\n verify(\"http://example.com:80/\", \"example.com\"); // port numbers...\n verify(\"http://example.com:9999/\", \"example.com\"); // shouldn't matter!\n verify(\"http://sub.example.com/\", \"sub.example.com\");\n verify(\"http://foo.bar.baz.example.com/\", \"foo.bar.baz.example.com\");\n verify(\"http://example.com/foo/bar/baz/\", \"example.com\");\n verify(\"http://example.com/foo/bar/baz.jpg\", \"example.com\");\n verify(\"http://foo.bar.example.com/baz/image.jpg\", \"foo.bar.example.com\");\n verify(\"http://t2.tiles.virtualearth.net/tiles/h02123012?g=282\", \"t2.tiles.virtualearth.net\");\n verify(\"http://t0.tiles.virtualearth.net/tiles/r02123010?g=282&shading=hill\", \"t0.tiles.virtualearth.net\");\n\n // Testing hostname for file:// URLs...\n verify(\"file:///C:/\", LOCALHOST);\n verify(\"file:///C:/Windows/\", LOCALHOST);\n verify(\"file:///C:/Windows/System32/mshtml.dll\", LOCALHOST);\n verify(\"file:///Users/\", LOCALHOST);\n verify(\"file:///Users/me/\", LOCALHOST);\n verify(\"file:///Users/me/Sites/index.html\", LOCALHOST);\n\n // Testing hostname for https:// URLs...\n verify(\"https://sub.example.com/\", \"sub.example.com\");\n verify(\"https://foo.bar.baz.example.com/\", \"foo.bar.baz.example.com\");\n verify(\"https://example.com/foo/bar/baz/\", \"example.com\");\n verify(\"https://example.com/foo/bar/baz.jpg\", \"example.com\");\n }\n\n this.hostnameCaps = function () {\n\n function verify(url, expHostname) {\n // hostname should remain all lowercase\n verifyHostname(randomlyCapitalize(url), expHostname);\n };\n\n // Testing hostname random capitalizations...\n // all of these examples are taken from test cases above, but are now being\n // randomly capitalized, letter by letter...\n verify(\"http://foo.bar.example.com/baz/image.jpg\", \"foo.bar.example.com\");\n verify(\"https://t2.tiles.virtualearth.net/tiles/h02123012?g=282\", \"t2.tiles.virtualearth.net\");\n verify(\"images/foo/../bar/\");\n verify(\"/images/foo/../bar/image.jpg\");\n verify(\"www.example.com/foo/bar/\");\n verify(\"file:///C:/Windows/System32/mshtml.dll\", LOCALHOST);\n verify(\"file:///Users/me/Sites/index.html\", LOCALHOST);\n }\n}", "function getImplementation( cb ){\n\n }", "verify() {\n // TODO\n }", "policy() {}", "transient private protected internal function m182() {}", "function lt(t,i){return t(i={exports:{}},i.exports),i.exports}", "transient private internal function m185() {}", "constructor (){}", "function test_utilization_host() {}", "function hc(){}", "function BOT_grepRequestComponents() {\r\n\tvar x,rel;\r\n\t\r\n\tBOT_theReqPerformative\t= null;\r\n\tBOT_theReqTopic\t\t\t= null;\r\n\tBOT_theReqAttribute\t\t= null;\r\n\tBOT_theReqAction\t\t= null;\r\n\tBOT_theReqValue\t\t\t= null;\r\n\tBOT_theReqStresser\t\t= null;\r\n\tBOT_theReqText\t\t\t= null; \r\n\tBOT_theReqFeeling\t\t= null; \r\n\tBOT_theReqJudgement\t\t= null; \r\n\t\r\n\tx = BOT_greplemTagElement(\"PER\"); BOT_theReqPerformative = x;\r\n\tx = BOT_greplemTagElement(\"REF\"); if(x) BOT_theReqTopic = x;\r\n\t\r\n\tx = BOT_greplemTagElement(\"KEY\"); \r\n\tif(x) BOT_theReqAttribute = x; \r\n\telse { x = BOT_greplemTagElement(\"KYS\"); if(x) BOT_theReqAttribute = x } // list\r\n\tx = BOT_greplemTagElement(\"REL\"); if(x) BOT_theReqRelation = x;\r\n\tx = BOT_greplemTagElement(\"ACT\"); if(x) BOT_theReqAction = x; \r\n\tx = BOT_greplemTagElement(\"VAL\"); if(x) BOT_theReqValue = x; \r\n\tx = BOT_greplemTagElement(\"STR\"); if(x) BOT_theReqStresser = x; \r\n\tx = BOT_greplemTagElement(\"TXT\"); if(x) BOT_theReqText = x; \r\n\tx = BOT_greplemTagElement(\"EQU\"); if(x) BOT_theReqEqual = x; \r\n\tx = BOT_greplemTagElement(\"FEE\"); if(x) BOT_theReqFeeling = x; \r\n\tx = BOT_greplemTagElement(\"JUD\"); if(x) BOT_theReqJudgement = x; \r\n\r\n\tif(!BOT_theReqPerformative) BOT_theReqPerformative = BOT_theReqAction ? \"x\" : \"g\"; // always a performative\r\n\r\n\tif(BOT_theReqPerformative) \tBOT_traceString += \"REQ perf \" + BOT_theReqPerformative + \"\\n\";\r\n\tif(BOT_theReqTopic) \t\tBOT_traceString += \"REQ topic \" + BOT_theReqTopic + \"\\n\";\r\n\tif(BOT_theReqAttribute) \tBOT_traceString += \"REQ attr \" + BOT_theReqAttribute + \"\\n\";\r\n\tif(BOT_theReqRelation) \t\tBOT_traceString += \"REQ rel \" + BOT_theReqRelation + \"\\n\";\r\n\tif(BOT_theReqAction) \t\tBOT_traceString += \"REQ action \" + BOT_theReqAction + \"\\n\";\r\n\tif(BOT_theReqValue) \t\tBOT_traceString += \"REQ value \" + BOT_theReqValue + \"\\n\";\r\n\tif(BOT_theReqStresser)\t\tBOT_traceString += \"REQ stress \" + BOT_theReqStresser + \"\\n\";\r\n\tif(BOT_theReqText)\t\t\tBOT_traceString += \"REQ text \" + BOT_theReqText + \"\\n\"; \r\n\tif(BOT_theReqEqual)\t\t\tBOT_traceString += \"REQ Equal \" + BOT_theReqEqual + \"\\n\"; \r\n\tif(BOT_theReqFeeling)\t\tBOT_traceString += \"REQ Feeling \" + BOT_theReqFeeling + \"\\n\"; \r\n\tif(BOT_theReqJudgement)\t\tBOT_traceString += \"REQ Judge \" + BOT_theReqJudgement + \"\\n\"; \r\n\r\n\t// current topic management\r\n\tif(!BOT_theReqTopic) {\r\n\t\tif(BOT_theReqPerformative == \"f\") {\r\n\t\t\tBOT_theReqTopic = BOT_theUserTopicId; \r\n\t\t\tBOT_traceString += \"FEEL topic \" + BOT_theReqTopic + \"\\n\";\r\n\t\t\t}\r\n\t\telse if (BOT_theReqPerformative == \"w\") BOT_theReqTopic = BOT_theLastTopic; \r\n\t\telse {\r\n\t\t\tvar thebottopicid = (eval(BOT_theBotId)).topicId; // back to current bot \r\n\t\t\tBOT_theReqTopic = thebottopicid; // BOT_theLastTopic ? BOT_theLastTopic : BOT_theTopicId;\r\n\t\t\tBOT_traceString += \"LAST topic \" + BOT_theReqTopic + \"\\n\";\r\n\t\t\t// relation to another topic\r\n\t\t\tif(BOT_theReqRelation) {\r\n\t\t\t\trel = BOT_get(BOT_theReqTopic, BOT_theReqRelation,\"VAL\");\r\n\t\t\t\tif(BOT_member(BOT_topicIdList,rel)) {\r\n\t\t\t\t\tBOT_theReqTopic = rel;\r\n\t\t\t\t\tBOT_traceString += \"NEW topic \" + BOT_theReqTopic + \"\\n\";\r\n\t\t\t\t}\r\n\t\t\t }\r\n\t\t}\r\n\t}\r\n\telse BOT_theTopicId = BOT_theReqTopic; // updates current topic\r\n\r\n}", "get () {\n }", "function MockedProvider() {\n /* ... */\n}", "function b(){var a,b=\"axe\",c=\"\";return\"undefined\"!=typeof axe&&axe._audit&&!axe._audit.application&&(b=axe._audit.application),\"undefined\"!=typeof axe&&(c=axe.version),a=b+\".\"+c}", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "function HTTPUtil() {\n}", "constructor() {\n\n\t}", "sinceFunction() {}", "function Utils() {}", "function Utils() {}", "function __JUAssert(){;}", "get CompressedHQ() {}", "function Q(a,b,c,d){var f=arguments.length,g=3>f?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,k;if(\"object\"===typeof Reflect&&Reflect&&\"function\"===typeof Reflect.decorate)g=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(k=a[l])g=(3>f?k(g):3<f?k(b,c,g):k(b,c))||g;3<f&&g&&Object.defineProperty(b,c,g)}", "function Util() {}", "function createTestObject() {\n 'use strict';\n return { '@id': 'http://bogus.domain.com/bogus1',\n '@type': 'http:/bogus.domain.com/type#Bogus',\n 'http:bogus.domain.com/prop#name': 'heya' };\n}", "function Hs(t,e,n,r){var i,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,n,o):i(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o}", "patch() {\n }", "constructor() {\n\t\t// ...\n\t}", "function queryTest3() {\n XHR.GET(SERVER_URL+'/classes/Sleep?'+encodeURI('where={\"metadata.app_version\":{\"$gte\":1,\"$lte\":3}}'))\n}", "function mock() {\n\twindow.SegmentString = Rng.Range;\n}", "function RequestTypeContainer(){\n\n}", "function $3gt(){\n var readyStateHeadersReceived$=new $3gt.$$;ReadyState(2,readyStateHeadersReceived$);\n return readyStateHeadersReceived$;\n}", "get BC7() {}", "function h(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&\"function\"===typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}", "function _node_p(){\n\tvar ret = false;\n\tif( anchor.environment() == 'Node.js' ){ ret = true; }\n\treturn ret;\n }" ]
[ "0.5123363", "0.49786115", "0.49725816", "0.49663672", "0.49649248", "0.49086165", "0.48621666", "0.48253107", "0.47874627", "0.47865483", "0.47808337", "0.47562635", "0.47442076", "0.47185218", "0.47185078", "0.4670678", "0.4668266", "0.46637774", "0.46481487", "0.4647086", "0.46380416", "0.46301344", "0.46172446", "0.46172446", "0.461649", "0.45923722", "0.4580055", "0.45784432", "0.45775914", "0.45706815", "0.45678538", "0.45618686", "0.4558231", "0.45436808", "0.4535917", "0.45203823", "0.45178944", "0.4516379", "0.45160598", "0.44982582", "0.44982582", "0.44982582", "0.44982582", "0.44982582", "0.44982582", "0.4497863", "0.4489741", "0.4489665", "0.44887617", "0.44878006", "0.44856474", "0.44810775", "0.44728038", "0.44697753", "0.44697753", "0.44666892", "0.44618997", "0.44594595", "0.44462425", "0.44425264", "0.44392747", "0.44360977", "0.44254658", "0.44210947", "0.4419659", "0.44174844", "0.4412265", "0.4401685", "0.43996713", "0.4394907", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43904808", "0.43873805", "0.43860704", "0.4385782", "0.4383438", "0.4383438", "0.43824363", "0.43812156", "0.4376378", "0.4374442", "0.43704158", "0.4368837", "0.4362456", "0.43606293", "0.4357396", "0.435413", "0.43539047", "0.43485728", "0.4346308", "0.43451214", "0.43445358" ]
0.0
-1
The MIT License Copyright (c) 2007 Cybozu Labs, Inc. Copyright (c) 2012 Google Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
function D(a,b,c){this.a=a;this.b=b||1;this.f=c||1}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function me(e,t,a,s){var n,i=arguments.length,r=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,a):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)r=Reflect.decorate(e,t,a,s);else for(var d=e.length-1;d>=0;d--)(n=e[d])&&(r=(i<3?n(r):i>3?n(t,a,r):n(t,a))||r);return i>3&&r&&Object.defineProperty(t,a,r),r\n/**\n * @license\n * Copyright 2016 Google Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */}", "function t(e,t,a,s){var i,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,a):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)r=Reflect.decorate(e,t,a,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(n<3?i(r):n>3?i(t,a,r):i(t,a))||r);return n>3&&r&&Object.defineProperty(t,a,r),r\n/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */}", "function e(t,e,r,o){var i,s=arguments.length,a=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,o);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(a=(s<3?i(a):s>3?i(e,r,a):i(e,r))||a);return s>3&&a&&Object.defineProperty(e,r,a),a\n/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */}", "function zg(e,t){if(!e){const r=new Error(t||\"Assertion failed\");throw Error.captureStackTrace&&Error.captureStackTrace(r,zg),r}}", "function CCUtility() {}", "function Util() {}", "function fuzzTestingFunctionsCtor(browser, fGlobal, fObject)\n{\n var prefix = browser ? \"fuzzPriv.\" : \"\";\n\n function numberOfInstructions() { return Math.floor(Random.ludOneTo(10000)); }\n function numberOfAllocs() { return Math.floor(Random.ludOneTo(500)); }\n function gcSliceSize() { return Math.floor(Random.ludOneTo(0x100000000)); }\n function maybeCommaShrinking() { return rnd(5) ? \"\" : \", 'shrinking'\"; }\n\n function enableGCZeal()\n {\n var level = rnd(17);\n if (browser && level == 9) level = 0; // bug 815241\n var period = numberOfAllocs();\n return prefix + \"gczeal\" + \"(\" + level + \", \" + period + \");\";\n }\n\n function callSetGCCallback() {\n // https://dxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp - SetGCCallback\n var phases = Random.index([\"both\", \"begin\", \"end\"]);\n var actionAndOptions = rnd(2) ? 'action: \"majorGC\", depth: ' + rnd(17) : 'action: \"minorGC\"';\n var arg = \"{ \" + actionAndOptions + \", phases: \\\"\" + phases + \"\\\" }\";\n return prefix + \"setGCCallback(\" + arg + \");\";\n }\n\n function tryCatch(statement)\n {\n return \"try { \" + statement + \" } catch(e) { }\";\n }\n\n function setGcparam() {\n switch(rnd(2)) {\n case 0: return _set(\"sliceTimeBudget\", rnd(100));\n default: return _set(\"markStackLimit\", rnd(2) ? (1 + rnd(30)) : 4294967295); // Artificially trigger delayed marking\n }\n\n function _set(name, value) {\n // try..catch because gcparam sets may throw, depending on GC state (see bug 973571)\n return tryCatch(prefix + \"gcparam\" + \"('\" + name + \"', \" + value + \");\");\n }\n }\n\n // Functions shared between the SpiderMonkey shell and Firefox browser\n // https://mxr.mozilla.org/mozilla-central/source/js/src/builtin/TestingFunctions.cpp\n var sharedTestingFunctions = [\n // Force garbage collection (global or specific compartment)\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \");\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \"'compartment'\" + maybeCommaShrinking() + \");\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + fGlobal(d, b) + maybeCommaShrinking() + \");\"; } },\n\n // Run a minor garbage collection on the nursery.\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(false);\"; } },\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(true);\"; } },\n\n // Start, continue, or abort incremental garbage collection.\n // startgc can throw: \"Incremental GC already in progress\"\n { w: 20, v: function(d, b) { return tryCatch(prefix + \"startgc\" + \"(\" + gcSliceSize() + maybeCommaShrinking() + \");\"); } },\n { w: 20, v: function(d, b) { return prefix + \"gcslice\" + \"(\" + gcSliceSize() + \");\"; } },\n { w: 10, v: function(d, b) { return prefix + \"abortgc\" + \"(\" + \");\"; } },\n\n // Schedule the given objects to be marked in the next GC slice.\n { w: 10, v: function(d, b) { return prefix + \"selectforgc\" + \"(\" + fObject(d, b) + \");\"; } },\n\n // Add a compartment to the next garbage collection.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // Schedule a GC for after N allocations.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + numberOfAllocs() + \");\"; } },\n\n // Change a GC parameter.\n { w: 10, v: setGcparam },\n\n // Verify write barriers. This functions is effective in pairs.\n // The first call sets up the start barrier, the second call sets up the end barrier.\n // Nothing happens when there is only one call.\n { w: 10, v: function(d, b) { return prefix + \"verifyprebarriers\" + \"();\"; } },\n\n // hasChild(parent, child): Return true if |child| is a child of |parent|, as determined by a call to TraceChildren.\n // We ignore the return value because hasChild can be used to see which WeakMap entries have been GCed.\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"hasChild(\" + fObject(d, b) + \", \" + fObject(d, b) + \");\"; } },\n\n // Various validation functions (toggles)\n { w: 5, v: function(d, b) { return prefix + \"validategc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"validategc\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(true);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableOsiPointRegisterChecks\" + \"();\"; } },\n\n // Various validation functions (immediate)\n { w: 1, v: function(d, b) { return prefix + \"assertJitStackInvariants\" + \"();\"; } },\n\n // Run-time equivalents to --baseline-eager, --baseline-warmup-threshold, --ion-eager, --ion-warmup-threshold\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('baseline.warmup.trigger', \" + rnd(20) + \");\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.warmup.trigger', \" + rnd(40) + \");\"; } },\n\n // Force inline cache.\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.forceinlineCaches\\', \" + rnd(2) + \");\"; } },\n\n // Run-time equivalents to --no-ion, --no-baseline\n // These can throw: \"Can't turn off JITs with JIT code on the stack.\"\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('ion.enable', \" + rnd(2) + \");\"); } },\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('baseline.enable', \" + rnd(2) + \");\"); } },\n\n // Test the built-in profiler.\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfilingWithSlowAssertions\" + \"();\"; } },\n { w: 5, v: function(d, b) { return prefix + \"disableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"readSPSProfilingStack\" + \"();\"; } },\n\n // I'm not sure what this does in the shell.\n { w: 5, v: function(d, b) { return prefix + \"deterministicgc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"deterministicgc\" + \"(true);\"; } },\n\n // Causes JIT code to always be preserved by GCs afterwards (see https://bugzilla.mozilla.org/show_bug.cgi?id=750834)\n { w: 5, v: function(d, b) { return prefix + \"gcPreserveCode\" + \"();\"; } },\n\n // Generate an LCOV trace (but throw away the returned string)\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // JIT bailout\n { w: 5, v: function(d, b) { return prefix + \"bailout\" + \"();\"; } },\n { w: 10, v: function(d, b) { return prefix + \"bailAfter\" + \"(\" + numberOfInstructions() + \");\"; } },\n ];\n\n // Functions only in the SpiderMonkey shell\n // https://mxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp\n var shellOnlyTestingFunctions = [\n // ARM simulator settings\n // These throw when not in the ARM simulator.\n { w: 1, v: function(d, b) { return tryCatch(\"(void\" + prefix + \"disableSingleStepProfiling\" + \"()\" + \")\"); } },\n { w: 1, v: function(d, b) { return tryCatch(\"(\" + prefix + \"enableSingleStepProfiling\" + \"()\" + \")\"); } },\n\n // Force garbage collection with function relazification\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"();\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"('compartment');\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // [TestingFunctions.cpp, but debug-only and CRASHY]\n // After N js_malloc memory allocations, fail every following allocation\n { w: 1, v: function(d, b) { return (typeof oomAfterAllocations == \"function\" && rnd(1000) === 0) ? prefix + \"oomAfterAllocations\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // After N js_malloc memory allocations, fail one allocation\n { w: 1, v: function(d, b) { return (typeof oomAtAllocation == \"function\" && rnd(100) === 0) ? prefix + \"oomAtAllocation\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // Reset either of the above\n { w: 1, v: function(d, b) { return (typeof resetOOMFailure == \"function\") ? \"void \" + prefix + \"resetOOMFailure\" + \"(\" + \");\" : \"void 0;\"; } },\n\n // [TestingFunctions.cpp, but SLOW]\n // Make garbage collection extremely frequent\n { w: 1, v: function(d, b) { return (rnd(100) === 0) ? (enableGCZeal()) : \"void 0;\"; } },\n\n { w: 10, v: callSetGCCallback },\n ];\n\n var testingFunctions = Random.weighted(browser ? sharedTestingFunctions : sharedTestingFunctions.concat(shellOnlyTestingFunctions));\n\n return { testingFunctions: testingFunctions, enableGCZeal: enableGCZeal };\n}", "function fuzzTestingFunctionsCtor(browser, fGlobal, fObject)\n{\n var prefix = browser ? \"fuzzPriv.\" : \"\";\n\n function numberOfInstructions() { return Math.floor(Random.ludOneTo(10000)); }\n function numberOfAllocs() { return Math.floor(Random.ludOneTo(500)); }\n function gcSliceSize() { return Math.floor(Random.ludOneTo(0x100000000)); }\n function maybeCommaShrinking() { return rnd(5) ? \"\" : \", 'shrinking'\"; }\n\n function enableGCZeal()\n {\n var level = rnd(17);\n if (browser && level == 9) level = 0; // bug 815241\n var period = numberOfAllocs();\n return prefix + \"gczeal\" + \"(\" + level + \", \" + period + \");\";\n }\n\n function callSetGCCallback() {\n // https://dxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp - SetGCCallback\n var phases = Random.index([\"both\", \"begin\", \"end\"]);\n var actionAndOptions = rnd(2) ? 'action: \"majorGC\", depth: ' + rnd(17) : 'action: \"minorGC\"';\n var arg = \"{ \" + actionAndOptions + \", phases: \\\"\" + phases + \"\\\" }\";\n return prefix + \"setGCCallback(\" + arg + \");\";\n }\n\n function tryCatch(statement)\n {\n return \"try { \" + statement + \" } catch(e) { }\";\n }\n\n function setGcparam() {\n switch(rnd(2)) {\n case 0: return _set(\"sliceTimeBudget\", rnd(100));\n default: return _set(\"markStackLimit\", rnd(2) ? (1 + rnd(30)) : 4294967295); // Artificially trigger delayed marking\n }\n\n function _set(name, value) {\n // try..catch because gcparam sets may throw, depending on GC state (see bug 973571)\n return tryCatch(prefix + \"gcparam\" + \"('\" + name + \"', \" + value + \");\");\n }\n }\n\n // Functions shared between the SpiderMonkey shell and Firefox browser\n // https://mxr.mozilla.org/mozilla-central/source/js/src/builtin/TestingFunctions.cpp\n var sharedTestingFunctions = [\n // Force garbage collection (global or specific compartment)\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \");\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \"'compartment'\" + maybeCommaShrinking() + \");\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + fGlobal(d, b) + maybeCommaShrinking() + \");\"; } },\n\n // Run a minor garbage collection on the nursery.\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(false);\"; } },\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(true);\"; } },\n\n // Start, continue, or abort incremental garbage collection.\n // startgc can throw: \"Incremental GC already in progress\"\n { w: 20, v: function(d, b) { return tryCatch(prefix + \"startgc\" + \"(\" + gcSliceSize() + maybeCommaShrinking() + \");\"); } },\n { w: 20, v: function(d, b) { return prefix + \"gcslice\" + \"(\" + gcSliceSize() + \");\"; } },\n { w: 10, v: function(d, b) { return prefix + \"abortgc\" + \"(\" + \");\"; } },\n\n // Schedule the given objects to be marked in the next GC slice.\n { w: 10, v: function(d, b) { return prefix + \"selectforgc\" + \"(\" + fObject(d, b) + \");\"; } },\n\n // Add a compartment to the next garbage collection.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // Schedule a GC for after N allocations.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + numberOfAllocs() + \");\"; } },\n\n // Change a GC parameter.\n { w: 10, v: setGcparam },\n\n // Verify write barriers. This functions is effective in pairs.\n // The first call sets up the start barrier, the second call sets up the end barrier.\n // Nothing happens when there is only one call.\n { w: 10, v: function(d, b) { return prefix + \"verifyprebarriers\" + \"();\"; } },\n\n // hasChild(parent, child): Return true if |child| is a child of |parent|, as determined by a call to TraceChildren.\n // We ignore the return value because hasChild can be used to see which WeakMap entries have been GCed.\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"hasChild(\" + fObject(d, b) + \", \" + fObject(d, b) + \");\"; } },\n\n // Various validation functions (toggles)\n { w: 5, v: function(d, b) { return prefix + \"validategc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"validategc\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(true);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableOsiPointRegisterChecks\" + \"();\"; } },\n\n // Various validation functions (immediate)\n { w: 1, v: function(d, b) { return prefix + \"assertJitStackInvariants\" + \"();\"; } },\n\n // Run-time equivalents to --baseline-eager, --baseline-warmup-threshold, --ion-eager, --ion-warmup-threshold\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('baseline.warmup.trigger', \" + rnd(20) + \");\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.warmup.trigger', \" + rnd(40) + \");\"; } },\n\n // Force inline cache.\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.forceinlineCaches\\', \" + rnd(2) + \");\"; } },\n\n // Run-time equivalents to --no-ion, --no-baseline\n // These can throw: \"Can't turn off JITs with JIT code on the stack.\"\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('ion.enable', \" + rnd(2) + \");\"); } },\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('baseline.enable', \" + rnd(2) + \");\"); } },\n\n // Test the built-in profiler.\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfilingWithSlowAssertions\" + \"();\"; } },\n { w: 5, v: function(d, b) { return prefix + \"disableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"readSPSProfilingStack\" + \"();\"; } },\n\n // I'm not sure what this does in the shell.\n { w: 5, v: function(d, b) { return prefix + \"deterministicgc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"deterministicgc\" + \"(true);\"; } },\n\n // Causes JIT code to always be preserved by GCs afterwards (see https://bugzilla.mozilla.org/show_bug.cgi?id=750834)\n { w: 5, v: function(d, b) { return prefix + \"gcPreserveCode\" + \"();\"; } },\n\n // Generate an LCOV trace (but throw away the returned string)\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // JIT bailout\n { w: 5, v: function(d, b) { return prefix + \"bailout\" + \"();\"; } },\n { w: 10, v: function(d, b) { return prefix + \"bailAfter\" + \"(\" + numberOfInstructions() + \");\"; } },\n ];\n\n // Functions only in the SpiderMonkey shell\n // https://mxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp\n var shellOnlyTestingFunctions = [\n // ARM simulator settings\n // These throw when not in the ARM simulator.\n { w: 1, v: function(d, b) { return tryCatch(\"(void\" + prefix + \"disableSingleStepProfiling\" + \"()\" + \")\"); } },\n { w: 1, v: function(d, b) { return tryCatch(\"(\" + prefix + \"enableSingleStepProfiling\" + \"()\" + \")\"); } },\n\n // Force garbage collection with function relazification\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"();\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"('compartment');\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // [TestingFunctions.cpp, but debug-only and CRASHY]\n // After N js_malloc memory allocations, fail every following allocation\n { w: 1, v: function(d, b) { return (typeof oomAfterAllocations == \"function\" && rnd(1000) === 0) ? prefix + \"oomAfterAllocations\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // After N js_malloc memory allocations, fail one allocation\n { w: 1, v: function(d, b) { return (typeof oomAtAllocation == \"function\" && rnd(100) === 0) ? prefix + \"oomAtAllocation\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // Reset either of the above\n { w: 1, v: function(d, b) { return (typeof resetOOMFailure == \"function\") ? \"void \" + prefix + \"resetOOMFailure\" + \"(\" + \");\" : \"void 0;\"; } },\n\n // [TestingFunctions.cpp, but SLOW]\n // Make garbage collection extremely frequent\n { w: 1, v: function(d, b) { return (rnd(100) === 0) ? (enableGCZeal()) : \"void 0;\"; } },\n\n { w: 10, v: callSetGCCallback },\n ];\n\n var testingFunctions = Random.weighted(browser ? sharedTestingFunctions : sharedTestingFunctions.concat(shellOnlyTestingFunctions));\n\n return { testingFunctions: testingFunctions, enableGCZeal: enableGCZeal };\n}", "function fuzzTestingFunctionsCtor(browser, fGlobal, fObject)\n{\n var prefix = browser ? \"fuzzPriv.\" : \"\";\n\n function numberOfInstructions() { return Math.floor(Random.ludOneTo(10000)); }\n function numberOfAllocs() { return Math.floor(Random.ludOneTo(500)); }\n function gcSliceSize() { return Math.floor(Random.ludOneTo(0x100000000)); }\n function maybeCommaShrinking() { return rnd(5) ? \"\" : \", 'shrinking'\"; }\n\n function enableGCZeal()\n {\n var level = rnd(17);\n if (browser && level == 9) level = 0; // bug 815241\n var period = numberOfAllocs();\n return prefix + \"gczeal\" + \"(\" + level + \", \" + period + \");\";\n }\n\n function callSetGCCallback() {\n // https://dxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp - SetGCCallback\n var phases = Random.index([\"both\", \"begin\", \"end\"]);\n var actionAndOptions = rnd(2) ? 'action: \"majorGC\", depth: ' + rnd(17) : 'action: \"minorGC\"';\n var arg = \"{ \" + actionAndOptions + \", phases: \\\"\" + phases + \"\\\" }\";\n return prefix + \"setGCCallback(\" + arg + \");\";\n }\n\n function tryCatch(statement)\n {\n return \"try { \" + statement + \" } catch(e) { }\";\n }\n\n function setGcparam() {\n switch(rnd(2)) {\n case 0: return _set(\"sliceTimeBudget\", rnd(100));\n default: return _set(\"markStackLimit\", rnd(2) ? (1 + rnd(30)) : 4294967295); // Artificially trigger delayed marking\n }\n\n function _set(name, value) {\n // try..catch because gcparam sets may throw, depending on GC state (see bug 973571)\n return tryCatch(prefix + \"gcparam\" + \"('\" + name + \"', \" + value + \");\");\n }\n }\n\n // Functions shared between the SpiderMonkey shell and Firefox browser\n // https://mxr.mozilla.org/mozilla-central/source/js/src/builtin/TestingFunctions.cpp\n var sharedTestingFunctions = [\n // Force garbage collection (global or specific compartment)\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \");\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \"'compartment'\" + maybeCommaShrinking() + \");\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + fGlobal(d, b) + maybeCommaShrinking() + \");\"; } },\n\n // Run a minor garbage collection on the nursery.\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(false);\"; } },\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(true);\"; } },\n\n // Start, continue, or abort incremental garbage collection.\n // startgc can throw: \"Incremental GC already in progress\"\n { w: 20, v: function(d, b) { return tryCatch(prefix + \"startgc\" + \"(\" + gcSliceSize() + maybeCommaShrinking() + \");\"); } },\n { w: 20, v: function(d, b) { return prefix + \"gcslice\" + \"(\" + gcSliceSize() + \");\"; } },\n { w: 10, v: function(d, b) { return prefix + \"abortgc\" + \"(\" + \");\"; } },\n\n // Schedule the given objects to be marked in the next GC slice.\n { w: 10, v: function(d, b) { return prefix + \"selectforgc\" + \"(\" + fObject(d, b) + \");\"; } },\n\n // Add a compartment to the next garbage collection.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // Schedule a GC for after N allocations.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + numberOfAllocs() + \");\"; } },\n\n // Change a GC parameter.\n { w: 10, v: setGcparam },\n\n // Verify write barriers. This functions is effective in pairs.\n // The first call sets up the start barrier, the second call sets up the end barrier.\n // Nothing happens when there is only one call.\n { w: 10, v: function(d, b) { return prefix + \"verifyprebarriers\" + \"();\"; } },\n\n // hasChild(parent, child): Return true if |child| is a child of |parent|, as determined by a call to TraceChildren.\n // We ignore the return value because hasChild can be used to see which WeakMap entries have been GCed.\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"hasChild(\" + fObject(d, b) + \", \" + fObject(d, b) + \");\"; } },\n\n // Various validation functions (toggles)\n { w: 5, v: function(d, b) { return prefix + \"validategc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"validategc\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(true);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableOsiPointRegisterChecks\" + \"();\"; } },\n\n // Various validation functions (immediate)\n { w: 1, v: function(d, b) { return prefix + \"assertJitStackInvariants\" + \"();\"; } },\n\n // Run-time equivalents to --baseline-eager, --baseline-warmup-threshold, --ion-eager, --ion-warmup-threshold\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('baseline.warmup.trigger', \" + rnd(20) + \");\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.warmup.trigger', \" + rnd(40) + \");\"; } },\n\n // Force inline cache.\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.forceinlineCaches\\', \" + rnd(2) + \");\"; } },\n\n // Run-time equivalents to --no-ion, --no-baseline\n // These can throw: \"Can't turn off JITs with JIT code on the stack.\"\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('ion.enable', \" + rnd(2) + \");\"); } },\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('baseline.enable', \" + rnd(2) + \");\"); } },\n\n // Test the built-in profiler.\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfilingWithSlowAssertions\" + \"();\"; } },\n { w: 5, v: function(d, b) { return prefix + \"disableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"readSPSProfilingStack\" + \"();\"; } },\n\n // I'm not sure what this does in the shell.\n { w: 5, v: function(d, b) { return prefix + \"deterministicgc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"deterministicgc\" + \"(true);\"; } },\n\n // Causes JIT code to always be preserved by GCs afterwards (see https://bugzilla.mozilla.org/show_bug.cgi?id=750834)\n { w: 5, v: function(d, b) { return prefix + \"gcPreserveCode\" + \"();\"; } },\n\n // Generate an LCOV trace (but throw away the returned string)\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // JIT bailout\n { w: 5, v: function(d, b) { return prefix + \"bailout\" + \"();\"; } },\n { w: 10, v: function(d, b) { return prefix + \"bailAfter\" + \"(\" + numberOfInstructions() + \");\"; } },\n ];\n\n // Functions only in the SpiderMonkey shell\n // https://mxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp\n var shellOnlyTestingFunctions = [\n // ARM simulator settings\n // These throw when not in the ARM simulator.\n { w: 1, v: function(d, b) { return tryCatch(\"(void\" + prefix + \"disableSingleStepProfiling\" + \"()\" + \")\"); } },\n { w: 1, v: function(d, b) { return tryCatch(\"(\" + prefix + \"enableSingleStepProfiling\" + \"()\" + \")\"); } },\n\n // Force garbage collection with function relazification\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"();\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"('compartment');\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // [TestingFunctions.cpp, but debug-only and CRASHY]\n // After N js_malloc memory allocations, fail every following allocation\n { w: 1, v: function(d, b) { return (typeof oomAfterAllocations == \"function\" && rnd(1000) === 0) ? prefix + \"oomAfterAllocations\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // After N js_malloc memory allocations, fail one allocation\n { w: 1, v: function(d, b) { return (typeof oomAtAllocation == \"function\" && rnd(100) === 0) ? prefix + \"oomAtAllocation\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // Reset either of the above\n { w: 1, v: function(d, b) { return (typeof resetOOMFailure == \"function\") ? \"void \" + prefix + \"resetOOMFailure\" + \"(\" + \");\" : \"void 0;\"; } },\n\n // [TestingFunctions.cpp, but SLOW]\n // Make garbage collection extremely frequent\n { w: 1, v: function(d, b) { return (rnd(100) === 0) ? (enableGCZeal()) : \"void 0;\"; } },\n\n { w: 10, v: callSetGCCallback },\n ];\n\n var testingFunctions = Random.weighted(browser ? sharedTestingFunctions : sharedTestingFunctions.concat(shellOnlyTestingFunctions));\n\n return { testingFunctions: testingFunctions, enableGCZeal: enableGCZeal };\n}", "function fuzzTestingFunctionsCtor(browser, fGlobal, fObject)\n{\n var prefix = browser ? \"fuzzPriv.\" : \"\";\n\n function numberOfInstructions() { return Math.floor(Random.ludOneTo(10000)); }\n function numberOfAllocs() { return Math.floor(Random.ludOneTo(500)); }\n function gcSliceSize() { return Math.floor(Random.ludOneTo(0x100000000)); }\n function maybeCommaShrinking() { return rnd(5) ? \"\" : \", 'shrinking'\"; }\n\n function enableGCZeal()\n {\n var level = rnd(17);\n if (browser && level == 9) level = 0; // bug 815241\n var period = numberOfAllocs();\n return prefix + \"gczeal\" + \"(\" + level + \", \" + period + \");\";\n }\n\n function callSetGCCallback() {\n // https://dxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp - SetGCCallback\n var phases = Random.index([\"both\", \"begin\", \"end\"]);\n var actionAndOptions = rnd(2) ? 'action: \"majorGC\", depth: ' + rnd(17) : 'action: \"minorGC\"';\n var arg = \"{ \" + actionAndOptions + \", phases: \\\"\" + phases + \"\\\" }\";\n return prefix + \"setGCCallback(\" + arg + \");\";\n }\n\n function tryCatch(statement)\n {\n return \"try { \" + statement + \" } catch(e) { }\";\n }\n\n function setGcparam() {\n switch(rnd(2)) {\n case 0: return _set(\"sliceTimeBudget\", rnd(100));\n default: return _set(\"markStackLimit\", rnd(2) ? (1 + rnd(30)) : 4294967295); // Artificially trigger delayed marking\n }\n\n function _set(name, value) {\n // try..catch because gcparam sets may throw, depending on GC state (see bug 973571)\n return tryCatch(prefix + \"gcparam\" + \"('\" + name + \"', \" + value + \");\");\n }\n }\n\n // Functions shared between the SpiderMonkey shell and Firefox browser\n // https://mxr.mozilla.org/mozilla-central/source/js/src/builtin/TestingFunctions.cpp\n var sharedTestingFunctions = [\n // Force garbage collection (global or specific compartment)\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \");\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \"'compartment'\" + maybeCommaShrinking() + \");\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + fGlobal(d, b) + maybeCommaShrinking() + \");\"; } },\n\n // Run a minor garbage collection on the nursery.\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(false);\"; } },\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(true);\"; } },\n\n // Start, continue, or abort incremental garbage collection.\n // startgc can throw: \"Incremental GC already in progress\"\n { w: 20, v: function(d, b) { return tryCatch(prefix + \"startgc\" + \"(\" + gcSliceSize() + maybeCommaShrinking() + \");\"); } },\n { w: 20, v: function(d, b) { return prefix + \"gcslice\" + \"(\" + gcSliceSize() + \");\"; } },\n { w: 10, v: function(d, b) { return prefix + \"abortgc\" + \"(\" + \");\"; } },\n\n // Schedule the given objects to be marked in the next GC slice.\n { w: 10, v: function(d, b) { return prefix + \"selectforgc\" + \"(\" + fObject(d, b) + \");\"; } },\n\n // Add a compartment to the next garbage collection.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // Schedule a GC for after N allocations.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + numberOfAllocs() + \");\"; } },\n\n // Change a GC parameter.\n { w: 10, v: setGcparam },\n\n // Verify write barriers. This functions is effective in pairs.\n // The first call sets up the start barrier, the second call sets up the end barrier.\n // Nothing happens when there is only one call.\n { w: 10, v: function(d, b) { return prefix + \"verifyprebarriers\" + \"();\"; } },\n\n // hasChild(parent, child): Return true if |child| is a child of |parent|, as determined by a call to TraceChildren.\n // We ignore the return value because hasChild can be used to see which WeakMap entries have been GCed.\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"hasChild(\" + fObject(d, b) + \", \" + fObject(d, b) + \");\"; } },\n\n // Various validation functions (toggles)\n { w: 5, v: function(d, b) { return prefix + \"validategc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"validategc\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(true);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableOsiPointRegisterChecks\" + \"();\"; } },\n\n // Various validation functions (immediate)\n { w: 1, v: function(d, b) { return prefix + \"assertJitStackInvariants\" + \"();\"; } },\n\n // Run-time equivalents to --baseline-eager, --baseline-warmup-threshold, --ion-eager, --ion-warmup-threshold\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('baseline.warmup.trigger', \" + rnd(20) + \");\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.warmup.trigger', \" + rnd(40) + \");\"; } },\n\n // Force inline cache.\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.forceinlineCaches\\', \" + rnd(2) + \");\"; } },\n\n // Run-time equivalents to --no-ion, --no-baseline\n // These can throw: \"Can't turn off JITs with JIT code on the stack.\"\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('ion.enable', \" + rnd(2) + \");\"); } },\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('baseline.enable', \" + rnd(2) + \");\"); } },\n\n // Test the built-in profiler.\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfilingWithSlowAssertions\" + \"();\"; } },\n { w: 5, v: function(d, b) { return prefix + \"disableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"readSPSProfilingStack\" + \"();\"; } },\n\n // I'm not sure what this does in the shell.\n { w: 5, v: function(d, b) { return prefix + \"deterministicgc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"deterministicgc\" + \"(true);\"; } },\n\n // Causes JIT code to always be preserved by GCs afterwards (see https://bugzilla.mozilla.org/show_bug.cgi?id=750834)\n { w: 5, v: function(d, b) { return prefix + \"gcPreserveCode\" + \"();\"; } },\n\n // Generate an LCOV trace (but throw away the returned string)\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // JIT bailout\n { w: 5, v: function(d, b) { return prefix + \"bailout\" + \"();\"; } },\n { w: 10, v: function(d, b) { return prefix + \"bailAfter\" + \"(\" + numberOfInstructions() + \");\"; } },\n ];\n\n // Functions only in the SpiderMonkey shell\n // https://mxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp\n var shellOnlyTestingFunctions = [\n // ARM simulator settings\n // These throw when not in the ARM simulator.\n { w: 1, v: function(d, b) { return tryCatch(\"(void\" + prefix + \"disableSingleStepProfiling\" + \"()\" + \")\"); } },\n { w: 1, v: function(d, b) { return tryCatch(\"(\" + prefix + \"enableSingleStepProfiling\" + \"()\" + \")\"); } },\n\n // Force garbage collection with function relazification\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"();\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"('compartment');\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // [TestingFunctions.cpp, but debug-only and CRASHY]\n // After N js_malloc memory allocations, fail every following allocation\n { w: 1, v: function(d, b) { return (typeof oomAfterAllocations == \"function\" && rnd(1000) === 0) ? prefix + \"oomAfterAllocations\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // After N js_malloc memory allocations, fail one allocation\n { w: 1, v: function(d, b) { return (typeof oomAtAllocation == \"function\" && rnd(100) === 0) ? prefix + \"oomAtAllocation\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // Reset either of the above\n { w: 1, v: function(d, b) { return (typeof resetOOMFailure == \"function\") ? \"void \" + prefix + \"resetOOMFailure\" + \"(\" + \");\" : \"void 0;\"; } },\n\n // [TestingFunctions.cpp, but SLOW]\n // Make garbage collection extremely frequent\n { w: 1, v: function(d, b) { return (rnd(100) === 0) ? (enableGCZeal()) : \"void 0;\"; } },\n\n { w: 10, v: callSetGCCallback },\n ];\n\n var testingFunctions = Random.weighted(browser ? sharedTestingFunctions : sharedTestingFunctions.concat(shellOnlyTestingFunctions));\n\n return { testingFunctions: testingFunctions, enableGCZeal: enableGCZeal };\n}", "function fuzzTestingFunctionsCtor(browser, fGlobal, fObject)\n{\n var prefix = browser ? \"fuzzPriv.\" : \"\";\n\n function numberOfInstructions() { return Math.floor(Random.ludOneTo(10000)); }\n function numberOfAllocs() { return Math.floor(Random.ludOneTo(500)); }\n function gcSliceSize() { return Math.floor(Random.ludOneTo(0x100000000)); }\n function maybeCommaShrinking() { return rnd(5) ? \"\" : \", 'shrinking'\"; }\n\n function enableGCZeal()\n {\n var level = rnd(17);\n if (browser && level == 9) level = 0; // bug 815241\n var period = numberOfAllocs();\n return prefix + \"gczeal\" + \"(\" + level + \", \" + period + \");\";\n }\n\n function callSetGCCallback() {\n // https://dxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp - SetGCCallback\n var phases = Random.index([\"both\", \"begin\", \"end\"]);\n var actionAndOptions = rnd(2) ? 'action: \"majorGC\", depth: ' + rnd(17) : 'action: \"minorGC\"';\n var arg = \"{ \" + actionAndOptions + \", phases: \\\"\" + phases + \"\\\" }\";\n return prefix + \"setGCCallback(\" + arg + \");\";\n }\n\n function tryCatch(statement)\n {\n return \"try { \" + statement + \" } catch(e) { }\";\n }\n\n function setGcparam() {\n switch(rnd(2)) {\n case 0: return _set(\"sliceTimeBudget\", rnd(100));\n default: return _set(\"markStackLimit\", rnd(2) ? (1 + rnd(30)) : 4294967295); // Artificially trigger delayed marking\n }\n\n function _set(name, value) {\n // try..catch because gcparam sets may throw, depending on GC state (see bug 973571)\n return tryCatch(prefix + \"gcparam\" + \"('\" + name + \"', \" + value + \");\");\n }\n }\n\n // Functions shared between the SpiderMonkey shell and Firefox browser\n // https://mxr.mozilla.org/mozilla-central/source/js/src/builtin/TestingFunctions.cpp\n var sharedTestingFunctions = [\n // Force garbage collection (global or specific compartment)\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \");\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + \"'compartment'\" + maybeCommaShrinking() + \");\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"gc\" + \"(\" + fGlobal(d, b) + maybeCommaShrinking() + \");\"; } },\n\n // Run a minor garbage collection on the nursery.\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(false);\"; } },\n { w: 20, v: function(d, b) { return prefix + \"minorgc\" + \"(true);\"; } },\n\n // Start, continue, or abort incremental garbage collection.\n // startgc can throw: \"Incremental GC already in progress\"\n { w: 20, v: function(d, b) { return tryCatch(prefix + \"startgc\" + \"(\" + gcSliceSize() + maybeCommaShrinking() + \");\"); } },\n { w: 20, v: function(d, b) { return prefix + \"gcslice\" + \"(\" + gcSliceSize() + \");\"; } },\n { w: 10, v: function(d, b) { return prefix + \"abortgc\" + \"(\" + \");\"; } },\n\n // Schedule the given objects to be marked in the next GC slice.\n { w: 10, v: function(d, b) { return prefix + \"selectforgc\" + \"(\" + fObject(d, b) + \");\"; } },\n\n // Add a compartment to the next garbage collection.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // Schedule a GC for after N allocations.\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"schedulegc\" + \"(\" + numberOfAllocs() + \");\"; } },\n\n // Change a GC parameter.\n { w: 10, v: setGcparam },\n\n // Verify write barriers. This functions is effective in pairs.\n // The first call sets up the start barrier, the second call sets up the end barrier.\n // Nothing happens when there is only one call.\n { w: 10, v: function(d, b) { return prefix + \"verifyprebarriers\" + \"();\"; } },\n\n // hasChild(parent, child): Return true if |child| is a child of |parent|, as determined by a call to TraceChildren.\n // We ignore the return value because hasChild can be used to see which WeakMap entries have been GCed.\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"hasChild(\" + fObject(d, b) + \", \" + fObject(d, b) + \");\"; } },\n\n // Various validation functions (toggles)\n { w: 5, v: function(d, b) { return prefix + \"validategc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"validategc\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"fullcompartmentchecks\" + \"(true);\"; } },\n { w: 5, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setIonCheckGraphCoherency\" + \"(true);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableOsiPointRegisterChecks\" + \"();\"; } },\n\n // Various validation functions (immediate)\n { w: 1, v: function(d, b) { return prefix + \"assertJitStackInvariants\" + \"();\"; } },\n\n // Run-time equivalents to --baseline-eager, --baseline-warmup-threshold, --ion-eager, --ion-warmup-threshold\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('baseline.warmup.trigger', \" + rnd(20) + \");\"; } },\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.warmup.trigger', \" + rnd(40) + \");\"; } },\n\n // Force inline cache.\n { w: 1, v: function(d, b) { return prefix + \"setJitCompilerOption\" + \"('ion.forceinlineCaches\\', \" + rnd(2) + \");\"; } },\n\n // Run-time equivalents to --no-ion, --no-baseline\n // These can throw: \"Can't turn off JITs with JIT code on the stack.\"\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('ion.enable', \" + rnd(2) + \");\"); } },\n { w: 1, v: function(d, b) { return tryCatch(prefix + \"setJitCompilerOption\" + \"('baseline.enable', \" + rnd(2) + \");\"); } },\n\n // Test the built-in profiler.\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return prefix + \"enableSPSProfilingWithSlowAssertions\" + \"();\"; } },\n { w: 5, v: function(d, b) { return prefix + \"disableSPSProfiling\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"readSPSProfilingStack\" + \"();\"; } },\n\n // I'm not sure what this does in the shell.\n { w: 5, v: function(d, b) { return prefix + \"deterministicgc\" + \"(false);\"; } },\n { w: 1, v: function(d, b) { return prefix + \"deterministicgc\" + \"(true);\"; } },\n\n // Causes JIT code to always be preserved by GCs afterwards (see https://bugzilla.mozilla.org/show_bug.cgi?id=750834)\n { w: 5, v: function(d, b) { return prefix + \"gcPreserveCode\" + \"();\"; } },\n\n // Generate an LCOV trace (but throw away the returned string)\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"();\"; } },\n { w: 1, v: function(d, b) { return \"void \" + prefix + \"getLcovInfo\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // JIT bailout\n { w: 5, v: function(d, b) { return prefix + \"bailout\" + \"();\"; } },\n { w: 10, v: function(d, b) { return prefix + \"bailAfter\" + \"(\" + numberOfInstructions() + \");\"; } },\n ];\n\n // Functions only in the SpiderMonkey shell\n // https://mxr.mozilla.org/mozilla-central/source/js/src/shell/js.cpp\n var shellOnlyTestingFunctions = [\n // ARM simulator settings\n // These throw when not in the ARM simulator.\n { w: 1, v: function(d, b) { return tryCatch(\"(void\" + prefix + \"disableSingleStepProfiling\" + \"()\" + \")\"); } },\n { w: 1, v: function(d, b) { return tryCatch(\"(\" + prefix + \"enableSingleStepProfiling\" + \"()\" + \")\"); } },\n\n // Force garbage collection with function relazification\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"();\"; } },\n { w: 10, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"('compartment');\"; } },\n { w: 5, v: function(d, b) { return \"void \" + prefix + \"relazifyFunctions\" + \"(\" + fGlobal(d, b) + \");\"; } },\n\n // [TestingFunctions.cpp, but debug-only and CRASHY]\n // After N js_malloc memory allocations, fail every following allocation\n { w: 1, v: function(d, b) { return (typeof oomAfterAllocations == \"function\" && rnd(1000) === 0) ? prefix + \"oomAfterAllocations\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // After N js_malloc memory allocations, fail one allocation\n { w: 1, v: function(d, b) { return (typeof oomAtAllocation == \"function\" && rnd(100) === 0) ? prefix + \"oomAtAllocation\" + \"(\" + (numberOfAllocs() - 1) + \");\" : \"void 0;\"; } },\n // Reset either of the above\n { w: 1, v: function(d, b) { return (typeof resetOOMFailure == \"function\") ? \"void \" + prefix + \"resetOOMFailure\" + \"(\" + \");\" : \"void 0;\"; } },\n\n // [TestingFunctions.cpp, but SLOW]\n // Make garbage collection extremely frequent\n { w: 1, v: function(d, b) { return (rnd(100) === 0) ? (enableGCZeal()) : \"void 0;\"; } },\n\n { w: 10, v: callSetGCCallback },\n ];\n\n var testingFunctions = Random.weighted(browser ? sharedTestingFunctions : sharedTestingFunctions.concat(shellOnlyTestingFunctions));\n\n return { testingFunctions: testingFunctions, enableGCZeal: enableGCZeal };\n}", "function Utils() {}", "function Utils() {}", "private public function m246() {}", "function y(e){let t=R,n=D,r=j,s=v,i=M,o=B,a=_,u=new Uint8Array(x.slice(0,R)),d=E,c=E.slice(0,E.length),g=F,l=Y,p=e();return R=t,D=n,j=r,v=s,M=i,B=o,_=a,x=u,Y=l,E=d,E.splice(0,E.length,...c),F=g,P=new DataView(x.buffer,x.byteOffset,x.byteLength),p}", "function gia(a){for(var b=0;b<a.length;++b){var c=a[b],d=c[1];if(c[0]){var e=\"_\"==c[0].charAt(0)?[c[0]]:(\"\"+c[0]).split(\".\");if(1==e.length)window[e[0]]=d;else{for(var f=window,g=0;g<e.length-1;++g){var l=e[g];f[l]||(f[l]={});f=f[l]}f[e[e.length-1]]=d}}if(e=c[2])for(g=0;g<e.length;++g)d.prototype[e[g][0]]=e[g][1];if(c=c[3])for(g=0;g<c.length;++g)d[c[g][0]]=c[g][1]}}", "function PerformanceTestCase() {\n}", "function qq(a){this.b=!0;this.c=!1;this.a=\"\";this.g=\"https\";this.f=\"\";this.port=-1;a=a.trim();a=a.replace(/[\\t\\r\\n]/g,\"\");a=rq(this,a);if(r(a,\"//\")){a=a.substr(2);a:{var b=0,c=!1;\"\"!==a&&91===a.charCodeAt(0)&&(c=!0,b++);for(var d=-1,e=-1,g=-1,k=a.charCodeAt(b);35!==k&&47!==k&&63!==k&&!isNaN(k);k=a.charCodeAt(++b))switch(k){case 64:d=b;g=e;e=-1;91===a.charCodeAt(b+1)?(c=!0,b++):c=!1;break;case 58:-1!==e||c||(e=b+1);break;case 91:c=!1;break;case 93:c=!1}-1!==d&&(c=d,-1!==g&&g===d&&c--);d=-1!==d?d+1:\n0;g=-1!==e?e-1:b;c=!1;if(91===a.charCodeAt(d)&&93===a.charCodeAt(g-1)&&d!=g){b:{for(var c=/^[0-9A-Fa-f]{1,4}$/,k=/^([0-9]{1,3}\\.){3}[0-9]{1,3}$/,l=!1,m=a.substr(d+1,g-d-2).split(\":\"),t=m.length,E=0;E<m.length;++E){var v=m[E];if(\"\"===v){if(l){c=!1;break b}l=!0;0===E&&(++E,--t);E===m.length-2&&(++E,--t)}else if(!c.test(v))if(E===m.length-1&&k.test(v))++t;else{c=!1;break b}}c=8<t||8>t&&!l?!1:!0}if(c)++d,--g;else{this.b=!1;break a}}d=a.substr(d,g-d);if(!c)b:{g=d;d=\"\";try{d=decodeURIComponent(g)}catch(J){this.b=\n!1;d=g;break b}for(g=0;g<d.length;++g)c=d.charCodeAt(g),!isNaN(c)&&31<c&&32!==c&&33!==c&&34!==c&&35!==c&&36!==c&&37!==c&&38!==c&&39!==c&&40!==c&&41!==c&&42!==c&&43!==c&&44!==c&&47!==c&&58!==c&&59!==c&&60!==c&&61!==c&&62!==c&&63!==c&&58!==c&&91!==c&&92!==c&&93!==c&&94!==c&&96!==c&&123!==c&&124!==c&&125!==c&&126!==c&&123!==c||(this.b=!1)}r(d,\".\")||-1!==d.indexOf(\"..\")?this.b=!1:\".\"===d.substr(-1)&&(d=d.substr(0,d.length-1));this.f=d;\"\"===this.f&&(this.b=!1);if(-1!==e){a=a.substr(e,b-e);if(\"\"===a)this.port=\n0;else if(/^[0-9]*$/g.test(a))this.port=parseInt(a,10);else{this.b=!1;break a}65535<this.port?this.b=!1:0===this.port&&(this.port={http:80,https:443,ftp:21,sftp:22}[this.a])}}}}", "function AeUtil() {}", "function test_bottleneck_provider() {}", "private internal function m248() {}", "function GranularSanityChecks() {}", "addPolyfills(){// Polyfill for canvas.toBlob().\nif(!HTMLCanvasElement.prototype.toBlob){Object.defineProperty(HTMLCanvasElement.prototype,'toBlob',{value:function(callback,type,quality){var binStr=atob(this.toDataURL(type,quality).split(',')[1]);var len=binStr.length;var arr=new Uint8Array(len);for(var i=0;i<len;i++){arr[i]=binStr.charCodeAt(i)}callback(new Blob([arr],{type:type||'image/png'}))}})}}", "function WebIdUtils () {\n}", "function xg(){for(var t,e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return\"object\"!==Object(Ei[\"a\"])(r[r.length-1])&&(e=r.pop()),xp()(t=bg()(r).call(r,1)).call(t,(function(t,n,r){return wg()(t,n,e)}),r[0])}", "function Y(){!function(t){q[$++]^=255&t,q[$++]^=t>>8&255,q[$++]^=t>>16&255,q[$++]^=t>>24&255,$>=256&&($-=256)}((new Date).getTime())}", "isGMOnly() {\n return false\n }", "verify() {\n // TODO\n }", "function Utils() {\n}", "googleLogin() { }", "function getGoogle(n) {\n\n}", "function _G() {}", "function _G() {}", "function defGoogle(frame) {\n\n var googlePolicy = (function() {\n\n var google = {};\n\n function drawBeforeAdvice(f, self, args) {\n var result = [ args[0] ];\n for (var i = 1; i < args.length; i++) {\n result.push(copyJson(args[i]));\n }\n return result;\n }\n\n function opaqueNodeAdvice(f, self, args) {\n return [ opaqueNode(args[0]) ];\n }\n\n ////////////////////////////////////////////////////////////////////////\n // gViz integration\n\n google.visualization = {};\n\n /** @constructor */\n google.visualization.DataTable = function(opt_data, opt_version) {};\n google.visualization.DataTable.__super__ = Object;\n google.visualization.DataTable.prototype.getNumberOfRows = function() {};\n google.visualization.DataTable.prototype.getNumberOfColumns = function() {};\n google.visualization.DataTable.prototype.clone = function() {};\n google.visualization.DataTable.prototype.getColumnId = function(columnIndex) {};\n google.visualization.DataTable.prototype.getColumnIndex = function(columnId) {};\n google.visualization.DataTable.prototype.getColumnLabel = function(columnIndex) {};\n google.visualization.DataTable.prototype.getColumnPattern = function(columnIndex) {};\n google.visualization.DataTable.prototype.getColumnRole = function(columnIndex) {};\n google.visualization.DataTable.prototype.getColumnType = function(columnIndex) {};\n google.visualization.DataTable.prototype.getValue = function(rowIndex, columnIndex) {};\n google.visualization.DataTable.prototype.getFormattedValue = function(rowIndex, columnIndex) {};\n google.visualization.DataTable.prototype.getProperty = function(rowIndex, columnIndex, property) {};\n google.visualization.DataTable.prototype.getProperties = function(rowIndex, columnIndex) {};\n google.visualization.DataTable.prototype.getTableProperties = function() {};\n google.visualization.DataTable.prototype.getTableProperty = function(property) {};\n google.visualization.DataTable.prototype.setTableProperties = function(properties) {};\n google.visualization.DataTable.prototype.setTableProperty = function(property, value) {};\n google.visualization.DataTable.prototype.setValue = function(rowIndex, columnIndex, value) {};\n google.visualization.DataTable.prototype.setFormattedValue = function(rowIndex, columnIndex, formattedValue) {};\n google.visualization.DataTable.prototype.setProperties = function(rowIndex, columnIndex, properties) {};\n google.visualization.DataTable.prototype.setProperty = function(rowIndex, columnIndex, property, value) {};\n google.visualization.DataTable.prototype.setCell = function(rowIndex, columnIndex, opt_value, opt_formattedValue, opt_properties) {};\n google.visualization.DataTable.prototype.setRowProperties = function(rowIndex, properties) {};\n google.visualization.DataTable.prototype.setRowProperty = function(rowIndex, property, value) {};\n google.visualization.DataTable.prototype.getRowProperty = function(rowIndex, property) {};\n google.visualization.DataTable.prototype.getRowProperties = function(rowIndex) {};\n google.visualization.DataTable.prototype.setColumnLabel = function(columnIndex, newLabel) {};\n google.visualization.DataTable.prototype.setColumnProperties = function(columnIndex, properties) {};\n google.visualization.DataTable.prototype.setColumnProperty = function(columnIndex, property, value) {};\n google.visualization.DataTable.prototype.getColumnProperty = function(columnIndex, property) {};\n google.visualization.DataTable.prototype.getColumnProperties = function(columnIndex) {};\n google.visualization.DataTable.prototype.insertColumn = function(atColIndex, type, opt_label, opt_id) {};\n google.visualization.DataTable.prototype.addColumn = function(type, opt_label, opt_id) {};\n google.visualization.DataTable.prototype.insertRows = function(atRowIndex, numOrArray) {};\n google.visualization.DataTable.prototype.addRows = function(numOrArray) {};\n google.visualization.DataTable.prototype.addRow = function(opt_cellArray) {};\n google.visualization.DataTable.prototype.getColumnRange = function(columnIndex) {};\n google.visualization.DataTable.prototype.getSortedRows = function(sortColumns) {};\n google.visualization.DataTable.prototype.sort = function(sortColumns) {};\n google.visualization.DataTable.prototype.getDistinctValues = function(column) {};\n google.visualization.DataTable.prototype.getFilteredRows = function(columnFilters) {};\n google.visualization.DataTable.prototype.removeRows = function(fromRowIndex, numRows) {};\n google.visualization.DataTable.prototype.removeRow = function(rowIndex) {};\n google.visualization.DataTable.prototype.removeColumns = function(fromColIndex, numCols) {};\n google.visualization.DataTable.prototype.removeColumn = function(colIndex) {};\n\n /** @return {string} JSON representation. */\n google.visualization.DataTable.prototype.toJSON = function() {\n return copyJson(this.toJSON());\n };\n google.visualization.DataTable.prototype.toJSON.__subst__ = true;\n\n google.visualization.arrayToDataTable = function(arr) {};\n\n /** @constructor */\n google.visualization.AreaChart = function(container) {};\n google.visualization.AreaChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.AreaChart.__super__ = Object;\n google.visualization.AreaChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.AreaChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.AreaChart.prototype.clearChart = function() {};\n // google.visualization.AreaChart.prototype.getSelection = function() {};\n // google.visualization.AreaChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.BarChart = function(container) {};\n google.visualization.BarChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.BarChart.__super__ = Object;\n google.visualization.BarChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.BarChart.prototype.clearChart = function() {};\n // google.visualization.BarChart.prototype.getSelection = function() {};\n // google.visualization.BarChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.BubbleChart = function(container) {};\n google.visualization.BubbleChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.BubbleChart.__super__ = Object;\n google.visualization.BubbleChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.BubbleChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.BubbleChart.prototype.clearChart = function() {};\n // google.visualization.BubbleChart.prototype.getSelection = function() {};\n // google.visualization.BubbleChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.CandlestickChart = function(container) {};\n google.visualization.CandlestickChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.CandlestickChart.__super__ = Object;\n google.visualization.CandlestickChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.CandlestickChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.CandlestickChart.prototype.clearChart = function() {};\n // google.visualization.CandlestickChart.prototype.getSelection = function() {};\n // google.visualization.CandlestickChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.ColumnChart = function(container) {};\n google.visualization.ColumnChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.ColumnChart.__super__ = Object;\n google.visualization.ColumnChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.ColumnChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.ColumnChart.prototype.clearChart = function() {};\n // google.visualization.ColumnChart.prototype.getSelection = function() {};\n // google.visualization.ColumnChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.ComboChart = function(container) {};\n google.visualization.ComboChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.ComboChart.__super__ = Object;\n google.visualization.ComboChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.ComboChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.ComboChart.prototype.clearChart = function() {};\n // google.visualization.ComboChart.prototype.getSelection = function() {};\n // google.visualization.ComboChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.Gauge = function(container) {};\n google.visualization.Gauge.__before__ = [ opaqueNodeAdvice ];\n google.visualization.Gauge.__super__ = Object;\n google.visualization.Gauge.prototype.draw = function(dataTable, opt_options) {};\n google.visualization.Gauge.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.Gauge.prototype.clearChart = function() {};\n\n /** @constructor */\n google.visualization.GeoChart = function(container) {};\n google.visualization.GeoChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.GeoChart.__super__ = Object;\n // google.visualization.GeoChart.mapExists = function(userOptions) {};\n google.visualization.GeoChart.prototype.clearChart = function() {};\n google.visualization.GeoChart.prototype.draw = function(dataTable, userOptions, opt_state) {};\n google.visualization.GeoChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n // google.visualization.GeoChart.prototype.getSelection = function() {};\n // google.visualization.GeoChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.LineChart = function(container) {};\n google.visualization.LineChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.LineChart.__super__ = Object;\n google.visualization.LineChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.LineChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.LineChart.prototype.clearChart = function() {};\n // google.visualization.LineChart.prototype.getSelection = function() {};\n // google.visualization.LineChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.PieChart = function(container) {};\n google.visualization.PieChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.PieChart.__super__ = Object;\n google.visualization.PieChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.PieChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.PieChart.prototype.clearChart = function() {};\n // google.visualization.PieChart.prototype.getSelection = function() {};\n // google.visualization.PieChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.ScatterChart = function(container) {};\n google.visualization.ScatterChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.ScatterChart.__super__ = Object;\n google.visualization.ScatterChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.ScatterChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.ScatterChart.prototype.clearChart = function() {};\n // google.visualization.ScatterChart.prototype.getSelection = function() {};\n // google.visualization.ScatterChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.SteppedAreaChart = function(container) {};\n google.visualization.SteppedAreaChart.__before__ = [ opaqueNodeAdvice ];\n google.visualization.SteppedAreaChart.__super__ = Object;\n google.visualization.SteppedAreaChart.prototype.draw = function(data, opt_options, opt_state) {};\n google.visualization.SteppedAreaChart.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.SteppedAreaChart.prototype.clearChart = function() {};\n // google.visualization.SteppedAreaChart.prototype.getSelection = function() {};\n // google.visualization.SteppedAreaChart.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.Table = function(container) {};\n google.visualization.Table.__before__ = [ opaqueNodeAdvice ];\n google.visualization.Table.__super__ = Object;\n google.visualization.Table.prototype.draw = function(dataTable, opt_options) {};\n google.visualization.Table.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.Table.prototype.clearChart = function() {};\n // google.visualization.Table.prototype.getSortInfo = function() {};\n // google.visualization.Table.prototype.getSelection = function() {};\n // google.visualization.Table.prototype.setSelection = function(selection) {};\n\n /** @constructor */\n google.visualization.TreeMap = function(container) {};\n google.visualization.TreeMap.__before__ = [ opaqueNodeAdvice ];\n google.visualization.TreeMap.__super__ = Object;\n google.visualization.TreeMap.prototype.draw = function(dataTable, opt_options) {};\n google.visualization.TreeMap.prototype.draw.__before__ = [ drawBeforeAdvice ];\n google.visualization.TreeMap.prototype.clearChart = function() {};\n // google.visualization.TreeMap.prototype.getSelection = function() {};\n // google.visualization.TreeMap.prototype.setSelection = function(selection) {};\n\n ////////////////////////////////////////////////////////////////////////\n // OnePick integration\n\n google.picker = {};\n\n google.picker.DocsUploadView = function() {};\n google.picker.DocsUploadView.__super__ = Object;\n google.picker.DocsUploadView.prototype.setIncludeFolders = function(boolean) {};\n\n google.picker.View = function() {};\n google.picker.View.__super__ = Object;\n google.picker.View.prototype.getId = function() {};\n google.picker.View.prototype.setMimeTypes = function() {};\n google.picker.View.prototype.setQuery = function() {};\n\n google.picker.DocsView = function() {};\n google.picker.DocsView.__super__ = ['google', 'picker', 'View'];\n google.picker.DocsView.prototype.setIncludeFolders = function() {};\n google.picker.DocsView.prototype.setMode = function() {};\n google.picker.DocsView.prototype.setOwnedByMe = function() {};\n google.picker.DocsView.prototype.setStarred = function() {};\n\n google.picker.DocsViewMode = {};\n google.picker.DocsViewMode.GRID = 1;\n google.picker.DocsViewMode.LIST = 1;\n\n google.picker.Feature = {};\n google.picker.Feature.MINE_ONLY = 1;\n google.picker.Feature.MULTISELECT_ENABLED = 1;\n google.picker.Feature.NAV_HIDDEN = 1;\n google.picker.Feature.SIMPLE_UPLOAD_ENABLED = 1;\n\n google.picker.ImageSearchView = function() {};\n google.picker.ImageSearchView.__super__ = ['google', 'picker', 'View'];\n google.picker.ImageSearchView.prototype.setLicense = function() {};\n google.picker.ImageSearchView.prototype.setSite = function() {};\n google.picker.ImageSearchView.prototype.setSize = function() {};\n\n google.picker.ImageSearchView.License = {};\n google.picker.ImageSearchView.License.NONE = 1;\n google.picker.ImageSearchView.License.COMMERCIAL_REUSE = 1;\n google.picker.ImageSearchView.License.COMMERCIAL_REUSE_WITH_MODIFICATION = 1;\n google.picker.ImageSearchView.License.REUSE = 1;\n google.picker.ImageSearchView.License.REUSE_WITH_MODIFICATION = 1;\n\n google.picker.ImageSearchView.Size = {};\n google.picker.ImageSearchView.Size.SIZE_QSVGA = 1;\n google.picker.ImageSearchView.Size.SIZE_VGA = 1;\n google.picker.ImageSearchView.Size.SIZE_SVGA = 1;\n google.picker.ImageSearchView.Size.SIZE_XGA = 1;\n google.picker.ImageSearchView.Size.SIZE_WXGA = 1;\n google.picker.ImageSearchView.Size.SIZE_WXGA2 = 1;\n google.picker.ImageSearchView.Size.SIZE_2MP = 1;\n google.picker.ImageSearchView.Size.SIZE_4MP = 1;\n google.picker.ImageSearchView.Size.SIZE_6MP = 1;\n google.picker.ImageSearchView.Size.SIZE_8MP = 1;\n google.picker.ImageSearchView.Size.SIZE_10MP = 1;\n google.picker.ImageSearchView.Size.SIZE_12MP = 1;\n google.picker.ImageSearchView.Size.SIZE_15MP = 1;\n google.picker.ImageSearchView.Size.SIZE_20MP = 1;\n google.picker.ImageSearchView.Size.SIZE_40MP = 1;\n google.picker.ImageSearchView.Size.SIZE_70MP = 1;\n google.picker.ImageSearchView.Size.SIZE_140MP = 1;\n\n google.picker.MapsView = function() {};\n google.picker.MapsView.__super__ = ['google', 'picker', 'View'];\n google.picker.MapsView.prototype.setCenter = function() {};\n google.picker.MapsView.prototype.setZoom = function() {};\n\n google.picker.PhotoAlbumsView = function() {};\n google.picker.PhotoAlbumsView.__super__ = ['google', 'picker', 'View'];\n\n google.picker.PhotosView = function() {};\n google.picker.PhotosView.__super__ = ['google', 'picker', 'View'];\n google.picker.PhotosView.prototype.setType = function() {};\n\n google.picker.PhotosView.Type = {};\n google.picker.PhotosView.Type.FEATURED = 1;\n google.picker.PhotosView.Type.UPLOADED = 1;\n\n var SECRET = {};\n\n google.picker.Picker = function() {\n if (arguments[0] !== SECRET) { throw new TypeError(); }\n this.v = arguments[1];\n };\n google.picker.Picker.__super__ = Object;\n google.picker.Picker.__subst__ = true;\n google.picker.Picker.prototype.isVisible = function() {\n return this.v.isVisible();\n };\n google.picker.Picker.prototype.setCallback = function(c) {\n this.v.setCallback(c);\n };\n google.picker.Picker.prototype.setRelayUrl = function(u) {\n this.v.setRelayUrl(u);\n };\n google.picker.Picker.prototype.setVisible = function(b) {\n this.v.setVisible(b);\n };\n\n/*\n google.picker.PickerBuilder = function() {};\n google.picker.PickerBuilder.__super__ = Object;\n google.picker.PickerBuilder.prototype.addView = function() {};\n google.picker.PickerBuilder.prototype.addViewGroup = function() {};\n google.picker.PickerBuilder.prototype.build = function() {};\n google.picker.PickerBuilder.prototype.disableFeature = function() {};\n google.picker.PickerBuilder.prototype.enableFeature = function() {};\n google.picker.PickerBuilder.prototype.getRelayUrl = function() {};\n google.picker.PickerBuilder.prototype.getTitle = function() {};\n google.picker.PickerBuilder.prototype.hideTitleBar = function() {};\n google.picker.PickerBuilder.prototype.isFeatureEnabled = function() {};\n google.picker.PickerBuilder.prototype.setAppId = function() {};\n google.picker.PickerBuilder.prototype.setAuthUser = function() {};\n google.picker.PickerBuilder.prototype.setCallback = function() {};\n google.picker.PickerBuilder.prototype.setDocument = function() {};\n google.picker.PickerBuilder.prototype.setLocale = function() {};\n google.picker.PickerBuilder.prototype.setRelayUrl = function() {};\n google.picker.PickerBuilder.prototype.setSelectableMimeTypes = function() {};\n google.picker.PickerBuilder.prototype.setSize = function() {};\n google.picker.PickerBuilder.prototype.setTitle = function() {}; // TODO: Add \"trusted path\" annotation\n google.picker.PickerBuilder.prototype.setUploadToAlbumId = function() {};\n google.picker.PickerBuilder.prototype.toUri = function() {};\n*/\n\n google.picker.PickerBuilder = function() {\n this.v = new window.google.picker.PickerBuilder();\n };\n google.picker.PickerBuilder.__subst__ = true;\n google.picker.PickerBuilder.__super__ = Object;\n google.picker.PickerBuilder.prototype.addView = function() {\n this.v.addView.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.addViewGroup = function() {\n this.v.addViewGroup.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.disableFeature = function() {\n this.v.disableFeature.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.enableFeature = function() {\n this.v.enableFeature.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.getRelayUrl = function() {\n this.v.getRelayUrl.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.getTitle = function() {\n this.v.getTitle.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.hideTitleBar = function() {\n this.v.hideTitleBar.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.isFeatureEnabled = function() {\n this.v.isFeatureEnabled.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setAppId = function() {\n this.v.setAppId.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setAuthUser = function() {\n this.v.setAuthUser.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setCallback = function() {\n this.v.setCallback.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setDocument = function() {\n this.v.setDocument.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setLocale = function() {\n this.v.setLocale.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setRelayUrl = function() {\n this.v.setRelayUrl.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setSelectableMimeTypes = function() {\n this.v.setSelectableMimeTypes.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setSize = function() {\n this.v.setSize.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setTitle = function() {\n this.v.setTitle.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.setUploadToAlbumId = function() {\n this.v.setUploadToAlbumId.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.toUri = function() {\n this.v.toUri.apply(this.v, arguments);\n return this;\n };\n google.picker.PickerBuilder.prototype.build = function() {\n return new google.picker.Picker(SECRET, this.v.build.apply(this.v, arguments));\n }; \n\n google.picker.ResourceId = {};\n google.picker.ResourceId.generate = function() {};\n\n google.picker.VideoSearchView = function() {};\n google.picker.VideoSearchView.__super__ = ['google', 'picker', 'View'];\n google.picker.VideoSearchView.prototype.setSite = function() {};\n\n google.picker.VideoSearchView.YOUTUBE = 1;\n\n google.picker.ViewGroup = function() {};\n google.picker.ViewGroup.__super__ = Object;\n google.picker.ViewGroup.prototype.addLabel = function() {};\n google.picker.ViewGroup.prototype.addView = function() {};\n google.picker.ViewGroup.prototype.addViewGroup = function() {};\n\n google.picker.ViewId = {};\n google.picker.ViewId.DOCS = 1;\n google.picker.ViewId.DOCS_IMAGES = 1;\n google.picker.ViewId.DOCS_IMAGES_AND_VIDEOS = 1;\n google.picker.ViewId.DOCS_VIDEOS = 1;\n google.picker.ViewId.DOCUMENTS = 1;\n google.picker.ViewId.FOLDERS = 1;\n google.picker.ViewId.FORMS = 1;\n google.picker.ViewId.IMAGE_SEARCH = 1;\n google.picker.ViewId.PDFS = 1;\n google.picker.ViewId.PHOTO_ALBUMS = 1;\n google.picker.ViewId.PHOTO_UPLOAD = 1;\n google.picker.ViewId.PHOTOS = 1;\n google.picker.ViewId.PRESENTATIONS = 1;\n google.picker.ViewId.RECENTLY_PICKED = 1;\n google.picker.ViewId.SPREADSHEETS = 1;\n google.picker.ViewId.VIDEO_SEARCH = 1;\n google.picker.ViewId.WEBCAM = 1;\n google.picker.ViewId.YOUTUBE = 1;\n\n google.picker.WebCamView = function() {};\n google.picker.WebCamView.__super__ = ['google', 'picker', 'View'];\n\n google.picker.WebCamViewType = {};\n google.picker.WebCamViewType.STANDARD = 1;\n google.picker.WebCamViewType.VIDEOS = 1;\n\n google.picker.Action = {};\n google.picker.Action.CANCEL = 1;\n google.picker.Action.PICKED = 1;\n\n google.picker.Audience = {};\n google.picker.Audience.OWNER_ONLY = 1;\n google.picker.Audience.LIMITED = 1;\n google.picker.Audience.ALL_PERSONAL_CIRCLES = 1;\n google.picker.Audience.EXTENDED_CIRCLES = 1;\n google.picker.Audience.DOMAIN_PUBLIC = 1;\n google.picker.Audience.PUBLIC = 1;\n\n google.picker.Document = {};\n google.picker.Document.ADDRESS_LINES = 1;\n google.picker.Document.AUDIENCE = 1;\n google.picker.Document.DESCRIPTION = 1;\n google.picker.Document.DURATION = 1;\n google.picker.Document.EMBEDDABLE_URL = 1;\n google.picker.Document.ICON_URL = 1;\n google.picker.Document.ID = 1;\n google.picker.Document.IS_NEW = 1;\n google.picker.Document.LAST_EDITED_UTC = 1;\n google.picker.Document.LATITUDE = 1;\n google.picker.Document.LONGITUDE = 1;\n google.picker.Document.MIME_TYPE = 1;\n google.picker.Document.NAME = 1;\n google.picker.Document.NUM_CHILDREN = 1;\n google.picker.Document.PARENT_ID = 1;\n google.picker.Document.PHONE_NUMBERS = 1;\n google.picker.Document.SERVICE_ID = 1;\n google.picker.Document.THUMBNAILS = 1;\n google.picker.Document.TYPE = 1;\n google.picker.Document.URL = 1;\n\n google.picker.Response = {};\n google.picker.Response.ACTION = 1;\n google.picker.Response.DOCUMENTS = 1;\n google.picker.Response.PARENTS = 1;\n google.picker.Response.VIEW = 1;\n\n google.picker.ServiceId = {};\n google.picker.ServiceId.DOCS = 1;\n google.picker.ServiceId.MAPS = 1;\n google.picker.ServiceId.PHOTOS = 1;\n google.picker.ServiceId.SEARCH_API = 1;\n google.picker.ServiceId.URL = 1;\n google.picker.ServiceId.YOUTUBE = 1;\n\n google.picker.Thumbnail = {};\n google.picker.Thumbnail.HEIGHT = 1;\n google.picker.Thumbnail.WIDTH = 1;\n google.picker.Thumbnail.URL = 1;\n\n google.picker.Type = {};\n google.picker.Type.ALBUM = 1;\n google.picker.Type.DOCUMENT = 1;\n google.picker.Type.PHOTO = 1;\n google.picker.Type.URL = 1;\n google.picker.Type.VIDEO = 1;\n\n ////////////////////////////////////////////////////////////////////////\n\n google.setOnLoadCallback = function(olc) {\n throw 'Cannot set onLoadCallback once modules loaded';\n }\n google.setOnLoadCallback.__subst__ = true;\n\n return google;\n })();\n\n function copyJson(o) {\n if (!o) { return undefined; }\n return JSON.parse(JSON.stringify(o, function(key, value) {\n return /__$/.test(key) ? void 0 : value;\n }));\n }\n\n function opaqueNode(guestNode) {\n var d = guestNode.ownerDocument.createElement('div');\n frame.imports.tameNodeAsForeign___(d);\n guestNode.appendChild(d);\n return d;\n }\n\n function forallkeys(obj, cb) {\n for (var k in obj) {\n if (!/.*__$/.test(k)) {\n cb(k);\n }\n }\n }\n\n function targ(obj, policy) {\n return policy.__subst__ ? policy : obj;\n }\n\n ////////////////////////////////////////////////////////////////////////\n \n function grantRead(o, k) {\n if (o[k + '__grantRead__']) { return; }\n console.log(' + grantRead');\n caja.grantRead(o, k);\n o[k + '__grantRead__'] = true;\n }\n\n function grantMethod(o, k) {\n if (o[k + '__grantMethod__']) { return; }\n caja.grantMethod(o, k);\n console.log(' + grantMethod');\n o[k + '__grantMethod__'] = true;\n }\n\n function markFunction(o) {\n if (o.__markFunction__) { return o; }\n var r = caja.markFunction(o);\n console.log(' + markFunction');\n o.__markFunction__ = true;\n return r;\n }\n\n function markCtor(o, sup) {\n if (o.__markCtor__) { return o; }\n var r = caja.markCtor(o, sup);\n console.log(' + markCtor');\n o.__markCtor__ = true;\n return r;\n }\n\n function adviseFunctionBefore(o, advices) {\n if (o.__adviseFunctionBefore__) { return o; }\n for (var i = 0; i < advices.length; i++) {\n caja.adviseFunctionBefore(o, advices[i]);\n }\n console.log(' + adviseFunctionBefore');\n return o;\n }\n\n ////////////////////////////////////////////////////////////////////////\n\n function defCtor(path, obj, policy) {\n console.log(path + ' defCtor');\n forallkeys(policy, function(name) {\n if (!obj[name]) {\n console.log(path + '.' + name + ' skip');\n return;\n }\n console.log(path + '.' + name + ' grant static');\n grantRead(obj, name);\n if (typeof policy[name] === 'function') {\n markFunction(obj[name]);\n }\n });\n forallkeys(policy.prototype, function(name) {\n if (!obj.prototype[name]) {\n console.log(path + '.prototype.' + name + ' skip');\n return;\n }\n console.log(path + '.prototype.' + name + ' grant instance');\n if (typeof policy.prototype[name] === 'function') {\n if (policy.prototype[name].__before__) {\n adviseFunctionBefore(obj.prototype[name], policy.prototype[name].__before__);\n }\n grantMethod(obj.prototype, name);\n } else {\n grantRead(obj.prototype, name);\n }\n });\n var sup;\n if (policy.__super__ === Object) {\n sup = Object;\n } else {\n sup = window;\n for (var i = 0; i < policy.__super__.length; i++) {\n sup = sup[policy.__super__[i]];\n }\n }\n\n if (obj.__before__) {\n adviseFunctionBefore(obj, obj.__before__);\n }\n\n return markCtor(obj, sup);\n }\n\n function defFcn(path, obj, policy) {\n console.log(path + ' defFcn');\n if (obj.__before__) {\n adviseFunctionBefore(obj, obj.__before__);\n }\n return markFunction(obj);\n }\n\n function defObj(path, obj, policy) {\n console.log(path + ' defObj');\n var r = {};\n forallkeys(policy, function(name) {\n var sub_obj = obj[name];\n if (!sub_obj) {\n console.log(path + '.' + name + ' skip');\n return;\n }\n var sub_policy = policy[name];\n var sub_path = path + '.' + name;\n var t_sub_policy = typeof sub_policy;\n if (t_sub_policy === 'function') {\n if (sub_policy.__super__) {\n r[name] = defCtor(sub_path, targ(sub_obj, sub_policy), sub_policy);\n } else {\n r[name] = defFcn(sub_path, targ(sub_obj, sub_policy), sub_policy);\n }\n } else if (t_sub_policy === 'object'){\n r[name] = defObj(sub_path, targ(sub_obj, sub_policy), sub_policy);\n } else {\n console.log(path + '.' + name + ' grant static');\n r[name] = targ(sub_obj, sub_policy);\n grantRead(r, name);\n }\n });\n return caja.markReadOnlyRecord(r);\n }\n\n ////////////////////////////////////////////////////////////////////////\n\n return defObj('google', window['google'], googlePolicy);\n}", "function __JUAssert(){;}", "function Bevy() {}", "function i(e){var t=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(e),n=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(e),r=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),i=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),a=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),s=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),c=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),d=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),f=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),m=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),v=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),y=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),g=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),_=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),b=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),w=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),T=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),E=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),S=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),x=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(e),k=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),C=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),A=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),N=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),I=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x);(0,o.default)(e,{0:t,NetworkOrCORSError:t,400:n,BadRequest:n,401:r,Unauthorized:r,402:i,PaymentRequired:i,403:a,Forbidden:a,404:s,NotFound:s,405:c,MethodNotAllowed:c,406:d,NotAcceptable:d,407:f,ProxyAuthenticationRequired:f,408:m,RequestTimeout:m,409:v,Conflict:v,410:y,Gone:y,411:g,LengthRequired:g,412:_,PreconditionFailed:_,413:b,RequestEntityTooLarge:b,414:w,RequestUriTooLong:w,415:T,UnsupportedMediaType:T,416:E,RequestRangeNotSatisfiable:E,417:S,ExpectationFailed:S,500:x,InternalServerError:x,501:k,NotImplemented:k,502:C,BadGateway:C,503:A,ServiceUnavailable:A,504:N,GatewayTimeout:N,505:I,HttpVersionNotSupported:I,select:function(t){if(void 0===t||null===t)return e;t=t.statusCode||t;var n=e[t];return n||(t=t.toString().split(\"\").shift()+\"00\",t=parseInt(t,10),e[t]||e)}})}", "function Utils(){}", "function WebKitBlobBuilder() {}", "function FunctionUtils() {}", "function Kutility() {\n\n}", "function Kutility() {\n\n}", "function Qc(){return Qc=Object.assign?Object.assign.bind():function(e){for(var c=1;c<arguments.length;c++){var a=arguments[c];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},Qc.apply(this,arguments)}", "function sha1(str){var _a,_b;var utf8=utf8Encode(str);var words32=stringToWords32(utf8,Endian.Big);var len=utf8.length*8;var w=new Array(80);var _c=Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])([0x67452301,0xefcdab89,0x98badcfe,0x10325476,0xc3d2e1f0],5),a=_c[0],b=_c[1],c=_c[2],d=_c[3],e=_c[4];words32[len>>5]|=0x80<<24-len%32;words32[(len+64>>9<<4)+15]=len;for(var i=0;i<words32.length;i+=16){var _d=Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])([a,b,c,d,e],5),h0=_d[0],h1=_d[1],h2=_d[2],h3=_d[3],h4=_d[4];for(var j=0;j<80;j++){if(j<16){w[j]=words32[i+j];}else{w[j]=rol32(w[j-3]^w[j-8]^w[j-14]^w[j-16],1);}var _e=Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])(fk(j,b,c,d),2),f=_e[0],k=_e[1];var temp=[rol32(a,5),f,e,k,w[j]].reduce(add32);_a=Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])([d,c,rol32(b,30),a,temp],5),e=_a[0],d=_a[1],c=_a[2],b=_a[3],a=_a[4];}_b=Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])([add32(a,h0),add32(b,h1),add32(c,h2),add32(d,h3),add32(e,h4)],5),a=_b[0],b=_b[1],c=_b[2],d=_b[3],e=_b[4];}return byteStringToHexString(words32ToByteString([a,b,c,d,e]));}", "function WSAPI() {\n }", "function Visitor(q,v){function y(a){function c(a,d,c){c=c?c+=\"|\":c;return c+(a+\"=\"+encodeURIComponent(d))}for(var b=\"\",e=0,f=a.length;e<f;e++){var g=a[e],h=g[0],g=g[1];g!=i&&g!==t&&(b=c(h,g,b))}return function(a){var d=(new Date).getTime(),a=a?a+=\"|\":a;return a+(\"TS=\"+d)}(b)}if(!q)throw\"Visitor requires Adobe Marketing Cloud Org ID\";var a=this;a.version=\"1.9.1\";var m=window,l=m.Visitor;l.version=a.version;m.s_c_in||(m.s_c_il=[],m.s_c_in=0);a._c=\"Visitor\";a._il=m.s_c_il;a._in=m.s_c_in;a._il[a._in]=a;m.s_c_in++;a.ja={Fa:[]};var u=m.document,i=l.Cb;i||(i=null);var E=l.Db;E||(E=void 0);var j=l.Oa;j||(j=!0);var k=l.Ma;k||(k=!1);a.fa=function(a){var c=0,b,e;if(a)for(b=0;b<a.length;b++)e=a.charCodeAt(b),c=(c<<5)-c+e,c&=c;return c};a.s=function(a,c){var b=\"0123456789\",e=\"\",f=\"\",g,h,i=8,k=10,l=10;c===n&&(w.isClientSideMarketingCloudVisitorID=j);if(1==a){b+=\"ABCDEF\";for(g=0;16>g;g++)h=Math.floor(Math.random()*i),e+=b.substring(h,h+1),h=Math.floor(Math.random()*i),f+=b.substring(h,h+1),i=16;return e+\n\"-\"+f}for(g=0;19>g;g++)h=Math.floor(Math.random()*k),e+=b.substring(h,h+1),0==g&&9==h?k=3:(1==g||2==g)&&10!=k&&2>h?k=10:2<g&&(k=10),h=Math.floor(Math.random()*l),f+=b.substring(h,h+1),0==g&&9==h?l=3:(1==g||2==g)&&10!=l&&2>h?l=10:2<g&&(l=10);return e+f};a.Ra=function(){var a;!a&&m.location&&(a=m.location.hostname);if(a)if(/^[0-9.]+$/.test(a))a=\"\";else{var c=a.split(\".\"),b=c.length-1,e=b-1;1<b&&2>=c[b].length&&(2==c[b-1].length||0>\",ac,ad,ae,af,ag,ai,al,am,an,ao,aq,ar,as,at,au,aw,ax,az,ba,bb,be,bf,bg,bh,bi,bj,bm,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cd,cf,cg,ch,ci,cl,cm,cn,co,cr,cu,cv,cw,cx,cz,de,dj,dk,dm,do,dz,ec,ee,eg,es,et,eu,fi,fm,fo,fr,ga,gb,gd,ge,gf,gg,gh,gi,gl,gm,gn,gp,gq,gr,gs,gt,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,im,in,io,iq,ir,is,it,je,jo,jp,kg,ki,km,kn,kp,kr,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,me,mg,mh,mk,ml,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,na,nc,ne,nf,ng,nl,no,nr,nu,nz,om,pa,pe,pf,ph,pk,pl,pm,pn,pr,ps,pt,pw,py,qa,re,ro,rs,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sx,sy,sz,tc,td,tf,tg,th,tj,tk,tl,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,yt,\".indexOf(\",\"+\nc[b]+\",\"))&&e--;if(0<e)for(a=\"\";b>=e;)a=c[b]+(a?\".\":\"\")+a,b--}return a};a.cookieRead=function(a){var a=encodeURIComponent(a),c=(\";\"+u.cookie).split(\" \").join(\";\"),b=c.indexOf(\";\"+a+\"=\"),e=0>b?b:c.indexOf(\";\",b+1);return 0>b?\"\":decodeURIComponent(c.substring(b+2+a.length,0>e?c.length:e))};a.cookieWrite=function(d,c,b){var e=a.cookieLifetime,f,c=\"\"+c,e=e?(\"\"+e).toUpperCase():\"\";b&&\"SESSION\"!=e&&\"NONE\"!=e?(f=\"\"!=c?parseInt(e?e:0,10):-60)?(b=new Date,b.setTime(b.getTime()+1E3*f)):1==b&&(b=new Date,f=b.getYear(),b.setYear(f+2+(1900>f?1900:0))):b=0;return d&&\"NONE\"!=e?(u.cookie=encodeURIComponent(d)+\"=\"+encodeURIComponent(c)+\"; path=/;\"+(b?\" expires=\"+b.toGMTString()+\";\":\"\")+(a.cookieDomain?\" domain=\"+a.cookieDomain+\";\":\"\"),a.cookieRead(d)==c):0};a.h=i;a.J=function(a,c){try{\"function\"==typeof a?a.apply(m,c):a[1].apply(a[0],c)}catch(b){}};a.Xa=function(d,c){c&&(a.h==i&&(a.h={}),a.h[d]==E&&(a.h[d]=[]),a.h[d].push(c))};a.r=function(d,c){if(a.h!=i){var b=a.h[d];if(b)for(;0<b.length;)a.J(b.shift(),c)}};a.v=function(a,c,b,e){b=encodeURIComponent(c)+\"=\"+encodeURIComponent(b);c=x.vb(a);a=x.mb(a);if(-1===a.indexOf(\"?\"))return a+\"?\"+b+c;var f=a.split(\"?\"),a=f[0]+\"?\",e=x.$a(f[1],b,e);return a+e+c};a.Qa=function(a,c){var b=RegExp(\"[\\\\?&#]\"+c+\"=([^&#]*)\").exec(a);if(b&&b.length)return decodeURIComponent(b[1])};a.Wa=function(){var d=i,c=m.location.href;try{var b=a.Qa(c,r.Z);if(b)for(var d={},e=b.split(\"|\"),c=0,f=e.length;c<f;c++){var g=e[c].split(\"=\");d[g[0]]=decodeURIComponent(g[1])}return d}catch(h){}};a.ba=function(){var d=a.Wa();if(d&&d.TS&&!(((new Date).getTime()-d.TS)/6E4>r.Ka||d[I]!==q)){var c=d[n],b=a.setMarketingCloudVisitorID;c&&c.match(r.u)&&b(c);a.j(s,-1);d=d[p];c=a.setAnalyticsVisitorID;d&&d.match(r.u)&&c(d)}};a.Va=function(d){function c(d){x.pb(d)&&a.setCustomerIDs(d)}function b(d){d=d||{};a._supplementalDataIDCurrent=d.supplementalDataIDCurrent||\"\";a._supplementalDataIDCurrentConsumed=d.supplementalDataIDCurrentConsumed||{};a._supplementalDataIDLast=d.supplementalDataIDLast||\"\";a._supplementalDataIDLastConsumed=d.supplementalDataIDLastConsumed||{}}d&&d[a.marketingCloudOrgID]&&(d=d[a.marketingCloudOrgID],c(d.customerIDs),b(d.sdid))};a.l=i;a.Ta=function(d,c,b,e){c=a.v(c,\"d_fieldgroup\",d,1);e.url=a.v(e.url,\"d_fieldgroup\",d,1);e.m=a.v(e.m,\"d_fieldgroup\",d,1);w.d[d]=j;e===Object(e)&&e.m&&\"XMLHttpRequest\"===a.la.C.D?a.la.ib(e,b,d):a.useCORSOnly||a.ia(d,c,b)};a.ia=function(d,c,b){var e=0,f=0,g;if(c&&u){for(g=0;!e&&2>g;){try{e=(e=u.getElementsByTagName(0<g?\"HEAD\":\"head\"))&&0<e.length?e[0]:0}catch(h){e=0}g++}if(!e)try{u.body&&(e=u.body)}catch(k){e=0}if(e)for(g=0;!f&&2>g;){try{f=u.createElement(0<g?\"SCRIPT\":\"script\")}catch(l){f=0}g++}}!c||!e||!f?b&&b():(f.type=\"text/javascript\",f.src=c,e.firstChild?e.insertBefore(f,e.firstChild):e.appendChild(f),e=a.loadTimeout,o.d[d]={requestStart:o.o(),url:c,ta:e,ra:o.ya(),sa:0},b&&(a.l==i&&(a.l={}),a.l[d]=setTimeout(function(){b(j)},e)),a.ja.Fa.push(c))};a.Pa=function(d){a.l!=i&&a.l[d]&&(clearTimeout(a.l[d]),a.l[d]=0)};a.ga=k;a.ha=k;a.isAllowed=function(){if(!a.ga&&(a.ga=j,a.cookieRead(a.cookieName)||a.cookieWrite(a.cookieName,\"T\",1)))a.ha=j;return a.ha};a.b=i;a.c=i;var F=l.Ub;F||(F=\"MC\");var n=l.ac;n||(n=\"MCMID\");var I=l.Yb;I||(I=\"MCORGID\");var H=l.Vb;H||(H=\"MCCIDH\");var L=l.Zb;L||(L=\"MCSYNCS\");var J=l.$b;J||(J=\"MCSYNCSOP\");var K=l.Wb;K||(K=\"MCIDTS\");var B=l.Xb;B||(B=\"MCOPTOUT\");var D=l.Sb;D||(D=\"A\");var p=l.Pb;p||(p=\"MCAID\");var C=l.Tb;C||(C=\"AAM\");var A=l.Rb;A||(A=\"MCAAMLH\");var s=l.Qb;s||(s=\"MCAAMB\");var t=l.bc;t||(t=\"NONE\");a.L=0;a.ea=function(){if(!a.L){var d=a.version;a.audienceManagerServer&&(d+=\"|\"+a.audienceManagerServer);a.audienceManagerServerSecure&&(d+=\"|\"+a.audienceManagerServerSecure);a.L=a.fa(d)}return a.L};a.ka=k;a.f=function(){if(!a.ka){a.ka=j;var d=a.ea(),c=k,b=a.cookieRead(a.cookieName),e,f,g,h,l=new Date;a.b==i&&(a.b={});if(b&&\"T\"!=b){b=b.split(\"|\");b[0].match(/^[\\-0-9]+$/)&&(parseInt(b[0],10)!=d&&(c=j),b.shift());1==b.length%2&&b.pop();for(d=0;d<b.length;d+=2)if(e=b[d].split(\"-\"),f=e[0],g=b[d+1],1<e.length?(h=parseInt(e[1],10),e=0<e[1].indexOf(\"s\")):(h=0,e=k),c&&(f==H&&(g=\"\"),0<h&&(h=l.getTime()/1E3-60)),f&&g&&(a.e(f,g,1),0<h&&(a.b[\"expire\"+f]=h+(e?\"s\":\"\"),l.getTime()>=1E3*h||e&&!a.cookieRead(a.sessionCookieName))))a.c||(a.c={}),a.c[f]=j}c=a.loadSSL?!!a.trackingServerSecure:!!a.trackingServer;if(!a.a(p)&&c&&(b=a.cookieRead(\"s_vi\")))b=b.split(\"|\"),1<b.length&&0<=b[0].indexOf(\"v1\")&&(g=b[1],d=g.indexOf(\"[\"),0<=d&&(g=g.substring(0,d)),g&&g.match(r.u)&&a.e(p,g))}};a.Za=function(){var d=a.ea(),c,b;for(c in a.b)!Object.prototype[c]&&a.b[c]&&\"expire\"!=c.substring(0,6)&&(b=a.b[c],d+=(d?\"|\":\"\")+c+(a.b[\"expire\"+c]?\"-\"+a.b[\"expire\"+c]:\"\")+\"|\"+b);a.cookieWrite(a.cookieName,d,1)};a.a=function(d,c){return a.b!=i&&(c||!a.c||!a.c[d])?a.b[d]:i};a.e=function(d,c,b){a.b==i&&(a.b={});a.b[d]=c;b||a.Za()};a.Sa=function(d,c){var b=a.a(d,c);return b?b.split(\"*\"):i};a.Ya=function(d,c,b){a.e(d,c?c.join(\"*\"):\"\",b)};a.Jb=function(d,c){var b=a.Sa(d,c);if(b){var e={},f;for(f=0;f<b.length;f+=2)e[b[f]]=b[f+1];return e}return i};a.Lb=function(d,c,b){var e=i,f;if(c)for(f in e=[],c)Object.prototype[f]||(e.push(f),e.push(c[f]));a.Ya(d,e,b)};a.j=function(d,c,b){var e=new Date;e.setTime(e.getTime()+1E3*c);a.b==i&&(a.b={});a.b[\"expire\"+d]=Math.floor(e.getTime()/1E3)+(b?\"s\":\"\");0>c?(a.c||(a.c={}),a.c[d]=j):a.c&&(a.c[d]=k);b&&(a.cookieRead(a.sessionCookieName)||a.cookieWrite(a.sessionCookieName,\"1\"))};a.da=function(a){if(a&&(\"object\"==typeof a&&(a=a.d_mid?a.d_mid:a.visitorID?a.visitorID:a.id?a.id:a.uuid?a.uuid:\"\"+a),a&&(a=a.toUpperCase(),\"NOTARGET\"==a&&(a=t)),!a||a!=t&&!a.match(r.u)))a=\"\";return a};a.k=function(d,c){a.Pa(d);a.i!=i&&(a.i[d]=k);o.d[d]&&(o.d[d].Ab=o.o(),o.I(d));w.d[d]&&w.Ha(d,k);if(d==F){w.isClientSideMarketingCloudVisitorID!==j&&(w.isClientSideMarketingCloudVisitorID=k);var b=a.a(n);if(!b||a.overwriteCrossDomainMCIDAndAID){b=\"object\"==typeof c&&c.mid?c.mid:a.da(c);if(!b){if(a.B){a.getAnalyticsVisitorID(i,k,j);return}b=a.s(0,n)}a.e(n,b)}if(!b||b==t)b=\"\";\"object\"==typeof c&&((c.d_region||c.dcs_region||c.d_blob||c.blob)&&a.k(C,c),a.B&&c.mid&&a.k(D,{id:c.id}));a.r(n,[b])}if(d==C&&\"object\"==typeof c){b=604800;c.id_sync_ttl!=E&&c.id_sync_ttl&&(b=parseInt(c.id_sync_ttl,10));var e=a.a(A);e||((e=c.d_region)||(e=c.dcs_region),e&&(a.j(A,b),a.e(A,e)));e||(e=\"\");a.r(A,[e]);e=a.a(s);if(c.d_blob||c.blob)(e=c.d_blob)||(e=c.blob),a.j(s,b),a.e(s,e);e||(e=\"\");a.r(s,[e]);!c.error_msg&&a.A&&a.e(H,a.A)}if(d==D){b=a.a(p);if(!b||a.overwriteCrossDomainMCIDAndAID)(b=a.da(c))?b!==t&&a.j(s,-1):b=t,a.e(p,b);if(!b||b==t)b=\"\";a.r(p,[b])}a.idSyncDisableSyncs?z.za=j:(z.za=k,b={},b.ibs=c.ibs,b.subdomain=c.subdomain,z.wb(b));if(c===Object(c)){var f;a.isAllowed()&&(f=a.a(B));f||(f=t,c.d_optout&&c.d_optout instanceof Array&&(f=c.d_optout.join(\",\")),b=parseInt(c.d_ottl,10),isNaN(b)&&(b=7200),a.j(B,b,j),a.e(B,f));a.r(B,[f])}};a.i=i;a.t=function(d,c,b,e,f){var g=\"\",h,k=x.ob(d);if(a.isAllowed()&&(a.f(),g=a.a(d,M[d]===j),a.disableThirdPartyCalls&&!g&&(d===n?(g=a.s(0,n),a.setMarketingCloudVisitorID(g)):d===p&&!k&&(g=\"\",a.setAnalyticsVisitorID(g))),(!g||a.c&&a.c[d])&&(!a.disableThirdPartyCalls||k)))if(d==n||d==B?h=F:d==A||d==s?h=C:d==p&&(h=D),h){if(c&&(a.i==i||!a.i[h]))a.i==i&&(a.i={}),a.i[h]=j,a.Ta(h,c,function(c,b){if(!a.a(d))if(o.d[h]&&(o.d[h].timeout=o.o(),o.d[h].nb=!!c,o.I(h)),b===Object(b)&&!a.useCORSOnly)a.ia(h,b.url,b.G);else{c&&w.Ha(h,j);var e=\"\";d==n?e=a.s(0,n):h==C&&(e={error_msg:\"timeout\"});a.k(h,e)}},f);if(g)return g;a.Xa(d,b);c||a.k(h,{id:t});return\"\"}if((d==n||d==p)&&g==t)g=\"\",e=j;b&&(e||a.disableThirdPartyCalls)&&a.J(b,[g]);return g};a._setMarketingCloudFields=function(d){a.f();a.k(F,d)};a.setMarketingCloudVisitorID=function(d){a._setMarketingCloudFields(d)};a.B=k;a.getMarketingCloudVisitorID=function(d,c){if(a.isAllowed()){a.marketingCloudServer&&0>a.marketingCloudServer.indexOf(\".demdex.net\")&&(a.B=j);var b=a.z(\"_setMarketingCloudFields\");return a.t(n,b.url,d,c,b)}return\"\"};a.Ua=function(){a.getAudienceManagerBlob()};l.AuthState={UNKNOWN:0,AUTHENTICATED:1,LOGGED_OUT:2};a.w={};a.ca=k;a.A=\"\";a.setCustomerIDs=function(d){if(a.isAllowed()&&d){a.f();var c,b;for(c in d)if(!Object.prototype[c]&&(b=d[c]))if(\"object\"==typeof b){var e={};b.id&&(e.id=b.id);b.authState!=E&&(e.authState=b.authState);a.w[c]=e}else a.w[c]={id:b};var d=a.getCustomerIDs(),e=a.a(H),f=\"\";e||(e=0);for(c in d)Object.prototype[c]||(b=d[c],f+=(f?\"|\":\"\")+c+\"|\"+(b.id?b.id:\"\")+(b.authState?b.authState:\"\"));a.A=a.fa(f);a.A!=e&&(a.ca=j,a.Ua())}};a.getCustomerIDs=function(){a.f();var d={},c,b;for(c in a.w)Object.prototype[c]||(b=a.w[c],d[c]||(d[c]={}),b.id&&(d[c].id=b.id),d[c].authState=b.authState!=E?b.authState:l.AuthState.UNKNOWN);return d};a._setAnalyticsFields=function(d){a.f();a.k(D,d)};a.setAnalyticsVisitorID=function(d){a._setAnalyticsFields(d)};a.getAnalyticsVisitorID=function(d,c,b){if(a.isAllowed()){var e=\"\";b||(e=a.getMarketingCloudVisitorID(function(){a.getAnalyticsVisitorID(d,j)}));if(e||b){var f=b?a.marketingCloudServer:a.trackingServer,g=\"\";a.loadSSL&&(b?a.marketingCloudServerSecure&&(f=a.marketingCloudServerSecure):a.trackingServerSecure&&(f=a.trackingServerSecure));var h={};if(f){var f=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+f+\"/id\",e=\"d_visid_ver=\"+\na.version+\"&mcorgid=\"+encodeURIComponent(a.marketingCloudOrgID)+(e?\"&mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\"),i=[\"s_c_il\",a._in,\"_set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\"],g=f+\"?\"+e+\"&callback=s_c_il%5B\"+a._in+\"%5D._set\"+(b?\"MarketingCloud\":\"Analytics\")+\"Fields\";h.m=f+\"?\"+e;h.oa=i}h.url=g;return a.t(b?n:p,g,d,c,h)}}return\"\"};a._setAudienceManagerFields=function(d){a.f();a.k(C,d)};a.z=function(d){var c=a.audienceManagerServer,b=\"\",e=a.a(n),f=a.a(s,j),g=a.a(p),g=g&&g!=t?\"&d_cid_ic=AVID%01\"+encodeURIComponent(g):\"\";a.loadSSL&&a.audienceManagerServerSecure&&(c=a.audienceManagerServerSecure);if(c){var b=a.getCustomerIDs(),h,i;if(b)for(h in b)Object.prototype[h]||(i=b[h],g+=\"&d_cid_ic=\"+encodeURIComponent(h)+\"%01\"+encodeURIComponent(i.id?i.id:\"\")+(i.authState?\"%01\"+i.authState:\"\"));d||(d=\"_setAudienceManagerFields\");c=\"http\"+(a.loadSSL?\"s\":\"\")+\"://\"+c+\"/id\";e=\"d_visid_ver=\"+a.version+\"&d_rtbd=json&d_ver=2\"+(!e&&a.B?\"&d_verify=1\":\"\")+\"&d_orgid=\"+encodeURIComponent(a.marketingCloudOrgID)+\n\"&d_nsid=\"+(a.idSyncContainerID||0)+(e?\"&d_mid=\"+encodeURIComponent(e):\"\")+(a.idSyncDisable3rdPartySyncing?\"&d_coppa=true\":\"\")+(f?\"&d_blob=\"+encodeURIComponent(f):\"\")+g;f=[\"s_c_il\",a._in,d];b=c+\"?\"+e+\"&d_cb=s_c_il%5B\"+a._in+\"%5D.\"+d;return{url:b,m:c+\"?\"+e,oa:f}}return{url:b}};a.getAudienceManagerLocationHint=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerLocationHint(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerLocationHint(d,j)}));if(b)return b=a.z(),a.t(A,b.url,d,c,b)}return\"\"};a.getLocationHint=a.getAudienceManagerLocationHint;a.getAudienceManagerBlob=function(d,c){if(a.isAllowed()&&a.getMarketingCloudVisitorID(function(){a.getAudienceManagerBlob(d,j)})){var b=a.a(p);b||(b=a.getAnalyticsVisitorID(function(){a.getAudienceManagerBlob(d,j)}));if(b){var b=a.z(),e=b.url;a.ca&&a.j(s,-1);return a.t(s,e,d,c,b)}}return\"\"};a._supplementalDataIDCurrent=\"\";a._supplementalDataIDCurrentConsumed={};a._supplementalDataIDLast=\"\";a._supplementalDataIDLastConsumed={};a.getSupplementalDataID=function(d,c){!a._supplementalDataIDCurrent&&!c&&(a._supplementalDataIDCurrent=a.s(1));var b=a._supplementalDataIDCurrent;a._supplementalDataIDLast&&!a._supplementalDataIDLastConsumed[d]?(b=a._supplementalDataIDLast,a._supplementalDataIDLastConsumed[d]=j):b&&(a._supplementalDataIDCurrentConsumed[d]&&(a._supplementalDataIDLast=a._supplementalDataIDCurrent,a._supplementalDataIDLastConsumed=a._supplementalDataIDCurrentConsumed,a._supplementalDataIDCurrent=b=!c?a.s(1):\"\",a._supplementalDataIDCurrentConsumed={}),b&&(a._supplementalDataIDCurrentConsumed[d]=j));return b};l.OptOut={GLOBAL:\"global\"};a.getOptOut=function(d,c){if(a.isAllowed()){var b=a.z(\"_setMarketingCloudFields\");return a.t(B,b.url,d,c,b)}return\"\"};a.isOptedOut=function(d,c,b){return a.isAllowed()?(c||(c=l.OptOut.GLOBAL),(b=a.getOptOut(function(b){a.J(d,[b==l.OptOut.GLOBAL||0<=b.indexOf(c)])},b))?b==l.OptOut.GLOBAL||0<=b.indexOf(c):i):k};a.appendVisitorIDsTo=function(d){var c=r.Z,b=y([[n,a.a(n)],[p,a.a(p)],[I,a.marketingCloudOrgID]]);try{return a.v(d,c,b)}catch(e){return d}};var r={q:!!m.postMessage,La:1,aa:864E5,Z:\"adobe_mc\",u:/^[0-9a-fA-F\\-]+$/,Ka:5};a.Eb=r;a.na={postMessage:function(a,c,b){var e=1;c&&(r.q?b.postMessage(a,c.replace(/([^:]+:\\/\\/[^\\/]+).*/,\"$1\")):c&&(b.location=c.replace(/#.*$/,\"\")+\"#\"+ +new Date+e++ +\"&\"+a))},U:function(a,c){var b;try{if(r.q)if(a&&(b=function(b){if(\"string\"===typeof c&&b.origin!==c||\"[object Function]\"===Object.prototype.toString.call(c)&&!1===c(b.origin))return!1;a(b)}),window.addEventListener)window[a?\"addEventListener\":\"removeEventListener\"](\"message\",b,!1);else window[a?\"attachEvent\":\"detachEvent\"](\"onmessage\",b)}catch(e){}}};var x={M:function(){if(u.addEventListener)return function(a,c,b){a.addEventListener(c,function(a){\"function\"===typeof b&&b(a)},k)};if(u.attachEvent)return function(a,c,b){a.attachEvent(\"on\"+c,function(a){\"function\"===typeof b&&b(a)})}}(),map:function(a,c){if(Array.prototype.map)return a.map(c);if(void 0===a||a===i)throw new TypeError;var b=Object(a),e=b.length>>>0;if(\"function\"!==typeof c)throw new TypeError;for(var f=Array(e),g=0;g<e;g++)g in b&&(f[g]=c.call(c,b[g],g,b));return f},va:function(a,c){return this.map(a,function(a){return encodeURIComponent(a)}).join(c)},vb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(c):\"\"},mb:function(a){var c=a.indexOf(\"#\");return 0<c?a.substr(0,c):a},$a:function(a,c,b){a=a.split(\"&\");b=b!=i?b:a.length;a.splice(b,0,c);return a.join(\"&\")},ob:function(d,c,b){if(d!==p)return k;c||(c=a.trackingServer);b||(b=a.trackingServerSecure);d=a.loadSSL?b:c;return\"string\"===typeof d&&d.length?0>d.indexOf(\"2o7.net\")&&0>d.indexOf(\"omtrdc.net\"):k},pb:function(a){return Boolean(a&&a===Object(a))}};a.Kb=x;var N={C:function(){var a=\"none\",c=j;\"undefined\"!==typeof XMLHttpRequest&&XMLHttpRequest===Object(XMLHttpRequest)&&(\"withCredentials\"in new XMLHttpRequest?a=\"XMLHttpRequest\":(new Function(\"/*@cc_on return /^10/.test(@_jscript_version) @*/\"))()?a=\"XMLHttpRequest\":\"undefined\"!==typeof XDomainRequest&&XDomainRequest===Object(XDomainRequest)&&(c=k),0<Object.prototype.toString.call(window.Bb).indexOf(\"Constructor\")&&(c=k));return{D:a,Nb:c}}(),jb:function(){return\"none\"===this.C.D?i:new window[this.C.D]},ib:function(d,c,b){var e=this;c&&(d.G=c);try{var f=this.jb();f.open(\"get\",d.m+\"&ts=\"+(new Date).getTime(),j);\"XMLHttpRequest\"===this.C.D&&(f.withCredentials=j,f.timeout=a.loadTimeout,f.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),f.onreadystatechange=function(){if(4===this.readyState&&200===this.status)a:{var a;try{if(a=JSON.parse(this.responseText),a!==Object(a)){e.n(d,i,\"Response is not JSON\");break a}}catch(c){e.n(d,c,\"Error parsing response as JSON\");break a}try{for(var b=d.oa,f=window,g=0;g<b.length;g++)f=f[b[g]];f(a)}catch(j){e.n(d,j,\"Error forming callback function\")}}});f.onerror=function(a){e.n(d,a,\"onerror\")};f.ontimeout=function(a){e.n(d,a,\"ontimeout\")};f.send();o.d[b]={requestStart:o.o(),url:d.m,ta:f.timeout,ra:o.ya(),sa:1};a.ja.Fa.push(d.m)}catch(g){this.n(d,g,\"try-catch\")}},n:function(d,c,b){a.CORSErrors.push({Ob:d,error:c,description:b});d.G&&(\"ontimeout\"===b?d.G(j):d.G(k,d))}};a.la=N;var z={Na:3E4,$:649,Ja:k,id:i,T:[],Q:i,xa:function(a){if(\"string\"===typeof a)return a=a.split(\"/\"),a[0]+\"//\"+a[2]},g:i,url:i,kb:function(){var d=\"http://fast.\",c=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);this.g||(this.g=\"nosubdomainreturned\");a.loadSSL&&(d=a.idSyncSSLUseAkamai?\"https://fast.\":\"https://\");d=d+this.g+\".demdex.net/dest5.html\"+c;this.Q=this.xa(d);this.id=\"destination_publishing_iframe_\"+this.g+\"_\"+a.idSyncContainerID;return d},cb:function(){var d=\"?d_nsid=\"+a.idSyncContainerID+\"#\"+encodeURIComponent(u.location.href);\"string\"===typeof a.K&&a.K.length&&(this.id=\"destination_publishing_iframe_\"+(new Date).getTime()+\"_\"+a.idSyncContainerID,this.Q=this.xa(a.K),this.url=a.K+d)},za:i,ua:k,W:k,F:i,cc:i,ub:i,dc:i,V:k,H:[],sb:[],tb:[],Ba:r.q?15:100,R:[],qb:[],pa:j,Ea:k,Da:function(){return!a.idSyncDisable3rdPartySyncing&&(this.ua||a.Gb)&&this.g&&\"nosubdomainreturned\"!==this.g&&this.url&&!this.W},O:function(){function a(){e=document.createElement(\"iframe\");e.sandbox=\"allow-scripts allow-same-origin\";e.title=\"Adobe ID Syncing iFrame\";e.id=b.id;e.style.cssText=\"display: none; width: 0; height: 0;\";e.src=b.url;b.ub=j;c();document.body.appendChild(e)}function c(){x.M(e,\"load\",function(){e.className=\"aamIframeLoaded\";b.F=j;b.p()})}this.W=j;var b=this,e=document.getElementById(this.id);e?\"IFRAME\"!==e.nodeName?(this.id+=\"_2\",a()):\"aamIframeLoaded\"!==e.className?c():(this.F=j,this.Aa=e,this.p()):a();this.Aa=e},p:function(d){var c=this;d===Object(d)&&(this.R.push(d),this.xb(d));if((this.Ea||!r.q||this.F)&&this.R.length)this.I(this.R.shift()),this.p();!a.idSyncDisableSyncs&&this.F&&this.H.length&&!this.V&&(this.Ja||(this.Ja=j,setTimeout(function(){c.Ba=r.q?15:150},this.Na)),this.V=j,this.Ga())},xb:function(a){var c,b,e;if((c=a.ibs)&&c instanceof Array&&(b=c.length))for(a=0;a<b;a++)e=c[a],e.syncOnPage&&this.qa(e,\"\",\"syncOnPage\")},I:function(a){var c=encodeURIComponent,b,e,f,g,h;if((b=a.ibs)&&b instanceof Array&&(e=b.length))for(f=0;f<e;f++)g=b[f],h=[c(\"ibs\"),c(g.id||\"\"),c(g.tag||\"\"),x.va(g.url||[],\",\"),c(g.ttl||\"\"),\"\",\"\",g.fireURLSync?\"true\":\"false\"],g.syncOnPage||(this.pa?this.N(h.join(\"|\")):g.fireURLSync&&this.qa(g,h.join(\"|\")));this.qb.push(a)},qa:function(d,c,b){var e=(b=\"syncOnPage\"===b?j:k)?J:L;a.f();var f=a.a(e),g=k,h=k,i=Math.ceil((new Date).getTime()/r.aa);f?(f=f.split(\"*\"),h=this.yb(f,d.id,i),g=h.gb,h=h.hb,(!g||!h)&&this.wa(b,d,c,f,e,i)):(f=[],this.wa(b,d,c,f,e,i))},yb:function(a,c,b){var e=k,f=k,g,h,i;for(h=0;h<a.length;h++)g=a[h],i=parseInt(g.split(\"-\")[1],10),g.match(\"^\"+c+\"-\")?(e=j,b<i?f=j:(a.splice(h,1),h--)):b>=i&&(a.splice(h,1),h--);return{gb:e,hb:f}},rb:function(a){if(a.join(\"*\").length>this.$)for(a.sort(function(a,b){return parseInt(a.split(\"-\")[1],10)-parseInt(b.split(\"-\")[1],10)});a.join(\"*\").length>this.$;)a.shift()},wa:function(d,c,b,e,f,g){var h=this;if(d){if(\"img\"===c.tag){var d=c.url,b=a.loadSSL?\"https:\":\"http:\",j,k,l;for(e=0,j=d.length;e<j;e++){k=d[e];l=/^\\/\\//.test(k);var m=new Image;x.M(m,\"load\",function(b,c,d,e){return function(){h.T[b]=i;a.f();var g=a.a(f),j=[];if(g){var g=g.split(\"*\"),k,l,m;for(k=0,l=g.length;k<l;k++)m=g[k],m.match(\"^\"+c.id+\"-\")||j.push(m)}h.Ia(j,c,d,e)}}(this.T.length,c,f,g));m.src=(l?b:\"\")+k;this.T.push(m)}}}else this.N(b),this.Ia(e,c,f,g)},N:function(d){var c=encodeURIComponent;this.H.push((a.Hb?c(\"---destpub-debug---\"):c(\"---destpub---\"))+d)},Ia:function(d,c,b,e){d.push(c.id+\"-\"+(e+Math.ceil(c.ttl/60/24)));this.rb(d);a.e(b,d.join(\"*\"))},Ga:function(){var d=this,c;this.H.length?(c=this.H.shift(),a.na.postMessage(c,this.url,this.Aa.contentWindow),this.sb.push(c),setTimeout(function(){d.Ga()},this.Ba)):this.V=k},U:function(a){var c=/^---destpub-to-parent---/;\"string\"===typeof a&&c.test(a)&&(c=a.replace(c,\"\").split(\"|\"),\"canSetThirdPartyCookies\"===c[0]&&(this.pa=\"true\"===c[1]?j:k,this.Ea=j,this.p()),this.tb.push(a))},wb:function(d){if(this.url===i||d.subdomain&&\"nosubdomainreturned\"===this.g)this.g=\"string\"===typeof a.ma&&a.ma.length?a.ma:d.subdomain||\"\",this.url=this.kb();d.ibs instanceof Array&&d.ibs.length&&(this.ua=j);this.Da()&&(a.idSyncAttachIframeOnWindowLoad?(l.Y||\"complete\"===u.readyState||\"loaded\"===u.readyState)&&this.O():this.ab());\"function\"===typeof a.idSyncIDCallResult?a.idSyncIDCallResult(d):this.p(d);\"function\"===typeof a.idSyncAfterIDCallResult&&a.idSyncAfterIDCallResult(d)},bb:function(d,c){return a.Ib||!d||c-d>r.La},ab:function(){function a(){c.W||(document.body?c.O():setTimeout(a,30))}var c=this;a()}};a.Fb=z;a.timeoutMetricsLog=[];var o={fb:window.performance&&window.performance.timing?1:0,Ca:window.performance&&window.performance.timing?window.performance.timing:i,X:i,P:i,d:{},S:[],send:function(d){if(a.takeTimeoutMetrics&&d===Object(d)){var c=[],b=encodeURIComponent,e;for(e in d)d.hasOwnProperty(e)&&c.push(b(e)+\"=\"+b(d[e]));d=\"http\"+(a.loadSSL?\"s\":\"\")+\"://dpm.demdex.net/event?d_visid_ver=\"+a.version+\"&d_visid_stg_timeout=\"+a.loadTimeout+\"&\"+c.join(\"&\")+\"&d_orgid=\"+b(a.marketingCloudOrgID)+\"&d_timingapi=\"+this.fb+\"&d_winload=\"+this.lb()+\"&d_ld=\"+this.o();(new Image).src=d;a.timeoutMetricsLog.push(d)}},lb:function(){this.P===i&&(this.P=this.Ca?this.X-this.Ca.navigationStart:this.X-l.eb);return this.P},o:function(){return(new Date).getTime()},I:function(a){var c=this.d[a],b={};b.d_visid_stg_timeout_captured=c.ta;b.d_visid_cors=c.sa;b.d_fieldgroup=a;b.d_settimeout_overriden=c.ra;c.timeout?c.nb?(b.d_visid_timedout=1,b.d_visid_timeout=c.timeout-c.requestStart,b.d_visid_response=-1):(b.d_visid_timedout=\"n/a\",b.d_visid_timeout=\"n/a\",b.d_visid_response=\"n/a\"):(b.d_visid_timedout=0,b.d_visid_timeout=-1,b.d_visid_response=c.Ab-c.requestStart);b.d_visid_url=c.url;l.Y?this.send(b):this.S.push(b);delete this.d[a]},zb:function(){for(var a=0,c=this.S.length;a<c;a++)this.send(this.S[a])},ya:function(){return\"function\"===typeof setTimeout.toString?-1<setTimeout.toString().indexOf(\"[native code]\")?0:1:-1}};a.Mb=o;var w={isClientSideMarketingCloudVisitorID:i,MCIDCallTimedOut:i,AnalyticsIDCallTimedOut:i,AAMIDCallTimedOut:i,d:{},Ha:function(a,c){switch(a){case F:c===k?this.MCIDCallTimedOut!==j&&(this.MCIDCallTimedOut=k):this.MCIDCallTimedOut=c;break;case D:c===k?this.AnalyticsIDCallTimedOut!==j&&(this.AnalyticsIDCallTimedOut=k):this.AnalyticsIDCallTimedOut=c;break;case C:c===k?this.AAMIDCallTimedOut!==j&&(this.AAMIDCallTimedOut=k):this.AAMIDCallTimedOut=c}}};a.isClientSideMarketingCloudVisitorID=function(){return w.isClientSideMarketingCloudVisitorID};a.MCIDCallTimedOut=function(){return w.MCIDCallTimedOut};a.AnalyticsIDCallTimedOut=function(){return w.AnalyticsIDCallTimedOut};a.AAMIDCallTimedOut=function(){return w.AAMIDCallTimedOut};a.idSyncGetOnPageSyncInfo=function(){a.f();return a.a(J)};a.idSyncByURL=function(d){var c,b=d||{};c=b.minutesToLive;var e=\"\";a.idSyncDisableSyncs&&(e=e?e:\"Error: id syncs have been disabled\");if(\"string\"!==typeof b.dpid||!b.dpid.length)e=e?e:\"Error: config.dpid is empty\";if(\"string\"!==typeof b.url||!b.url.length)e=e?e:\"Error: config.url is empty\";if(\"undefined\"===typeof c)c=20160;else if(c=parseInt(c,10),isNaN(c)||0>=c)e=e?e:\"Error: config.minutesToLive needs to be a positive number\";c={error:e,ec:c};if(c.error)return c.error;var e=d.url,f=encodeURIComponent,b=z,g,e=e.replace(/^https:/,\"\").replace(/^http:/,\"\");g=x.va([\"\",d.dpid,d.dpuuid||\"\"],\",\");d=[\"ibs\",f(d.dpid),\"img\",f(e),c.ttl,\"\",g];b.N(d.join(\"|\"));b.p();return\"Successfully queued\"};a.idSyncByDataSource=function(d){if(d!==Object(d)||\"string\"!==typeof d.dpuuid||!d.dpuuid.length)return\"Error: config or config.dpuuid is empty\";d.url=\"//dpm.demdex.net/ibs:dpid=\"+d.dpid+\"&dpuuid=\"+d.dpuuid;return a.idSyncByURL(d)};0>q.indexOf(\"@\")&&(q+=\"@AdobeOrg\");a.marketingCloudOrgID=q;a.cookieName=\"AMCV_\"+q;a.sessionCookieName=\"AMCVS_\"+q;a.cookieDomain=a.Ra();a.cookieDomain==m.location.hostname&&(a.cookieDomain=\"\");a.loadSSL=0<=m.location.protocol.toLowerCase().indexOf(\"https\");a.loadTimeout=3E4;a.CORSErrors=[];a.marketingCloudServer=a.audienceManagerServer=\"dpm.demdex.net\";var M={};M[A]=j;M[s]=j;if(v&&\"object\"==typeof v){for(var G in v)!Object.prototype[G]&&(a[G]=v[G]);a.idSyncContainerID=a.idSyncContainerID||0;a.ba();a.f();N=a.a(K);G=Math.ceil((new Date).getTime()/\nr.aa);!a.idSyncDisableSyncs&&z.bb(N,G)&&(a.j(s,-1),a.e(K,G));a.getMarketingCloudVisitorID();a.getAudienceManagerLocationHint();a.getAudienceManagerBlob();a.Va(a.serverState)}else a.ba();if(!a.idSyncDisableSyncs){z.cb();x.M(window,\"load\",function(){l.Y=j;o.X=o.o();o.zb();var a=z;a.Da()&&a.O()});try{a.na.U(function(a){z.U(a.data)},z.Q)}catch(O){}}}", "function fingerprint(str){var utf8=utf8Encode(str);var _a=Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__read\"])([hash32(utf8,0),hash32(utf8,102072)],2),hi=_a[0],lo=_a[1];if(hi==0&&(lo==0||lo==1)){hi=hi^0x130f9bef;lo=lo^-0x6b5f56d8;}return[hi,lo];}", "initialize() {\n\n }", "function DWRUtil() { }", "function test() {\n var o35 = Object.getOwnPropertyDescriptor(Object.prototype, \"__proto__\").function(o1, o2)\n{\n var o3 = 0;\n var o4 = 0;\n try {\nfor (var o5 = 1; o5 < 10000; o5++)\n {\n try {\no3 = (o1.o3 + o1.o3 + o1.o3 + o1.o3 + o1.o3) & 0x3FFFF;\n}catch(e){}\n try {\no2.o3 = o3 + o4;\n}catch(e){}\n try {\no4 = (o1.o3 + o1.o3 + o1.o3 + o1.o3 + o1.o3) & 0xFFFF;\n}catch(e){}\n }\n}catch(e){}\n try {\nreturn o3 + o4;\n}catch(e){}\n};\n function o1() {\n }\n var o2 = ((o863 & 0x4000) >> Object.o157) | ((o863 & 0x40) >> 6);\n var o38 = o839.o906.o917(o308);\n var o6 = Array('Math.ceil((' + target + ')/');\n var o867 = this.o543[0x200 | (o768 >> 4)];\n var o8 = o1(\"willValidate\");\n try {\no21 = function () {\n try {\no337++;\n}catch(e){}\n };\n}catch(e){}\n try {\ntry { o1(\"MSGestureEvent\"); } catch(e) {}try { try {\no1(\"setImmediate\");\n}catch(e){} } catch(e) {}\n}catch(e){}\n try {\n({ o9: !o3.call(o2, o1, '!') });\n}catch(e){}\n try {\nif (o0 != 2)\n try {\nprint(\"FAIL\");\n}catch(e){}\n else\n try {\nprint(\"PASS\");\n}catch(e){}\n}catch(e){}\n}", "function DOMCryptAPI() {}", "function main() {\n\n}", "function WMCache(param, // @arg Object - { name, deny, allow, limit, garbage }\n callback, // @arg Function - cache ready callback(cache:WMCache, backend:StorageString):void\n errCallback) { // @arg Function - error callback(err:Error):void\n // @param.name String = \"void\" - application name\n // @param.deny URLStringArray = [] - deny URL pattern\n // @param.allow URLStringArray = [] - allow URL pattern\n // @param.garbage URLStringArray = [] - garbage URL pattern\n // @param.limit Integer = 0 - cache limit (unit MB)\n param = param || {};\n\n//{@dev\n $valid($type(param, \"Object\"), WMCache, \"param\");\n $valid($type(callback, \"Function\"), WMCache, \"callback\");\n $valid($type(errCallback, \"Function\"), WMCache, \"errCallback\");\n $valid($keys(param, \"name|deny|allow|garbage|limit\"), WMCache, \"param\");\n $valid($type(param.name, \"String|omit\"), WMCache, \"param.name\");\n $valid($type(param.deny, \"URLStringArray|omit\"), WMCache, \"param.deny\");\n $valid($type(param.allow, \"URLStringArray|omit\"), WMCache, \"param.allow\");\n $valid($type(param.garbage, \"URLStringArray|omit\"), WMCache, \"param.garbage\");\n $valid($type(param.limit, \"Integer|omit\"), WMCache, \"param.limit\");\n//}@dev\n\n var that = this;\n var name = param[\"name\"] || \"void\";\n var deny = param[\"deny\"] || [];\n var allow = param[\"allow\"] || [];\n var garbage = param[\"garbage\"] || [];\n\n this._limit = (param[\"limit\"] || 0) * 1024 * 1024; // to MB\n this._errCallback = errCallback;\n this._control = new WMCacheControl(allow, deny, garbage);\n this._storage = FS[\"ready\"] ? new FS(name, _ready, errCallback) :\n DB[\"ready\"] ? new DB(name, _ready, errCallback) :\n new BH(name, _ready, errCallback);\n function _ready() {\n callback(that);\n }\n}", "function t(e,t){/* istanbul ignore if */\nif(!e)throw new Error(\"ASSERT: \"+t)}", "function t(e,t){/* istanbul ignore if */\nif(!e)throw new Error(\"ASSERT: \"+t)}", "function pb(a,b){a.src=b instanceof ab&&b.constructor===ab?b.o:\"type_error:TrustedResourceUrl\";var c,d,e=(a.ownerDocument&&a.ownerDocument.defaultView||window).document,f=null===(d=e.querySelector)||void 0===d?void 0:d.call(e,\"script[nonce]\");(c=f?f.nonce||f.getAttribute(\"nonce\")||\"\":\"\")&&a.setAttribute(\"nonce\",c)}", "function main() {\n}", "function Zc(a, b) {\n var c = {\n nominative: \"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი\".split(\"_\"),\n accusative: \"იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს\".split(\"_\")\n }, d = /D[oD] *MMMM?/.test(b) ? \"accusative\" : \"nominative\";\n return c[d][a.month()]\n }", "function Bandcamp() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "initialize() {}", "function X(){!function(t){$[W++]^=255&t,$[W++]^=t>>8&255,$[W++]^=t>>16&255,$[W++]^=t>>24&255,W>=J&&(W-=J)}((new Date).getTime())}", "function cc(){var a;!(a=Ja()&&!Zb(10))&&(a=bc||ac)&&(a=!(0<=ua($b,10)));this.ae=a;this.fg=!(this.ae||Jb&&!Zb(10));!Jb||Zb(11);this.Ug=Ka()||Ja();this.ug=n(window.Map)&&n(window.Map.prototype.values)&&n(window.Map.prototype.forEach)&&!this.ae;this.vg=n(window.Set)&&n(window.Set.prototype.values)&&n(window.Set.prototype.forEach)&&!this.ae}", "function heyGoogle( name ) {\n // console.log(\"Yes Jacob?\");\n console.log(`Yes ${ name }?`);\n}", "function Gu(){return Gu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Gu.apply(this,arguments)}", "function HTTPUtil() {\n}", "function cov_2fpze8ad7p(){var path=\"/Users/federicolacabaratz/bootcamp/collab/skylab-bootcamp-202001/staff/federico-lacabaratz/share-my-spot/share-my-spot-api/logic/save-spot-photo.spec.js\";var hash=\"6075a72b2a405bb8817f93427c26829ae2e7ed0d\";var global=new Function(\"return this\")();var gcv=\"__coverage__\";var coverageData={path:\"/Users/federicolacabaratz/bootcamp/collab/skylab-bootcamp-202001/staff/federico-lacabaratz/share-my-spot/share-my-spot-api/logic/save-spot-photo.spec.js\",statementMap:{},fnMap:{},branchMap:{},s:{},f:{},b:{},_coverageSchema:\"1a1c01bbd47fc00a2c39e90264f33305004495a9\",hash:\"6075a72b2a405bb8817f93427c26829ae2e7ed0d\"};var coverage=global[gcv]||(global[gcv]={});if(!coverage[path]||coverage[path].hash!==hash){coverage[path]=coverageData;}var actualCoverage=coverage[path];cov_2fpze8ad7p=function(){return actualCoverage;};return actualCoverage;}", "static private internal function m121() {}", "function mock() {\n\twindow.SegmentString = Rng.Range;\n}", "function f(a,b,c){b=b||[],c=c||[];var d=/*istanbul ignore start*/void 0;for(d=0;d<b.length;d+=1)if(b[d]===a)return c[d];var e=/*istanbul ignore start*/void 0;if(\"[object Array]\"===k.call(a)){for(b.push(a),e=new Array(a.length),c.push(e),d=0;d<a.length;d+=1)e[d]=f(a[d],b,c);return b.pop(),c.pop(),e}if(a&&a.toJSON&&(a=a.toJSON()),/*istanbul ignore start*/\"object\"===(\"undefined\"==typeof/*istanbul ignore end*/a?\"undefined\":g(a))&&null!==a){b.push(a),e={},c.push(e);var h=[],i=/*istanbul ignore start*/void 0;for(i in a)/* istanbul ignore else */\na.hasOwnProperty(i)&&h.push(i);for(h.sort(),d=0;d<h.length;d+=1)i=h[d],e[i]=f(a[i],b,c);b.pop(),c.pop()}else e=a;return e}", "static transient final protected public internal function m46() {}", "function i(t){\"use strict\";var a=this,n=e;a.s=t,a._c=\"s_m\",n.s_c_in||(n.s_c_il=[],n.s_c_in=0),a._il=n.s_c_il,a._in=n.s_c_in,a._il[a._in]=a,n.s_c_in++,a.version=\"1.0\";var i,o,r,s=\"pending\",c=\"resolved\",d=\"rejected\",l=\"timeout\",u=!1,p={},m=[],g=[],f=0,b=!1,h=function(){var e={};e.requiredVarList=[\"supplementalDataID\",\"timestamp\",\"dynamicVariablePrefix\",\"visitorID\",\"marketingCloudVisitorID\",\"analyticsVisitorID\",\"audienceManagerLocationHint\",\"authState\",\"fid\",\"vmk\",\"visitorMigrationKey\",\"visitorMigrationServer\",\"visitorMigrationServerSecure\",\"charSet\",\"visitorNamespace\",\"cookieDomainPeriods\",\"fpCookieDomainPeriods\",\"cookieLifetime\",\"pageName\",\"pageURL\",\"referrer\",\"contextData\",\"currencyCode\",\"lightProfileID\",\"lightStoreForSeconds\",\"lightIncrementBy\",\"retrieveLightProfiles\",\"deleteLightProfiles\",\"retrieveLightData\"],e.accountVarList=e.requiredVarList.concat([\"purchaseID\",\"variableProvider\",\"channel\",\"server\",\"pageType\",\"transactionID\",\"campaign\",\"state\",\"zip\",\"events\",\"events2\",\"products\",\"audienceManagerBlob\",\"tnt\"]),e.lightRequiredVarList=[\"timestamp\",\"charSet\",\"visitorNamespace\",\"cookieDomainPeriods\",\"cookieLifetime\",\"contextData\",\"lightProfileID\",\"lightStoreForSeconds\",\"lightIncrementBy\"],e.lightVarList=e.lightRequiredVarList.slice(0),e.accountConfigList=[\"account\",\"allAccounts\",\"debugTracking\",\"visitor\",\"visitorOptedOut\",\"trackOffline\",\"offlineLimit\",\"offlineThrottleDelay\",\"offlineFilename\",\"usePlugins\",\"doPlugins\",\"configURL\",\"visitorSampling\",\"visitorSamplingGroup\",\"linkObject\",\"clickObject\",\"linkURL\",\"linkName\",\"linkType\",\"trackDownloadLinks\",\"trackExternalLinks\",\"trackClickMap\",\"trackInlineStats\",\"linkLeaveQueryString\",\"linkTrackVars\",\"linkTrackEvents\",\"linkDownloadFileTypes\",\"linkExternalFilters\",\"linkInternalFilters\",\"useForcedLinkTracking\",\"forcedLinkTrackingTimeout\",\"trackingServer\",\"trackingServerSecure\",\"ssl\",\"abort\",\"mobile\",\"dc\",\"lightTrackVars\",\"maxDelay\",\"expectSupplementalData\",\"usePostbacks\",\"AudienceManagement\"];for(var t=0;250>=t;t++)76>t&&(e.accountVarList.push(\"prop\"+t),e.lightVarList.push(\"prop\"+t)),e.accountVarList.push(\"eVar\"+t),e.lightVarList.push(\"eVar\"+t),6>t&&e.accountVarList.push(\"hier\"+t),4>t&&e.accountVarList.push(\"list\"+t);var a=[\"pe\",\"pev1\",\"pev2\",\"pev3\",\"latitude\",\"longitude\",\"resolution\",\"colorDepth\",\"javascriptVersion\",\"javaEnabled\",\"cookiesEnabled\",\"browserWidth\",\"browserHeight\",\"connectionType\",\"homepage\",\"pageURLRest\"];return e.accountVarList=e.accountVarList.concat(a),e.requiredVarList=e.requiredVarList.concat(a),e}();a.newCall=!1,a.newCallVariableOverrides=null,a.hitCount=0,a.timeout=1e3,a.currentHit=null,a.backup=function(e,t,a){var n,i,o,r;for(t=t||{},n=0;2>n;n++)for(i=n>0?h.accountConfigList:h.accountVarList,o=0;o<i.length;o++)r=i[o],t[r]=e[r],a||t[r]||(t[\"!\"+r]=1);return t},a.restore=function(e,t,a){var n,i,o,r,s,c,d=!0;for(n=0;2>n;n++)for(i=n>0?h.accountConfigList:h.accountVarList,o=0;o<i.length;o++)if(r=i[o],s=e[r],s||e[\"!\"+r]){if(!a&&(\"contextData\"==r||\"retrieveLightData\"==r)&&t[r])for(c in t[r])s[c]||(s[c]=t[r][c]);t[r]=s}return d},a.createHitMeta=function(e,t){var n,i=a.s,o=[],r=[];return t=t||{},n={id:e,delay:!1,restorePoint:f,status:c,promise:Promise.resolve(),backup:{s:{},sSet:{},variableOverrides:{}},values:{s:{},variableOverrides:{}},timeout:!1},o=a.replacePromises(i,n.values.s),r=a.replacePromises(t,n.values.variableOverrides),n.backup.s=a.backup(i),n.backup.sSet=a.backup(i,null,!0),n.backup.variableOverrides=t,(o&&o.length>0||r&&r.length>0)&&(n.delay=!0,n.status=s,n.promise=Promise.all([Promise.all(o),Promise.all(r)]).then(function(){n.delay=!1,n.status=c,n.timeout&&clearTimeout(n.timeout)}),a.timeout&&(n.timeout=setTimeout(function(){n.delay=!1,n.status=l,n.timeout&&clearTimeout(n.timeout),a.sendPendingHits()},a.timeout))),n},a.replacePromises=function(e,t){var a,n,i,o,r,l,u=[];t=t||{},o=function(e,t){return function(a){t[e].value=a,t[e].status=c}},r=function(e,t){return function(a){t[e].status=d,t[e].exception=a}},l=function(e,t,a){var n=e[t];n instanceof Promise?(a[t]=a[t]||{},\"contextData\"===t||\"retrieveLightData\"===t?e[t]={}:e[t]=\"\",a[t].status=s,u.push(n.then(o(t,a))[\"catch\"](r(t,a)))):\"object\"==typeof n&&null!==n&&n.promise instanceof Promise&&(a[t]=a[t]||{},\"contextData\"===t||\"retrieveLightData\"===t?e[t]={}:e[t]=\"\",n.hasOwnProperty(\"unresolved\")&&(a[t].value=n.unresolved),a[t].status=s,u.push(n.promise.then(o(t,a))[\"catch\"](r(t,a))))};for(a in e)if(e.hasOwnProperty(a))if(i=e[a],\"contextData\"===a||\"retrieveLightData\"===a)if(i instanceof Promise||\"object\"==typeof i&&null!==i&&i.promise instanceof Promise)l(e,a,t);else{t[a]={isGroup:!0};for(n in i)i.hasOwnProperty(n)&&l(i,n,t[a])}else l(e,a,t);return u},a.metaToObject=function(e){var t,n,i,o,r=(a.s,{});if(e)for(t in e)if(e.hasOwnProperty(t))if(i=e[t],\"contextData\"!==t&&\"retrieveLightData\"!==t||!i.isGroup)i.value&&i.status===c&&(r[t]=i.value);else{r[t]={};for(n in i)i.hasOwnProperty(n)&&(o=i[n],o.value&&o.status===c&&(r[t][n]=o.value))}return r},a.getMeta=function(e){return e&&m[e]?m[e]:m},a.forceReady=function(){u=!0,a.sendPendingHits()},i=t.isReadyToTrack,t.isReadyToTrack=function(){return!!(!a.newCall&&i()&&g&&g.length>0&&(u||m[g[0]]&&!m[g[0]].delay))},o=t.callbackWhenReadyToTrack,t.callbackWhenReadyToTrack=function(e,n,i){var r,s;return n!==t.track?o(e,n,i):void(a.newCall&&(r=a.hitCount++,g.push(r),s=a.createHitMeta(r,a.newCallVariableOverrides),m[r]=s,b||(b=setInterval(a.sendPendingHits,100)),s.promise.then(function(){a.sendPendingHits()})))},r=t.t,t.t=t.track=function(e,t,n){n||(a.newCall=!0,a.newCallVariableOverrides=e),r(e,t),n||(a.newCall=!1,a.newCallVariableOverrides=null,a.sendPendingHits())},a.sendPendingHits=function(){for(var e,t,n,i,o,r=a.s;r.isReadyToTrack();){for(e=m[g[0]],a.currentHit=e,i={},o={},a.trigger(\"hitBeforeSend\",e),o.marketingCloudVisitorID=r.marketingCloudVisitorID,o.visitorOptedOut=r.visitorOptedOut,o.analyticsVisitorID=r.analyticsVisitorID,o.audienceManagerLocationHint=r.audienceManagerLocationHint,o.audienceManagerBlob=r.audienceManagerBlob,a.restore(e.backup.s,r),t=e.restorePoint;t<g[0];t++)n=a.metaToObject(m[t].values.s),delete n.referrer,delete n.resolution,delete n.colorDepth,delete n.javascriptVersion,delete n.javaEnabled,delete n.cookiesEnabled,delete n.browserWidth,delete n.browserHeight,delete n.connectionType,delete n.homepage,a.restore(n,o);a.restore(e.backup.sSet,o),a.restore(a.metaToObject(e.values.s),o),a.restore(e.backup.variableOverrides,i),a.restore(a.metaToObject(e.values.variableOverrides),i),r.track(i,o,!0),f=g.shift(),a.trigger(\"hitAfterSend\",e),a.currentHit=null}b&&g.length<1&&(clearInterval(b),b=!1)},i()||o(a,function(){a.sendPendingHits()},[]),a.on=function(e,t){p[e]||(p[e]=[]),p[e].push(t)},a.trigger=function(e,t){var a,n,i,o=!1;if(p[e])for(a=0,n=p[e].length;n>a;a++){i=p[e][a];try{i(t),o=!0}catch(e){}}else o=!0;return o},a._s=function(){a.trigger(\"_s\")},a._d=function(){return a.trigger(\"_d\"),0},a._g=function(){a.trigger(\"_g\")},a._t=function(){a.trigger(\"_t\")}}", "function wd(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),a=0,e=0;e<n;e++)for(var i=arguments[e],s=0,o=i.length;s<o;s++,a++)r[a]=i[s];return r}", "function p$(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),a=0;for(t=0;t<n;t++)for(var i=arguments[t],o=0,s=i.length;o<s;o++,a++)r[a]=i[o];return r}", "t6 () {\n /** REASON FOR THAT UGLY FUNCTION (TIP: I CAN'T USE DEFAULT VALUES FOR ARGUMENTS IN THESE TESTS!):\n * I don't know why, but it is not possible to use default arguments in this test, like:\n * (arg1 = 'default arg value') => `Run with ${arg1}`\n *\n * That returns a TypeError:\n * An error occurred in ClientFunction code:\n *\n * TypeError: se[u.type] is not a function\n *\n * So I just put in the LOOOONG TRANSPILED version of that, which is:\n * function () {\n * const arg1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default arg value'\n * return 'Run with ' + arg1\n * }\n *\n * Even the slightly shorter version of that ugly function, i.e., an arrow function, can not be used:\n * () => {\n * const arg1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default arg value'\n * return 'Run with ' + arg1\n * }\n * Returns an ReferenceError:\n * ReferenceError: arguments is not defined\n * And an AssertionError (well, that's an error raised by the assertion test itself, so it's ok, I guess):\n * AssertionError: expected { isTrusted: true } to be a string\n *\n * The bottom line is:\n * I CAN'T USE DEFAULT VALUES FOR ARGUMENTS IN THESE TESTS!\n */\n return WorkerWrapper.run(function () {\n const arg1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default arg value'\n return 'Run with ' + arg1\n }, undefined)\n .then(result => {\n resultEl.innerHTML = result\n return result\n })\n .catch(err => err)\n }", "function embedhtml5(gd, mb) {\n function hd() {\n function F(a) {\n return (\"\" + a).toLowerCase()\n }\n\n function Ha(a, d) {\n if (!a)return a;\n var b = 0, f = 0, g, n = a.length, k;\n for (g = 0; g < n; g++)if (k = a.charCodeAt(g), 32 >= k)b++; else break;\n for (g = n - 1; 0 < g; g--)if (k = a.charCodeAt(g), 32 >= k)f++; else break;\n void 0 === d && (g = a.charAt(b), k = a.charAt(n - f - 1), (\"'\" == g && \"'\" == k || '\"' == g && '\"' == k) && 3 == a.split(g).length && (b++, f++));\n return a = a.slice(b, n - f)\n }\n\n function pa(a) {\n return 0 <= _[368].indexOf(String(a).toLowerCase())\n }\n\n function ga(a, d) {\n return _[523] == d ? Number(a) : _[67] == d ? pa(a) : _[13] == d ? null == a ? null : String(a) : a\n }\n\n function sa(a) {\n return Number(a).toFixed(6)\n }\n\n function ha(a, d, b, f) {\n a.__defineGetter__(d, b);\n void 0 !== f && a.__defineSetter__(d, f)\n }\n\n function va(a, d, b) {\n var f = \"_\" + d;\n a[f] = b;\n a.__defineGetter__(d, function () {\n return a[f]\n });\n a.__defineSetter__(d, function (d) {\n d = ga(d, typeof b);\n d != a[f] && (a[f] = d, a.haschanged = !0)\n })\n }\n\n function Aa(a) {\n a && a.preventDefault()\n }\n\n function R(a, d, b, f) {\n a && a.addEventListener(d, b, f)\n }\n\n function ba(a, d, b, f) {\n a && a.removeEventListener(d, b, f)\n }\n\n function Ja(a) {\n var d = aa.createElement(1 == a ? \"img\" : 2 == a ? _[486] : \"div\");\n d && 1 == a && \"off\" != Tc && (d.crossOrigin = Tc);\n return d\n }\n\n function gc(a) {\n return function () {\n return a.apply(a, arguments)\n }\n }\n\n function id(a) {\n return a.split(\"<\").join(\"&lt;\").split(\">\").join(\"&gt;\")\n }\n\n function ca(a, d) {\n var b = \"(\" + (a >> 16 & 255) + \",\" + (a >> 8 & 255) + \",\" + (a & 255);\n void 0 === d && (d = 1 - (a >> 24 & 255) / 255);\n return (1 > d ? \"rgba\" + b + \",\" + d : \"rgb\" + b) + \")\"\n }\n\n function Ed(a) {\n return a.split(\"[\").join(\"<\").split(\"<<\").join(\"[\").split(\"]\").join(\">\").split(\">>\").join(\"]\")\n }\n\n function nc(a, d) {\n a = Number(a);\n for (d = Number(d); 0 > a;)a += 360;\n for (; 360 < a;)a -= 360;\n var b = Math.abs(d - a), f = Math.abs(d - (a - 360)), g = Math.abs(d - (a + 360));\n f < b && f < g ? a -= 360 : g < b && g < f && (a += 360);\n return a\n }\n\n function Gc(a) {\n if (a) {\n var d = a.indexOf(\"?\");\n 0 <= d && (a = a.slice(0, d));\n d = a.indexOf(\"#\");\n 0 <= d && (a = a.slice(0, d))\n }\n return a\n }\n\n function Vd(a) {\n a = Gc(a);\n var d = a.lastIndexOf(\"/\"), b = a.lastIndexOf(\"\\\\\");\n b > d && (d = b);\n return a.slice(d + 1)\n }\n\n function Uc(a, d) {\n var b = String(a).charCodeAt(0);\n return 48 <= b && 57 >= b ? (la(3, d + _[154]), !1) : !0\n }\n\n function gd(a, d) {\n for (var b = \"\", f = 0, g = 1, n = 0, k = 0; 1 == g && 0 == f;) {\n var e, w = a.indexOf(\"*\", n), b = \"\";\n 0 > w ? (w = a.length, f = 1) : (b = a.indexOf(\"*\", w + 1), 0 > b && (b = a.length), e = b - (w + 1), b = a.substr(w + 1, e));\n e = w - n;\n 0 < e && d.substr(k, f ? void 0 : e) != a.substr(n, e) && (g = 0);\n n = w + 1;\n \"\" != b && (k = d.indexOf(b, k), 0 > k && (g = 0))\n }\n return !!g\n }\n\n function oc(a, d, b, f) {\n for (; 32 >= a.charCodeAt(d);)d++;\n for (; 32 >= a.charCodeAt(b - 1);)b--;\n var g = a.charCodeAt(d);\n if (37 == g)a = U(a.slice(d + 1, b), f); else if (103 == g && \"get(\" == a.slice(d, d + 4)) {\n for (d += 4; 32 >= a.charCodeAt(d);)d++;\n for (b = a.lastIndexOf(\")\"); 32 >= a.charCodeAt(b - 1);)b--;\n a = U(a.slice(d, b), f)\n } else 99 == g && \"calc(\" == a.slice(d, d + 5) ? a = U(a.slice(d, b), f) : (f = a.charCodeAt(d), 39 != f && 34 != f || f != a.charCodeAt(b - 1) || (d++, b--), a = a.slice(d, b));\n return a\n }\n\n function Vc(a) {\n var d = [];\n if (null == a || void 0 == a)return d;\n var b, f = 0, g, n, k = 0;\n a = F(a);\n g = a.length;\n for (b = 0; b < g; b++)n = a.charCodeAt(b), 40 == n ? k++ : 41 == n ? k-- : 46 == n && 0 == k && (d.push(a.slice(f, b)), f = b + 1);\n d.push(a.slice(f));\n return d\n }\n\n function Ka(a, d) {\n a = F(a);\n var b, f, g, n;\n g = Yb[a];\n null != g && void 0 !== g && \"\" != g && Zb(g, null, d);\n n = Yb.getArray();\n f = n.length;\n for (b = 0; b < f; b++)if (g = n[b])g = g[a], null != g && void 0 !== g && \"\" != g && Zb(g, null, d)\n }\n\n function I(a, d, b, f, g) {\n if (d && _[13] == typeof d) {\n var n = d.slice(0, 4);\n \"get:\" == n ? d = U(d.slice(4)) : \"calc\" == n && 58 == d.charCodeAt(4) && (d = da.calc(null, d.slice(5)))\n }\n var n = null, k, e = Vc(a);\n k = e.length;\n if (1 == k && f && (n = e[0], void 0 !== f[n])) {\n f[n] = _[67] == typeof f[n] ? pa(d) : d;\n return\n }\n var w = m, n = null;\n 1 < k && (n = e[k - 1]);\n for (a = 0; a < k; a++) {\n var x = e[a], v = a == k - 1, r = null, y = x.indexOf(\"[\");\n 0 < y && (r = oc(x, y + 1, x.length - 1, f), x = x.slice(0, y));\n y = !1;\n if (void 0 === w[x]) {\n if (b)break;\n v || (null == r ? w[x] = new Fb : (w[x] = new bb(Fb), y = !0))\n } else y = !0;\n if (y && 0 == v && w[x] && 1 == w[x].isArray && null != r)if (v = null, w = w[x], v = b ? w.getItem(r) : w.createItem(r)) {\n if (a == k - 2 && \"name\" == n) {\n d = F(d);\n r != d && (null == d || \"null\" == d || \"\" == d ? w.removeItem(r) : w.renameItem(r, d));\n break\n }\n w = v;\n continue\n } else break;\n if (v)w[x] = 1 == g ? d : ga(d, typeof w[x]); else if (w = w[x], null == w)break\n }\n }\n\n function Wd(a) {\n if (a && \"null\" != a) {\n if (_[13] == typeof a) {\n var d = a.split(\"&\"), b = d.length, f;\n a = {};\n for (f = 0; f < b; f++) {\n var g = d[f].split(\"=\");\n a[g[0]] = g[1]\n }\n }\n for (var n in a)\"xml\" != n && I(n, a[n])\n }\n }\n\n function U(a, d, b) {\n if (a && \"calc(\" == (\"\" + a).slice(0, 5))return da.calc(null, a.slice(5, a.lastIndexOf(\")\")));\n var f, g, n = Vc(a);\n f = n.length;\n if (1 == f && _[307] == n[0])return d ? d._type + \"[\" + d.name + \"]\" : \"\";\n if (1 == f && d && (g = n[0], d.hasOwnProperty(g)))return d[g];\n var k = m;\n for (a = 0; a < f; a++) {\n g = n[a];\n var e = a == f - 1, w = null, x = g.indexOf(\"[\");\n 0 < x && (w = oc(g, x + 1, g.length - 1, d), g = g.slice(0, x));\n if (k && void 0 !== k[g]) {\n if (null != w && (x = k[g]) && x.isArray)if (g = x.getItem(w)) {\n if (e)return g;\n k = g;\n continue\n } else break;\n if (e)return k[g];\n k = k[g]\n } else break\n }\n return !0 === b ? void 0 : null\n }\n\n function Zb(a, d, b) {\n da.callaction(a, d, b)\n }\n\n function hd(a, d, b) {\n Zb(a, d ? U(d) : null, b ? pa(b) : null)\n }\n\n function la(a, d) {\n !jd && (0 < a || m.debugmode) && (d = [\"DEBUG\", \"INFO\", _[458], \"ERROR\", _[367]][a] + \": \" + d, V.log(d), 2 < a && m.showerrors && setTimeout(function () {\n try {\n V.showlog(!0)\n } catch (a) {\n }\n }, 500))\n }\n\n function Ea(a, d) {\n if (!jd) {\n a = \"\" + a;\n var E = 0 < F(a).indexOf(\"load\");\n a = id(a).split(\"[br]\").join(\"<br/>\");\n var f = xa.createItem(_[424]), g = xa.createItem(_[425]);\n f.sprite || (f.create(), V.controllayer.appendChild(f.sprite));\n g.sprite || (g.create(), V.controllayer.appendChild(g.sprite));\n var n;\n f.loaded = !0;\n f.align = _[66];\n f.width = \"100%\";\n f.height = \"100%\";\n f.alpha = .5;\n f.keep = !0;\n n = f.sprite.style;\n n.backgroundColor = _[26];\n n.zIndex = 99999998;\n E && (g.visible = !1);\n g.loaded = !0;\n g.align = _[136];\n g.y = 0;\n g.width = \"105%\";\n var k = b.ie || b.android ? -2 : 2;\n g.height = k + 46 / X;\n g.keep = !0;\n n = g.sprite.style;\n n.backgroundColor = _[26];\n n.color = _[40];\n n.fontFamily = b.realDesktop && !b.ie ? _[55] : _[38];\n n.fontSize = \"12px\";\n n.margin = \"-2px\";\n n.border = _[239];\n d || (d = _[291]);\n g.sprite.innerHTML = _[166] + d + \"<br/>\" + a + _[298];\n n.zIndex = 99999999;\n n[pc] = _[203];\n g.jsplugin = {\n onresize: function (a, d) {\n var b = g.sprite.childNodes[0].clientHeight;\n g.height = k + Math.max(46, b) / X;\n 0 >= b && (g.imageheight = 1)\n }\n };\n f.updatepos();\n g.updatepos();\n E && setTimeout(function () {\n try {\n g.visible = !0\n } catch (a) {\n }\n }, 500)\n }\n }\n\n function ve() {\n Xa.removeelements(!0);\n Xd.stop();\n Pa.unregister();\n Oa.unload();\n V.remove()\n }\n\n function we() {\n this.caller = this.args = this.cmd = null;\n this.breakable = !1\n }\n\n function Gb(a, d, b) {\n if (null == a || \"\" == a)return null;\n for (var f = 0, g = 0, n = 0, k = 0, e = 0, w = 0, x = 0, v = 0, r = \"\", r = 0; ;)\n if (r = a.charCodeAt(e), 0 < r && 32 >= r)\n e++;\n else\n break;\n\n //sohow_base64\n for (var y = [], g = a.length, f = e; f < g; f++)\n if (r = a.charCodeAt(f), 0 == v && 0 == x && 40 == r)\n n++;\n else if (0 == v && 0 == x && 41 == r) {\n if (k++, n == k) {\n w = f + 1;\n r = a.slice(e, w);\n y.push(r);\n for (e = w; ;)if (r = a.charCodeAt(e), 0 < r && 32 >= r)e++; else break;\n r = a.charCodeAt(e);\n if (59 != r) {\n w = g;\n break\n }\n for (e++; ;)if (r = a.charCodeAt(e), 59 == r || 0 < r && 32 >= r)e++; else break;\n f = e\n }\n }\n else\n 34 == r ? 0 == x ? x = 1 : 1 == x && (x = 0) : 39 == r ? 0 == x ? x = 2 : 2 == x && (x = 0) : 91 == r && 0 == x ? v++ : 93 == r && 0 == x && v--;\n\n\n w != g && (r = a.slice(e, g), 0 < r.length && y.push(r));\n a = null;\n g = y.length;\n for (f = 0; f < g; f++) {\n r = y[f];\n x = r.indexOf(\"[\");\n k = r.indexOf(\"]\");\n n = r.indexOf(\"(\");\n 0 < x && 0 < k && n > x && n < k && (n = r.indexOf(\"(\", k));\n e = k = null;\n 0 < n ? (k = r.slice(0, n), e = Ha(r.slice(n + 1, r.lastIndexOf(\")\")), !1), 0 >= e.length && (e = null)) : (k = r, e = null);\n k = Ha(k);\n w = [];\n if (null != e) {\n var l, v = e.length, n = 0, u = -1, h = -1, c = x = 0, r = null;\n for (l = 0; l < v; l++)\n r = e.charCodeAt(l),\n 0 == x && 40 == r ? n++ : 0 == x && 41 == r ? n-- : 34 == r ? 1 == x && 0 <= u ? (u = -1, x = 0) : 0 == x && (u = l, x = 1) : 39 == r && (2 == x && 0 <= h ? (h = -1, x = 0) : 0 == x && (h = l, x = 2)),\n 44 == r && 0 == n && 0 == x && (r = Ha(e.slice(c, l)), (r != \"data:image/png;base64\") && (w.push(r),c = l + 1));\n\n 0 == n && (r = Ha(e.slice(c, l)), w.push(r))\n }\n null == a && (a = []);\n n = new we;\n n.cmd = b ? k : F(k);\n n.args = w;\n n.caller = d;\n a.push(n)\n }\n return a\n }\n\n function Hb() {\n this.z = this.y = this.x = 0\n }\n\n function Ma() {\n var a = _[111] !== typeof Float32Array ? new Float32Array(16) : Array(16);\n a[0] = a[5] = a[10] = a[15] = 1;\n a[1] = a[2] = a[3] = a[4] = a[6] = a[7] = a[8] = a[9] = a[11] = a[12] = a[13] = a[14] = 0;\n return a\n }\n\n function xe(a, d, b, f, g, n, k, e, w, x, v, r, y, l, u, h, c) {\n a[0] = d;\n a[1] = b;\n a[2] = f;\n a[3] = g;\n a[4] = n;\n a[5] = k;\n a[6] = e;\n a[7] = w;\n a[8] = x;\n a[9] = v;\n a[10] = r;\n a[11] = y;\n a[12] = l;\n a[13] = u;\n a[14] = h;\n a[15] = c\n }\n\n function Hc(a, d, b, f, g, n, k, e, w, x) {\n a[0] = d;\n a[1] = b;\n a[2] = f;\n a[3] = 0;\n a[4] = g;\n a[5] = n;\n a[6] = k;\n a[7] = 0;\n a[8] = e;\n a[9] = w;\n a[10] = x;\n a[11] = 0;\n a[12] = 0;\n a[13] = 0;\n a[14] = 0;\n a[15] = 1\n }\n\n function kd(a, d) {\n a[0] = d[0];\n a[1] = d[1];\n a[2] = d[2];\n a[3] = d[3];\n a[4] = d[4];\n a[5] = d[5];\n a[6] = d[6];\n a[7] = d[7];\n a[8] = d[8];\n a[9] = d[9];\n a[10] = d[10];\n a[11] = d[11];\n a[12] = d[12];\n a[13] = d[13];\n a[14] = d[14];\n a[15] = d[15]\n }\n\n function Ic(a, d) {\n var b = d[0], f = d[1], g = d[2], n = d[3], k = d[4], e = d[5], w = d[6], x = d[7], v = d[8], r = d[9], y = d[10], l = d[11], u = d[12], h = d[13], c = d[14], m = d[15], D = a[0], z = a[1], q = a[2], J = a[3];\n a[0] = D * b + z * k + q * v + J * u;\n a[1] = D * f + z * e + q * r + J * h;\n a[2] = D * g + z * w + q * y + J * c;\n a[3] = D * n + z * x + q * l + J * m;\n D = a[4];\n z = a[5];\n q = a[6];\n J = a[7];\n a[4] = D * b + z * k + q * v + J * u;\n a[5] = D * f + z * e + q * r + J * h;\n a[6] = D * g + z * w + q * y + J * c;\n a[7] = D * n + z * x + q * l + J * m;\n D = a[8];\n z = a[9];\n q = a[10];\n J = a[11];\n a[8] = D * b + z * k + q * v + J * u;\n a[9] = D * f + z * e + q * r + J * h;\n a[10] = D * g + z * w + q * y + J * c;\n a[11] = D * n + z * x + q * l + J * m;\n D = a[12];\n z = a[13];\n q = a[14];\n J = a[15];\n a[12] = D * b + z * k + q * v + J * u;\n a[13] = D * f + z * e + q * r + J * h;\n a[14] = D * g + z * w + q * y + J * c;\n a[15] = D * n + z * x + q * l + J * m\n }\n\n function ef(a, d) {\n var b = a[0], f = a[1], g = a[2], n = a[3], k = a[4], e = a[5], w = a[6], x = a[7], v = a[8], r = a[9], y = a[10], l = a[11], u = a[12], h = a[13], c = a[14], m = a[15], D = d[0], z = d[1], q = d[2], J = d[3], C = d[4], Q = d[5], A = d[6], H = d[7], qa = d[8], ea = d[9], Ca = d[10], S = d[11], p = d[12], B = d[13], t = d[14], G = d[15];\n a[0] = D * b + z * k + q * v + J * u;\n a[1] = D * f + z * e + q * r + J * h;\n a[2] = D * g + z * w + q * y + J * c;\n a[3] = D * n + z * x + q * l + J * m;\n a[4] = C * b + Q * k + A * v + H * u;\n a[5] = C * f + Q * e + A * r + H * h;\n a[6] = C * g + Q * w + A * y + H * c;\n a[7] = C * n + Q * x + A * l + H * m;\n a[8] = qa * b + ea * k + Ca * v + S * u;\n a[9] = qa * f + ea * e + Ca * r + S * h;\n a[10] = qa * g + ea * w + Ca * y + S * c;\n a[11] = qa * n + ea * x + Ca * l + S * m;\n a[12] = p * b + B * k + t * v + G * u;\n a[13] = p * f + B * e + t * r + G * h;\n a[14] = p * g + B * w + t * y + G * c;\n a[15] = p * n + B * x + t * l + G * m\n }\n\n function ye(a, d, b, f) {\n xe(a, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, d, b, f, 1)\n }\n\n function Yd(a, d, b, f) {\n var g, n, k;\n g = b * Y;\n b = Math.cos(g);\n n = Math.sin(g);\n g = -(d - 90) * Y;\n d = Math.cos(g);\n k = Math.sin(g);\n g = -f * Y;\n f = Math.cos(g);\n g = Math.sin(g);\n Hc(a, d * f - k * n * g, d * g + k * n * f, -k * b, -b * g, b * f, n, k * f + d * n * g, k * g - d * n * f, d * b)\n }\n\n function Zd(a, d) {\n var b = d[0], f = d[1], g = d[2], n = d[4], k = d[5], e = d[6], w = d[8], x = d[9], v = d[10], r = 1 / (b * k * v + f * e * w + n * x * g - w * k * g - n * f * v - x * e * b);\n Hc(a, (k * v - x * e) * r, (-f * v + x * g) * r, (f * e - k * g) * r, (-n * v + w * e) * r, (b * v - w * g) * r, (-b * e + n * g) * r, (n * x - w * k) * r, (-b * x + w * f) * r, (b * k - n * f) * r)\n }\n\n function nb(a, d) {\n var b = d.x, f = d.y, g = d.z;\n d.x = b * a[0] + f * a[4] + g * a[8];\n d.y = b * a[1] + f * a[5] + g * a[9];\n d.z = b * a[2] + f * a[6] + g * a[10]\n }\n\n function Fd(a, d) {\n var b = d[0], f = d[1], g = d[2];\n d[0] = b * a[0] + f * a[4] + g * a[8];\n d[1] = b * a[1] + f * a[5] + g * a[9];\n d[2] = b * a[2] + f * a[6] + g * a[10]\n }\n\n function Jc(a) {\n \"\" != a.loader.src && (a.loader = Ja(1), a.loader.kobject = a)\n }\n\n function hc(a) {\n return b.fractionalscaling ? Math.round(a * (b.pixelratio + 1E-7)) / b.pixelratio : Math.round(a)\n }\n\n function Ib(a, d, b, f) {\n a = (\"\" + a).split(b);\n f = f ? f : [0, 0, 0, 0];\n b = a.length;\n 4 == b ? (f[0] = a[0] * d + .5 | 0, f[1] = a[1] * d + .5 | 0, f[2] = a[2] * d + .5 | 0, f[3] = a[3] * d + .5 | 0) : 3 == b ? (f[0] = a[0] * d + .5 | 0, f[1] = f[3] = a[1] * d + .5 | 0, f[2] = a[2] * d + .5 | 0) : 2 == b ? (f[0] = f[2] = a[0] * d + .5 | 0, f[1] = f[3] = a[1] * d + .5 | 0) : f[0] = f[1] = f[2] = f[3] = a[0] * d + .5 | 0;\n return f\n }\n\n function Gd(a) {\n var d = a && a._poly;\n d && (d.setAttribute(\"fill\", !0 === a.polyline ? \"none\" : ca(a.fillcolor, a.fillalpha)), d.setAttribute(_[510], ca(a.bordercolor, a.borderalpha)), d.setAttribute(_[312], a.borderwidth * X))\n }\n\n function ze(a) {\n var d = p.r_rmatrix, b = p.r_zoom, f = p.r_zoff, g = .5 * Qa, n = .5 * ya + p.r_yoff, k = p._stereographic ? 10 - f : 1 - f * (1 - Math.min(p.fisheye * p.fisheye, 1)), e = a._poly;\n if (!e) {\n var w = V.svglayer;\n w || (w = document.createElementNS(_[77], \"svg\"), w.setAttribute(_[49], \"100%\"), w.setAttribute(_[28], \"100%\"), w.style.position = _[0], w.style.left = 0, w.style.top = 0, w.style.display = ja.stereo ? \"none\" : \"\", V.svglayer = w, V.hotspotlayer.appendChild(w));\n e = document.createElementNS(_[77], pa(a.polyline) ? _[121] : _[444]);\n w.appendChild(e);\n e.kobject = a;\n a._poly = e;\n Gd(a);\n e.style.opacity = Number(a._alpha) * (a.keep ? 1 : qc);\n a._assignEvents(e);\n setTimeout(function () {\n a.loading = !1;\n a.loaded = !0;\n da.callaction(a.onloaded, a)\n }, 7)\n }\n var w = a.point.getArray(), x = w.length, v = [];\n if (1 < x && a._visible && 0 == ja.stereo) {\n var r, y, l, u = new Hb, h = new Hb, c;\n y = w[x - 1];\n l = (180 - Number(y.ath)) * Y;\n y = Number(y.atv) * Y;\n u.x = 1E3 * Math.cos(y) * Math.cos(l);\n u.z = 1E3 * Math.cos(y) * Math.sin(l);\n u.y = 1E3 * Math.sin(y);\n nb(d, u);\n for (r = 0; r < x; r++)y = w[r], l = (180 - Number(y.ath)) * Y, y = Number(y.atv) * Y, h.x = 1E3 * Math.cos(y) * Math.cos(l), h.z = 1E3 * Math.cos(y) * Math.sin(l), h.y = 1E3 * Math.sin(y), nb(d, h), h.z >= k ? (u.z >= k || (c = (k - u.z) / (h.z - u.z), y = b / (k + f), l = (u.x + (h.x - u.x) * c) * y + g, y = (u.y + (h.y - u.y) * c) * y + n, v.push(l.toFixed(2) + \",\" + y.toFixed(2))), y = b / (h.z + f), l = h.x * y + g, y = h.y * y + n, v.push(l.toFixed(2) + \",\" + y.toFixed(2))) : u.z >= k && (c = (k - h.z) / (u.z - h.z), y = b / (k + f), l = (h.x + (u.x - h.x) * c) * y + g, y = (h.y + (u.y - h.y) * c) * y + n, v.push(l.toFixed(2) + \",\" + y.toFixed(2))), u.x = h.x, u.y = h.y, u.z = h.z;\n 0 == a.polyline && 2 < v.length && v.push(v[0]);\n e.style.pointerEvents = a._enabled ? _[264] : \"none\";\n e.style.cursor = a._handcursor ? _[18] : _[5];\n e.style.visibility = a._visible ? _[12] : _[6]\n }\n e.setAttribute(_[506], v.join(\" \"))\n }\n\n function Ae(a, d) {\n if (a && d) {\n var b = a.zorder, f = d.zorder;\n if (b < f)return -1;\n if (b > f)return 1\n }\n return 0\n }\n\n function ob(a, d) {\n if (Wc) {\n var E = Ua.getArray();\n E.sort(Ae);\n var f = E.length, g;\n for (g = 0; g < f; g++) {\n var n = E[g];\n n && (n.index = g)\n }\n Wc = !1\n }\n var E = Ua.getArray(), f = E.length, k;\n g = p.r_rmatrix;\n var n = Qa, e = ya, w = X, x = .5 * n, v = .5 * e, r = p.r_zoom, y = p.r_hlookat, l = p.r_vlookat, u = p.r_vlookatA, h = p.r_yoff, c = p.r_zoff, m = p._camroll;\n k = p._stereographic;\n var D;\n D = 1 * (1 + c / 1E3);\n var z = 50;\n 0 < c && (k ? z -= c : (z = 20 - c, -125 > z && (z = -125)));\n var q = 0, J = 0;\n k = 0;\n void 0 !== d && (k = d, f = k + 1);\n var C = ic, Q = b.realDesktop && 250 > r ? 1.5 : 0, A = ub;\n ub = !1;\n var H = Be, qa = Ce;\n H[1] = x;\n H[5] = $d;\n H[9] = sa(y);\n H[15] = C + \",\" + C + \",\" + C;\n for (var ea = ib, Ca = new Hb, S = (\"\" + ja.hotspotrenderer).toLowerCase(), S = b.webgl && _[30] == S && \"both\" != S || ja.stereo, Z = null; k < f; k++) {\n var B = E[k];\n if (B && (Z = B.sprite))if (Z = Z.style, S)\"none\" != Z.display && (Z.display = \"none\"); else {\n B._GL_onDestroy && (B._GL_onDestroy(), B.GL = null);\n if (A = !0, B.sprite)A = Number(B._alpha) * (B.keep ? 1 : qc), Z.opacity = A, B._poly && (B._poly.style.opacity = A);\n A = a || B.poschanged || B.forceupdate;\n if (null == B._url && 0 < B.point.count && A)ze(B), B.poschanged = !1; else if (B._visible && B.loaded && A) {\n B.poschanged = !1;\n A = Number(B._flying);\n q = (1 - A) * Number(B._ath);\n J = (1 - A) * Number(B._atv);\n 0 < A && (q += A * nc(y, B._ath), J += A * nc(l, B._atv));\n var t = !1, G = (180 - q) * Y, Ba = J * Y;\n Ca.x = 1E3 * Math.cos(Ba) * Math.cos(G);\n Ca.z = 1E3 * Math.cos(Ba) * Math.sin(G);\n Ca.y = 1E3 * Math.sin(Ba);\n nb(g, Ca);\n var P = !1, Fa = Ca.x, wa = Ca.y, G = Ca.z;\n if (G >= z - c)var ta = r / (G + c), Fa = Fa * ta, wa = wa * ta + h, P = 8E3 > Math.abs(Fa) && 8E3 > Math.abs(wa), Fa = Fa + x, wa = wa + v;\n if (B._distorted) {\n Z.pointerEvents = 50 <= G + c && B._enabled ? \"auto\" : \"none\";\n t = !0;\n G = (Ba = B._scale) ? B._scale : 1;\n B._hszscale = G;\n 1 == B.scaleflying && (G = G * (1 - A) + G / (r / (e / 2)) * D * A);\n B._scale = 1;\n B.updatepluginpos();\n B._scale = Ba;\n var W = B.pixelwidth, F = B.pixelheight, Da = Ba = 1;\n B._use_css_scale && (Ba = W / B.imagewidth, Da = F / B.imageheight);\n var L = .5 * -F, Va = String(B._edge), Fa = wa = 0, O = B._oxpix, $b = B._oypix, wa = wa + .5 * -W / Ba, Fa = Fa + L / Da;\n 0 <= Va.indexOf(\"left\") ? wa += +W / 2 / Ba : 0 <= Va.indexOf(_[3]) && (wa += -W / 2 / Ba);\n 0 <= Va.indexOf(\"top\") ? Fa += +F / 2 / Da : 0 <= Va.indexOf(_[2]) && (Fa += -F / 2 / Da);\n F = -500;\n W = B._deepscale;\n Va = B._depth;\n isNaN(Va) && (Va = 1E3);\n L = 1;\n 0 == (Va | 0) ? (F = 0, W = 1) : L = 1E3 / Va;\n 2 == Nb && (W *= 15);\n W /= 1 + A + Q;\n if (b.firefox || 6 < b.iosversion && .1 > B.scale)W = 10 / (1 + A);\n 0 < c && (W = 1);\n G = G * W * L;\n F *= W;\n O = O * W * L;\n $b = $b * W * L;\n if (0 < c || b.firefox)t = P;\n P = W * L * C / 2;\n P = _[274] + P * B.tx + \"px,\" + P * B.ty + \"px,\" + -P * B.tz + \"px) \";\n H[3] = sa(v + h * (1 - A));\n H[7] = sa(-(u * (1 - A) + l * A));\n H[11] = P + _[125] + sa(-q);\n H[13] = sa(J);\n H[17] = F;\n H[19] = sa(B._rotate + A * m);\n H[21] = O;\n H[23] = $b;\n B.inverserotation ? (H[25] = \"Y(\" + sa(B.ry), H[27] = \"X(\" + sa(B.rx), H[29] = \"Z(\" + sa(-B.rz)) : (H[25] = \"Z(\" + sa(B.rz), H[27] = \"X(\" + sa(-B.rx), H[29] = \"Y(\" + sa(-B.ry));\n H[31] = G * Ba;\n H[33] = G * Da;\n H[35] = wa;\n H[37] = Fa;\n Z[ea] = H.join(\"\")\n } else if (G >= z && (G = 1, P)) {\n if (B.zoom || B.distorted)G *= Number(2 * (1 - A) * ta + A * X) / X;\n B.updatepluginpos();\n W = B.pixelwidth;\n F = B.pixelheight;\n Da = Ba = 1;\n B._use_css_scale && (Ba = W / B.imagewidth, Da = F / B.imageheight);\n q = Fa;\n J = wa;\n 0 == B.accuracy && (q = Math.round(q), J = Math.round(J));\n Va = String(B._edge);\n Fa = wa = 0;\n O = B._oxpix * G;\n $b = B._oypix * G;\n 0 <= Va.indexOf(\"left\") ? wa += +W / 2 / Ba : 0 <= Va.indexOf(_[3]) && (wa += -W / 2 / Ba);\n 0 <= Va.indexOf(\"top\") ? Fa += +F / 2 / Da : 0 <= Va.indexOf(_[2]) && (Fa += -F / 2 / Da);\n P = 2 * G * (Math.max(W, F) * B._scale + Math.max(O, $b));\n if (0 < q + P || 0 < J + P || q - P < n || J - P < e)B._use_css_scale ? G *= w : (W *= w, F *= w, wa *= w, Fa *= w), t = -(W / Ba) / 2, P = -(F / Da) / 2, B._istextfield && 0 == B.accuracy && (q |= 0, J |= 0, t |= 0, P |= 0, O |= 0, $b |= 0, wa |= 0, Fa |= 0), qa[1] = sa(q), qa[3] = sa(J), qa[5] = sa(t), qa[7] = sa(P), qa[9] = sa(B._rotate - m * (1 - A)), qa[11] = O, qa[13] = $b, qa[15] = G * Ba, qa[17] = G * Da, qa[19] = sa(wa), qa[21] = sa(Fa), A = qa.join(\"\"), A = Kc && 2 > Nb && .5 < Number(B.zorder2) ? _[325] + (999999999E3 + B._zdeep) + \"px) \" + A : _[263] + A, Z[ib] = A, t = !0\n }\n 0 == B.forceupdate && (A = t ? \"\" : \"none\", A != Z.display && (Z.display = A));\n B.forceupdate = !1\n }\n }\n }\n }\n\n function De(a, d, E, f) {\n function g() {\n var c = Ja(), C = c.style;\n C.marginTop = C.marginBottom = l[17] * p + \"px\";\n C.height = \"1px\";\n C.backgroundColor = ca(l[18]);\n \"none\" != l[19] && (C.borderBottom = _[350] + ca(l[19]));\n D.appendChild(c)\n }\n\n function n(c) {\n var C = c.changedTouches;\n return (C && 0 < C.length ? C[0] : c).pageY\n }\n\n function k(C, a, d) {\n var Q = Ja(), A = Q.style;\n A.padding = l[20] * p + \"px\";\n A.border = l[21] + _[23] + ca(l[22]);\n A.borderRadius = l[23] * p + \"px\";\n A.marginTop = l[24] * p + \"px\";\n A.marginBottom = l[24] * p + \"px\";\n b.androidstock && (A[_[76]] = _[36]);\n Pa.touch && R(Q, b.browser.events.touchstart, function (C) {\n function A(C) {\n C = n(C) - H;\n if (h > ya) {\n var a = v + C | 0;\n a < ya - h - 10 ? a = ya - h - 10 : 10 < a && (a = 10);\n c.style.top = a + \"px\"\n }\n 15 < Math.abs(C) && (Q.onmouseout(), r = !0)\n }\n\n function t() {\n ba(L, qa, A, !0);\n ba(L, g, t, !0);\n if (0 == r)Q.onclick()\n }\n\n Aa(C);\n C.stopPropagation();\n if (d && a) {\n Q.onmouseover();\n var H = n(C), v = parseInt(c.style.top) | 0, r = !1, qa = b.browser.events.touchmove, g = b.browser.events.touchend;\n R(L, qa, A, !0);\n R(L, g, t, !0)\n }\n }, !0);\n d && a ? (A.cursor = _[18], Q.onmousedown = function (c) {\n c.stopPropagation()\n }, Q.onmouseover = function () {\n A = this.style;\n A.background = ca(l[25]);\n A.border = l[21] + _[23] + ca(l[26]);\n A.color = ca(l[27])\n }, Q.onmouseout = function () {\n A = this.style;\n A.background = \"none\";\n A.border = l[21] + _[23] + ca(l[22]);\n A.color = ca(l[4])\n }, Q.oncontextmenu = function (c) {\n Aa(c);\n c.stopPropagation();\n Q.onclick()\n }, Q.onclick = function (C) {\n f ? (A = c.style, A.opacity = 1, A.transition = _[98], A.opacity = 0, setTimeout(E, 300)) : E();\n da.callaction(d)\n }) : (0 == a && (A.color = ca(l[5])), A.cursor = _[5]);\n var H = Ja();\n H.style.marginLeft = l[28] * p + \"px\";\n H.style.marginRight = l[29] * p + \"px\";\n H.innerHTML = C;\n Q.appendChild(H);\n D.appendChild(Q);\n return H\n }\n\n function e() {\n function c() {\n return .4 > Math.random() ? \" \" : _[139]\n }\n\n var C = k(\"About\" + c() + \"the\" + c() + _[46] + c() + _[414] + c() + _[385], !0, function () {\n da.openurl(_[220])\n });\n try {\n (new MutationObserver(function (c) {\n c = L.getComputedStyle(C);\n 9 > Math.min(parseInt(c.width) | 0, parseInt(c.height) | 0) && (m = {}, Ea(_[97]))\n })).observe(C, {attributes: !1, childList: !0, characterData: !0, subtree: !0})\n } catch (a) {\n }\n }\n\n function w() {\n k(V.fullscreen ? y.exitfs : y.enterfs, !0, function () {\n m.fullscreen = !m.fullscreen\n })\n }\n\n function x() {\n var c = b.android, C = b.infoString, C = C.split(_[431]).join(\"\");\n k((qa ? \"\" : _[128] + m.version + _[240] + m.build + _[261]) + (c ? _[481] : \"\") + C + Oa.infoString + (c ? _[443] : \"\"), !0, null)\n }\n\n function v() {\n Na && Na[2] && k(Na[2], !0, function () {\n da.openurl(Na[3])\n })\n }\n\n function r() {\n var C = c.getBoundingClientRect(), b = C.width, C = C.height, Q = d;\n if (0 < b && 0 < C) {\n h = C;\n f && (a -= b >> 1, a + b > Qa && (a = Qa - b - 10), 10 > a && (a = 10));\n for (; a + b > Qa;)a -= b / 2;\n 0 > a && (a = 0);\n d + C > ya && (d = f ? ya - C - 10 : d - C);\n 0 > d && (f ? d = ya - C >> 1 : Q > ya / 2 ? (d = Q - C, 0 > d && (d = 4)) : (d = Q, d + C > ya && (d = ya - 4 - C)));\n u = c.style;\n u.left = (a | 0) + \"px\";\n u.top = (d | 0) + \"px\";\n f && (u.transition = _[98], u.opacity = 1)\n } else 10 > ++B && setTimeout(r, 32)\n }\n\n var y = m.contextmenu;\n if (f && 0 == y.touch)return null;\n var l = null;\n y.customstyle && (_[109] == b.browser.domain || 0 == b.realDesktop || b.realDesktop && 0 != (Ya & 16)) && (l = F(y.customstyle).split(\"|\"), 30 != l.length && (l = null));\n null == l && (l = (b.mac ? \"default|14|default|0xFFFFFF|0x000000|0xBBBBBB|0|0|5|2|2|8|0x66000000|0|0|1|4|5|0xEEEEEE|none|1|0|0|0|3|0xEEEEEE|0|0|20|12\" : b.desktop ? \"default|default|150%|0xFFFFFF|0x000000|0xBBBBBB|1|0xBBBBBB|0|2|2|8|0x66000000|0|0|2|2|5|0xE0E0E0|none|4|0|0|0|3|0xEEEEEE|0|0|18|12\" : \"Helvetica|16|default|0x55000000|0xFFFFFF|0x555555|1|0xFFFFFF|8|0|0|8|0x44000000|0|0|4|4|6|0x555555|none|4|0|0|0|3|0xEEEEEE|0|0|12|12\").split(\"|\"));\n var u = null, h = 0, c = Ja();\n c.onselectstart = _[266];\n b.desktop && b.chrome && (c.style.opacity = .999);\n if (b.linux || b.android)l[1] = 12;\n u = c.style;\n u.position = _[0];\n u.zIndex = 99999999999;\n var p = 1;\n b.androidstock ? p = b.pixelratio : b.chrome && 40 > b.chromeversion && (u[ib] = _[20]);\n _[5] != l[0] ? u.fontFamily = l[0] : b.ios ? (u.fontFamily = _[38], u.fontWeight = _[484], _[5] == l[1] && (l[1] = 14)) : u.font = \"menu\";\n _[5] != l[1] && (u.fontSize = l[1] * p * (b.android ? 1.2 : 1) + \"px\");\n _[5] != l[2] && (u.lineHeight = l[2]);\n u.background = ca(l[3]);\n u.color = ca(l[4]);\n u.border = l[6] + _[23] + ca(l[7]);\n u.borderRadius = l[8] * p + \"px\";\n u.minWidth = \"150px\";\n u.textAlign = \"left\";\n u[pc] = l[9] + \"px \" + l[10] + \"px \" + l[11] + \"px \" + ca(l[12]);\n var D = Ja(), u = D.style;\n u.border = l[13] + _[23] + ca(l[14]);\n u.paddingTop = l[15] * p + \"px\";\n u.paddingBottom = l[16] * p + \"px\";\n Pa.touch && R(D, b.browser.events.touchstart, function (c) {\n Aa(c);\n c.stopPropagation()\n }, !1);\n c.appendChild(D);\n var z = y.item.getArray(), q, J, C = 0, Q, A = z.length, H, qa = 0 != (Ya & 16), ea = qa, Ca = qa, S = !1, Z = !1;\n for (H = 0; H < A; H++)if (q = z[H])if (J = q.caption)J = Ed(unescape(J)), q.separator && 0 < C && g(), Q = F(J), _[46] == Q ? 0 == ea && (ea = !0, e(), C++) : Na && _[430] == Q ? 0 == Ca && (Ca = !0, v(), C++) : _[110] == Q ? (S = !0, b.fullscreensupport && (w(), C++)) : _[334] == Q ? (Z = !0, x(), C++) : (Q = q.visible && (!q.showif || da.calc(null, q.showif))) ? (k(J, q.enabled, q.onclick), C++) : 0 == Q && q.separator && 0 < C && D.removeChild(D.lastChild);\n Na && 0 == Ca && (0 < C && (g(), C = 0), v());\n 0 == ea && (0 < C && g(), e(), C++);\n 0 == S && 1 == y.fullscreen && b.fullscreensupport && (w(), C++);\n 0 == Z && 1 == y.versioninfo && (0 < C && g(), x(), C++);\n if (0 == C)return null;\n u = c.style;\n u.left = _[122];\n u.top = \"10px\";\n var B = 0;\n f && (u.opacity = 0);\n setTimeout(r, 16);\n return c\n }\n\n function qf() {\n function a(a, d, b) {\n a.__defineGetter__(d, b)\n }\n\n m = new Fb;\n m.set = I;\n m.get = U;\n m.call = Zb;\n m.trace = la;\n m[\"true\"] = !0;\n m[_[31]] = !1;\n m.strict = !1;\n m.version = _[432];\n m.build = _[348];\n m.buildversion = m.version;\n m.debugmode = !1;\n m.tweentypes = ac;\n m.basedir = _[349];\n m.showtext = function () {\n };\n m.bgcolor = 0;\n m[rc[0]] = m[rc[1]] = !0;\n m.haveexternalinterface = !0;\n m.havenetworkaccess = !0;\n m.device = b;\n m.browser = b.browser;\n m._have_top_access = b.topAccess;\n m._isrealdesktop = b.realDesktop;\n m.iosversion = b.iosversion;\n m.isphone = b.iphone;\n m.ispad = b.ipad;\n m.isandroid = b.android;\n m.ishtml5 = !0;\n m.isflash = !1;\n m.ismobile = b.mobile;\n m.istablet = b.tablet;\n m.isdesktop = b.desktop;\n m.istouchdevice = b.touchdevice;\n m.isgesturedevice = b.gesturedevice;\n a(m, _[351], function () {\n return bc / X\n });\n a(m, _[326], function () {\n return vb / X\n });\n ha(m, _[352], function () {\n return X\n }, function (a) {\n a = Number(a);\n isNaN(a) && (a = 1);\n 1E-4 < Math.abs(a - X) && (X = a, V.onResize(null, !0))\n });\n pb = m.area = new rf;\n m.wheeldelta = 0;\n m.wheeldelta_raw = Number.NaN;\n m.wheeldelta_touchscale = 0;\n m.keycode = 0;\n m.idletime = .5;\n m.__defineGetter__(_[397], Ta);\n m.__defineGetter__(_[500], Math.random);\n ha(m, _[110], function () {\n return V.fullscreen\n }, function (a) {\n V.setFullscreen(pa(a))\n });\n ha(m, _[389], function () {\n return ra.swfpath\n }, function (a) {\n ra.swfpath = a\n });\n m.hlookat_moveforce = 0;\n m.vlookat_moveforce = 0;\n m.fov_moveforce = 0;\n m.multireslevel = 0;\n m.lockmultireslevel = \"-1\";\n m.downloadlockedlevel = !1;\n O = m.mouse = {};\n O.down = !1;\n O.up = !1;\n O.moved = !1;\n O.downx = 0;\n O.downy = 0;\n O.x = 0;\n O.y = 0;\n a(O, _[495], function () {\n return O.x + pb.pixelx\n });\n a(O, _[493], function () {\n return O.y + pb.pixely\n });\n a(O, \"dd\", function () {\n var a = O.x - O.downx, d = O.y - O.downy;\n return Math.sqrt(a * a + d * d)\n });\n p = m.view = new sf;\n m.screentosphere = p.screentosphere;\n m.spheretoscreen = p.spheretoscreen;\n m.loadFile = ra.loadfile;\n m.decodeLicense = ra.decodeLicense;\n m.haveLicense = gc(function (a) {\n var d = !1, b = Ya;\n switch (a.toLowerCase().charCodeAt(0)) {\n case 107:\n d = 0 != (b & 1);\n break;\n case 109:\n d = 0 != (b & 128);\n break;\n case 98:\n d = 0 != (b & 16)\n }\n return d\n });\n m.parsepath = m.parsePath = ra.parsePath;\n m.contextmenu = new tf;\n ia = m.control = new uf;\n ae = m.cursors = new vf;\n N = m.image = {};\n xa = m.plugin = new bb(Ob);\n m.layer = xa;\n Ua = m.hotspot = new bb(wf);\n Yb = m.events = new bb(null, !0);\n Yb.dispatch = Ka;\n ja = m.display = {\n currentfps: 60,\n r_ft: 16,\n FRM: 0,\n _framebufferscale: 1,\n mipmapping: \"auto\",\n loadwhilemoving: b.realDesktop ? \"true\" : \"auto\",\n _stereo: !1,\n stereooverlap: 0,\n hotspotrenderer: \"auto\",\n hardwarelimit: b.realDesktop && b.safari && \"6\" > b.safariversion ? 2E3 : b.realDesktop && !b.webgl ? 2560 : b.iphone && b.retina && !b.iphone5 ? 800 : b.iphone && !b.retina ? 600 : b.ipod && b.retina ? 640 : b.mobile || b.tablet ? 1024 : 4096\n };\n ha(ja, _[491], function () {\n return ja._stereo\n }, function (a) {\n a = pa(a);\n ja._stereo != a && (ja._stereo = a, V.svglayer && (V.svglayer.style.display = a ? \"none\" : \"\"))\n });\n ha(ja, _[383], function () {\n var a = ja.FRM | 0;\n return 0 == a ? \"auto\" : \"\" + a\n }, function (a) {\n a |= 0;\n 0 > a && (a = 0);\n ja.FRM = a\n });\n ha(ja, _[231], function () {\n return ja._framebufferscale\n }, function (a) {\n a = Number(a);\n if (isNaN(a) || 0 == a)a = 1;\n ja._framebufferscale = a;\n pb.haschanged = !0;\n V.resizeCheck(!0)\n });\n m.memory = {maxmem: b.realDesktop ? Math.min(Math.max(150, 48 * screen.availWidth * screen.availHeight >> 20), 400) : b.ios && 7.1 > b.iosversion || b.iphone && !b.iphone5 ? 40 : 50};\n m.network = {retrycount: 2};\n sc = m.progress = {};\n sc.progress = 0;\n Ra = new Ob;\n Ra.name = \"STAGE\";\n Za = new Ob;\n Za.name = _[480];\n xa.alpha = 1;\n Ua.alpha = 1;\n Ua.visible = !0;\n ha(xa, _[12], function () {\n return \"none\" != V.pluginlayer.style.display\n }, function (a) {\n V.pluginlayer.style.display = pa(a) ? \"\" : \"none\"\n });\n m.xml = {};\n m.xml.url = \"\";\n m.xml.content = null;\n m.xml.scene = null;\n var d = m.security = {};\n ha(d, \"cors\", function () {\n return Tc\n }, function (a) {\n Tc = a\n });\n za = m.autorotate = {};\n za.enabled = !1;\n za.waittime = 1.5;\n za.accel = 1;\n za.speed = 10;\n za.horizon = 0;\n za.tofov = null;\n za.currentmovingspeed = 0;\n m.math = function () {\n function a(d) {\n return function (a, b) {\n void 0 === b ? I(a, Math[d](n(a))) : I(a, Math[d](n(b)))\n }\n }\n\n var d = {}, b = _[157].split(\" \"), n = function (a) {\n var d = U(a);\n return Number(null !== d ? d : a)\n }, k;\n for (k in b) {\n var e = b[k];\n d[e] = a(e)\n }\n d.pi = Ga;\n d.atan2 = function (a, d, b) {\n I(a, Math.atan2(n(d), n(b)))\n };\n d.min = function () {\n var a = arguments, d = a.length, b = 3 > d ? 0 : 1, r = n(a[b]);\n for (b++; b < d; b++)r = Math.min(r, n(a[b]));\n I(a[0], r)\n };\n d.max = function () {\n var a = arguments, d = a.length, b = 3 > d ? 0 : 1, r = n(a[b]);\n for (b++; b < d; b++)r = Math.max(r, n(a[b]));\n I(a[0], r)\n };\n d.pow = da.pow;\n return d\n }();\n m.action = new bb;\n m.scene = new bb;\n m.data = new bb;\n m.addlayer = m.addplugin = function (a) {\n if (!Uc(a, _[204] + a + \")\"))return null;\n a = xa.createItem(a);\n if (!a)return null;\n null == a.sprite && (a._dyn = !0, a.create(), null == a._parent && V.pluginlayer.appendChild(a.sprite));\n return a\n };\n m.removelayer = m.removeplugin = function (a, d) {\n var b = xa.getItem(a);\n if (b) {\n if (pa(d)) {\n var n = b._childs;\n if (n)for (; 0 < n.length;)m.removeplugin(n[0].name, !0)\n }\n b.visible = !1;\n b.parent = null;\n b.sprite && V.pluginlayer.removeChild(b.sprite);\n b.destroy();\n xa.removeItem(a)\n }\n };\n m.addhotspot = function (a) {\n if (!Uc(a, _[321] + a + \")\"))return null;\n a = Ua.createItem(a);\n if (!a)return null;\n null == a.sprite && (a._dyn = !0, a.create(), V.hotspotlayer.appendChild(a.sprite));\n ld = !0;\n return a\n };\n m.removehotspot = function (a) {\n var d = Ua.getItem(a);\n if (d) {\n d.visible = !1;\n d.parent = null;\n if (d.sprite) {\n try {\n V.hotspotlayer.removeChild(d.sprite)\n } catch (b) {\n }\n if (d._poly) {\n try {\n V.svglayer.removeChild(d._poly)\n } catch (n) {\n }\n d._poly.kobject = null;\n d._poly = null\n }\n }\n d.destroy();\n Ua.removeItem(a)\n }\n }\n }\n\n function xf() {\n var a = p.haschanged, d = !1;\n jc++;\n ja.frame = jc;\n Oa.fps();\n var m = V.resizeCheck(), f = da.processAnimations(), a = a | p.haschanged;\n if (b.webgl || !b.ios || b.ios && 5 <= b.iosversion)f = !1;\n f |= ld;\n ld = !1;\n f && (p._hlookat += ((jc & 1) - .5) / (1 + p.r_zoom), a = !0);\n a |= Xa.handleloading();\n 0 == da.blocked && (a |= Pa.handleFrictions(), Xa.checkautorotate(p.haschanged) && (a = d = !0));\n p.continuousupdates && (a = d = !0);\n a || m ? (Oa.startFrame(), Xa.updateview(d, !0), Oa.finishFrame()) : (p.haschanged && p.updateView(), ob(!1));\n Xa.updateplugins(m);\n b.desktop && Xa.checkHovering()\n }\n\n var Jb = this;\n try {\n !Object.prototype.__defineGetter__ && Object.defineProperty({}, \"x\", {\n get: function () {\n return !0\n }\n }).x && (Object.defineProperty(Object.prototype, _[233], {\n enumerable: !1,\n configurable: !0,\n value: function (a, d) {\n Object.defineProperty(this, a, {get: d, enumerable: !0, configurable: !0})\n }\n }), Object.defineProperty(Object.prototype, _[234], {\n enumerable: !1,\n configurable: !0,\n value: function (a, d) {\n Object.defineProperty(this, a, {set: d, enumerable: !0, configurable: !0})\n }\n }))\n } catch (Bf) {\n }\n\n var jb = navigator, aa = document, L = window, Ga = Math.PI, Y = Ga / 180, tc = Number.NaN, md = 0, Ta = L.performance && L.performance.now ? function () {\n return L.performance.now() - md\n } : function () {\n return (new Date).getTime() - md\n }, md = Ta(), Xc = String.fromCharCode, m = null, bc = 0, vb = 0, Qa = 0, ya = 0, X = 1, Yc = 1, uc = 0, pb = null, za = null, ia = null, ae = null, ja = null, Yb = null, sc = null, Ua = null, N = null, O = null, xa = null, p = null, Ra = null, Za = null, jc = 0, nd = 60, Ya = 14, od = null, rc = [_[362], _[489]], Na = null, Tc = \"\", vc = null, ld = !1, kc = 0, Kc = !0, b = {\n runDetection: function (a) {\n function d() {\n var a = screen.width, c = screen.height, C = b.topAccess ? top : L, d = C.innerWidth, Q = C.innerHeight, C = C.orientation | 0, A = a / (c + 1), h = d / (Q + 1);\n if (1 < A && 1 > h || 1 > A && 1 < h)A = a, a = c, c = A;\n v.width = a;\n v.height = c;\n v.orientation = C;\n b.window = {width: d, height: Q};\n a /= d;\n return b.pagescale = a\n }\n\n function m(a, c) {\n for (var C = [\"ms\", \"Moz\", _[494], \"O\"], d = 0; 5 > d; d++) {\n var b = 0 < d ? C[d - 1] + a.slice(0, 1).toUpperCase() + a.slice(1) : a;\n if (void 0 !== t.style[b])return b\n }\n return null\n }\n\n var f = \"multires flash html5 html mobile tablet desktop ie edge webkit ios iosversion iphone ipod ipad retina hidpi android androidstock blackberry touchdevice gesturedevice fullscreensupport windows mac linux air standalone silk\".split(\" \"), g, n, k, e, w = aa.documentElement, x = a.mobilescale;\n isNaN(x) && (x = .5);\n n = f.length;\n for (g = 0; g < n; g++)k = f[g], b[k] = !1;\n b.html5 = b.html = !0;\n b.iosversion = 0;\n b.css3d = !1;\n b.webgl = !1;\n b.topAccess = !1;\n b.simulator = !1;\n b.multiressupport = !1;\n b.panovideosupport = !1;\n var v = b.screen = {};\n try {\n top && top.document && (b.topAccess = !0)\n } catch (r) {\n }\n var y = jb.platform, f = F(y), l = jb.userAgent, u = F(l), h = n = \"\";\n 0 <= f.indexOf(\"win\") ? b.windows = !0 : 0 <= f.indexOf(\"mac\") ? b.mac = !0 : 0 <= f.indexOf(\"linux\") && (b.linux = !0);\n var c = L.devicePixelRatio, p = 2 <= c;\n g = 1;\n var D = 0 <= f.indexOf(\"ipod\"), z = 0 <= f.indexOf(_[41]), q = 0 <= f.indexOf(\"ipad\"), J = z || D || q;\n e = u.indexOf(\"silk/\");\n var C = 0 <= u.indexOf(_[469]) || 0 <= u.indexOf(_[145]), Q = 0 > e && !C && 0 <= u.indexOf(_[464]), A = k = !1, H = !1, qa = l.indexOf(_[147]), ea = L.chrome && !C, Ca = l.indexOf(_[460]), S = !1, Z = (J || Q || e) && (b.windows || b.mac);\n C && (qa = Ca = -1);\n var f = !1, B = 0;\n Yc = d();\n if (J) {\n if (b.ios = !0, n = y, e = l.indexOf(\"OS \"), 0 < e && (e += 3, B = l.slice(e, l.indexOf(\" \", e)).split(\"_\").join(\".\"), n += _[457] + B, b.iosversion = parseFloat(B), \"6.0\" <= B && (z && !p || D && p) && (b._iOS6_canvas_bug = !0)), k = z || D, A = q, B = Math.max(screen.width, screen.height), b.iphone = z || D, b.iphone5 = z && 500 < B, b.ip6p = z && 735 < B, b.ipod = D, b.ipad = q, b.retina = p, z || D)g *= x\n } else if (Q)if (e = l.indexOf(_[454]), B = parseFloat(l.slice(e + 8)), b.android = !0, b.linux = !1, b.androidversion = B, n = l.slice(e, l.indexOf(\";\", e)), k = 0 < u.indexOf(_[44]), ea && 0 < u.indexOf(_[275]) && (k = 480 > Math.min(screen.width, screen.height)), A = !k, B = l.indexOf(\")\"), 5 < B && (e = l.slice(0, B).lastIndexOf(\";\"), 5 < e && (p = l.indexOf(_[511], e), 0 < p && (B = p), n += \" (\" + l.slice(e + 2, B) + \")\")), 0 < Ca && isNaN(c) && (c = Yc), A && 1 < c) {\n if (b.hidpi = !0, g = c, 0 <= qa || 0 < Ca)b.hidpi = !1, g = 1\n } else k && (b.hidpi = 1 < c, g = c * x, .5 > g && (g = .5), 0 <= qa || 0 < Ca || Z) && (b.hidpi = !1, g = x); else {\n if (0 <= u.indexOf(_[345]) || 0 <= u.indexOf(_[344]) || 0 <= u.indexOf(\"bb10\"))S = !0, b.blackberry = !0, n = _[336], f = !0;\n 0 <= e ? (S = !0, b.silk = !0, n = _[297] + parseFloat(u.slice(e + 5)).toFixed(2), H = !1, k = 0 <= u.indexOf(_[44]), A = !k, f = !0) : 0 <= u.indexOf(\"ipad\") || 0 <= u.indexOf(_[41]) ? H = S = !0 : 0 <= u.indexOf(_[138]) ? (A = !0, n += _[513]) : 0 <= u.indexOf(_[44]) ? (k = !0, n += _[518], g = x) : H = !0\n }\n D = jb.vendor && 0 <= jb.vendor.indexOf(\"Apple\");\n z = L.opera;\n p = !1;\n H && (n = _[285]);\n e = l.indexOf(_[451]);\n 0 < e && (D || z || Q) && (e += 8, B = l.slice(e, l.indexOf(\" \", e)), D ? (b.safari = !0, b.safariversion = B, h = _[520]) : (Q && (h = _[238], f = !0), z && (b.opera = !0, b.operaversion = B, h = \"Opera\")), h += \" \" + B);\n J && (e = l.indexOf(_[521]), 0 < e && (b.safari = !0, e += 6, B = parseFloat(l.slice(e, l.indexOf(\" \", e))), b.crios = B, h = _[449] + B.toFixed(1)));\n e = qa;\n if (0 <= e || ea)B = parseFloat(l.slice(e + 7)), b.chrome = !0, b.chromeversion = B, h = _[147] + (isNaN(B) ? \"\" : \" \" + B.toFixed(1)), e = u.indexOf(\"opr/\"), 0 < e && (h = _[517] + parseFloat(l.slice(e + 4)).toFixed(1) + _[378]), Q && 28 > B && (f = !0), Q && 1 < c && 20 > B && !Z && (b.hidpi = !0, g = c, k && (g *= x)); else if (e = Ca, 0 > e && (e = l.indexOf(_[514])), 0 <= e && (B = parseFloat(l.slice(1 + l.indexOf(\"/\", e))), b.firefox = !0, b.firefoxversion = B, h = _[434] + (isNaN(B) ? \"\" : B.toFixed(1)), Q && 35 > B && (f = !0)), e = l.indexOf(\"MSIE \"), p = 0 <= e || C)H = b.ie = !0, A = !1, h = _[224], 0 < u.indexOf(_[436]) || 0 < u.indexOf(_[289]) ? (k = !0, H = !1, h = _[445] + h, g = x) : 0 < u.indexOf(\"arm;\") && 1 < jb.msMaxTouchPoints && (A = !0, H = !1, h = _[447] + h, f = !0, g = 1), 0 <= e ? (B = l.slice(e + 4, l.indexOf(\";\", e)), b.ieversion = parseFloat(B), h += B) : (e = l.indexOf(\"rv:\"), 0 <= e ? (B = parseFloat(l.slice(e + 3)), !isNaN(B) && 10 <= B && 100 > B && (b.ieversion = B, h += \" \" + B.toFixed(1))) : (e = u.indexOf(_[145]), 0 <= e && (h = _[260], b.edge = !0, Kc = !1, B = parseFloat(l.slice(e + 6)), isNaN(B) || (b.ieversion = B, h += \" \" + (B + 8).toFixed(5))))), n = h, h = \"\";\n b.android && (b.androidstock = !(b.chrome || b.firefox || b.opera));\n 0 == b.ie && 0 < (e = u.indexOf(_[448])) && (B = parseFloat(u.slice(e + 7)), !isNaN(B) && 0 < B && (b.webkit = !0, b.webkitversion = B));\n b.pixelratio = isNaN(c) ? 1 : c;\n b.fractionalscaling = 0 != b.pixelratio % 1;\n var c = {}, t = Ja();\n c.find = m;\n c.prefix = p ? \"ms\" : b.firefox ? \"moz\" : b.safari || b.chrome || b.androidstock ? _[70] : \"\";\n c.perspective = m(_[335]);\n c.transform = m(_[387]);\n c.backgroundsize = m(_[256]);\n c.boxshadow = m(_[388]);\n c.boxshadow_style = _[252] == c.boxshadow ? _[212] : _[292] == c.boxshadow ? _[249] : _[342];\n Q && \"4.0\" > b.androidversion && (c.perspective = null);\n c.perspective && (b.css3d = !0, _[217] == c.perspective && L.matchMedia && (u = L.matchMedia(_[195]))) && (b.css3d = 1 == u.matches);\n t = null;\n b.webgl = function () {\n var a = null;\n try {\n for (var c = Ja(2), C = 0; 4 > C && !(a = c.getContext([_[30], _[83], _[116], _[112]][C])); C++);\n } catch (d) {\n }\n return null != a\n }();\n u = {};\n u.useragent = l;\n u.platform = y;\n u.domain = null;\n u.location = L.location.href;\n y = u.events = {};\n u.css = c;\n if (J || Q || void 0 !== w.ontouchstart || S)b.touchdevice = !0, b.gesturedevice = !0;\n J = 0;\n (jb.msPointerEnabled || jb.pointerEnabled) && b.ie && (Q = jb.msMaxTouchPoints || jb.maxTouchPoints, jb.msPointerEnabled && (J = 2), jb.pointerEnabled && (J = 1), b.touchdevice = 0 < Q, b.gesturedevice = 1 < Q);\n y.touchstart = [_[343], _[331], _[290]][J];\n y.touchmove = [_[115], _[330], _[283]][J];\n y.touchend = [_[118], _[390], _[328]][J];\n y.touchcancel = [_[327], _[280], _[236]][J];\n y.gesturestart = [_[300], _[96], _[96]][J];\n y.gesturechange = [_[276], _[91], _[91]][J];\n y.gestureend = [_[355], _[99], _[99]][J];\n y.pointerover = [_[8], _[8], _[34]][J];\n y.pointerout = [_[9], _[9], _[35]][J];\n b.pointerEvents = b.opera || b.ie && 11 > b.ieversion ? !1 : !0;\n h && (n += \" - \" + h);\n b.realDesktop = H;\n h = a.vars ? F(a.vars.simulatedevice) : null;\n _[392] == h && (0 <= l.indexOf(_[146]) || 0 <= l.indexOf(\"iPod\") ? h = _[41] : 0 <= l.indexOf(\"iPad\") && (h = \"ipad\"));\n b.touchdeviceNS = b.touchdevice;\n l = _[41] == h ? 1 : \"ipad\" == h ? 2 : 0;\n 0 < l && (b.simulator = !0, b.crios = 0, n += \" - \" + (1 == l ? _[146] : \"iPad\") + _[356], g = l * x, k = 1 == l, A = 2 == l, H = !1, b.ios = !0, b.iphone = k, b.ipad = A, b.touchdevice = !0, b.gesturedevice = !0);\n b.browser = u;\n b.infoString = n;\n a = F(a.fakedevice);\n _[44] == a ? (k = !0, A = H = !1) : _[138] == a ? (A = !0, k = H = !1) : _[465] == a && (H = !0, k = A = !1);\n b.mobile = k;\n b.tablet = A;\n b.desktop = H;\n b.normal = A || H;\n b.touch = b.gesturedevice;\n b.mouse = H;\n b.getViewportScale = d;\n X = g;\n 0 == b.simulator && 0 != aa.fullscreenEnabled && 0 != aa.mozFullScreenEnabled && 0 != aa.webkitFullScreenEnabled && 0 != aa.webkitFullscreenEnabled && 0 != aa.msFullscreenEnabled && (a = [_[223], _[201], _[194], _[191], _[209]], x = -1, g = null, n = _[228], w[a[0]] ? (g = \"\", x = 0) : w[a[1]] ? (g = \"moz\", x = 1) : w[a[2]] ? (g = _[70], x = 2) : w[a[3]] ? (g = _[70], x = 3) : w[a[4]] && (g = \"MS\", n = _[229], x = 4), 0 <= x && 0 == f && (b.fullscreensupport = !0, y.fullscreenchange = g + n, y.requestfullscreen = a[x]));\n b.buildList();\n delete b.runDetection\n }, buildList: function () {\n var a, d = \"|all\";\n for (a in b)a == F(a) && b[a] && (d += \"|\" + a);\n b.haveList = d + \"|\"\n }, checkSupport: function (a) {\n a = F(a).split(\"no-\").join(\"!\").split(\".or.\").join(\"|\").split(\".and.\").join(\"+\").split(\"|\");\n var d, m, f = a.length;\n for (d = 0; d < f; d++) {\n var g = a[d].split(\"+\"), n = !1;\n for (m = 0; m < g.length; m++) {\n var n = g[m], k = !1;\n 33 == n.charCodeAt(0) && (n = n.slice(1), k = !0);\n if (0 == n.indexOf(\"ios\") && b.ios)if (3 == n.length || b.iosversion >= parseFloat(n.slice(3)))if (k) {\n n = !1;\n break\n } else n = !0; else if (k)n = !0; else {\n n = !1;\n break\n } else if (0 <= b.haveList.indexOf(\"|\" + n + \"|\"))if (k) {\n n = !1;\n break\n } else n = !0; else if (k)n = !0; else {\n n = !1;\n break\n }\n }\n if (n)return !0\n }\n return !1\n }\n }, cb = 0, Kb = 0, Hd = 0, Nb = 0, Lc = 0, be = 0, jd = !1, ib = null, Id = null, pd = null, Zc = null, pc = null, ce = !1, Lb = 0, Fb = function () {\n var a = this;\n a._type = \"base\";\n a.registerattribute = function (d, b, f, g) {\n d = F(d);\n f && g ? (a.hasOwnProperty(d) && (b = ga(a[d], typeof b)), a.__defineGetter__(d, g), a.__defineSetter__(d, f), f(b)) : a.hasOwnProperty(d) ? a[d] = ga(a[d], typeof b) : a[d] = b\n };\n a.createobject = function (d) {\n d = F(d);\n try {\n return a.hasOwnProperty(d) ? a[d] : a[d] = new Fb\n } catch (b) {\n }\n return null\n };\n a.removeobject = a.removeattribute = function (d) {\n d = F(d);\n try {\n a[d] = null, delete a[d]\n } catch (b) {\n }\n };\n a.createarray = function (d) {\n d = F(d);\n return a[d] && a[d].isArray ? a[d] : a[d] = new bb(Fb)\n };\n a.removearray = function (d) {\n d = F(d);\n a[d] && a[d].isArray && (a[d] = null, delete a[d])\n };\n a.getattributes = function () {\n var d = [], b = [\"index\", _[438]], f;\n for (f in a)_[11] != typeof a[f] && -1 == b.indexOf(f) && \"_\" != f.charAt(0) && d.push(f);\n return d\n }\n }, bb = function (a, d) {\n var b = [], f = {};\n this.isArray = !0;\n this.isDynArray = 1 == d;\n this.__defineGetter__(\"count\", function () {\n return b.length\n });\n this.__defineSetter__(\"count\", function (a) {\n 0 == a ? (b = [], f = {}) : b.length = a\n });\n this.createItem = function (d, n) {\n var k = -1, e = null, k = String(d).charCodeAt(0);\n if (48 <= k && 57 >= k) {\n if (n)return null;\n k = parseInt(d, 10);\n e = b[k];\n if (null == e || void 0 == e)e = null != a ? new a : {}, e.name = \"n\" + k, e.index = k, b[k] = e, f[e.name] = e\n } else if (d = F(d), e = f[d], null == e || void 0 == e)e = n ? n : null != a ? new a : {}, k = b.push(e) - 1, e.index = k, e.name = d, b[k] = e, f[d] = e;\n return e\n };\n this.getItem = function (a) {\n var d = -1, d = String(a).charCodeAt(0);\n 48 <= d && 57 >= d ? (d = parseInt(a, 10), a = b[d]) : a = f[F(a)];\n return a\n };\n this.getArray = function () {\n return b\n };\n this.renameItem = function (a, d) {\n var k = -1, k = String(a).charCodeAt(0);\n 48 <= k && 57 >= k ? (k = parseInt(a, 10), k = b[k]) : k = f[F(a)];\n k && (delete f[k.name], d = F(d), k.name = d, f[d] = k)\n };\n this.removearrayitem = this.removeItem = function (a) {\n var d = -1, d = null;\n a = String(a);\n d = String(a).charCodeAt(0);\n 48 <= d && 57 >= d ? (d = parseInt(a, 10), d = b[d]) : d = f[F(a)];\n if (d) {\n f[d.name] = null;\n delete f[d.name];\n b.splice(d.index, 1);\n var k;\n k = b.length;\n for (a = d.index; a < k; a++)b[a].index--\n }\n return d\n };\n this.sortby = function (a, d) {\n var f, e, w = !1 === d ? -1 : 1;\n e = b.length;\n if (1 < e)for (b.sort(function (d, b) {\n var r = d[a], e = b[a];\n return void 0 === r && void 0 !== e ? +w : void 0 !== r && void 0 === e || r < e ? -w : r > e ? +w : 0\n }), f = 0; f < e; f++)b[f].index = f\n }\n }, ra = {};\n (function () {\n function a(a) {\n for (var d = w, b = [], e, g, h, c, f, n = a.length, k = 0, q = 0; k < n;)e = d.indexOf(a.charAt(k++)), g = d.indexOf(a.charAt(k++)), c = d.indexOf(a.charAt(k++)), f = d.indexOf(a.charAt(k++)), e = e << 2 | g >> 4, g = (g & 15) << 4 | c >> 2, h = (c & 3) << 6 | f, b[q++] = e, 64 != c && (b[q++] = g), 64 != f && (b[q++] = h);\n return b\n }\n\n function d(a, d) {\n var b, e, g, h = [];\n h.length = 256;\n if (80 == d || 82 == d) {\n e = 15;\n var c = _[89];\n 82 == d && od && (e = 127, c = od);\n b = a[65] & 7;\n for (g = 0; 128 > g; g++)h[2 * g] = a[g], h[2 * g + 1] = String(c).charCodeAt(g & e);\n e = a.length - 128 - b;\n b += 128\n } else if (71 == d) {\n b = a[4];\n e = (a[b] ^ b) & 15 | ((a[2 + b] ^ b) >> 2 & 63) << 4 | ((a[1 + b] ^ b) >> 1 & 63) << 10 | ((a[3 + b] ^ b) & 63) << 16;\n for (g = 0; 256 > g; g++)h[g] = a[g] ^ a[256 + e + b + 2 * g];\n b = 256\n }\n x.srand(h, 256);\n return x.flip(a, b, e)\n }\n\n function p(a, d, b) {\n if (null == a)return null;\n a = \"\" + a;\n 1 == d && m.basedir && 0 > a.indexOf(\"://\") && 0 != a.indexOf(\"/\") && _[74] != a.slice(0, 5) && (a = m.basedir + a);\n a = a.split(\"\\\\\").join(\"/\");\n null == e.firstxmlpath && (e.firstxmlpath = \"\");\n null == e.currentxmlpath && (e.currentxmlpath = \"\");\n null == e.swfpath && (e.swfpath = \"\");\n null == e.htmlpath && (e.htmlpath = \"\");\n for (d = a.indexOf(\"%\"); 0 <= d;) {\n var g = a.indexOf(\"%\", d + 1);\n if (g > d) {\n var f = a.slice(d + 1, g), h = null;\n if (36 == f.charCodeAt(0)) {\n if (f = U(f.slice(1)), null != f) {\n f = \"\" + f;\n a = 47 == f.charCodeAt(0) || 0 < f.indexOf(\"://\") ? f + a.slice(g + 1) : a.slice(0, d) + f + a.slice(g + 1);\n d = a.indexOf(\"%\");\n continue\n }\n } else switch (f) {\n case _[437]:\n h = 1 == b ? \"\" : e.firstxmlpath;\n break;\n case _[361]:\n h = e.currentxmlpath;\n break;\n case _[475]:\n h = 1 == b ? \"\" : e.swfpath;\n break;\n case _[422]:\n h = 1 == b ? \"\" : e.htmlpath;\n break;\n case _[473]:\n h = 1 == b ? \"\" : m.basedir\n }\n null != h ? (g++, \"/\" == a.charAt(g) && g++, a = h + a.slice(g), d = a.indexOf(\"%\")) : d = a.indexOf(\"%\", d + 1)\n } else d = -1\n }\n return a\n }\n\n function f(b, e, f) {\n var l, n;\n 0 <= (l = e.indexOf(_[333])) ? (n = e.indexOf(_[309])) > l && (e = e.slice(l + 11, n), l = e.indexOf(_[393]), 0 <= l && (e = e.slice(l + 9, -3))) : f && 0 <= (l = e.indexOf('\"[[KENC')) && (n = e.lastIndexOf(']]\"')) > l && (e = e.slice(l + 3, n));\n var h;\n n = null;\n h = e.slice(0, 8);\n l = e.slice(8);\n f = !0 === f && Ya & 64 || !f && Ya & 32;\n if (\"KENC\" != h.slice(0, 4))return f ? (b && Ea(b + _[32]), null) : e;\n var c = !1, k = e = 0, k = 0, w = !1;\n e = String(h).charCodeAt(4);\n if (80 == e || 82 == e || 71 == e)if (k = String(h).charCodeAt(5), 85 == k && (k = String(h).charCodeAt(6), w = 90 == k, 66 == k || w))c = !0;\n if (!c)return b && la(3, b + _[170]), null;\n if (f && 80 == e)return b && Ea(b + _[32]), null;\n b = null;\n if (w) {\n b = e;\n n = String.fromCharCode;\n h = 1;\n f = l.length;\n var m = e = null, q = k = c = w = 0, x = 0, C = 0, Q = 0;\n try {\n n.apply(null, (new Uint8Array(4)).subarray(2))\n } catch (A) {\n h = 0\n }\n n = h ? Uint8Array : Array;\n for (e = new n(4 * f / 5); w < f;)k = l.charCodeAt(w++) - 35, q = l.charCodeAt(w++) - 35, x = l.charCodeAt(w++) - 35, C = l.charCodeAt(w++) - 35, Q = l.charCodeAt(w++) - 35, 56 < k && k--, 56 < q && q--, 56 < x && x--, 56 < C && C--, 56 < Q && Q--, Q += 85 * (85 * (85 * (85 * k + q) + x) + C), e[c++] = Q >> 24 & 255, e[c++] = Q >> 16 & 255, e[c++] = Q >> 8 & 255, e[c++] = Q & 255;\n e = d(e, b);\n m = new n(e[2] << 16 | e[1] << 8 | e[0]);\n f = 8 + (e[6] << 16 | e[5] << 8 | e[4]);\n w = 8;\n for (c = 0; w < f;) {\n k = e[w++];\n q = k >> 4;\n for (x = q + 240; 255 === x; q += x = e[w++]);\n for (C = w + q; w < C;)m[c++] = e[w++];\n if (w === f)break;\n Q = c - (e[w++] | e[w++] << 8);\n q = k & 15;\n for (x = q + 240; 255 === x; q += x = e[w++]);\n for (C = c + q + 4; c < C;)m[c++] = m[Q++]\n }\n e.length = 0;\n n = l = g(m)\n } else b = a(l), b = d(b, e), null != b && (n = g(b));\n return n\n }\n\n function g(a) {\n for (var d = \"\", b = 0, e = 0, g = 0, h = 0, c = a.length; b < c;)e = a[b], 128 > e ? (0 < e && (d += Xc(e)), b++) : 191 < e && 224 > e ? (g = a[b + 1], d += Xc((e & 31) << 6 | g & 63), b += 2) : (g = a[b + 1], h = a[b + 2], e = (e & 15) << 12 | (g & 63) << 6 | h & 63, 65279 != e && (d += Xc(e)), b += 3);\n return d\n }\n\n function n(a, d, b) {\n void 0 !== d ? d(a, b) : Ea(a + _[80] + b + \")\")\n }\n\n function k(a, d, g, f, k) {\n if (0 == e.DMcheck(a))n(a, k, _[227]); else {\n var h = null, c = !1;\n if (b.ie && \"\" == aa.domain)try {\n h = new ActiveXObject(_[218]), c = !0\n } catch (w) {\n h = null\n }\n null == h && (h = new XMLHttpRequest);\n void 0 !== h.overrideMimeType && d && h.overrideMimeType(d);\n h.onreadystatechange = function () {\n if (4 == h.readyState) {\n var d = h.status, b = h.responseText;\n if (0 == d && b || 200 == d || 304 == d)if (g) {\n var e = null, e = c ? (new DOMParser).parseFromString(b, _[25]) : h.responseXML;\n f(a, e, d)\n } else f(a, b); else n(a, k, h.status)\n }\n };\n try {\n h.open(\"GET\", a, !0), h.send(null)\n } catch (m) {\n n(a, k, m)\n }\n }\n }\n\n var e = ra, w = _[183], w = w + (F(w) + _[273]);\n e.firstxmlpath = null;\n e.currentxmlpath = null;\n e.swfpath = null;\n e.htmlpath = null;\n e.parsePath = p;\n e.DMcheck = function (a) {\n var d;\n if (Ya & 256 && (d = aa.domain) && vc) {\n a = a.toLowerCase();\n var b = a.indexOf(\"://\");\n if (0 < b) {\n var b = b + 3, e = a.indexOf(\"/\", b);\n if (0 < e)return a = a.slice(b, e), b = a.indexOf(\":\"), 1 < b && (a = a.slice(0, b)), a == d\n } else return d == vc\n }\n return !0\n };\n var x = new function () {\n var a, d, b;\n this.srand = function (e, g) {\n var h, c, f, n, k = [];\n k.length = 256;\n for (h = 0; 256 > h; h++)k[h] = h;\n for (c = h = 0; 256 > h; h++)c = c + k[h] + e[h % g] & 255, n = k[h], k[h] = k[c], k[c] = n;\n for (f = c = h = 0; 256 > f; f++)h = h + 1 & 255, c = c + k[h] & 255, n = k[h], k[h] = k[c], k[c] = n;\n a = k;\n d = h;\n b = c\n };\n this.flip = function (e, g, h) {\n var c = [], f, n;\n c.length = h;\n var k = a, q = d, w = b;\n for (f = 0; f < h; f++, g++)q = q + 1 & 255, w = w + k[q] & 255, c[f] = e[g] ^ a[k[q] + k[w] & 255], n = k[q], k[q] = k[w], k[w] = n;\n d = q;\n b = w;\n return c\n }\n };\n e.loadimage = function (a, d, b) {\n var e = Ja(1);\n e.addEventListener(\"load\", function () {\n d && d(e)\n });\n e.addEventListener(_[48], function () {\n b && b(null, !1)\n }, !1);\n e.addEventListener(\"abort\", function () {\n b && b(null, !0)\n }, !1);\n e.src = a;\n return e\n };\n e.loadfile = function (a, d, b) {\n e.loadfile2(a, null, d, b)\n };\n e.loadxml = function (a, d, b) {\n e.loadfile2(a, _[25], d, b, !0)\n };\n e.loadfile2 = function (a, d, b, e, g) {\n g = !0 === g;\n var h = {errmsg: !0};\n h.rqurl = a;\n a = p(a);\n h.url = a;\n k(a, d, g, function (a, n, k) {\n !0 === g ? b(n, k) : (n = f(a, n, _[92] == d), h.data = n, null != n ? b && b(h) : e && e(h))\n }, g ? e : function (d, b) {\n e && e(h);\n h.errmsg && la(3, a + _[80] + b + \")\")\n })\n };\n e.resolvecontentencryption = f;\n e.b64u8 = function (d) {\n return g(a(d))\n };\n e.decodeLicense = function (a) {\n return null\n }\n })();\n\n var T = {};\n (function () {\n function a(d) {\n var b, e, g = d.childNodes, f;\n e = g.length;\n for (b = 0; b < e; b++)if (f = g.item(b))switch (f.nodeType) {\n case 1:\n a(f);\n break;\n case 8:\n d.removeChild(f), b--, e--\n }\n }\n\n function d(a, d) {\n var b, e, g = a.childNodes, f = -1;\n e = g.length;\n if (1 <= e)for (b = 0; b < e; b++)if (F(g[b].nodeName) == d) {\n f = b;\n break\n }\n return 0 <= f ? g[f] : null\n }\n\n function p(d, e, g, f, n) {\n var k, u, h, c = null, K = null, D, z;\n z = 0;\n var q, J = d.length, C = new XMLSerializer, Q = !1;\n f || (Q = !0, f = [], n = [], m.xml.parsetime = Ta());\n for (var A = 0; A < J; A++)if ((k = d[A]) && k.nodeName && \"#text\" != k.nodeName && (u = k.nodeName, u = F(u), _[129] != u)) {\n u = null == e && _[46] == u ? null : e ? e + \".\" + u : u;\n if (h = k.attributes)if (h.devices && 0 == b.checkSupport(h.devices.value))continue; else if (h[\"if\"] && 0 == da.calc(null, h[\"if\"].value))continue;\n q = (K = h && h.name ? h.name.value : null) ? !0 : !1;\n if (g) {\n if (_[462] == u && g & 16)continue;\n if ((_[29] == u || \"layer\" == u) && g & 4)continue;\n if (_[1] == u && g & 128)continue;\n if (_[75] == u && g & 65536)continue;\n if (g & 64 && K)if (_[29] == u || \"layer\" == u) {\n if ((c = xa.getItem(K)) && c._pCD && c.keep)continue\n } else if (_[1] == u && (c = Ua.getItem(K)) && c._pCD && c.keep)continue\n }\n if (u)if (q) {\n if (_[14] == u || \"data\" == u || \"scene\" == u) {\n a(k);\n q = null;\n if ((_[14] == u || \"data\" == u) && k.childNodes && 1 <= k.childNodes.length)for (c = 0; c < k.childNodes.length; c++)if (4 == k.childNodes[c].nodeType) {\n q = k.childNodes[c].nodeValue;\n break\n }\n null == q && (q = C.serializeToString(k), q = q.slice(q.indexOf(\">\") + 1, q.lastIndexOf(\"</\")), _[14] == u && (q = q.split(_[497]).join('\"').split(_[499]).join(\"'\").split(_[139]).join(String.fromCharCode(160)).split(\"&amp;\").join(\"&\")));\n I(u + \"[\" + K + _[61], q);\n if (h) {\n var H;\n q = h.length;\n for (H = 0; H < q; H++)if (D = h[H], c = F(D.nodeName), D = D.value, \"name\" != c) {\n z = c.indexOf(\".\");\n if (0 < z)if (b.checkSupport(c.slice(z + 1)))c = c.slice(0, z); else continue;\n z = u + \"[\" + K + \"].\" + F(c);\n I(z, D)\n }\n }\n continue\n }\n u = u + \"[\" + K + \"]\";\n if (!Uc(K, u))continue;\n I(u + \".name\", K)\n } else(K = U(u)) && K.isArray && !K.isDynArray && (K = \"n\" + String(K.count), u = u + \"[\" + K + \"]\", I(u + \".name\", K));\n if (h) {\n var qa = \"view\" == u, c = u ? U(u) : null, K = null;\n q = h.length;\n c && (c._lateBinding && (K = c._lateBinding), (D = h.style) && (D = D.value) && null == K && (c.style = D, n.push(u), K = c._lateBinding = {}));\n for (H = 0; H < q; H++) {\n D = h[H];\n c = F(D.nodeName);\n D = D.value;\n var ea = u ? u + \".\" : \"\";\n if (\"name\" != c && \"style\" != c) {\n z = c.indexOf(\".\");\n if (0 < z)if (b.checkSupport(c.slice(z + 1)))c = c.slice(0, z).toLowerCase(); else continue;\n z = ea + c;\n K ? K[c] = D : !D || _[13] != typeof D || \"get:\" != D.slice(0, 4) && \"calc:\" != D.slice(0, 5) ? (I(z, D), qa && I(\"xml.\" + z, D)) : (f.push(z), f.push(D))\n }\n }\n }\n k.childNodes && 0 < k.childNodes.length && p(k.childNodes, u, g, f, n)\n }\n if (Q) {\n J = f.length;\n for (A = 0; A < J; A += 2)I(f[A], f[A + 1]);\n J = n.length;\n for (A = 0; A < J; A++)if (u = n[A], da.assignstyle(u, null), c = U(u))if (K = c._lateBinding)da.copyattributes(c, K), c._lateBinding = null;\n m.xml.parsetime = Ta() - m.xml.parsetime\n }\n }\n\n function f(a, d) {\n var b = null, e, g;\n g = a.length;\n for (e = 0; e < g; e++)if (b = a[e], !b || !b.nodeName || _[14] != F(b.nodeName)) {\n var k = b.attributes;\n if (k) {\n var n, h = k.length, c;\n for (n = 0; n < h; n++) {\n var m = k[n];\n c = F(m.nodeName);\n var p = c.indexOf(\".\");\n 0 < p && (c = c.slice(0, p));\n if (_[435] == c) {\n c = m.value;\n var p = c.split(\"|\"), z, q;\n q = p.length;\n for (z = 0; z < q; z++)c = p[z], \"\" != c && 0 > c.indexOf(\"://\") && 47 != c.charCodeAt(0) && (p[z] = d + c);\n m.value = p.join(\"|\")\n } else if (p = c.indexOf(\"url\"), 0 == p || 0 < p && p == c.length - 3)if (c = m.value)p = c.indexOf(\":\"), 47 == c.charCodeAt(0) || 0 < p && (\"//\" == c.substr(p + 1, 2) || 0 <= _[94].indexOf(c.substr(0, p + 1))) || (c = d + c), m.value = c\n }\n }\n b.childNodes && 0 < b.childNodes.length && f(b.childNodes, d)\n }\n }\n\n function g(a, d) {\n var b = Gc(d), e = b.lastIndexOf(\"/\"), g = b.lastIndexOf(\"\\\\\");\n g > e && (e = g);\n 0 < e && (b = b.slice(0, e + 1), f(a, b))\n }\n\n function n(a, b) {\n var e = d(a, _[374]);\n if (e) {\n var g = \"\", f, k;\n k = e.childNodes.length;\n for (f = 0; f < k; f++)g += e.childNodes[f].nodeValue;\n if (e = ra.resolvecontentencryption(b, g))return (e = (new DOMParser).parseFromString(e, _[25])) && e.documentElement && _[22] == e.documentElement.nodeName ? (la(3, b + _[21]), null) : e;\n Ea(b + _[32]);\n return null\n }\n return Ya & 32 ? (Ea(b + _[32]), null) : a\n }\n\n function k(a, d) {\n var b, e;\n switch (a.nodeType) {\n case 1:\n var g = T.xmlDoc.createElement(a.nodeName);\n if (a.attributes && 0 < a.attributes.length)for (b = 0, e = a.attributes.length; b < e;)g.setAttribute(a.attributes[b].nodeName, a.getAttribute(a.attributes[b++].nodeName));\n if (d && a.childNodes && 0 < a.childNodes.length)for (b = 0, e = a.childNodes.length; b < e;)g.appendChild(k(a.childNodes[b++], d));\n return g;\n case 3:\n case 4:\n case 8:\n return T.xmlDoc.createTextNode(a.nodeValue)\n }\n }\n\n function e(a, d) {\n var f, r, m;\n if (null != T.xmlIncludeNode) {\n m = Gc(a.url);\n if ((r = a.responseXML) && r.documentElement && _[22] == r.documentElement.nodeName) {\n Ea(m + _[21]);\n return\n }\n r = n(r, a.url);\n if (null == r)return;\n g(r.childNodes, m);\n f = r.childNodes;\n var l = T.xmlIncludeNode.parentNode;\n if (null != l.parentNode) {\n var u = 0;\n m = f.length;\n if (1 < m)for (r = 0; r < m; r++)if (_[46] == F(f[r].nodeName)) {\n u = r;\n break\n }\n r = null;\n r = void 0 === T.xmlDoc.importNode ? k(f[u], !0) : T.xmlDoc.importNode(f[u], !0);\n l.insertBefore(r, T.xmlIncludeNode);\n l.removeChild(T.xmlIncludeNode)\n } else T.xmlDoc = r;\n T.xmlAllNodes = [];\n T.addNodes(T.xmlDoc.childNodes);\n T.xmlIncludeNode = null\n }\n l = !1;\n m = T.xmlAllNodes.length;\n for (r = 0; r < m; r++)if (f = T.xmlAllNodes[r], u = null, null != f.nodeName) {\n u = F(f.nodeName);\n if (_[129] == u) {\n var u = f.attributes, h, c = u.length, p = !1;\n for (h = 0; h < c; h++) {\n var D = u[h];\n _[483] == D.nodeName ? 0 == b.checkSupport(D.value) && (p = !0) : \"if\" == D.nodeName && 0 == da.calc(null, D.value) && (p = !0)\n }\n if (0 == p)for (h = 0; h < c; h++)if (D = u[h], \"url\" == F(D.nodeName)) {\n l = !0;\n p = D.value;\n D = p.indexOf(\":\");\n 0 < D && 0 <= _[94].indexOf(p.substr(0, D + 1)) && (p = da.calc(null, p.substr(D + 1)));\n T.xmlIncludeNode = f;\n var z = ra.parsePath(p);\n z ? ra.loadxml(z, function (a, c) {\n a ? e({url: z, responseXML: a}, d) : Ea(z + \" - \" + (200 == c ? _[208] : _[184]))\n }) : d()\n }\n }\n if (l)break\n }\n 0 == l && d()\n }\n\n T.resolvexmlencryption = n;\n T.resolvexmlincludes = function (a, d) {\n var b = a.childNodes;\n T.xmlDoc = a;\n T.xmlAllNodes = [];\n T.addNodes(b);\n g(b, m.xml.url);\n T.xmlIncludeNode = null;\n e(null, d)\n };\n T.parsexml = p;\n T.xmlDoc = null;\n T.xmlAllNodes = null;\n T.xmlIncludeNode = null;\n T.addNodes = function (a) {\n var d, b, e;\n e = a.length;\n for (b = 0; b < e; b++)(d = a[b]) && d.nodeName && _[14] != F(d.nodeName) && (T.xmlAllNodes.push(d), d.childNodes && 0 < d.childNodes.length && T.addNodes(d.childNodes))\n };\n T.findxmlnode = d\n })();\n\n var ac = {};\n (function () {\n var a = ac;\n a.linear = function (a, b, f) {\n return f * a + b\n };\n a.easeinquad = function (a, b, f) {\n return f * a * a + b\n };\n a.easeoutquad = function (a, b, f) {\n return -f * a * (a - 2) + b\n };\n a[_[5]] = a.easeoutquad;\n a.easeinoutquad = function (a, b, f) {\n return (1 > (a /= .5) ? f / 2 * a * a : -f / 2 * (--a * (a - 2) - 1)) + b\n };\n a.easeinback = function (a, b, f) {\n return f * a * a * (2.70158 * a - 1.70158) + b\n };\n a.easeoutback = function (a, b, f) {\n return f * (--a * a * (2.70158 * a + 1.70158) + 1) + b\n };\n a.easeinoutback = function (a, b, f) {\n var g = 1.70158;\n return 1 > (a *= 2) ? f / 2 * a * a * (((g *= 1.525) + 1) * a - g) + b : f / 2 * ((a -= 2) * a * (((g *= 1.525) + 1) * a + g) + 2) + b\n };\n a.easeincubic = function (a, b, f) {\n return f * a * a * a + b\n };\n a.easeoutcubic = function (a, b, f) {\n return f * (--a * a * a + 1) + b\n };\n a.easeinquart = function (a, b, f) {\n return f * a * a * a * a + b\n };\n a.easeoutquart = function (a, b, f) {\n return -f * ((a = a / 1 - 1) * a * a * a - 1) + b\n };\n a.easeinquint = function (a, b, f) {\n return f * a * a * a * a * a + b\n };\n a.easeoutquint = function (a, b, f) {\n return f * ((a = a / 1 - 1) * a * a * a * a + 1) + b\n };\n a.easeinsine = function (a, b, f) {\n return -f * Math.cos(Ga / 2 * a) + f + b\n };\n a.easeoutsine = function (a, b, f) {\n return f * Math.sin(Ga / 2 * a) + b\n };\n a.easeinexpo = function (a, b, f) {\n return 0 == a ? b : f * Math.pow(2, 10 * (a - 1)) + b - .001 * f\n };\n a.easeoutexpo = function (a, b, f) {\n return 1 == a ? b + f : 1.001 * f * (-Math.pow(2, -10 * a) + 1) + b\n };\n a.easeincirc = function (a, b, f) {\n return -f * (Math.sqrt(1 - a * a) - 1) + b\n };\n a.easeoutcirc = function (a, b, f) {\n return f * Math.sqrt(1 - (a = a / 1 - 1) * a) + b\n };\n a.easeoutbounce = function (a, b, f) {\n return a < 1 / 2.75 ? 7.5625 * f * a * a + b : a < 2 / 2.75 ? f * (7.5625 * (a -= 1.5 / 2.75) * a + .75) + b : a < 2.5 / 2.75 ? f * (7.5625 * (a -= 2.25 / 2.75) * a + .9375) + b : f * (7.5625 * (a -= 2.625 / 2.75) * a + .984375) + b\n };\n a.easeinbounce = function (b, m, f) {\n return f - a.easeoutbounce(1 - b, 0, f) + m\n };\n a.getTweenfu = function (b) {\n b = F(b);\n \"\" == b || \"null\" == b ? b = _[56] : void 0 === a[b] && (b = _[56]);\n return a[b]\n }\n })();\n\n var da = {};\n (function () {\n function a(a, b, c) {\n var d, h = a.length;\n c = 1 != c;\n for (d = 0; d < h; d++) {\n var e = \"\" + a[d], g = e.toLowerCase();\n c && \"null\" == g ? a[d] = null : 41 == e.charCodeAt(e.length - 1) && (g = g.slice(0, 4), \"get(\" == g ? a[d] = U(Ha(e.slice(4, e.length - 1)), b) : \"calc\" == g && 40 == e.charCodeAt(4) && (a[d] = U(e, b)))\n }\n }\n\n function b(a, c) {\n var d, e, h, g = 0, f = 0, k = 0;\n h = \"\";\n d = 0;\n for (e = a.length; d < e;) {\n h = a.charCodeAt(d);\n if (!(32 >= h))if (34 == h)0 == k ? k = 1 : 1 == k && (k = 0); else if (39 == h)0 == k ? k = 2 : 2 == k && (k = 0); else if (0 == k)if (91 == h)0 == f && (f = d + 1), g++; else if (93 == h && 0 < g && (g--, 0 == g)) {\n if (h = oc(a, f, d, c))a = a.slice(0, f) + h + a.slice(d), d = f + h.length + 1, e = a.length;\n f = 0\n }\n d++\n }\n return a\n }\n\n function E(a, b) {\n var c = \"\", d, h, e, g, f;\n e = a.length;\n f = b.length;\n for (h = 0; h < e; h++)d = a.charAt(h), \"%\" == d ? (h++, d = a.charCodeAt(h) - 48, 0 <= d && 9 >= d ? (h + 1 < e && (g = a.charCodeAt(h + 1) - 48, 0 <= g && 9 >= g && (h++, d = 10 * d + g)), c = d < f ? c + (\"\" + b[d]) : c + \"null\") : c = -11 == d ? c + \"%\" : c + (\"%\" + a.charAt(h))) : c += d;\n return c\n }\n\n function f(a, b, c, d) {\n c = Array.prototype.slice.call(c);\n c.splice(0, 0, a);\n b = E(b, c);\n h.callaction(b, d, !0)\n }\n\n function g(a, b, c) {\n var krpano = m;\n var caller = c;\n var args = b;\n var resolve = y;\n var actions = h;\n try {\n eval(a, c)\n } catch (d) {\n la(3, b[0] + \" - \" + d)\n }\n }\n\n function n(a) {\n var b = c, d = b.length, h;\n for (h = 0; h < d; h++)if (b[h].id == a) {\n b.splice(h, 1);\n break\n }\n }\n\n function k(a) {\n var b = a.length;\n if (2 == b || 3 == b) {\n var c = U(a[b - 2], h.actioncaller), d = U(a[b - 1], h.actioncaller);\n null == c && (c = a[b - 2]);\n null == d && (d = a[b - 1]);\n return [a[0], parseFloat(c), parseFloat(d)]\n }\n return null\n }\n\n function e(a, b, c) {\n var d = 1 == b.length ? U(b[0], c) : b[1], d = 0 == a ? escape(d) : unescape(d);\n I(b[0], d, !1, c, !0)\n }\n\n function w(a) {\n if (1 == a.length)return a[0];\n var b, c = null, d = null, h = null, c = !1;\n for (b = 0; b < a.length; b++)if (c = \"\" + a[b], 0 < c.length && 0 <= _[442].indexOf(c)) {\n if (0 == b || b >= a.length - 1)throw _[33];\n d = a[b - 1];\n h = a[b + 1];\n switch (c) {\n case \"===\":\n case \"==\":\n c = d == h;\n break;\n case \"!==\":\n case \"!=\":\n c = d != h;\n break;\n case \"<\":\n c = d < h;\n break;\n case \"<=\":\n c = d <= h;\n break;\n case \">\":\n c = d > h;\n break;\n case \">=\":\n c = d >= h;\n break;\n default:\n throw _[33];\n }\n a.splice(b - 1, 3, c);\n b -= 2\n }\n if (1 == a.length)return a[0];\n for (b = 0; b < a.length; b++)if (c = a[b], \"&&\" == c || \"||\" == c) {\n if (0 == b || b >= a.length - 1)throw _[33];\n d = a[b - 1];\n h = a[b + 1];\n c = \"&&\" == c ? d && h : d || h;\n a.splice(b - 1, 3, c);\n b -= 2\n }\n if (5 == a.length && \"?\" == a[1] && \":\" == a[3])return a[0] ? a[2] : a[4];\n if (1 < a.length)throw _[33];\n return a[0]\n }\n\n function x(a) {\n var b = void 0, b = F(a), c = b.charCodeAt(0), d, e = 0, g = !1;\n 64 == c && (g = !0, a = a.slice(1), b = b.slice(1), c = b.charCodeAt(0));\n if (39 == c || 34 == c)return Ha(a);\n if (33 == c || 43 == c || 45 == c)e = c, a = a.slice(1), b = b.slice(1), c = b.charCodeAt(0);\n d = b.charCodeAt(b.length - 1);\n 40 == c && 41 == d ? b = v(a.slice(1, -1)) : 37 == d ? b = a : (b = \"null\" != b ? U(a, h.actioncaller, !0) : null, void 0 === b ? (c = Number(a), isNaN(c) || isNaN(parseFloat(a)) ? g && (b = a) : b = c) : _[13] == typeof b && (a = F(b), \"true\" == a ? b = !0 : _[31] == a ? b = !1 : \"null\" == a ? b = null : (a = Number(b), isNaN(a) || (b = a))));\n 33 == e ? b = !b : 45 == e && (b = -b);\n return b\n }\n\n function v(a) {\n var b;\n if (\"\" == a || null === a)return a;\n try {\n var c, d = a.length, h = 0, e = 0, g = !1, f = !1, k = 0, n = 0, t = 0, G = !1, q = [], l = 0, r = 0;\n for (c = 0; c < d; c++)if (r = a.charCodeAt(c), 0 == G && 32 >= r)0 < e && (q[l++] = a.substr(h, e), e = 0), g = !1; else if (0 == G && (61 == r || 33 == r && 61 == a.charCodeAt(c + 1) || 62 == r || 60 == r))0 == g && (0 < e ? (q[l++] = a.substr(h, e), e = 0) : 0 == l && 0 == m.strict && (q[l++] = \"\"), g = !0, f = !1, h = c), e++; else if (0 != G || 43 != r && 45 != r && 42 != r && 47 != r && 94 != r && 63 != r && 58 != r) {\n if (0 == t)if (91 == r)k++, G = !0; else if (93 == r)k--, 0 == k && 0 == n && (G = !1); else if (40 == r)n++, G = !0; else if (41 == r)n--, 0 == n && 0 == k && (G = !1); else {\n if (39 == r || 34 == r)t = r, G = !0\n } else r == t && (t = 0, 0 == k && 0 == n && (G = !1));\n if (g || f)0 < e && (q[l++] = a.substr(h, e), e = 0), f = g = !1, h = c;\n 0 == e && (h = c);\n e++\n } else 0 < e && (q[l++] = a.substr(h, e)), g = !1, f = !0, h = c, e = 1;\n 0 < e && (q[l++] = a.substr(h, e));\n 2 == l && g && 0 == m.strict && (q[l++] = \"\");\n if (0 == m.strict) {\n var u = q.length;\n if (!(3 > u)) {\n var p, v;\n for (p = 1; p < u - 1; p++)if (v = q[p], \"==\" == v || \"!=\" == v) {\n q[p - 1] = \"@\" + q[p - 1];\n v = q[p + 1];\n if (\"+\" == v || \"-\" == v)for (p++, v = q[p + 1]; \"+\" == v || \"-\" == v;)p++, v = q[p + 1];\n q[p + 1] = \"@\" + v\n }\n }\n }\n var J = q.length, z, y, D;\n if (1 == J)q[0] = x(q[0]); else for (z = 0; z < J; z++)if (y = q[z], !(0 <= \"<=>=!===+-*/^||&&?:\".indexOf(y))) {\n switch (y) {\n case \"AND\":\n D = \"&&\";\n break;\n case \"OR\":\n D = \"||\";\n break;\n case \"GT\":\n D = \">\";\n break;\n case \"GE\":\n D = \">=\";\n break;\n case \"LT\":\n D = \"<\";\n break;\n case \"LE\":\n D = \"<=\";\n break;\n case \"EQ\":\n D = \"==\";\n break;\n case \"LSHT\":\n D = \"<<\";\n break;\n case \"RSHT\":\n D = \">>\";\n break;\n case \"BAND\":\n D = \"~&\";\n break;\n case \"BOR\":\n D = \"~|\";\n break;\n default:\n D = x(y)\n }\n q[z] = D\n }\n var F = q.length;\n if (!(2 > F)) {\n var E, K;\n c = null;\n for (E = 0; E < q.length; E++)if (c = q[E], \"+\" == c || \"-\" == c)if (0 == E || 0 <= \".<.<<.<=.==.===.=>.>.>>.!=.!==.+.-.*./.^.&&.||.?.:.~|.~&.\".indexOf(\".\" + q[E - 1] + \".\")) {\n K = 45 == c.charCodeAt(0) ? -1 : 1;\n F = 1;\n for (c = \"\" + q[E + F]; \"+\" == c || \"-\" == c;)K *= 45 == c.charCodeAt(0) ? -1 : 1, F++, c = \"\" + q[E + F];\n c && 40 == c.charCodeAt(0) && (c = x(c));\n c = c && 37 == c.charCodeAt(c.length - 1) ? parseFloat(c) * K + \"%\" : Number(c) * K;\n q.splice(E, 1 + F, c);\n --E\n }\n for (E = 1; E < q.length - 1; E++)c = q[E], \"*\" == c ? (q.splice(E - 1, 3, Number(q[E - 1]) * Number(q[E + 1])), E -= 3) : \"/\" == c ? (q.splice(E - 1, 3, Number(q[E - 1]) / Number(q[E + 1])), E -= 3) : \"^\" == c ? (q.splice(E - 1, 3, Math.pow(Number(q[E - 1]), Number(q[E + 1]))), E -= 3) : \"<<\" == c ? (q.splice(E - 1, 3, Number(q[E - 1]) << Number(q[E + 1])), E -= 3) : \">>\" == c ? (q.splice(E - 1, 3, Number(q[E - 1]) >> Number(q[E + 1])), E -= 3) : \"~&\" == c ? (q.splice(E - 1, 3, Number(q[E - 1]) & Number(q[E + 1])), E -= 3) : \"~|\" == c && (q.splice(E - 1, 3, Number(q[E - 1]) | Number(q[E + 1])), E -= 3);\n for (E = 1; E < q.length - 1; E++)c = q[E], \"+\" == c ? (q.splice(E - 1, 3, q[E - 1] + q[E + 1]), E -= 3) : \"-\" == c && (q.splice(E - 1, 3, Number(q[E - 1]) - Number(q[E + 1])), E -= 3)\n }\n b = w(q)\n } catch (L) {\n la(3, L + \": \" + a)\n }\n return b\n }\n\n function r(a) {\n var b = a.position;\n 1 == a.motionmode ? (b *= a.Tmax, b <= a.T1 ? b *= a.accelspeed / 2 * b : b > a.T1 && b <= a.T1 + a.T2 ? b = a.S1 + (b - a.T1) * a.Vmax : (b -= a.T1 + a.T2, b = a.Vmax * b + a.breakspeed / 2 * b * b + a.S1 + a.S2), b = 0 != a.Smax ? b / a.Smax : 1) : 2 == a.motionmode && (b = a.tweenfu(b, 0, 1));\n p.hlookat = a.startH + b * (a.destH - a.startH);\n p.vlookat = a.startV + b * (a.destV - a.startV);\n p.fov = a.startF + b * (a.destF - a.startF)\n }\n\n function y(a, b) {\n var c = U(a, b);\n null == c && (c = a);\n return c\n }\n\n function l(a) {\n var b = a.waitfor;\n \"load\" == b ? Xa.isLoading() && (a.position = 0) : _[73] == b && Xa.isBlending() && (a.position = 0)\n }\n\n function u(a) {\n var b = a.varname, c = parseFloat(a.startval), d = parseFloat(a.endval), e = null != a.startval ? 0 < String(a.startval).indexOf(\"%\") : !1, g = null != a.endval ? 0 < String(a.endval).indexOf(\"%\") : !1;\n g ? e || (c = 0) : e && 0 == d && (g = !0);\n var e = 0, e = a.position, f = a.tweenmap;\n 0 <= b.indexOf(_[47], b.lastIndexOf(\".\") + 1) ? (c = parseInt(a.startval), d = parseInt(a.endval), 1 <= e ? e = d : (e = f(e, 0, 1), e = Math.min(Math.max((c >> 24) + e * ((d >> 24) - (c >> 24)), 0), 255) << 24 | Math.min(Math.max((c >> 16 & 255) + e * ((d >> 16 & 255) - (c >> 16 & 255)), 0), 255) << 16 | Math.min(Math.max((c >> 8 & 255) + e * ((d >> 8 & 255) - (c >> 8 & 255)), 0), 255) << 8 | Math.min(Math.max((c & 255) + e * ((d & 255) - (c & 255)), 0), 255))) : e = 1 <= e ? d : f(e, c, d - c);\n I(b, g ? e + \"%\" : e, !0, a.actioncaller);\n null != a.updatefu && h.callaction(a.updatefu, a.actioncaller)\n }\n\n var h = da;\n h.busy = !1;\n h.blocked = !1;\n h.queue = [];\n h.actioncaller = null;\n var c = [], K = [], D = null, z = 0, q = function () {\n this.id = null;\n this.blocking = !1;\n this.position = this.maxruntime = this.starttime = 0;\n this.updatefu = this.actioncaller = this.donecall = this.process = null\n };\n h.copyattributes = function (a, b) {\n for (var c in b) {\n var d = F(c);\n if (\"name\" != d && \"index\" != d && \"_type\" != d) {\n var e = b[c];\n if (_[11] !== typeof e) {\n if (e && _[13] == typeof e) {\n var h = e.slice(0, 4);\n \"get:\" == h ? e = U(e.slice(4)) : \"calc\" == h && 58 == e.charCodeAt(4) && (e = v(e.slice(5)))\n }\n a[d] = _[67] == typeof a[d] ? pa(e) : e\n }\n }\n }\n };\n h.assignstyle = function (a, b) {\n var c = U(a);\n if (c && (null == b && (b = c.style), b)) {\n c.style = b;\n var d = b.split(\"|\"), e, g;\n g = d.length;\n for (e = 0; e < g; e++) {\n var f = U(_[515] + d[e] + \"]\");\n f ? h.copyattributes(c, f) : la(3, a + _[198] + d[e])\n }\n }\n };\n h.isblocked = function () {\n if (h.blocked) {\n var a = D;\n if (a)D = null, h.stopall(), \"break\" != F(a) && h.callaction(a), h.processactions(); else return !0\n }\n return !1\n };\n h.actions_autorun = function (a, b) {\n var c = m.action.getArray(), d = [], e, g, f = null;\n g = c.length;\n for (e = 0; e < g; e++)(f = c[e]) && f.autorun == a && !f._arDone && (f._arDone = !0, d.push(f));\n g = d.length;\n if (0 < g) {\n c = \"\";\n for (e = 0; e < g; e++)f = d[e], c += _[452] + f.name + \");\";\n h.callaction(c, null, b);\n h.processactions()\n }\n };\n h.callwith = function (a, b) {\n var c = U(a, h.actioncaller);\n if (c) {\n var d = c._type;\n _[29] != d && _[1] != d || h.callaction(b, c)\n }\n };\n\n //sohow_base64\n h.callaction = function (a, b, c) {\n if (a && \"null\" != a && \"\" != a) {\n var d = typeof a;\n if (_[11] === d)\n a();\n else if (_[144] !== d && (a = Gb(a, b))) {\n var d = a.length, e = 0 < h.queue.length, g = !1;\n for (b = 0; b < d; b++) {\n var f = a[b];\n _[314] == f.cmd && (g = !0);\n f.breakable = g;\n 1 == c ? h.queue.splice(b, 0, f) : h.queue.push(f)\n }\n 0 == e && h.processactions()\n }\n }\n };\n var J = !1;\n h.processactions = function () {\n if (!J) {\n J = !0;\n for (var b = null, c = null, d = null, e = null, f = 0, q = h.queue; null != q && 0 < q.length;) {\n if (h.busy || h.blocked) {\n J = !1;\n return\n }\n f++;\n if (1E5 < f) {\n la(2, _[89]);\n q.length = 0;\n break\n }\n b = q.shift();\n c = String(b.cmd);\n d = b.args;\n b = b.caller;\n h.actioncaller = b;\n if (!(b && b._busyonloaded && b._destroyed) && \"//\" != c.slice(0, 2))if (\"call\" == c && (c = F(d.shift())), a(d, b, \"set\" == c), void 0 !== h[c])h[c].apply(h[c], d); else if (b && void 0 !== b[c])e = b[c], _[11] === typeof e ? e.apply(e, d) : h.callaction(b[c], b, !0); else {\n if (_[14] == c || \"call\" == c)c = F(d.shift());\n e = null;\n if (null != (e = U(c))) {\n var k = typeof e;\n _[11] === k ? e.apply(e, d) : _[144] === k ? la(2, _[87] + id(c)) : _[13] === typeof e && (d.splice(0, 0, c), e = E(e, d), h.callaction(e, b, !0))\n } else if (k = U(_[453] + c + \"]\")) {\n if (e = k.content)d.splice(0, 0, c), _[372] === F(k.type) ? g(e, d, b) : (e = E(e, d), h.callaction(e, b, !0))\n } else la(2, _[87] + id(c))\n }\n }\n h.blocked || (D = null);\n h.actioncaller = null;\n J = !1\n }\n };\n h.processAnimations = function (a) {\n var b = !1, d = c, e = d.length, g, f = Ta();\n a = 1 == a;\n for (g = 0; g < e; g++) {\n var q = d[g];\n if (q) {\n var k = 0 < q.maxruntime ? (f - q.starttime) / 1E3 / q.maxruntime : 1;\n isNaN(k) && (k = 1);\n 1 < k && (k = 1);\n q.position = k;\n null != q.process && (b = !0, q.process(q), k = q.position);\n if (1 <= k || a)d.splice(g, 1), e--, g--, q.blocking ? (h.blocked = !1, h.processactions()) : q.donecall && 0 == a && h.callaction(q.donecall, q.actioncaller)\n }\n }\n h.blocked && (b = !1);\n return b\n };\n h.fromcharcode = function () {\n var a = arguments;\n 2 == a.length && I(a[0], String.fromCharCode(y(a[1], h.actioncaller)), !1, h.actioncaller)\n };\n h.stopmovements = function () {\n Pa.stopFrictions(4)\n };\n h.stopall = function () {\n var a, b, d = h.queue;\n b = d.length;\n for (a = 0; a < b; a++) {\n var e = d[a];\n e && e.breakable && (e.cmd = \"//\")\n }\n c = [];\n h.blocked = !1\n };\n h.breakall = function () {\n h.processAnimations(!0)\n };\n h.oninterrupt = function (a) {\n D = a\n };\n h.delayedcall = function () {\n var a = arguments, b = a.length, d = 0;\n 3 == b && (d++, b--);\n 2 == b && (b = new q, b.maxruntime = Number(a[d]), b.donecall = a[d + 1], b.starttime = Ta(), b.actioncaller = h.actioncaller, b.id = 0 < d ? \"ID\" + F(a[0]) : \"DC\" + ++z, n(b.id), c.push(b))\n };\n h.stopdelayedcall = function (a) {\n n(\"ID\" + F(a))\n };\n h.set = function () {\n var a = arguments;\n 2 == a.length && I(a[0], a[1], !1, h.actioncaller)\n };\n h.copy = function () {\n var a = arguments;\n if (2 == a.length) {\n var b = U(a[1], h.actioncaller);\n I(a[0], void 0 === b ? null : b, !1, h.actioncaller)\n }\n };\n h.push = function () {\n var a = arguments;\n 1 == a.length && K.push(U(a[0], h.actioncaller))\n };\n h.pop = function () {\n var a = arguments;\n 1 == a.length && I(a[0], K.pop(), !1, h.actioncaller)\n };\n h[_[508]] = function () {\n var a = arguments, b = a.length, c = a[0], d = F(U(c, h.actioncaller));\n if (1 == b)I(c, !pa(d), !0, h.actioncaller); else if (3 <= b) {\n var e;\n b--;\n for (e = 1; e <= b; e++) {\n var g = F(a[e]), f = !1;\n isNaN(Number(d)) || isNaN(Number(g)) ? d == g && (f = !0) : Number(d) == Number(g) && (f = !0);\n if (f) {\n e++;\n e > b && (e = 1);\n I(c, a[e], !0, h.actioncaller);\n break\n }\n }\n }\n };\n h.roundval = function () {\n var a = arguments;\n if (1 <= a.length) {\n var b = Number(U(a[0], h.actioncaller)), c = 2 == a.length ? parseInt(a[1]) : 0, b = 0 == c ? Math.round(b).toString() : b.toFixed(c);\n I(a[0], b, !1, h.actioncaller, !0)\n }\n };\n h.tohex = function () {\n var a = arguments, b = a.length;\n if (0 < b) {\n var c = parseInt(U(a[0], h.actioncaller)).toString(16).toUpperCase();\n 2 < b && (c = (_[419] + c).slice(-parseInt(a[2])));\n 1 < b && (c = a[1] + c);\n I(a[0], c, !1, h.actioncaller, !0)\n }\n };\n h.tolower = function () {\n var a = arguments;\n 1 == a.length && I(a[0], F(U(a[0], h.actioncaller)), !1, h.actioncaller, !0)\n };\n h.toupper = function () {\n var a = arguments;\n 1 == a.length && I(a[0], (\"\" + U(a[0], h.actioncaller)).toUpperCase(), !1, h.actioncaller, !0)\n };\n h.inc = function () {\n var a = arguments, b = a.length;\n if (1 <= b) {\n var c = Number(U(a[0], h.actioncaller)) + (1 < b ? Number(a[1]) : 1);\n 3 < b && c > Number(a[2]) && (c = Number(a[3]));\n I(a[0], c, !0, h.actioncaller)\n }\n };\n h.dec = function () {\n var a = arguments, b = a.length;\n if (1 <= b) {\n var c = Number(U(a[0], h.actioncaller)) - (1 < b ? Number(a[1]) : 1);\n 3 < b && c < Number(a[2]) && (c = Number(a[3]));\n I(a[0], c, !0, h.actioncaller)\n }\n };\n h.add = function () {\n var a = k(arguments);\n a && I(a[0], a[1] + a[2], !1, h.actioncaller)\n };\n h.sub = function () {\n var a = k(arguments);\n a && I(a[0], a[1] - a[2], !1, h.actioncaller)\n };\n h.mul = function () {\n var a = k(arguments);\n a && I(a[0], a[1] * a[2], !1, h.actioncaller)\n };\n h.div = function () {\n var a = k(arguments);\n a && I(a[0], a[1] / a[2], !1, h.actioncaller)\n };\n h.mod = function () {\n var a = k(arguments);\n if (a) {\n var b = a[1], c = b | 0, b = b + (-c + c % (a[2] | 0));\n I(a[0], b, !1, h.actioncaller)\n }\n };\n h.pow = function () {\n var a = k(arguments);\n a && I(a[0], Math.pow(a[1], a[2]), !1, h.actioncaller)\n };\n h.clamp = function () {\n var a = arguments;\n if (3 == a.length) {\n var b = h.actioncaller, c = Number(U(a[0], b)), d = Number(a[1]), e = Number(a[2]);\n c < d && (c = d);\n c > e && (c = e);\n I(a[0], c, !1, b)\n }\n };\n h.remapfovtype = function () {\n var a = arguments, b = a.length;\n if (3 == b || 5 == b) {\n var c = h.actioncaller, d = Number(U(a[0], c)), e = 3 == b ? m.area.pixelwidth : Number(U(a[3], c)), b = 3 == b ? m.area.pixelheight : Number(U(a[4], c)), d = p.fovRemap(d, a[1], a[2], e, b);\n I(a[0], d, !1, c)\n }\n };\n h.screentosphere = function () {\n var a = arguments;\n if (4 == a.length) {\n var b = h.actioncaller, c = p.screentosphere(Number(U(a[0], b)), Number(U(a[1], b)));\n I(a[2], c.x, !1, b);\n I(a[3], c.y, !1, b)\n }\n };\n h.spheretoscreen = function () {\n var a = arguments;\n if (4 == a.length) {\n var b = h.actioncaller, c = p.spheretoscreen(Number(U(a[0], b)), Number(U(a[1], b)));\n I(a[2], c.x, !1, b);\n I(a[3], c.y, !1, b)\n }\n };\n h.screentolayer = function () {\n var a = arguments;\n if (5 == a.length) {\n var b = h.actioncaller, c = xa.getItem(a[0]);\n if (c) {\n var d = Number(U(a[1], b)), e = Number(U(a[2], b)), g = tc, f = tc, q = c.sprite;\n if (q) {\n var k = X, f = V.viewerlayer.getBoundingClientRect(), n = q.getBoundingClientRect(), g = d * k - (n.left - f.left + q.clientLeft + q.scrollLeft), f = e * k - (n.top - f.top + q.clientTop + q.scrollTop);\n c.scalechildren && (k = 1);\n g /= c._finalxscale * k;\n f /= c._finalyscale * k\n }\n I(a[3], g, !1, b);\n I(a[4], f, !1, b)\n }\n }\n };\n h.layertoscreen = function () {\n var a = arguments;\n if (5 == a.length) {\n var b = h.actioncaller, c = xa.getItem(a[0]);\n if (c) {\n var d = Number(U(a[1], b)), e = Number(U(a[2], b)), g = tc, f = tc, q = c.sprite;\n if (q)var f = X, k = c.scalechildren ? f : 1, n = V.viewerlayer.getBoundingClientRect(), t = q.getBoundingClientRect(), g = d * c._finalxscale / k + (t.left - n.left + q.clientLeft + q.scrollLeft) / f, f = e * c._finalyscale / k + (t.top - n.top + q.clientTop + q.scrollTop) / f;\n I(a[3], g, !1, b);\n I(a[4], f, !1, b)\n }\n }\n };\n h.escape = function () {\n e(0, arguments, h.actioncaller)\n };\n h.unescape = function () {\n e(1, arguments, h.actioncaller)\n };\n h.txtadd = function () {\n var a = arguments, b, c = a.length, d = 2 == c ? String(U(a[0], h.actioncaller)) : \"\";\n \"null\" == d && (d = \"\");\n for (b = 1; b < c; b++)d += a[b];\n I(a[0], d, !1, h.actioncaller, !0)\n };\n h.subtxt = function () {\n var a = arguments, b = a.length;\n if (2 <= b) {\n var c = U(a[1], h.actioncaller), c = null == c ? String(a[1]) : String(c), c = c.substr(2 < b ? Number(a[2]) : 0, 3 < b ? Number(a[3]) : void 0);\n I(a[0], c, !1, h.actioncaller, !0)\n }\n };\n h.indexoftxt = function () {\n var a = arguments, b = a.length;\n 3 <= b && (b = String(a[1]).indexOf(String(a[2]), 3 < b ? Number(a[3]) : 0), I(a[0], b, !1, h.actioncaller, !0))\n };\n h.txtreplace = function () {\n var a = arguments, b = a.length;\n if (3 == b || 4 == b) {\n var b = 3 == b ? 0 : 1, c = U(a[b], h.actioncaller);\n if (c)var d = a[b + 2], c = c.split(a[b + 1]).join(d);\n I(a[0], c, !1, h.actioncaller, !0)\n }\n };\n h.txtsplit = function () {\n var a = arguments, b = a.length;\n if (3 <= b) {\n var c = (\"\" + y(a[0], h.actioncaller)).split(\"\" + a[1]), d;\n if (3 == b)for (d = 0; d < c.length; d++)I(a[2] + \"[\" + d + _[455], c[d], !1, h.actioncaller, !0); else for (d = 2; d < b; d++)I(a[d], c[d - 2], !1, h.actioncaller, !0)\n }\n };\n h.showlog = function () {\n var a = arguments, a = !(1 == a.length && 0 == pa(a[0]));\n V.showlog(a)\n };\n h.trace = function () {\n var a = arguments, b, c = a.length, d = \"\", e = h.actioncaller;\n for (b = 0; b < c; b++)var g = a[b], f = U(g, e), d = null != f ? d + f : d + g;\n la(1, d)\n };\n h[_[507]] = function () {\n var a = arguments, b, c = a.length, d = h.actioncaller;\n for (b = 0; b < c; b++)a:{\n var e = d, g = void 0, f = void 0, q = void 0, k = Vc(a[b]), f = k.length;\n if (1 == f && e && (q = k[0], e.hasOwnProperty(q))) {\n e[q] = null;\n delete e[q];\n break a\n }\n for (var n = m, g = 0; g < f; g++) {\n var q = k[g], t = g == f - 1, G = null, l = q.indexOf(\"[\");\n 0 < l && (G = oc(q, l + 1, q.length - 1, e), q = q.slice(0, l));\n if (void 0 !== n[q]) {\n if (null != G && (l = n[q], l.isArray))if (q = l.getItem(G))if (t)break a; else {\n n = q;\n continue\n } else break;\n if (t) {\n n[q] = null;\n delete n[q];\n break a\n } else n = n[q]\n } else break\n }\n }\n };\n h.error = function () {\n 1 == arguments.length || !1 !== pa(arguments[1]) ? Ea(arguments[0]) : la(3, arguments[0])\n };\n h.openurl = function () {\n var a = arguments;\n L.open(a[0], 0 < a.length ? a[1] : _[504])\n };\n h.loadscene = function () {\n var a = arguments;\n if (0 < a.length) {\n var b = a[0], c = U(_[72] + b + _[61]), d = U(_[72] + b + _[394]);\n d && (d += \";\");\n null == c ? la(3, 'loadscene() - scene \"' + b + '\" not found') : (m.xml.scene = b, m.xml.view = {}, Xa.loadxml(_[124] + c + _[117], a[1], a[2], a[3], d))\n }\n };\n h.jsget = function () {\n var a = arguments;\n if (2 == a.length) {\n var b = a[0], c = a[1], d = null;\n try {\n (function () {\n var krpano = V.viewerlayer;\n d = eval(c)\n })()\n } catch (e) {\n la(3, \"js\" + (b ? \"get\" : \"call\") + '() - calling Javascript \"' + c + '\" failed: ' + e)\n }\n b && I(b, d, !1, h.actioncaller)\n }\n };\n h.jscall = function () {\n var a = arguments;\n 1 == a.length && h.jsget(null, a[0])\n };\n h.parseFunction = function (b) {\n var c = null;\n if (b = Gb(b, null, !0))b = b[0], a(b.args, h.actioncaller), c = [b.cmd].concat(b.args);\n return c\n };\n h.js = function (b) {\n b = \"\" + b;\n var c = Gb(b, null, !0);\n if (c) {\n c = c[0];\n a(c.args, h.actioncaller);\n var d = !1;\n if (_[11] == typeof L[c.cmd]) {\n d = !0;\n try {\n L[c.cmd].apply(L[c.cmd], c.args)\n } catch (e) {\n d = !1\n }\n }\n if (0 == d) {\n c = c.cmd + (0 < c.args.length ? \"('\" + c.args.join(\"','\") + \"');\" : \"();\");\n try {\n eval(c)\n } catch (g) {\n la(2, 'js() - calling Javascript \"' + b + '\" failed: ' + g)\n }\n }\n }\n };\n h.setfov = function () {\n var a = arguments;\n 1 == a.length && (p.fov = Number(a[0]))\n };\n h.lookat = function () {\n var a = arguments;\n if (2 <= a.length) {\n var b;\n b = Number(a[0]);\n isNaN(b) || (p.hlookat = b);\n b = Number(a[1]);\n isNaN(b) || (p.vlookat = b);\n b = Number(a[2]);\n isNaN(b) || (p.fov = b);\n b = Number(a[3]);\n isNaN(b) || (p.distortion = b);\n b = Number(a[4]);\n isNaN(b) || (p.architectural = b);\n b = Number(a[5]);\n isNaN(b) || (p.pannini = \"\" + b)\n }\n };\n h.adjusthlookat = function () {\n var a = arguments;\n 1 == a.length && (p.hlookat = nc(p.hlookat, Number(a[0])))\n };\n h.adjust360 = function () {\n var a = arguments;\n if (2 == a.length) {\n var b = h.actioncaller;\n I(a[0], nc(U(a[0], b), Number(y(a[1], b))), !1, b)\n }\n };\n h.loop = function () {\n f(\"loop\", _[192], arguments, h.actioncaller)\n };\n h.asyncloop = function () {\n f(_[402], _[164], arguments, h.actioncaller)\n };\n h[\"for\"] = function () {\n f(\"for\", _[155], arguments, h.actioncaller)\n };\n h.asyncfor = function () {\n f(_[409], \"if('%5'!='NEXTLOOP',%1);if(%2,%4;%3;delayedcall(0,asyncfor(%1,%2,%3,%4,NEXTLOOP)););\", arguments, h.actioncaller)\n };\n h.calc = function () {\n var a, b = arguments;\n 2 == b.length && (a = v(b[1]), b[0] && I(b[0], a, !1, h.actioncaller));\n return a\n };\n h.resolvecondition = function () {\n var a = h.actioncaller, b = arguments, c = b.length, d = null, e = null, e = !1;\n if (2 == c || 3 == c) {\n d = F(b[0]);\n e = 2 == c ? b[1] : b[2];\n if (\"null\" == d || \"\" == d)d = null;\n e = null == e || \"\" == e ? !1 : v(e);\n null != d && (3 == c && (b = F(b[1]), c = pa(U(d, a)), \"and\" == b ? e = c && e : \"or\" == b ? e = c || e : \"xor\" == b && (e = !(c && e) && (c || e))), I(d, e, !1, a))\n }\n return e\n };\n h[\"if\"] = function () {\n var a = arguments, b = h.actioncaller;\n 2 <= a.length && (v(a[0]) ? h.callaction(a[1], b, !0) : 3 == a.length && h.callaction(a[2], b, !0))\n };\n h.ifnot = function () {\n var a = arguments;\n h[\"if\"](a[0], a[2], a[1])\n };\n h.stoplookto = function () {\n n(_[69])\n };\n h.lookto = function () {\n var b = arguments, d = b.length;\n if (2 <= d) {\n var e = h.actioncaller, g = new q;\n h.stopmovements();\n n(_[69]);\n g.id = _[69];\n g.actioncaller = e;\n 1 == pa(b[5]) ? (g.blocking = !1, g.donecall = b[6]) : (g.blocking = !0, h.blocked = !0);\n 4 < d && void 0 === b[4] && d--;\n 3 < d && void 0 === b[3] && d--;\n 2 < d && void 0 === b[2] && d--;\n var f = Number(b[0]), k = Number(b[1]), l = 2 < d ? Number(b[2]) : p.fov, m = 3 < d ? b[3] : null, u = 4 < d ? pa(b[4]) : !0;\n if (!(isNaN(f) || isNaN(k) || isNaN(l))) {\n var B = 1, b = 720, d = -720, t = 720, G = p.hlookat, w = G, P = p.vlookat, v = p.fov;\n if (u) {\n for (; -90 > k || 90 < k;)-90 > k ? (k = -180 - k, f += 180) : 90 < k && (k = 180 - k, f -= 180);\n for (; 0 > G;)G += 360;\n for (; 360 < G;)G -= 360;\n for (; 0 > f;)f += 360;\n for (; 360 < f;)f -= 360;\n for (; -180 > P;)P += 360;\n for (; 180 < P;)P -= 360;\n G = nc(G, f);\n P = nc(P, k);\n u = G - w;\n G -= u;\n f -= u\n }\n g.startH = G;\n g.startV = P;\n g.startF = v;\n g.destH = f;\n g.destV = k;\n g.destF = l;\n f = Math.sqrt((f - G) * (f - G) + (k - P) * (k - P) + (l - v) * (l - v));\n m && ((m = Gb(m)) && (m = m[0]), m && (k = m.cmd, l = m.args, a(l, e), _[43] == k ? (B = 0, t = 360, 1 == m.args.length && (t = parseFloat(l[0]))) : _[496] == k ? (B = 1, 0 < m.args.length && (b = parseFloat(l[0])), 1 < m.args.length && (d = parseFloat(l[1])), 2 < m.args.length && (t = parseFloat(l[2])), b = +Math.abs(b), d = -Math.abs(d), t = +Math.abs(t)) : \"tween\" == k && (B = 2, g.tweenfu = ac.getTweenfu(l[0]), g.maxruntime = parseFloat(l[1]), isNaN(g.maxruntime) && (g.maxruntime = .5))));\n g.motionmode = B;\n 0 == B ? g.maxruntime = f / t : 1 == B && (e = f, B = t * t / (2 * b), m = t / b, f = -(t * t) / (2 * d), k = -t / d, l = e - (B + f), G = l / t, 0 > G && (t = Math.sqrt(2 * e * b * d / (d - b)), B = t * t / (2 * b), m = t / b, f = -(t * t) / (2 * d), k = -t / d, G = l = 0), P = m + G + k, g.accelspeed = b, g.breakspeed = d, g.Vmax = t, g.Tmax = P, g.Smax = e, g.T1 = m, g.T2 = G, g.T3 = k, g.S1 = B, g.S2 = l, g.S3 = f, g.maxruntime = P);\n g.starttime = Ta();\n g.process = r;\n c.push(g)\n }\n }\n };\n h.looktohotspot = function () {\n var a = arguments, b = h.actioncaller, c = Ua.getItem(1 > a.length ? b ? b.name : \"\" : a[0]);\n if (c) {\n var b = c.ath, d = c.atv, e = 30, e = c.getcenter(), b = e.x, d = e.y, e = e.z, c = Number(a[1]);\n isNaN(c) || (e = c);\n c = p.fovmin;\n e < c && (e = c);\n h.lookto(b, d, e, a[2], a[3])\n }\n };\n h.moveto = function () {\n var a = arguments;\n 2 <= a.length && h.lookto(a[0], a[1], p.fov, a[2])\n };\n h.zoomto = function () {\n var a = arguments;\n 1 <= a.length && h.lookto(p.hlookat, p.vlookat, a[0], a[1])\n };\n h.getlooktodistance = function () {\n var a = arguments, b = a.length;\n if (3 <= b) {\n var c = h.actioncaller, d = Number(y(a[1], c)), e = Number(y(a[2], c)), g = p.hlookat, f = p.vlookat;\n 5 == b && (g = Number(y(a[3], c)), f = Number(y(a[4], c)));\n if (!(isNaN(d) || isNaN(e) || isNaN(g) || isNaN(f))) {\n var b = Math.PI, q = b / 180, d = b - d * q, g = b - g * q, f = f * q, e = e * q, d = Math.acos(Math.cos(f) * Math.cos(g) * Math.cos(e) * Math.cos(d) + Math.sin(f) * Math.sin(e) + Math.cos(f) * Math.sin(g) * Math.cos(e) * Math.sin(d)) / q;\n I(a[0], d, !1, c)\n }\n }\n };\n h.wait = function () {\n var a = arguments;\n if (1 == a.length) {\n var a = a[0], b = F(a);\n if (\"load\" == b || _[73] == b)a = 0; else {\n b = \"time\";\n a = Number(a);\n if (isNaN(a))return;\n 0 >= a && (b = _[73], a = 0)\n }\n var d = new q;\n d.waitfor = b;\n d.maxruntime = a;\n d.process = l;\n d.starttime = Ta();\n d.actioncaller = h.actioncaller;\n d.id = \"WAIT\" + ++z;\n d.blocking = !0;\n h.blocked = !0;\n c.push(d)\n }\n };\n h.tween = function () {\n var a = arguments, e = a.length;\n if (2 <= e) {\n var g = h.actioncaller, f = new q, k = F(a[0]);\n if (0 < k.indexOf(\"|\")) {\n var e = (\"\" + a[0]).split(\"|\"), g = (\"\" + a[1]).split(\"|\"), f = a[3] ? (\"\" + a[3]).split(\"|\") : [a[3]], l = e.length, m = g.length, r = f.length, p = parseFloat(a[2]);\n if (0 > p || isNaN(p))p = .5;\n for (k = 0; k < m; k++)g[k] = Ha(g[k]);\n for (k = 0; k < r; k++)f[k] = Ha(f[k]);\n for (k = 0; k < l; k++)h.tween(Ha(e[k]), g[k % m], p, f[k % r], k == l - 1 ? a[4] : null, k == l - 1 ? a[5] : null)\n } else {\n l = k;\n r = a[1];\n m = !1;\n g && 0 > k.indexOf(\".\") && g.hasOwnProperty(k) && (l = g._type + \"[\" + g.name + \"].\" + k, m = !0);\n 0 == m && 0 < k.indexOf(\"[\") && (l = k = b(k, g), l = l.split(_[134]).join(_[127]));\n f.id = l;\n f.varname = k;\n f.actioncaller = g;\n f.startval = m ? g[k] : U(k, g);\n if (null == f.startval || \"\" == f.startval)f.startval = 0;\n f.endval = r;\n k = 2 < e ? String(a[2]) : \"0.5\";\n if (0 < k.indexOf(\"(\") && (p = Gb(k))) {\n var B = p[0];\n _[427] == B.cmd && (p = Number(B.args[0]), k = Number(B.args[1]), r = Math.abs(parseFloat(r) - parseFloat(f.startval)), k = k * r / p)\n }\n k = parseFloat(k);\n isNaN(k) && (k = .5);\n f.maxruntime = k;\n f.tweenmap = ac.getTweenfu(3 < e ? a[3] : _[56]);\n if (4 < e)if (\"wait\" == F(a[4]))f.blocking = !0, h.blocked = !0; else if (r = a[4])0 == m && 0 < r.indexOf(\"[\") && (r = b(r, g)), f.donecall = r;\n 5 < e && (f.updatefu = a[5]);\n f.starttime = Ta();\n f.process = u;\n n(l);\n c.push(f)\n }\n }\n };\n h.stoptween = function () {\n var a = h.actioncaller, c = arguments, e = c.length, g;\n for (g = 0; g < e; g++) {\n var f = F(c[g]);\n if (0 < f.indexOf(\"|\"))h.stoptween.apply(h.stoptween, f.split(\"|\")); else {\n if (a && 0 > f.indexOf(\".\")) {\n if (n(a._type + \"[\" + a.name + \"].\" + f))continue\n } else 0 < f.indexOf(\"[\") && (f = b(f, a)), f = f.split(_[134]).join(_[127]);\n n(f)\n }\n }\n };\n h.invalidatescreen = function () {\n Kb = Ta();\n p.haschanged = !0\n };\n h.updatescreen = function () {\n p.haschanged = !0\n };\n h.updateobject = function () {\n M && M.updateFOV && M.updateFOV(M, [Number(N.hfov), Number(N.vfov), Number(N.voffset)]);\n p.haschanged = !0\n };\n h.loadpano = function (a, b, c, d, e) {\n m.xml.scene = null;\n m.xml.view = {};\n Xa.loadpano(a, b, c, d, e)\n };\n h.loadpanoscene = function (a, b, c, d, e, h) {\n m.xml.scene = b;\n m.xml.view = {};\n m._loadpanoscene_name = b;\n Xa.loadpano(a, c, d, e, h)\n };\n h.loadxml = function (a, b, c, d, e) {\n m.xml.scene = null;\n m.xml.view = {};\n Xa.loadxml(a, b, c, d, e)\n };\n h.fscommand = function () {\n };\n h.freezeview = function () {\n };\n h.reloadpano = function () {\n };\n h.addlensflare = function () {\n };\n h.removelensflare = function () {\n };\n h.SAcall = function (a) {\n var b = U(_[14]);\n if ((a = Gb(a)) && b) {\n var c, d;\n d = a.length;\n for (c = 0; c < d; c++) {\n var e = a[c];\n if (e) {\n var g = e.cmd, f = b.getItem(g);\n f && 1 == pa(f.secure) ? (e = e.args, e.splice(0, 0, g), h.callaction(E(f.content, e))) : la(2, _[428] + g + _[282])\n }\n }\n }\n }\n })();\n var V = {};\n (function () {\n function a(a) {\n a = _[189] + a;\n L.console ? L.console.log(a) : alert(a)\n }\n\n function d(a, b, c, d, e, h) {\n var g = Ja(), f = g.style;\n f.position = _[0];\n \"LT\" == a ? (f.left = b, f.top = c) : (f.left = b, f.bottom = c);\n f.width = d;\n f.height = e;\n f.overflow = _[6];\n !1 === h && (f.webkitUserSelect = f.MozUserSelect = f.msUserSelect = f.oUserSelect = f.userSelect = \"none\");\n return g\n }\n\n function p(a) {\n if (r.fullscreen = a)L.activekrpanowindow = c.id;\n Ka(1 == a ? _[221] : _[225])\n }\n\n function f(a) {\n l && (Aa(a), r.onResize(a), setTimeout(e, 250))\n }\n\n function g(a, b) {\n for (var c = a.style, d = b.length, e = 0, e = 0; e < d; e += 2)c[b[e]] = b[e + 1]\n }\n\n function n(a) {\n p(!!(aa.fullscreenElement || aa.mozFullScreenElement || aa.webkitIsFullScreen || aa.webkitFullscreenElement || aa.msFullscreenElement))\n }\n\n function k(a) {\n if (l) {\n a = L.innerHeight;\n var b = vb;\n a < b ? r.__scrollpage_yet = !0 : r.__scrollpage_yet && (r.__scrollpage_yet = !1, e());\n if (a != b)r.onResize(null)\n }\n }\n\n function e() {\n var a = L.innerWidth, c = L.innerHeight;\n r.__scrollpage_yet && c == vb && (r.__scrollpage_yet = !1);\n var d = screen.height - 64, e = 268;\n 26 <= b.crios && (d += 44, e = 300);\n (320 == a && c != d || a == screen.height && c != e) && L.scrollTo(0, 0)\n }\n\n function w() {\n if (8 == b.iosversion && b.ipad) {\n var a = screen.width, d = screen.height, e = L.innerWidth, f = L.innerHeight, g = c.clientHeight;\n if (Math.min(e, f) == Math.min(a, d) && Math.max(e, f) == Math.max(a, d) || g > f)qa ^= 1, L.scrollTo(0, qa), setTimeout(w, 60)\n }\n }\n\n function x(a, b) {\n Aa(a);\n var c = \"none\" == D.style.display ? \"\" : \"none\";\n void 0 !== b && (c = 1 == b ? \"\" : \"none\");\n D.style.display = c;\n z.scrollTop = z.scrollHeight\n }\n\n function v() {\n Ca && (K.removeChild(Ca), Ca = null);\n var a, c = Ja();\n a = 25;\n b.androidstock && (a *= b.pixelratio);\n g(c, [_[65], _[0], \"left\", \"50%\", \"top\", \"50%\", _[47], _[40], _[120], a + \"px\", _[51], \"none\", _[148], _[5], _[267], \"none\"]);\n a = c.style;\n a.zIndex = 999999;\n a.opacity = .67;\n a = Ja();\n g(a, \"position;relative;left;-50%;top;-25px;fontFamily;sans-serif;textShadow;#000000 1px 1px 2px;lineHeight;110%\".split(\";\"));\n a.innerHTML = _[433] + (Na && Na[1] && 6 < Ha(Na[1], !1).length ? Na[1] : _[169]) + _[375];\n c.appendChild(a);\n K.appendChild(c);\n Ca = c\n }\n\n var r = V;\n r.fullscreen = !1;\n var y = !0, l = !1, u = !1;\n r.__scrollpage_yet = !1;\n var h = null, c = null, K = null;\n r.htmltarget = null;\n r.viewerlayer = null;\n r.controllayer = null;\n r.panolayer = null;\n r.pluginlayer = null;\n r.hotspotlayer = null;\n var D = r.svglayer = null, z = null, q = null, J = null, C = 0, Q = 0, A = !1, H = !1;\n r.build = function (e) {\n function h(a) {\n x(null, !1)\n }\n\n var l = e.target, t = e.id, G = aa.getElementById(l);\n if (!G)return a(_[172] + l), !1;\n for (var l = null, p = t, C = 1; ;)if (l = aa.getElementById(t))if (_[254] == p)C++, t = p + C; else return a(_[165] + t), !1; else break;\n l = Ja();\n l.id = t;\n l.style.position = _[119];\n l.style.overflow = _[6];\n l.style.lineHeight = _[45];\n l.style.fontWeight = _[45];\n l.style.fontStyle = _[45];\n l.tabIndex = -1;\n l.style.outline = 0;\n t = _[26];\n e.bgcolor && (t = e.bgcolor);\n e = F(e.wmode);\n if (_[36] == e || _[142] == e)t = null, m.bgcolor = 4278190080;\n null != t && (l.style.background = t, m.bgcolor = parseInt(t.slice(1), 16));\n G.appendChild(l);\n c = l;\n r.htmltarget = G;\n r.viewerlayer = l;\n K = d(\"LT\", 0, 0, \"100%\", \"100%\", !1);\n g(K, \"msTouchAction none touchAction none msContentZooming none contentZooming none -webkit-tap-highlight-color transparent\".split(\" \"));\n r.controllayer = K;\n t = d(\"LT\", 0, 0, \"100%\", \"100%\");\n r.panolayer = t;\n g(t, [_[258], \"none\"]);\n G = d(\"LT\", 0, 0, \"100%\", \"100%\", !1);\n 0 == b.ie && 0 == b.firefox && g(G, [Id, _[59]]);\n e = G;\n b.android && b.firefox && Kc && (p = d(\"LT\", 0, 0, \"1px\", \"1px\"), p.style.background = _[226], p.style.pointerEvents = \"none\", p.style.zIndex = 999999999, p.style[ib] = _[20], G.appendChild(p));\n var p = b.androidstock ? b.pixelratio : 1, C = 156 * p, u = (b.mobile ? 8 : 13) * p, w = b.androidstock || b.android && b.chrome ? 6 : 8;\n D = d(\"LB\", 0, 0, \"100%\", C + \"px\", !0);\n D.style.display = \"none\";\n !0 !== b.opera && Kc && (2 > Nb && (D.style[ib] = _[20]), b.ios && 0 == b.simulator || b.android && b.chrome) && (D.style[ib] = _[20]);\n D.style.zIndex = 999999999;\n var A = d(\"LT\", 0, 0, \"100%\", \"100%\", !0);\n A.style.opacity = .67;\n b.android && b.opera && (A.style.borderTop = _[179]);\n g(A, [_[255], _[26], pc, _[441] + w + _[373], _[114], w + \"px\", _[482], .67]);\n z = aa.createElement(\"pre\");\n w = null;\n b.mac && (w = _[270] + (L.chrome ? \"1px\" : \"0\"));\n b.realDesktop ? (z.style.fontFamily = _[55], z.style.fontSize = \"11px\", w && (z.style.fontSize = \"13px\", z.style.textShadow = w)) : (z.style.fontFamily = _[38], z.style.fontSize = u + \"px\");\n g(z, [_[65], _[0], \"left\", \"5px\", \"top\", \"0px\", _[50], \"left\", _[329], 0, _[296], b.realDesktop ? \"16px\" : 0, _[346], 0, _[286], 0, _[107], \"none\", _[71], 0, _[114], (b.realDesktop ? 10 : 8) + \"px\", _[49], \"100%\", _[28], C - 10 + \"px\", _[421], \"auto\", _[210], \"none\", _[471], \"block\", _[395], \"left\", _[338], _[411], _[51], \"none\", _[47], _[40]]);\n q = Ja();\n w && (q.style.textShadow = w);\n g(q, [_[65], _[0], _[3], 0, _[2], 0, _[132], \"0 4px\", _[28], C - 10 + \"px\", _[230], \"none\", _[279], \"none\", _[148], _[18], _[76], _[36], _[347], b.realDesktop ? _[55] : _[38], _[120], (b.realDesktop ? 10 : 9 * p | 0) + \"px\", _[47], _[40]]);\n q.innerHTML = \"CLOSE\";\n R(q, _[115], Aa, !0);\n R(q, _[118], h, !0);\n R(q, _[7], h, !0);\n D.appendChild(A);\n D.appendChild(z);\n D.appendChild(q);\n l.appendChild(K);\n K.appendChild(t);\n 0 < b.iosversion && 5 > b.iosversion && (e = Ja(), e.style.position = _[0], G.appendChild(e), K.style.webkitTransformStyle = _[59], G.style.webkitTransformStyle = \"flat\");\n K.appendChild(G);\n b.ios && (t = Ja(), t.style.position = _[0], t.style.webkitTransformStyle = _[59], e.appendChild(t));\n l.appendChild(D);\n r.pluginlayer = G;\n r.hotspotlayer = e;\n b.fullscreensupport && R(aa, b.browser.events.fullscreenchange, n);\n J = [l.style.width, l.style.height];\n r.onResize(null);\n R(L, _[137], r.onResize, !1);\n b.iphone && b.safari && R(L, _[133], k, !1);\n R(L, _[84], f, !1);\n return !0\n };\n r.setFullscreen = function (a) {\n if (b.fullscreensupport)if (a)c[b.browser.events.requestfullscreen](); else try {\n aa.exitFullscreen ? aa.exitFullscreen() : aa.mozCancelFullScreen ? aa.mozCancelFullScreen() : aa.webkitCancelFullScreen ? aa.webkitCancelFullScreen() : aa.webkitExitFullscreen ? aa.webkitExitFullscreen() : aa.msExitFullscreen && aa.msExitFullscreen()\n } catch (d) {\n } else {\n var e = aa.body, f = e.style, h = c.style;\n if (a)r.fsbkup = [f.padding, f.margin, f.overflow, e.scrollTop, e.scrollLeft, L.pageYOffset], f.padding = \"0 0\", f.margin = \"0 0\", f.overflow = _[6], e.scrollTop = \"0\", e.scrollLeft = \"0\", e.appendChild(c), h.position = _[0], h.left = 0, h.top = 0, h.width = \"100%\", h.height = \"100%\", Pa.domUpdate(), L.scrollTo(0, 0), p(!0); else if (a = r.fsbkup)r.htmltarget.appendChild(c), f.padding = a[0], f.margin = a[1], f.overflow = a[2], e.scrollTop = a[3], e.scrollLeft = a[4], h.position = _[119], Pa.domUpdate(), L.scrollTo(0, a[5]), r.fsbkup = null, p(!1)\n }\n };\n var qa = 0;\n r.onResize = function (a, d) {\n A = d;\n Aa(a);\n var f = c, g = \"100%\", k = \"100%\";\n null == J && (J = [f.style.width, f.style.height]);\n J && (g = J[0], k = J[1], \"\" == g && (g = \"100%\"), \"\" == k && (k = \"100%\"), J = null);\n var q = Jb.so;\n q && (q.width && (g = q.width), q.height && (k = q.height));\n r.fullscreen && (g = k = \"100%\");\n var n = f.parentNode, m = 0, p = f;\n do if (m = p.offsetHeight, b.ie && r.fullscreen && 20 > m && (m = 0), 1 >= m) {\n if (p = p.parentNode, null == p) {\n m = L.innerHeight;\n break\n }\n } else break; while (1);\n q = 0;\n for (p = f; p && \"body\" != F(p.nodeName);)q++, p = p.parentNode;\n var n = n ? n.offsetHeight : L.innerHeight, C = f.clientWidth, p = g, f = k;\n 0 < String(g).indexOf(\"%\") ? g = parseFloat(g) * C / 100 : (g = parseFloat(g), p = g + \"px\");\n 0 < String(k).indexOf(\"%\") ? k = parseFloat(k) * m / 100 : (k = parseFloat(k), f = k + \"px\");\n 1 > k && (k = 100);\n m = screen.width;\n C = screen.height;\n b.iphone && 320 == m && 4 > b.iosversion && 480 > C && (C = 480);\n var v = L.innerWidth, x = L.innerHeight;\n b.ios && 2 >= q && 0 == r.fullscreen && (26 <= b.crios && n > x && (x = k = n), w(), 7 <= b.iosversion && k > x && (k = x, l = u = !0, setTimeout(e, 10)));\n y && (y = !1, b.iphone ? (320 == v && x >= C - 124 ? x = C - 124 : v == C && 208 <= x && (x = 208), 2 >= q && (v == g && x && (320 == g && k == C - 124 || g == C && (208 == k || 320 == k)) && (l = !0), 26 <= b.crios && (320 == g || g == C) && (l = !0))) : b.ipad && 28 <= b.crios && 2 >= q && (g > k != m > C && (q = m, m = C, C = q), g == m && k == C - 20 && (u = l = !0)));\n l && (u ? (g = v, k = x) : 320 == L.innerWidth ? (g = 320, k = C - 64, b.crios && (k += 44)) : (g = C, k = 320 == L.innerHeight ? 320 : 268, 26 <= b.crios && (k = 300)), p = g + \"px\", f = k + \"px\");\n b.getViewportScale();\n q = p;\n Pa && Pa.focusLoss();\n l && null == h && (h = setInterval(e, 4E3), setTimeout(e, 250));\n n = !1;\n if (bc != g || vb != k || A)n = !0, A = !1, bc = g, vb = k;\n Ra && (Ra._pxw = Ra.pixelwidth = Ra.imagewidth = bc / X, Ra._pxh = Ra.pixelheight = Ra.imageheight = vb / X);\n Za && (Za._pxw = Za.pixelwidth = Za.imagewidth = bc / X, Za._pxh = Za.pixelheight = Za.imageheight = vb / X);\n n && (pb && pb.calc(bc, vb), Ka(_[63]), n = !1);\n pb ? (n |= pb.calc(bc, vb), K.style.left = pb.pixelx * X + \"px\", K.style.top = pb.pixely * X + \"px\", K.style.width = Qa + \"px\", K.style.height = ya + \"px\", g = Qa, k = ya) : (Qa = bc, ya = vb);\n uc = Math.max(4 * k / 3, g);\n c.style.width = q;\n c.style.height = f;\n b.desktop && (q = L.devicePixelRatio, isNaN(q) || (b.pixelratio = q, b.fractionalscaling = 0 != q % 1));\n Oa.size(g, k);\n H = !0;\n n && Ka(_[63]);\n Xa.updateview(!1, !0);\n r.resizeCheck(!0);\n A = !1\n };\n r.resizeCheck = function (a) {\n var b = !1, d = c, e = d.clientWidth, d = d.clientHeight;\n if (e != C || d != Q || a || pb && pb.haschanged)if (C = e, Q = d, b = !0, 1 == a)b = !1; else r.onResize(null);\n H && !0 !== a && (b = !0, H = !1);\n 255 == (jc & 511) && 0 == (Ya & 1) && v();\n return b\n };\n var ea = \"\";\n r.log = function (a) {\n if (\"cls\" == a)z.innerHTML = \"\"; else if (\"d\" == a)v(); else {\n var c = 4 > b.firefoxversion ? 4096 : 1E4, d = a.slice(0, 6);\n _[140] == d || _[135] == d ? (c = _[200] + (69 == d.charCodeAt(0) ? \"F\" : \"0\") + _[416] + a + _[417], ea += c + \"\\n\", z.innerHTML += \"\\n\" + c) : (ea += a + \"\\n\", ea.length > c ? (ea = ea.slice(-c / 2, -1), z.innerHTML = ea) : z.lastChild ? z.lastChild.nodeValue += \"\\n\" + a : z.innerHTML += a);\n z.scrollTop = z.scrollHeight;\n Jb.so.vars && pa(Jb.so.vars.consolelog) && (c = L.console) && c.log && (b.firefox || b.chrome ? c.log(\"%c\" + a, _[135] == d ? _[259] : _[140] == d ? _[178] : _[420] == d ? _[257] : _[262]) : c.log(a))\n }\n };\n r.showlog = function (a) {\n x(null, a)\n };\n r.togglelog = x;\n r.getMousePos = function (a, b) {\n var c;\n c = {};\n var d = b ? b : K, e = d.getBoundingClientRect();\n c.x = Math.round(a.clientX - e.left - d.clientLeft + d.scrollLeft);\n c.y = Math.round(a.clientY - e.top - d.clientTop + d.scrollTop);\n return c\n };\n r.remove = function () {\n null != h && (clearInterval(h), h = null);\n try {\n ba(L, _[137], r.onResize, !1), b.iphone && b.safari && ba(L, _[133], k, !1), ba(L, _[84], f, !1), b.fullscreensupport && ba(aa, b.browser.events.fullscreenchange, n), r.htmltarget.removeChild(c), r.htmltarget = null, r.viewerlayer = null, r.controllayer = null, r.panolayer = null, r.pluginlayer = null, K = c = q = z = D = r.hotspotlayer = null\n } catch (a) {\n }\n };\n var Ca = null\n })();\n var Pa = {};\n (function () {\n function a(a) {\n var b = a.pointerType;\n if (4 != b && _[19] != b) {\n a = a.changedTouches ? a.changedTouches : [a];\n var b = a.length, c, d, e;\n for (c = 0; c < b; c++)if (d = a[c], e = d.pointerId ? d.pointerId : d.identifier, void 0 !== e) {\n d = wa(d);\n d = {id: e, lx: d.x / X, ly: d.y / X};\n var f, g;\n g = ka.length;\n for (f = 0; f < g; f++)if (ka[f].id == e) {\n ka[f] = d;\n return\n }\n ka.push(d)\n }\n }\n }\n\n function d(a) {\n var b = a.pointerType;\n if (4 != b && _[19] != b) {\n a = a.changedTouches ? a.changedTouches : [a];\n var b = a.length, c, d;\n for (c = 0; c < b; c++)if (d = a[c], d = d.pointerId ? d.pointerId : d.identifier, void 0 !== d) {\n var e, f;\n f = ka.length;\n for (e = 0; e < f; e++)if (ka[e].id == d) {\n ka.splice(e, 1);\n break\n }\n }\n }\n }\n\n function E() {\n var a = F(ia.usercontrol);\n return _[19] == a || \"all\" == a\n }\n\n function f(a) {\n return a && (a = a.pointerType, 4 == a || _[19] == a) ? !0 : !1\n }\n\n function g(a, b, c, d) {\n for (var e = jc; 0 < wb.length && !(c - wb[0].t <= Sa) && !(1 >= e - wb[0].f);)wb.shift();\n e = wb.length - 1;\n 0 <= e && a == wb[e].x && b == wb[e].y ? wb[e].t = c : wb.push({x: a, y: b, t: c, f: d})\n }\n\n function n(a, b, c, d) {\n b = p.inverseProject(a, b);\n var e = p.inverseProject(c, d);\n d = (Math.atan2(e.z, e.x) - Math.atan2(b.z, b.x)) / Y;\n b = -(Math.atan2(b.y, Math.sqrt(b.x * b.x + b.z * b.z)) - Math.atan2(e.y, Math.sqrt(e.x * e.x + e.z * e.z))) / Y;\n -180 > d ? d += 360 : 180 < d && (d -= 360);\n if (c < a && 0 > d || c > a && 0 < d)d = -d;\n return {h: d, v: b}\n }\n\n function k(a, b, c, d) {\n E() ? (a = n(a, b, c, d), ga = !1, ca = a.h, oa = a.v, a = p.hlookat + ca, b = p.vlookat + oa, T += ca, ya += oa, c = p._limits, ia.bouncinglimits && c && (360 > c[0] && (a < c[1] ? (Na = !0, a = .5 * T + .5 * c[1]) : a > c[2] && (Na = !0, a = .5 * T + .5 * c[2])), b < c[4] ? (Na = !0, b = .5 * ya + .5 * c[4]) : b > c[5] && (Na = !0, b = .5 * ya + .5 * c[5])), p.hlookat = a, p.vlookat = b, Xa.updateview(), p.haschanged = !0) : oa = ca = 0\n }\n\n function e(a) {\n (aa.hidden || aa.webkitHidden || aa.mozHidden || aa.msHidden) && w(a)\n }\n\n function w(a) {\n K();\n a && (_[64] == a.type && !1 === a.persisted && (jd = !0), O.down && C(a));\n for (var b in N)1 == N[b] && (m.keycode = b, Ka(_[130]), N[b] = !1);\n m.keycode = 0;\n x()\n }\n\n function x() {\n m.hlookat_moveforce = m.vlookat_moveforce = m.fov_moveforce = 0;\n Oa = sa = ga = !1;\n Ga = za = Qa = La = ca = oa = Ea = Ua = Ra = Bb = 0\n }\n\n function v(a) {\n var c = 0;\n if (1 != ia.disablewheel && (Aa(a), cb = Ta(), E())) {\n a.wheelDelta ? c = a.wheelDelta / -120 : a.detail && (c = a.detail, 0 == b.mac && (c /= 3));\n var d = c * ia.mousefovchange;\n ia.zoomtocursor ? (Ma = !0, u(a), Ha = O.x, va = O.y, 0 < d && 0 == ia.zoomoutcursor && (Ma = !1)) : Ma = !1;\n Oa = !0;\n ha = 0;\n Ga += .001 * d;\n m.wheeldelta_raw = -c;\n m.wheeldelta = 3 * -c;\n Ka(_[100])\n }\n }\n\n function r(a) {\n var c = V.viewerlayer;\n aa.activeElement == c != 0 && L.activekrpanowindow == c.id && (c = a.keyCode, 0 == (a.altKey || a.ctrlKey || a.shiftKey || 32 > c || 111 < c && 124 > c) && Aa(a), m.keycode = c, N[c] = !0, Ka(_[384]), 79 != c || !m.logkey && Ya & 1 || V.togglelog(), l(c, 1), 27 == c && (K(), V.fullscreen && (V.fsbkup || b.opera) && V.setFullscreen(!1)))\n }\n\n function y(a) {\n var b = V.viewerlayer;\n aa.activeElement == b != 0 && L.activekrpanowindow == b.id && (a = a.keyCode, m.keycode = a, N[a] = !1, Ka(_[130]), l(a, 0))\n }\n\n function l(a, b) {\n var c = F(ia.usercontrol);\n if (\"all\" == c || \"keyb\" == c)a = \",\" + a + \",\", 0 <= (\",\" + ia.keycodesin + \",\").indexOf(a) ? m.fov_moveforce = -b : 0 <= (\",\" + ia.keycodesout + \",\").indexOf(a) ? m.fov_moveforce = +b : 0 <= (\",\" + ia.keycodesleft + \",\").indexOf(a) ? m.hlookat_moveforce = -b : 0 <= (\",\" + ia.keycodesright + \",\").indexOf(a) ? m.hlookat_moveforce = +b : 0 <= (\",\" + ia.keycodesup + \",\").indexOf(a) ? m.vlookat_moveforce = ia.keybinvert ? +b : -b : 0 <= (\",\" + ia.keycodesdown + \",\").indexOf(a) && (m.vlookat_moveforce = ia.keybinvert ? -b : +b)\n }\n\n function u(a) {\n cb = Ta();\n a = wa(a);\n O.x = a.x / X;\n O.y = a.y / X;\n O.moved = !0\n }\n\n function h(a) {\n cb = Ta();\n var d, e, g = a.changedTouches ? a.changedTouches : [a];\n e = g.length;\n var h = F(a.type), k = 0 <= h.indexOf(\"start\") || 0 <= h.indexOf(\"down\");\n -99 != fa && k && (ra = !0);\n for (d = 0; d < e; d++) {\n var h = g[d], q = h.pointerId ? h.pointerId : h.identifier;\n -99 == fa && k && (fa = q);\n if (fa == q) {\n e = wa(h);\n O.x = e.x / X;\n O.y = e.y / X;\n O.moved = !0;\n 0 == (Ya & 16) && (0 == b.realDesktop || 10 <= b.ieversion && !f(a)) && O.x > bc / X - 22 && O.y > vb / X - 32 && a.type == ta.touchstart && (U = h.pageY, R(W, ta.touchend, c, !0));\n break\n }\n }\n }\n\n function c(a) {\n a = a.changedTouches ? a.changedTouches : [a];\n ba(W, ta.touchend, c, !0);\n -120 > a[0].pageY - U && V.showlog(!0)\n }\n\n function K() {\n if (Za) {\n try {\n W.removeChild(Za), W.removeChild(bb)\n } catch (a) {\n }\n bb = Za = null\n }\n }\n\n function D(a) {\n if (Za)K(); else {\n Aa(a);\n a.stopPropagation();\n var c = wa(a.changedTouches ? a.changedTouches[0] : a);\n Za = De(c.x, c.y, K, 0 <= F(a.type).indexOf(\"touch\"));\n null != Za && (bb = Ja(), a = bb.style, a.position = _[0], b.androidstock || (a.zIndex = 99999999998, a[ib] = _[20]), a.width = \"100%\", a.height = \"100%\", W.appendChild(bb), W.appendChild(Za))\n }\n }\n\n function z(a, c) {\n var d = a.timeStamp | 0;\n 500 < d && 500 > d - kc ? kc = 0 : (L.activekrpanowindow = V.viewerlayer.id, V.viewerlayer.focus(), cb = Ta(), Aa(a), da.isblocked() || 0 != (a.button | 0) || (K(), 1 != c ? (R(L, _[10], q, !0), R(L, _[4], J, !0), b.topAccess && R(top, _[4], C, !0)) : R(b.topAccess ? top : L, ta.touchend, Ca, !0), d = wa(a), ab = d.x, $a = d.y, kb = a.timeStamp, T = p.hlookat, ya = p.vlookat, xa = 0, O.down = !0, O.up = !1, O.moved = !1, O.downx = O.x = d.x / X, O.downy = O.y = d.y / X, ae.update(), Ka(_[103])))\n }\n\n function q(a) {\n Aa(a);\n var b = wa(a);\n O.x = b.x / X;\n O.y = b.y / X;\n O.moved = !0;\n if (_[27] == F(ia.mousetype)) {\n sa = !0;\n var c = n(ab, $a, b.x, b.y).h;\n xa += c\n } else k(ab, $a, b.x, b.y);\n ab = b.x;\n $a = b.y;\n kb = a.timeStamp;\n (0 === a.buttons || void 0 === a.buttons && 0 === a.which) && J(a, !0)\n }\n\n function J(a, c) {\n cb = Ta();\n Aa(a);\n ba(L, _[10], q, !0);\n ba(L, _[4], J, !0);\n b.topAccess && ba(top, _[4], C, !0);\n ga = !0;\n O.down = !1;\n ae.update();\n 0 == O.up && (O.up = !0, Ka(_[113]), !0 !== c && (0 == O.moved || 5 > Math.abs(O.x - O.downx) && 5 > Math.abs(O.y - O.downy)) && Ka(_[131]))\n }\n\n function C(a) {\n J(a, !0)\n }\n\n function Q(a) {\n 1 == m.control.preventTouchEvents && Aa(a)\n }\n\n function A(a) {\n Ia && (xb++, 2 == xb && (qd = 1), Pb.addPointer(a.pointerId), W.setPointerCapture ? W.setPointerCapture(a.pointerId) : W.msSetPointerCapture && W.msSetPointerCapture(a.pointerId))\n }\n\n function H(a) {\n xb--;\n 0 > xb && (xb = 0);\n return 2 > xb && Da ? (t(a), !0) : !1\n }\n\n function qa(c) {\n kc = c.timeStamp | 0;\n Sa = b.ios ? 100 : 49 > nd ? 200 : 100;\n a(c);\n if (ua) {\n if (0 == m.control.preventTouchEvents)return;\n if (f(c)) {\n c.currentPoint && c.currentPoint.properties && 0 == c.currentPoint.properties.isLeftButtonPressed && (c.button = 0);\n kc = 0;\n z(c, !0);\n return\n }\n A(c)\n }\n L.activekrpanowindow = V.viewerlayer.id;\n cb = Ta();\n 0 == V.__scrollpage_yet && Q(c);\n K();\n if (!(Da || 0 == Va && 1 < ka.length || da.isblocked())) {\n var d = c.changedTouches ? c.changedTouches[0] : c, e = wa(d);\n la = d.pointerId ? d.pointerId : d.identifier;\n ab = e.x;\n $a = e.y;\n kb = c.timeStamp;\n wb = [];\n T = p.hlookat;\n ya = p.vlookat;\n xa = 0;\n O.down = !0;\n O.up = !1;\n O.moved = !1;\n O.downx = O.x = e.x / X;\n O.downy = O.y = e.y / X;\n Fa = {t: kc};\n Ka(_[103])\n }\n }\n\n function ea(a) {\n var b = a.pointerType;\n if (4 != b && _[19] != b) {\n var b = a.changedTouches ? a.changedTouches : [a], c = b.length, d, e, h;\n for (d = 0; d < c; d++)if (e = b[d], h = e.pointerId ? e.pointerId : e.identifier, void 0 !== h) {\n var t, l;\n l = ka.length;\n for (t = 0; t < l; t++)if (ka[t].id == h) {\n e = wa(e);\n h = e.y / X;\n t = ka[t];\n t.lx = e.x / X;\n t.ly = h;\n break\n }\n }\n }\n if (ua) {\n if (f(a)) {\n O.down && q(a);\n return\n }\n if (1 < xb)return\n }\n if ((b = E()) && 0 == Va && 1 < ka.length) {\n var m;\n l = e = ka[0].lx;\n m = h = ka[0].ly;\n t = ka.length;\n for (d = 1; d < t; d++)b = ka[d].lx, c = ka[d].ly, b < e && (e = b), b > l && (l = b), c < h && (h = c), c > m && (m = c);\n b = l - e;\n c = m - h;\n b = Math.sqrt(b * b + c * c);\n 1 > b && (b = 1);\n 0 == M ? (M = !0, I = b, Z(a)) : B(a, b / I)\n } else cb = Ta(), 0 == V.__scrollpage_yet && Q(a), Da || 0 == b || (b = a.changedTouches ? a.changedTouches[0] : a, la == (b.pointerId ? b.pointerId : b.identifier) && (b = wa(b), _[27] == F(ia.touchtype) ? (sa = !0, c = n(ab, $a, b.x, b.y).h, -180 > c ? c = 360 + c : 180 < c && (c = -360 + c), xa += c) : k(ab, $a, b.x, b.y), ab = b.x, $a = b.y, kb = a.timeStamp, g(ab, $a, kb, jc), -99 == fa && (O.x = b.x / X, O.y = b.y / X), Fa && 16 < O.dd && (Fa = null), Aa(a)))\n }\n\n function Ca(a) {\n d(a);\n fa = -99;\n ra = !1;\n if (ua) {\n ba(b.topAccess ? top : L, ta.touchend, Ca, !0);\n if (H(a))return;\n if (f(a)) {\n J(a);\n return\n }\n }\n M && (t(a), M = !1);\n 0 == V.__scrollpage_yet && Q(a);\n if (Da)la = -99; else {\n var c = a.changedTouches ? a.changedTouches[0] : a;\n if (la == (c.pointerId ? c.pointerId : c.identifier)) {\n la = -99;\n c = wa(c);\n O.x = c.x / X;\n O.y = c.y / X;\n ab = c.x;\n $a = c.y;\n kb = a.timeStamp;\n g(ab, $a, kb, jc);\n if (_[27] != F(ia.touchtype))if (E() && 1 < wb.length) {\n var e = wb[0], h = wb[wb.length - 1], c = (h.t - e.t) / 15;\n 0 < c && (e = n(e.x, e.y, h.x, h.y), ga = !0, ca = e.h / c, oa = e.v / c)\n } else ga = !1, oa = ca = 0;\n O.down = !1;\n 0 == O.up && (O.up = !0, Fa && (c = 52800 / (Math.min(Math.max(ja.currentfps, 10), 60) + 35), 32 > O.dd && (a.timeStamp | 0) - Fa.t > c && D(a)), Ka(_[113]), (0 == O.moved || 5 > Math.abs(O.x - O.downx) && 5 > Math.abs(O.y - O.downy)) && Ka(_[131]));\n Fa = null\n }\n }\n }\n\n function S(a) {\n d(a);\n M = !1;\n fa = la = -99;\n Da = !1;\n xb = 0;\n Fa = null\n }\n\n function Z(a) {\n 0 == m.control.preventTouchEvents || Ia && 2 > xb || (Aa(a), Da = !0, Fa = null, pa = p.fov, la = -99, O.down = !1)\n }\n\n function B(a, b) {\n if (0 != m.control.preventTouchEvents) {\n var c = void 0 !== b ? b : a.scale;\n if (Ia) {\n if (2 > xb)return;\n 0 == Da && Z(a);\n c = qd *= c\n }\n Aa(a);\n cb = Ta();\n if (E()) {\n oa = ca = 0;\n var d = 2 / Y, e = 1 / Math.tan(pa / d), d = Math.atan(1 / (e * c)) * d, e = d > p.fov ? -3 : 3;\n m.wheeldelta = e;\n m.wheeldelta_raw = e / 3;\n m.wheeldelta_touchscale = c;\n 0 == ia.touchzoom && (d = p.fov);\n ia.bouncinglimits && (d < p.fovmin ? (d = G(d), c = G(p.fovmin), Ga = .5 * -(d - c), Oa = !0, ha = 1, d += Ga, Ga = 1E-9, d = Ba(d)) : d > p.fovmax && (d = G(d), c = G(p.fovmax), Ga = .75 * -(d - c), Oa = !0, ha = 1, d += Ga, Ga = 1E-9, d = Ba(d)));\n if (ia.zoomtocursor && (0 < e || 1 == ia.zoomoutcursor)) {\n if (e = ka.length, 0 < e) {\n Ma = !0;\n for (c = va = Ha = 0; c < e; c++) {\n var f = ka[c];\n Ha += f.lx;\n va += f.ly\n }\n Ha /= e;\n va /= e;\n p.updateView();\n e = p.screentosphere(Ha, va);\n p.fov = d;\n p.updateView();\n c = p.screentosphere(Ha, va);\n d = p.hlookat + (e.x - c.x);\n e = p.vlookat + (e.y - c.y);\n if (c = p._limits)360 > c[0] && (d < c[1] ? d = c[1] : d > c[2] && (d = c[2])), e < c[4] ? e = c[4] : e > c[5] && (e = c[5]);\n p.hlookat = d;\n p.vlookat = e\n }\n } else p.fov = d, p.updateView();\n Ka(_[100]);\n p.haschanged = !0\n }\n }\n }\n\n function t(a) {\n 0 != m.control.preventTouchEvents && (Da && (Da = !1), ra = !1, ka = [], Aa(a))\n }\n\n function G(a) {\n return pb * Math.log(1 / Math.tan(.5 * a * Y))\n }\n\n function Ba(a) {\n return 2 * Math.atan(1 / Math.exp(a / pb)) / Y\n }\n\n var P = Pa;\n P.mouse = !1;\n P.touch = !1;\n var Fa = null, wa = null, ta = null, W = null, N = [], Da = !1, U = 0, Va = !1, M = !1, I = 1, pa = 90, la = -99, T = 0, ya = 0, ab = 0, $a = 0, kb = 0, wb = [], fa = -99, ra = !1, Sa = 100, ka = [], ua = !1, Ia = !1, Pb = null, xb = 0, qd = 1, ga = !1, ca = 0, oa = 0, sa = !1, Qa = 0, La = 0, za = 0, xa = 0, Oa = !1, Ga = 0, ha = 0, Ma = !1, Ha = 0, va = 0, Ea = 0, Ua = 0, Na = !1, Ra = 0, Bb = 0, Za = null, bb = null;\n P.registerControls = function (a) {\n W = a;\n ta = b.browser.events;\n wa = V.getMousePos;\n b.ie && (Ia = (ua = jb.msPointerEnabled || jb.pointerEnabled) && (1 < jb.msMaxTouchPoints || 1 < jb.maxTouchPoints));\n Va = Ia || 0 == b.simulator && b.ios || void 0 !== aa.documentElement.ongesturestart;\n if (b.chrome || b.android)Va = !1;\n a = !(0 == b.simulator && b.ios || b.android || 10 <= b.ieversion && b.touchdeviceNS);\n var c = b.touchdeviceNS;\n c && (b.mobile || b.tablet) && 0 == b.simulator && (a = !1);\n P.mouse = a;\n P.touch = c;\n ta.mouse = a;\n ta.touch = c;\n R(aa, _[126], r, !1);\n R(aa, \"keyup\", y, !1);\n R(b.topAccess ? top : L, _[37], w, !0);\n R(b.topAccess ? top : L, _[64], w, !0);\n R(aa, _[52], e);\n R(aa, _[79], e);\n R(aa, _[81], e);\n R(aa, _[82], e);\n if (a || ua)R(W, _[95], v, !1), R(W, _[108], v, !1);\n (a || ua) && R(L, _[10], u, !0);\n a && R(W, _[7], z, !1);\n (a && b.realDesktop || b.ie) && R(W, _[37], D, !0);\n c && (R(W, ta.touchstart, h, !0), R(W, ta.touchmove, h, !0), R(W, ta.touchstart, qa, !1), R(W, ta.touchmove, ea, !0), R(W, ta.touchend, Ca, !0), R(W, ta.touchcancel, S, !0), Va && (R(W, ta.gesturestart, Z, !1), R(W, ta.gesturechange, B, !1), R(W, ta.gestureend, t, !0), Ia && (R(W, _[93], t, !0), Pb = new MSGesture, Pb.target = W)))\n };\n P.domUpdate = function () {\n if (Pb) {\n var a = W;\n xb = 0;\n P.unregister();\n P.registerControls(a)\n }\n };\n P.unregister = function () {\n Pb && (Pb = Pb.target = null);\n ba(aa, _[126], r, !1);\n ba(aa, \"keyup\", y, !1);\n ba(b.topAccess ? top : L, _[37], w, !0);\n ba(b.topAccess ? top : L, _[64], w, !0);\n b.topAccess && ba(top, _[4], C, !0);\n ba(aa, _[52], e);\n ba(aa, _[79], e);\n ba(aa, _[81], e);\n ba(aa, _[82], e);\n ba(L, _[10], u, !0);\n ba(L, _[10], q, !0);\n ba(L, _[4], J, !0);\n ba(W, _[95], v, !1);\n ba(W, _[108], v, !1);\n ba(W, _[7], z, !1);\n ba(W, _[37], D, !1);\n ba(W, ta.touchstart, h, !0);\n ba(W, ta.touchmove, h, !0);\n ba(W, ta.touchstart, qa, !1);\n ba(W, ta.touchmove, ea, !0);\n ba(W, ta.touchend, Ca, !0);\n ba(W, ta.touchcancel, S, !0);\n ba(W, ta.gesturestart, Z, !1);\n ba(W, ta.gesturechange, B, !1);\n ba(W, ta.gestureend, t, !0);\n ba(W, _[93], t, !0);\n wa = ta = W = null\n };\n P.handleFrictions = function () {\n var a, b = a = !1, c = m.hlookat_moveforce, d = m.vlookat_moveforce, e = m.fov_moveforce;\n if (0 != e) {\n var f = ia.keybfovchange;\n Ma = !1;\n Oa = !0;\n ha = 0;\n Ga += f * e * .001\n }\n if (0 != c || 0 != d || 0 != Ea || 0 != Ua) {\n var g = ia.keybfriction, b = ia.keybspeed, e = p.hlookat, f = p.vlookat, h = ia.keybaccelerate * Math.tan(Math.min(.5 * Number(p.fov), 45) * Y);\n Ea += c * h;\n c = Ua += d * h;\n d = Ea;\n Ea *= g;\n Ua *= g;\n g = Math.sqrt(c * c + d * d);\n 0 < g ? (c /= g, d /= g) : d = c = 0;\n g > b && (g = b);\n d *= g;\n e = 180 >= (Math.floor(f) % 360 + 450) % 360 ? e + d : e - d;\n f += c * g;\n p.hlookat = e;\n p.vlookat = f;\n g < .05 * h && (Ua = Ea = 0);\n b = !0\n }\n a |= b;\n if (ga)c = Math.pow(ia.touchfriction, .92), ca *= c, oa *= c, c = Math.sqrt(oa * oa + ca * ca), d = Math.min(.04 * uc / p.r_zoom, .5), 0 != c && (p.hlookat += ca, p.vlookat += oa), c < d && (ga = !1, oa = ca = 0), a |= 1; else if (sa) {\n var c = O, d = za, b = Qa, e = La, g = .025 * ia.mouseaccelerate, k = ia.mousespeed, h = ia.mousefriction, f = !1;\n if (E()) {\n if (c.down && (c.x != c.downx || c.y != c.downy)) {\n var q = n(c.downx, c.downy, c.x, c.y);\n q.h = xa;\n b = d * b - q.h * g;\n e = d * e - q.v * g;\n d = Math.sqrt(b * b + e * e);\n 0 < d && (b /= d, e /= d, d > k && (d = k))\n }\n g = p.hlookat;\n k = p.vlookat;\n k += d * e * ia.mouseyfriction;\n p.hlookat = g + d * b;\n p.vlookat = k;\n d *= h;\n h = Math.min(.04 * uc / p.r_zoom, .5);\n 0 == c.down && d < h && (f = !0)\n } else f = !0;\n f && (sa = !1, xa = e = b = d = 0);\n za = d;\n Qa = b;\n La = e;\n a |= 1\n }\n if (Oa) {\n a:{\n d = c = p.fov;\n b = Ga;\n e = !1;\n if (0 < Math.abs(b)) {\n h = b;\n g = ia.fovspeed;\n e = p.fovmin;\n f = p.fovmax;\n b *= ia.fovfriction;\n Math.abs(h) > g && (h = g * (h / Math.abs(h)));\n c = G(c);\n c = Ba(c + h);\n if (ia.bouncinglimits && 0 < ha)if (0 == Da)h = G(c), c < e ? (b = G(e), b = .25 * -(h - b)) : c > f && (b = G(f), b = .25 * -(h - b)); else {\n c = void 0;\n break a\n } else c < e && (c = e, b = 0), c > f && (c = f, b = 0);\n p.fov = c;\n Ga = b;\n e = !0;\n Ma && (p.fov = d, p.updateView(), d = p.screentosphere(Ha, va), p.fov = c, p.updateView(), c = p.screentosphere(Ha, va), b = p.vlookat + (d.y - c.y), p.hlookat += d.x - c.x, p.vlookat = b)\n }\n 1E-5 > Math.abs(Ga) && (ha = Ga = 0, Oa = !1);\n c = e\n }\n a |= c\n }\n Na && (c = !1, O.down ? c = !1 : (d = p.hlookat, b = p.vlookat, d += Ra, b += Bb, p.hlookat = d, p.vlookat = b, c = !0, Ra *= .95, Bb *= .95, e = p._limits, ia.bouncinglimits && e && (360 > e[0] && (d < e[1] ? Ra = .15 * -(d - e[1]) : d > e[2] && (Ra = .15 * -(d - e[2]))), b < e[4] ? Bb = .15 * -(b - e[4]) : b > e[5] && (Bb = .15 * -(b - e[5]))), d = .15 * Math.min(.04 * uc / p.r_zoom, .5), Math.sqrt(Ra * Ra + Bb * Bb) < d && (Ra = Bb = 0, Na = !1)), a |= c);\n return a\n };\n P.stopFrictions = function (a) {\n 0 == (0 | a) && (a = 3);\n a & 1 && (Qa = ca = 0);\n a & 2 && (La = oa = 0);\n a & 4 && (x(), O.down = !1)\n };\n P.isMultiTouch = function () {\n return Da || M || 1 < xb || ra\n };\n P.isBouncing = function () {\n return 0 < ha || Na\n };\n P.focusLoss = w;\n P.trackTouch = function (b) {\n if (0 == Va || Ia) {\n var c = b.type;\n c == ta.touchstart ? ua ? A(b) : a(b) : c == ta.touchend && (ua ? H(b) : d(b))\n }\n };\n var pb = -.1\n })();\n var fa = null, M = null, Cb = !1, $c = !1, Db = 0, Wa = !1, ad = !1, Eb = -1, Xa = {};\n (function () {\n function a(a, b) {\n if (!0 !== b)p.haschanged = !0; else {\n !0 !== a && (Kb = Ta());\n var c = m.webVR;\n c && c.enabled && c.updateview();\n Ka(_[299]);\n p.updateView();\n fa && Oa.renderpano(fa, 2);\n M && Oa.renderpano(M, 1);\n z && (z = Oa.rendersnapshot(z, M));\n ob(!0);\n Ka(_[278])\n }\n }\n\n function d(a, b, c, d, e) {\n h.count++;\n h.id = h.count;\n if (f()) {\n da.busy = !0;\n m.xml.url = \"\";\n m.xml.content = a;\n var g = (new DOMParser).parseFromString(a, _[25]);\n T.resolvexmlincludes(g, function () {\n g = T.xmlDoc;\n n(g, b, c, d, e)\n })\n }\n }\n\n function E(a) {\n var b = 0 != (c & 64) && 0 == (c & 256), d;\n !0 === a && (c = b = 0);\n if (0 == (c & 4)) {\n var e = xa.getArray();\n a = e.length;\n for (d = 0; d < a; d++) {\n var g = e[d];\n !g || 0 != b && 0 != g.keep || (g.sprite && (g.visible = !1, g.parent = null, V.pluginlayer.removeChild(g.sprite)), g.destroy(), xa.removeItem(d), d--, a--)\n }\n }\n if (0 == (c & 128))for (e = Ua.getArray(), a = e.length, d = 0; d < a; d++)if ((g = e[d]) && (0 == b || 0 == g.keep)) {\n if (g.sprite) {\n g.visible = !1;\n g.parent = null;\n try {\n V.hotspotlayer.removeChild(g.sprite)\n } catch (f) {\n }\n if (g._poly) {\n try {\n V.svglayer.removeChild(g._poly)\n } catch (h) {\n }\n g._poly.kobject = null;\n g._poly = null\n }\n }\n g.destroy();\n Ua.removeItem(d);\n d--;\n a--\n }\n b = Yb.getArray();\n a = b.length;\n for (d = 0; d < a; d++)(e = b[d]) && 0 == pa(e.keep) && (Yb.removeItem(d), d--, a--)\n }\n\n function f() {\n return 1 < h.count && h.removeid != h.id && (h.removeid = h.id, Ka(_[301], !0), h.removeid != h.id) ? !1 : !0\n }\n\n function g(a) {\n var b, c, d = \"\";\n a = Gc(a);\n b = a.lastIndexOf(\"/\");\n c = a.lastIndexOf(\"\\\\\");\n c > b && (b = c);\n 0 <= b && (d = a.slice(0, b + 1));\n return d\n }\n\n function n(a, d, e, g, f) {\n za.currentmovingspeed = 0;\n K = !1;\n c = M ? 64 : 0;\n e && (e = F(e), 0 <= e.indexOf(_[323]) && (c |= 4), 0 <= e.indexOf(_[306]) && (c |= 128), 0 <= e.indexOf(_[391]) && (c |= 16), 0 <= e.indexOf(_[418]) && (c |= 32), 0 <= e.indexOf(\"merge\") && (c |= 16448), 0 <= e.indexOf(_[354]) && (c |= 256), 0 <= e.indexOf(_[412]) && (c |= 4), 0 <= e.indexOf(_[459]) && (c |= 36), 0 <= e.indexOf(_[400]) && (K = !0, c |= 65536), 0 <= e.indexOf(_[310]) && I(_[102], 0), 0 <= e.indexOf(_[360]) && (c |= 1056));\n 0 == K && (Db = 0, g && (g = F(g), e = g.indexOf(_[490]), 0 <= e && (Db = parseFloat(g.slice(e + 6)), isNaN(Db) || 0 > Db)) && (Db = 2), M && (e = 0 != (c & 1024), b.webgl ? (e && (fa || z) && (fa && (z = Oa.snapshot(z, fa)), e = !1), fa && (fa.destroy(), fa = null), 0 == e ? (M.stop(), z = Oa.snapshot(z, M), M.destroy(), M = null) : (M.suspended = !0, fa = M, M = null, Oa.renderpano(fa, 2)), Oa.setblendmode(g), Eb = -1, Wa = !1) : (0 == Wa ? (fa && (fa.destroy(), fa = null), fa = M, 0 == e ? fa.stop() : fa.suspended = !0, M = null) : (g = (Ta() - Eb) / 1E3 / Db, g = y(g), .5 < g ? M && (M.destroy(), M = null) : (fa && (fa.destroy(), fa = null), fa = M, 0 == e ? fa.stop() : fa.suspended = !0, M = null), Wa = !1), fa && fa.stopped && Oa.renderpano(fa, 2))), c & 32 && (u[0] = p.hlookat, u[1] = p.vlookat, u[2] = p.camroll, u[3] = p.fov, u[4] = p.fovtype, u[5] = p.fovmin, u[6] = p.fovmax, u[7] = p.maxpixelzoom, u[8] = p.fisheye, u[9] = p.fisheyefovlink, u[10] = p.stereographic, u[12] = p.pannini, u[13] = p.architectural, u[14] = p.architecturalonlymiddle), 0 == (c & 16384) && p.defaults(), p.limitview = \"auto\", p.hlookatmin = Number.NaN, p.hlookatmax = Number.NaN, p.vlookatmin = Number.NaN, p.vlookatmax = Number.NaN, m.preview && delete m.preview, m.image && delete m.image, m.onstart = null, N = m.image = {}, N.type = null, N.multires = !1, N.multiresthreshold = .025, N.cubelabels = \"l|f|r|b|u|d\", N.stereo = !1, N.stereoformat = \"TB\", N.stereolabels = \"1|2\", N.tiled = !1, N.tilesize = 0, N.tiledimagewidth = 0, N.tiledimageheight = 0, N.baseindex = 1, N.level = new bb, N.hfov = 0, N.vfov = 0, N.voffset = 0, N.hres = 0, N.vres = 0, N.haschanged = !1, va(N, \"frame\", 1), N.frames = 1);\n E();\n if (a && a.documentElement && _[22] == a.documentElement.nodeName)Ea(a.baseURI + _[21]); else {\n T.parsexml(a.childNodes, null, c);\n if (null != m._loadpanoscene_name) {\n var h = U(_[72] + m._loadpanoscene_name + \"]\");\n h && (g = _[124] + h.content + _[117], m.xml.url = \"\", m.xml.scene = m._loadpanoscene_name, m.xml.content = g, m.onstart = null, g = (new DOMParser).parseFromString(g, _[25]), T.resolvexmlincludes(g, function () {\n (a = T.xmlDoc) && a.documentElement && _[22] == a.documentElement.nodeName ? Ea(a.baseURI + _[21]) : (T.parsexml(a.childNodes, null, c), f = h.onstart)\n }));\n m._loadpanoscene_name = null\n }\n m.xmlversion = m.version;\n m.version = m.buildversion;\n D = f;\n Wd(d);\n k()\n }\n }\n\n function k() {\n var a, b, d = m.plugin.getArray();\n m.hotspot.getArray();\n var g;\n b = d.length;\n for (a = 0; a < b; a++) {\n var f = d[a];\n if (f && f.layer && f.layer.isArray) {\n var k = f.layer.getArray();\n g = k.length;\n for (b = 0; b < g; b++) {\n var n = k[b];\n n && (n.parent = f.name, n.keep = f.keep, xa.createItem(n.name, n))\n }\n f.plugin = null;\n f.layer = null;\n a--;\n b = d.length\n }\n }\n if (0 != e(!0)) {\n if (0 == K) {\n c & 32 && (p.hlookat = u[0], p.vlookat = u[1], p.camroll = u[2], p.fov = u[3], p.fovtype = u[4], p.fovmin = u[5], p.fovmax = u[6], p.maxpixelzoom = u[7], p.fisheye = u[8], p.fisheyefovlink = u[9], p.stereographic = u[10], p.pannini = u[12], p.architectural = u[13], p.architecturalonlymiddle = u[14]);\n Xa.updateview();\n fa && fa.removemainpano();\n for (a = 0; 4100 > a; a++);\n void 0 !== ja.hardwarelimit && (Lb = parseFloat(ja.hardwarelimit), isNaN(Lb) && (Lb = 0));\n void 0 !== ja.usedesktopimages && (ce = pa(ja.usedesktopimages));\n Cb = !0;\n sc.progress = 0;\n M = Oa.createPano(N);\n M.addToLayer(V.panolayer);\n 0 <= Db && (ad = !0, M.setblend(0), ub = !0, qc = 0)\n }\n da.busy = !1;\n da.actions_autorun(_[466], !0);\n a = m.onstart;\n D && (a = D, D = null);\n d = h.id;\n da.callaction(a, null, !0);\n if (d == h.id && (da.actions_autorun(_[467], !1), Ka(_[287]), m.xml && m.xml.scene && Ka(_[369]), d == h.id)) {\n 0 == K && x();\n a = Ua.getArray();\n d = a.length;\n for (f = 0; f < d; f++)(b = a[f]) && null == b.sprite && (b.create(), V.hotspotlayer.appendChild(b.sprite));\n e();\n Ka(_[63]);\n Xa.updateview();\n da.processactions()\n }\n }\n }\n\n function e(a) {\n var b = xa.getArray(), c = b.length, d, e = !0;\n for (d = 0; d < c; d++) {\n var g = b[d];\n if (g) {\n var f = !1;\n 1 == a ? 1 == g.preload && _[15] != g.type && 0 == g.loaded && (g.onloaded = k, g.altonloaded = null, f = !0, e = !1) : (1 == g.preload && (g.preload = !1, g.onloaded = null), f = !0);\n f && null == g.sprite && (g.create(), null == g._parent && V.pluginlayer.appendChild(g.sprite))\n }\n }\n return e\n }\n\n function w() {\n Ka(_[216])\n }\n\n function x() {\n var c = b.desktop || ce, d = !1, e = N.type, g = parseFloat(N.hfov), f = parseFloat(N.vfov), h = parseFloat(N.voffset);\n isNaN(g) && (g = 0);\n isNaN(f) && (f = 0);\n isNaN(h) && (h = 0);\n var k = !!(N.multires && N.level && 0 < N.level.count), n = !!N.mobile, l = !!N.tablet;\n c || 0 != k || !n && !l || (e = \"cube\", d = !0);\n if (null == e)if (N.left || N.cube)e = \"cube\"; else if (N.cubestrip)e = _[39]; else if (N.sphere)e = _[42]; else if (N.cylinder)e = _[24]; else if (N.flat)e = \"flat\"; else {\n if (n || l)e = \"cube\", d = !0\n } else e = F(e);\n var m = _[42] == e || _[24] == e, p = 0 < g && 1 >= g && 45 >= f && m || \"flat\" == e, u = \"cube\" == e || _[39] == e || null == e && 0 == m && 0 == p, c = !1, t = null;\n if (u)g = 360, f = 180; else if (m || p)if (t = ra.parsePath(U(_[487] + e + \".url\"))) {\n var G = 0;\n 0 <= (G = F(t).indexOf(_[478])) && (m = c = !0, k = p = !1, b.panovideosupport && (t = t.slice(G + 7)))\n }\n N.type = e;\n N.hfov = g;\n N.vfov = f;\n N.voffset = h;\n h = (\"\" + N.cubelabels).split(\"|\");\n 6 == h.length && (M.cubelabels = h);\n M.stereo = b.webgl ? N.stereo : !1;\n M.stereoformat = \"sbs\" == F(N.stereoformat) ? 0 : 1;\n h = (\"\" + N.stereolabels).split(\"|\");\n 2 == h.length && (M.stereolabels = h);\n G = F(U(_[294]));\n if (h = U(_[322])) {\n h = ra.parsePath(h);\n if (_[39] == G || \"null\" == G && u) {\n G = U(_[211]);\n if (null != G) {\n var G = F(G), x = [0, 1, 2, 3, 4, 5];\n x[G.indexOf(\"l\")] = 0;\n x[G.indexOf(\"f\")] = 1;\n x[G.indexOf(\"r\")] = 2;\n x[G.indexOf(\"b\")] = 3;\n x[G.indexOf(\"u\")] = 4;\n x[G.indexOf(\"d\")] = 5;\n G = x\n }\n M.addCubestripPreview(h, G)\n } else(\"flat\" == G || (\"null\" == G || _[42] == G || _[24] == G) && p) && M.addFlatLevel(h, g, f, 0, 0, 0, N.baseindex, !0);\n a(!1, !0)\n } else if (0 == G.indexOf(\"grid\")) {\n if (h = Gb(G))if (h = h[0], \"grid\" == h.cmd) {\n var P = h.args, h = void 0 == P[1] ? 64 : parseInt(P[1]), G = void 0 == P[2] ? 64 : parseInt(P[2]), x = void 0 == P[3] ? 512 : parseInt(P[3]), z = void 0 == P[4] ? 6710886 : parseInt(P[4]), y = void 0 == P[5] ? 2236962 : parseInt(P[5]), P = void 0 == P[6] ? void 0 == P[4] ? 16777215 : z : parseInt(P[6]), z = ca(z), y = ca(y), P = ca(P);\n M.addGridPreview(x, h, G, y, z, P);\n a(!1, !0);\n w()\n }\n } else w();\n h = !1;\n G = b.androidstock && !b.webgl;\n if (p || u) {\n if (d || u && G)l ? h = r(_[311]) : n && (h = r(_[313]));\n if (0 == h)if (\"cube\" == e) {\n if (k)if (n = N.level.getArray(), d = n.length, n.sort(function (a, b) {\n return +parseInt(a.tiledimagewidth, 10) - parseInt(b.tiledimagewidth, 10)\n }), 0 == b.multiressupport || G) {\n f = b.iphone && b.retina || b.tablet || b.android ? 1100 : b.iphone ? 512 : 2560;\n 0 < Lb && (f = Lb + 256);\n for (k = d - 1; 0 <= k && !(g = n[k].tiledimagewidth, g <= f); k--);\n 0 <= k && (h = r(_[54] + k + \"]\", !0))\n } else for (n.sort(function (a, b) {\n return +parseInt(a.tiledimagewidth, 10) - parseInt(b.tiledimagewidth, 10)\n }), k = 0; k < d; k++)if (n = _[54] + k + \"]\", l = U(n), f = v(n))n = l.tilesize ? l.tilesize : N.tilesize, g = parseInt(l.tiledimagewidth, 10), 0 < n && 0 < g && (M.addCubeLevel(f, g, n, N.baseindex), h = !0);\n 0 == h && (h = r(_[75]))\n } else if (_[39] == e && N.cubestrip)M.addCubestripPano(ra.parsePath(\"\" + N.cubestrip.url)), h = !0; else if ((_[42] == e || _[24] == e) && 1 >= g && 45 >= f || \"flat\" == e) {\n if (b.multiressupport && k)for (n = N.level.getArray(), d = n.length, n.sort(function (a, b) {\n return +parseInt(a.tiledimagewidth, 10) - parseInt(b.tiledimagewidth, 10)\n }), k = 0; k < d; k++)if (n = _[54] + k + \"]\", l = U(n), c = U(n + \".\" + e + \".url\"), c = ra.parsePath(c))n = l.tilesize ? l.tilesize : N.tilesize, t = parseInt(l.tiledimagewidth, 10), l = parseInt(l.tiledimageheight, 10), 0 < n && 0 < t && 0 < l && (M.addFlatLevel(c, g, f, t, l, n, N.baseindex, !1), h = !0);\n 0 == h && (d = N[e]) && d.url && (M.addFlatLevel(ra.parsePath(\"\" + d.url), g, f, 0, 0, 0, N.baseindex, !1), h = !0)\n }\n } else m && 0 == k && b.webgl && t && ((g = [Number(N.hfov), Number(N.vfov), Number(N.voffset)], c) ? b.panovideosupport && (f = xa.getItem(t)) && (f.renderToBitmap = !0, f.visible = !1, M.addRoundPano(e, null, g, f), h = !0) : (M.addRoundPano(e, t, g), h = !0));\n h && (Cb = $c = !0);\n M.finalize();\n 0 == h && null != e && la(2, _[171]);\n a(!1, !0)\n }\n\n function v(a) {\n var b = _[174].split(\" \"), c = Array(6), d, e;\n if (d = U(a + \".\" + b[6] + \".url\")) {\n if (d = ra.parsePath(d))for (e = 0; 6 > e; e++)c[e] = d.split(\"%s\").join(M.cubelabels[e])\n } else for (e = 0; 6 > e; e++)if (d = ra.parsePath(U(a + \".\" + b[e] + \".url\")))c[e] = d; else return null;\n return c\n }\n\n function r(a, b) {\n var c = v(a);\n if (!c)return !1;\n if (b) {\n var d = U(a), e = d.tilesize ? d.tilesize : N.tilesize, d = parseInt(d.tiledimagewidth, 10);\n M.addCubeLevel(c, d, e, N.baseindex)\n } else M.addCubeLevel(c, 0, 0, 1);\n return !0\n }\n\n function y(a) {\n 1 < a && (a = 1);\n 0 == b.webgl && (a *= a * a);\n a = 1 - a;\n 0 > a && (a = 0);\n return a\n }\n\n var l = Xa;\n l.loadpano = function (a, b, c, e, k) {\n h.count++;\n h.id = h.count;\n if (f())if (0 > F(c).indexOf(_[358]) && I(_[102], 0), \"null\" == F(a) && (a = null), m.xml.content = null, m.xml.scene = null, a) {\n da.busy = !0;\n null == ra.firstxmlpath ? ra.firstxmlpath = g(a) : a = ra.parsePath(a, !0);\n ra.currentxmlpath = g(a);\n m.xml.url = a;\n var l = h.id;\n ra.loadxml(a, function (d, g) {\n if (l == h.id) {\n if (d && d.childNodes) {\n var f = d.childNodes, m = f.length;\n 0 == m ? d = null : 2 == m && f[1] && _[22] == f[1].nodeName && (d = null)\n }\n d ? (d = T.resolvexmlencryption(d, a), null != d && T.resolvexmlincludes(d, function () {\n d = T.xmlDoc;\n n(d, b, c, e, k)\n })) : 200 == g ? Ea(a + _[21]) : Ea(a + _[181])\n }\n })\n } else m.xml.url = \"\", d(_[219], b, c, e, k)\n };\n l.loadxml = d;\n l.loadxmldoc = n;\n l.updateview = a;\n l.updateplugins = function (a) {\n var b = xa.getArray(), c = b.length, d;\n for (d = 0; d < c; d++) {\n var e = b[d];\n e && (a || e.poschanged) && e.loaded && e.updatepos()\n }\n };\n l.checkautorotate = function (a) {\n var b = Ta();\n a && (Kb = b);\n Kb > cb && (cb = Kb);\n a = b - cb;\n a > 1E3 * m.idletime && cb != Hd && (Hd = cb, Ka(_[492]));\n a = b - Kb;\n if (za.enabled && a > 1E3 * za.waittime) {\n cb = Kb = 0;\n var c = p._hlookat;\n a = p._vlookat;\n var b = p._fov, d = Math.tan(Math.min(.5 * b, 45) * Y), e = za.accel, g = za.speed, f = za.currentmovingspeed, e = e / 60, g = g / 60;\n 0 < g ? (f += e * e, f > g && (f = g)) : (f -= e * e, f < g && (f = g));\n za.currentmovingspeed = f;\n c += d * f;\n d = Math.abs(d * f);\n p._hlookat = c;\n c = parseFloat(za.horizon);\n isNaN(c) || (c = (c - a) / 60, e = Math.abs(c), 0 < e && (e > d && (c = d * c / e), a += c, p._vlookat = a));\n a = parseFloat(za.tofov);\n isNaN(a) || (a < p.fovmin && (a = p.fovmin), a > p.fovmax && (a = p.fovmax), a = (a - b) / 60, c = Math.abs(a), 0 < c && (c > d && (a = d * a / c), b += a, p._fov = b));\n return !0\n }\n za.currentmovingspeed = 0;\n return !1\n };\n l.previewdone = w;\n l.havepanosize = function (a) {\n M && M.id == a.id && (N.hfov = a.hfov, N.vfov = a.vfov, N.hres = a.hres, N.vres = a.vres, Ka(_[405]), p.haschanged = !0)\n };\n l.removeelements = E;\n l.isLoading = function () {\n return Cb\n };\n l.isBlending = function () {\n return ad || Wa\n };\n var u = [], h = {count: 0, id: 0}, c = 0, K = !1, D = null, z = null;\n l.checkHovering = function () {\n if (1 != (jc & 1) && !da.blocked) {\n var a = [xa.getArray(), Ua.getArray()], b, c, d, e, g;\n for (g = 0; 2 > g; g++)for (b = a[g], d = b.length, e = 0; e < d; e++)(c = b[e]) && c._visible && c.hovering && c.onhover && da.callaction(c.onhover, c)\n }\n };\n l.handleloading = function () {\n var a = !1;\n 0 == Wa && (fa && (a |= fa.doloading()), M && (a |= M.doloading()));\n Cb = M && M.isloading();\n var b = Oa.handleloading();\n $c && 1 != Cb && ($c = !1, Ka(_[265]));\n b & 1 && (Cb = !0);\n b & 2 && (a = !0);\n M && (fa || z) && (0 == Wa ? M.previewcheck() && (Wa = !0, Eb = -1) : (a = 0, 0 <= Db && (-1 == Eb ? Eb = Ta() : (a = (Ta() - Eb) / 1E3, a = 0 < Db ? a / Db : 1), a = y(a), ad = !0, M.setblend(1 - a), ub = !0, qc = 1 - a), 0 == a && (Db = 0, fa && (fa.destroy(), fa = null), ad = Wa = !1), a = !0));\n return a\n }\n })();\n var Oa = {};\n (function () {\n var a, d;\n\n function E(a) {\n if (!1 === document.hidden && ka) {\n var b = parseInt(ka.style.height);\n 0 < b && (ka.style.height = b + 1 + \"px\", setTimeout(function () {\n ka && parseInt(ka.style.height) == b + 1 && (ka.style.height = b + \"px\")\n }, 100))\n }\n }\n\n function f(a) {\n return \"#ifdef GL_ES\\n#ifdef GL_FRAGMENT_PRECISION_HIGH\\nprecision highp float;\\n#else\\nprecision mediump float;\\n#endif\\n#endif\\nuniform float aa;uniform sampler2D sm;varying vec2 tt;void main(){vec4 c=texture2D(sm,vec2(tt.s,tt.t)\" + (a ? \",-1.0\" : \"\") + \");gl_FragColor=vec4(c.rgb,c.a*aa);}\"\n }\n\n function g(a, b, c) {\n var d = ua;\n null == a && (a = \"attribute vec2 vx;varying vec2 tx;void main(){gl_Position=vec4(vx.x*2.0-1.0,-1.0+vx.y*2.0,0.0,1.0);tx=vx;}\");\n var e = d.createShader(d.VERTEX_SHADER);\n d.shaderSource(e, a);\n d.compileShader(e);\n if (!d.getShaderParameter(e, d.COMPILE_STATUS))return la(0, _[185] + d.getShaderInfoLog(e)), null;\n a = d.createShader(d.FRAGMENT_SHADER);\n d.shaderSource(a, b);\n d.compileShader(a);\n if (!d.getShaderParameter(a, d.COMPILE_STATUS))return la(0, _[186] + d.getShaderInfoLog(a)), null;\n b = d.createProgram();\n d.attachShader(b, e);\n d.attachShader(b, a);\n d.linkProgram(b);\n if (!d.getProgramParameter(b, d.LINK_STATUS))return la(0, _[162]), null;\n d.useProgram(b);\n d.uniform1i(d.getUniformLocation(b, \"sm\"), 0);\n e = d.getAttribLocation(b, \"vx\");\n d.enableVertexAttribArray(e);\n e = {prg: b, vxp: e};\n c = c.split(\",\");\n var g, f;\n g = c.length;\n for (a = 0; a < g; a++)f = c[a], e[f] = d.getUniformLocation(b, f);\n return e\n }\n\n function n(a) {\n var b = ua;\n a ? (ob = Cb, Cb = a) : (a = Cb = ob, ob = null);\n a && b.useProgram(a)\n }\n\n function k() {\n var c = ua;\n try {\n var e = c.createBuffer();\n c.bindBuffer(lb, e);\n c.bufferData(lb, new Float32Array([0, 0, 0, 1, 1, 1, 1, 0]), wc);\n var h = c.createBuffer();\n c.bindBuffer(Qb, h);\n c.bufferData(Qb, new Uint16Array([0, 1, 2, 0, 2, 3]), wc);\n a = e;\n d = h;\n var k;\n for (k = 0; 6 > k; k++) {\n var e = _[159], t = h = \"\", l = \"\";\n 0 == k ? t = _[168] : 1 == k ? (l = \"cc\", h = _[88], t = _[158]) : 2 == k ? (l = \"cc\", h = _[88], t = _[153]) : 3 == k ? (l = \"ct,zf\", h = _[176], t = _[152]) : 4 == k ? (l = \"fp,bl\", h = _[175], t = \"float t=(tx.x*fp.x+tx.y*fp.y+fp.z)*(1.0-2.0*bl)+bl;gl_FragColor=vec4(texture2D(sm,tx).rgb,smoothstep(t-bl,t+bl,aa));\") : 5 == k && (l = _[439], h = _[163], t = \"float t=(1.0-sqrt(2.0)*sqrt((ap.x*(tx.x-0.5)*(tx.x-0.5)+ap.y*(tx.y-0.5)*(tx.y-0.5))/(0.5*(ap.x+ap.y))))*(1.0-2.0*bl)+bl;gl_FragColor=vec4(texture2D(sm,(tx-vec2(0.5,0.5))*mix(1.0,aa,zf)+vec2(0.5,0.5)).rgb,smoothstep(t-bl,t+bl,aa));\");\n e = _[187] + e + h + \"void main(){\" + t + \"}\";\n ha[k] = g(null, e, \"aa,\" + l);\n if (null == ha[k])return !1\n }\n var m = c.createShader(c.VERTEX_SHADER);\n c.shaderSource(m, \"attribute vec3 vx;attribute vec2 tx;uniform float sh;uniform float ch;uniform mat4 mx;uniform mat4 ot;uniform mat3 tm;varying vec2 tt;void main(){vec3 vr=vec3(ot*vec4(vx,1));vec3 vs=1000.0*normalize(vr);vec2 c2=vec2(vr.x,vr.z);c2=c2/max(1.0,length(c2));vec3 vc=1000.0*vec3(c2.x,clamp(vr.y*inversesqrt(1.0+vr.x*vr.x+vr.z*vr.z),-30.0,+30.0),c2.y);vec3 vv=vr*(1.0-sh)+sh*(vs*(1.0-ch)+vc*ch);gl_Position=mx*vec4(vv,1);tt=(vec3(tx,1)*tm).xy;}\");\n c.compileShader(m);\n if (!c.getShaderParameter(m, c.COMPILE_STATUS))return !1;\n var q = c.createShader(c.FRAGMENT_SHADER);\n c.shaderSource(q, f(!0));\n c.compileShader(q);\n if (!c.getShaderParameter(q, c.COMPILE_STATUS))if (b.ie) {\n if (c.shaderSource(q, f(!1)), c.compileShader(q), !c.getShaderParameter(q, c.COMPILE_STATUS))return !1\n } else return !1;\n var p = c.createProgram();\n c.attachShader(p, m);\n c.attachShader(p, q);\n c.linkProgram(p);\n if (!c.getProgramParameter(p, c.LINK_STATUS))return !1;\n n(p);\n Pa = c.getAttribLocation(p, \"vx\");\n Ra = c.getAttribLocation(p, \"tx\");\n Ya = c.getUniformLocation(p, \"sh\");\n Za = c.getUniformLocation(p, \"ch\");\n bb = c.getUniformLocation(p, \"aa\");\n pb = c.getUniformLocation(p, \"sm\");\n jb = c.getUniformLocation(p, \"mx\");\n Bb = c.getUniformLocation(p, \"ot\");\n vb = c.getUniformLocation(p, \"tm\");\n c.enableVertexAttribArray(Pa);\n c.enableVertexAttribArray(Ra);\n Ia.sh = p;\n Ia.vs = m;\n Ia.ps = q\n } catch (G) {\n return la(0, _[288] + G), !1\n }\n return !0\n }\n\n function e(a) {\n if (a) {\n var b = ua;\n b.deleteBuffer(a.vx);\n b.deleteBuffer(a.tx);\n b.deleteBuffer(a.ix);\n a.vx = null;\n a.tx = null;\n a.ix = null;\n a.vxd = null;\n a.txd = null;\n a.ixd = null;\n a.tcnt = 0\n }\n }\n\n function w(a, b, c, d) {\n this.tcnt = a;\n this.vxd = b;\n this.txd = c;\n this.ixd = d;\n this.ix = this.tx = this.vx = null\n }\n\n function x(a) {\n var b = ua;\n b.bindBuffer(lb, a.vx = b.createBuffer());\n b.bufferData(lb, a.vxd, wc);\n b.bindBuffer(lb, a.tx = b.createBuffer());\n b.bufferData(lb, a.txd, wc);\n b.bindBuffer(Qb, a.ix = b.createBuffer());\n b.bufferData(Qb, a.ixd, wc)\n }\n\n function v(a, b) {\n var c, d = 2 * (b + 1) * (b + 1);\n c = 6 * b * b;\n var e = new Float32Array(3 * (b + 1) * (b + 1)), g = new Float32Array(d), f = new Uint16Array(c);\n if (isNaN(b) || 0 >= b)b = 1;\n var h, k, t, n, l;\n a *= 2;\n for (k = c = d = 0; k <= b; k++)for (h = 0; h <= b; h++)t = h / b, n = k / b, g[d] = t, g[d + 1] = n, d += 2, e[c] = a * (t - .5), e[c + 1] = a * (n - .5), e[c + 2] = 0, c += 3;\n for (k = c = 0; k < b; k++)for (h = 0; h < b; h++)d = h + k * (b + 1), t = d + 1, n = d + (b + 1), l = n + 1, f[c] = d, f[c + 1] = t, f[c + 2] = n, f[c + 3] = t, f[c + 4] = l, f[c + 5] = n, c += 6;\n return new w(6 * b * b, e, g, f)\n }\n\n function r(a) {\n var c = ua;\n null == a && (a = {\n have: !1,\n fb: null,\n tex: null,\n w: 0,\n h: 0,\n alpha: 1,\n havepano: -1,\n drawcalls: 0\n }, a.fb = c.createFramebuffer(), a.tex = c.createTexture(), c.bindTexture(ma, a.tex), c.texParameteri(ma, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE), c.texParameteri(ma, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE), c.texParameteri(ma, c.TEXTURE_MAG_FILTER, qb), c.texParameteri(ma, c.TEXTURE_MIN_FILTER, qb));\n var d = b.gl.width * xa + .5 | 0, e = b.gl.height * xa + .5 | 0;\n if (a.w != d || a.h != e)a.w = d, a.h = e, c.bindTexture(ma, a.tex), c.texImage2D(ma, 0, mb, d, e, 0, mb, Nc, null), c.bindFramebuffer(Ab, a.fb), c.framebufferTexture2D(Ab, c.COLOR_ATTACHMENT0, ma, a.tex, 0), c.bindTexture(ma, null), c.bindFramebuffer(Ab, null);\n return a\n }\n\n function y(c, e, g) {\n var f = ua;\n if (0 >= c.drawcalls || null == e)return !1;\n var h = b.gl.width * xa + .5 | 0, k = b.gl.height * xa + .5 | 0;\n if (0 < h && 0 < k)return n(e.prg), f.viewport(0, 0, h, k), e.aa && (Aa && (g = 1 - Aa(1 - g, 0, 1), 0 > g ? g = 0 : 1 < g && (g = 1)), f.uniform1f(e.aa, g)), e.sz && f.uniform2f(e.sz, h, k), f.bindBuffer(lb, a), f.vertexAttribPointer(e.vxp, 2, Oc, !1, 0, 0), f.bindBuffer(Qb, d), f.activeTexture(Mc), f.bindTexture(ma, c.tex), f.drawElements(Kb, 6, Gb, 0), R++, !0\n }\n\n function l(a, b, c, d, e, g) {\n var f = !1;\n 0 == d && (b = c = d = 1024, Da = f = !0);\n this.type = 0;\n this.stereo = g;\n this.preview = !1;\n this.needsize = f;\n this.w = b;\n this.h = c;\n this.mp = b * c * a >> 20;\n this.tilesize = d;\n this.htiles = (b + d - 1) / d | 0;\n this.vtiles = (c + d - 1) / d | 0;\n this.loadedtiles = [0, 0];\n this.addedtiles = [0, 0];\n this.totaltiles = a * this.htiles * this.vtiles;\n this.i = e;\n this.planeurls = Array(a);\n this.planemapping = 6 == a ? [0, 1, 2, 3, 4, 5] : [1];\n this.invplanemapping = 6 == a ? [0, 1, 2, 3, 4, 5] : [0, 0, 0, 0, 0, 0];\n this.completelyadded = this.complete = !1;\n this.vfov = this.hfov = 90;\n this.voffset = this.hoffset = 0;\n this.vscale = 1\n }\n\n function u(a, b) {\n return a.preview ? -1 : b.preview ? 1 : a.w - b.w\n }\n\n function h(a, b, d, e, g, f, h) {\n f = 0 < f ? e * h / f : 1;\n 0 >= e && (e = 1);\n 0 >= g && (g = f);\n f = g / f;\n b.hfov = e;\n b.vfov = g;\n b.hoffset = 0;\n b.voffset = e / 2 - g / f / 2;\n b.vscale = 1;\n h = a.levels;\n d && h.push(b);\n h.sort(u);\n b = h.length - 1;\n for (d = g = 0; d <= b; d++)h[d].needsize || (g = h[d].vfov);\n if (0 < g) {\n for (d = 0; d <= b; d++)h[d].needsize || (h[d].vscale = g / h[d].vfov * f);\n a.fovlimits = [-e / 2, +e / 2, -g / 2, +g / 2]\n }\n c(a)\n }\n\n function c(a) {\n var b = null, c = 0 == a.type, d = c || null != a.fovlimits, e = a.levels;\n if (e) {\n var g = e.length;\n 0 < g && (e = e[g - 1], 0 == e.preview && 0 == e.needsize && d && (b = e))\n }\n b && a.done && 0 == a.ready && (a.ready = !0, a.hfov = c ? 360 : b.hfov, a.vfov = c ? 180 : b.vfov, a.hres = b.w, a.vres = b.h, Xa.havepanosize(a))\n }\n\n function K() {\n this.h = this.w = 0;\n this.imgfov = null;\n this.loading = !0;\n this.texture = this.obj = null;\n this.texvalid = !1;\n this.mx = Ma()\n }\n\n function D() {\n this.layer = null;\n this.tiles = [];\n this.mx = this.texture = this.csobj = this.csobj0 = null\n }\n\n function z(a) {\n function d(a, b, c, e) {\n f(a);\n if (0 == a.type) {\n var g = ua;\n c || (c = [0, 1, 2, 3, 4, 5]);\n var h, k, t, n;\n if (b) {\n h = b.naturalWidth;\n k = b.naturalHeight;\n n = 1;\n if (3 * h == 2 * k)t = h / 2; else if (2 * h == 3 * k)t = h / 3; else if (1 * h == 6 * k)t = h / 6; else if (6 * h == 1 * k)t = h / 1; else {\n 0 == a.type && la(2, _[247] + b.src + _[190]);\n return\n }\n h /= t;\n k /= t\n } else e && (t = e.width, n = 0, h = 1, k = 6, b = e);\n e = Sa ? 0 : G;\n var m = t, p = new D, zf = new l(6, m, m, m, 1, !1), r, u, w, v = [2, 0, 3, 1, 4, 5];\n 0 == Sa && (r = Ja(), r.style.position = _[0], r.style.pointerEvents = \"none\", p.layer = r);\n p.tiles = Array(6);\n for (u = 0; u < k; u++)for (r = 0; r < h; r++) {\n var x = c[u * h + r], P = new q(\"prev\" + a.id + \"s\" + Yb[x], 0, x, 0, 0, zf, \"\", a);\n w = v[x];\n var B = 1 == x || 3 == x ? e : 0, z = 3 >= x ? e : 0, y = Ja(2);\n y.width = m + 2 * B;\n y.height = m + 2 * z;\n y.style.position = _[0];\n y.style[Zc] = \"0 0\";\n var E = y.getContext(\"2d\");\n E && (0 < z && (E.drawImage(b, n * r * t, n * u * t, t, 1, B, 0, t, z), E.drawImage(b, n * r * t, n * u * t + t - 1, t, 1, B, m + z, t, z)), 0 < B && (E.drawImage(b, n * r * t + 0, n * u * t + 0, 1, t, 0, B, B, t), E.drawImage(b, n * r * t + t - 1, n * u * t + 0, 1, t, m + B, B, B, t)), E.drawImage(b, n * r * t, n * u * t, t, t, B, z, m, m), Ba && E.getImageData(m >> 1, m >> 1, 1, 1));\n P.canvas = y;\n 0 == Sa ? (P.elmt = y, y = -m / 2, P.transform = Fb[x] + _[53] + (y - B) + \"px,\" + (y - z) + \"px,\" + y + \"px) \") : (J(P, m, m), x = g.createTexture(), g.activeTexture(Mc), g.bindTexture(ma, x), g.texParameteri(ma, g.TEXTURE_WRAP_T, g.CLAMP_TO_EDGE), g.texParameteri(ma, g.TEXTURE_WRAP_S, g.CLAMP_TO_EDGE), g.texParameteri(ma, g.TEXTURE_MAG_FILTER, qb), g.texParameteri(ma, g.TEXTURE_MIN_FILTER, qb), g.texImage2D(ma, 0, cc, cc, Nc, y), g.bindTexture(ma, null), P.texture = x, P.mem = 0);\n P.state = 2;\n p.tiles[w] = P\n }\n Da = !0;\n a.cspreview = p\n }\n }\n\n function e(a, b) {\n t.imagefov = b;\n var c = a.rppano, d = c.w, g = c.h;\n a.stereo && (0 == a.stereoformat ? d >>= 1 : g >>= 1);\n var f = b[0], h = b[1], k = b[2];\n 0 >= f && (f = 360);\n if (0 >= h) {\n var h = f, n = d, l = g, m = 180, m = 4 == a.type ? 2 * Math.atan(h / 2 * (l / n) * Y) / Y : h * l / n;\n 180 < m && (m = 180);\n h = m\n }\n a.hfov = f;\n a.vfov = h;\n a.hres = d;\n a.vres = g;\n c.imgfov = [f, h, k];\n c = -h / 2 + k;\n d = +h / 2 + k;\n 4 == a.type && (d = Math.tan(.5 * h * Y), k = Math.sin(k * Y), c = Math.atan(-d + k) / Y, d = Math.atan(+d + k) / Y);\n a.fovlimits = [-f / 2, +f / 2, c, d]\n }\n\n function g(a, c, d, e) {\n c = ua;\n var f = a.rppano, h = c.createTexture();\n c.activeTexture(Mc);\n c.bindTexture(ma, h);\n c.texParameteri(ma, c.TEXTURE_WRAP_T, c.CLAMP_TO_EDGE);\n c.texParameteri(ma, c.TEXTURE_WRAP_S, c.CLAMP_TO_EDGE);\n c.texParameteri(ma, c.TEXTURE_MAG_FILTER, qb);\n c.texParameteri(ma, c.TEXTURE_MIN_FILTER, qb);\n if (d) {\n var t;\n e = d.naturalWidth;\n t = d.naturalHeight;\n f.w = e;\n f.h = t;\n var k = !1, n = !1, l = Q(e) << 1 | Q(t), n = b.opera ? \"\" : F(ja.mipmapping);\n if (n = \"force\" == n || \"auto\" == n && 3 == l)0 == (l & 2) && (k = !0, e = A(e)), 0 == (l & 1) && (k = !0, t = A(t)), c.texParameteri(ma, c.TEXTURE_MIN_FILTER, c.LINEAR_MIPMAP_LINEAR);\n e > ga && (k = !0, e = ga);\n t > ga && (k = !0, t = ga);\n if (k) {\n k = Ja(2);\n k.width = e;\n k.height = t;\n l = k.getContext(\"2d\");\n l.drawImage(d, 0, 0, e, t);\n if (b.ios) {\n var m;\n m = t;\n for (var p = l.getImageData(0, 0, 1, m).data, q = 0, r = m, G = m; G > q;)0 == p[4 * (G - 1) + 3] ? r = G : q = G, G = r + q >> 1;\n m = G / m;\n 0 < m && 1 > m && l.drawImage(d, 0, 0, e, t / m)\n }\n c.texImage2D(ma, 0, cc, cc, Nc, k)\n } else c.texImage2D(ma, 0, cc, cc, Nc, d);\n n && c.generateMipmap(ma);\n f.texvalid = !0\n } else e && (f.videoplugin = e, f.videoready = !1);\n c.bindTexture(ma, null);\n f.texture = h;\n a.rppano = f;\n Da = !0\n }\n\n function f(a) {\n var b = ua, c = a.cspreview;\n if (c)if (a.cspreview = null, b)for (a = 0; 6 > a; a++) {\n var d = c.tiles[a], e = d.texture;\n e && (b.deleteTexture(e), d.texture = null)\n } else a.previewadded && (a.layer.removeChild(c.layer), a.previewadded = !1)\n }\n\n var k = ++X, t = this;\n t.id = k;\n t.image = a;\n t.panoview = null;\n t.type = 0;\n t.cubelabels = _[519].split(\"\");\n t.stereo = !1;\n t.stereoformat = 0;\n t.stereolabels = [\"1\", \"2\"];\n t.done = !1;\n t.ready = !1;\n t.fovlimits = null;\n t.hfov = 0;\n t.vfov = 0;\n t.hres = 0;\n t.vres = 0;\n t.levels = [];\n t.frame = 0;\n t.currentlevel = -1;\n t.viewloaded = !1;\n t.stopped = !1;\n t.suspended = !1;\n t.suspended_h = 0;\n t.alpha = 1;\n t.cspreview = null;\n t.rppano = null;\n t.previewadded = !1;\n t.previewloading = !1;\n t.addToLayer = function (a) {\n if (0 == Sa) {\n var b = Ja(), c = b.style;\n c.position = _[0];\n c.left = 0;\n c.top = 0;\n t.layer = b;\n a.appendChild(b)\n }\n };\n t.addGridPreview = function (a, c, e, g, f, h) {\n a += 1;\n var k = b.desktop ? 1023 : b.tablet || b.webgl ? 511 : 255, n = a < k ? a : k, l = Ja(2);\n l.width = n;\n l.height = n;\n k = n / a;\n e *= k;\n c *= k;\n k = l.getContext(\"2d\");\n k.fillStyle = g;\n k.fillRect(0, 0, n, n);\n k.fillStyle = f;\n for (g = 0; g < a; g += e)k.fillRect(0, g, a, 1);\n for (g = 0; g < a; g += c)k.fillRect(g, 0, 1, a);\n if (h != f)for (k.fillStyle = h, f = 0; f < a; f += e)for (g = 0; g < a; g += c)k.fillRect(g, f, 1, 1);\n setTimeout(function () {\n d(t, null, null, l)\n }, 10)\n };\n t.addCubestripPreview = function (a, b) {\n t.previewloading = !0;\n ra.loadimage(a, function (a) {\n d(t, a, b);\n t.previewloading = !1;\n Xa.previewdone()\n }, function (b) {\n la(3, _[58] + a + _[62]);\n t.previewloading = !1\n })\n };\n t.addCubestripPano = function (a) {\n ra.loadimage(a, function (a) {\n d(t, a, null)\n }, function (b) {\n la(3, _[58] + a + _[62])\n })\n };\n t.addCubeLevel = function (a, b, d, e) {\n b = new l(6, b, b, d, e, t.stereo);\n b.planeurls[0] = a[0];\n b.planeurls[1] = a[1];\n b.planeurls[2] = a[2];\n b.planeurls[3] = a[3];\n b.planeurls[4] = a[4];\n b.planeurls[5] = a[5];\n a = t.levels;\n a.push(b);\n a.sort(u);\n c(t)\n };\n t.addFlatLevel = function (a, b, c, d, e, g, f, k) {\n t.type = 1;\n g = new l(1, d, e, g, f, t.stereo);\n g.planeurls[0] = a;\n g.type = 1;\n g.preview = k;\n h(t, g, !0, b, c, d, e)\n };\n t.addRoundPano = function (a, b, c, d) {\n _[24] == F(a) ? t.type = 4 : t.type = 3;\n t.rppano = new K;\n if (d) {\n if (t.updateFOV = e, g(t, a, null, d), d._panoid = t.id, t.imagefov = c, d.onvideoreadyCB = function () {\n var a = t.rppano;\n a.w = d.videowidth;\n a.h = d.videoheight;\n e(t, t.imagefov);\n p.updateView();\n Xa.havepanosize(t);\n t.ready = !0;\n t.rppano.loading = !1;\n a.videoready = !0\n }, d.havevideosize)d.onvideoreadyCB()\n } else b && ra.loadimage(b, function (b) {\n g(t, a, b);\n e(t, c);\n p.updateView();\n Xa.havepanosize(t);\n t.rppano.loading = !1\n })\n };\n t.finalize = function () {\n t.done = !0;\n c(t)\n };\n t.setblend = function (a) {\n Sa ? t.alpha = a : t.layer && (t.layer.style.opacity = a)\n };\n t.removemainpano = function () {\n };\n t.stop = function () {\n t.stopped = !0\n };\n t.destroy = function () {\n var a = ua;\n f(t);\n if (a) {\n var b = t.rppano;\n if (b) {\n var c = b.texture;\n c && a.deleteTexture(c);\n b.texture = null\n }\n }\n for (var d in ab)(b = ab[d]) && b.pano === t && ea(b);\n a || (t.layer.parentNode.removeChild(t.layer), t.layer = null)\n };\n t.previewcheck = function () {\n var a = t.rppano;\n return a && a.videoplugin ? a.texvalid : t.previewloading || 0 == t.type && null == t.cspreview && 0 < t.levels.length && !t.viewloaded ? !1 : !0\n };\n t.doloading = function () {\n return !1\n };\n t.isloading = function () {\n if (t.previewloading)return !0;\n var a = t.levels, b = a.length;\n if (0 < b) {\n if (0 == t.type && (b = a[0].preview && 1 < b ? 1 : 0, 9 > a[b].mp && !a[b].complete) || !t.viewloaded)return !0\n } else if (a = t.rppano)return a.videoplugin ? a.texvalid : a.loading;\n return !1\n }\n }\n\n function q(a, b, c, d, e, g, f, h) {\n this.id = a;\n this.pano = h;\n this.cubeside = c;\n this.stereo = f;\n this.levelindex = b;\n this.level = g;\n this.h = d;\n this.v = e;\n this.draworder = g ? Yb[c] * g.htiles * g.vtiles + e * g.htiles + d : Yb[c];\n this.url = null;\n this.sh = this.ch = this.sv = 0;\n this.mx = this.texture = this.canvas = this.image = this.elmt = null;\n this.lastusage_on_frame = this.mem = this.retries = this.state = 0;\n this.overlap = this.transform = null;\n g && (a = 2 * ((d + .5) / g.htiles - .5), e = 2 * ((e + .5) / g.vtiles - .5), a += .5 / g.htiles, e += .5 / g.vtiles, 1 == h.type && (a *= Math.tan(.5 * g.hfov * Y), e *= Math.tan(.5 * g.vfov * Y)), 0 == c ? (c = 1, g = e, h = -a) : 1 == c ? (c = -a, g = e, h = -1) : 2 == c ? (c = -1, g = e, h = a) : 3 == c ? (c = a, g = e, h = 1) : 4 == c ? (c = -a, h = -e, g = -1) : (c = -a, h = e, g = 1), a = -Math.atan2(c, h), e = -Math.atan2(-g, Math.sqrt(c * c + h * h)), this.sv = Math.sin(e), e = Math.cos(e), this.ch = Math.cos(a) * e, this.sh = Math.sin(a) * e)\n }\n\n function J(a, b, c) {\n var d = Jc[a.cubeside], e = a.level, g = e.w / 2, f = e.tilesize, h = 1E3 / g, k = 1, t = e.vscale;\n 1 == e.type && (k = Math.tan(.5 * e.hfov * Y));\n var n = (-g + a.h * f + b / 2 + 2 * e.hoffset * g / 90) * h * k, e = (-g + a.v * f + c / 2 + 2 * e.voffset * g / e.hfov) * h * k * t, g = g * h;\n Hc(rd, b / 1E3 * k, 0, 0, 0, c / 1E3 * k * t, 0, 0, 0, 1);\n ye(Zb, n, e, g);\n Ic(rd, Zb);\n b = Zb;\n k = d[1];\n t = -d[0] * Y;\n d = Math.cos(t);\n c = Math.sin(t);\n t = -k * Y;\n k = Math.cos(t);\n t = Math.sin(t);\n Hc(b, k, 0, -t, c * t, d, c * k, d * t, -c, d * k);\n Ic(rd, Zb);\n d = Ma();\n Hc(d, h, 0, 0, 0, h, 0, 0, 0, h);\n Ic(d, rd);\n a.mx = d\n }\n\n function C(a, b, c, d, e, g) {\n var f = [], h = a.length, k, t = !1, n = 0, l;\n for (k = 0; k < h; k++) {\n var m = a.charAt(k), p = m.charCodeAt(0);\n if (37 == p)t = !0, n = 0; else if (48 == p)t ? n++ : f.push(m); else if (t) {\n t = !1;\n l = null;\n 65 <= p && 84 >= p && (p += 32);\n if (108 == p)l = c; else if (115 == p)l = b; else if (116 == p)l = g; else if (117 == p || 120 == p || 99 == p || 104 == p)l = d; else if (118 == p || 121 == p || 114 == p)l = e;\n if (null != l) {\n for (; l.length <= n;)l = \"0\" + l;\n f.push(l)\n } else f.push(\"%\" + m)\n } else t = !1, f.push(m)\n }\n return f.join(\"\")\n }\n\n function Q(a) {\n return 0 == (a & a - 1)\n }\n\n function A(a) {\n a--;\n a |= a >> 1;\n a |= a >> 2;\n a |= a >> 4;\n a |= a >> 8;\n a |= a >> 16;\n a++;\n return a\n }\n\n function H(a, b, c, d, e, g) {\n if (0 < g)setTimeout(function () {\n try {\n H(null, b, c, d, e, 0)\n } catch (a) {\n }\n }, g); else {\n null == a && (a = b.getContext(\"2d\"));\n g = e[0];\n var f = e[1], h = e[2], k = e[3];\n 0 < g && a.drawImage(c, 0, 0, 1, d[1], 0, f, g, d[3]);\n 0 < f && a.drawImage(c, 0, 0, d[0], 1, g, 0, d[2], f);\n 0 < h && a.drawImage(c, d[0] - 1, 0, 1, d[1], g + d[2], f, h, d[3]);\n 0 < k && a.drawImage(c, 0, d[1] - 1, d[0], 1, g, f + d[3], d[2], k)\n }\n }\n\n function qa(a) {\n function d() {\n if (0 < I)Da = !0, setTimeout(d, 0); else if (aa--, null != g && null != g.naturalWidth) {\n var e = g.naturalWidth, f = g.naturalHeight, k = e * f * 4, t = !1;\n 0 == k && (t = !0);\n if (t)a.state = 0, Da = !0; else {\n var n = a.level;\n if (n) {\n n.needsize && (n.w = e, n.h = f, n.tilesize = e > f ? e : f, n.needsize = !1, 1 == n.type ? h(a.pano, n, !1, N.hfov, N.vfov, e, f) : c(a.pano), n.preview && Xa.previewdone());\n n.loadedtiles[a.stereo - 1]++;\n n.complete = n.stereo && ja.stereo ? n.loadedtiles[0] == n.totaltiles && n.loadedtiles[1] == n.totaltiles : n.loadedtiles[0] == n.totaltiles;\n t = 1 == n.htiles * n.vtiles;\n a.state = 2;\n a.lastusage_on_frame = M;\n if (Sa) {\n J(a, e, f);\n var l = ua, m = b.opera ? \"\" : F(ja.mipmapping), p = \"force\" == m;\n if (m = p || \"auto\" == m) {\n if (!Q(e) || !Q(f)) {\n m = 1024;\n t ? (m = 0, p && (m = ga)) : p || Q(n.tilesize) || (m = 0);\n var t = A(e), q = A(f);\n t < m && q < m && (n = Ja(2), n.width = t, n.height = q, m = n.getContext(\"2d\"), m.drawImage(g, 0, 0, t, q), g = n, e = t, f = q)\n }\n m = Q(e) && Q(f)\n }\n m && 0 == p && !b.realDesktop && a.level && 2500 < a.level.h && (m = !1);\n e = l.createTexture();\n l.activeTexture(Mc);\n l.bindTexture(ma, e);\n l.texParameteri(ma, l.TEXTURE_WRAP_T, l.CLAMP_TO_EDGE);\n l.texParameteri(ma, l.TEXTURE_WRAP_S, l.CLAMP_TO_EDGE);\n l.texParameteri(ma, l.TEXTURE_MAG_FILTER, qb);\n l.texParameteri(ma, l.TEXTURE_MIN_FILTER, m ? l.LINEAR_MIPMAP_LINEAR : qb);\n l.texImage2D(ma, 0, cc, cc, Nc, g);\n m && l.generateMipmap(ma);\n l.bindTexture(ma, null);\n a.texture = e;\n a.image = g = null\n } else {\n l = [e, f, e, f];\n p = !1;\n e == f && 1 == n.htiles && (m = ja.hardwarelimit, e + 2 * G > m && (n.w = n.h = l[2] = l[3] = e = f = m - 2 * G, p = !0));\n var r = [0, 0, 0, 0], u = G, w = a.h, v = a.v, n = a.cubeside, x = a.level, P = x.tilesize, m = x.vscale, B = -x.w / 2, y = q = 1;\n 1 == x.type && (q = Math.tan(.5 * x.hfov * Y), n = 6, 2 < u && (u = 2), b.ie || b.desktop && b.safari) && (y = 252);\n 1E3 < -B && 4 < u && (u = 4);\n var z = B, D = z;\n r[2] = u;\n r[3] = u;\n 0 == n || 2 == n ? 0 == w && (r[0] = u) : 1 != n && 3 != n || w != x.vtiles - 1 || (r[2] = 0);\n 0 <= n && 3 >= n ? 0 == v && (r[1] = u) : (w == x.htiles - 1 && (r[2] = 0), v == x.vtiles - 1 && (r[3] = 0));\n a.overlap = r;\n z -= r[0];\n D -= r[1];\n r = (z + w * P) * q;\n v = (D + v * P - 2 * x.voffset * B / x.hfov) * q * m;\n x = q;\n P = q * m;\n 1 < y && (r *= y, v *= y, B *= y, x *= y, P *= y);\n y = \"\" + r;\n r = 0 < y.indexOf(\"e-\") ? r = r.toFixed(18) : y;\n y = \"\" + v;\n v = 0 < y.indexOf(\"e-\") ? v = v.toFixed(18) : y;\n y = \"\" + B;\n B = 0 < y.indexOf(\"e-\") ? B = B.toFixed(18) : y;\n a.transform = Fb[n] + _[53] + r + \"px,\" + v + \"px,\" + B + \"px) \";\n if (1 != q || 1 != m)a.transform += _[429] + x + \",\" + P + \",1) \";\n (q = a.overlap) ? (n = Ja(2), n.width = e + q[0] + q[2], n.height = f + q[1] + q[3], n.style.overflow = _[6], k = n.width * n.height * 4, B = y = 0, m = n.getContext(\"2d\"), q && (y = q[0], B = q[1], H(m, n, g, l, q, t ? 0 : 250)), p ? m.drawImage(g, 0, 0, l[0], l[1], y, B, e, f) : m.drawImage(g, y, B), Ba && m.getImageData(l[0] >> 1, l[1] >> 1, 1, 1), a.canvas = n, a.elmt = n, a.image = g = null) : a.elmt = g;\n a.elmt.style.position = _[0];\n a.elmt.style[Zc] = \"0 0\"\n }\n a.mem = k;\n kb += k;\n if (kb > ca) {\n Da = !0;\n I++;\n for (var E, e = null, f = 0; ;) {\n for (E in ab)f++, k = ab[E], 0 < k.levelindex && 2 <= k.state && k.lastusage_on_frame < M - 1 && (!e || k.lastusage_on_frame < e.lastusage_on_frame) && (e = k);\n if (e) {\n if (ea(e), e = null, kb < ca - 2097152)break\n } else break\n }\n if (f > Math.max(2 * $a.length, 100)) {\n e = {};\n for (E in ab)if (k = ab[E])(0 < k.levelindex || 8 < k.level.mp) && 0 == k.state && k.lastusage_on_frame < M - 2 ? (k.pano = null, k.level = null) : e[E] = k;\n ab = e\n }\n kb > ca && (ia = !0)\n }\n Da = !0;\n I++\n }\n }\n }\n }\n\n function e(b, c) {\n aa--;\n c ? a.state = 4 : a.retries < m.network.retrycount ? (a.retries++, a.state = 0, Da = !0) : (a.state = 4, la(3, _[58] + a.url + _[62]))\n }\n\n if (null != a.pano) {\n null == a.url && (a.url = C(a.level.planeurls[a.level.invplanemapping[a.cubeside]], a.pano.cubelabels[a.cubeside], a.levelindex, String(a.h + a.level.i), String(a.v + a.level.i), a.pano.stereolabels[a.stereo - 1]));\n a.state = 1;\n var g = ra.loadimage(a.url, d, e);\n a.image = g;\n aa++\n }\n }\n\n function ea(a) {\n var b = ua, c = a.texture;\n b && c && b.deleteTexture(c);\n (b = a.elmt) && (c = b.parentNode) && c.removeChild(b);\n c = $a.length;\n for (b = 0; b < c; b++)if ($a[b] == a) {\n $a.splice(b, 1);\n break\n }\n b = a.id;\n ab[b] = null;\n delete ab[b];\n if (b = a.level)b.addedtiles[a.stereo - 1]--, b.completelyadded = b.stereo && ja.stereo ? b.addedtiles[0] == b.totaltiles && b.addedtiles[1] == b.totaltiles : b.addedtiles[0] == b.totaltiles;\n kb -= a.mem;\n a.state = 0;\n a.image = null;\n a.canvas = null;\n a.texture = null;\n a.elmt = null;\n a.pano = null;\n a.level = null\n }\n\n function Ca(a) {\n if (Sa) {\n var b = ua, c = xb, d = a.texture;\n c && d && (b.uniformMatrix4fv(Bb, !1, a.mx), b.bindBuffer(lb, c.vx), b.vertexAttribPointer(Pa, 3, Oc, !1, 0, 0), b.bindBuffer(lb, c.tx), b.vertexAttribPointer(Ra, 2, Oc, !1, 0, 0), b.bindBuffer(Qb, c.ix), b.activeTexture(Mc), b.bindTexture(ma, d), b.drawElements(Kb, c.tcnt, Gb, 0), R++)\n } else a.elmt.style[ib] = pc + a.transform\n }\n\n function S(a, b) {\n var c = new Hb;\n c.x = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n c.y = a[0] * b[3] + a[1] * b[4] + a[2] * b[5];\n c.z = -2 * (a[0] * b[6] + a[1] * b[7] + a[2] * b[8]);\n return c\n }\n\n function Z(a, c) {\n var d = a.panoview, g = a.id, f, h, k, t, n, l, r, G, u, P, y, z, D, E, C, A, Ba, F, H, J, K, S, Q = !1, L, ea, Z, N, I, V, X, ba, ka, kb, T, ca, ga, ia, ha = !1, oa = !1, va = !0, sa = Ta();\n if (Sa) {\n var ra = ua, za = Qa, Ha = ya, Ea = a.panoview, La = Ea.z, Aa = b.gl.width * xa + .5 | 0, Ka = b.gl.height * xa + .5 | 0;\n if (0 < c) {\n var Na = Aa, Aa = Aa >> 1, za = za >> 1;\n ra.viewport(2 == c ? Aa : 0, 0, 1 == c ? Aa : Na - Aa, Ka)\n } else ra.viewport(0, 0, Aa, Ka);\n var wb = 1 / (.5 * za), Oa = -1 / (.5 * Ha), Ma = Ea.zf, $b = 0 < c ? Number(ja.stereooverlap) * za * .5 * (1 == c ? 1 : -1) : 0, qd = Ea.yf, Xa = Math.min(Ma / 200, 1), ib = 0 < Ma ? Ea.ch : 0;\n xe(Tc, wb, 0, 0, 0, 0, Oa, 0, 0, 0, 0, 65535 / 65536, 1, 0, 0, 65535 / 65536 - 1, 0);\n xe(Kd, La, 0, 0, 0, 0, La, 0, 0, $b, qd, 1, 0, Ma * $b, Ma * qd, Ma, 1);\n Ic(Kd, Tc);\n if (0 < c) {\n var Ee = m.webVR;\n Ee && Ee.enabled && Ee.prjmatrix(c, Kd)\n }\n ra.uniform1i(pb, 0);\n ra.uniform1f(bb, 1);\n ra.uniform1f(Ya, Xa);\n ra.uniform1f(Za, ib);\n kd(Gc, tc);\n Ic(Gc, Kd);\n ra.uniformMatrix4fv(jb, !1, Gc);\n ra.uniformMatrix3fv(vb, !1, Db);\n var Jd = Ia.obj0, Pb = Ia.obj;\n null == Jd && (Jd = v(500, 1), Pb = v(500, 19), x(Jd), x(Pb), Ia.obj0 = Jd, Ia.obj = Pb);\n xb = 10 < Ma ? Pb : Jd\n }\n var Wa = c;\n 0 == Wa && (Wa = 1);\n a.stereo && (g += \"t\" + Wa);\n f = +d.h;\n h = -d.v;\n k = d.z;\n t = Ga - f * Y;\n n = -h * Y;\n l = Math.sin(n);\n r = Math.cos(n);\n G = Math.cos(t) * r;\n u = Math.sin(t) * r;\n if (Ib) {\n var cb = [G, l, u];\n Zd(rd, Ib);\n Fd(rd, cb);\n G = cb[0];\n l = cb[1];\n u = cb[2]\n }\n P = a.levels;\n z = P.length;\n D = a.currentlevel;\n a.viewloaded = !1;\n if (5E3 > k) {\n var ff = 1 / Math.max(100, k), mb = Math.abs(Math.cos(f * Y)), Ab = Math.cos(.25 * Ga);\n if (1E-14 > mb || mb > Ab - 1E-14 && mb < Ab + 1E-14 || mb > 1 - 1E-14 || 1E-14 > r || r > 1 - 1E-14)f += (.5 + .5 * Math.random()) * ff * (.5 > Math.random() ? -1 : 1), h += (.5 + .5 * Math.random()) * ff * (.5 > Math.random() ? -1 : 1);\n b.firefox && (l < -(1 - 1E-14) && (h += .5), l > +(1 - 1E-14) && (h -= .5))\n }\n pc = _[53] + Qa / 2 + \"px,\" + ya / 2 + _[207] + d.yf.toFixed(16) + _[232] + k.toFixed(16) + (0 < b.iosversion && 5 > b.iosversion ? \"\" : \"px\") + _[106] + (-d.r).toFixed(16) + _[86] + k.toFixed(16) + _[295] + h.toFixed(16) + _[284] + f.toFixed(16) + \"deg) \" + hc;\n if (0 < z) {\n var qb = 1 == pa(ja.loadwhilemoving) ? !0 : 0 == a.hasmoved || wa, ob = D;\n 7 <= aa && (qb = !1);\n if (a.stopped)qb = !1; else {\n 9 > P[0].mp && (0 == P[0].complete && (ob = 0, Q = !0), 0 == qb && 0 == P[0].completelyadded && (ob = 0, qb = Q = !0));\n var Cb = m.lockmultireslevel | 0;\n m.downloadlockedlevel && 0 <= Cb && Cb < z && (Q = !0, 0 == P[Cb].complete && (qb = !0))\n }\n ta && 5 < ob && (ob -= 3, ta = !1, Da = !0);\n if (qb) {\n Fa = sa;\n wa = !1;\n ca = null;\n ia = 1E6;\n for (E = ob; 0 <= E; E--) {\n y = P[E];\n Ba = y.w;\n F = y.h;\n H = y.tilesize;\n J = y.htiles;\n K = y.vtiles;\n var ha = !0, Zb = y.planeurls.length;\n for (A = 0; A < Zb; A++)if (C = y.planemapping[A], S = Q ? [0, 0, 1, 1] : d.vr[C]) {\n kb = \"p\" + g + \"l\" + E + \"s\" + Yb[C] + \"h\";\n var Fb = 1, Hb = 1;\n 1 == a.type && (Fb = 1 / Math.tan(.5 * y.hfov * Y), Hb = 1 / Math.tan(.5 * y.vfov * Y));\n L = Math.floor((Fb * (S[0] - .5) + .5) * Ba / H);\n ea = Math.ceil((Fb * (S[2] - .5) + .5) * Ba / H);\n 0 > L && (L = 0);\n ea > J && (ea = J);\n Z = Math.floor((Hb * (S[1] - .5) + .5) * F / H);\n N = Math.ceil((Hb * (S[3] - .5) + .5) * F / H);\n 0 > Z && (Z = 0);\n N > K && (N = K);\n for (ba = Z; ba < N; ba++)for (X = L; X < ea; X++) {\n ka = kb + X + \"v\" + ba;\n T = ab[ka];\n T || (T = new q(ka, E, C, X, ba, y, Wa, a), ab[ka] = T, ha = !1);\n if (0 == T.state)ga = Math.acos(G * T.ch + u * T.sh + l * T.sv), ga < ia && (ca = T, ia = ga), ha = !1; else if (1 == T.state)ha = !1; else if (2 == T.state) {\n 0 == Sa && Ca(T);\n var nb = T, ub = null, Eb = null;\n 0 == Sa && (ub = nb.elmt, Eb = a.layer);\n if (0 != Sa || ub.parentNode != Eb) {\n for (var gc = $a.length, Jb = -1, Ob = void 0, Lb = void 0, Fc = nb.pano, Hc = nb.levelindex, Jc = nb.draworder, qc = 0, uc = 0, Lb = 0; Lb < gc; Lb++)if (Ob = $a[Lb], Ob.pano === Fc && (qc = Ob.levelindex, uc = Ob.draworder, qc >= Hc && uc >= Jc)) {\n Jb = Lb;\n break\n }\n 0 > Jb ? (ub && Eb.appendChild(ub), $a.push(nb)) : (ub && Eb.insertBefore(ub, $a[Jb].elmt), $a.splice(Jb, 0, nb));\n var xc = nb.level;\n xc.addedtiles[nb.stereo - 1]++;\n xc.completelyadded = xc.stereo && ja.stereo ? xc.addedtiles[0] == xc.totaltiles && xc.addedtiles[1] == xc.totaltiles : xc.addedtiles[0] == xc.totaltiles\n }\n T.state = 3\n }\n T.lastusage_on_frame = M\n }\n }\n 0 == ta && 0 == ha && E == ob && 1E3 < sa - W && (ta = !0, W = sa);\n if (ha) {\n a.viewloaded = !0;\n break\n }\n }\n ca && qa(ca)\n }\n }\n 1 != a.viewloaded ? (oa = !0, U = sa) : 0 < U && 200 > sa - U && (oa = !0);\n Sa && 10 < d.zf && (oa = !0);\n if (oa) {\n var ac = a.cspreview;\n if (ac) {\n var Ec = ac.layer;\n for (I = 0; 6 > I; I++) {\n var sc = ac.tiles[I];\n Ca(sc);\n 0 == Sa && 2 == sc.state && (Ec.appendChild(sc.elmt), sc.state = 3)\n }\n 0 != Sa || a.previewadded || (0 == a.layer.childNodes.length ? a.layer.appendChild(Ec) : a.layer.insertBefore(Ec, a.layer.childNodes[0]), a.previewadded = !0)\n }\n } else 0 == Sa && a.previewadded && ((ac = a.cspreview) && a.layer.removeChild(ac.layer), a.previewadded = !1);\n a.previewloading && (va = !1);\n if (va)for (V = $a.length, I = 0; I < V; I++)if (T = $a[I], !(T.pano !== a || a.stereo && T.stereo != Wa))if (T.levelindex > D) {\n 0 == Sa && T.pano.layer.removeChild(T.elmt);\n T.state = 2;\n $a.splice(I, 1);\n I--;\n V--;\n var yc = T.level;\n yc.addedtiles[T.stereo - 1]--;\n yc.completelyadded = yc.stereo && ja.stereo ? yc.addedtiles[0] == yc.totaltiles && yc.addedtiles[1] == yc.totaltiles : yc.addedtiles[0] == yc.totaltiles\n } else Ca(T);\n if (0 == z && Sa) {\n var yb = a.rppano;\n if (2 < a.type && yb) {\n var Xc = yb.texture, vc = yb.imgfov, Rb = yb.videoplugin, Mb = null, Lc = !1;\n Rb && (Rb._panoid != a.id ? Rb = yb.videoplugin = null : Da = p.haschanged = !0);\n if (Xc && vc) {\n var Zc = vc[0], ad = vc[1], gd = vc[2];\n Lc = Rb ? (Mb = Rb.videoDOM) ? yb.videoready : yb.texvalid : !0;\n if (Lc) {\n var Pc = Ia.objS, hd = a.type + \"/\" + Zc + \"x\" + ad + \"/\" + gd;\n if (hd != Ia.objS_i) {\n var id = a.type, Uc = Zc, sd = ad, Qc = gd, zc = Pc, bd = 15453, td = 10302, dc = 3E4;\n zc && zc.tcnt != dc && (zc = null);\n var de = zc ? zc.vxd : new Float32Array(bd), Vc = zc ? zc.txd : new Float32Array(td), cd = zc ? zc.ixd : new Uint16Array(dc), Ac, Bc, jd, Wc, ld, md, Yc, ud, ee, nd, od, pd, Ld, fe, Uc = Uc * Y, sd = sd * Y, Qc = Qc * Y;\n 4 == id ? (sd = 1E3 * Math.tan(.5 * sd), Qc = 500 * Math.sin(1 * Qc)) : Qc = -Qc + .5 * Ga;\n for (Bc = bd = td = 0; 50 >= Bc; Bc++)for (Yc = 1 - Bc / 50, 4 == id ? (ee = 1, Wc = sd * (Yc - .5) + Qc) : (ud = (Bc / 50 - .5) * sd + Qc, ee = Math.sin(ud), nd = Math.cos(ud), Wc = 500 * nd), Ac = 0; 100 >= Ac; Ac++)ud = (Ac / 100 - .5) * Uc + Ga, od = Math.sin(ud), pd = Math.cos(ud), jd = 500 * pd * ee, ld = 500 * od * ee, md = 1 - Ac / 100, de[bd] = jd, de[bd + 1] = Wc, de[bd + 2] = ld, bd += 3, Vc[td] = md, Vc[td + 1] = Yc, td += 2;\n for (Bc = dc = 0; 50 > Bc; Bc++)for (Ac = 0; 100 > Ac; Ac++)Ld = 101 * Bc + Ac, fe = Ld + 101, cd[dc] = Ld, cd[dc + 1] = Ld + 1, cd[dc + 2] = fe, cd[dc + 3] = fe, cd[dc + 4] = Ld + 1, cd[dc + 5] = fe + 1, dc += 6;\n var Pc = new w(3E4, de, Vc, cd), dd = Ia.objS, ec = Pc;\n if (dd && dd.tcnt == ec.tcnt) {\n ec.vx = dd.vx;\n ec.tx = dd.tx;\n ec.ix = dd.ix;\n var vd = ua;\n vd.bindBuffer(lb, ec.vx);\n vd.bufferData(lb, ec.vxd, wc);\n vd.bindBuffer(lb, ec.tx);\n vd.bufferData(lb, ec.txd, wc);\n vd.bindBuffer(Qb, ec.ix);\n vd.bufferData(Qb, ec.ixd, wc)\n } else dd && e(dd), x(ec);\n Ia.objS = Pc;\n Ia.objS_i = hd\n }\n var fc = ua;\n fc.uniformMatrix4fv(Bb, !1, yb.mx);\n a.stereo && fc.uniformMatrix3fv(vb, !1, 0 == a.stereoformat ? 1 >= Wa ? jc : kc : 1 >= Wa ? Nb : bc);\n fc.bindBuffer(lb, Pc.vx);\n fc.vertexAttribPointer(Pa, 3, Oc, !1, 0, 0);\n fc.bindBuffer(lb, Pc.tx);\n fc.vertexAttribPointer(Ra, 2, Oc, !1, 0, 0);\n fc.bindBuffer(Qb, Pc.ix);\n var ge = null;\n if (Mb) {\n var Fe = 60 * Mb.currentTime, Ge = Fe != Mb._uf || b.android && b.chrome && 0 == Mb.paused;\n Rb.isseeking && 0 == Rb.iPhoneMode && (Ge = !1);\n 4 > Mb.readyState && (Ge = !1, Mb._uf = -1);\n if (Ge && 0 == Va)if (Va++, Mb._uf = 4 > Mb.readyState ? -1 : Fe, b.ie && b.desktop) {\n null == fa && (fa = Ja(2));\n if (fa.width != yb.w || fa.height != yb.h)fa.width = yb.w, fa.height = yb.h;\n fa.getContext(\"2d\").drawImage(Mb, 0, 0, yb.w, yb.h);\n ge = fa\n } else ge = Mb && Mb.paused && 5 > (Fe | 0) && Rb.posterDOM ? Rb.posterDOM : Mb\n }\n fc.activeTexture(Mc);\n fc.bindTexture(ma, Xc);\n if (ge)try {\n fc.texImage2D(ma, 0, cc, cc, Nc, ge), yb.texvalid = !0\n } catch (Md) {\n Md = \"\" + Md, Rb && Rb.error != Md && (Rb.error = Md, la(3, Md))\n }\n yb.texvalid && (fc.drawElements(Kb, Pc.tcnt, Gb, 0), R++)\n }\n }\n }\n }\n if (Sa) {\n var $c = (\"\" + ja.hotspotrenderer).toLowerCase();\n if (\"both\" == $c || _[30] == $c || \"auto\" == $c && 0 < c) {\n var Sb = ua, he = xb, ie = m.webVR, He = ie && ie.enabled, Ed = He ? ie.getcursor() : null, Nd = a.panoview, Vd = Nd.h, Wd = Nd.v, Xd = Nd.r, Yd = Nd.z / (He ? 2E3 : ya) * 2, Ie = 1, Ie = Ie * (1 + Nd.zf / 1E3), Gd = Ua.getArray(), $d = Gd.length, je, na, Od, Hd = 2 > c, Je = null;\n if (0 < c) {\n var be = He ? ie.eyetranslt(c) : 0;\n ye(rc, -be, 0, 0);\n kd(oc, ic);\n Ic(oc, rc);\n ye(rc, -p.tz, p.ty, -p.tx);\n ef(oc, rc);\n Je = oc\n }\n Sb.uniformMatrix4fv(jb, !1, Kd);\n Sb.bindBuffer(lb, he.vx);\n Sb.vertexAttribPointer(Pa, 3, Oc, !1, 0, 0);\n Sb.bindBuffer(lb, he.tx);\n Sb.vertexAttribPointer(Ra, 2, Oc, !1, 0, 0);\n Sb.bindBuffer(Qb, he.ix);\n for (je = 0; je < $d; je++)if ((na = Gd[je]) && na._visible && na.loaded && na._distorted && (0 != na.keep || !a.suspended)) {\n var ke = na.GL;\n ke || (na.GL = ke = {tex: null});\n var Id = !0;\n if (Hd) {\n var ed = na._scale, Pd = na._depth;\n isNaN(Pd) && (Pd = 1E3, Id = !1);\n na === Ed && (Pd = Ed.hit_depth, ed *= Pd / 1E3);\n var Cc = na._flying, Ke = (1 - Cc) * na._ath, Le = (1 - Cc) * na._atv, Me = (1 - Cc) * na.rotate;\n 0 < Cc && (Ke += Cc * nc(Vd, na._ath), Le += Cc * nc(Wd, na._atv), Me += Cc * nc(Xd, na.rotate));\n 1 == na.scaleflying && (ed = ed * (1 - Cc) + ed / Yd * Cc * Ie);\n var zb = wd, Ne = na._width / 1E3 * ed * 2, Oe = na._height / 1E3 * ed * 2, ce = na.rz, yf = na.ry, Pe = 2 * na.ox, Qe = 2 * na.oy, Re = Pd, ve = -Me, we = -Ke + 90, ze = Le, Ae = -na.tz, Be = na.ty, Ce = na.tx, rb = void 0, Qd = void 0, xd = void 0, yd = void 0, zd = void 0, Ad = void 0, Bd = void 0, sb = void 0, db = void 0, eb = void 0, fb = void 0, gb = void 0, hb = void 0, rb = na.rx * Y, Qd = Math.cos(rb), xd = Math.sin(rb), rb = yf * Y, yd = Math.cos(rb), zd = Math.sin(rb), rb = ce * Y, Ad = Math.cos(rb), Bd = Math.sin(rb), rb = -ze * Y, sb = Math.cos(rb), db = Math.sin(rb), rb = -we * Y, eb = Math.cos(rb), fb = Math.sin(rb), rb = -ve * Y, gb = Math.cos(rb), hb = Math.sin(rb), Tb = void 0, Ub = void 0, Vb = void 0, Tb = Ne * (yd * Ad - zd * xd * Bd), Ub = Ne * (yd * Bd + zd * xd * Ad), Vb = Ne * zd * Qd;\n zb[0] = Tb * (gb * eb + hb * db * fb) + Ub * (gb * db * fb - hb * eb) - Vb * sb * fb;\n zb[1] = Tb * hb * sb + Ub * gb * sb + Vb * db;\n zb[2] = Tb * (hb * db * eb - gb * fb) + Ub * (hb * fb + gb * db * eb) - Vb * sb * eb;\n zb[3] = 0;\n Tb = -Oe * Qd * Bd;\n Ub = Oe * Qd * Ad;\n Vb = Oe * xd;\n zb[4] = Tb * (gb * eb + hb * db * fb) + Ub * (gb * db * fb - hb * eb) + Vb * sb * fb;\n zb[5] = Tb * hb * sb + Ub * gb * sb - Vb * db;\n zb[6] = Tb * (hb * db * eb - gb * fb) + Ub * (hb * fb + gb * db * eb) + Vb * sb * eb;\n zb[7] = 0;\n Tb = zd * Ad + yd * xd * Bd;\n Ub = zd * Bd - yd * xd * Ad;\n Vb = yd * Qd;\n zb[8] = Tb * (gb * eb + hb * db * fb) + Ub * (gb * db * fb - hb * eb) + Vb * sb * fb;\n zb[9] = Tb * hb * sb + Ub * gb * sb - Vb * db;\n zb[10] = Tb * (hb * db * eb - gb * fb) + Ub * (hb * fb + gb * db * eb) + Vb * sb * eb;\n zb[11] = 0;\n zb[12] = Pe * (gb * eb + hb * db * fb) + Qe * (gb * db * fb - hb * eb) + Re * sb * fb + Ae;\n zb[13] = Pe * hb * sb + Qe * gb * sb - Re * db + Be;\n zb[14] = Pe * (hb * db * eb - gb * fb) + Qe * (hb * fb + gb * db * eb) + Re * sb * eb + Ce;\n zb[15] = 1;\n kd(na.MX, wd)\n } else kd(wd, na.MX);\n if (!(.01 > na._alpha)) {\n Je && Id ? Ic(wd, Je) : Ic(wd, ic);\n Sb.uniformMatrix4fv(Bb, !1, wd);\n var Rc = Db, Cd = na.crop;\n na.pressed && na._ondowncrop ? Cd = na._ondowncrop : na.hovering && na._onovercrop && (Cd = na._onovercrop);\n if (Cd)if (Cd != na.C_crop) {\n na.C_crop = Cd;\n var le = (\"\" + Cd).split(\"|\"), gf = na.loader.naturalWidth, hf = na.loader.naturalHeight, Rc = [1, 0, 0, 0, 1, 0, 0, 0, 0];\n Rc[0] = (1 * le[2] - 1) / gf;\n Rc[2] = (1 * le[0] + .5) / gf;\n Rc[4] = (1 * le[3] - 1) / hf;\n Rc[5] = (1 * le[1] + .5) / hf;\n na.C_crop_matrix = Rc\n } else Rc = na.C_crop_matrix;\n Sb.uniformMatrix3fv(vb, !1, Rc);\n Sb.uniform1f(bb, na._alpha);\n Sb.activeTexture(Mc);\n if (Od = ke.tex)Sb.bindTexture(ma, Od); else if (Od = B(na))ke.tex = Od;\n Od && (Sb.drawElements(Kb, he.tcnt, Gb, 0), R++)\n }\n }\n if (Hd && M & 1) {\n var Se = m.webVR, jf = Se && Se.enabled, lc = jf ? Se.getcursor() : null, Te = Ua.getArray(), kf = Te.length, Sc, tb, lf = !jf, Rd = [0, 0, 1], mf = !1, me = lc ? lc.depth : 2E3, nf = lc && lc.enabled;\n if (lf) {\n var nf = !0, mc = O.x, De = O.y;\n if (ja.stereo) {\n var ne = Qa >> 1, of = ne * Number(ja.stereooverlap);\n mc < ne ? (mc += ne >> 1, mc -= of >> 1) : (mc -= ne >> 1, mc += of >> 1)\n }\n var Ue = p.inverseProject(mc, De), Rd = [-Ue.x, -Ue.y, -Ue.z]\n }\n var Wb = Kc, Dd = Rd, Ve = Dd[0], We = Dd[1], Xe = Dd[2];\n Dd[0] = Ve * Wb[0] + We * Wb[4] + Xe * Wb[8] + Wb[12];\n Dd[1] = Ve * Wb[1] + We * Wb[5] + Xe * Wb[9] + Wb[13];\n Dd[2] = Ve * Wb[2] + We * Wb[6] + Xe * Wb[10] + Wb[14];\n for (Sc = kf - 1; 0 <= Sc; Sc--)if ((tb = Te[Sc]) && tb._visible && tb.loaded && tb._distorted && tb !== lc && (tb._hit = !1, nf && tb._enabled)) {\n var Ye, Dc = tb.MX, pf = 0, Xb = 1E3, Ze = Rd[0], $e = Rd[1], af = Rd[2], oe = Xb * Dc[0], pe = Xb * Dc[1], qe = Xb * Dc[2], re = Xb * Dc[4], se = Xb * Dc[5], te = Xb * Dc[6], bf = Dc[12] - (oe + re) / 2, cf = Dc[13] - (pe + se) / 2, df = Dc[14] - (qe + te) / 2, Sd = $e * te - af * se, Td = af * re - Ze * te, Ud = Ze * se - $e * re, fd = oe * Sd + pe * Td + qe * Ud;\n if (-1E-6 > fd || 1E-6 < fd)fd = 1 / fd, Xb = (bf * Sd + cf * Td + df * Ud) * -fd, 0 <= Xb && 1 >= Xb && (Sd = df * pe - cf * qe, Td = bf * qe - df * oe, Ud = cf * oe - bf * pe, Xb = (Ze * Sd + $e * Td + af * Ud) * fd, 0 <= Xb && 1 >= Xb && (pf = (re * Sd + se * Td + te * Ud) * fd));\n Ye = pf;\n if (1 < Ye) {\n mf = tb._hit = !0;\n me = Ye;\n break\n }\n }\n lc && (me = Math.max(me, 200) - 100, lc.hit_depth = me);\n for (Sc = 0; Sc < kf; Sc++)if (tb = Te[Sc]) {\n var ue = tb._hit;\n ue != tb.hovering && (tb.hovering = ue, da.callaction(ue ? tb.onover : tb.onout, tb), lc && da.callaction(ue ? lc.onover : lc.onout, tb))\n }\n 0 == O.down && ae.update(!1, lf && mf)\n }\n }\n }\n }\n\n function B(a) {\n var b = a.loader, c = null;\n if (a.jsplugin)b = null; else if (c = b.src, 1 > b.naturalWidth || 1 > b.naturalHeight)b = null;\n if (!b)return null;\n var d = ua, e = null;\n if (e = Ec[c])e.cnt++, e = e.tex; else {\n e = d.createTexture();\n d.bindTexture(ma, e);\n d.texParameteri(ma, d.TEXTURE_WRAP_T, d.CLAMP_TO_EDGE);\n d.texParameteri(ma, d.TEXTURE_WRAP_S, d.CLAMP_TO_EDGE);\n d.texParameteri(ma, d.TEXTURE_MAG_FILTER, qb);\n d.texParameteri(ma, d.TEXTURE_MIN_FILTER, qb);\n try {\n d.texImage2D(ma, 0, mb, mb, Nc, b), Ec[c] = {cnt: 1, tex: e}\n } catch (g) {\n la(3, g)\n }\n }\n a._GL_onDestroy || (a._GL_onDestroy = function () {\n var b = a.loader;\n if (b && !a.jsplugin) {\n var c = ua, b = b.src, d = Ec[b];\n d && 0 == --d.cnt && (c.deleteTexture(d.tex), d.tex = null, Ec[b] = null, delete Ec[b]);\n a._GL_onDestroy = null\n }\n });\n return e\n }\n\n var t = Oa, G = 0, Ba = !1, P = 0, Fa = 0, wa = !1, ta = !1, W = 0, U = 0, Da = !1, M = 0, Va = 0, R = 0, I = 0, X = 0, aa = 0, ba = 0, T = 16.666, ab = {}, $a = [], kb = 0, ca = 52428800, ia = !1, fa = null, Sa = !1, ka = null, ua = null, Ia = null, ga = 0, xb = null, sa = !1, xa = 1, Ha = !1, oa = null, va = null;\n d = a = null;\n var ha = [], La = null, Aa = null, Ea = !1, za = null, Ka = null, Na = [], Pa, Ra, Ya, Za, bb, pb, jb, Bb, vb, Db = [1, 0, 0, 0, 1, 0, 0, 0, 0], Nb = [1, 0, 0, 0, .5, 0, 0, 0, 0], bc = [1, 0, 0, 0, .5, .5, 0, 0, 0], jc = [.5, 0, 0, 0, 1, 0, 0, 0, 0], kc = [.5, 0, .5, 0, 1, 0, 0, 0, 0], ma, Wa, Ab, Mc, lb, Qb, mb, cc, Nc, Gb, Oc, Kb, wc, qb, Yb = [1, 3, 0, 2, 4, 5, 6], Fb = \"rotateY(90deg) ;;rotateY(-90deg) ;rotateY(180deg) ;rotateX(-90deg) ;rotateX(90deg) ;\".split(\";\"), pc = \"\", hc = \"\", Ib = null;\n t.requiereredraw = !1;\n t.isloading = !1;\n t.setup = function (a) {\n var c, d = null;\n if (2 == a) {\n var e = {};\n if (0 <= F(Jb.so.html5).indexOf(_[196]) || b.mac && b.firefox)e.preserveDrawingBuffer = !0;\n b.mobile && (e.antialias = !1);\n e.depth = !1;\n e.stencil = !1;\n var f = Jb.so.webglsettings;\n f && (!0 === f.preserveDrawingBuffer && (e.preserveDrawingBuffer = !0), !0 === f.depth && (e.depth = !0), !0 === f.stencil && (e.stencil = !0));\n f = F(Jb.so.wmode);\n _[36] == f || _[142] == f ? (sa = !0, e.alpha = !0, e.premultipliedAlpha = !1) : e.alpha = !1;\n try {\n for (ka = Ja(2), ka.style.position = _[0], ka.style.left = 0, c = ka.style.top = 0; 4 > c && !(d = ka.getContext([_[30], _[83], _[116], _[112]][c], e)); c++);\n } catch (h) {\n }\n ka && d && (ua = d, Ia = {}, ma = d.TEXTURE_2D, Wa = d.COLOR_BUFFER_BIT | d.DEPTH_BUFFER_BIT | d.STENCIL_BUFFER_BIT, Ab = d.FRAMEBUFFER, Mc = d.TEXTURE0, lb = d.ARRAY_BUFFER, Qb = d.ELEMENT_ARRAY_BUFFER, mb = d.RGBA, cc = d.RGB, Nc = d.UNSIGNED_BYTE, Gb = d.UNSIGNED_SHORT, Oc = d.FLOAT, Kb = d.TRIANGLES, wc = d.STATIC_DRAW, qb = d.LINEAR, k() && (c = m.bgcolor, d.clearColor((c >> 16 & 255) / 255, (c >> 8 & 255) / 255, (c & 255) / 255, 1 - (c >> 24) / 255, sa ? 1 : 0), d.disable(d.DEPTH_TEST), d.depthFunc(d.NEVER), d.enable(d.BLEND), d.blendFunc(d.SRC_ALPHA, d.ONE_MINUS_SRC_ALPHA), d.enable(d.CULL_FACE), d.cullFace(d.FRONT), ga = d.getParameter(d.MAX_TEXTURE_SIZE), !b.desktop && 4096 < ga && (ga = 4096), 2048 >= ga && b.firefox && !b.mac && !b.android && (b.css3d = !1), b.ios && (ga = 2048), V.panolayer.appendChild(ka), t.infoString = _[423], m.webGL = {\n canvas: ka,\n context: d,\n ppshaders: Na,\n createppshader: function (a, b) {\n return g(null, a, b)\n },\n useProgram: n\n }, Sa = !0));\n 0 == Sa && (Ia = ua = ka = null, a = 1)\n }\n 1 == a && (t.infoString = \"\", b.webgl = !1);\n G = b._tileOverlap | 0;\n if (6 < b.iosversion || b.mac && \"7\" <= b.safariversion)Ba = !0;\n b.multiressupport = b.androidstock && 0 == b.webgl ? !1 : !0;\n (a = b.webgl) && b.android && (b.androidstock ? a = !1 : b.chrome && 38 > b.chromeversion && (a = !1));\n 9 <= b.iosversion && document.addEventListener(_[52], E, !1);\n b.panovideosupport = a;\n b.buildList()\n };\n t.reset = function () {\n M = 0\n };\n var ob = null, Cb = null;\n t.unload = function () {\n var b;\n m.webGL && (m.webGL.canvas = null, m.webGL.context = null, m.webGL = null);\n var c = ua;\n if (c && Ia) {\n c.bindTexture(ma, null);\n c.bindBuffer(lb, null);\n c.bindBuffer(Qb, null);\n c.bindFramebuffer(Ab, null);\n c.deleteProgram(Ia.sh);\n c.deleteShader(Ia.vs);\n c.deleteShader(Ia.ps);\n Ia.obj0 && (e(Ia.obj0), e(Ia.obj));\n Ia.objS && e(Ia.objS);\n Ia = null;\n for (b = 0; 6 > b; b++)ha[b] && ha[b].prg && (c.deleteProgram(ha[b].prg), ha[b].prg = null, ha[b] = null);\n c.deleteBuffer(a);\n c.deleteBuffer(d);\n var g = [oa, va, za, Ka];\n for (b = 0; b < g.length; b++)g[b] && (g[b].fb && c.deleteFramebuffer(g[b].fb), g[b].tex && c.deleteTexture(g[b].tex), g[b] = null)\n }\n Sa = !1;\n ua = ka = null\n };\n t.size = function (a, c) {\n if (Sa) {\n var d = (b.android && 0 == b.androidstock || b.blackberry || b.silk || b.mac) && 0 == b.hidpi ? b.pixelratio : 1;\n if (b.desktop || b.ios || b.ie)d = L.devicePixelRatio;\n isNaN(d) && (d = 1);\n if (!b.desktop && 1 != d)a:{\n var e = d, d = [320, 360, 400, 480, 640, 720, 768, 800, 1024, 1080, 1280, 1366, 1440, 1920, 2560], g, f, h = a * e;\n f = d.length;\n for (g = 0; g < f; g++)if (2 > Math.abs(d[g] - h)) {\n d = d[g] / a;\n break a\n }\n d = e\n }\n d *= 1;\n e = a * d + .25 | 0;\n d = c * d + .25 | 0;\n if (g = m.webVR)if (g = g.getsize(e, d))e = g.w, d = g.h;\n e *= ja.framebufferscale;\n d *= ja.framebufferscale;\n ka.style.width = a + \"px\";\n ka.style.height = c + \"px\";\n if (ka.width != e || ka.height != d) {\n ka.width = e;\n ka.height = d;\n g = ua.drawingBufferWidth | 0;\n f = ua.drawingBufferHeight | 0;\n b.desktop && b.chrome && 300 == g && 150 == f && (g = f = 0);\n if (0 >= g || 0 >= f)g = e, f = d;\n ua.viewport(0, 0, g, f);\n b.gl = {width: g, height: f}\n }\n } else b.gl = {width: 0, height: 0}\n };\n t.fps = function () {\n var a = Ta();\n if (0 < ba) {\n var b = a - ba;\n if (5 < b && 500 > b) {\n var c = Math.min(b / 160, .75);\n T = T * (1 - c) + b * c;\n 0 < T && (nd = 1E3 / T, ja.currentfps = nd)\n }\n 0 == I && (ja.r_ft = .9 * ja.r_ft + .1 * b)\n }\n ba = a\n };\n var Fc = !1;\n t.startFrame = function () {\n Da = !1;\n R = Va = 0;\n Fc = !0;\n ca = m.memory.maxmem << 20;\n if (Sa) {\n var a = ua;\n (Ea = 0 < Na.length) ? (a.clear(Wa), za = r(za), a.bindFramebuffer(Ab, za.fb), a.clear(Wa), R = 0) : a.clear(Wa)\n }\n };\n t.finishFrame = function () {\n M++;\n I = 0;\n if (Sa) {\n var a = ua;\n if (Ea) {\n var c, d = Na.length, e = za, g = null;\n 1 < d && (g = Ka = r(Ka));\n a.disable(a.BLEND);\n for (c = 0; c < d; c++)e.drawcalls = R, R = 0, a.bindFramebuffer(Ab, g ? g.fb : null), a.clear(Wa), y(e, Na[c], 1), e = g, g = c + 1 == d - 1 ? null : c & 1 ? Ka : za;\n a.enable(a.BLEND)\n }\n b.androidstock && a.finish()\n }\n m.memory.usage = kb >> 20;\n Fc = !1\n };\n t.createPano = function (a) {\n return new z(a)\n };\n var Eb = 0, gc = 0, nb = 0, ic = Ma(), Kc = Ma(), Ob = Ma(), tc = Ma(), Lb = Ma(), Tc = Ma(), Kd = Ma(), Gc = Ma(), oc = Ma(), rd = Ma(), Zb = Ma();\n t.setblendmode = function (a) {\n if (Sa) {\n var c = ua;\n La = null;\n var d = !0, e = null, g = null, f = 1, h = da.parseFunction(a);\n if (h)switch (h[0].toUpperCase()) {\n case \"BLEND\":\n (e = h[2]) || (e = _[324]);\n La = ha[0];\n break;\n case _[359]:\n g = Number(h[2]);\n f = Number(h[3]);\n (e = h[4]) || (e = _[319]);\n isNaN(g) && (g = 16777215);\n isNaN(f) && (f = 2);\n La = ha[1];\n n(La.prg);\n break;\n case _[363]:\n g = Number(h[2]);\n (e = h[3]) || (e = _[317]);\n isNaN(g) && (g = 0);\n La = ha[2];\n n(La.prg);\n break;\n case _[365]:\n var d = !1, k = Number(h[2]);\n a = Number(h[3]);\n e = h[4];\n isNaN(k) && (k = 0);\n isNaN(a) && (a = .2);\n a = 0 > a ? 0 : 1 < a ? 1 : a;\n e || (e = _[43]);\n var t = h = 0, l = Math.cos(k * Y), m = Math.sin(k * Y);\n 0 > m && (t = 1, k += 90);\n 0 > l && (h = 1, k += 0 > m ? 90 : -90);\n k = Math.sqrt(2) * Math.cos((45 - k) * Y);\n l *= k;\n m *= k;\n k = 1 / (l * l + m * m);\n La = ha[4];\n n(La.prg);\n c.uniform3f(La.fp, l * k, m * k, (-h * l - t * m) * k);\n c.uniform1f(La.bl, .5 * a);\n break;\n case _[404]:\n d = !1;\n a = Number(h[2]);\n (e = h[3]) || (e = _[272]);\n isNaN(a) && (a = 2);\n La = ha[3];\n n(La.prg);\n c.uniform2f(La.ct, .5, .5);\n c.uniform1f(La.zf, a);\n break;\n case _[399]:\n d = !1, a = Number(h[2]), k = Number(h[3]), t = Number(h[4]), (e = h[5]) || (e = _[43]), isNaN(a) && (a = .2), isNaN(k) && (k = .2), isNaN(t) && (t = 0), a = -1 > a ? -1 : 1 < a ? 1 : a, k = 0 > k ? 0 : 1 < k ? 1 : k, t = 0 > t ? 0 : 1 < t ? 1 : t, h = b.gl.width / b.gl.height, l = 1, isNaN(h) && (h = 1), h *= h, 0 > a ? h *= 1 + a : l *= 1 - a, La = ha[5], n(La.prg), c.uniform2f(La.ap, h, l), c.uniform1f(La.bl, .5 * k), c.uniform1f(La.zf, t)\n }\n if (null == La || 0 == d && ja.stereo)La = ha[0], g = null;\n null !== g && c.uniform3f(La.cc, f * (g >> 16 & 255) / 255, f * (g >> 8 & 255) / 255, f * (g & 255) / 255);\n null == e && (e = _[43]);\n Aa = ac.getTweenfu(e);\n Ha = 0 == b.realDesktop && 1 < b.pixelratio || 33 < ja.r_ft\n }\n };\n t.snapshot = function (a, b) {\n if (Sa) {\n var c = ua;\n if (a) {\n var d = oa;\n oa = va;\n va = d\n }\n Ha && (xa = .707);\n va = r(va);\n c.bindFramebuffer(Ab, va.fb);\n R = 0;\n c.clear(Wa);\n d = 0;\n b && (d = Fc, Fc = !0, t.renderpano(b, 1), Fc = d, d = 1 - b.alpha);\n a && y(oa, La, b ? 1 - b.alpha : a.alpha) && R++;\n va.drawcalls = R;\n c.bindFramebuffer(Ab, Ea ? za.fb : null);\n xa = 1;\n null == a && (a = {});\n a.alpha = d;\n return a\n }\n return null\n };\n t.rendersnapshot = function (a, b) {\n if (0 == Fc)return a;\n if (null == ua || null == va || b && 1 <= b.alpha)return null;\n var c = a.alpha = b ? 1 - b.alpha : a.alpha;\n y(va, La, c);\n return a\n };\n t.renderpano = function (a, c) {\n if (0 != Fc) {\n a.frame = M;\n var d = !1, e = ua;\n if (2 == c && e) {\n if (a.stopped && oa && oa.done && oa.pano == a.id) {\n oa.have = !0;\n return\n }\n Ha && (xa = .707);\n if (oa = r(oa))d = !0, oa.have = !0, oa.pano = a.id, oa.done = !1, oa.alpha = a.alpha, oa.drawcalls = 0, e.bindFramebuffer(Ab, oa.fb), e.clear(Wa)\n }\n var g = a.panoview = a.stopped && a.panoview ? a.panoview : p.getState(a.panoview), f = g.h, h = g.v, k = g.r, t = g.z, l = a.hasmoved = f != Eb || h != gc || t != nb;\n t != nb && (ia = !1);\n var q = Ta();\n if (l) {\n if (\"auto\" == F(ja.loadwhilemoving)) {\n var G = q - cb;\n 200 < q - Fa && 0 == O.down && 200 < G && (wa = !0)\n }\n P = q\n } else 10 > q - P && (a.hasmoved = l = !0);\n Da = l;\n Eb = f;\n gc = h;\n nb = t;\n l = ic;\n t = Kc;\n Yd(l, f, h, k);\n kd(tc, l);\n hc = \"\";\n Ib = null;\n if (a.image && a.image.prealign && (f = (\"\" + a.image.prealign).split(\"|\"), 3 == f.length)) {\n var h = Number(f[0]), u = -Number(f[1]), k = -Number(f[2]);\n if (!isNaN(h) && !isNaN(u) && !isNaN(k)) {\n hc = _[125] + u.toFixed(4) + _[271] + k.toFixed(4) + _[269] + h.toFixed(4) + \"deg) \";\n Ib = Ob;\n Zd(t, l);\n l = tc;\n t = Lb;\n kd(l, ic);\n var f = Ib, w, G = -k * Y, k = Math.cos(G), q = Math.sin(G), G = -u * Y, u = Math.cos(G);\n w = Math.sin(G);\n G = -h * Y;\n h = Math.cos(G);\n G = Math.sin(G);\n Hc(f, h * u + G * q * w, G * k, -h * w + G * q * u, -G * u + h * q * w, h * k, G * w + h * q * u, k * w, -q, k * u);\n ef(l, Ib)\n }\n }\n Zd(t, l);\n l = (b.android && 0 == b.androidstock || b.blackberry || b.ios) && 0 == b.hidpi ? b.pixelratio : 1;\n b.ios && b.retina && (l = 1.5);\n 1.4 < l && (l = 1.4);\n h = 1 / (g.z / (.5 * ya));\n f = g.zf;\n 200 < f && (h = Math.atan(h), f = Math.min(h + Math.asin(f / 1E3 * Math.sin(h)), 1), isNaN(f) && (f = 1), h = Math.tan(f));\n .5 > h && (l = 1);\n b.desktop && (l = b.pixelratio);\n l = .25 * Ga * (Qa * l / Math.sin(Math.atan(Qa / ya * h)) + ya * l / h);\n 0 == a.type ? l *= 2 / Ga : 1 == a.type && (f = a.levels, l *= 2 / Ga, l *= Math.tan(.5 * f[f.length - 1].vfov * Y));\n h = l;\n l = 0;\n k = a.levels;\n f = k.length;\n q = 1 + (N ? parseFloat(N.multiresthreshold) : 0);\n isNaN(q) && (q = 1);\n .1 > q && (q = .1);\n h = Math.ceil(h * q);\n if (0 < f) {\n for (; !(0 == k[l].preview && k[l].h >= h);)if (l++, l >= f) {\n l = f - 1;\n break\n }\n ia && 0 < l && --l;\n h = m.lockmultireslevel;\n _[470] == F(h) && (m.lockmultireslevel = h = \"\" + l);\n h |= 0;\n 0 <= h && h < f && (l = h);\n a.currentlevel != l && (a.currentlevel = l)\n }\n 1 == c && (l = a.currentlevel, m.multireslevel = 0 < l && a.levels[0].preview ? l - 1 : l);\n a:{\n k = t;\n t = g.zf;\n h = 1 / (g.z / (.5 * uc));\n if (0 < t && (l = Math.atan(h), h = Math.tan(l + Math.asin(t / 1E3 * Math.sin(l))), isNaN(h) || 0 >= h)) {\n t = [0, 0, 1, 1];\n g.vr = [t, t, t, t, t, t];\n break a\n }\n q = h * ya / Qa;\n G = g.yf / ya * 2 * q;\n t = [h, q + G, -1];\n l = [-h, q + G, -1];\n f = [-h, -q + G, -1];\n h = [h, -q + G, -1];\n Fd(k, t);\n Fd(k, l);\n Fd(k, f);\n Fd(k, h);\n for (var q = 1, v = null, G = Array(40), u = [null, null, null, null, null, null], k = 0; 6 > k; k++) {\n var x = [], B = [];\n x.push(S(t, ub[k]));\n x.push(S(l, ub[k]));\n x.push(S(f, ub[k]));\n x.push(S(h, ub[k]));\n var z = 0, E = 0, D = 0, C = 0;\n for (w = E = 0; 4 > w; w++)v = x[w], E = v.x, D = v.y, C = v.z / 2, E = 1 * (E > -C) + 8 * (E < C) + 64 * (D < C) + 512 * (D > -C) + 4096 * (-.1 > -C), G[w] = E, z += E;\n w = 0 != (z & 18724);\n if (0 == z)for (w = 0; 4 > w; w++)v = x[w], B.push(v.x / v.z), B.push(v.y / v.z); else if (w)continue; else {\n for (var z = 4, v = G, A = 0, Ba = [], W = [], H, J = 0, J = 0; 5 > J; J++) {\n var ta = 1 << 3 * J;\n for (w = 0; w < z; w++) {\n var D = (w + z - 1) % z, E = x[D], K = x[w], D = v[D], Q = v[w], L = 0;\n 0 == (Q & ta) ? (L |= 2, D & ta && (L |= 1)) : 0 == (D & ta) && (L |= 1);\n L & 1 && (4 == J ? q = (.1 - E.z / 2) / (K.z - E.z) / 2 : 3 == J ? q = (-E.y - E.z / 2) / (K.y - E.y + (K.z - E.z) / 2) : 2 == J ? q = (E.z / 2 - E.y) / (K.y - E.y - (K.z - E.z) / 2) : 1 == J ? q = (E.z / 2 - E.x) / (K.x - E.x - (K.z - E.z) / 2) : 0 == J && (q = (-E.z / 2 - E.x) / (K.x - E.x + (K.z - E.z) / 2)), H = new Hb, H.x = E.x + (K.x - E.x) * q, H.y = E.y + (K.y - E.y) * q, H.z = E.z + (K.z - E.z) * q, E = H.x, D = H.y, C = H.z / 2, E = 1 * (E > -C) + 8 * (E < C) + 64 * (D < C) + 512 * (D > -C) + 4096 * (-.1 > -C), Ba.push(H), W.push(E), A++);\n L & 2 && (Ba.push(K), W.push(Q), A++)\n }\n z = A;\n x = Ba;\n v = W;\n A = 0;\n Ba = [];\n W = []\n }\n for (w = 0; w < z; w++)v = x[w], B.push(v.x / v.z), B.push(v.y / v.z)\n }\n x = z = 9;\n A = v = -9;\n Ba = B.length;\n if (4 < Ba) {\n for (w = 0; w < Ba; w++)B[w] += .5;\n for (w = 0; w < Ba; w += 2)B[w + 0] < z && (z = B[w + 0]), B[w + 1] < x && (x = B[w + 1]), B[w + 0] > v && (v = B[w + 0]), B[w + 1] > A && (A = B[w + 1]);\n z > v || 0 > z && 0 > v || 1 < z && 1 < v || x > A || 0 > x && 0 > A || 1 < x && 1 < A || (0 > z && (z = 0), 0 > x && (x = 0), 1 < v && (v = 1), 1 < A && (A = 1), u[k] = [z, x, v, A])\n }\n }\n g.vr = u\n }\n Ia && (n(Ia.sh), e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA), sa && e.colorMask(!0, !0, !0, !0));\n ja.stereo ? (Z(a, 1), Z(a, 2)) : Z(a, 0);\n g = 0;\n m.downloadlockedlevel && 0 < (m.lockmultireslevel | 0) && (g = m.lockmultireslevel | 0);\n t = a.levels;\n 0 < t.length && (g = t[g], sc.progress = g.stereo && ja.stereo ? (g.loadedtiles[0] + g.loadedtiles[1]) / (2 * g.totaltiles) : g.loadedtiles[0] / g.totaltiles);\n d && (e.bindFramebuffer(Ab, Ea ? za.fb : null), e.clear(Wa), oa.drawcalls = R, oa.done = !0, xa = 1);\n 1 == c && e && oa && 0 < oa.drawcalls && oa.done && oa.have && (oa.have = !1, y(oa, La, 1 - qc));\n sa && e.colorMask(!0, !0, !0, !1)\n }\n };\n t.handleloading = function () {\n return Da ? 2 : 0\n };\n var Jc = [[0, 180], [0, 90], [0, 0], [0, 270], [-90, 90], [90, 90]], ub = [[-1, 0, 0, 0, 1, 0, 0, 0, 1], [0, 0, 1, 0, 1, 0, 1, 0, 0], [1, 0, 0, 0, 1, 0, 0, 0, -1], [0, 0, -1, 0, 1, 0, -1, 0, 0], [0, 0, 1, -1, 0, 0, 0, 1, 0], [0, 0, 1, 1, 0, 0, 0, -1, 0]], Ec = {}, wd = Ma(), rc = Ma()\n })();\n var sf = function () {\n function a(a, b, f) {\n a = F(a).charCodeAt(0);\n return 118 == a ? f : 104 == a ? b : 100 == a ? Math.sqrt(b * b + f * f) : Math.max(b, f * d.mfovratio)\n }\n\n var d = this;\n d.haschanged = !1;\n d.r_rmatrix = Ma();\n (function () {\n var a = \"hlookat vlookat camroll fov maxpixelzoom fisheye fisheyefovlink architectural tx ty tz\".split(\" \"), b = [_[268], _[193]], f;\n for (f in a)va(d, a[f], 0);\n for (f in b)va(d, b[f], !1);\n va(d, _[474], \"VFOV\");\n d.continuousupdates = !1;\n ha(d, _[477], function () {\n return \"\" + d._pannini\n }, function (a) {\n var b = Number(a), b = isNaN(b) ? pa(a) ? 1 : 0 : 0 > b ? 0 : 1 < b ? 1 : b;\n d._pannini = b;\n d.haschanged = !0\n });\n ha(d, _[364], function () {\n return d._fisheye\n }, function (a) {\n d.fisheye = a\n });\n ha(d, _[215], function () {\n return d._fisheyefovlink\n }, function (a) {\n d.fisheyefovlink = a\n });\n ha(d, _[305], function () {\n var a = d.hlookatmax, b = d.hlookatmin, g = M && M.fovlimits;\n isNaN(b) && (b = g ? g[0] : -180);\n isNaN(a) && (a = g ? g[1] : 180);\n return a - b\n }, function (a) {\n });\n ha(d, _[304], function () {\n var a = d.vlookatmax, b = d.vlookatmin, g = M && M.fovlimits;\n isNaN(b) && (b = g ? g[2] : -90);\n isNaN(a) && (a = g ? g[3] : 90);\n return a - b\n }, function (a) {\n })\n })();\n d.defaults = function () {\n d._hlookat = 0;\n d._vlookat = 0;\n d._architectural = 0;\n d._architecturalonlymiddle = !0;\n d._fov = 90;\n d._fovtype = b.desktop ? \"VFOV\" : \"MFOV\";\n d._camroll = 0;\n d.mfovratio = 4 / 3;\n d._maxpixelzoom = Number.NaN;\n d._stereographic = !0;\n d._pannini = 0;\n d._fisheye = 0;\n d._fisheyefovlink = .5;\n d.fovmin = 1;\n d.fovmax = 179;\n d.r_zoom = 1;\n d.r_yoff = 0;\n d.r_zoff = 0;\n d.haschanged = !1;\n d.limitview = \"auto\";\n d.hlookatmin = Number.NaN;\n d.hlookatmax = Number.NaN;\n d.vlookatmin = Number.NaN;\n d.vlookatmax = Number.NaN;\n d._limits = null\n };\n d.inverseProject = function (a, b) {\n var f, e, m, p, v, r, y, l;\n m = -1E3;\n v = m / d.r_zoom;\n f = (a - Qa / 2) * v;\n e = (b - ya / 2 - d.r_yoff) * v;\n v = 1 / Math.sqrt(f * f + e * e + m * m);\n f *= v;\n e *= v;\n m *= v;\n p = d.r_zoff;\n 0 < p && (0 == d._stereographic && (l = Math.atan(1E3 / p) / Y - 1, (1 > -m ? Math.acos(-m) / Y : 0) > l && (r = -e, y = f, v = r * r + y * y, 0 < v && (v = 1 / Math.sqrt(v), r *= v, y *= v), l *= Y, v = Math.sin(l), f = v * y, e = -v * r, m = -Math.cos(l))), r = p * m, y = r * r - (p * p - 1E6), 0 < y && (v = -r + Math.sqrt(y), f *= v, e *= v, m = m * v - -p, v = 1 / Math.sqrt(f * f + e * e + m * m), f *= v, e *= v, m *= v));\n p = new Hb;\n p.x = f;\n p.y = e;\n p.z = m;\n return p\n };\n var m = d.fovRemap = function (b, d, f, e, m) {\n e || (e = Qa);\n m || (m = ya);\n b = Math.tan(b / 360 * Ga);\n d = a(d, e, m);\n f = a(f, e, m);\n return b = 360 * Math.atan(b * f / d) / Ga\n }, f = Ma();\n d.screentosphere = function (a, b) {\n var k = new Hb;\n if (ja.stereo) {\n var e = Qa / 2, m = e / 2 * (1 - Number(ja.stereooverlap));\n a = a < e ? a + m : a - m\n }\n e = d.inverseProject(a * X, b * X);\n Zd(f, d.r_rmatrix);\n nb(f, e);\n e = [Math.atan2(e.x, e.z) / Y + 270, Math.atan2(-e.y, Math.sqrt(e.x * e.x + e.z * e.z)) / Y];\n 180 < e[0] && (e[0] -= 360);\n k.x = e[0];\n k.y = e[1];\n k.z = 0;\n return k\n };\n d.spheretoscreen = function (a, b) {\n var f = new Hb, e = (180 - a) * Y, m = b * Y;\n f.x = 1E3 * Math.cos(m) * Math.cos(e);\n f.z = 1E3 * Math.cos(m) * Math.sin(e);\n f.y = 1E3 * Math.sin(m);\n nb(d.r_rmatrix, f);\n var e = f.z + d.r_zoff, p = m = tc;\n 10 <= e && (e = d.r_zoom / e, m = (f.x * e + .5 * Qa) / X, p = (f.y * e + .5 * ya) / X + d.r_yoff);\n f.x = m;\n f.y = p;\n return f\n };\n d.updateView = function () {\n var a = d._maxpixelzoom;\n if (!isNaN(a) && 0 != a) {\n var f = 1E-6;\n if (M && M.ready) {\n var k = M.vres, e = M.vfov;\n 0 == M.type && (k = k * Math.PI * .5);\n if (50 < k && 0 < e) {\n var f = Qa, w = ya, a = 360 / Math.PI * Math.atan(Math.tan(2 * Math.atan(1 / (2 / Math.PI * k * a / (e / 180) / (.5 * f)))) / (f / w));\n if (isNaN(a) || 1E-4 > a)a = d.fovmax;\n 90 < a && (a = 90);\n f = m(a, \"VFOV\", d._fovtype)\n }\n }\n d.fovmin = f\n }\n var e = d._fov, f = d._hlookat, w = d._vlookat, a = d._camroll, x = b.webgl ? d._fisheye : 0, v = d._fisheyefovlink, r = d._stereographic, k = 0, y = 0 == ia.bouncinglimits || 0 == Pa.isBouncing();\n y && (e < d.fovmin && (e = d.fovmin), e > d.fovmax && (e = d.fovmax));\n 179 < e && (e = 179);\n if (0 < x) {\n var l = m(e, d._fovtype, \"VFOV\");\n r ? (170 < e && (e = 170), k = 1E3 * x * Math.sin(Math.pow(Math.min(l / 130, 1), 2 * v) * Ga * .5)) : (x += Math.pow(Math.min(x, 1), 10) / 10, k = x * Math.sin(Math.pow(l / 180, v) * Ga * .5), k *= 3E3 * k)\n }\n var u = F(d.limitview), h = M && M.fovlimits, c = 0, K = 0, D = 0, v = Number(d.hlookatmin), l = Number(d.hlookatmax), z = Number(d.vlookatmin), q = Number(d.vlookatmax);\n \"auto\" == u && (v = l = z = q = Number.NaN);\n isNaN(v) && (v = h ? h[0] : -180);\n isNaN(l) && (l = h ? h[1] : 180);\n isNaN(z) && (z = h ? h[2] : -90);\n isNaN(q) && (q = h ? h[3] : 90);\n \"auto\" == u && (p.hlookatmin = v, p.hlookatmax = l, p.vlookatmin = z, p.vlookatmax = q, u = \"range\");\n q < z && (h = z, z = q, q = h);\n l < v && (h = v, v = l, l = h);\n var J = !1, C = !1, L = _[123] != u, A = !0, A = 180, h = l - v, H = q - z;\n switch (u) {\n case \"off\":\n case _[31]:\n h = 360;\n v = -180;\n l = 180;\n z = -1E5;\n q = 1E5;\n L = !1;\n break;\n case _[379]:\n L = !0;\n case _[123]:\n C = !0;\n case \"range\":\n if ((J = 360 > h) || 180 > H)D = m(e, d._fovtype, \"HFOV\"), D > h && (A = !0, C && m(h, \"HFOV\", \"VFOV\") < H && (A = J = !1), D = h, L && A && (e = m(D, \"HFOV\", d._fovtype))), c = m(e, d._fovtype, \"VFOV\"), c > H && (A = !0, C && m(H, \"VFOV\", \"HFOV\") < h && (A = J = !1), c = H, L && A && (e = m(c, \"VFOV\", d._fovtype))), m(e, d._fovtype, \"HFOV\"), A = c, K = c *= .5, D *= .5, -89.9 >= z && (c = 0), 89.9 <= q && (K = 0)\n }\n u = [360, -180, 180, c + K, z + c, q - K];\n y && (w - c < z ? (w = z + c, Pa.stopFrictions(2)) : w + K > q && (w = q - K, Pa.stopFrictions(2)));\n J && (D = -w * Y, K = .5 * Qa, c = .5 * ya, z = c / Math.tan(A * Y * .5), 0 < D && (c = -c), K = 1 / Math.sqrt(1 + (K * K + c * c) / (z * z)), c = c / z * K, z = Math.acos(-K * Math.sin(D) + c * Math.cos(D)) - Ga / 2, isNaN(z) && (z = -Ga / 2), K = Math.acos((K * Math.cos(D) + c * Math.sin(D)) / Math.sin(z + Ga / 2)), isNaN(K) && (K = 0), D = 180 * K / Ga, 2 * D >= h && (L && (D = m(h, \"HFOV\", d._fovtype), D < e && (e = D)), D = h / 2));\n 360 > h && (L = !1, u[0] = h, u[1] = v + D, u[2] = l - D, y && (f - D < v ? (f = v + D, L = !0) : f + D > l && (f = l - D, L = !0)), L && (Pa.stopFrictions(1), 0 != za.currentmovingspeed && (za.currentmovingspeed = 0, za.speed *= -1)));\n d._limits = u;\n d._fov = e;\n d._hlookat = f;\n d._vlookat = w;\n e = m(e, d._fovtype, \"MFOV\");\n 0 < x && 0 == r ? (l = m(e, \"MFOV\", \"VFOV\"), x = Math.asin(1E3 * Math.sin(l * Y * .5) / (1E3 + .72 * k)), x = .5 * ya / Math.tan(x)) : x = .5 * uc / Math.tan(e / 114.591559);\n d.hfov = m(e, \"MFOV\", \"HFOV\");\n d.vfov = m(e, \"MFOV\", \"VFOV\");\n d.r_fov = e;\n d.r_zoom = x;\n d.r_zoff = k;\n d.r_vlookat = w;\n r = Number(d._architectural);\n y = 0;\n 0 < r && (1 == d._architecturalonlymiddle && (y = Math.abs(w / 90), 1 < y && (y = 1), y = Math.tan(y * Ga * .25), r *= 1 - y), y = r * (-w * (ya / Math.tan(m(e, \"MFOV\", \"VFOV\") / 114.591559)) / 90), w *= 1 - r);\n d.r_yoff = y;\n Yd(d.r_rmatrix, f, w, a);\n d.r_hlookat = f;\n d.r_vlookatA = w;\n d.r_roll = a;\n e = 0 == b.realDesktop && b.ios && 5 > b.iosversion || b.androidstock || be ? \"\" : \"px\";\n ic = 0 == b.simulator && (b.iphone || b.ipad) ? .25 : 1;\n b.ie && (ic = p.r_zoom / 1E3 * 10);\n if (b.androidstock || b.android && b.chrome || b.blackberry)ic = p.r_zoom / 1E3 / 4;\n $d = _[303] + x + e + _[106] + -a + _[86] + (x - k / 2 * ic) + \"px) \";\n d.haschanged = !1\n };\n d.getState = function (a) {\n null == a && (a = {h: 0, v: 0, z: 0, r: 0, zf: 0, yf: 0, ch: 0, vr: null});\n a.h = d._hlookat;\n a.v = d.r_vlookatA;\n a.z = d.r_zoom;\n a.r = d._camroll;\n a.zf = d.r_zoff;\n a.yf = d.r_yoff;\n a.ch = d._pannini;\n return a\n };\n d.defaults()\n }, uf = function () {\n var a = this;\n a.defaults = function () {\n a.usercontrol = \"all\";\n a.mousetype = _[27];\n a.touchtype = _[485];\n a.mouseaccelerate = 1;\n a.mousespeed = 10;\n a.mousefriction = .8;\n a.mouseyfriction = 1;\n a.mousefovchange = 1;\n a.keybaccelerate = .5;\n a.keybspeed = 10;\n a.keybfriction = .9;\n a.keybfovchange = .75;\n a.keybinvert = !1;\n a.fovspeed = 3;\n a.fovfriction = .9;\n a.camrollreset = !0;\n a.keycodesleft = \"37\";\n a.keycodesright = \"39\";\n a.keycodesup = \"38\";\n a.keycodesdown = \"40\";\n a.keycodesin = \"\";\n a.keycodesout = \"\";\n a.touchfriction = .87;\n a.touchzoom = !0;\n a.zoomtocursor = !1;\n a.zoomoutcursor = !0;\n a.disablewheel = !1;\n a.bouncinglimits = !1;\n a.preventTouchEvents = !0\n };\n a.defaults()\n }, vf = function () {\n var a = this;\n a.standard = _[5];\n a.dragging = \"move\";\n a.moving = \"move\";\n a.hit = _[18];\n a.update = function (b, m) {\n void 0 === b && (b = O.down);\n var f = F(ia.mousetype);\n V.controllayer.style.cursor = b ? _[27] == f ? a.moving : a.dragging : m ? a.hit : a.standard\n }\n }, rf = function () {\n var a = this;\n a.haschanged = !1;\n a.mode = _[50];\n a.pixelx = 0;\n a.pixely = 0;\n a.pixelwidth = 0;\n a.pixelheight = 0;\n va(a, _[50], _[66]);\n va(a, \"x\", \"0\");\n va(a, \"y\", \"0\");\n va(a, _[49], \"100%\");\n va(a, _[28], \"100%\");\n va(a, \"left\", \"0\");\n va(a, \"top\", \"0\");\n va(a, _[3], \"0\");\n va(a, _[2], \"0\");\n a.calc = function (b, m) {\n var f = 1 / X, g = _[71] == F(a.mode), n = g ? a._left : a._x, k = g ? a._top : a._y, e = g ? a._right : a._width, p = g ? a._bottom : a._height, n = 0 < n.indexOf(\"%\") ? parseFloat(n) / 100 * b * f : Number(n), e = 0 < e.indexOf(\"%\") ? parseFloat(e) / 100 * b * f : Number(e), k = 0 < k.indexOf(\"%\") ? parseFloat(k) / 100 * m * f : Number(k), p = 0 < p.indexOf(\"%\") ? parseFloat(p) / 100 * m * f : Number(p), n = n / f, k = k / f, e = e / f, p = p / f;\n g ? (e = b - n - e, p = m - k - p) : (g = F(a._align), 0 <= g.indexOf(\"left\") || (n = 0 <= g.indexOf(_[3]) ? b - e - n : (b - e) / 2 + n), 0 <= g.indexOf(\"top\") || (k = 0 <= g.indexOf(_[2]) ? m - p - k : (m - p) / 2 + k));\n a.pixelx = Math.round(n * f);\n a.pixely = Math.round(k * f);\n g = !1;\n n = Math.round(e);\n e = Math.round(p);\n if (Qa != n || ya != e)g = !0, Qa = n, ya = e;\n a.pixelwidth = n * f;\n a.pixelheight = e * f;\n a.haschanged = !1;\n return g\n }\n }, Wc = !1, Ob = function () {\n function a() {\n var a = c._alpha;\n _[1] == c._type && (a *= qc);\n var b = 255 * a | 0;\n b == c._aa || c.GL || (c.sprite && (c.sprite.style.opacity = a, c._aa = b), c._poly && (c._poly.style.opacity = a, c._aa = b));\n c._autoalpha && (a = 0 < a, a != c._visible && (c.visible = a))\n }\n\n function d() {\n if (c.sprite && null != c._zorder) {\n var a = parseInt(c._zorder);\n !isNaN(a) && 0 <= a ? (c.sprite.style.zIndex = J + a, c._zdeep = a, c._deepscale = 100 / (200 + a)) : (c._zdeep = 0, c._deepscale = .5)\n }\n _[1] == c._type && (Wc = !0)\n }\n\n function p() {\n c.sprite && (c.sprite.style.overflow = c._maskchildren ? _[6] : _[12], z && b.safari && u())\n }\n\n function f(a, b) {\n b && (b = a._enabled) && _[15] == a.type && (b = 0 != a.bgcapture);\n a._enabledstate = 1 * b + 2 * a._handcursor;\n var c = a.sprite.style;\n c.cursor = b && a._handcursor ? _[18] : _[5];\n c.pointerEvents = b ? \"auto\" : \"none\";\n 0 == b && a.hovering && (a.hovering = !1);\n if (c = a._childs) {\n var d, e, g;\n e = c.length;\n for (d = 0; d < e; d++)(g = c[d]) && g.sprite && f(g, b)\n }\n }\n\n function g() {\n if (c.sprite) {\n var a = c._enabled;\n z && (a &= c.bgcapture);\n if (a && c._parent)a:{\n for (a = n(c._parent); a;) {\n if (0 == a._enabled || 0 == a.children) {\n a = !1;\n break a\n }\n if (a._parent)a = n(a._parent); else break\n }\n a = !0\n }\n 1 * a + 2 * c._handcursor != c._enabledstate && f(c, a)\n }\n }\n\n function n(a) {\n var b = null;\n if (a) {\n var b = a = F(a), c = xa, d = a.indexOf(\"[\");\n 0 < d && (b = a.slice(0, d), _[1] == b && (c = Ua), a = a.slice(d + 1, a.indexOf(\"]\")));\n if (\"stage\" == b)return null == Ra.sprite && (Ra.sprite = V.viewerlayer, Ra.loaded = !0), Ra;\n if (_[468] == b)return null == Za.sprite && (a = Ja(), b = a.style, b.position = _[0], b.width = \"100%\", b.height = \"100%\", b.overflow = _[6], b.zIndex = \"0\", b.pointerEvents = \"none\", V.controllayer.parentNode.insertBefore(a, V.controllayer), Za.sprite = a, Za.loaded = !0), Za;\n b = c.getItem(a)\n }\n return b\n }\n\n function k(a) {\n if (c._parent != a) {\n if (c._parent) {\n var b = n(c._parent);\n if (b) {\n var d = b._childs;\n if (d) {\n var e, f;\n f = d.length;\n for (e = 0; e < f; e++)if (d[e] === c) {\n d.splice(e, 1);\n f--;\n break\n }\n 0 == f && (d = null);\n b._childs = d;\n b.poschanged = !0\n }\n }\n }\n a && ((b = n(a)) ? b.sprite ? (null == b._childs && (b._childs = []), b._use_css_scale = !1, c._use_css_scale = !1, b._childs.push(c), b.sprite.appendChild(c.sprite), b.poschanged = !0) : setTimeout(function () {\n c._parent = null;\n k(a)\n }, 16) : a = null);\n null == a && V.pluginlayer.appendChild(c.sprite);\n c._parent = a;\n c.poschanged = !0;\n g()\n }\n }\n\n function e(a) {\n (a = this.kobject) && 0 == D && (a = a.url, 0 < F(a).indexOf(\".swf\") ? la(2, c._type + \"[\" + c.name + _[78] + Vd(a)) : (a && _[74] == a.slice(0, 5) && 50 < a.length && (a = a.slice(0, 50) + \"...\"), la(3, c._type + \"[\" + c.name + _[85] + a)))\n }\n\n function w(a) {\n if (S && (Pa.trackTouch(a), ba(L, a.type, w, !0), _[4] == a.type ? (aa.body.style.webkitUserSelect = aa.body.style.backupUserSelect, ba(L, _[10], x, !0), ba(L, _[4], w, !0)) : (ba(L, b.browser.events.touchmove, x, !0), ba(L, b.browser.events.touchend, w, !0)), S.pressed)) {\n S.pressed = !1;\n if (S._ondowncrop || S._onovercrop)S.hovering && S._onovercrop ? h(S, S._onovercrop) : h(S, S._crop);\n da.callaction(S.onup, S);\n K || da.blocked || da.callaction(S.onclick, S)\n }\n }\n\n function x(a, c) {\n var d = a.changedTouches && 0 < a.changedTouches.length ? a.changedTouches[0] : a, e = d.pageX, d = d.pageY;\n !0 === c ? I = [e, d] : I ? 0 == K && (e -= I[0], d -= I[1], Math.sqrt(e * e + d * d) >= (b.touchdevice ? 11 : 4) && (K = !0)) : (I = null, ba(L, a.type, x, !0))\n }\n\n function v(a, d) {\n var e = a.timeStamp | 0, f = !0;\n switch (a.type) {\n case _[34]:\n case _[8]:\n case _[16]:\n 1 == d && (e = _[15] == S.type, y(S) && (!e || e && S.bgcapture) && S._handcursor && (c.sprite.style.cursor = _[18]));\n e = S.sprite;\n for (f = 0; e;) {\n var g = e.kobject;\n if (g) {\n var k = g._enabled;\n 0 == b.pointerEvents && (k = y(g));\n if (0 == k || 0 < f && 0 == g.children)return;\n f++;\n e = e.parentNode\n } else break\n }\n for (f = S.sprite; f;) {\n if (g = f.kobject)g.enabled && 0 == g.hovering && (g.hovering = !0, 0 == g.pressed && g._onovercrop && h(g, g._onovercrop), da.blocked || da.callaction(g.onover, g)); else break;\n f = f.parentNode\n }\n break;\n case _[35]:\n case _[9]:\n case _[17]:\n for (e = (f = a.relatedTarget) ? f.kobject : null; f && null == e;)if (f = f.parentNode)e = f.kobject; else break;\n for (f = S.sprite; f;) {\n if (g = f.kobject) {\n for (var k = !1, l = e; l;) {\n if (g == l) {\n k = !0;\n break\n }\n if (l.sprite && l.sprite.parentNode)l = l.sprite.parentNode.kobject; else break\n }\n if (0 == k)1 == g.hovering && (g.hovering = !1, 0 == g.pressed && g._onovercrop && h(g, g._crop), da.callaction(g.onout, g)); else break\n } else break;\n f = f.parentNode\n }\n break;\n case _[7]:\n if (500 < e && 500 > e - kc) {\n kc = 0;\n break\n }\n if (f = 0 == (a.button | 0))aa.body.style.backupUserSelect = aa.body.style.webkitUserSelect, aa.body.style.webkitUserSelect = \"none\", x(a, !0), R(L, _[4], w, !0), R(L, _[10], x, !0), K = !1, S.pressed = !0, S._ondowncrop && h(S, S._ondowncrop), da.blocked || da.callaction(S.ondown, S);\n break;\n case b.browser.events.touchstart:\n kc = e;\n Pa.trackTouch(a);\n if (Pa.isMultiTouch())break;\n K = !1;\n if (f = 0 == (a.button | 0))x(a, !0), R(L, b.browser.events.touchend, w, !0), R(L, b.browser.events.touchmove, x, !0), S.pressed = !0, S._ondowncrop && h(S, S._ondowncrop), da.blocked || da.callaction(S.ondown, S)\n }\n }\n\n function r(a, b) {\n if (a === b)return !1;\n for (; b && b !== a;)b = b.parentNode;\n return b === a\n }\n\n function y(a) {\n if (a._enabled) {\n for (a = a.sprite; a;)if ((a = a.parentNode) && a.kobject && 0 == a.kobject._enabled)return !1;\n return !0\n }\n return !1\n }\n\n function l(a) {\n cb = Ta();\n var d = a.type;\n if (_[7] != d && d != b.browser.events.touchstart || !da.isblocked()) {\n var e = a.target.kobject;\n _[34] == d ? d = _[8] : _[35] == d && (d = _[9]);\n null == e && (e = c);\n if ((_[8] != d && _[9] != d || 4 == a.pointerType || _[19] == a.pointerType) && e) {\n var e = a.timeStamp, f = c._eP;\n e != c._eT && (f = 0);\n if (_[16] == d || _[8] == d) {\n var h = a.relatedTarget;\n if (this === h || r(this, h))return\n } else if (_[17] == d || _[9] == d)if (h = a.relatedTarget, this === h || r(this, h))return;\n 0 == e && (_[16] == d && 0 == c.hovering ? f = 0 : _[17] == d && 1 == c.hovering && (f = 0));\n d = c._enabled;\n 0 == b.pointerEvents && (d = y(c));\n if (d && (!z || z && c.bgcapture))0 == c.children && a.stopPropagation(), 0 == f && (0 == c.children && 1 == a.eventPhase || 2 <= a.eventPhase) && (f = 1, c.jsplugin && c.jsplugin.hittest && (d = V.getMousePos(a.changedTouches ? a.changedTouches[0] : a, c.sprite), c.jsplugin.hittest(d.x * c.imagewidth / c.pixelwidth, d.y * c.imageheight / c.pixelheight) || (f = 2)), 1 == f && (S = c, v(a), c.capture && (null != c.jsplugin && r(V.controllayer, c.sprite) || 0 == (a.target && \"A\" == a.target.nodeName) && Aa(a), a.stopPropagation()))); else if (0 == b.pointerEvents && aa.msElementsFromPoint && 0 == f && 2 == a.eventPhase && (h = a.type, d = _[4] == h || _[17] == h || _[35] == h || _[9] == h || h == b.browser.events.touchend, _[7] == h || _[16] == h || _[34] == h || _[8] == h || h == b.browser.events.touchstart || d) && (h = aa.msElementsFromPoint(a.clientX, a.clientY))) {\n var k = [], l, n, m = null, m = null;\n for (l = 0; l < h.length; l++)if (m = h[l], m = m.kobject)k.push(m); else break;\n d && g();\n if (d && Z)for (l = 0; l < Z.length; l++) {\n var m = Z[l], p = !1;\n for (n = 0; n < k.length; n++)k[n] === m && (p = !0);\n 0 == p && (f = 1, S = m, v(a, !0), m.capture && (null == c.jsplugin && Aa(a), a.stopPropagation()))\n }\n for (l = 0; l < h.length; l++)if (m = h[l], m = m.kobject) {\n if (n = _[15] == m.type, 1 == (y(m) && (!n || n && m.bgcapture)) || d)if (f = 1, S = m, v(a, !0), m.capture) {\n null == c.jsplugin && Aa(a);\n a.stopPropagation();\n break\n }\n } else break;\n Z = k\n }\n c._eT = e;\n c._eP = f\n }\n }\n }\n\n function u() {\n var a = c.sprite;\n if (a) {\n var a = a.style, d = Number(c._bgcolor), e = Number(c._bgalpha), f = X;\n isNaN(d) && (d = 0);\n isNaN(e) && (e = 0);\n var g = (\"\" + c._bgborder).split(\" \"), h = Ib(g[0], f, \",\"), k = g[1] | 0, g = Number(g[2]);\n isNaN(g) && (g = 1);\n if (h[0] != q[0] || h[3] != q[3])q = h, c.poschanged = !0;\n 0 == e ? a.background = \"none\" : a.backgroundColor = ca(d, e);\n var d = Ib(c.bgroundedge, f * c._scale, \" \"), e = \"\", l = c.bgshadow;\n if (l) {\n var n = (\"\" + l).split(\",\"), m, p;\n p = n.length;\n for (m = 0; m < p; m++) {\n var r = Ha(n[m]).split(\" \"), u = r.length;\n if (4 < u) {\n var v = 5 < u ? 1 : 0;\n \"\" != e && (e += \", \");\n e += r[0] * f + \"px \" + r[1] * f + \"px \" + r[2] * f + \"px \" + (v ? r[3] * f : 0) + \"px \" + ca(r[3 + v] | 0, r[4 + v]) + (6 < u ? \" \" + r[6] : \"\")\n }\n }\n }\n if (b.safari || b.ios)a.webkitMaskImage = c._maskchildren && !l && 0 < d[0] + d[1] + d[2] + d[3] ? _[167] : \"\";\n a[pc] = e;\n a.borderStyle = \"solid\";\n a.borderColor = ca(k, g);\n a.borderWidth = h.join(\"px \") + \"px\";\n a.borderRadius = d.join(\"px \") + \"px\"\n }\n }\n\n function h(a, b) {\n var c = 0, d = 0, e = a.loader;\n e && (c = e.naturalWidth, d = e.naturalHeight);\n b && (b = String(b).split(\"|\"), 4 == b.length && (c = b[2], d = b[3]));\n null == a.jsplugin && 0 == a._isNE() && (a.imagewidth = c, a.imageheight = d, e = a._gOSF(), e & 1 && (a._width = String(c)), e & 2 && (a._height = String(d)));\n a.updatepos()\n }\n\n var c = this;\n c.prototype = Fb;\n this.prototype.call(this);\n c._type = _[29];\n c.layer = c.plugin = new bb(Ob);\n c.createvar = function (a, b, d) {\n var e = \"_\" + a;\n c[e] = void 0 === b ? null : b;\n c.__defineGetter__(a, function () {\n return c[e]\n });\n void 0 !== d ? c.__defineSetter__(a, function (a) {\n c[e] = a;\n d()\n }) : c.__defineSetter__(a, function (a) {\n c[e] = a;\n c.poschanged = !0\n })\n };\n var K = !1, D = !1, z = !1, q = [0, 0, 0, 0], J = 0, C = 3, Q = !1;\n c._isNE = function () {\n return D\n };\n c._gOSF = function () {\n return C\n };\n c.haveUserWidth = function () {\n return 0 == (C & 1)\n };\n c.haveUserHeight = function () {\n return 0 == (C & 2)\n };\n c.sprite = null;\n c.loader = null;\n c.jsplugin = null;\n c._use_css_scale = !1;\n c._finalxscale = 1;\n c._finalyscale = 1;\n c._hszscale = 1;\n c._eT = 0;\n c._eP = 0;\n c._pCD = !1;\n c.MX = Ma();\n c.__defineGetter__(\"type\", function () {\n return _[57] == c.url ? _[15] : _[75]\n });\n c.__defineSetter__(\"type\", function (a) {\n _[15] == F(a) && (c.url = _[57])\n });\n c.imagewidth = 0;\n c.imageheight = 0;\n c.pixelwidth = 0;\n c.pixelheight = 0;\n c._pxw = 0;\n c._pxh = 0;\n c.pressed = !1;\n c.hovering = !1;\n c.loading = !1;\n c.loaded = !1;\n c.loadedurl = null;\n c.loadingurl = null;\n c.preload = !1;\n c._ispreload = !1;\n c.keep = !1;\n c.poschanged = !1;\n c.style = null;\n c.capture = !0;\n c.children = !0;\n c.pixelx = 0;\n c.pixely = 0;\n c._deepscale = .5;\n c._zdeep = 0;\n c.accuracy = 0;\n c._dyn = !1;\n c.onloaded = null;\n c.altonloaded = null;\n c.maxwidth = 0;\n c.minwidth = 0;\n c.maxheight = 0;\n c.minheight = 0;\n c.onover = null;\n c.onhover = null;\n c.onout = null;\n c.onclick = null;\n c.ondown = null;\n c.onup = null;\n c.onloaded = null;\n var A = c.createvar, H = function (a, b) {\n var d = \"_\" + a;\n c[d] = null;\n c.__defineGetter__(a, function () {\n return c[d]\n });\n c.__defineSetter__(a, b)\n };\n A(_[472], !0, g);\n A(_[353], !0, g);\n A(_[302], !1, p);\n A(_[415], null, function () {\n var a = c._jsborder;\n 0 >= parseInt(a) && (c._jsborder = a = null);\n c.sprite && (c.sprite.style.border = a);\n null != a && (c._use_css_scale = !1)\n });\n A(_[512], null, function () {\n if (null != c.sprite) {\n var a = c._alturl;\n c._alturl = null;\n c.url = a\n }\n });\n A(\"url\", null, function () {\n if (\"\" == c._url || \"null\" == c._url)c._url = null;\n null != c._url ? c.reloadurl() : (c.jsplugin && c.jsplugin.unloadplugin && c.jsplugin.unloadplugin(), c.jsplugin = null, c.loadedurl = null, c.loadingurl = null, c.loading = !1, c.loaded = !1)\n });\n A(\"scale\", 1, function () {\n c.poschanged = !0;\n z && u()\n });\n A(_[277], !1, function () {\n Q = !0\n });\n A(_[516], 0);\n A(\"alpha\", 1, a);\n A(_[403], !1, a);\n A(_[503], null, d);\n H(_[12], function (a) {\n a = pa(a);\n if (c._visible != a && (c._visible = a, c._poly && (c._poly.style.visibility = a ? _[12] : _[6]), c.sprite)) {\n var b = !0;\n c.jsplugin && c.jsplugin.onvisibilitychanged && (b = !0 !== c.jsplugin.onvisibilitychanged(a));\n b && (0 == a ? c.sprite.style.display = \"none\" : c.poschanged = !0)\n }\n });\n c._visible = !0;\n A(\"crop\", null, function () {\n h(c, c._crop)\n });\n c._childs = null;\n c._parent = null;\n c.__defineGetter__(_[149], function () {\n return c._parent\n });\n c.__defineSetter__(_[149], function (a) {\n if (null == a || \"\" == a || \"null\" == F(a))a = null;\n c.sprite ? k(a) : c._parent = a\n });\n for (var N = [_[50], \"edge\", _[341], _[339]], ea = 0; ea < N.length; ea++)A(N[ea]);\n H(_[49], function (a) {\n 0 == 0 * parseFloat(a) ? C &= 2 : a && \"prop\" == a.toLowerCase() ? (a = \"prop\", C &= 2) : (a = null, C |= 1);\n c._width = a;\n c.poschanged = !0\n });\n H(_[28], function (a) {\n 0 == 0 * parseFloat(a) ? C &= 1 : a && \"prop\" == a.toLowerCase() ? (a = \"prop\", C &= 1) : (a = null, C |= 2);\n c._height = a;\n c.poschanged = !0\n });\n H(\"x\", function (a) {\n 0 != 0 * parseFloat(a) && (a = null);\n c._x = a;\n c.poschanged = !0\n });\n H(\"y\", function (a) {\n 0 != 0 * parseFloat(a) && (a = null);\n c._y = a;\n c.poschanged = !0\n });\n H(\"ox\", function (a) {\n 0 != 0 * parseFloat(a) && (a = null);\n c._ox = a;\n c.poschanged = !0\n });\n H(\"oy\", function (a) {\n 0 != 0 * parseFloat(a) && (a = null);\n c._oy = a;\n c.poschanged = !0\n });\n c.loadstyle = function (a) {\n da.assignstyle(c.getfullpath(), a)\n };\n c.getmouse = function (a) {\n var b = 0, d = 0, d = V.controllayer, e = c.sprite, f = d.getBoundingClientRect(), g = e.getBoundingClientRect(), b = O.x - g.left - e.clientLeft + f.left + d.clientLeft, d = O.y - g.top - e.clientTop + f.top + d.clientTop;\n a && (b = b * c.imagewidth / c.pixelwidth, d = d * c.imageheight / c.pixelheight);\n return {x: b, y: d}\n };\n c._assignEvents = function (a) {\n Pa.touch && (R(a, b.browser.events.touchstart, l, !0), R(a, b.browser.events.touchstart, l, !1));\n Pa.mouse && (R(a, _[7], l, !0), R(a, _[7], l, !1));\n b.desktop && (Pa.mouse || b.ie) && (0 == Pa.mouse && b.ie ? (R(a, b.browser.events.pointerover, l, !0), R(a, b.browser.events.pointerover, l, !1), R(a, b.browser.events.pointerout, l, !0), R(a, b.browser.events.pointerout, l, !1)) : (R(a, _[16], l, !0), R(a, _[16], l, !1), R(a, _[17], l, !0), R(a, _[17], l, !1)))\n };\n c.create = function () {\n c._pCD = !0;\n c.alturl && (c.url = c.alturl, c._alturl = null);\n c.altscale && (c.scale = c.altscale, delete c.altscale);\n var b = c.sprite = Ja(), f = c.loader = Ja(1);\n b.kobject = c;\n f.kobject = c;\n b.style.display = \"none\";\n b.style.position = _[0];\n J = _[29] == c._type ? 3001 : 2001;\n b.style.zIndex = J;\n p();\n g();\n a();\n d();\n c._jsborder && (c.jsborder = c._jsborder);\n c._assignEvents(b);\n R(f, _[48], e, !0);\n R(f, \"load\", c.loadurl_done, !1);\n if (b = c._parent)c._parent = null, k(b);\n null != c._url && c.reloadurl()\n };\n c.destroy = function () {\n c.jsplugin && c.jsplugin.unloadplugin && c.jsplugin.unloadplugin();\n c._GL_onDestroy && c._GL_onDestroy();\n c.jsplugin = null;\n c.loaded = !1;\n c._destroyed = !0;\n c.parent = null;\n var a = c._childs;\n if (a) {\n var b, d, a = a.slice();\n d = a.length;\n for (b = 0; b < d; b++)a[b].parent = null;\n c._childs = null\n }\n };\n c.getfullpath = function () {\n return c._type + \"[\" + c.name + \"]\"\n };\n c.changeorigin = function () {\n var a = arguments, b = null, d = null;\n if (0 < a.length) {\n var e = null, f = 0, g = 0, h = 0, k = 0, l = X, m = Qa / l, p = ya / l, q = c._parent;\n q && (q = n(q)) && (0 == c._use_css_scale ? (m = q._pxw * l, p = q._pxh * l) : (m = q.imagewidth * l, p = q.imageheight * l));\n l = c.imagewidth;\n q = c.imageheight;\n b = 0;\n e = String(c._width);\n \"\" != e && null != e && (0 < e.indexOf(\"%\") ? l = parseFloat(e) / 100 * m : \"prop\" == e.toLowerCase() ? b = 1 : l = e);\n e = String(c._height);\n \"\" != e && null != e && (0 < e.indexOf(\"%\") ? q = parseFloat(e) / 100 * p : \"prop\" == e.toLowerCase() ? b = 2 : q = e);\n 1 == b ? l = q * c.imagewidth / c.imageheight : 2 == b && (q = l * c.imageheight / c.imagewidth);\n b = d = F(a[0]);\n 1 < a.length && (d = F(a[1]));\n var a = String(c._align), r = c._edge ? F(c._edge) : \"null\";\n if (\"null\" == r || _[498] == r)r = a;\n (e = String(c._x)) && (f = 0 < e.indexOf(\"%\") ? parseFloat(e) / 100 * m : parseFloat(e));\n isNaN(f) && (f = 0);\n (e = String(c._y)) && (g = 0 < e.indexOf(\"%\") ? parseFloat(e) / 100 * p : parseFloat(e));\n isNaN(g) && (g = 0);\n if (e = a)h = 0 <= e.indexOf(\"left\") ? 0 + f : 0 <= e.indexOf(_[3]) ? m - f : m / 2 + f, k = 0 <= e.indexOf(\"top\") ? 0 + g : 0 <= e.indexOf(_[2]) ? p - g : p / 2 + g;\n 1 != c._scale && (l *= c._scale, q *= c._scale);\n h = 0 <= r.indexOf(\"left\") ? h + 0 : 0 <= r.indexOf(_[3]) ? h + -l : h + -l / 2;\n k = 0 <= r.indexOf(\"top\") ? k + 0 : 0 <= r.indexOf(_[2]) ? k + -q : k + -q / 2;\n e = a = 0;\n a = 0 <= b.indexOf(\"left\") ? 0 + f : 0 <= b.indexOf(_[3]) ? m - f : m / 2 + f;\n e = 0 <= b.indexOf(\"top\") ? 0 + g : 0 <= b.indexOf(_[2]) ? p - g : p / 2 + g;\n a = 0 <= d.indexOf(\"left\") ? a + 0 : 0 <= d.indexOf(_[3]) ? a + -l : a + -l / 2;\n e = 0 <= d.indexOf(\"top\") ? e + 0 : 0 <= d.indexOf(_[2]) ? e + -q : e + -q / 2;\n c._align = b;\n c._edge = d;\n 0 <= b.indexOf(_[3]) ? c._x = String(f + a - h) : c._x = String(f - a + h);\n 0 <= b.indexOf(_[2]) ? c._y = String(g + e - k) : c._y = String(g - e + k)\n }\n };\n c.resetsize = function () {\n c.loaded && (c._width = String(c.imagewidth), c._height = String(c.imageheight), C = 3, c.poschanged = !0)\n };\n c.registercontentsize = function (a, b) {\n null != a && (c.imagewidth = Number(a), C & 1 && (c._width = String(a)));\n null != b && (c.imageheight = Number(b), C & 2 && (c._height = String(b)));\n c.poschanged = !0\n };\n var I = null, S = null, Z = null;\n\n\n\n\n /**\n * Created by sohow on 16-6-15.\n */\n\n var krpanoplugin2 = function () {\n function Er(e) {\n return \".yes.on.true.1\"[s]((\".\" + e)[c]()) >= 0\n }\n\n function Sr(e) {\n }\n\n function xr() {\n ar = 0;\n if (Tn[at] || _n)if (Tn[_]) {\n var e = (\"\" + navigator.userAgent)[c]()[s](\"ucbrowser\") > 0;\n Tn.chrome || Tn[Ht] ? ar = 2 : e && (ar = 2)\n } else ar = 2;\n if (ar > 0) {\n Vn == 0 && (ar = 1);\n if (Tn[E] && _n)setTimeout(Nr, 10); else {\n window[u](ar == 1 ? f : h, Cr, t);\n var i = Nn[l] != \"\" && Nn[l] != n;\n setTimeout(Nr, Tn[E] ? 10 : i ? 1500 : 3e3)\n }\n } else sr == t && (sr = r, xn[J](Nn[l], Nn))\n }\n\n function Tr() {\n sr == t && (sr = r, er = r, tr = r, nr = r, rr = t, Rr(), xn[J](Nn[O], Nn))\n }\n\n function Nr() {\n window[o](f, Cr, t), window[o](h, Cr, t), Tn[E] && _n ? Tr() : sr == t && (sr = r, xn[J](Nn[l], Nn))\n }\n\n function Cr(e) {\n window[o](e.type, Cr, t), e.type == f || e.type == h && e[K] && e.rotationRate ? (sr = r, er = r, tr = r, Tn[E] && (nr = r), Rr(), xn[J](Nn[O], Nn)) : Tn[E] && _n ? Tr() : sr == t && (sr = r, xn[J](Nn[l], Nn))\n }\n\n function jr(e) {\n var i;\n for (i = 0; i < e[kt]; i++)if (e[i] instanceof HMDVRDevice) {\n kr = e[i], kr[F] ? (Dr = kr[F](mt), Pr = kr[F](Tt), Ar = Dr[pn], Or = Pr[pn], Mr = Dr[Et], _r = Pr[Et]) : kr[$] && kr[C] && (Ar = kr[$](mt), Or = kr[$](Tt), Mr = kr[C](mt), _r = kr[C](Tt));\n var s = 2 * Math.max(Mr.leftDegrees, Mr.rightDegrees), o = 2 * Math.max(Mr.upDegrees, Mr.downDegrees);\n Br = Math.max(s, o);\n break\n }\n for (i = 0; i < e[kt]; i++)if (e[i] instanceof PositionSensorVRDevice)if (kr == n || kr[vn] == e[i][vn]) {\n Lr = e[i];\n break\n }\n kr || Lr ? (er = r, Xn == t && Tn[_] && (rr = r), xn[J](Nn[O], Nn)) : sr == t && (sr = r, xn[J](Nn[l], Nn))\n }\n\n function Ir(e) {\n Zn = e;\n if (e) {\n Fr = {\n imagehfov: xn.image.hfov,\n continuousupdates: xn[p][g],\n usercontrol: xn[y][it],\n mousetype: xn[y][St],\n contextmenu_touch: xn[Rt].touch,\n loadwhilemoving: xn[m][A],\n stereo: xn[m][Ct],\n stereooverlap: xn[m][j],\n hlookat: xn[p][V],\n vlookat: xn[p][jt],\n camroll: xn[p][an],\n fovmin: xn[p][ft],\n fovmax: xn[p][ht],\n fisheye: xn[p][X],\n fov: xn[p].fov,\n maxpixelzoom: xn[p][d],\n fovtype: xn[p][G],\n stereographic: xn[p][x],\n fisheyefovlink: xn[p][b],\n pannini: xn[p][nt],\n architectural: xn[p][v],\n limitview: xn[p][T],\n area_mode: xn[Lt].mode,\n area_align: xn[Lt].align,\n area_x: xn[Lt].x,\n area_y: xn[Lt].y,\n area_width: xn[Lt][Y],\n area_height: xn[Lt][N],\n maxmem: xn.memory[en]\n }, xn[Lt].mode = \"align\", xn[Lt].align = \"lefttop\", xn[Lt].x = \"0\", xn[Lt].y = \"0\", xn[Lt][Y] = \"100%\", xn[Lt][N] = \"100%\", xn[Rt].touch = t, xn[p][g] = r, nr && Tn[E] && !mr ? xn[y][St] = \"drag2d\" : xn[y][it] = \"off\", xn[m][Ct] = r, xn[m][A] = r, xn[p][T] = \"off\", xn[p][nt] = 0, xn[p][v] = 0, xn[p][G] = \"VFOV\", xn[p][ft] = 0, xn[p][ht] = 179, xn[p][X] = 0, xn[p].fov = Br, xn[p][d] = 0, xn[p][x] = r, xn[p][b] = 0, cr = xn[p][V], ci = 0, Tn[E] || (cr -= Ci()), ui();\n if (tr || rr)zr(0, 0), nr && Tn[E] && !mr || (xn[yt] = r);\n ri(), Dn && oi(r), xn.set(\"events[__webvr].keep\", r), xn.set(\"events[__webvr].onnewpano\", ii), xn.set(\"events[__webvr].onresize\", si), (tr || rr) && Ko(r), xn[J](Nn.onentervr, Nn)\n } else if (Fr) {\n xn.set(\"events[__webvr].name\", n), xn[p][g] = Fr[g], xn[y][it] = Fr[it], xn[y][St] = Fr[St], xn[Rt].touch = Fr.contextmenu_touch, xn[m][A] = Fr[A], xn[m][Ct] = Fr[Ct], xn[m][j] = Fr[j], xn[p][an] = 0;\n if (Fr.imagehfov == xn.image.hfov)xn[p][ft] = Fr[ft], xn[p][ht] = Fr[ht], xn[p].fov = Fr.fov, xn[p][d] = Fr[d], xn[p][G] = Fr[G], xn[p][T] = Fr[T], xn[p][X] = Fr[X], xn[p][x] = Fr[x], xn[p][b] = Fr[b], xn[p][nt] = Fr[nt], xn[p][v] = Fr[v]; else {\n var i = xn.xml[p];\n xn[p][ft] = i && !isNaN(Number(i[ft])) ? Number(i[ft]) : 1, xn[p][ht] = i && !isNaN(Number(i[ht])) ? Number(i[ht]) : 140, xn[p].fov = i && !isNaN(Number(i.fov)) ? Number(i.fov) : 90, xn[p][X] = i && !isNaN(Number(i[X])) ? Number(i[X]) : 0, xn[p][nt] = i && !isNaN(Number(i[nt])) ? Number(i[nt]) : 0, xn[p][v] = i && !isNaN(Number(i[v])) ? Number(i[v]) : 0, xn[p][d] = i && !isNaN(Number(i[d])) ? Number(i[d]) : 2, xn[p][G] = i && i[G] ? i[G] : \"MFOV\", xn[p][T] = i && i[T] ? i[T] : pt, xn[p][x] = r, xn[p][b] = .5\n }\n xn[Lt].mode = Fr.area_mode, xn[Lt].align = Fr.area_align, xn[Lt].x = Fr.area_x, xn[Lt].y = Fr.area_y, xn[Lt][Y] = Fr.area_width, xn[Lt][N] = Fr.area_height, xn[W] = -1, xn[D] = t, xn.memory[en] = Fr[en], Fr = n, Qn && (ji(Qn, t), Qn = n), Ko(t), oi(t), ui(), xn[J](Nn.onexitvr, Nn)\n }\n }\n\n function Rr() {\n if (qr)return qr;\n var e = \"Unknown\", t = 0, n = 1536, r = Math.min(screen[Y], screen[N]), i = Math.max(screen[Y], screen[N]), o = window.devicePixelRatio || 1;\n if (Tn.iphone)if (i == 568) {\n var u = xn.webGL.context, a = \"\" + u.getParameter(u.VERSION);\n a[s](\"A8 GPU\") > 0 ? (e = ln, t = 4.7) : (e = \"iPhone 5\", t = 4, n = 1024)\n } else i == 667 ? o == 2 ? (e = ln, t = 4.7) : (e = on, t = 5.5) : i == 736 && (e = on, t = 5.5); else {\n var f = navigator.userAgent[c]();\n f[s](\"gt-n710\") >= 0 ? (t = 5.5, e = \"Note 2\") : f[s](\"sm-n900\") >= 0 ? (t = 5.7, e = \"Note 3\") : f[s](\"sm-n910\") >= 0 ? (t = 5.7, e = \"Note 4\") : f[s](\"gt-i930\") >= 0 || f[s](sn) >= 0 ? (t = 4.7, e = \"Galaxy S3\") : f[s](\"gt-i950\") >= 0 || f[s](sn) >= 0 ? (t = 5, e = \"Galaxy S4\") : f[s](\"sm-g900\") >= 0 || f[s](\"sc-04f\") >= 0 || f[s](\"scl23\") >= 0 ? (t = 5.1, e = \"Galaxy S5\") : f[s](\"sm-g920\") >= 0 || f[s](\"sm-g925\") >= 0 ? (t = 5.1, e = \"Galaxy S6\") : f[s](\"lg-d85\") >= 0 || f[s](\"vs985\") >= 0 || f[s](\"lgls990\") >= 0 || f[s](\"lgus990\") >= 0 ? (t = 5.5, e = \"LG G3\") : f[s](\"lg-h810\") >= 0 || f[s](\"lg-h815\") >= 0 || f[s](\"lgls991\") >= 0 ? (t = 5.5, e = \"LG G4\") : f[s](\"xt1068\") >= 0 || f[s](\"xt1069\") >= 0 || f[s](\"xt1063\") >= 0 ? (t = 5.5, e = \"Moto G 2g\") : f[s](\"xt1058\") >= 0 ? (t = 5.2, e = \"Moto X 2g\") : f[s](\"d6653\") >= 0 || f[s](\"d6603\") >= 0 ? (t = 5.2, e = \"Xperia Z3\") : f[s](\"xperia z4\") >= 0 ? (t = 5.5, e = \"Xperia Z4\") : f[s](\"htc_p4550\") >= 0 || f[s](\"htc6525lv\") >= 0 || f[s](\"htc_pn071\") >= 0 ? (t = 5, e = \"One M8\") : f[s](\"nexus 4\") >= 0 ? (t = 4.7, e = \"Nexus 4\") : f[s](\"nexus 5\") >= 0 ? (t = 5, e = \"Nexus 5\") : f[s](\"nexus 6\") >= 0 ? (t = 6, e = \"Nexus 6\") : f[s](\"lumia 930\") >= 0 && (t = 5, e = \"Lumia 930\")\n }\n t == 0 && (xn[J](Nn[Nt], Nn), t = 5);\n var l = Math[Bt](t * t / (1 + r / i * (r / i))) * 25.4, h = l * r / i;\n return qr = {\n screendiagonal_inch: t,\n screenwidth_mm: l,\n screenheight_mm: h,\n screenwidth_px: i * o,\n screenheight_px: r * o,\n devicename: e,\n best_res: n\n }, qr\n }\n\n function Ur() {\n Fn < 1 ? Fn = 1 : Fn > 179.9 && (Fn = 179.9), In < 0 ? In = 0 : In > 5 && (In = 5);\n var e = qn[mn](\"|\"), t;\n for (t = 0; t < 4; t++) {\n var n = Number(e[t]);\n isNaN(n) && (n = t == 0 ? 1 : 0), Rn[t] = n\n }\n Un = Rn[0] != 1 || Rn[1] != 0 || Rn[2] != 0 || Rn[3] != 0, or[a] && (tr || rr) && (zr(0, 0), Ko(r))\n }\n\n function zr(e, n) {\n var i = Rr(), s = 0, o = 0, u = xn.webGL.canvas;\n if (u) {\n var a = Number(xn[m].framebufferscale);\n s = u[Y], o = u[N], !isNaN(a) && a != 0 && (s /= a, o /= a)\n }\n if (e <= 0 || n <= 0)e = s, n = o;\n var f = Fn, l = In;\n f = Math.tan(f * .5 * br), l = Math.exp(l) - 1;\n var c = Math.atan(f) * 2 / 2, h = l * 1e3, p = 1e3, d = p * Math.sin(c), v = p * Math.cos(c), g = 2 * Math.atan(d / (h + v));\n f = Math.tan(g / 2);\n var y = l, b = Hn;\n b /= jn;\n var w = i.screenwidth_mm, E = i.screenheight_mm;\n if (Bn > 0) {\n var S = Math.min(screen[Y], screen[N]), x = Math.max(screen[Y], screen[N]);\n w = Math[Bt](Bn * Bn / (1 + S / x * (S / x))) * 25.4, E = w * S / x\n }\n var T = w / 2 - b, C = 2 * (T / w), k = e, L = n, A = i.screenwidth_px, O = i.screenheight_px, M = r;\n if (nr || Tn.tablet || n > e)M = t;\n k <= 0 && (k = s), L <= 0 && (L = o);\n var _ = E / 70.9, D = f;\n D *= _, hr = _ / .69, M && (D *= L / O, C = 2 * (w * (k / A) / 2 - b) / (w * (k / A)));\n var P = 2 * Math.atan(D) * wr;\n pr = P, dr = y, vr = C, Wr()\n }\n\n function Wr() {\n var e = xn[p];\n pr > 0 && (e[X] = dr, e.fov = pr, e[ft] = pr, e[ht] = pr, e[d] = 0, e[G] = \"VFOV\", e[x] = r, e[b] = 0, e[T] = \"off\", xn[m][j] = vr)\n }\n\n function Xr() {\n return Tn[E] && kr && kr.deviceName ? kr.deviceName : (Rr(), qr ? qr[Gt] : \"\")\n }\n\n function Vr() {\n return qr ? qr.screendiagonal_inch : 0\n }\n\n function $r(e) {\n if ((\"\" + e)[c]() == pt)Bn = 0, Ur(); else {\n var t = parseFloat(e);\n if (isNaN(t) || t <= 0)t = 0;\n Bn = t, Ur()\n }\n }\n\n function Jr() {\n var e = Bn;\n return e <= 0 ? pt : e\n }\n\n function Kr() {\n return Tn[_] ? xn[m].viewerlayer : xn.webGL.canvas\n }\n\n function Qr() {\n xn.trace(0, \"update - stereo=\" + xn[m][Ct]), or[a] && (tr || rr) && (zr(0, 0), Ko(r))\n }\n\n function Gr() {\n if (er && Zn == t)if (tr == t) {\n var e = Kr();\n Sn[u](Tn[w][k][Yt], li), or[a] = r, Ir(r), ur = r, rr = t, Xn == t && Tn[_] && (rr = r), rr && (ur = t), e[Tn[w][k].requestfullscreen]({\n vrDisplay: kr,\n vrDistortion: ur\n }), Tn[at] && ei(xn[p][V]), ur == t && zr()\n } else {\n Sn[u](Tn[w][k][Yt], li), or[a] = r, Ir(r);\n if (Tn[at] || Tn.tablet)ar == 1 ? window[u](f, Mi, r) : ar == 2 && window[u](h, Bs, r);\n nr == t && Tn[w][k].touch && xn[y][$t][u](Tn[w][k][Kt], ni, t)\n }\n }\n\n function Yr() {\n or[a] = t, xn.get(yt) && xn.set(yt, t), window[o](f, Mi, r), window[o](h, Bs, r), Tn[w][k].touch && xn[y][$t][o](Tn[w][k][Kt], ni, t), Ir(t), xn[p].haschanged = r\n }\n\n function Zr() {\n er && (Zn ? Yr() : Gr())\n }\n\n function ei(e) {\n e === undefined ? e = 0 : (e = Number(e), isNaN(e) && (e = 0));\n var t = xn[p][V];\n if (Lr) {\n try {\n Lr.resetSensor !== undefined && Lr.resetSensor()\n } catch (n) {\n }\n try {\n Lr.zeroSensor !== undefined && Lr.zeroSensor()\n } catch (n) {\n }\n t = 0, cr = 0\n }\n nr && (xn[p][V] = e), cr = cr - t + e, ci = 0\n }\n\n function ni(e) {\n var i = t;\n if (Mn == t)i = r; else {\n var s = xn[y].getMousePos(e[fn] ? e[fn][0] : e);\n s.x /= xn.stagescale, s.y /= xn.stagescale;\n if (e.type == Tn[w][k][Kt])ti == n ? (ti = s, xn[y][$t][u](Tn[w][k][un], ni, r), xn[y][$t][u](Tn[w][k][gn], ni, r)) : i = r; else if (e.type == Tn[w][k][gn])i = r; else if (e.type == Tn[w][k][un] && ti) {\n var a = ti.x, f = s.x;\n if (xn[m][Ct]) {\n var l = xn.stagewidth * .5;\n (a >= l || f >= l) && (a < l || f < l) && (f = a)\n }\n var c = xn[cn](a, ti.y, t), h = xn[cn](f, s.y, t), p = h.x - c.x;\n ti = s, cr -= p\n }\n }\n i && (ti = n, xn[y][$t][o](Tn[w][k][un], ni, r), xn[y][$t][o](Tn[w][k][gn], ni, r))\n }\n\n function ri() {\n if (An == t)xn[W] = -1, xn[D] = t; else if (xn.image.type == \"cube\" && xn.image.multires) {\n var e = Rr().best_res, n = 0, s = -1, o = 0, u = xn.image.level.getArray(), a = u[kt];\n if (a > 0)for (i = 0; i < a; i++) {\n var f = u[i].tiledimagewidth, l = Math.abs(f - e);\n if (s == -1 || l < s)n = f, s = l, o = i\n }\n if (s > 0) {\n xn[W] = o, xn[D] = r;\n if (n > 0) {\n var c = 4 + 8 * (n * n * 6 + 1048575 >> 20);\n c > xn.memory[en] && (xn.memory[en] = c)\n }\n }\n }\n }\n\n function ii() {\n or[a] && ri()\n }\n\n function si() {\n ii(), Ur()\n }\n\n function ui() {\n fr = 0, ki.t = 0, Li.t = 0, yo(), So = 0, go = t, Ls = n\n }\n\n function fi(e) {\n ai == 1 ? (yr.apply(document), ai = 0) : (gr.apply(Kr()), ai = 1)\n }\n\n function li(e) {\n var n = Kr(), i = !!(Sn[Jt] || Sn[Mt] || Sn[zt] || Sn[gt] || Sn[qt]);\n if (i && or[a]) {\n try {\n Tn[E] && mr && (gr.apply(n), nr && (ai = 1, xn[y][$t][u](nn, fi, t)))\n } catch (s) {\n }\n Tn[E] && n[u](rn, hi, t)\n } else window[o](f, Mi, r), window[o](h, Bs, r), n[o](rn, hi, t), xn[y][$t][o](nn, fi, t), or[a] = t, Ir(t)\n }\n\n function hi(e) {\n var t = Kr();\n if (Sn.pointerLockElement === t || Sn.mozPointerLockElement === t) {\n var n = e.movementX || e.mozMovementX, r = e.movementY || e.mozMovementY;\n if (!isNaN(n)) {\n ci += n * kn;\n while (ci < 0)ci += Math.PI * 2;\n while (ci >= Math.PI * 2)ci -= Math.PI * 2\n } else n = 0;\n nr && (isNaN(r) && (r = 0), xn[p][V] += n * kn * wr, xn[p][jt] = Math.max(Math.min(xn[p][jt] + r * kn * wr, 120), -120))\n }\n }\n\n function pi(e, t, n, r) {\n this.x = e, this.y = t, this.z = n, this.w = r\n }\n\n function di(e) {\n var t = Math[Bt](e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w);\n t === 0 ? (e.x = e.y = e.z = 0, e.w = 1) : (t = 1 / t, e.x *= t, e.y *= t, e.z *= t, e.w *= t)\n }\n\n function vi(e) {\n e.x *= -1, e.y *= -1, e.z *= -1, di(e)\n }\n\n function mi(e, t) {\n return e.x * t.x + e.y * t.y + e.z * t.z + e.w * t.w\n }\n\n function gi(e) {\n return Math[Bt](e.x * e.x + e.y * e.y + e.z * e.z + e.w * e.w)\n }\n\n function yi(e, t) {\n var n = e.x, r = e.y, i = e.z, s = e.w, o = t.x, u = t.y, a = t.z, f = t.w;\n e.x = n * f + s * o + r * a - i * u, e.y = r * f + s * u + i * o - n * a, e.z = i * f + s * a + n * u - r * o, e.w = s * f - n * o - r * u - i * a\n }\n\n function bi(e, t) {\n var n = t.x, r = t.y, i = t.z, s = t.w, o = e.x, u = e.y, a = e.z, f = e.w;\n e.x = n * f + s * o + r * a - i * u, e.y = r * f + s * u + i * o - n * a, e.z = i * f + s * a + n * u - r * o, e.w = s * f - n * o - r * u - i * a\n }\n\n function wi(e, t, n) {\n var r = e.x, i = e.y, s = e.z, o = e.w, u = r * t.x + i * t.y + s * t.z + o * t.w;\n u < 0 ? (u = -u, e.x = -t.x, e.y = -t.y, e.z = -t.z, e.w = -t.w) : (e.x = t.x, e.y = t.y, e.z = t.z, e.w = t.w);\n if (u >= 1) {\n e.w = o, e.x = r, e.y = i, e.z = s;\n return\n }\n var a = Math.acos(u), f = Math[Bt](1 - u * u);\n if (Math.abs(f) < .001) {\n e.w = .5 * (o + e.w), e.x = .5 * (r + e.x), e.y = .5 * (i + e.y), e.z = .5 * (s + e.z);\n return\n }\n var l = Math.sin((1 - n) * a) / f, c = Math.sin(n * a) / f;\n e.w = o * l + e.w * c, e.x = r * l + e.x * c, e.y = i * l + e.y * c, e.z = s * l + e.z * c\n }\n\n function Ei(e, t, n) {\n var r = n / 2, i = Math.sin(r);\n e.x = t.x * i, e.y = t.y * i, e.z = t.z * i, e.w = Math.cos(r)\n }\n\n function Si(e, t, n, r, i) {\n var s = Math.cos(t / 2), o = Math.cos(n / 2), u = Math.cos(r / 2), a = Math.sin(t / 2), f = Math.sin(n / 2), l = Math.sin(r / 2);\n return i === \"XYZ\" ? (e.x = a * o * u + s * f * l, e.y = s * f * u - a * o * l, e.z = s * o * l + a * f * u, e.w = s * o * u - a * f * l) : i === Wt ? (e.x = a * o * u + s * f * l, e.y = s * f * u - a * o * l, e.z = s * o * l - a * f * u, e.w = s * o * u + a * f * l) : i === \"ZXY\" ? (e.x = a * o * u - s * f * l, e.y = s * f * u + a * o * l, e.z = s * o * l + a * f * u, e.w = s * o * u - a * f * l) : i === \"ZYX\" ? (e.x = a * o * u - s * f * l, e.y = s * f * u + a * o * l, e.z = s * o * l - a * f * u, e.w = s * o * u + a * f * l) : i === \"YZX\" ? (e.x = a * o * u + s * f * l, e.y = s * f * u + a * o * l, e.z = s * o * l - a * f * u, e.w = s * o * u - a * f * l) : i === \"XZY\" && (e.x = a * o * u - s * f * l, e.y = s * f * u - a * o * l, e.z = s * o * l + a * f * u, e.w = s * o * u + a * f * l), e\n }\n\n function xi(e, t, n) {\n var r, i, s, o, u, a, f, l, c, h, p, d;\n i = t.x, s = t.y, o = t.z, u = Math[Bt](i * i + s * s + o * o), u > 0 && (i /= u, s /= u, o /= u), a = n.x, f = n.y, l = n.z, c = Math[Bt](a * a + f * f + l * l), c > 0 && (a /= c, f /= c, l /= c), r = i * a + s * f + o * l + 1, r < 1e-6 ? (r = 0, Math.abs(i) > Math.abs(o) ? (h = -s, p = i, d = 0) : (h = 0, p = -o, d = s)) : (h = s * l - o * f, p = o * a - i * l, d = i * f - s * a), e.x = h, e.y = p, e.z = d, e.w = r, di(e)\n }\n\n function Ti(e, t, n) {\n function r(e, t, n) {\n return e < t ? t : e > n ? n : e\n }\n\n if (!t || isNaN(t.x) || isNaN(t.y) || isNaN(t.z) || isNaN(t.w))return;\n var i = t.x * t.x, s = t.y * t.y, o = t.z * t.z, u = t.w * t.w;\n if (n === \"XYZ\")e[0] = Math[tt](2 * (t.x * t.w - t.y * t.z), u - i - s + o), e[1] = Math.asin(r(2 * (t.x * t.z + t.y * t.w), -1, 1)), e[2] = Math[tt](2 * (t.z * t.w - t.x * t.y), u + i - s - o); else if (n === Wt)e[0] = Math.asin(r(2 * (t.x * t.w - t.y * t.z), -1, 1)), e[1] = Math[tt](2 * (t.x * t.z + t.y * t.w), u - i - s + o), e[2] = Math[tt](2 * (t.x * t.y + t.z * t.w), u - i + s - o); else if (n === \"ZXY\")e[0] = Math.asin(r(2 * (t.x * t.w + t.y * t.z), -1, 1)), e[1] = Math[tt](2 * (t.y * t.w - t.z * t.x), u - i - s + o), e[2] = Math[tt](2 * (t.z * t.w - t.x * t.y), u - i + s - o); else if (n === \"ZYX\")e[0] = Math[tt](2 * (t.x * t.w + t.z * t.y), u - i - s + o), e[1] = Math.asin(r(2 * (t.y * t.w - t.x * t.z), -1, 1)), e[2] = Math[tt](2 * (t.x * t.y + t.z * t.w), u + i - s - o); else if (n === \"YZX\")e[0] = Math[tt](2 * (t.x * t.w - t.z * t.y), u - i + s - o), e[1] = Math[tt](2 * (t.y * t.w - t.x * t.z), u + i - s - o), e[2] = Math.asin(r(2 * (t.x * t.y + t.z * t.w), -1, 1)); else {\n if (n !== \"XZY\")return;\n e[0] = Math[tt](2 * (t.x * t.w + t.y * t.z), u - i + s - o), e[1] = Math[tt](2 * (t.x * t.z + t.y * t.w), u + i - s - o), e[2] = Math.asin(r(2 * (t.z * t.w - t.x * t.y), -1, 1))\n }\n }\n\n function Ni(e, t) {\n var r, i, s, o;\n e == n ? (r = Math.tan(50 * br), i = Math.tan(50 * br), s = Math.tan(45 * br), o = Math.tan(45 * br)) : (r = Math.tan(e.upDegrees * br), i = Math.tan(e.downDegrees * br), s = Math.tan(e.leftDegrees * br), o = Math.tan(e.rightDegrees * br));\n var u = 2 / (s + o), a = 2 / (r + i);\n t[0] = u, t[1] = 0, t[2] = 0, t[3] = 0, t[4] = 0, t[5] = -a, t[6] = 0, t[7] = 0, t[8] = (s - o) * u * .5, t[9] = -((r - i) * a * .5), t[10] = 65535 / 65536, t[11] = 1, t[12] = 0, t[13] = 0, t[14] = 65535 / 65536 - 1, t[15] = 1\n }\n\n function Ci() {\n var e = Number.NaN, t = screen[Y] > screen[N], n = screen[st] || screen.msOrientation || screen.mozOrientation;\n if (n) {\n n = (\"\" + n)[c]();\n var r = n[s](\"portrait\") >= 0, i = n[s](\"landscape\") >= 0, o = n[s](\"primary\") >= 0, u = n[s](\"secondary\") >= 0;\n r && o ? e = 0 : i && o ? e = 90 : i && u ? e = -90 : r && u && (e = 180), !isNaN(e) && !Tn[at] && (e -= 90)\n }\n return isNaN(e) && (e = xn._have_top_access ? top[st] : window[st]), isNaN(e) && (Tn[at] ? e = t ? 90 : 0 : e = t ? 0 : 90), Tn.tablet && Tn[Ht] && (e += 90), e\n }\n\n function Mi(e) {\n if (!or[a])return;\n var t = xn[B], r = t - Hs;\n Hs = t;\n var i = Ci() * br, s = e.alpha * br, o = e.beta * br, u = e.gamma * br;\n Oi === n && (Oi = s), s = s - Oi + Math.PI;\n var f = Math.cos(s), l = Math.sin(s), c = Math.cos(o), h = Math.sin(o), p = Math.cos(u), d = Math.sin(u);\n s = Math[tt](-l * h * p - f * d, l * d - f * h * p), o = -Math.asin(c * p), u = Math[tt](c * d, -h) - Math.PI, ki.q.x = Li.q.x, ki.q.y = Li.q.y, ki.q.z = Li.q.z, ki.q.w = Li.q.w, ki.t = Li.t;\n var v = Li.q;\n Li.t = t, fr++, Si(v, o, s + i, u - i, Wt)\n }\n\n function _i() {\n if (or[a]) {\n xn[p][g] = r;\n var e = [0, 0, 0];\n if (Lr) {\n Hr = Lr.getState();\n if (Hr) {\n rr && Wr();\n if (Ln) {\n var t = Hr.position;\n if (t) {\n ci = 0;\n var i = 400;\n xn[p].tx = t.x * i, xn[p].ty = t.y * i, xn[p].tz = t.z * i\n }\n }\n Ti(e, Hr[st], Wt);\n var s = 0;\n Tn[_] && (s = Ci()), s += cr, xn[p][V] = (-e[1] + ci) * wr + s, xn[p][jt] = -e[0] * wr, xn[p][an] = -e[2] * wr\n }\n } else if (tr) {\n Wr();\n if (fr > lr) {\n var o = n;\n if ($n == 0)o = Li.q; else if (($n == 4 || $n >= 6) && ar == 2)o = Li.q, Ds(o); else if ($n <= 3 || $n == 5 || ar == 1)if (ki.t > 0 && Li.t > 0) {\n var u = xn[B], f = Li.t - ki.t, l = 0, c = 0, h = 1;\n $n == 1 || $n == 2 ? l = u - Li.t : (l = u - ki.t, h = 2), f <= 0 ? c = 1 : (c = l / f, c > h && (c = h)), Ai.x = ki.q.x, Ai.y = ki.q.y, Ai.z = ki.q.z, Ai.w = ki.q.w, wi(Ai, Li.q, c), o = Ai\n }\n if (o) {\n Ti(e, o, Wt);\n var s = Ci();\n xn[p][V] = cr + (-e[1] + ci) * wr + s, xn[p][jt] = -e[0] * wr, xn[p][an] = -e[2] * wr\n }\n }\n }\n }\n }\n\n function Di(e, n) {\n tr == t && ur == r && Ni(e == 1 ? Mr : _r, n)\n }\n\n function Pi(e) {\n var t = 0;\n return e == 1 ? Ar && Ar.x ? t = Ar.x : t = -0.03 : e == 2 && (Or && Or.x ? t = Or.x : t = .03), t *= 320 / Cn, t\n }\n\n function Hi(e, i) {\n var s = !!(Sn[Jt] || Sn[Mt] || Sn[zt] || Sn[gt] || Sn[qt]);\n if (or[a] && s && tr == t && ur == r) {\n var o = 0, u = 0;\n if (Dr)o = Dr[lt][Y] + Pr[lt][Y], u = Math.max(Dr[lt][N], Pr[lt][N]); else if (S in kr) {\n var f = kr[S](mt), l = kr[S](Tt);\n o = f[Y] + l[Y], u = Math.max(f[N], l[N])\n } else if (H in kr) {\n var c = kr[H]();\n o = c[Y], u = c[N]\n } else z in kr ? (o = kr[z][Y], u = kr[z][N]) : (o = 2e3, u = 1056);\n if (o > 0 && u > 0) {\n var h = 1;\n return o *= h, u *= h, {w: o, h: u}\n }\n } else or[a] && (tr || ur == t) && zr(e, i);\n return n\n }\n\n function Bi(e) {\n var e = (\"\" + e)[c](), i = e[s](dn), o = e.lastIndexOf(\"]\");\n if (i >= 0 && o > i) {\n var u = e[It](i + 8, o), a = dn + u + \"]\";\n a != Jn && (Jn = a, Qn && (ji(Qn, t), Qn = n), Qn = xn.get(Jn), Qn && ji(Qn, r))\n }\n }\n\n function ji(e, i) {\n if (i == r)e[Vt] = {\n visible: e[Ft],\n enabled: e[a],\n flying: e.flying,\n scaleflying: e[ot],\n distorted: e[xt],\n zorder: e.zorder,\n scale: e.scale,\n depth: e.depth,\n onover: e.onover,\n onout: e.onout\n }, e[a] = t, e.flying = 1, e[ot] = t, e[xt] = r, e.zorder = 999999999; else {\n var s = e[Vt];\n s && (e[Ft] = s[Ft], e[a] = s[a], e.flying = s.flying, e[ot] = s[ot], e[xt] = s[xt], e.zorder = s.zorder, e.scale = s.scale, e.depth = s.depth, e.onover = s.onover, e.onout = s.onout, e[Vt] = s = n)\n }\n }\n\n function Fi() {\n if (Jn) {\n var e = Qn;\n e == n && (e = xn.get(Jn), e && (ji(e, r), Qn = e));\n if (e) {\n if (!or[a])return e[Ft] = t, n;\n e.onover = Gn, e.onout = Yn, e[a] = Kn, e[Ft] = r\n }\n return e\n }\n return n\n }\n\n function Ii() {\n this.x = 0, this.y = 0, this.z = 0\n }\n\n function qi(e, t, n, r) {\n e.x = t, e.y = n, e.z = r\n }\n\n function Ri(e, t) {\n e.x = t.x, e.y = t.y, e.z = t.z\n }\n\n function Ui(e) {\n e.x = 0, e.y = 0, e.z = 0\n }\n\n function zi(e, t, n) {\n t == 0 ? e.x = n : t == 1 ? e.y = n : e.z = n\n }\n\n function Wi(e) {\n return Math[Bt](e.x * e.x + e.y * e.y + e.z * e.z)\n }\n\n function Xi(e) {\n var t = Wi(e);\n t > 0 ? Vi(e, 1 / t) : (e.x = 0, e.y = 0, e.z = 0)\n }\n\n function Vi(e, t) {\n e.x *= t, e.y *= t, e.z *= t\n }\n\n function $i(e, t, n) {\n qi(n, e.x - t.x, e.y - t.y, e.z - t.z)\n }\n\n function Ji(e, t, n) {\n qi(n, e.y * t.z - e.z * t.y, e.z * t.x - e.x * t.z, e.x * t.y - e.y * t.x)\n }\n\n function Ki(e, t) {\n return e.x * t.x + e.y * t.y + e.z * t.z\n }\n\n function Qi() {\n var e;\n return typeof Float64Array != \"undefined\" ? e = new Float64Array(9) : e = new Array(9), Yi(e), e\n }\n\n function Gi(e) {\n e[0] = e[1] = e[2] = e[3] = e[4] = e[5] = e[6] = e[7] = e[8] = 0\n }\n\n function Yi(e) {\n e[0] = e[4] = e[8] = 1, e[1] = e[2] = e[3] = e[5] = e[6] = e[7] = 0\n }\n\n function Zi(e, t) {\n e[0] = e[4] = e[8] = t\n }\n\n function es(e, t) {\n e[0] *= t, e[1] *= t, e[2] *= t, e[3] *= t, e[4] *= t, e[5] *= t, e[6] *= t, e[7] *= t, e[8] *= t\n }\n\n function ts(e, t) {\n var n = e[1], r = e[2], i = e[5];\n t[0] = e[0], t[1] = e[3], t[2] = e[6], t[3] = n, t[4] = e[4], t[5] = e[7], t[6] = r, t[7] = i, t[8] = e[8]\n }\n\n function ns(e, t, n) {\n e[t] = n.x, e[t + 3] = n.y, e[t + 6] = n.z\n }\n\n function rs(e, t) {\n e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8]\n }\n\n function is(e, t) {\n var n = e[0] * (e[4] * e[8] - e[7] * e[5]) - e[1] * (e[3] * e[8] - e[5] * e[6]) + e[2] * (e[3] * e[7] - e[4] * e[6]);\n n != 0 && (n = 1 / n, t[0] = (e[4] * e[8] - e[7] * e[5]) * n, t[1] = -(e[1] * e[8] - e[2] * e[7]) * n, t[2] = (e[1] * e[5] - e[2] * e[4]) * n, t[3] = -(e[3] * e[8] - e[5] * e[6]) * n, t[4] = (e[0] * e[8] - e[2] * e[6]) * n, t[5] = -(e[0] * e[5] - e[3] * e[2]) * n, t[6] = (e[3] * e[7] - e[6] * e[4]) * n, t[7] = -(e[0] * e[7] - e[6] * e[1]) * n, t[8] = (e[0] * e[4] - e[3] * e[1]) * n)\n }\n\n function ss(e, t) {\n e[0] -= t[0], e[1] -= t[1], e[2] -= t[2], e[3] -= t[3], e[4] -= t[4], e[5] -= t[5], e[6] -= t[6], e[7] -= t[7], e[8] -= t[8]\n }\n\n function os(e, t) {\n e[0] += t[0], e[1] += t[1], e[2] += t[2], e[3] += t[3], e[4] += t[4], e[5] += t[5], e[6] += t[6], e[7] += t[7], e[8] += t[8]\n }\n\n function us(e, t, n) {\n var r = t[0], i = t[1], s = t[2], o = t[3], u = t[4], a = t[5], f = t[6], l = t[7], c = t[8], h = e[0], p = e[1], d = e[2];\n n[0] = h * r + p * o + d * f, n[1] = h * i + p * u + d * l, n[2] = h * s + p * a + d * c, h = e[3], p = e[4], d = e[5], n[3] = h * r + p * o + d * f, n[4] = h * i + p * u + d * l, n[5] = h * s + p * a + d * c, h = e[6], p = e[7], d = e[8], n[6] = h * r + p * o + d * f, n[7] = h * i + p * u + d * l, n[8] = h * s + p * a + d * c\n }\n\n function as(e, t, n) {\n var r = e[0] * t.x + e[1] * t.y + e[2] * t.z, i = e[3] * t.x + e[4] * t.y + e[5] * t.z, s = e[6] * t.x + e[7] * t.y + e[8] * t.z;\n n.x = r, n.y = i, n.z = s\n }\n\n function fs(e, t, n) {\n n[0] = e[0] + t[0], n[1] = e[1] + t[1], n[2] = e[2] + t[2], n[3] = e[3] + t[3], n[4] = e[4] + t[4], n[5] = e[5] + t[5], n[6] = e[6] + t[6], n[7] = e[7] + t[7], n[8] = e[8] + t[8]\n }\n\n function bs(e, t, n) {\n Ji(e, t, cs);\n if (Wi(cs) == 0)Yi(n); else {\n Ri(hs, e), Ri(ps, t), Xi(cs), Xi(hs), Xi(ps);\n var r = vs, i = ms;\n Ji(cs, hs, ls), r[0] = hs.x, r[1] = hs.y, r[2] = hs.z, r[3] = cs.x, r[4] = cs.y, r[5] = cs.z, r[6] = ls.x, r[7] = ls.y, r[8] = ls.z, Ji(cs, ps, ls), i[0] = ps.x, i[3] = ps.y, i[6] = ps.z, i[1] = cs.x, i[4] = cs.y, i[7] = cs.z, i[2] = ls.x, i[5] = ls.y, i[8] = ls.z, us(i, r, n)\n }\n }\n\n function ws(e, t) {\n var n = Ki(e, e), r = Math[Bt](n), i, s;\n if (n < 1e-8)i = 1 - 1 / 6 * n, s = .5; else if (n < 1e-6)s = .5 - .25 * (1 / 6) * n, i = 1 - n * (1 / 6) * (1 - .05 * n); else {\n var o = 1 / r;\n i = Math.sin(r) * o, s = (1 - Math.cos(r)) * o * o\n }\n Ss(e, i, s, t)\n }\n\n function Es(e, t) {\n var n = (e[0] + e[4] + e[8] - 1) * .5;\n qi(t, (e[7] - e[5]) / 2, (e[2] - e[6]) / 2, (e[3] - e[1]) / 2);\n var r = Wi(t);\n if (n > Math.SQRT1_2)r > 0 && Vi(t, Math.asin(r) / r); else if (n > -Math.SQRT1_2) {\n var i = Math.acos(n);\n Vi(t, i / r)\n } else {\n var i = Math.PI - Math.asin(r), s = e[0] - n, o = e[4] - n, u = e[8] - n, a = gs;\n s * s > o * o && s * s > u * u ? qi(a, s, (e[3] + e[1]) / 2, (e[2] + e[6]) / 2) : o * o > u * u ? qi(a, (e[3] + e[1]) / 2, o, (e[7] + e[5]) / 2) : qi(a, (e[2] + e[6]) / 2, (e[7] + e[5]) / 2, u), Ki(a, t) < 0 && Vi(a, -1), Xi(a), Vi(a, i), Ri(t, a)\n }\n }\n\n function Ss(e, t, n, r) {\n var i = e.x * e.x, s = e.y * e.y, o = e.z * e.z;\n r[0] = 1 - n * (s + o), r[4] = 1 - n * (i + o), r[8] = 1 - n * (i + s);\n var u = t * e.z, a = n * e.x * e.y;\n r[1] = a - u, r[3] = a + u, u = t * e.y, a = n * e.x * e.z, r[2] = a + u, r[6] = a - u, u = t * e.x, a = n * e.y * e.z, r[5] = a - u, r[7] = a + u\n }\n\n function xs(e, t, n, r) {\n t *= br, n *= br, r *= br;\n var i = Math.cos(t), s = Math.sin(t), o = Math.cos(n), u = Math.sin(n), a = Math.cos(r), f = Math.sin(r), l = i * u, c = s * u;\n e[0] = o * a, e[1] = l * a + i * f, e[2] = -c * a + s * f, e[3] = -o * f, e[4] = -l * f + i * a, e[5] = c * f + s * a, e[6] = u, e[7] = -s * o, e[8] = i * o\n }\n\n function Ts(e, t) {\n var n = e[0] + e[4] + e[8], r;\n n > 0 ? (r = Math[Bt](1 + n) * 2, t.x = (e[5] - e[7]) / r, t.y = (e[6] - e[2]) / r, t.z = (e[1] - e[3]) / r, t.w = .25 * r) : e[0] > e[4] && e[0] > e[8] ? (r = Math[Bt](1 + e[0] - e[4] - e[8]) * 2, t.x = .25 * r, t.y = (e[3] + e[1]) / r, t.z = (e[6] + e[2]) / r, t.w = (e[5] - e[7]) / r) : e[4] > e[8] ? (r = Math[Bt](1 + e[4] - e[0] - e[8]) * 2, t.x = (e[3] + e[1]) / r, t.y = .25 * r, t.z = (e[7] + e[5]) / r, t.w = (e[6] - e[2]) / r) : (r = Math[Bt](1 + e[8] - e[0] - e[4]) * 2, t.x = (e[6] + e[2]) / r, t.y = (e[7] + e[5]) / r, t.z = .25 * r, t.w = (e[1] - e[3]) / r)\n }\n\n function Ds(e) {\n if (js) {\n var t = Ci();\n t != Ls && (Ls = t, xs(Os, 0, 0, -t), xs(As, -90, 0, +t));\n var n;\n if ($n <= 1 || $n == 3)n = To(); else {\n var r = xn[B], i = (r - Ns) / 1e3, s = i;\n $n == 2 ? s += 2 / 60 : $n == 6 ? s += 1 / 60 : $n == 7 && (s += 2 / 60), n = Lo(s)\n }\n us(Os, n, _s), us(_s, As, Ms), Ts(Ms, e)\n }\n }\n\n function Bs(e) {\n if (!or[a])return;\n var i = xn[B], s = i - Hs;\n Hs = i, s > 5e3 && (ui(), s = .16), fr++;\n if (fr < lr)return;\n go == t && (go = r, yo());\n var o = e[K], u = o.x, f = o.y, l = o.z;\n u == n && (u = 0), f == n && (f = 9.81), l == n && (l = 0);\n var c = e.acceleration;\n if (c) {\n var h = c.x, p = c.y, d = c.z;\n h == n && (h = 0), p == n && (p = 0), d == n && (d = 0), u -= h, f -= p, l -= d\n }\n if (Tn.ios || Tn.ie)u *= -1, f *= -1, l *= -1;\n var v = e.rotationRate, m = v.alpha, g = v.beta, y = v.gamma;\n m == n && (m = 0), g == n && (g = 0), y == n && (y = 0);\n if (Tn.ios || Tn[Ht] || Tn.ie) {\n m *= br, g *= br, y *= br;\n if (Tn.ie) {\n var b = m, w = g, E = y;\n m = w, g = E, y = b\n }\n }\n Uo ? Jo(s, m, g, y) : Pn && Ps(m, g, y, i);\n var S = zo;\n m -= S.rx, g -= S.ry, y -= S.rz, qi(Cs, u, f, l), Eo(Cs, s), Ns = i, qi(ks, m, g, y), xo(ks, i);\n if ($n <= 3 || $n == 5)ki.q.x = Li.q.x, ki.q.y = Li.q.y, ki.q.z = Li.q.z, ki.q.w = Li.q.w, ki.t = Li.t, Ds(Li.q), Li.t = i\n }\n\n function yo() {\n Yi(Qs), Yi(Gs), Gi(Zs), Zi(Zs, ho), Gi(Ys), Zi(Ys, 1), Gi(ro), Zi(ro, po), Gi(to), Gi(eo), Gi(no), Ui(Ws), Ui(Us), Ui(Rs), Ui(zs), Ui(qs), qi(Is, 0, 0, vo), js = t\n }\n\n function bo(e, t) {\n as(e, Is, Rs), bs(Rs, Us, co), Es(co, t)\n }\n\n function wo() {\n ts(Gs, fo), us(Zs, fo, lo), us(Gs, lo, Zs), Yi(Gs)\n }\n\n function Eo(e, t) {\n Ri(Us, e);\n if (js) {\n bo(Qs, Ws), t < 5 && (t = 5);\n var n = 1e3 / 60 / t, i = mo * n, s = 1 / mo, o = Xs;\n for (var u = 0; u < 3; u++)Ui(o), zi(o, u, s), ws(o, io), us(io, Qs, so), bo(so, Vs), $i(Ws, Vs, $s), Vi($s, i), ns(eo, u, $s);\n ts(eo, oo), us(Zs, oo, uo), us(eo, uo, ao), fs(ao, ro, to), is(to, oo), ts(eo, uo), us(uo, oo, ao), us(Zs, ao, no), as(no, Ws, qs), us(no, eo, oo), Yi(uo), ss(uo, oo), us(uo, Zs, oo), rs(Zs, oo), ws(qs, Gs), us(Gs, Qs, Qs), wo()\n } else bs(Is, Us, Qs), js = r\n }\n\n function xo(e, t) {\n if (So != 0) {\n var n = (t - So) / 1e3;\n n > 1 && (n = 1), Ri(zs, e), Vi(zs, -n), ws(zs, Gs), rs(Js, Qs), us(Gs, Qs, Js), rs(Qs, Js), wo(), rs(Ks, Ys), es(Ks, n * n), os(Zs, Ks)\n }\n So = t, Ri(Fs, e)\n }\n\n function To() {\n return Qs\n }\n\n function Lo(e) {\n var t = No;\n Ri(t, Fs), Vi(t, -e);\n var n = Co;\n ws(t, n);\n var r = ko;\n return us(n, Qs, r), r\n }\n\n function Ho(e) {\n var t = e[s](\"://\");\n if (t > 0) {\n var r = e[s](\"/\", t + 3), i = e[It](0, t)[c](), o = e[It](t + 3, r), u = e[It](r);\n return [i, o, u]\n }\n return n\n }\n \n function local_storage() {\n // krpano WebVR Plugin - cross-domain localstorage - server page\n // - save the WebVR cardboard settings (IPD, screensize, lens-settings, gyro-calibration)\n\n var ls = window.localStorage;\n if (ls)\n {\n if (false) //parent === window\n {\n // direct call - show stored settings\n var vals = ls.getItem(\"krpano.webvr.4\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.3\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.2\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.1\");\n\n if (vals)\n {\n vals = (\"\"+vals).split(\",\")\n if (vals.length >= 6)\n {\n document.body.innerHTML =\n \"<div style='font-family:Arial;font-size:14px;'>\"+\n \"krpano WebVR Settings (v4): \"+\n \"ipd=\"+Number(vals[0]).toFixed(2)+\"mm, \"+\n \"screensize=\"+(vals[1] == 0 ? \"auto\" : Number(vals[1]).toFixed(1)+\" inch\")+\", \"+\n \"fov=\"+Number(vals[2]).toFixed(1)+\", \"+\n \"distortion=\"+Number(vals[3]).toFixed(2)+\", \"+\n \"distortion2=\"+(vals[10] ? vals[10] : \"none\")+\", \"+\n \"ca=\"+(!isNaN(Number(vals[11])) ? Number(vals[11]) : \"0.0\")+\", \"+\n \"vignette=\"+Number(vals[4]).toFixed(1)+\", \"+\n \"sensormode=\"+Number(vals[5]).toFixed(0)+\", \"+\n \"overlap=\"+(vals.length >= 10 ? Number(vals[9]) : 1.0).toFixed(2)+\n (vals.length >= 9 ? \", gyro-calibration=\"+Number(vals[6]).toFixed(4)+\"/\"+Number(vals[7]).toFixed(4)+\"/\"+Number(vals[8]).toFixed(4) : \"\")+\n \"</div>\";\n }\n }\n }\n else\n {\n // handle messages from the parent frame\n window.addEventListener(\"message\", function(event)\n {\n var request = (\"\"+event.data).toLowerCase();\n var vals;\n\n if ( request == \"load.1\" )\n {\n // load.1 => ipd,size,fov,dist,vig,ssm\n vals = ls.getItem(\"krpano.webvr.1\");\n if (vals)\n {\n if ((\"\"+vals).split(\",\").length == 6)\n {\n event.source.postMessage(\"webvr_settings:\"+vals, event.origin);\n }\n }\n }\n else if ( request == \"load.2\" )\n {\n // load.2 => ipd,size,fov,dist,vig,ssm,gyrox,gyroy,gyroz\n vals = ls.getItem(\"krpano.webvr.2\");\n if (vals)\n {\n if ((\"\"+vals).split(\",\").length == 9)\n {\n event.source.postMessage(\"webvr_settings:\"+vals, event.origin);\n }\n }\n else\n {\n // use older version data: load.2 => ipd,size,fov,dist,vig,ssm,0,0,0\n vals = ls.getItem(\"krpano.webvr.1\");\n if (vals && (\"\"+vals).split(\",\").length == 6)\n {\n event.source.postMessage(\"webvr_settings:\"+vals+\",0,0,0\", event.origin);\n }\n }\n }\n else if ( request == \"load.3\" )\n {\n // load.3 => ipd,size,fov,dist,vig,ssm,gyrox,gyroy,gyroz,overlap\n vals = ls.getItem(\"krpano.webvr.3\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.2\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.1\");\n\n if (vals && (\"\"+vals).split(\",\").length >= 6)\n {\n event.source.postMessage(\"webvr_settings:\"+vals, event.origin);\n }\n }\n else if ( request == \"load.4\" )\n {\n // load.4 => ipd,size,fov,dist,vig,ssm,gyrox,gyroy,gyroz,overlap,dist2,ca\n vals = ls.getItem(\"krpano.webvr.4\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.3\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.2\");\n if (!vals) vals = ls.getItem(\"krpano.webvr.1\");\n\n if (vals && (\"\"+vals).split(\",\").length >= 6)\n {\n event.source.postMessage(\"webvr_settings:\"+vals, event.origin);\n }\n }\n else if ( request.slice(0,7) == \"save.1:\" )\n {\n // save.1:ipd,size,fov,dist,vig,ssm\n vals = request.slice(7).split(\",\");\n if (vals.length == 6)\n {\n var ipd = Number(vals[0]);\n var srd = Number(vals[1]);\n var fov = Number(vals[2]);\n var dst = Number(vals[3]);\n var vig = Number(vals[4]);\n var ssm = Number(vals[5]);\n\n // validate values\n if (!isNaN(ipd) && ipd >= 30 && ipd < 90 &&\n !isNaN(srd) && srd >= 0 && srd < 12 &&\n !isNaN(fov) && fov >= 1 && fov < 180 &&\n !isNaN(dst) && dst >= 0 && dst < 10 &&\n !isNaN(vig) && vig >= 1 && vig < 500 &&\n !isNaN(ssm) && ssm >= 0 && ssm < 10\n )\n {\n ls.setItem(\"krpano.webvr.1\", vals.join(\",\"));\n }\n }\n }\n else if ( request.slice(0,7) == \"save.2:\" )\n {\n // save.2:ipd,size,fov,dist,vig,ssm,gyrox,gyroy,gyroz\n vals = request.slice(7).split(\",\");\n if (vals.length == 9)\n {\n var ipd = Number(vals[0]);\n var srd = Number(vals[1]);\n var fov = Number(vals[2]);\n var dst = Number(vals[3]);\n var vig = Number(vals[4]);\n var ssm = Number(vals[5]);\n var grx = Number(vals[6]);\n var gry = Number(vals[7]);\n var grz = Number(vals[8]);\n\n // validate values\n if (!isNaN(ipd) && ipd >= 30 && ipd < 90 &&\n !isNaN(srd) && srd >= 0 && srd < 12 &&\n !isNaN(fov) && fov >= 1 && fov < 180 &&\n !isNaN(dst) && dst >= 0 && dst < 10 &&\n !isNaN(vig) && vig >= 1 && vig < 500 &&\n !isNaN(ssm) && ssm >= 0 && ssm < 10 &&\n !isNaN(grx) && !isNaN(gry) && !isNaN(grz)\n )\n {\n ls.setItem(\"krpano.webvr.2\", vals.join(\",\"));\n\n // save settings also for older versions\n ls.setItem(\"krpano.webvr.1\", vals.slice(0,6).join(\",\"));\n }\n }\n }\n else if ( request.slice(0,7) == \"save.3:\" )\n {\n // save.3:ipd,size,fov,dist,vig,ssm,gyrox,gyroy,gyroz,overlap\n vals = request.slice(7).split(\",\");\n if (vals.length == 10)\n {\n var ipd = Number(vals[0]);\n var srd = Number(vals[1]);\n var fov = Number(vals[2]);\n var dst = Number(vals[3]);\n var vig = Number(vals[4]);\n var ssm = Number(vals[5]);\n var grx = Number(vals[6]);\n var gry = Number(vals[7]);\n var grz = Number(vals[8]);\n var olp = Number(vals[9]);\n\n // validate values\n if (!isNaN(ipd) && ipd >= 30 && ipd < 90 &&\n !isNaN(srd) && srd >= 0 && srd < 12 &&\n !isNaN(fov) && fov >= 1 && fov < 180 &&\n !isNaN(dst) && dst >= 0 && dst < 10 &&\n !isNaN(vig) && vig >= 1 && vig < 500 &&\n !isNaN(ssm) && ssm >= 0 && ssm < 10 &&\n !isNaN(grx) && !isNaN(gry) && !isNaN(grz) &&\n !isNaN(olp) && olp > 0 && olp < 2\n )\n {\n ls.setItem(\"krpano.webvr.3\", vals.join(\",\"));\n\n // save the settings also for older versions\n ls.setItem(\"krpano.webvr.2\", vals.slice(0,9).join(\",\"));\n ls.setItem(\"krpano.webvr.1\", vals.slice(0,6).join(\",\"));\n }\n }\n }\n else if ( request.slice(0,7) == \"save.4:\" )\n {\n // save.4:ipd,size,fov,dist,vig,ssm,gyrox,gyroy,gyroz,overlap,dist2,ca\n vals = request.slice(7).split(\",\");\n if (vals.length == 12)\n {\n var ipd = Number(vals[0]);\n var srd = Number(vals[1]);\n var fov = Number(vals[2]);\n var dst = Number(vals[3]);\n var vig = Number(vals[4]);\n var ssm = Number(vals[5]);\n var grx = Number(vals[6]);\n var gry = Number(vals[7]);\n var grz = Number(vals[8]);\n var olp = Number(vals[9]);\n\n // validate values\n if (!isNaN(ipd) && ipd >= 30 && ipd < 90 &&\n !isNaN(srd) && srd >= 0 && srd < 12 &&\n !isNaN(fov) && fov >= 1 && fov < 180 &&\n !isNaN(dst) && dst >= 0 && dst < 10 &&\n !isNaN(vig) && vig >= 1 && vig < 500 &&\n !isNaN(ssm) && ssm >= 0 && ssm < 10 &&\n !isNaN(grx) && !isNaN(gry) && !isNaN(grz) &&\n !isNaN(olp) && olp > 0 && olp < 2\n )\n {\n ls.setItem(\"krpano.webvr.4\", vals.join(\",\"));\n\n // save the settings also for older versions\n ls.setItem(\"krpano.webvr.3\", vals.slice(0,10).join(\",\"));\n ls.setItem(\"krpano.webvr.2\", vals.slice(0,9).join(\",\"));\n ls.setItem(\"krpano.webvr.1\", vals.slice(0,6).join(\",\"));\n }\n }\n }\n }\n , false);\n }\n }\n }\n\n function Bo(e) {\n if (Mo == n) {\n var i = Ho(Ao), s = Ho(window[wn].href);\n if (s[0] == \"http\" || s[0] == \"https\") {\n _o = s[0] + \"://\" + i[1], Do = _o + i[2];\n var o = document[bn](\"iframe\");\n o.style.cssText = \"position:absolute;width:1px;height:1px;left:-9999px;visibility:hidden;\",\n xn[m].viewerlayer.appendChild(o),\n Mo = o,\n o[u](\"load\", function () {\n Oo = r, e(Mo)\n }, true),\n window[u](\"message\", Fo, true);\n //o.src = Do\n local_storage();\n }\n } else Oo && e(Mo)\n }\n\n function jo(e) {\n Bo(function (t) {\n try {\n t.contentWindow.postMessage(e, _o)\n } catch (n) {\n }\n })\n }\n\n function Fo(e) {\n alert(233);\n if (e.origin == _o) {\n var t = \"\" + e.data;\n t[It](0, 15) == \"webvr_settings:\" && Io(t[It](15))\n }\n }\n\n function Io(e) {\n var t = e[mn](bt), n = Number(t[0]), i = Number(t[1]), s = Number(t[2]), o = Number(t[3]), u = Number(t[4]), a = Number(t[5]), f = Number(t[6]), l = Number(t[7]), c = Number(t[8]), h = Number(t[9]), p = \"\" + t[10], d = Number(t[11]);\n isNaN(f) && (f = 0), isNaN(l) && (l = 0), isNaN(c) && (c = 0), isNaN(h) && (h = 1), isNaN(d) && (d = 0), p[mn](\"|\")[kt] != 4 && (p = Qt), !isNaN(n) && n >= 30 && n < 90 && !isNaN(i) && i >= 0 && i < 12 && !isNaN(s) && s >= 1 && s < 180 && !isNaN(o) && o >= 0 && o < 10 && !isNaN(u) && u >= 1 && u < 500 && !isNaN(a) && a >= 0 && a < 10 && !isNaN(h) && h > 0 && h < 2 && (Hn = n, Bn = i, Fn = s, In = o, Wn = u, $n = a, zo.rx = f, zo.ry = l, zo.rz = c, jn = h, qn = p, zn = d, ir = r)\n }\n\n function qo(e) {\n if (tr || rr) {\n if (Po)try {\n var t = window.localStorage;\n if (t) {\n var n = t[tn](Pt);\n n || (n = t[tn](Dt)), n || (n = t[tn](At)), n || (n = t[tn](Ot)), n && Io(n)\n }\n } catch (r) {\n }\n (\"\" + e)[c]() != \"local\" && jo(\"load.4\")\n }\n }\n\n function Ro(e) {\n if (tr || rr) {\n var t = Hn + bt + Bn + bt + Fn + bt + In + bt + Wn + bt + $n + bt + zo.rx + bt + zo.ry + bt + zo.rz + bt + jn + bt + qn + bt + zn;\n if (Po)try {\n var n = window.localStorage;\n n && (n[Zt](Pt, t), n[Zt](Dt, t[mn](bt)[It](0, 10).join(bt)), n[Zt](At, t[mn](bt)[It](0, 9).join(bt)), n[Zt](Ot, t[mn](bt)[It](0, 6).join(bt)))\n } catch (r) {\n }\n (\"\" + e)[c]() != \"local\" && jo(\"save.4:\" + t)\n }\n }\n\n function Vo(e, n) {\n Zn && tr && !nr && (Uo = r, Pn = t, Wo = e, Xo = n, Jo(-1))\n }\n\n function $o() {\n Uo = t, zo.rx = 0, zo.ry = 0, zo.rz = 0\n }\n\n var e = \"registerattribute\", t = !1, n = null, r = !0, s = \"indexOf\", o = \"removeEventListener\", u = \"addEventListener\", a = \"enabled\", f = \"deviceorientation\", l = \"onunavailable\", c = \"toLowerCase\", h = \"devicemotion\", p = \"view\", d = \"maxpixelzoom\", v = \"architectural\", m = \"display\", g = \"continuousupdates\", y = \"control\", b = \"fisheyefovlink\", w = \"browser\", E = \"desktop\", S = \"getRecommendedEyeRenderRect\", x = \"stereographic\", T = \"limitview\", N = \"height\", C = \"getCurrentEyeFieldOfView\", k = \"events\", L = \"#ifdef GL_FRAGMENT_PRECISION_HIGH\\n\", A = \"loadwhilemoving\", O = \"onavailable\", M = \"float b = texture2D(sm,vB).b;\", _ = \"android\", D = \"downloadlockedlevel\", P = \"float r = texture2D(sm,vR).r;\", H = \"getRecommendedRenderTargetSize\", B = \"timertick\", j = \"stereooverlap\", F = \"getEyeParameters\", I = \"uniform1f\", q = \"vec2 vR = center + v * ca;\", R = \"vec2 vB = center + v / ca;\", U = \"precision mediump float;\\n\", z = \"renderTargetSize\", W = \"lockmultireslevel\", X = \"fisheye\", V = \"hlookat\", $ = \"getEyeTranslation\", J = \"call\", K = \"accelerationIncludingGravity\", Q = \"documentElement\", G = \"fovtype\", Y = \"width\", Z = \"#endif\\n\", et = \"precision highp float;\\n\", tt = \"atan2\", nt = \"pannini\", rt = \"uniform sampler2D sm;\", it = \"usercontrol\", st = \"orientation\", ot = \"scaleflying\", ut = \"vec2 v = tx - center;\", at = \"mobile\", ft = \"fovmin\", lt = \"renderRect\", ct = \"useProgram\", ht = \"fovmax\", pt = \"auto\", dt = \"uniform float ca;\", vt = \"uniform float ol;\", mt = \"left\", gt = \"webkitFullscreenElement\", yt = \"fullscreen\", bt = \",\", wt = \"varying vec2 tx;\", Et = \"recommendedFieldOfView\", St = \"mousetype\", xt = \"distorted\", Tt = \"right\", Nt = \"onunknowndevice\", Ct = \"stereo\", kt = \"length\", Lt = \"area\", At = \"krpano.webvr.2\", Ot = \"krpano.webvr.1\", Mt = \"mozFullScreenElement\", _t = \"#ifdef GL_ES\\n\", Dt = \"krpano.webvr.3\", Pt = \"krpano.webvr.4\", Ht = \"firefox\", Bt = \"sqrt\", jt = \"vlookat\", Ft = \"visible\", It = \"slice\", qt = \"msFullscreenElement\", Rt = \"contextmenu\", Ut = \"mozGetVRDevices\", zt = \"webkitIsFullScreen\", Wt = \"YXZ\", Xt = \"void main()\", Vt = \"_VR_backup\", $t = \"layer\", Jt = \"fullscreenElement\", Kt = \"touchstart\", Qt = \"1|0|0|0\", Gt = \"devicename\", Yt = \"fullscreenchange\", Zt = \"setItem\", en = \"maxmem\", tn = \"getItem\", nn = \"mousedown\", rn = \"mousemove\", sn = \"galaxy s4\", on = \"iPhone 6+\", un = \"touchmove\", an = \"camroll\", fn = \"changedTouches\", ln = \"iPhone 6\", cn = \"screentosphere\", hn = \"createppshader\", pn = \"eyeTranslation\", dn = \"hotspot[\", vn = \"hardwareUnitId\", mn = \"split\", gn = \"touchend\", yn = \"#else\\n\", bn = \"createElement\", wn = \"location\", En = this, Sn = document, xn = n, Tn = n, Nn = n, Cn = 1, kn = .00125, Ln = t, An = r, On = r, Mn = t, _n = t, Dn = r, Pn = t, Hn = 63.5, Bn = pt, jn = 1, Fn = 96, In = .6, qn = Qt, Rn = [1, 0, 0, 0], Un = t, zn = 0, Wn = 100, Xn = t, Vn = 1, $n = 3, Jn = \"\", Kn = r, Qn = n, Gn = n, Yn = n, Zn = t, er = t, tr = t, nr = t, rr = t, ir = t, sr = t, or = {\n enabled: t,\n eyetranslt: Pi,\n updateview: _i,\n prjmatrix: Di,\n getsize: Hi,\n getcursor: Fi\n }, ur = r, ar = 0, fr = 0, lr = 6, cr = 0, hr = 1, pr = 0, dr = 0, vr = 0, mr = t, gr = n, yr = n, br = Math.PI / 180, wr = 180 / Math.PI;\n En.registerplugin = function (i, s, o) {\n xn = i, Nn = o;\n if (xn.version < \"1.19\" || xn.build < \"2015-07-09\") {\n xn.trace(3, \"WebVR plugin - too old krpano version (min. 1.19)\");\n return\n }\n if (xn.webVR)return;\n Tn = xn.device, Nn[e](\"worldscale\", Cn, function (e) {\n var t = Number(e);\n isNaN(t) || (Cn = Math.max(t, .1))\n }, function () {\n return Cn\n }), Nn[e](\"mousespeed\", kn, function (e) {\n var t = Number(e);\n isNaN(t) || (kn = t)\n }, function () {\n return kn\n }), Nn[e](\"pos_tracking\", Ln, function (e) {\n Ln = Er(e)\n }, function () {\n return Ln\n }), Nn[e](\"multireslock\", An, function (e) {\n An = Er(e), or[a] && ri()\n }, function () {\n return An\n }), Nn[e](\"mobilevr_support\", On, function (e) {\n On = Er(e)\n }, function () {\n return On\n }), Nn[e](\"mobilevr_touch_support\", Mn, function (e) {\n Mn = Er(e)\n }, function () {\n return Mn\n }), Nn[e](\"mobilevr_fake_support\", _n, function (e) {\n _n = Er(e)\n }, function () {\n return _n\n }), Nn[e](\"mobilevr_ipd\", Hn, function (e) {\n var t = Number(e);\n isNaN(t) || (Hn = t), Ur()\n }, function () {\n return Hn\n }), Nn[e](\"mobilevr_screensize\", Bn, function (e) {\n $r(e)\n }, function () {\n return Jr()\n }), Nn[e](\"mobilevr_lens_fov\", Fn, function (e) {\n var t = Number(e);\n isNaN(t) || (Fn = t, Ur())\n }, function () {\n return Fn\n }), Nn[e](\"mobilevr_lens_overlap\", jn, function (e) {\n var t = Number(e);\n isNaN(t) || (jn = t, Ur())\n }, function () {\n return jn\n }), Nn[e](\"mobilevr_lens_dist\", In, function (e) {\n var t = Number(e);\n isNaN(t) || (In = t, Ur())\n }, function () {\n return In\n }), Nn[e](\"mobilevr_lens_dist2\", qn, function (e) {\n qn = e, Ur()\n }, function () {\n return qn\n }), Nn[e](\"mobilevr_lens_ca\", zn, function (e) {\n var t = Number(e);\n isNaN(t) || (zn = t, Ur())\n }, function () {\n return zn\n }), Nn[e](\"mobilevr_lens_vign\", Wn, function (e) {\n var t = Number(e);\n isNaN(t) || (Wn = t, Ur())\n }, function () {\n return Wn\n }), Nn[e](\"mobilevr_webvr_dist\", Xn, function (e) {\n Xn = Er(e)\n }, function () {\n return Xn\n }), Nn[e](\"mobilevr_wakelock\", Dn, function (e) {\n Dn = Er(e)\n }, function () {\n return Dn\n }), Nn[e](\"mobilevr_autocalibration\", Pn, function (e) {\n Pn = Er(e)\n }, function () {\n return Pn\n }), Nn[e](\"mobilevr_sensor\", Vn, function (e) {\n Vn = parseInt(e) & 1\n }, function () {\n return Vn\n }), Nn[e](\"mobilevr_sensor_mode\", $n, function (e) {\n var t = parseInt(e);\n t >= 0 && t <= 7 && ($n = t), fr = 0\n }, function () {\n return $n\n }), Nn[e](\"vr_cursor\", Jn, function (e) {\n Bi(e)\n }, function () {\n return Jn\n }), Nn[e](\"vr_cursor_enabled\", Kn, function (e) {\n Kn = Er(e)\n }, function () {\n return Kn\n }), Nn[e](\"vr_cursor_onover\", Gn, function (e) {\n Gn = e\n }, function () {\n return Gn\n }), Nn[e](\"vr_cursor_onout\", Yn, function (e) {\n Yn = e\n }, function () {\n return Yn\n }), Nn[e](\"isavailable\", er, function (e) {\n }, function () {\n return er\n }), Nn[e](\"isenabled\", Zn, function (e) {\n }, function () {\n return Zn\n }), Nn[e](\"iswebvr\", !tr, function (e) {\n }, function () {\n return !tr || rr\n }), Nn[e](\"ismobilevr\", tr, function (e) {\n }, function () {\n return tr || rr\n }), Nn[e](\"isfake\", nr, function (e) {\n }, function () {\n return nr\n }), Nn[e](\"havesettings\", ir, function (e) {\n }, function () {\n return ir\n }), Nn[e](Gt, \"\", function (e) {\n }, function () {\n return Xr()\n }), Nn[e](\"devicesize\", \"\", function (e) {\n }, function () {\n return Vr()\n }), Nn[e](O, n), Nn[e](l, n), Nn[e](Nt, n), Nn[e](\"onentervr\", n), Nn[e](\"onexitvr\", n), Nn.entervr = Gr, Nn.exitvr = Yr, Nn.togglevr = Zr, Nn.resetsensor = ei, Nn.loadsettings = qo, Nn.savesettings = Ro, Nn.calibrate = Vo, Nn.resetcalibration = $o, Nn.update = Qr;\n if (xn.webGL) {\n xn.webVR = or;\n var u = Tn[_] && Tn[Ht], f = document[Q].requestPointerLock || document[Q].mozRequestPointerLock || document[Q].webkitRequestPointerLock, c = document.exitPointerLock || document.mozExitPointerLock || document.webkitExitPointerLock;\n f && c && (mr = r, gr = f, yr = c);\n try {\n u == t && navigator.getVRDevices ? navigator.getVRDevices().then(jr) : u == t && navigator[Ut] ? navigator[Ut](jr) : On ? xr() : sr == t && (sr = r, xn[J](Nn[l], Nn))\n } catch (h) {\n }\n } else sr == t && (sr = r, xn[J](Nn[l], Nn))\n }, En.unloadplugin = function () {\n Yr(), oi(t, r), xn.webVR = n\n };\n var kr = n, Lr = n, Ar = n, Or = n, Mr = n, _r = n, Dr = n, Pr = n, Hr = n, Br = 100, Fr = n, qr = n, ti = n, oi = function () {\n var e = n, r = n;\n return function (i, s) {\n if (Tn[at] && nr == t)if (i)Tn.ios ? e = window.setInterval(function () {\n window[wn] = window[wn], window.setTimeout(window.stop, 0)\n }, 15e3) : Tn[_] && (r == n && (r = document[bn](\"video\"), r.setAttribute(\"loop\", \"\"), r.canPlayType(\"video/webm\") != \"\" && (r.src = Qo)), r.play()); else {\n e && (window.clearInterval(e), e = n);\n if (r && s) {\n r.pause();\n try {\n r.src = \"\", r.removeAttribute(\"src\")\n } catch (o) {\n }\n r = n\n }\n }\n }\n }(), ai = 0, ci = 0, ki = {q: new pi(0, 0, 0, 1), t: 0}, Li = {\n q: new pi(0, 0, 0, 1),\n t: 0\n }, Ai = new pi(0, 0, 0, 1), Oi = n, ls = new Ii, cs = new Ii, hs = new Ii, ps = new Ii, ds = new Ii, vs = Qi(), ms = Qi(), gs = new Ii, ys = new Ii, Ns = 0, Cs = new Ii, ks = new Ii, Ls = n, As = Qi(), Os = Qi(), Ms = Qi(), _s = Qi(), Ps = function () {\n var e = 0, t = 0, n = 0, r = 0, i = 0, s = 0, o = 0, u = 0, a = 0, f = 0, l = 1, c = 0, h = 0, p = 0, d = .03;\n return function (c, h, p, v) {\n var m = c - e, g = h - t, y = p - n, b = v - r;\n e = c, t = h, n = p, r = v;\n var w = Math[Bt](m * m + g * g + y * y);\n if (b > 500) {\n i = 0;\n return\n }\n if (i == 0) {\n i = b, s = w;\n return\n }\n i = i * .95 + .05 * b;\n var E = Math.min(15 * i / 1e3, .5);\n s = s * (1 - E) + E * w;\n var S = zo;\n s < d ? (o++, u += c, a += h, f += p, o > 19 && (S.rx = S.rx * (1 - l) + l * (u / o), S.ry = S.ry * (1 - l) + l * (a / o), S.rz = S.rz * (1 - l) + l * (f / o), l > .5 && (l *= .9), s = 10, d *= .5)) : (o = 1, u = c, a = h, f = p)\n }\n }(), Hs = 0, js = t, Fs = new Ii, Is = new Ii, qs = new Ii, Rs = new Ii, Us = new Ii, zs = new Ii, Ws = new Ii, Xs = new Ii, Vs = new Ii, $s = new Ii, Js = Qi(), Ks = Qi(), Qs = Qi(), Gs = Qi(), Ys = Qi(), Zs = Qi(), eo = Qi(), to = Qi(), no = Qi(), ro = Qi(), io = Qi(), so = Qi(), oo = Qi(), uo = Qi(), ao = Qi(), fo = Qi(), lo = Qi(), co = Qi(), ho = 20, po = .5, vo = 9.81, mo = 1e7, go = t, So = 0, No = new Ii, Co = Qi(), ko = Qi(), Ao = \"http://d8d913s460fub.cloudfront.net/krpanocloud/webvr_localstorage.html?v=114\", Oo = t, Mo = n, _o = n, Do = n, Po = r, Uo = t, zo = {\n rx: 0,\n ry: 0,\n rz: 0\n }, Wo = n, Xo = n, Jo = function () {\n function i() {\n var t = 0, r = n * 3, i = 0, s = 0, o = 0, u = 0, a = 0, f = 0, l = 0, c = 0, h = 0, p = 0;\n for (t = 0; t < r; t += 3)i += e[t | 0], s += e[t + 1 | 0], o += e[t + 2 | 0];\n i /= n, s /= n, o /= n;\n for (t = 0; t < r; t += 3)l = e[t | 0] - i, c = e[t + 1 | 0] - s, h = e[t + 2 | 0] - o, u += l * l, a += c * c, f += h * h;\n u = Math[Bt](u / n), a = Math[Bt](a / n), f = Math[Bt](f / n), p = Math[Bt](u * u + a * a + f * f);\n if (p < .05) {\n var d = zo;\n d.rx = i, d.ry = s, d.rz = o, Wo && xn[J](Wo, Nn)\n } else Xo && xn[J](Xo, Nn)\n }\n\n var e = new Array(300), n = 0, r = 0;\n return function (s, o, u, a) {\n if (s < 0) {\n n = 0, r = xn[B];\n return\n }\n var f = xn[B] - r;\n if (f > 500) {\n var l = n * 3;\n e[l | 0] = o, e[l + 1 | 0] = u, e[l + 2 | 0] = a, n++;\n if (n > 100 || f > 2500)Uo = t, i()\n }\n }\n }(), Ko = function () {\n function u(t) {\n for (i = 0; i < t[kt]; i++)if (e && t[i] === e || s && t[i] === s)t.splice(i, 1), i--\n }\n\n var e = n, r = \"\" + _t + L + et + yn + U + Z + Z + rt + wt + dt + vt + Xt + \"{\" + \"float g = texture2D(sm,tx).g;\" + \"vec2 center = vec2(0.5 + (0.5 - ol)*(step(0.5,tx.x) - 0.5), 0.5);\" + ut + q + P + R + M + \"gl_FragColor=vec4(r,g,b,1.0);\" + \"}\", s = n, o = \"\" + _t + L + et + yn + U + Z + Z + rt + wt + \"uniform vec2 sz;\" + \"uniform float ss;\" + dt + vt + \"uniform float vg;\" + \"uniform vec4 dd;\" + Xt + \"{\" + \"float vig = 0.015;\" + \"float side = step(0.5,tx.x) - 0.5;\" + \"float aspect = (sz.x / sz.y);\" + \"vec2 center = vec2(0.5 + (0.5 - ol)*side, 0.5);\" + ut + \"v.x = v.x * aspect;\" + \"v *= 2.0 * ss;\" + \"float rs = dot(v,v);\" + \"v = v * (dd.x + rs*(dd.y + rs*(dd.z + rs*dd.w)));\" + \"v /= 2.0 * ss;\" + \"v.x = v.x / aspect;\" + \"vec2 vG = center + v;\" + \"float a = (1.0 - smoothstep(vG.x-vig - side*ol, vG.x - side*ol, center.x - 0.25)) * \" + \"(1.0 - smoothstep(center.x + 0.25 - vG.x + side*ol - vig, center.x + 0.25 - vG.x + side*ol, 0.0)) * \" + \"(1.0 - smoothstep(vG.y-vig, vG.y, 0.0)) * \" + \"(1.0 - smoothstep(1.0 - vG.y-vig,1.0 - vG.y, 0.0));\" + \"a *= smoothstep(rs-vig, rs+vig, vg);\" + q + R + P + \"float g = texture2D(sm,vG).g;\" +\n M + \"gl_FragColor=vec4(a*r,a*g,a*b,1.0);\" + \"}\";\n return function (i) {\n var a = xn.webGL;\n if (a) {\n var f, l = a.context, c = a.ppshaders, h = 1 - zn * .1 / hr;\n Un == t && h > .999999 && h < 1.000001 && (i = t), xn[m][Ct] == t && (i = t);\n if (i)if (Un) {\n s == n && (s = a[hn](o, \"ss,ca,dd,ol,sz,vg\"));\n if (s) {\n var p = 1 / Rn[0], d = Rn[1], v = Rn[2], g = Rn[3];\n a[ct](s.prg), l[I](s.ss, hr), l[I](s.ca, h), l.uniform4f(s.dd, p, p * d, p * v, p * g), l[I](s.ol, .5 * vr * (1 + (jn - 1) * .1)), l[I](s.vg, Wn / 30), a[ct](n), u(c), c.push(s)\n }\n } else e == n && (e = a[hn](r, \"ca,ol\")), e && (a[ct](e.prg), l[I](e.ca, h), l[I](e.ol, .5 * vr * (1 + (jn - 1) * .1)), a[ct](n), u(c), c.push(e)); else u(c)\n }\n }\n }(), Qo = \"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAABzRFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEuTbuMU6uEHFO7a1OsggGw7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEMq17GDD0JATYCMTGF2ZjU2LjMuMTAwV0GMTGF2ZjU2LjMuMTAwc6SQC+JFWnEfyt4nOD98NcnLDESJiAAAAAAAAAAAFlSuawEAAAAAAABCrgEAAAAAAAA514EBc8WBAZyBACK1nIN1bmSGhVZfVlA4g4EBI+ODgw9CQOABAAAAAAAADrCBCLqBCFSwgQhUuoEIH0O2dQEAAAAAAAAo54EAo6OBAACAEAIAnQEqCAAIAABHCIWFiIWEiAICAAwNYAD+/6PeABxTu2sBAAAAAAAAEbuPs4EAt4r3gQHxggF88IED\"\n };\n\n\n\n c.reloadurl = function () {\n if (c.sprite) {\n var a = ra.parsePath(c.url), b = a, d = \"\", f = b.indexOf(\"?\");\n 0 < f && (b = b.slice(0, f));\n f = b.indexOf(\"#\");\n 0 < f && (b = b.slice(0, f));\n f = b.lastIndexOf(\".\");\n 0 < f && (d = F(b.slice(f + 1)));\n if (c.loading) {\n if (c.loadingurl == a)return;\n c.loader.kobject = null;\n ba(c.loader, _[48], e, !0);\n ba(c.loader, \"load\", c.loadurl_done, !1);\n Jc(c);\n R(c.loader, _[48], e, !0);\n R(c.loader, \"load\", c.loadurl_done, !1)\n }\n if (c.loadedurl != a)\n if (D = !1, c.loadedurl = null, _[57] == b) {\n z = D = !0;\n Jc(c);\n c.loadedurl = a;\n c.createvar(_[456], c.bgcolor ? Number(c.bgcolor) : 0, u);\n c.createvar(_[463], c.bgalpha ? Number(c.bgalpha) : 0, u);\n c.createvar(_[337], c.bgroundedge ? c.bgroundedge : \"0\", u);\n c.createvar(_[406], c.bgborder ? c.bgborder : \"0\", u);\n c.createvar(_[413], c.bgshadow ? c.bgshadow : \"\", u);\n c.createvar(_[386], pa(c.bgcapture), g);\n g();\n u();\n var h = {};\n h.ss = X;\n h.onresize = function (a, b) {\n a = c.pixelwidth;\n b = c.pixelheight;\n c.imagewidth = a / c.scale;\n c.imageheight = b / c.scale;\n h.ss != X && (h.ss = X, u());\n Q = !0;\n return !1\n };\n c.jsplugin = h;\n c.loadurl_done()\n } \n else if (0 <= a.indexOf(_[281])) {\n D = !0;\n Jc(c);\n c.loadedurl = a;\n var k = new Af;\n k.registerplugin(m, c.getfullpath(), c);\n c.jsplugin = k;\n 0 == c._dyn ? (k.updatehtml(), c.loadurl_done()) : setTimeout(function () {\n k.updatehtml();\n c.loadurl_done()\n }, 7)\n } \n else\"js\" == d ? \n (D = !0, Jc(c), c.loading = !0, c.loaded = !1, c.loadingurl = a, ra.loadfile2(a, _[92], function (b) {\n c.loading = !1;\n c.loaded = !0;\n c.loadedurl = a;\n b = b.data;\n if (null != b) {\n var d = 'the file \"' + a + '\" is not a krpano plugin!';\n try {\n eval(b + \";\")\n } catch (e) {\n d = 'parsing \"' + a + '\" failed: ' + e\n }\n _[11] == typeof krpanoplugin2 ? (b = new krpanoplugin2, b.registerplugin(m, c.getfullpath(), c), c._nativeelement = !0, c.jsplugin = b, c.loadurl_done()) : la(3, d)\n }\n })) : \"swf\" == d ? la(2, c._type + \"[\" + c.name + _[78] + Vd(a)) : c.loader.src != a && (c.loaded && c.preload && (c._ispreload = !0, c.preload = !1, c.onloaded = null), ra.DMcheck(a) ? (c.loading = !0, c.loaded = !1, c.loadingurl = a, c.loader.src = a) : (c.loading = !1, la(3, c._type + \"[\" + c.name + _[85] + a)))\n }\n };\n c.loadurl_done = function () {\n 1 != c._destroyed && (0 == D && (c.sprite.style.backgroundImage = 'url(\"' + c.loader.src + '\")'), h(c, c._crop), c.loading = !1, Q = c.loaded = !0, 0 == D && (c.loadedurl = c.loadingurl), c.poschanged = !0, 0 == (b.iphone && b.retina && 7 > b.iosversion) && null == c.jsborder && 0 == D && null == c.parent && null == c._childs && (c._use_css_scale = !0), 0 == c.preload && 0 == c._ispreload && (c._busyonloaded = da.busy || da.blocked, c._busyonloaded && da.callaction(_[188], c, !0)), da.callaction(null != c.altonloaded ? c.altonloaded : c.onloaded, c, !0))\n };\n var B = null;\n c.updatepluginpos = c.updatepos = function () {\n var a = _[1] == c._type;\n c.poschanged = !1;\n var d = c.sprite, e = c.loader;\n if (d && (e || 0 != D)) {\n D && (e = null);\n var f = c._align, g = c._scale;\n f || (f = _[66]);\n var h = c._use_css_scale, k = c.imagewidth, l = c.imageheight, m = !1, p = c._crop;\n c.pressed && c._ondowncrop ? p = c._ondowncrop : c.hovering && c._onovercrop && (p = c._onovercrop);\n p && (p = String(p).split(\"|\"), 4 == p.length ? (p[0] |= 0, p[1] |= 0, p[2] |= 0, p[3] |= 0) : p = null);\n var r = c.scale9grid;\n r && (r = String(r).split(\"|\"), 4 <= r.length ? (r[0] |= 0, r[1] |= 0, r[2] |= 0, r[3] |= 0, h = c._use_css_scale = !1, c._scalechildren = !1) : r = null);\n var u = X, v = Qa, w = ya;\n a && c.distorted && (u = 1, v = w = 1E3);\n var x = 1, y = 1, z = c._parent, E = !0;\n if (z) {\n var C = n(z);\n C ? (C.poschanged && C.updatepos(), 0 == h ? (v = C._pxw * u, w = C._pxh * u) : (v = C.imagewidth * u, w = C.imageheight * u), C._scalechildren ? (x = 0 != C.imagewidth ? v / u / C.imagewidth : 1, y = 0 != C.imageheight ? w / u / C.imageheight : 1) : (x *= C._finalxscale, y *= C._finalyscale), 0 == C.loaded && (E = !1, d.style.display = \"none\")) : la(3, 'no parent \"' + z + '\" found')\n }\n var A = c._width, F = c._height, H = c._x, J = c._y, z = c._ox, K = c._oy;\n isNaN(k) && (k = 0);\n isNaN(l) && (l = 0);\n A && 0 < String(A).indexOf(\"%\") ? A = parseFloat(A) * (v / u) / (100 * x) : null == A && (A = k);\n F && 0 < String(F).indexOf(\"%\") ? F = parseFloat(F) * (w / u) / (100 * y) : null == F && (F = l);\n var S = \"prop\" == A | (\"prop\" == F) << 1, A = Number(A) * u, F = Number(F) * u;\n 0 > A && (A = v / x + A, 0 > A && (A = 0));\n 0 > F && (F = w / y + F, 0 > F && (F = 0));\n S && (S & 1 ? A = 0 != l ? Number(F) * k / l : 0 : F = 0 != k ? Number(A) * l / k : 0);\n 0 < c.maxwidth && A > u * c.maxwidth && (A = u * c.maxwidth);\n 0 < c.minwidth && A < u * c.minwidth && (A = u * c.minwidth);\n 0 < c.maxheight && F > u * c.maxheight && (F = u * c.maxheight);\n 0 < c.minheight && F < u * c.minheight && (F = u * c.minheight);\n A = A * x * g;\n F = F * y * g;\n H && 0 < String(H).indexOf(\"%\") ? H = parseFloat(H) * (v / u) / (100 * x) : null == H && (H = 0);\n J && 0 < String(J).indexOf(\"%\") ? J = parseFloat(J) * (w / u) / (100 * y) : null == J && (J = 0);\n H = Number(H) * u * x;\n J = Number(J) * u * y;\n g = c._hszscale;\n z = z && 0 < String(z).indexOf(\"%\") ? parseFloat(z) * A * g / 100 / u : null == z ? 0 : z * x;\n K = K && 0 < String(K).indexOf(\"%\") ? parseFloat(K) * F * g / 100 / u : null == K ? 0 : K * y;\n z = Number(z) * u;\n K = Number(K) * u;\n 0 != c.accuracy || a || (A = hc(A), F = hc(F));\n var g = 0 != k ? A / k : 0, S = 0 != l ? F / l : 0, ea = A / u, Z = F / u;\n if (ea != c._pxw || Z != c._pxh)c._pxw = ea, c._pxh = Z, c.pixelwidth = ea / x, c.pixelheight = Z / y, m = !0;\n this._scalechildren ? (c._finalxscale = g, c._finalyscale = S) : (c._finalxscale = x, c._finalyscale = y);\n h ? (d.style.width = k + \"px\", d.style.height = l + \"px\") : (d.style.width = A + \"px\", d.style.height = F + \"px\");\n if (r) {\n var Z = r, O = A, N = F, I = p, p = c.sprite, l = c.loader, M;\n M = X;\n 5 == Z.length && (M *= Number(Z[4]));\n e = l.naturalWidth;\n k = l.naturalHeight;\n null == I && (I = [0, 0, e, k]);\n l = 'url(\"' + l.src + '\")';\n if (null == B)for (B = Array(9), x = 0; 9 > x; x++)r = Ja(), r.kobject = c, r.imgurl = null, r.style.position = _[0], r.style.overflow = _[6], B[x] = r, p.appendChild(r);\n for (var x = [I[0] + 0, I[0] + Z[0], I[0] + Z[0] + Z[2], I[0] + I[2]], y = [I[1] + 0, I[1] + Z[1], I[1] + Z[1] + Z[3], I[1] + I[3]], ea = [Z[0], Z[2], I[2] - Z[0] - Z[2]], Z = [Z[1], Z[3], I[3] - Z[1] - Z[3]], O = [ea[0] * M | 0, O - ((ea[0] + ea[2]) * M | 0), ea[2] * M | 0], R = [Z[0] * M | 0, N - ((Z[0] + Z[2]) * M | 0), Z[2] * M | 0], T = [0, O[0], O[0] + O[1]], U = [0, R[0], R[0] + R[1]], qa, V, I = 0; 3 > I; I++)for (M = 0; 3 > M; M++)r = B[3 * I + M], N = r.style, qa = 0 != ea[M] ? O[M] / ea[M] : 0, V = 0 != Z[I] ? R[I] / Z[I] : 0, r.imgurl != l && (r.imgurl = l, N.backgroundImage = l), r = b.mac && b.firefox ? L.devicePixelRatio : 1, N[pd] = (e * qa * r | 0) / r + \"px \" + (k * V * r | 0) / r + \"px\", N.backgroundPosition = (-x[M] * qa * r | 0) / r + \"px \" + (-y[I] * V * r | 0) / r + \"px\", N.left = T[M] + \"px\", N.top = U[I] + \"px\", N.width = O[M] + \"px\", N.height = R[I] + \"px\";\n p.style.background = \"none\"\n } else {\n if (B) {\n try {\n for (k = 0; 9 > k; k++)B[k].kobject = null, d.removeChild(B[k])\n } catch (Ca) {\n }\n B = null;\n c.sprite && c.loader && (c.sprite.style.backgroundImage = 'url(\"' + c.loader.src + '\")')\n }\n p ? (k = -p[0], p = -p[1], h || (k *= g, p *= S), d.style.backgroundPosition = k + \"px \" + p + \"px\") : d.style.backgroundPosition = \"0 0\";\n e && (d.style[pd] = 0 == h ? e.naturalWidth * g + \"px \" + e.naturalHeight * S + \"px\" : e.naturalWidth + \"px \" + e.naturalHeight + \"px\")\n }\n c.jsplugin && c.jsplugin.onresize && (c._pxw != c.imagewidth || c._pxh != c.imageheight) && (p = [c.imagewidth, c.imageheight], c.imagewidth = c._pxw, c.imageheight = c._pxh, !0 === c.jsplugin.onresize(c._pxw, c._pxh) && (c.imagewidth = p[0], c.imageheight = p[1]));\n c._oxpix = z;\n c._oypix = K;\n l = \"\";\n e = p = 0;\n if (0 == a) {\n p = c._edge;\n if (null == p || \"\" == p)p = f;\n a = k = 0;\n k = 0 <= p.indexOf(\"left\") ? k + 0 : 0 <= p.indexOf(_[3]) ? k + -A : k + -A / 2;\n a = 0 <= p.indexOf(\"top\") ? a + 0 : 0 <= p.indexOf(_[2]) ? a + -F : a + -F / 2;\n p = 0 <= f.indexOf(\"left\") ? H + k : 0 <= f.indexOf(_[3]) ? v - H + k : v / 2 + H + k;\n e = 0 <= f.indexOf(\"top\") ? J + a : 0 <= f.indexOf(_[2]) ? w - J + a : w / 2 + J + a;\n c.pixelx = (p + z) / u;\n c.pixely = (e + K) / u;\n p -= q[3];\n e -= q[0];\n 0 == c.accuracy && (p = hc(p), e = hc(e));\n h && (u = f = 1, v = c.imagewidth / 2, w = c.imageheight / 2, J = H = 0, C && 0 == C._scalechildren && (f /= C.pixelwidth / C.imagewidth, u /= C.pixelheight / C.imageheight, H = -k * (1 - f), J = -a * (1 - u)), l = _[60] + (-v + H) + \"px,\" + (-w + J) + _[340] + g * f + \",\" + S * u + _[293] + v + \"px,\" + w + \"px) \");\n 0 == c.accuracy && (p = hc(p), e = hc(e));\n C = A / 2 + k;\n F = F / 2 + a;\n h && (0 != g && (C /= g, z /= g), 0 != S && (F /= S, K /= S));\n l = _[60] + p + \"px,\" + e + \"px) \" + l + _[60] + -C + \"px,\" + -F + _[332] + c._rotate + _[245] + (C + z) + \"px,\" + (F + K) + \"px)\";\n Kc && 2 > Nb && !0 !== b.opera ? l = _[182] + l : b.androidstock && (l = _[199] + l);\n ib ? d.style[ib] = l : (d.style.left = p + \"px\", d.style.top = e + \"px\");\n h = c._visible && E ? \"\" : \"none\";\n h != d.style.display && (d.style.display = h)\n }\n if (m || Q) {\n if (d = c._childs)for (m = d.length, k = 0; k < m; k++)d[k].updatepos();\n Q = !1\n }\n }\n }\n }, Af = function () {\n function a(a, b, c, e) {\n v.registerattribute(b, c, function (c) {\n r[b] != c && (r[b] = c, null != e ? e(b, c) : d(a))\n }, function () {\n return r[b]\n })\n }\n\n function d(a) {\n l |= a;\n v && null == y && (y = setTimeout(m, 0))\n }\n\n function m() {\n y = null;\n if (v) {\n var a = !1;\n 2 == l && (a = e());\n 0 == a && p();\n l = 0\n }\n }\n\n function f(a) {\n a && 0 == a.indexOf(_[74]) && ((a = U(\"data[\" + a.slice(5) + _[61])) || (a = \"\"));\n return a\n }\n\n function g(a) {\n if (a && a.parentNode)try {\n a.parentNode.removeChild(a)\n } catch (b) {\n }\n }\n\n function n(a) {\n a && (a.style.left = _[122], a.style.visibility = _[6], V.viewerlayer.appendChild(a))\n }\n\n function k(a) {\n a.ontouchend = function () {\n a.click()\n }\n }\n\n function e() {\n var a = !1;\n if (H) {\n var b = H.childNodes[0];\n if (b) {\n var a = b.style, b = pa(r.background), c = pa(r.border), d = parseInt(r.backgroundcolor), e = parseFloat(r.backgroundalpha);\n isNaN(e) && (e = 1);\n var f = parseFloat(r.borderwidth);\n isNaN(f) && (f = 1);\n var g = r.bordercolor, g = g ? parseInt(g) : 0, h = parseFloat(r.borderalpha);\n isNaN(h) && (h = 1);\n var k = Number(r.shadow);\n isNaN(k) && (k = 0);\n var l = Number(r.textshadow);\n isNaN(l) && (l = 0);\n var m = 1 == Lc ? .78 : .8, n = r.shadowangle * Y, p = r.textshadowangle * Y;\n a.backgroundColor = b ? ca(d, e) : \"\";\n a.borderColor = c && 0 < f ? ca(g, e * h) : \"\";\n a.borderRadius = 0 < D[0] + D[1] + D[2] + D[3] ? D.join(\"px \") + \"px\" : \"\";\n a[pc] = 0 < k ? Math.round(k * Math.cos(n)) + \"px \" + Math.round(k * Math.sin(n)) + \"px \" + m * r.shadowrange + \"px \" + ca(r.shadowcolor, e * r.shadowalpha) : \"\";\n a.textShadow = 0 < l ? Math.round(l * Math.cos(p)) + \"px \" + Math.round(l * Math.sin(p)) + \"px \" + m * r.textshadowrange + \"px \" + ca(r.textshadowcolor, e * r.textshadowalpha) : \"\";\n a = !0\n }\n }\n return a\n }\n\n function p() {\n if (v) {\n y && (clearTimeout(y), y = null);\n var a = 2 == u || 1 == u && 0 == v.haveUserWidth(), d = 2 == h || 1 == h && 0 == v.haveUserHeight(), g = r.html, m = r.css, g = g ? f(g) : \"\", m = m ? f(m) : \"\";\n pa(r.background);\n var w = pa(r.border), t = parseFloat(r.borderwidth);\n isNaN(t) && (t = 1);\n var g = Ed(g), m = m.split(\"0x\").join(\"#\"), E = m.split(\"}\").join(\"{\").split(\"{\");\n if (1 < E.length) {\n for (var D = [], m = 1; m < E.length; m += 2) {\n var J = Ha(E[m - 1]), L = E[m], M = \"p\" == F(J) ? \"div\" : J, g = g.split(\"<\" + J).join(\"<\" + M + _[407] + L + \"' \"), g = g.split(\"</\" + J + \">\").join(\"</\" + M + \">\");\n D.push(E[m])\n }\n m = \"\"\n }\n g = _[206] + K[0] + \"px \" + K[1] + \"px \" + K[2] + \"px \" + K[3] + \"px;\" + m + \"'>\" + g + _[68];\n 1 == r.vcenter && 0 == d && (g = \"<table style='width:100%;height:100%;border-collapse:collapse;text-decoration:inherit;'><tr style='vertical-align:middle;'><td style='padding:0;'>\" + g + _[214]);\n g = g.split(\"<p\").join(_[161]);\n g = g.split(\"</p>\").join(_[68]);\n m = _[213];\n if (1 == a || 0 == pa(r.wordwrap))m += _[205];\n 0 == d && (m += _[308]);\n z = 1;\n w && 0 < t ? (z = t * X, m += _[450] + Math.ceil(t) + _[197]) : z = 0;\n 0 == a && (m += _[505] + v.imagewidth + _[202]);\n g = unescape(g);\n g = '<div style=\"' + m + '\">' + g + _[68];\n v.sprite.style.color = _[26];\n v.sprite.style[_[51]] = \"none\";\n H && H.parentNode == v.sprite && (A = H, H = null);\n null == H && (H = Ja(), I = H.style, pa(r.selectable) && (I.webkitUserSelect = I.MozUserSelect = I.msUserSelect = I.oUserSelect = I.userSelect = \"text\", I.cursor = \"text\"), I.position = _[0], I.left = I.top = -z + \"px\", _[1] == v._type && 1 == v._distorted ? (I.width = \"100%\", I.height = \"100%\", I[ib] = \"\") : (I[Zc] = \"0 0\", I[ib] = _[141] + X + \")\", I.width = 100 / X + \"%\", I.height = 100 / X + \"%\"), I.fontSize = \"12px\", I.fontFamily = \"Arial\", I.lineHeight = _[45]);\n H.innerHTML = g;\n e();\n if (a = H.getElementsByTagName(\"a\"))if (d = a.length, 0 < d)for (m = 0; m < d; m++)if (g = a[m])w = \"\" + g.href, _[509] == w.toLowerCase().slice(0, 6) && (g.href = _[173] + V.viewerlayer.id + _[376] + w.slice(6).split(\"'\").join('\"') + \"','\" + v.getfullpath() + \"');\"), b.touch && k(g);\n _[1] == v._type && (v.forceupdate = !0, ob(!0, v.index));\n n(H);\n c = !1;\n v.loaded = !0;\n v.scalechildren = v.scalechildren;\n C = 0;\n null == q && (q = setTimeout(x, 10));\n l = 0\n }\n }\n\n function x() {\n q = null;\n c = !1;\n if (v && H) {\n var a = 2 == u || 1 == u && 0 == v.haveUserWidth(), b = 2 == h || 1 == h && 0 == v.haveUserHeight();\n J = !0;\n var d = H && H.parentNode == v.sprite, e = 0, f = 0;\n if (0 == a && 0 == b)f = v.imageheight, 1 > f && (f = 1); else {\n try {\n e = H.childNodes[0].clientWidth, f = H.childNodes[0].clientHeight, 3 > f && (f = 0)\n } catch (k) {\n }\n if (1 > f && d && H.parentNode && 1 > H.parentNode.clientHeight) {\n n(H);\n C = 0;\n null == q && (q = setTimeout(x, 10));\n J = !1;\n return\n }\n }\n if (0 < f) {\n if (v._enabledstate = null, v.enabled = v._enabled, I.top = I.left = -z + \"px\", c = !0, A && A.parentNode == v.sprite ? (I.visibility = _[12], v.sprite.replaceChild(H, A), A = null) : (g(A), A = null, I.visibility = _[12], v.sprite.appendChild(H)), 0 != a || 0 != b)if (e = a ? Math.round(e) : v.imagewidth, f = b ? Math.round(f) : v.imageheight, e != v._width || f != v._height)a && (v._width = e), b && (v._height = f), v.poschanged = !0, _[1] == v._type ? ob(!0, v.index) : v.updatepluginpos(), v.onautosized && da.callaction(v.onautosized, v, !0)\n } else C++, 10 > C ? null == q && (q = setTimeout(x, 20)) : (A && A.parentNode == v.sprite && (v.sprite.replaceChild(H, A), A = null), v.height = 0);\n J = !1\n }\n }\n\n var v = null, r = {}, y = null, l = 0, u = 1, h = 1, c = !1, K = [0, 0, 0, 0], D = [0, 0, 0, 0], z = 1, q = null, J = !1, C = 0, L = X, A = null, H = null, I = null;\n this.registerplugin = function (b, c, e) {\n v = e;\n b = v.html;\n c = v.css;\n delete v.html;\n delete v.css;\n v._istextfield = !0;\n v.accuracy = 0;\n v.registerattribute(_[377], \"auto\", function (a) {\n u = \"auto\" == F(a) ? 1 : 2 * pa(a);\n d(1)\n }, function () {\n return 1 == u ? \"auto\" : 2 == u ? \"true\" : _[31]\n });\n v.registerattribute(_[357], \"auto\", function (a) {\n h = \"auto\" == F(a) ? 1 : 2 * pa(a);\n d(1)\n }, function () {\n return 1 == h ? \"auto\" : 2 == h ? \"true\" : _[31]\n });\n a(1, _[446], !1);\n a(1, _[132], \"2\", function (a, b) {\n Ib(b, 1, \" \", K);\n d(1)\n });\n a(2, _[107], !0);\n a(2, _[235], 1);\n a(2, _[237], 16777215);\n a(1, _[71], !1);\n a(1, _[105], 1);\n a(2, _[104], 1);\n a(2, _[101], 0);\n a(2, _[380], \"0\", function (a, b) {\n Ib(b, 1, \" \", D);\n d(2)\n });\n a(2, _[522], 0);\n a(2, _[320], 4);\n a(2, _[318], 45);\n a(2, _[316], 0);\n a(2, _[315], 1);\n a(2, _[366], 0);\n a(2, _[241], 4);\n a(2, _[242], 45);\n a(2, _[243], 0);\n a(2, _[244], 1);\n a(1, _[370], !1);\n a(1, _[410], !0);\n a(1, _[502], \"\");\n v.registerattribute(\"blur\", 0);\n v.registerattribute(_[408], 0);\n v.registerattribute(_[440], null, function (a) {\n null != a && \"\" != a && \"none\" != (\"\" + a).toLowerCase() && (h = 2, d(1))\n }, function () {\n return 2 == h ? _[136] : \"none\"\n });\n v.registercontentsize(400, 300);\n v.sprite.style.pointerEvents = \"none\";\n a(1, \"html\", b ? b : \"\");\n a(1, \"css\", c ? c : \"\")\n };\n this.unloadplugin = function () {\n v && (v.loaded = !1, q && clearTimeout(q), y && clearTimeout(y), g(A), g(H));\n v = y = q = I = H = A = null\n };\n this.onvisibilitychanged = function (a) {\n a && _[1] == v._type && (v.forceupdate = !0, ob(!0, v.index));\n return !1\n };\n this.onresize = function (a, b) {\n if (L != X)return L = X, Ib(r.padding, 1, \" \", K), Ib(r.roundedge, 1, \" \", D), p(), !1;\n if (J)return !1;\n if (v) {\n var d = 2 == u || 1 == u && 0 == v.haveUserWidth(), e = 2 == h || 1 == h && 0 == v.haveUserHeight();\n v.registercontentsize(a, b);\n H && (_[1] != v._type || 1 != v._distorted ? (I[ib] = _[141] + X + \")\", I.width = 100 / X + \"%\", I.height = 100 / X + \"%\") : (I[ib] = \"\", I.width = \"100%\", I.height = \"100%\"), c && (I.left = I.top = -z + \"px\"), 0 == d && (H.childNodes[0].style.width = a + \"px\"), 0 == e && (H.childNodes[0].style.height = b + \"px\"), d || e ? (c = !1, d && (v.sprite.style.width = 0), e && (v.sprite.style.height = 0), C = 0, null == q && (q = setTimeout(x, 10))) : (0 == d && (I.width = a + 2 * z + \"px\"), 0 == e && (I.height = b + \"px\")))\n }\n return !1\n };\n this.updatehtml = p\n }, ub = !1, qc = 1, wf = function () {\n function a() {\n 0 == b.css3d && d._distorted && (d._distorted = !1, d.zoom = !0);\n d.poschanged = !0;\n d.jsplugin && d.jsplugin.onresize && (d.forceupdate = !0, d.imagewidth = d.imageheight = 0);\n d.sprite && (d._visible && d.loaded && ob(!0, d.index), d.sprite.style[ib + _[143]] = d._distorted ? \"0 0\" : _[461])\n }\n\n var d = this;\n d.prototype = Ob;\n this.prototype.call(this);\n d._type = _[1];\n var m = d.createvar;\n m(\"ath\", 0);\n m(\"atv\", 0);\n m(\"depth\", 1E3);\n m(_[501], 0);\n d.scaleflying = !0;\n m(\"zoom\", !1);\n m(\"rx\", 0);\n m(\"ry\", 0);\n m(\"rz\", 0);\n m(\"tx\", 0);\n m(\"ty\", 0);\n m(\"tz\", 0);\n m(_[401], !1, a);\n d.accuracy = 1;\n d.zorder2 = 0;\n d.inverserotation = !1;\n d.forceupdate = !1;\n d._hit = !1;\n d.point = new bb(null);\n var f = d.create;\n d.create = function () {\n function b() {\n Gd(d)\n }\n\n f();\n d.createvar(_[121], d.polyline ? pa(d.polyline) : !1, b);\n d.createvar(_[398], d.fillcolor ? Number(d.fillcolor) : 11184810, b);\n d.createvar(_[396], d.fillalpha ? Number(d.fillalpha) : .5, b);\n d.createvar(_[105], d.borderwidth ? Number(d.borderwidth) : 3, b);\n d.createvar(_[101], d.bordercolor ? Number(d.bordercolor) : 11184810, b);\n d.createvar(_[104], d.borderalpha ? Number(d.borderalpha) : 1, b);\n a()\n };\n d.updatepos = function () {\n d.poschanged = !0\n };\n d.getcenter = function () {\n var a = 0, b = 0, f = 25;\n if (d._url)a = d._ath, b = d._atv, f = 25 * Number(d.scale); else {\n for (var e = d.point.getArray(), m = 0, p = e.length, v, r, y, l = 5E4, u = -5E4, h = 5E4, c = -5E4, E = 5E4, D = -5E4, z = 0, q = 0, F = 0, m = 0; m < p; m++)r = e[m], v = Number(r.ath), y = Number(r.atv), r = 0 > v ? v + 360 : v, v < l && (l = v), v > u && (u = v), r < h && (h = r), r > c && (c = r), y < E && (E = y), y > D && (D = y), v = (180 - v) * Y, y *= Y, z += Math.cos(y) * Math.cos(v), F += Math.cos(y) * Math.sin(v), q += Math.sin(y);\n 0 < p && (z /= p, q /= p, F /= p, a = 90 + Math.atan2(z, F) / Y, b = -Math.atan2(-q, Math.sqrt(z * z + F * F)) / Y, 180 < a && (a -= 360), v = u - l, y = D - E, 170 < v && (v = c - h), f = v > y ? v : y)\n }\n 1 > f ? f = 1 : 90 < f && (f = 90);\n e = new Hb;\n e.x = a;\n e.y = b;\n e.z = f;\n f = arguments;\n 2 == f.length && (I(f[0], a, !1, this), I(f[1], b, !1, this));\n return e\n }\n }, $d = \"\", ic = 1, Be = \"translate3D(;;px,;;px,0px) ;;rotateX(;;deg) rotateY(;;deg) ;;deg) rotateX(;;deg) scale3D(;;) translateZ(;;px) rotate(;;deg) translate(;;px,;;px) rotate;;deg) rotate;;deg) rotate;;deg) scale(;;,;;) translate(;;px,;;px)\".split(\";\"), Ce = \"translate(;;px,;;px) translate(;;px,;;px) rotate(;;deg) translate(;;px,;;px) scale(;;,;;) translate(;;px,;;px)\".split(\";\"), tf = function () {\n this.fullscreen = b.fullscreensupport;\n this.touch = this.versioninfo = !0;\n this.customstyle = null;\n this.enterfs = _[371];\n this.exitfs = _[246];\n this.item = new bb(function () {\n this.visible = this.enabled = !0;\n this.caption = null;\n this.separator = !1;\n this.onclick = null\n })\n }, Xd = function () {\n function a(a) {\n var b = ja.FRM;\n if (0 == b && n)n(a); else {\n 0 == b && (b = 60);\n var d = 1E3 / b, b = (new Date).getTime(), d = Math.max(0, d - (b - g));\n L.setTimeout(a, d);\n g = b + d\n }\n }\n\n function d() {\n m && (f(), a(d))\n }\n\n var m = !0, f = null, g = 0, n = L.requestAnimationFrame || L.webkitRequestAnimationFrame || L.mozRequestAnimationFrame || L.oRequestAnimationFrame || L.msRequestAnimationFrame;\n return {\n start: function (g) {\n if (b.ios && 9 > b.iosversion || b.linux && b.chrome)n = null;\n m = !0;\n f = g;\n a(d)\n }, stop: function () {\n m = !1;\n f = null\n }\n }\n }();\n Jb.init = function (a) {\n Jb.so = a;\n b.runDetection(a);\n if (b.css3d || b.webgl)ib = b.browser.css.transform, Id = ib + \"Style\", Zc = ib + _[143];\n pd = b.browser.css.backgroundsize;\n pc = b.browser.css.boxshadow;\n var d = b.webkit && 534 > b.webkitversion, E = 0;\n b.ios && 0 == b.simulator ? (Nb = 0, 5 <= b.iosversion && 1 != Yc && (Nb = 1, E = b._cubeOverlap = 4)) : b.android ? (Nb = 2, b._cubeOverlap = 0, E = 4, b.chrome ? (Nb = 1, Lc = 0, b._cubeOverlap = 4) : b.firefox && (E = 0)) : (b.windows || b.mac) && d ? (be = 1, Lc = Nb = 0, b._cubeOverlap = 4) : (Nb = 1, Lc = 0, E = 2, b.desktop && b.safari && (E = 8), b.chrome && (22 <= b.chromeversion && 25 >= b.chromeversion ? (b._cubeOverlap = 64, E = 16) : b._cubeOverlap = 1), b.ie && (E = 8));\n b._tileOverlap = E;\n qf();\n if (!V.build(a))return !1;\n ia.layer = V.controllayer;\n ia.panoControl = Pa;\n ia.getMousePos = V.getMousePos;\n ja.htmltarget = V.htmltarget;\n ja.viewerlayer = V.viewerlayer;\n la(1, _[128] + m.version + _[426] + m.build + (m.debugmode ? _[476] : \")\"));\n d = !(b.android && b.firefox && 22 > b.firefoxversion);\n a.html5 && (E = F(a.html5), 0 <= E.indexOf(_[30]) ? d = !0 : 0 <= E.indexOf(\"css3d\") && (d = !1));\n b.webgl && d ? Oa.setup(2) : Oa.setup(1);\n la(1, b.infoString + Oa.infoString);\n a && a.basepath && \"\" != a.basepath && (ra.swfpath = a.basepath);\n V.onResize(null);\n Pa.registerControls(V.controllayer);\n Xd.start(xf);\n if (!b.css3d && !b.webgl && 0 > F(a.html5).indexOf(_[488]))Ea(_[156]); else {\n var f, g, n = [], d = !0, E = 0, k = [], e = _[150].split(\" \"), w = _[151].split(\" \"), x = null, v = null, r = Xc(100), y = F(_[160]).split(\";\"), l, u;\n if (null != mb && \"\" != mb) {\n var h = ra.b64u8(mb), c = h.split(\";\");\n if (l = c[0] == y[0])if (h = F(h), 0 <= h.indexOf(y[6]) || 0 <= h.indexOf(y[7]) || 0 <= h.indexOf(y[8]))l = !1;\n var h = mb = null, h = c.length, h = h - 2, K = c[h], D = 0;\n 0 == K.indexOf(\"ck=\") ? K = K.slice(3) : l = !1;\n if (l)for (l = 0; l < h; l++) {\n var z = c[l], q = z.length;\n for (u = 0; u < q; u++)D += z.charCodeAt(u) & 255;\n if (!(4 > q) && (u = z.slice(3), \"\" != u))switch (_[177].indexOf(z.slice(0, 3)) / 3 | 0) {\n case 1:\n Ya = parseInt(u);\n d = 0 == (Ya & 1);\n break;\n case 2:\n f = u;\n n.push(y[1] + \"=\" + u);\n break;\n case 3:\n g = u;\n n.push(y[2] + u);\n break;\n case 4:\n k.push(u);\n n.push(y[3] + \"=\" + u);\n break;\n case 5:\n z = parseInt(u);\n x = new Date;\n x.setFullYear(z >> 16, (z >> 8 & 15) - 1, z & 63);\n break;\n case 6:\n v = u;\n break;\n case 7:\n q = z = u.length;\n if (128 > z)for (; 128 > q;)u += u.charAt(q % z), q++;\n od = u;\n break;\n case 8:\n break;\n case 9:\n Na = u.split(\"|\");\n 4 != Na.length && (Na = null);\n break;\n case 10:\n break;\n default:\n n.push(z)\n }\n }\n D != parseInt(K) && (E = 1);\n l = aa.location;\n l = F(l.search || l.hash);\n if (0 < l.indexOf(_[90])) {\n Ea(n.join(\", \"), F(_[90]).toUpperCase());\n return\n }\n 0 < l.indexOf(_[248]) && (null == a.vars && (a.vars = {}), a.vars.consolelog = !0, Ya = Ya & 1 | 14);\n c = null\n }\n vc = n = F(aa[y[3]]);\n try {\n throw Error(\"path\");\n } catch (J) {\n l = \"\" + J.stack, c = l.indexOf(\"://\"), 0 < c && (c += 3, h = l.indexOf(\"/\", c), l = l.slice(c, h), h = l.indexOf(\":\"), 0 < h && (l = l.slice(0, h)), vc = l)\n }\n 0 == n.indexOf(_[524]) && (n = n.slice(4));\n y = \"\" == n || _[382] == n || _[381] == n || 0 == n.indexOf(y[4]);\n b.browser.domain = y ? null : n;\n if (0 == (Ya & 2) && y)E = 3; else if (!y) {\n l = n.indexOf(\".\") + 1;\n 0 > n.indexOf(\".\", l) && (l = 0);\n y = n;\n n = n.slice(l);\n 0 == n.indexOf(_[479]) && _[109] != n && (E = 2);\n for (l = 0; l < e.length; l++)if (e[l] == n) {\n E = 2;\n break\n }\n if (0 == E && 0 < k.length)for (E = 2, l = 0; l < k.length; l++)if (n == k[l] || gd(k[l], y)) {\n E = 0;\n break\n }\n }\n if (f || g)for (g = (\".\" + f + \".\" + g).toLowerCase(), l = 0; l < w.length; l++)0 <= g.indexOf(w[l]) && (E = 1);\n if (null != x && new Date > x)Ea(_[250]), null != v && setTimeout(function () {\n L.location = v\n }, 500); else if (0 < E)Ea(_[97] + [\"\", _[251], _[222]][E - 1]); else {\n Na && (Ya &= -129, la(1, Na[0]));\n 0 == d && (f ? la(1, _[253] + f) : d = !0);\n (d || 0 == (Ya & 1)) && V.log(r);\n f = null;\n a.xml && (f = a.xml);\n a.vars && (a.vars.xml && (f = a.vars.xml), f || (f = a.vars.pano));\n 0 == (Ya & 4) && (a.vars = null);\n Ya & 16 && (m[rc[0]] = m[rc[1]] = !1);\n g = V.viewerlayer;\n Ya & 8 ? (g.get = gc(U), g.set = gc(I), g.call = hd) : (g.set = function () {\n la(2, _[180])\n }, g.get = Na ? gc(U) : g.set, g.call = gc(da.SAcall));\n g.screentosphere = p.screentosphere;\n g.spheretoscreen = p.spheretoscreen;\n g.unload = ve;\n a.initvars && Wd(a.initvars);\n da.loadpano(f, a.vars);\n if (a.onready)a.onready(g);\n return !0\n }\n }\n }\n }\n\n var _ = function () {\n // var F = mb;\n // mb = null;\n // var Ha = F.length - 3, pa, ga, sa, ha = \"\", va = \"\", Aa = 1, R = 0, ba = [], Ja = [1, 48, 55, 53, 38, 51, 52, 3];\n // sa = F.charCodeAt(4);\n // for (pa = 5; pa < Ha; pa++)ga = F.charCodeAt(pa), 92 <= ga && ga--, 34 <= ga && ga--, ga -= 32, ga = (ga + 3 * pa + 59 + Ja[pa & 7] + sa) % 93, sa = (23 * sa + ga) % 32749, ga += 32, 124 == ga ? 0 == Aa ? R ^= 1 : 1 == R ? R = 0 : (ba.push(ha), ha = \"\", Aa = 0) : (ga = String.fromCharCode(ga), 0 == R ? ha += ga : va += ga, Aa++);\n // 0 < Aa && ba.push(ha);\n // ga = 0;\n // for (Ha += 3; pa < Ha;)ga = ga << 5 | F.charCodeAt(pa++) - 53;\n // ga != sa && (ba = null);\n // mb = va;\n\n\n //sohow\n // var ba_json = window.JSON.stringify(ba);\n var ba = new Array(\"absolute\",\"hotspot\",\"bottom\",\"right\",\"mouseup\",\"default\",\"hidden\",\"mousedown\",\"pointerover\",\"pointerout\",\"mousemove\",\"function\",\"visible\",\"string\",\"action\",\"container\",\"mouseover\",\"mouseout\",\"pointer\",\"mouse\",\"translateZ(+2000000000000px)\",\" - xml parsing failed!\",\"parsererror\",\"px solid \",\"cylinder\",\"text/xml\",\"#000000\",\"moveto\",\"height\",\"plugin\",\"webgl\",\"false\",\" - wrong encryption!\",\"Invalid expression\",\"MSPointerOver\",\"MSPointerOut\",\"transparent\",\"contextmenu\",\"sans-serif\",\"cubestrip\",\"#FFFFFF\",\"iphone\",\"sphere\",\"linear\",\"mobile\",\"normal\",\"krpano\",\"color\",\"error\",\"width\",\"align\",\"-webkit-text-size-adjust\",\"visibilitychange\",\"translate3D(\",\"image.level[\",\"Courier New\",\"easeoutquad\",\"<container>\",\"loading of \",\"preserve-3d\",\"translate(\",\"].content\",\" failed!\",\"onresize\",\"pagehide\",\"position\",\"lefttop\",\"boolean\",\"</div>\",\"LOOKTO\",\"webkit\",\"border\",\"scene[\",\"blend\",\"data:\",\"image\",\"-webkit-tap-highlight-color\",\"http://www.w3.org/2000/svg\",\"] skipped flash file: \",\"webkitvisibilitychange\",\" - loading failed! (\",\"mozvisibilitychange\",\"msvisibilitychange\",\"experimental-webgl\",\"orientationchange\",\"] loading error: \",\"deg) translateZ(\",\"unknown action: \",\"uniform vec3 cc;\",\"actions overflow\",\"showlicenseinfo\",\"MSGestureChange\",\"text/javascript\",\"MSInertiaStart\",\"get:calc:data:\",\"DOMMouseScroll\",\"MSGestureStart\",\"LICENSE ERROR\",\"opacity 0.25s\",\"MSGestureEnd\",\"onmousewheel\",\"bordercolor\",\"scene.count\",\"onmousedown\",\"borderalpha\",\"borderwidth\",\") rotateZ(\",\"background\",\"mousewheel\",\"krpano.com\",\"fullscreen\",\"undefined\",\"webkit-3d\",\"onmouseup\",\"marginTop\",\"touchmove\",\"moz-webgl\",\"</krpano>\",\"touchend\",\"relative\",\"fontSize\",\"polyline\",\"-10000px\",\"offrange\",\"<krpano>\",\"rotateY(\",\"keydown\",\"plugin[\",\"krpano \",\"include\",\"onkeyup\",\"onclick\",\"padding\",\"scroll\",\"layer[\",\"DEBUG:\",\"center\",\"resize\",\"tablet\",\"&nbsp;\",\"ERROR:\",\"scale(\",\"opaque\",\"Origin\",\"object\",\" edge/\",\"iPhone\",\"Chrome\",\"cursor\",\"parent\",\"360etours.net clickcwb.com.br afu360.com realtourvision.com webvr.net webvr.cn round.me aero-scan.ru shambalaland.com littlstar.com d3uo9a4kiyu5sk.cloudfront.net youvisit.com vrvideo.com\",\"panofree freeuser figgler teameat eatusebuy no-mail chen44 .lestra. gfreidinger an37almk\",\"gl_FragColor=vec4(texture2D(sm,(tx-ct)/mix(1.0,zf,1.0-aa)+ct).rgb,aa);\",\"gl_FragColor=vec4(mix(texture2D(sm,tx).rgb,cc,2.0*(1.0-aa)),aa*2.0);\",\" - invalid name! Names need to begin with an alphabetic character!\",\"if(\\'%5\\'!=\\'NEXTLOOP\\',%1);if(%2,%4;%3;for(%1,%2,%3,%4,NEXTLOOP););\",\"A Browser with CSS 3D Transforms or WebGL support is required!\",\"abs acos asin atan ceil cos exp floor log round sin sqrt tan\",\"gl_FragColor=vec4(texture2D(sm,tx).rgb+(1.0-aa)*cc,aa);\",\"uniform sampler2D sm;varying vec2 tx;uniform float aa;\",\"kr;user;mail=;domain;file:;id;chen4490;teameat;figgler\",\"<div style=\\'padding-top:2.5px; padding-bottom:5px;\\' \",\"WebGL-Error shaderProgram: could not link shaders!\",\"uniform vec2 ap;uniform float zf;uniform float bl;\",\"if(%1,%2;delayedcall(0,asyncloop(%1,%2,%3));,%3);\",\"there is already a html element with this id: \",\"<div style=\\'padding:8px; text-align:center;\\'>\",\"-webkit-radial-gradient(circle, white, black)\",\"gl_FragColor=vec4(texture2D(sm,tx).rgb,aa);\",\"<i><b>krpano</b><br/>demo&nbsp;version</i>\",\" - invalid or unsupported xml encryption!\",\"No device compatible image available...\",\"there is no html element with this id: \",\"javascript:document.getElementById(\\'\",\"left front right back up down cube\",\"uniform vec3 fp;uniform float bl;\",\"uniform vec2 ct;uniform float zf;\",\"xx=lz=rg=ma=dm=ed=eu=ek=rd=pt=id=\",\"color:#FF0000;font-weight:bold;\",\"1px solid rgba(255,255,255,0.5)\",\"Javascript Interface disabled!\",\" - loading or parsing failed!\",\"translateZ(+1000000000000px) \",\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\"loading or parsing failed!\",\"WebGL-Error vertexShader: \",\"WebGL-Error pixelShader: \",\"precision mediump float;\",\"set(_busyonloaded,false)\",\"krpano embedding error: \",\" (not a cubestrip image)\",\"webkitRequestFullScreen\",\"if(%1,%2;loop(%1,%2););\",\"architecturalonlymiddle\",\"webkitRequestFullscreen\",\"(-webkit-transform-3d)\",\"preservedrawingbuffer\",\"px solid transparent;\",\" - style not found: \",\"translateZ(+1000px) \",\"<span style=\\'color:#\",\"mozRequestFullScreen\",\"px;overflow:hidden;\",\"0px 0px 8px #FFFFFF\",\"addlayer/addplugin(\",\"white-space:nowrap;\",\"<div style=\\'margin:\",\"px,0px) translateY(\",\"xml parsing failed!\",\"msRequestFullscreen\",\"-ms-overflow-style\",\"preview.striporder\",\"-webkit-box-shadow\",\"position:absolute;\",\"</td></tr></table>\",\"distortionfovlink\",\"onpreviewcomplete\",\"WebkitPerspective\",\"Microsoft.XMLHTTP\",\"<krpano></krpano>\",\"http://krpano.com\",\"onenterfullscreen\",\" - NO LOCAL USAGE\",\"requestFullscreen\",\"Internet Explorer\",\"onexitfullscreen\",\"rgba(0,0,0,0.01)\",\"access permitted\",\"fullscreenchange\",\"FullscreenChange\",\"webkitUserSelect\",\"framebufferscale\",\"px) perspective(\",\"__defineGetter__\",\"__defineSetter__\",\"backgroundalpha\",\"MSPointerCancel\",\"backgroundcolor\",\"Android Browser\",\"1px solid white\",\" <small>(build \",\"textshadowrange\",\"textshadowangle\",\"textshadowcolor\",\"textshadowalpha\",\"deg) translate(\",\"Exit Fullscreen\",\"ignoring image \",\"consolelog=true\",\"-moz-box-shadow\",\"LICENSE EXPIRED\",\" - WRONG DOMAIN\",\"WebkitBoxShadow\",\"Registered to: \",\"krpanoSWFObject\",\"backgroundColor\",\"backgroundSize\",\"color:#AA7700;\",\"pointer-events\",\"color:#007700;\",\"Microsoft Edge\",\")</small><br/>\",\"color:#333333;\",\"translateZ(0) \",\"visiblePainted\",\"onloadcomplete\",\"return false;\",\"pointerEvents\",\"stereographic\",\"deg) rotateX(\",\"#FFF 0px 0px \",\"deg) rotateZ(\",\"easeInOutSine\",\"0123456789+/=\",\" translate3D(\",\"mobile safari\",\"gesturechange\",\"scalechildren\",\"onviewchanged\",\"mozUserSelect\",\"pointercancel\",\"textfield.swf\",\" not allowed!\",\"MSPointerMove\",\"deg) rotateY(\",\"HTML5/Desktop\",\"paddingBottom\",\"onxmlcomplete\",\"WebGL-Error: \",\"windows phone\",\"MSPointerDown\",\" FATAL ERROR:\",\"MozBoxShadow\",\") translate(\",\"preview.type\",\"px) rotateX(\",\"paddingRight\",\"Amazon Silk \",\"&nbsp;</div>\",\"onviewchange\",\"gesturestart\",\"onremovepano\",\"maskchildren\",\"perspective(\",\"vlookatrange\",\"hlookatrange\",\"keephotspots\",\"actioncaller\",\"height:100%;\",\"</encrypted>\",\"removescenes\",\"image.tablet\",\"stroke-width\",\"image.mobile\",\"oninterrupt\",\"shadowalpha\",\"shadowcolor\",\"easeoutsine\",\"shadowangle\",\"easeincubic\",\"shadowrange\",\"addhotspot(\",\"preview.url\",\"keepplugins\",\"easeInCubic\",\"translateZ(\",\"stageheight\",\"touchcancel\",\"MSPointerUp\",\"paddingLeft\",\"pointermove\",\"pointerdown\",\"px) rotate(\",\"<encrypted>\",\"versioninfo\",\"perspective\",\"BlackBerry \",\"bgroundedge\",\"whiteSpace\",\"onovercrop\",\"px) scale(\",\"ondowncrop\",\"box-shadow\",\"touchstart\",\"rim tablet\",\"blackberry\",\"paddingTop\",\"fontFamily\",\"2015-08-04\",\"%FIRSTXML%\",\"1px solid \",\"stagewidth\",\"stagescale\",\"handcursor\",\"ignorekeep\",\"gestureend\",\" Simulator\",\"autoheight\",\"keepscenes\",\"LIGHTBLEND\",\"keepmoving\",\"CURRENTXML\",\"showerrors\",\"COLORBLEND\",\"distortion\",\"SLIDEBLEND\",\"textshadow\",\"FATALERROR\",\"yesontrue1\",\"onnewscene\",\"selectable\",\"Fullscreen\",\"javascript\",\"px #FFFFFF\",\"encrypted\",\"</center>\",\"\\').call(\\'\",\"autowidth\",\" (Chrome)\",\"fullrange\",\"roundedge\",\"127.0.0.1\",\"localhost\",\"framerate\",\"onkeydown\",\"Viewer...\",\"bgcapture\",\"transform\",\"boxShadow\",\"__swfpath\",\"pointerup\",\"nopreview\",\"useragent\",\"<![CDATA[\",\"].onstart\",\"textAlign\",\"fillalpha\",\"timertick\",\"fillcolor\",\"OPENBLEND\",\"keepimage\",\"distorted\",\"asyncloop\",\"autoalpha\",\"ZOOMBLEND\",\"onnewpano\",\"bgborder\",\" style=\\'\",\"textblur\",\"asyncfor\",\"wordwrap\",\"pre-line\",\"keepbase\",\"bgshadow\",\"Panorama\",\"jsborder\",\"FFF00;\\'>\",\"</span> \",\"keepview\",\"00000000\",\"WARNING:\",\"overflow\",\"HTMLPATH\",\" - WebGL\",\"__fte1__\",\"__fte2__\",\" (build \",\"distance\",\"Calling \",\"scale3D(\",\"panotour\",\"SAMSUNG \",\"1.19-pr3\",\"<center>\",\"Firefox \",\"videourl\",\"iemobile\",\"FIRSTXML\",\"jsplugin\",\"ap,zf,bl\",\"autosize\",\"0px 0px \",\"<=>=!===\",\"</small>\",\"polygon\",\"Mobile \",\"vcenter\",\"Tablet \",\"webkit/\",\"Chrome \",\"border:\",\"Version\",\"action(\",\"action[\",\"Android\",\"].value\",\"bgcolor\",\" - iOS:\",\"WARNING\",\"keepall\",\"Firefox\",\"50% 50%\",\"preview\",\"bgalpha\",\"android\",\"desktop\",\"preinit\",\"onstart\",\"bglayer\",\"trident\",\"current\",\"display\",\"enabled\",\"BASEDIR\",\"fovtype\",\"SWFPATH\",\" debug)\",\"pannini\",\"plugin:\",\"krpano.\",\"BGLAYER\",\"<small>\",\"opacity\",\"devices\",\"lighter\",\"drag2d\",\"canvas\",\"image.\",\"always\",\"logkey\",\"blend(\",\"stereo\",\"onidle\",\"stagey\",\"Webkit\",\"stagex\",\"smooth\",\"&quot;\",\"origin\",\"&apos;\",\"random\",\"flying\",\"effect\",\"zorder\",\"_blank\",\"width:\",\"points\",\"delete\",\"switch\",\"event:\",\"stroke\",\" Build\",\"alturl\",\"Tablet\",\"Gecko/\",\"style[\",\"rotate\",\"Opera \",\"Mobile\",\"lfrbud\",\"Safari\",\"CriOS/\",\"shadow\",\"number\",\"www.\",\"\");\n mb = 'a3I7aWQ9NDk5ODEzMDAzLzIwMTUtMTEtMDk7bHo9MTU5O3JnPeWkqea0peaegeedv+i9r+S7tuaKgOacr+W8gOWPkeaciemZkOWFrOWPuDttYT10ZXJhQGdlZXJlaS5jb207ZWs9Mm5vM3JuM2xlM2x0M3RwMnNyM2hlM2xwMnNlMmlpM2xnM2tpMmZwMmlzZGJZYlhQWVlZYllaTFhhYWRNTk5OTE1MTE1kTExMTUtMTEtMTmQyc3AyZ3BIM3BzZDJoazJzcDJzZjJzbDJtaDJoczNsaDJpaDNnbzNrbTJscE5NS047cmQ9SlBLR1E7Y2s9MTc2MTI7';\n\n return ba\n }();\n\n _ && _[111] != typeof krpanoJS && (new hd).init(gd)\n }", "function vB_PHP_Emulator()\n{\n}", "function XujWkuOtln(){return 23;/* vO5K0TFskMu F17GpWQ70j mOtPuVGsIS ni946YsF0315 oec03VPSXH 7y9H5f0ai41M i5VvgKN2TvtI ujBRalYVB7T RDHodC0QDj y5ztFal0VAY vfkVPKOLcj cRtNl13djcE IaqjmbSCAq4Z NuiiIXX5d3 ph2OjBRfX3ZK lXvBMXyE2mNH pWyRLpaXguFG WBzqGLH75du MgSotV20Uey Flo7uiKjCTOo QspSJiCVCK wRDVRjAG6g HnMMuCyhk7 mpbSnT0CH0cm eLUKt4Ahum Bbi7coOwsAr6 ucYeUY6Opm GQrCyzlocG XkjaFkHbbvAj aRXDHChE63 AfyGwY27EFBP JKgEpjEy7ch 3UD23TBRd8A qHkhwvzBwmQ 1ISOvRsVTbq Z2UfcdvCwEtl HvuvE9v0Evv 1iiWgBZHuTe dcxnLS6mnBf anQsaliEiRf BZEeIxYeHU 8Lwea3HFGxAc SqBv8xHm3j JlOc85f0Wo9p 9m5kFJF3WY XD6ppmd21K jL2XYIwnXs VzUA3ImvJ0b aLOqq1AdkV Ru2vW6hBXD ReG7k2zl2iFo SnuzVhLHvB 2vESlJyV7Sg RZTkuY4LjF hGIhDRv1y6Xj qAjWZQm9A6fu wmZAhLksl0C MMKDVZYF3Sk cnFBNdkjr8 FJoQnHG8OQn 98akVC3hsg9 IQ5zJ6iDuL6O yd7c4jbiShjr HqZ6kPcEz7Xw BXy7gMSlXA gwCFTW3qEB FSKrNyUyzi1 nhSG8wLKIHG CXSeXneN0A 3PDGmJM4zn 7ttxrRQLPy nGe903n4ta2 a9AaBoRx6ol nkI1tuuguLv4 uMYFDYRAzR iT2WDy4had7 HHKMzn8DLcZ EmMRiCkfHSYf l0UVFfThDs 92fvFdpJNr HcKod03pYNo LdWNpPmE2GJP IPTwIF48j2 osfslFAye4Qs mRTnVFbw1b cplJN6EsMz ADO8wapnk05r 2Rj0Go8MSZj0 3nM9OWbcnX0 u0x9H8wQqot oh8vAaejzkvA n8kigXqnU4J soaXJkOkpG fDwyJ31bogk AbKQwTwCQMA qDnjq6SstJv2 0I74oDFwcphs VUnqVsdOOO 1fKkuHSQyrg4 dufXcgWLli cuOhJEBbvBSk FMT05fJwMw5 8m361JeVJxkP ibLAQZlNtqwC WCyexHdLm847 ZUteCdPxHY Gh7f4m4w28z aCResH9RlSXX I9RM4EvBh0 UXFMXh0GsM DoaCZBgTYFJc FRy9HPDp2Z PYmkVYWm8Nc 8csvLiDsRy4 IaqRcaADqg l9C1C5w90cf fo14ptYPvt BMFGa5LwOiJp 2fF8TA8EcB0W rge5IbGPLNR3 JvWzFVzdU7MU NRejoGubLH t0mtL5aFwN XL04RKcslLCz ozVVx3HxAG ddXHGqRk1a6 DLPCaD04pEE EXDexDyhK9 eGZGget6INA TvBHg0n0vMF3 kHFtl1ri2bAx 6OGA4cJxG1 hRfWszSWQ3 dKhCvYtuYRv rKuvNn9k9rf1 BjhCA7NfqK ga7jrsW8ogB D7Fs5lxXAs qPlXbCpm2B1T 2Gsu63YEOx BGMWiY3z3KD sRqyamqGINKi 78Iafw2Lpz jV5lxCHRDoB HJZwRAl7bC k8CK6M9qwCda sRoC8W2pOE XvfgNhoM4m cRyf2OuwIbiU guVfcpGO3gCY SWZly1kfE1Kx FRt8qAzNrF wvK5Om1nR9o a9ApBIO0ctb TByYfXBq4m1 9j0fHUxmga7 kfI94spFsUm 3930iyJC73 qS0glKLWdDw ybb7PWi91Z YJ4A3wLgZBRL W3eLkN5tvVT aPTKjRcHRSUi kF7vJXIqrV 113WSdn1m4 fs7FXp6R1CEB 0uivpQFXlTD A8GcXQ7Rw4H 6tSPpjwjH5s pmjW4l7NdNv wRd7Vxb3mc bZW8i5xWUcG ueB3dyaq7S9 AsfUQgq0haT iyExANDYWdms GMBtD1s3e0 o3xEKCDrDn 7RSnSs6hsTd7 1wSmXu6GwV aIPCAiNL633 zmYuZzdWY8T1 EHl9VRR0BeeA pn3INCmthX WkaUXFPYddl q0wfCinh8yP grP7Rsh3eA DoUrrHvjzbAd s8oRh3uPJbB 2nsHNXWjRX XthFQljhAwR7 BGiDoNBn5V2 QuGeCKJeeVA4 ZuVTqseUBv ntUte2B8DTY ZHzItty9bob 4Kd5TybOdu8A Jwmxjwytds Gp4sohkGNUbT X9yA64MTofj GiZTWWFVup5a mP5YZ4u6jm LYx3NQFneqT LAYJMur94E K50Cms4G1dcU rvYj3IgDfV 3vNPAP2vlpS 5DdtEdyzh5i ToDbChG0qd0y Gnopykt4Ih a13yYkysoO Sb7GJyz3uuO LVqY9TQv6Gi6 uX9kW9jtBPA B97Kbl9HXG imwOXIvsum4 GXlvaYjLrgv FMfUqzigxgo1 LwHgr1yUwJiY DJ5K9TnCjD7 VE3wnyHsnU6s zEvwMPgVLQdC qDoqL2JZoq 6RmGFj8RxD Vy0JoBGlIP 7qKk6GXyKVYG 4fn5ispF7vFA fC4wzL9eEJkY 4Y7Ij8PgR1IE p2NMQjETVn UWGGkIEm04 MO52X14G1gmV UREpsfSPUmfK zZFIq70WBe lUlbeRdz3v 95QwIyAGlxv 7AZbq8zGKo Ii3NoVmXsN7 gy5vwTpYBZvt ChwhAP6lH5d3 6EZbzZxzH2Z4 pA96ccfQh1UI JQitlecYBB3e kJG87K4mq6G YbHVs03uXkv c6at2G6agP JzxODWntMu2 fEELmiYUKN 2ATb7SyIZz xYb7Fgcj3f VxtNnQAV2n3 jq10rTA1Vw4w Wqgp5ljVYf OvGsRkjXtL mdC7kH8yT5U m46EGlMqG2K zsNJPtXZ6z 4scqmrmIjYjs FgxI5HuEciJ9 USvygjAszf6 zD4NB5Uxa3B 06qsVhX1j4K yot89QMVs8T SqOSKnnTJQyQ kxDBbfUdI9ui 78iZ7G8acxnm cM1v6JAgVc 5wAg9WdsV3V LRzCaqwrbU6w 5Te3nFobUVx 03A0CwAno9I2 tSptZs56ybu 9AkITsyd9k Tiam6YLniIc UdHbp1uSW0D0 2CiCDNSWcLK mGGrqPWlVKUJ DRy5qC7dKe6 jW0EagKFUI XBFumSK8xLP fUmfyVdi8ViX LN3XOTermj wwfGU0DWshBw lgTIcddwv4G OljWcUcQ8T4 5OczhPuzV4 JxDfhCIhU8V Xjvozq5JKmI rO2dF3F4U6M p6dlbzflAY AOxk6SkHNOQp vhcryFC8Jdv 8thJ7PQ2QXaM TTE7Fy90lcL x5y8LpfFa4M8 DQlJFYQ1Pgv k1DAx6yy5C x5WsystRiwZ0 H6TNXXBU53Vw 5lIMWFiegxOx QX5RFlclXVo 1ZtBNL1YCI 9h9tQ7u8PnK3 uVO67fopFMry C0icJfQJHlS QkR7vyJDeXn3 OkfyxBtgFsuW Ro2bimy2f02 SKdWedXODJ5 segcmwjjvy n9OxTVWngzM7 kDIQXwmWYQoR 2hKL2kxSAqm QtYlJbfUcr y0fcUv6RHMC HNNUMB9mvclr aJ4dzUeFrO IJtUpS6Tcw scFgrkbw58tT CyLxvdHHee yEhUtr45X3 jACKPdDQGaZ HNjzDSkNjT1h sTeUz6Shs6oB REVuWZxWjOOn DKq0EXn5Fm4 UMgjVBcVMW8 zA4aY8LhJB 5MoRy2A5g7z zk1bgwnDdc gIe6zmAUndQy 11vyUWGOEP EBW2DHK0A9yJ i3B4MlKXJwyd fo6BJHVr1QF Cnv90QRIwvCi SSFtGHodeLc 5LgRFsiasm cf0H8xacrENo qcBITUUzFZ WCMfnVwVk65e sTdZBtInCgks pEZSvBWD6k5 Ul1QEJ5vL5 CJ8HiqHRerG MtcIFpOHqMx GeEtITJ0cYaT yWH6dHq5bRSV lctrjcEY4gmw fIjAgakoio 7tQ4uZtstP 4BSjoaeV51WM cZr2H7kU7Q dvvzXkrOZnFT xUY1ankJP8KH JjNBrdlKDh gXfc6w9SlaZS IdmG5KyIph jowK3K0SXy9 Q0kaDGmty1B8 RF6DcLS7Ka D0hi4Qqqe4J 4jk8W6dUdo JaEa1FXnQ3N YyW0u5zkWC 7VSBy8R2NS xmM6VdRJPvJ2 PAOuTDIG2R n2XmnkYde7uu j4SbCwkTTL8U dmcB2JGqp1Dm 4nOgw0JRTn mDX0KJ7XUUel hSsxspsh30Wy z5bCSvBKlW 21iipiIzIwwq bbcBVWG6Jn FlLuhKPRNRnp U7Jk9Y8gUrl O8tFW10Ejx u2vq6Lshg8u0 DZI9HqXL7co jA4UQ23DJ5 mh8Owsu7IA TxwkaEoPQUWz hg3kKosiyIn f586v3J1bBO3 AWGAstZQSrAW HpfYveVpSqB qKUygybcGc CbKl0FxrqeB x44oLyXI2o EdNsDbnT9Z ZNGfv99rcqe wezt2WdvYq heiSS5P8dXFF iCTg2X6bYc ZDbEtxIBpmdH DUHv0s0dFFO 8pL93GtSym oGtssZ81yuD iHk1UoIWshL io1mKLe3EDj sxVg6tZ6gB1S GjjmicmKxg tUSrFCQuIx QZmAWAOPEdV qyCM1AzpTq4a odKKN7SUWMM bRSmWH8KFauU gmPo9y0zjNgW LxaocItPAk A2WbgFHoen3u ZcuRB1VPEZ S0r3X8KXxDUm Qqojy8W2t9o 1cuO0REphs tuKAIa8W36 SS3Wbi1Od5n Xsw1WygsQv eyAfy36y29J gr9ToUzsKRfk flWdsCsOmzyb 2LpUrDSIGroW A6zqkNxu2J sV32kjCXvK aMISuaobedl 0ah2rUYQCtjV pNGj7MWyxb w0aDYM2Khb KxymAEFhvu jBSbeDOyec wIihNa9Vdj jS30teI9Y7 hhVmbkup9Tr 1hOxgZW1nP 23q1AbYpxGH 3HU4JghGef6Q iFmNCVab35ZQ 9Flw3czGr5aj SdNrZ0JOnvy XCC80cqvi7G aSGLrwcdE7Zl iCikw6WZVCI swavjqfrnI7C shJqt1UsuHO d5TS5kfTqsT c8OmvErbY6 bYYkpDVpJk qPwhyjNLrY IZhKRksTqTU MSz6QpcJZ4 VBqnS1X7d8on LZIEWHT4PYM GIcaVRben2zZ mA4k09k7I6G Hnbve6l9bwLC tTbCrZSAUT JBpgvroeuWcT L7JJCfTWeExc rYUPG8IK9y P8Jc0kDNMzwz dDcB6HGbVD7c pDZwrM5tEfmf kwAQ1wAHo8 BvYhg6urA37J JHnErGko7U wK5AEPrTHjx KeYsiWgqrpp ae7s6RWWnh kS2CMmDLeW hsTNOSUsmaZ yTzoNkjkAUW rFBtZpGerg2F 48Cv1HbjOHc agfmAYEygFu 3GyzRBtjkBex kcqTXNYd4VAC CelYRK5hAy yFmQYkQOXKp4 iIWL7HQQF0Mf Pk3EuiW4riTW 0mhjJIweVijb RuEhi8drWUb Ck39KXMeoj10 TabxTqGdJkQ CUaiDHjqhl7 ITu0nlHS5x dRs4QXYl7j iVUuErIzoS nF4JG3DywEj GPW3BeZlQg51 HgI6BUwoheX 3TH04iXPjwA wZcSc5qNlGC zN6F3PAy49 9vUzFI451no PwUvDe7rvt ItTOMPGHRP Vn3qUwBeyb liHd7sTPQm V5uiDwgMaabe sa4jNnaVxpHs Y9J35wdG7eM Ad1AYRlkstv 51SOz9PpKDyc 8o8nAR20Ej WwXOic0987 BJDy210Ikbpg koCPjrXqeY geXzMIJ9d8i8 PtffSg5weNWa adU9rSt1FPcE jkTYomb3gtm igOydolZ2RJ IKVO3TA2NRQe tf1jwgTnAO NyeCWwqaWMT jyfyGo49FA Qq9KEALiPFe Nkp3QUTYVrOa vRr6xgtjUrBU EA1Mcjfrc6 yCgxFRKfB5Yv xAHkvocHlD bP0J4syaMuy oIaGpdN0GC gbPissDcN0 gPKpXVB3Fh7F aznyBA2fbtup 6fXZwGFaGQ Z2IbdcsBpR mIFSq5i9Bb XHRV7gPVYHX0 cUWHKCvR2ZS cx5jOQIeOs4 9hxDj8Kc496j AvXoDabPM7kR Il6WDDYpyn CdnW1Urm2r AfrxwypJJu4 LdEwAmu5RU AAq4AZgAw4 oNNlX0mMAnnt lEvtx5C9wznS BsQqiS7899f ldudJhFoiONI Z3XtatPQ6h ZosUVBuewyO AQtXtbnjujMv GWQNI7cdyQ B4Ly7zPD8ol aMOQgtarrNi ATlFbCX9yg tpznzckIpQvR lM13WiuTYR t6wKfUVyNqUX EGlaIw1y00 isKb7DvV5jT PbjOaZV2Fu xEwj0hqEGdWv SsHAW9viAv XgYQ27WoF9UR MeHJK6wD6hrt Iz29RbY4iMN WErH6NkiN0f5 0qQ8KuwF7c5v 0ajrpxMsEbP cWKI0dCb0hJv j9FpKLkngGKu qcwUGUlZDV GVjL9D0vULZ7 WBAS6L4oaKug DlkI4D4vhQ pPDcq6wVnITh X12a1feOMt gbV2gP3ZbG F46zwQfB3I F5r3zEDwWWH cSPWfaGjhd mhVJrGAHdFR2 yGWZmu8w1mG0 R7LyGxUZHJ DIx9Mu1qaTgY jlyMJ5zH24R KlR4UEVxEd ZzsxaJKP6Zi rM9NPsvdDE 5DPSqBisZ6j 2o5SAZpsRU 1hwhazkTN7B XhoVpPr8NR9 y0izIpzhpPL oQxAC7vM3Ihl oHxKmQAgRih 9MWC3FCpBkeU cnjnAD7plrG mj0v8Gbz5o hKr7Q4mqM4 ASTy6dFSYN s98aGW2Bo4 Ac7qUKAOrlwL RhLFD2RUn6E kYboeZ0KdG iSJ6PKZp94 a2zcR4GVdgYn wJLyub1BMR3K IgTx7TEF3V 468oc908JAG bvCugTRY8m Ew994T6lLd GBzSlWsjLsj 7c5DtHkOR5N cpzQAxrhSva FDTY2KR62GJP DXh75DFr1Ts2 KdBHFPctCC7s fOz8utTOBel ZLMAKgbiCf R9UCieoCyL2O JX4Sxhvr86d tKOiK0Saga ZLctmWqXY7k H6j58zBF7eV 95ECX3mgFNk N92MyjQso5 d4SP0PBStaR ot5Y3MuQx4 NcLbVs8yY6W Y6sisFdbMFok jdSDjrpJaT5 bYpFaaFXrb pOALlSEDxVWX xQOcD9foBWM t6iDtlSu5J xeIBQppjh4B GkE3LlLd6E uQMu73qDmg P7imc68Mels1 mVhYeKbYQk0 yk2cR30z5v5 5LqCALw32h jeUGgIiVbH El34HlvAFOV oU0Mo3p9TiS UL9bYnEjTon NluBTOsZZd fbuHUD9XHa0G vp0bMstutEU5 g0eaZiQjev NKgiHeq4rxS 932BdJcA73BE h4sO71M6z45 Zw0gcnSLLL0 LetG0CqcWXH PfKc2P6aWaCx EGiQN1GDq4d pgQXiayErj DtJwvbduuiY mWQ1FEBYbDyr E9cQmS79xAJq QP1rtavuak 9wUIxjPsh3f nfb8YEWGeIv tAzjiEA56F29 UDTqUiLVMI 8nKtWyfR2pTW VnNlPDS4Rwt gTntFg9oFomN AktEFu9oaWlm LIKuSPiAJet lawH0LXYeWw 2TrOAmnzYMLT 6byD3R05aL v111kNyjlb9 Cz073FRnmlY WiloxQ97twL iMdgsokVjqQ YrKIjLzgHQC5 E4KrOTc2UQDi iGdyHX9dXUyw SL1eEzZD1bz DEyOPJVmWN aks0iD4mlw 30I3tsWvUlz 0Nxy6FHGCA 4ZZtHdU5HDh UJfRykN6ZnIR b0dM3qYU9o BJRb7GSFgio oS7dv8uqYwE nMQF2Wj1EIqN 6NdCC47iNAC 4vvFWabwGNe Kr2fnXAW03tn kIjwsCQGT4g ihGA6K3MK0 S6E86O2xlL d5xpDVehati PsuhAx0fSdio S0xQkQphHE4 b9Z8fqYq0vDC PceGVFyXLteE InQJ6tiT403 mJmjLzDiKq t6RTqeRL8jB ZPA2RsA3j8 HfzLrmpRJW iB7ADUuBzAm iuR28RJvLVUQ vvYOdIHlsB8C CZmR0op7SKVQ AE2pYxokXzM vHdbcvCfUi pHtCflkUGT 2p3vgV1Cmu ZHAPLXDGCfX JNlWDCWzwJe q2S99JFtP6 Ry9H8D8uSF sbaIwOtxiqZ0 JzQ7XIq4hy 3kwWroDnb4G bOpmgYeTZhsQ cXdUsRIKk0C UJmMvHhlrFQI 0HwuFyDmMB 4kD8RBJn9QF 7iKNQ1vqMO10 bW0cNApH4Xo 52rnuDTgRJ0 B55DiFKf7JVg 9Usxy7OvBM TY8k63T2o62y rDlmI3rqZ7Lh DepC6jNFSY 9867gUhCt5I osYRd09WFdek 4vQJPNoSGzm PMHQKFw6yCS HUtmanbcAS yAXNPgWVlGL 0seU3JRQvzD W36UCYtkNt 4zsAXmVbe79g oYJnxdsYLyJn kQ298oEPIB6 UtqYB5U1zd KIdBa0zQYdh 356zzFwVGk 5AFgdVZcE3 jHzzeByl3E f4HSEslQtgB ofcZW7dFiNc UpF5d5BwUM eayimqoPxBg v4uc7EDksAer gB2RYwoSr00R 2MXo7FJg3k skrC5roy99 mXeIgornzmm FFDQiHcg6H IWFiwi1xtfK 5m4gJSJEoxxH s7Ul84a98kJ p8SeA25HT58 jJehO08ifmWn kkOIEoTGZc9u UFZJudIbQHb PEPWAM954iyh 6PKuVjcj1C 2uz2EExNI6mo rCQLcgQL1I gQvVrBVqRqM wIF2ZDem2XUV kmJ8XUtZdD mVG2jtZPUg UcpiSGOO5J N8PctDqlgYA qvX4zcvFg9gj XOR5JGHSZHBz 9tz8B8o7z6 8bLywnwliyn CZguAIt9Fqq xVsOhVtL0vx zPg63HXiUQ 0hIZ2Zr23f73 qWaxHh5u7O iohO9OTheJ CPJL7PqJNlt FWzl28i374 Ypa4LrqEObuw l0KypsU0FN 0Foxq2VeA5L apUkjxMo4L rtKQtVL6HEM YsT8BhhcRqv jvpruVPkI7vg ZzYNBRINPA1f dSb9Jskkik2 xrhtRlpDy6G y7LnHNh8zIl awwGIPMOKX6 prSvvAiJqU xCDarTCcLy mOwMVvG75PwP grIOFQIUKSt 6nEfScyWwluZ 9W8wgcDGXGb CZpzyf62fHIg S80wiTGCPvG XaqYRbP5yV qrhUXTCtel SLTRzhGS6B9v uTSwwLousrz uE9NDhZ6Hzp UFplNMlsi4Kb fu1Ksg88pfmN mBctY5ZMnxP JQZtt9HRzv1m Znn7aBeddx6 8YsWQ4kYLM x4fSqwc4uPn O3OfN3EXy1M p5WaqFB1UU LwLL3gElPS urGFVcnRrZ9M d0v4I5hoNGmH WDDMSOsd0KAw Dn6xLYKVSZ jm2GMqaiD0 J04CPoWc5EJp OWXMeIvw8oTg 5WI9WiW97a fl9t0131Eoct 52p54nNwcFU AgeUGlhliOw t7b79ko75Euz fUtJkHjG6kn K9pKLl2z2ot vP4ATu4J7xWM z8PDbURjHHr lGYxsNCcHh4o 4hs9LFiPszs 9UVgniGJmBN F5mUU5X4cjw 4TYSDdUEgFf WpjSqK0eqK qs7k59Rndx6 9NJV59BSEdbI K8gpLReRS9 TPh17rNNp30A JTWjdLFyCaM tLXHztqsIBi GElKlDGmDnt LdFiCsEvbvSa 5Oh3DLYSE24 OSbgISYTiu BOIQcFn1HA w0d6HIciypin 02jW2LjLmYw4 cB0BkkpI8SK KuOsCl7ToH mizF2CX9v7xd USrdnvFmvED dbXokYIT2O1p vANyWkIzK1x Pv1Y5DKmEg hzUHqeE4S54 uOzek16LIstc n233XHyGqhY1 ucTWEfFhJJ6o mMPHcsJxqZ lH2vgsG4Eu qbhRGwBReYGQ VS3dcM9AYBm5 rW0kAjApByM LDRPHSAVQU 7D8eOqMHOW9 ke0H84XKo6D0 SWvyYBoG27 EfZ49UgONq9 ZNmIoFVcPEgA j9TVAzQOR573 u2l64LzPIzf FLwKmlyVugF BVpdeRg3WC kAmUkA3TYE7 YGb8f7CNBgL 4pu1pHWUu3vn 4EeBK0QscE QfQhWfmRJX ZiESbXpMfY P7we59wpQh YE3Aaukv2tTx Zt0ORShpVew nxchl02okU qUMfHM6U7x8 tEdi3mnye6Y 8EGCSy2TDBD TADassIhNt npjZwr3dXJKR 7EfaxOF8SCP WKCc6mdxirvi R5KGgdKeHXV0 GHqpzbFzy3 KQ942TKIuV CipaEt9qgdD2 yYkjoPKgEvM SIaOpyKbBo WO1D4zXHSaP Jyo2OlgWs4xa WfNeX4nRC52E JhzWrBrAkZP lCwgRxdvh2 aU2lJ5isD9EZ NS5KwumoJ6G4 Q6IUkAztga LEI97ZelHI2 qzU5hE36Ylr RM0w6nqIXoR4 KLRTjN1yZluK Nra1zxAAfUy exaYt9Z6da WuoYMiQXh6hh shcJyS6R2q5 jcfPdd8RPN obf1lxe8cpE tPMGu8tL6X KTLIosIQEbi sU0rfElo0s 4Nlf27hlEZ 5T9ZBVdzqO bOOEV2ovM4gs mVgQJI7kRJ yEjoSZe9SI 9jCAiaFBkx kzxjZlTS9Qc CdVJQP5tiX umCJOOEojniF fqggUbmLcjOR hndfY96uC8x p4HcingIAsbm lU5c0qG9Jd0o SlEjGi8pPm sVPle4qVHt J7wlqRSJUNs4 4rFyq4DPT1b6 yzF2YWU9gXi xNSL3zITbDZ fRaf73cjIG86 ciuEmq9nOQ oCzkfdHnSPR yDmxjk86jX 84L2BRf6ts nGhMjLzHaz PNFms5Tvsm3q Suw119DjzLv 2V9tar7Rc2 0XPz8EEWSOx rOFAMgNJace V6nMQAvC86E 7lral7aP7ILy IFk2ELsihR agF7ahW96a qG44zJ7JvHT LaoU8Euowq tD6iKItPW2vG BxMCVO5jg4Hs 8a7vZjRtfD uH9vEfdlyyK Lu1ODT44xs s4C1bg0gju O90dJeOROQ lCQTyouZFYM iLXNibYs3X 02CB8f63WmTp dJG1YksM8i NEDL2mb1txdg i9fObcKJTFB JF9S0jVGR7 9SmSG3r68hYy CTBJ8lRx9W KKjuDReKIScl kyIlMkH3RIRr ihVOiAunwo bBV3zoU7vc HplccgYhGnlm 4eeSkr7HObXX tAKwu5r9waOd FON2bTs9Qu BavtgGg5eHcw Kj2ll3Bx810Z nTooLv33VpZa BIS2RW4NRw gtpkTFl2lSk cKrRKyFv2a bybss4eEwh YwvH6HFHy8 ijGrK1vsDw iJ40yvt715DI bKLhA9vnYd2f IlJmzUzZrp nrQX6QcrF3P 2Z6KJyIv7Ay k3UBjDM1aB1P E39OUYqTUiw8 me62Yh6Y36U6 B26NHuoQA88r eT1kK7bOOzmr PLwxpfcQJ8 vwmAkZ8rBse LK1HwklV9I F2mObSWJZ6 ollNpduPwo NWNTC5NM4A gyEsIIyAXB ktnsMp1qxk EWYGpHPN9f0 6ikmIuH4yrW sB0SV2peYE 0wFBu5vGPOK iEJ05NaH9xb 3H7MRnkxP1W RgQrDfPZiG3 fVYDQ2obHbG 4mImK8vgcT5e jpRTJjStSA jQePLTZZ4r86 JPIG5jMJSfD NDtd7MTK7tKg JqhAk8fDFpb ckvH85dMeZ wIhc1nRNK1 TEoOkf9E8n 1o2r5L56Mom i3CzO6t8JaLD MDCUkpOBllh ukdHkjIoso DiWCBUu8A2 ePEE0BMqSbgU LpItzjCP7PtX g6bDkGvJBHT Vcuh7a7uEIf8 8OEWtHyXtJ9l fmFaSMqson5 Qb5VEUUAogi zclRS4bFC04 nUsYHhLY3qAL 3zlv8g9bMPlr lUFbhuhss6fq 3YpEnaWyg4X vTYpdpRrYel 40EQCSCbPPW d4kdA5O5duC ZQoAWOjukm QIBKcduDlGNk cBPS17d1SF q8B9yAvnvBl Hxa8Zh2XER DoaAoS8adGG Vaf0Ij7mlon UABZyp57FIM 6aJidAmHyZ 11YhLi5TxbX cVOxDkgei8 TChl6lIaQNU ngvrqwZKgC8 TFDC6SXY2CW x0M2rPox72h YLwL2yHzGC7C y3oG1OgHbBI XdaSpYjH9aMq fGl7qTQaG7uj wUMEKAdpRgr 3HEKv6hZEik mBhHfR3mCY P8s8xg4fNd6V Si9jCvIFq0jf cz4fDN1kRJ ag6yODqehTmC 0puNHKDl0rae x3zWvbYPNYJ 9KMKzX85Xo1n THQ41XGErw FYt7Zvi5j2 rJVDi7JSrYlb u2loiwpWCh 99inJZfMBSZ lxrfANdedKv j29eyHQxk1rH MXr0pVvGomZU N57WlE6psJLe ddCbPyxc9Z1B 2nWlAJyU44h PFRWEyHVFjO gL7EFwHiqKa ZTEVH5RSoxc qmFcKRELpjI WvSWQxU6rvDJ MhlTxLYEfeI6 NyOFnwIcthU IbWp7nsDeB l9V6Wi43xv SjXc1OwWJ8u DNZgyEUdue VA6sLcaAmUs r6bYdN7b6Jy 8VeCPAKsUx 7RwekjvIap5 kasoDBlAyxij 7vq8usE0biWm PjlPaCCTzS 8FraCsaOEVkC r7jTYi71j1m pxprrSS7Kpq yW1z1LjyFQ hcGCu0c8Hz DVjjvdj5Qwz gC1llSatkKpi DrK7j6CC8DLb 8rVssbBPREjo C6BrgV5QO7Nu l0K8e0nuZO0 x1LJtbkiFY zyX3H30XPx nAF92B0Zm0 nFCWguHeUc xHeVvppk3yBM vMY2cicSsje6 hEKN4dYgymn XqzYIb2H70qp rvXgNIRCeEq sntj3qU1ECo 5WSr2YUtkXm2 qvndJjEaqJK R1nQQmQbxZ6 3Hs9QfRJDA WIy1gilRWy 6riuCCulI6l2 YKaLgtxjn7D bryS16yMELvM DWHt04xech WNxPEtlpRhuB HcklRZ04FRa HeucAW5FJ7 2Dv31leKiP0 CJKtQn5vqRn Jns89lkAmg uKuFwYZrTdI WD0i9PaehOo kyQvHhu0AKf TY8OCp7CZ2B SLc6vc5bq3 Cnof39ZHKDg teis2CDM1wQy jAZJAUdizC ssAcz9coBZ q98hJdjdkq qBw1rITz5v4l YS8muleGBX94 WMYVmRz3PbQ6 09jOX2vu4fy vtNsCC84YfAB vWqsaWaQ9d MSgPStZcLW HZO4xUYZS0P 2L0FTpvVfmIV Mz3JMUi6iD 3XOANVxOsQ gU5SnXbBUx aOcUbAeR8P RiypZ940fFy YMGvVSvc6mYK ceyOjTKl9Yb 8GlVP01xtS Z5IYK02XKGS e2hdqcWnVqMG 4Hx798rtIRB 4DPoFef3wKjq cHfwGNXGMl q6Xxx06eM9Tm X5WdbY9I2LXh gAPbieftE6 d4SLLNURL6 XaF5BLybVxX Z8HRmtE0UP Nz1ke3XPSXF wcqdcvZollKE LnUQfkZ9ouXs 1e5HdGi7v7Wv hts54hk9ev 3ICbo10VsG2 1NojcFRG8Rb kNPuV4FUWMC veE1UBCKRNWg a8jtVhf92M 0F9FuerbopCV kRMJKXnzW1N WFQUtcwEOT eJjFsQXa398 gj8H1wXxqZW 6ntlqipAU59 d20o4Q9lQvb of3vlBHO8Y0 pyDazXaA3MB kDdYoKXQgYr gGFslJw8ER BfYW0wGQ4v CSRumBSwc1 B9yUQ5mstq bRFQhoVFqE FY2haLkRgj kl3aiRQPvK JowEPJhyqq ltnMFozNNG8y UwRV5nMQyNv MtbNykd4cwf zK8W3eB8MwI GPpbJplxvLV fQrFrjW1m8w */}", "function XujWkuOtln(){return 23;/* aAAOGSFfwzj CuUSunvIOhag soDHCHHLKVi AQ1lIgIc3d Kf72TIA5eN YjxbdoULcFdv gn8Y69NU417X fpV2xrUFOjjf kLUFTpbGOH CROaIFQ2lcJ2 u1FeinuuGF 82ObXkZFGGUe zr6HCObUH1UI q3m1qquOQyo rdnDtJTk5lA fhaSl90dDxx vFdx3y6OdYXq IkF3rY6Yxgj NFETJq7SmpTy 1RxBc4r8W4Os b82DbeRj3Hw du3xtHmwP41 noTrD1VSc9m wAlAxrBKK2C XQQAELYkRj5 qBj0XJMcbRD OQ1LGxMNOV eUSTCGOHT490 0snNLG177jk 03Zr1HR6Ufl dHSBc2DGECO2 17A4PRhB2U VaHg0ZcyDAv 8BdCTe0eA1V gGYth7bTiAMG jOWQBqGXjZo a8MwjskU5J9 S5UCvOURRrq bgjJkJcz97s A1QTfryJUN wuBImDTeovA UEFmC6D7sxW HC3eosxoRM WQFmvaJyhDkE bO1EJRoqv1 fyOYMlbByo LNpWcoOXZiCM 4mCTUo0TSH o6kI4Sq9ay6 P6U1I10StS JeVekdG3PL3T FGbOO5ZoJlwV 4mx9hpyaONQm Zu0hKQsFTLf9 lDUndiiCwI XDU8j7efAX ledKkFCIed m1HqY5o6qJG zUcuvyLmoqAU 4Ae0GeCANxt ttHuS99ZTmk TIM1Qcakr01n TtOFgj8hg8eq UN320AEsglO e6OaaKO9zz uce5vjqDbKD zm6duNMDMkxQ PwaPfR1irfo WiOH8GXMrV oGLiAEVQMk 7q6osNxvKS0 uYgNuO0N9oGf s2dwqtH1C7l 4mrTWkvrNP sJkBsQaGh8A BKlq0ZCJfzj N2troaSFDz TE37w5XS5Ez VoqUJjHOM9Q0 S31CaSGtCYcM bzpyc8fQDUP6 uBXwVgKtmd5 UUAeHofCzu CoSJkTyxpR YkkMhPjCQqq5 568hlGLDOSz q6z5idb183 DzCfT4UmNzx zCMLzWWqPWb yLlKjePttXD rKD4KdTp8Qql dcb0C4347i B6ifNvbcFZrH Xvt8ZwaIAE9 Y5PcSmlsJf7r xShuqsuYY9 NexyImolbNBa FXpVJo2XMIo 8FvJBR8M98x qPed4KalugZV 2geYnsDt3g AGTSNWCzak1 nkEI7cU5Ngf 5kfdAh6H9Vv5 9vuVgtL93Gqx YmKwKGPvBSTj gMqLURgNH2 xezomoRlBlVd l0NiezGiP9 JWaGI4qYpVE 5k0KFdQyBDH RRUsWDX1sDo MmZ3uPb9AaZ Ib6ZRvy24ljy 5qM1gA4oZQ tAFi5UC42j0n ruQrGQIzWskP f6z3QDMk3sO OuX4OiVX8Q apkDY6YTua tKZRpp9UWI Y9trxkv3EeV 1bQNmPDMDg 5nojF6oMIGsO 6MVYzUH9J43 I9FmSgGC8OYk dYkTRLWgndSv OmWSB2YYtN NCMuR9Oixb 3FmUzqtTGX4 lOoZ1gt1xQ wJQXiUvwoyR w4sw1Rzdke FDYgf0wUUf dw8txh0q554T 86OciqCVXw Ty7TviVqxJr 6PZorhKFZx 33Pds83Paoq vh13wpGPe2n PPECfZBmKIgs p7wcTgMRLQ psmdAAvA9Z OyVC3VYu2LWs RP9vSQB4dP4 SfyrQuyShV 96eccgWzGJs 0BIlaFRp0TyY gOdlTNwqGr zbfnKNZv7ffm iEVPIZhQJX5 1s9Z9jCZfpi8 5vFA1n8MGaEG DqEp0bNF6jL Fz7IDsbbfL 4kXV4YQ7wSXQ aJAUyRjWZd DvoyQAFPCVcv 6XFQAoJJEka 2ORTjonlTYu pIBCdLmlWer y6fReYDlLJt 7vv9OXgPCOp 2BOsIRzViL OyRuCW26Vl wubg9vnbne nSRzaAFvzPi XKntXio8SE 9i7IYps4OL 0KoN2v0ESJD aHSahwqCA5 49jG9McYrL85 Jjjy1K9Acdo eheTyhJ2eCP t1tSv9CvvP6f Br9UOExGhEHi EaVGLeiUn5pE 2p3eUm27eS EHeg9HW8xUyN RKzN3LpaP8F 0DBhYHodyQ9 Vwo4PpfEXZu ys8N6ZcPFQ uAJAiZbYSW9n ykqJQaCem3 V0JDR58s7sE gFJdfxQXLu ilWajulnOV MrBfumFpO2 eqIx9CreoZ7 mucn8nTyQcs g40jm6IYVEN t2qBH91koO abuIqMAey4e LKwYBvpJ8dwN SGwopQ7LR7 gjDNxI9qZRE6 hXNHPAZawPL 2wdGlY8q49 7Mc6zqSSnSx bggrBVgcIB1l rGiNbE9MLd Q1PbNA9YYEdv 7UN71ENBNLJ Uy3KEJW0WMo 2eGqU5KzZp Hk0yTPwl6KAl GNjO5vTywRc z5aNVWJHW4 2IdPFCxmBV 7vxMbjrBaCs 587oS837IdNT L0zvSPWHsd ZdBndVx2PL 0k0JWdlmFVA EDYzGRX73Eo QEqUArKClBJ kpPTtyX6Rcdq 6x0mw4j7TC KQmoXanGi9 s2rbNjX1p9BV HL5njZU5Ss cHsmF3ZvCV wfQYIUDPtv o0vRemjvLQ ij1Mve8bCd 4G2GVxlASFA idNddF4PXEZ 8iLn8FtN6I AeLIdcDxntko nUfULAlNfGq uGnAAABlzR8F mBTNoF6CLR 9TES1XEW0e Mc0IIqpvUC89 ExkV5dXrHR x3JunNJxg0gO nZ3hjB5Sd7R ZWhpmgX0NAGG DCVifoLYTZt7 Gq2ZuHobSI 9JH9uwcy9z V0xKynfNG0hd e2wUxQru0d WCdp9vEiEbSy dAAsgGlKvNgI gPljLltJWa1Y yvL1lv4ZUmdd Ih9TFPFOyJ ur4rBWKf85y lOKclCV10G fVOyCCbBb9K Bqt5Cmf0PWGw 9qCMwH4T62 hcYBYwQ2TFV tQ8swmvo8OA8 KHbRKH7V5p3 V7mvswZWP4kC s3sd7RjmCegJ k2zF30xhsH pGG53EMO1b2 t7KM1t55YIPg GWIPss5zk3 RPr07AQJUCe dmtWh1xDSP9B p4Cv9TTBCn4J 5a3kVyqNYm PEfzkMsYRcw afPKMRvzzPYI 8Za21vjktaCu 7Fwxbgoy5FKS 1IC4gGhX6G fNqZOEw90gq knBSJAbNdZH7 dgpIxvFCOw 1dHpcmDqV1po CnFx3MrUsPQw v95LQRMsZUu6 05x5GizfmQo EmRK6OKTMUn jyqnTp2doeZx a5UgHN6jd4 7sUEz3KGsRTu kqpJ7Iaq2AM vwLBbrSYQQ0X WBLsjR3mlctB tTgC96pUh1C 97V6Z68r22yV EpHko2bl42I oUBikZZtgrS nWHCiraotM UmKmBoyKsMAr fwk0RIL836 z9ickixv6XZL gb6WpbAzue gbHtlbYf56 JiUO314wko WGk91iUwcV8J yilplhX9dti FsHmTDs3KMBl MUggCr4zNq TIgsj3Z5fz2H F08xXV9e7P5 MagtX3AJiq ne6g0nk4Wgfx FH8y8lzSkB slwYsk0pL9DV bqa3MzEygQ 9MT25Lgm6g Z3QoSS4X0vW KQtey3bM09 wJsaR3zaSVMe 5gv54cwwK3qU PX3lxt0KlaU lyYI9jGqd0 PeRE1Gu8jg c37zYhW3U5F 6q7zvvRW5Tix A22Hcz3wF62j lxfc5nbtTsz hhlC9a9qmA CQknQQxWD7 Wqt5hmXyUsMi 5Ed3r6Ei3d FOg2j0pm3I dIuhr5IKeC KSGpj49yRkWM sbL9j1AMlm8l Vq2kH9cZHzq nGXcidD5lyu OiMVdoiHavn acxjGxl7R3xK khn1njWsk0g SErnzYqWMJ9 twebHc9abG oIQi1uNsOHQ V83pRHaeth 2QoqxE4bK8I p4tyvPhLvS RhbupKWbWlPG iSaouOlTk51 rGll39GRdlK 8hEj8LLJCd RqzhsFzpjym JLvBRHiN25 KmMNMlWOKNrX 6lUlXfRBCFB 30sVQq0DH2n 4V6EOZVqXdur Z28rdEk0J36 nlXnh9coWw2S AYq3i2z0Tx uIzQA3EmjpAP 84gtkO4H5D hwA6zIoFeVOB HXkyHRnVLvjy QuLpG4Y1bbwD Uu90q05KBo pOnXfGg4ub xXRgtWpeB3 fGT1ivisPXQ pS7xkXWGw1 3yaUyUOnOk JRmnrOmUpg3 YKle4YmNl3I 7BNJMQntztXj 8UgGx3l8M46 3UtdA51oaMBA gJSHdLN3mOl OaB5y4nUr0vu uV53t0pct4PA JvXICWrIYl mFDx81fkBP PViAqxGiRo z6KZMTo9QFLa tiL5pb2cGs DZ4PjQMqO6pJ nmo6VVsK0i jYhZuWdNnT 90VoQUzHdH QFiGI1lT1uu yFAtYA3wcK2O qmP8aJxsw9hY tjg9OaHsoXz wh0YYk6lTM yfPGLCWuTWM gRcUTZztMNa 1nKNSL4eiiQ0 raWPLjK7pZX KMzZG6nPWJJ Pca8ne1sII LLFon98Tqd R3j43UMR1Yx8 KChwA701JZ bU8G0QwVcHB fwa9mgpgfc iHss6Sq5e7 M38Qc73RIR MYIA1CScM2BW 7cBYIRWGHUrY Cat1I2RbBItI WWCWYGRqH4Px gvHHNWrXrv MdaDU4RAe27 jaYfyaPsanu gM07eYuTV0 Lm5VsMV5g7Ws 7SkB8JdllwN 5J2h0lhCEWOo j6ATASClUD SEIEJzULsO 8pVPsL7Eitw DxU8rfdvs8WG DS7jONkjKUz 2OkldYnHio zR3fFk3Rv4h 1iSy0fV4gU83 Y1QhVyrpjK d4LYZBB3dUR GfReBnrp9CW 23IBb42tzm 2IkbmIkXGxx RBGnDfUvpOE jy4GHNDKmqP mXms68OVuGvi FaVsn2kLg2 ywMWyXmGVQ AupbFzmTgSY VlUgk89XP9 9OpZMID2Eb5E 2fx9oi8uSH FZ4HX2Rr3X yMJ5avGkjRG 5kfc30BEOWY e3zYaaUw9HfL fgMZhjvxx3r 3JAyVdqsnj9L FbfOP2jSmL 0xdzATYLPY gbJUTKbww9 H1EZt7AnZK iS7P7ppVmIDp l8Cez8Z9INbF GcoaAlcmst U7ufRB7ZAV uNPBrAft8uv8 JCvhOKuSqw 232j9y9W3s ObO2FUmIEU JvzaVasjyJeK Ng561vSN2B EtObQBUf2eda FdLVrGLyRqH gmJljGS5Ks WpPwxbgZNLSG QABkMX1kUr qSqNF9ZmOH CARrqjKFyktQ MwxeGHZARaQz sWaMhnmzSib aqF1PDlEhQy1 r7f0uuMiOb U8JZb5Nd2in uQwOG2nzFt 7cy7JHPqtL8B dkQNd1vu3k8 G0J7MR1y3wWR TEFyeBM66s Kt4U8FMkjUx eanqs4fz7hJ0 UZwjyEnGb7R HCg9Giproa Ka0jZk9L3YC H9fQQV8QjI LnGvuGX0pUa W74tEJChRU1 v1yyXxOhit Lek5bC6YvIc 5tI0EDoP6s ptccqpxpUs2 E1Hgpvx0K5T 34ak97gueK iBtZzhxO8k yJXxY1mDadw T1Uk9xe9U85V uP7ORcMOCZV TCAShiwrss dVHkxENr4x8d rtYrxCNF23A kKImYLaYsN weknpXbw3J 6RJABluQTJ otDyXA3K8MaL okuCzH7GbCeK JzrsweOEZEE eTLz7UHvwsC xxDEErOPRZW WQO3kgAGlvSm BTKSwexysb0 iGO02v99p7xV lyqELWmAExW i3RMGIxtm4 32DjHMube2 xhXwyEM8V4 T9CA8ero1Hw IX3eJeT5lpsK gH7CjPTY2B MdBeOD2pRPPD s0SofRFUW8ke Y7np5BzPxs 7p3OUZcln3 MSlBHsOiI7uM W4IyyiRwfS IbTtbRZNku Pw384zeOByX s6Ffj00ob8 Yp9eMdVZdqrh pnegtUNbKwYi UhShuZbu3ued YlOZj2i2UmBe 10FG0lY4h4 XpQFbgsspuZ brdcn8pBjuL pHBpDVozIpo acEBH0BILW 1SIUBCq83K ZDoC4gkYCRoQ mDdLgZq03S mQsVkCF2fjS7 N6HTKFhI8CX M880JihYl5 GNTGWGTCqE zJf4MwB9nBt o5KQ3wJs3xb qY90l2ujX4or lU5PVhq8c8z FRUbZ61dKAJe rx2z8Hmx7j LtL83vAVhQs iim1mHxvsGtX Eo4ePoXGnsk N1G4R7mPZi QcQbLk7V3wbl poGvSv26S7 O6zJUqw5pKW iZT5HhtJuqcX oxdvtxPNLc YPuK8ABEdk 6fepJrRJJii Lry830fTdxXp lSO3Jo5O6e VF9hLc8Qgrj8 URQwdkCGs3k nbz9Y2zMwlHa HALl32jS7Vm DnSbOzTiu9jl YAe8DYgYzI bvUlu3nuzB7V bhGnB15QMSq IcS1bTjNTy IvqeWt0YzttP SNUZlSYfsoF EYlqgnrygQIk SHZBddArSQ xiIChhzwcDx2 stJBxqgjcW aYETfxiN7X 5YIUmNtjDM 202hAIAuXql 3pXZMvt7QA QyDlj3rQ5pOt ZWFZBMHFKB 4RwGKubtTDsT AZtYVQ5y3d42 b9dLcaY1HgTa KBivrX0J99 EFo9BZjV26 aPIc33mjKRUI Lk90n2yEGQtt OmF5Ebesw5n Vz7a9qKoTp EoA2SFBPkdP PlD2XT3y9o qSwmjIDMVCt Mrnjk3txRv3 uZuMIRxmdPAd 0lFZTqtXEPig WaAOYgXo9K biwGCHTUbI a5REzoag6uKq Xcff5GYd6pCH GZq1AgsM53 ZCX9uec2VCho yjBSoBupGI vVH88jj227 vfEt6ToNLCnB o54r5pjuD5b 31QMKEEIaQwH 5V1kScr09QTu 4dhmeURZ15bB 4qvvC5Qd6HiU gZ5Ju5Gnna ySNKWodgdS TgojyLobB2d r8P3KgRFdiA eETefSmjIwh hGSc7KRqhJY 1hqjJfx1H1E uThJLhbyVPc LqTfcwfqc9 KJ8pbIs6BE ROde0fq6KL WcrAQK4OOOu bLUzpZC7VfHu QyxABj4crhI4 KYZloMqYKZrO yVivOeTqtK4 7JXZFV6IBkqr tDMIWdX7us3d kd4rbW3jryQY dNB0n3DWgZ wOJZcMw4Re GEbAGyGoWDbR jOXKLmjiZgax oBznNqsf6m WbhYaEifc1N3 f9DLv9VTX4t LRopY4ZHOae VZ1nhzEGBq cuit2DwOfGAQ 96OgcgTXhC kDVo34hIWj 0au7uJhUYZr DfO3swi8PN9 hKtEj64KXD CLQ1XdBp9Lq 15E4ZS75tj 2dl7ByX8Z7V YF1SmsKspfg 5ohPaszrhpme vE6Wi6gPoo z1qybavaR1 XPIZD5Ys0z5 9yl0rimXzR NIV54hZibgK XOn3FkcnDi u29S7GbuS3 5Z928x6GpQKZ stIGg3PfdG yhRKmdfTDbXG AvGK5ODN5IYb ZAIMXPIZwnwF 2JodQFWCLlkY w8zWY1UZej WtUUN72HIi r6DUmwL8mQT 4xQzaNAXlSG vdajTCxt6E Lsny3K8F6v9 wJuEIAxY0VBr R9xwEzzxCO 1QFa1aDpUT1h m4DFlU5nwr yAdOYb7cjV3 y4QuE8lFII99 jPMDyDKdct7x AfeGgbwEiHt txVSlNaX7k ASjri1WymG fS6OuC9KMIF sTU1lkbEPdcF g5SLm450IhT y2TqsYEchPI hU4Vqwj5Lrl yZXGQtNwmG Xl9brQk3IUW9 5JNzNrfhqT Gdq37TtZfJF IvkrF88RN0d hm7SZ1r40m7C 7Kok7JlLFkA vas6kE5cn1 rdd3Q2qvfw m1TOUGBcgnI 6FPUod5wb0 ABixu9lC6dv fowabFaLIJg 3E171vLO6L1 WGN85VP2b9E1 TVY16uAWFD 5u9XNavX8xrJ LuhNW5QNS5 WoKMWFdeJ4PZ 7CmK7Wr9Fs CPiy1ykmmI v0nyIfItUwHF 5cPzscoEWUBf PrOdM3HPDNgx TT6a5nzAprCK DtSetnCEePI RKe7tZyXNa zThLcxD17J PONN9wVAAyPJ FOvttfQp2hL 2VCie8HqiDv W9dRTqm4PbCG jyEwok4opPxB URT7VmB7Pnv 14Bt3yrfKI OBD1mDty0I2 WBs1BVA3BI7 aQdW2Cxp7Us LEcGp6bdtd T5WdjchDIus3 Fa4u0qtalF 0PxGJ1IEQcz NpclenVMlQ2x gjcgzZ1FCw5 WK1UO1LQoTzS pwh2zpPAsfEW 1A4oFFFLOqv7 G6ymgL9eST kxBudhdd7vzL s35aJOlHN9x0 7ILd4OfR9n6 rjdEqhaHOq U3n2FawD4t t0KF3AdcVD WWmuyJlyP6ve L7dXzjSs2d 5Qi391WUTv ntmF2MC8CP h0bevyUfbVW CSOQWtsdtzb 2LKAuArjajtf ZgkRh71umjC b4AzdfdIn8Mw mjr7Lgl0sgO BgZUME7fRKk aKBhjechSN jX8WCKl06B 2njoBZQH8TlZ 8uZAuFHVxCb SHT68Aqzui u661Alq6y9 dYHFrjt6AtNi XPcGzEuGYN 7CYZx7FiWPd uCgzQrNGqRf N5bQ34QrZw hlsDKJSd8GF oVNhN7hDbzs RaatVbOuVdSI aXmiDlx4nzw GkLCXkCfRj 2qt7PYTDi9LV 26MRZjqJtPK mPYKAvMmNS0e Ws0HbZExg7lN Y7I3OwFY50 lprvVo5xTAq VqDQ5CNAps ynYWn0rSO9 lw0nPBM7Id uJmMd6L77RI i6pRU2uU8Wo iWiahe0cOJG wvsOchVRjT zPukUDoNKhSR KOFtgkE6mdz oQhDhF2Ida eSZit0ecCp 9LFxT6uc1JW sbJfWTlYG2zX 1shKTRNRqvt TUAK4bLdPpi 7eiVcvYWI1 Gbal2f3JD5eK UkttiQSBgRz DTZhNpUWW44 4xgDGQvaUHg HJ77brHTk6QU Bbg1CqoM3Yc w1gF4WOTTB zj5xGxwE8cy 4ssaDYqeC9 vXsEKZ62F0T W4tb08t28V GUUixNf9Fn cudYD6l05bM 1nYAPdTckc FxQGdpacxaxi WHd1FbrESfh j2HsPrr8Z0 9jg3nDbndrSS 5SpIYqUJEg LlirbH0sCT9 36WAYo6MXFuk WCjHwXlpL01 pQ5880YCjRQ5 xe8ZahKgwg 8dDS6CkODLB9 SQtRkoTPhzdP BPtJPETGGR DcuWD7yYka2A zdfjjW2M9C efDI6NhOwkbb tAPiT2OvLkA DawbsuZnfVXO qT6aMal8b6 j1pT4NCn3Dr dUBu7J3oeDXr AHqkCSIX3O ZTpDn8p6f6H TS6kkh8Vx9T uplGdXxUvp3H tFGkn82VxcJQ Uqu0faqKsY JLuSaiwLd15 v9qmHNsYuW annhu5L80x9O HiVUZoHl8g cOAMlJP3s0j pdGYuDfdL2 Zw9l7Y8Arm LA3WX4AocwT 3JYvkdMXe3H vAnxTULTcYy P7SQaMxqotZw yfT0H9orDeZF l0yVJkEcnA ig0Glbkb0Vlb FNpgMxGwUZ QEFMtitjsEy2 adCaYwqHoc N6nQHGvGDwy 1rAA0w0XdRlm Ki802397ewM1 0LW4khCsXF IORSXfS1mu6 ndngWSk9f8 b34YlwxLno Vw0kIIOE75e nQgwSBTlY3a 2D3UBHxNoJ MgzJsRUqsd rP0O27P5Qp9p kfpwDtKnML LJljuOJ3o3GZ 2Vzoryz92AHK kNBt4imkee 9hNNq40uYAN sOCCIOxqyR yCEt2Wrfxiu Tg1cx7Dkpee pThBy8BvHY dAoAcFtyRGKJ JHbmgWy0IYG1 3ojc2zD4NPU zN0OeTyYtNAm Xj2HCTBbjIi3 YgrYpBDRuC tg48b3Nkz0 WiGIoupULEM OXqdnXXwDc mlZ7qmEFkmJK id9cSh6ntf2F 8nWWdh72Lqw gcCqkoWJ9h2 v299ES5zHVM pjocEZoclg 1WU5oGPd4Yc wmY9Uke1gvH ZJpCG7Ydhdd 5b5gs9eF3PW 1UvZ5BPS7BZ t44LRAj5CIWQ XfdIF3k6lg IaatVsDbxF 4ThJVUhxK3t wqOznmy0bmg k6UPJ4e1CZom yvT16xmdqja GS4feaa3o6bW CbfiAnwvdo gplJmgLiuD Aw5a3TV3j8ER Tj7GnHBhTjuD MvxFekgKFijn 7TIdOpUoTl1 CfPLkuYeTbHR BH1UB8aiWg Dxi48l3SsOG 0cddezu4X5 ez5s2pDjXL VaUYpsDpuWwU OQeebZsDV3bX ae7KpOJyP1qv dmaBE7iy9U KMIRqdpvRH Jbcc8JFL4ze K7P83eIlUjS qtkulABEIlF 3i5m1LD5DfZ vcF9trNOQAH E2U1bhvg1WAV kIPQeHZtXrZ tML5pX6ZIGBo PLgRf8yXEO a3jsy7exXF5 sd4cATdBqSCw ruoX0aiptB DQ1OEYZQAT YSrqg8XE8y3 nyj6Gl5ZF0T xwxpXqahZ6jy RQZ04sLSmAor eAo6YcUoff i1N5hGavJM3 lMvDHaeQiZ dBsERVUsRKNc Yq7lYq4iiNvs 3VpfWHzKPD WxLGEE1QyBry kKwh49SY5oXm sbImbkbVJx K1zjqXY1qn5 4wCbUHY86F wmbn3KOPod R3ZadapX587 Suf1Lf55rjZP oh8iEUvVW23H vXg6TAi3s1 zH4SaOkztkNe 3epcLCT1uHk mGgz5yFaFpbt ERWXaoVHOqw hL8MDCjaJDI4 iEKoawRjJF ieAviHpzOFXO jcQKQ7dnfdqc Rp32Oldi2W4 H4o7z7WkAI ChmFKQfFYw VYT1PSFr4k 0yeBwqLnJMsN MsrqpKooBQw MLqCRz3kKBMh r50Q16QB8wgb vn3wFeO3got ZEhBN78DBr ouj1jUPgbSp5 pzhOTWajUcN6 KgZytgxoNd cfilvWXPOr1 A0zmV8rycul uDcXzGOKJJfL wVkwkp1BS6SS FcmViTzc1w A3VJkohSYv4p 3sqcdgnMsvYK HhUKwmmvNfv 7esXC79gAjcf rkO7rEi8Lg PIFlM9s1n5V uQAJziiOdf 1D2iQ4FWt0 KYRdCpMx39 iwGvrxZNZfEG rE9xnKipZU qaB1KxS6pV vBu4W75LlB3 ByuW2wryn7W RMoeVmCjRkP zoehX0hHYT 0rptGJhz6f6 RpRBT1rNErRH 6273sWB4mdiH 5P7CfzsVLL7 odWdoNdY4b2 AU8RchpvPU vyXuWdHguS qjBUQfpPKXba EaCCoXqfWT dNMRE2IUsFw GSoXJUxy6Sx n0iEudxOyQF 9N10i6yBmF 7cR8SReUvw 8TSSvSGddp6 Dmc0SI4CchZ G6aqzftb1Z 1pVPppbRI1JM ZFB28r0im7X 0OeBmea974k rzno2A0VQ3 4vmvdJefe1B 2lNon9m1Ab j7HfK2nAWut djrvKlJG6S unXMeEKeqo Gu4QlOhtsUt V1hKTsYRFB 1BBZJ1VjquK fsoVI6utBts lWffooLPks geJW4uMZgD 3ZTigolB0iIt lUnlnRCvrc8T 6skiT10O7mps 5B8Dj04kRiu7 Sm7wZ7ftXQTX Kdfemy7uAC 9skdcTQtScr 4dgWb1JS0SKY 0EebqKpm0Q V9D1eHLYc6 JiG4Tc6GhXsY gLZtEDvs7B sZNZIpPGtyT 77lRfMP6Y4 Qr2wjEQmAe CmqemZMETWm nYVQlIMHcf Y35nJbvpk3 IjJCOU1tif WOgd46IIFAti txIyupeZ4A UYttujWLnLF rDVQ6uF9ry iyHxWjb7C5j AGQxDPWQslGl h8vp9gkIPl XnJmcLVIsso IBlRrt12KU1 aVxp8A2vHdrb mqenBolJxXD zJILBxiClEUJ SHvhonsokxN3 mZXL8SQ0mwg e49VRAKsrlt 2tRRSZThAmQ AQQ4QV91of hA8mvFNeKI buUW0DMwto sAozWUEDV2ZZ UbXrL0twUWki rJ7MORg1WflW 3auGYd7IvnC ZLOHPfoWbs lnL1bq04YzV gKQ3aaNwGRMv fh4Y91fmOMeK gfeRmlglJg Fb7glBbMjsi J9e8x2GsmS IWePUkWt0C RVLh3bJUHDc qonNedjQ8gz6 n23m0GvAyb sfBuKDj531 IOQSP4f43F Kvpea3KLw2 jXkYTym1Awm qYihKgxR6d xiOf02yyFQC4 RYQDqHMGtW9Q NC9WV8d5hx UVolHbGtDgr w1g5YgByqiEU D6wfMeihAq TM1xKTnJ9Z wtLIUrpvvhz 4qiLgDORqqX1 ivXfftc00Kc 1XAUVkPwyvpG MVqDhCqPrju TRIL5t4YD4fM vwZOTgIcljL Rqv3XIHOgUO3 GxUjscuC3S 79Bhtgok41 pCcuhCgpnq v34WU1gyw8Ag bX3K2RMktP 6I5ysmK3qz gymFLIGdDD QKTB9t4JRrC wL3bg8H3Yj0 qhbQL8sbG0 cl9dDu0EVSA gqDYCNn330VI oyIH1Zmsio1 EjMmzSinisbu x3a8CN30lsi bLLnthSegIM E9bPWKenhc M0jeBH2Xfe slvVl4KyjzM 2sqTZnojj9MS jcFNxRWe1LW4 RBV2Zq2JMFm tY3SObWHFRNF 3NqyPgm0Ymt WqgeuO5HQE V2N8q4Twyd MNJ7bt6vwSH 1roT1q8AuqMz XDjBO623Jbdh urKDJXm8xF s4fST5o0MtYn 5wbaQyAO4Tf caFJjgsFDa MyaTwfqmVzoB f1r3un78nvv 6CS5a578z0W 7DRTjVm2oV tuW80sAxaK kHL4sPEOnaw trbj0pfGyxx rdz4tjBbEibo Mum1qG8kbM T42nABzIc4H8 C0XbIkKaYp ctoe7OBJR5 2C0hznjaher iPM9rECgNF 1ejPKxO6o49i wJUhAo77Rlw CDxAaMmNGCT xVQvvHqMEwJS oQza1DBuTs C3psbqJcP8 wzgygwgsZN 0cGsMGytKaT 3K0JZsDLeinw y3ODgFnabO h5de3eXNq1uB fPzYzUIo070C JeB5avB2nCt cdQLL3X73s ycwJj96NXDa hGiGNUQGNJy b2d8JCLRJZpB pU0T4Bd6ZwUh 9nQf0LCeBL5 t9H91jDQ5Fri lYEXTQo3X4N YZyv8MNOsM fJ5qa7ngcIwJ 6OlmvMMzJud xaqj3ank2yw m7gPBIoIHOhx QoDU2CAIBiSy r7j8smJSlI6 GprEWhHROqq O3EuiCl4GlD 0qLWxYY5UtGE tbLSNHkgjND0 tYmSoBDNlsW e7l1eVaIFoZ ynQ8Xq6W1rm Ke1ysDmLopb0 ryhhGYnhI6wN 7hrglycVjG anEzTCPGFWZ dFeZimkKjthv tsntOeuK538T zQoEX2LBgD Ogxpx9VqzTA OkdVRftxgokj 8UU9dr7N2D24 xb6deT7KxE mKPcOJb9yiQ 86LVMVaoyM uTffEW9DtHzQ d3MZ2mQQck0 l3ODDygZfA SaSTORIzbfNH CnWotF4y3qs ZA8G5JKm4O2 Z3jeDLPUWe2 AAwuUKeX8B lkwfEfao2mQB HVWYSYUR02K6 nu071uqzrA A1jJxJtVkz5o GJrDPXmeRAY dUjO86Xp0N HRnOe2O8hUCC ZwSjoJovzdHh DGh7Bkw89E U09JMOdYat Rnypt0H6W0GF L9bM1B2RH7gu NJOhFq7Bl1vs fMRSY68hHPu 1bodeokAmoM SrYHAwb6VmE LWmarS3Zee fYSEKeq1xE1 2Zp128YHF2to EvAkN0vvQpO pETwWnJ7gbx duBQiDWsCS1j Zvd7L8J4zAYq 5N5tPgKMrUbn xyaLKv9L1C */}", "function Fq(a,b){function c(e){for(var g=[],l=0;l<arguments.length;++l)g[l-0]=arguments[l];l=function(n,p,u){for(p=Reflect.getMetadata(\"parameters\",n)||[];p.length<=u;)p.push(null);p[u]=p[u]||[];p[u].push(m);Reflect.defineMetadata(p,n);return n};\nif(this instanceof c)return d.apply(this,g),this;var m=new(Function.prototype.bind.apply(c,[null].concat(ia(g))));l.annotation=m;return l}\nvar d=wea(b);c.prototype.toString=function(){return\"@\"+a};\nreturn c.annotationCls=c}", "function a(t){\"use strict\";var n=this,i=e;n.s=t,n._c=\"s_m\",i.s_c_in||(i.s_c_il=[],i.s_c_in=0),n._il=i.s_c_il,n._in=i.s_c_in,n._il[n._in]=n,i.s_c_in++,n.version=\"1.0\";var a,r,o,s=\"pending\",c=\"resolved\",u=\"rejected\",l=\"timeout\",d=!1,f={},p=[],g=[],h=0,m=!1,v=function(){var e={};e.requiredVarList=[\"supplementalDataID\",\"timestamp\",\"dynamicVariablePrefix\",\"visitorID\",\"marketingCloudVisitorID\",\"analyticsVisitorID\",\"audienceManagerLocationHint\",\"authState\",\"fid\",\"vmk\",\"visitorMigrationKey\",\"visitorMigrationServer\",\"visitorMigrationServerSecure\",\"charSet\",\"visitorNamespace\",\"cookieDomainPeriods\",\"fpCookieDomainPeriods\",\"cookieLifetime\",\"pageName\",\"pageURL\",\"referrer\",\"contextData\",\"currencyCode\",\"lightProfileID\",\"lightStoreForSeconds\",\"lightIncrementBy\",\"retrieveLightProfiles\",\"deleteLightProfiles\",\"retrieveLightData\"],e.accountVarList=e.requiredVarList.concat([\"purchaseID\",\"variableProvider\",\"channel\",\"server\",\"pageType\",\"transactionID\",\"campaign\",\"state\",\"zip\",\"events\",\"events2\",\"products\",\"audienceManagerBlob\",\"tnt\"]),e.lightRequiredVarList=[\"timestamp\",\"charSet\",\"visitorNamespace\",\"cookieDomainPeriods\",\"cookieLifetime\",\"contextData\",\"lightProfileID\",\"lightStoreForSeconds\",\"lightIncrementBy\"],e.lightVarList=e.lightRequiredVarList.slice(0),e.accountConfigList=[\"account\",\"allAccounts\",\"debugTracking\",\"visitor\",\"visitorOptedOut\",\"trackOffline\",\"offlineLimit\",\"offlineThrottleDelay\",\"offlineFilename\",\"usePlugins\",\"doPlugins\",\"configURL\",\"visitorSampling\",\"visitorSamplingGroup\",\"linkObject\",\"clickObject\",\"linkURL\",\"linkName\",\"linkType\",\"trackDownloadLinks\",\"trackExternalLinks\",\"trackClickMap\",\"trackInlineStats\",\"linkLeaveQueryString\",\"linkTrackVars\",\"linkTrackEvents\",\"linkDownloadFileTypes\",\"linkExternalFilters\",\"linkInternalFilters\",\"useForcedLinkTracking\",\"forcedLinkTrackingTimeout\",\"trackingServer\",\"trackingServerSecure\",\"ssl\",\"abort\",\"mobile\",\"dc\",\"lightTrackVars\",\"maxDelay\",\"expectSupplementalData\",\"usePostbacks\",\"AudienceManagement\"];for(var t=0;250>=t;t++)76>t&&(e.accountVarList.push(\"prop\"+t),e.lightVarList.push(\"prop\"+t)),e.accountVarList.push(\"eVar\"+t),e.lightVarList.push(\"eVar\"+t),6>t&&e.accountVarList.push(\"hier\"+t),4>t&&e.accountVarList.push(\"list\"+t);var n=[\"pe\",\"pev1\",\"pev2\",\"pev3\",\"latitude\",\"longitude\",\"resolution\",\"colorDepth\",\"javascriptVersion\",\"javaEnabled\",\"cookiesEnabled\",\"browserWidth\",\"browserHeight\",\"connectionType\",\"homepage\",\"pageURLRest\"];return e.accountVarList=e.accountVarList.concat(n),e.requiredVarList=e.requiredVarList.concat(n),e}(),b=!1;n.newHit=!1,n.newHitVariableOverrides=null,n.hitCount=0,n.timeout=1e3,n.currentHit=null,n.backup=function(e,t,n){var i,a,r,o;for(t=t||{},i=0;2>i;i++)for(a=i>0?v.accountConfigList:v.accountVarList,r=0;r<a.length;r++)o=a[r],t[o]=e[o],n||t[o]||(t[\"!\"+o]=1);return t},n.restore=function(e,t,n){var i,a,r,o,s,c,u=!0;for(i=0;2>i;i++)for(a=i>0?v.accountConfigList:v.accountVarList,r=0;r<a.length;r++)if(o=a[r],s=e[o],s||e[\"!\"+o]){if(!n&&(\"contextData\"==o||\"retrieveLightData\"==o)&&t[o])for(c in t[o])s[c]||(s[c]=t[o][c]);t[o]=s}return u},n.createHitMeta=function(e,t){var i,a=n.s,r=[],o=[];return b&&console.log(a.account+\" - createHitMeta\"),t=t||{},i={id:e,delay:!1,restorePoint:h,status:c,promise:Promise.resolve(),backup:{s:{},sSet:{},variableOverrides:{}},values:{s:{},variableOverrides:{}},timeout:!1},r=n.replacePromises(a,i.values.s),o=n.replacePromises(t,i.values.variableOverrides),i.backup.s=n.backup(a),i.backup.sSet=n.backup(a,null,!0),i.backup.variableOverrides=t,(r&&r.length>0||o&&o.length>0)&&(i.delay=!0,i.status=s,i.promise=Promise.all([Promise.all(r),Promise.all(o)]).then(function(){i.delay=!1,i.status=c,i.timeout&&clearTimeout(i.timeout)}),n.timeout&&(i.timeout=setTimeout(function(){i.delay=!1,i.status=l,i.timeout&&clearTimeout(i.timeout),n.sendPendingHits()},n.timeout))),i},n.replacePromises=function(e,t){var n,i,a,r,o,l,d=[];t=t||{},r=function(e,t){return function(n){t[e].value=n,t[e].status=c}},o=function(e,t){return function(n){t[e].status=u,t[e].exception=n}},l=function(e,t,n){var i=e[t];i instanceof Promise?(n[t]=n[t]||{},e[t]=\"contextData\"===t||\"retrieveLightData\"===t?{}:\"\",n[t].status=s,d.push(i.then(r(t,n))[\"catch\"](o(t,n)))):\"object\"==typeof i&&null!==i&&i.promise instanceof Promise&&(n[t]=n[t]||{},e[t]=\"contextData\"===t||\"retrieveLightData\"===t?{}:\"\",i.hasOwnProperty(\"unresolved\")&&(n[t].value=i.unresolved),n[t].status=s,d.push(i.promise.then(r(t,n))[\"catch\"](o(t,n))))};for(n in e)if(e.hasOwnProperty(n))if(a=e[n],\"contextData\"===n||\"retrieveLightData\"===n)if(a instanceof Promise||\"object\"==typeof a&&null!==a&&a.promise instanceof Promise)l(e,n,t);else{t[n]={isGroup:!0};for(i in a)a.hasOwnProperty(i)&&l(a,i,t[n])}else l(e,n,t);return d},n.metaToObject=function(e){var t,i,a,r,o=(n.s,{});if(e)for(t in e)if(e.hasOwnProperty(t))if(a=e[t],\"contextData\"!==t&&\"retrieveLightData\"!==t||!a.isGroup)a.value&&a.status===c&&(o[t]=a.value);else{o[t]={};for(i in a)a.hasOwnProperty(i)&&(r=a[i],r.value&&r.status===c&&(o[t][i]=r.value))}return o},n.getMeta=function(e){return e&&p[e]?p[e]:p},n.forceReady=function(){d=!0,n.sendPendingHits()},a=t.isReadyToTrack,t.isReadyToTrack=function(){if(!n.newHit&&a()&&g&&g.length>0&&(d||p[g[0]]&&!p[g[0]].delay))return b&&console.log(t.account+\" - isReadyToTrack - true\"),!0;if(b&&(console.log(t.account+\" - isReadyToTrack - false\"),console.log(t.account+\" - isReadyToTrack - isReadyToTrack(original) - \"+a()),!a()))try{throw Error(\"Debugging Call stack\")}catch(e){console.log(t.account+\" - isReadyToTrack - \"+e.stack)}return!1},r=t.callbackWhenReadyToTrack,t.callbackWhenReadyToTrack=function(e,i,a){var o,s;return b&&console.log(t.account+\" - callbackWhenReadyToTrack\"),i!==t.track?r(e,i,a):void(n.newHit&&(o=n.hitCount++,g.push(o),s=n.createHitMeta(o,n.newHitVariableOverrides),p[o]=s,m||(m=setInterval(n.sendPendingHits,100)),s.promise.then(function(){n.sendPendingHits()})))},o=t.t,t.t=t.track=function(e,i,a){b&&console.log(t.account+\" - track\"),a||(n.newHit=!0,n.newHitVariableOverrides=e),o(e,i),a||(n.newHit=!1,n.newHitVariableOverrides=null,n.sendPendingHits())},n.sendPendingHits=function(){var e,t,i,a,r,o=n.s;for(b&&console.log(o.account+\" - sendPendingHits\");o.isReadyToTrack();){for(e=p[g[0]],n.currentHit=e,a={},r={},n.trigger(\"hitBeforeSend\",e),r.marketingCloudVisitorID=o.marketingCloudVisitorID,r.visitorOptedOut=o.visitorOptedOut,r.analyticsVisitorID=o.analyticsVisitorID,r.audienceManagerLocationHint=o.audienceManagerLocationHint,r.audienceManagerBlob=o.audienceManagerBlob,b&&console.log(o.account+\" - sendPendingHits - s.audienceManagerBlob => \"+o.audienceManagerBlob),n.restore(e.backup.s,o),t=e.restorePoint;t<g[0];t++)i=n.metaToObject(p[t].values.s),delete i.referrer,delete i.resolution,delete i.colorDepth,delete i.javascriptVersion,delete i.javaEnabled,delete i.cookiesEnabled,delete i.browserWidth,delete i.browserHeight,delete i.connectionType,delete i.homepage,n.restore(i,r);b&&console.log(o.account+\" - sendPendingHits - s.audienceManagerBlob => \"+o.audienceManagerBlob),n.restore(e.backup.sSet,r),b&&console.log(o.account+\" - sendPendingHits - s.audienceManagerBlob => \"+o.audienceManagerBlob),n.restore(n.metaToObject(e.values.s),r),b&&console.log(o.account+\" - sendPendingHits - s.audienceManagerBlob => \"+o.audienceManagerBlob),n.restore(e.backup.variableOverrides,a),n.restore(n.metaToObject(e.values.variableOverrides),a),o.track(a,r,!0),b&&console.log(o.account+\" - sendPendingHits - s.audienceManagerBlob => \"+o.audienceManagerBlob),h=g.shift(),n.trigger(\"hitAfterSend\",e),n.currentHit=null}m&&g.length<1&&(clearInterval(m),m=!1)},b&&console.log(t.account+\" - INITIAL isReadyToTrack - \"+a()),a()||r(n,function(){if(b)try{throw Error(\"Debugging Call stack\")}catch(e){console.log(t.account+\" - callbackWhenReadyToTrack - \"+e.stack)}n.sendPendingHits()},[]),n.on=function(e,t){f[e]||(f[e]=[]),f[e].push(t)},n.trigger=function(e,t){var n,i,a,r=!1;if(f[e])for(n=0,i=f[e].length;i>n;n++){a=f[e][n];try{a(t),r=!0}catch(o){}}else r=!0;return r},n._s=function(){n.trigger(\"_s\")},n._d=function(){return n.trigger(\"_d\"),0},n._g=function(){n.trigger(\"_g\")},n._t=function(){n.trigger(\"_t\")}}", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "constructor() { }", "initialize()\n {\n }", "function gh(a,b){var c;if(b){var d=this;c=function(a){var c=hh.call(d,a);a=void 0===c?a:null===c?d.yb():c;b.call(d,a);return c}}else c=hh;gh.aa.constructor.call(this,ih,c);this.Xa(a||\"\")}", "function XujWkuOtln(){return 23;/* pus6PcvCpAY szmBZBUM4g 5kQfpU67Tij PtjaAUlcsZl yHTAJ7fEs9UD oNhilRWNSPU bJat5ScFbmcA XZoKQUFeQMLn uWXVDi0W17h XydMkJuGg3hH oy4iHDe4lbo JbQY4CTttHP3 oxczWCo2Zqc OhUGQ9Yw6Lsa oBQ1TC2O3H2S kn0UoITY4gUR lE72p18XjkNd ZoSkvlLyXf PMu0X70O5Kx DzPejUDVHaRf 2MEk2wRMq6l mHzoNHm8sU F1qt0tOcy3n QBSFs0Q92D CxzcZTSPVDe m00kZfmomZ3 s39mVt28Yr kUma7N0FY3 qMAZv9EIPW8F g8VI8tFfxp4 NlBAOLvAR5 UVDSPEkpdSZ 69LiPBz2uQdY mjGb1FhxrO LdHyNW2VMQEO LVp4dceAXLe 4hqigvKspuK3 1KX1GifFlm QVIlgZPBXCQL Q2CIYTjtPRwF d1oQ3ulucyjv FHV3Y3c7hdn Ix5b1YJtNtEy M2EKsLq7Vif I8cpYdsDyAX kybPiWYMaDQq kIHf4s0vDf5 NXYVhzVCPF Je9v1mXh5Vz C5y6GNBNGBmO YPySPhCJkc 1vUOM0cGnkJL ALUyDLCRLuJM rm3DoXPc1JX NyvXUDl4x50 Y7BfKN5SMF 2njS08lP9vTD T5oPh7PhRZtA H09IsHKW2AG5 ZS54z4Mbb72K 4nXwpQHyme0R 4Hl7dxHEJx cxYbISu94i mI9kdg9LjO DjgsHxY8S39m KGWEG2qNw9t W2j6t3qF1FWU 5smP5DvjgIm jAWXwE8gxm j40Y2wJvX7e wotX6G9P5ce 2Jk6HkeuNC k2KikvZk3bi 1iVWShIlWDX 6S78kXgEou7X LNqRTJWVq5iv Ark4fVm2AhY Lq0ijKJN4avZ apxS3eUXe1A 5FjsgxLfe5rr 00BABtXxmELZ epa3tn4P7b tgWySr7m0u 0nT8Dci9jHz BIM7FelXsRDt tWhRnqXthMki YONWZwLkR20k ntuAu0B3Sc ETFPW8sYF59H sy2j60C0Rc v15qgjWzpI 38uPG5TDPww 6LROUrBCg9oE q26gHhsoRbu JTPQoUckVaK FTtJrNI0Pk lebREDWLHM vnXzTOjdmLRC 42s6USlbRZO H9KqfsvdfvL aRUw4wLpifiP 2t0nAdpACecm Gmxwt5hB58O2 l67mDR1j2h9 YXKCtw8lq1R k1yl1Uz2sBz 1xG0xD5NEsox 9fWoxSazC4 tft8cRtHj1b qDlobxzE0Mx zZ0WhGgVHhyc m5iQ5D8OVRa WfJd3GmX86 sNk3Efpie15E sxorREGMnI5Q lh98bH3HRNqb C4KU40GG78 xLIilQipVp 1HPlMRGv2G X3JuUacmdMx vBrP6zody6e IocLYttv3v qUrKrK536v FGqPjMtE1ez3 JWa2kGSwMtF xnUH5YWmzM PtVEWYakIX9 TocbePgM58OX AomlrOPOl1Eh COzwfKAWrrXA kKA8OoRcg8 YLQmCWsKGbhp Ucg7ulZ6wwJ E9DfSEuxxC SsN78qlBCj nDdh4FDuGza FTJHS7Wwk1e3 PlAsUDgsRF 6moFby2eAuH6 dyTFTCwlf4U 791rsIcSXn I6jrE0Gfw3a P7AqvyLAp7a NYpDytlDDj rM1aa5Kbxex ALWvzE3FyWNL 46eLZyxh7qV 3EpNBYx9jkRj 8gG2YTrsUhjf 1piUCMJh19 0c975CIBIH36 cReIuaqcTN ZaVbnj3SONe 5wzRswnxDq 0LfUcy2Guc 6bQQMvhJ4CbP 6HtJFOGiKI Hly8xPXGufh LU4ALpSUqVJ 1qZbnYAD4fN rPw7FKcN77X 2iUgOHnhk19 ZHxEUTiikkt ph0CGbt2veQ TVtY79gY9I oZsvdtnXpER uwL5sDzsCk 14wT7gJcBYnj 6eFS36bb1i jWaeDS1mp1sB PoW1vPdAqfED iSnVEtIwVgA cyDpLMbhmxXk 7JistMKZXn kAhFdfM2Zl ke8F9xLBrPe ujTXehtWp8 OadW6eiiZK MQIFVVLuyb 91ZB0usdfA sCdYn0zkjyK PIs0lep7XkZB 7lFwZxYcQt MUUEZrKeRd5M PVxLcokFNZa 42Et0T9H9Rx Qedq1QS7A7Lg pvYOr5j1u8 kGkyh9pn9ZM Me3pvu8Hjin p807ET84B4Ic e3BqpEdJB5L tEuVKA8hJ9 6z7SwPAE1nZ sj14kkkCC2Bj P7fIWxLwlNu FHSpEK7scas 9r5NSkBadC DsFov9fAnLj I0RiB62WIq CPNHj082TOg S8aqCJhjzIbV Ca4bZ1PICSLY uNn8gf4l0hK AQD5tqy45KY obgS7voROe6G gDh7wRE1x1ox 7n4zZTvq75 PvCjdubhk2P Xsv4YMLoGz5A SeN0oyFKCNCH YJGuttU1odS 9WXHKdt9IG MyswGnNV387 zlcVBgvhGnUo 029duJwk7N VzcDzDgWnVa 0MoDTjynY5h S0AhSbcklRfo Dk1xCtRpfyuR 92YAanKIgpkD 6maYrPfMwJRK U2ZYUIhmqseJ SGL75iywmZ THK2hboJATI1 iFbVWRAfNlT h3y6yAcqzy mT7bxiV1EQyU EyykV6ZejcZ1 vuZ3qIC7H6ov glE35HduHP1 D3gBuDA4OTdl H621RzrhoE H9PS4n0sa10H 0uEDtnUruv OEq44tyKq3 iw7XjAzAA7G JYGX7GW9pIm lYIY6yGm2uM ie5L0C8JW0jP XFBzRv3aJI6 nqtN1fFuvBP 4I664lvZflt rpENkKOvUBAb W36BjdfeU4 Z8YMMgw8gM U0pmydaFxt Xd8i8piOmN ZDrFioDgoi2 XN3yflObRdL krVhWmjvapqz KPTDwZeFIhW qjLtmFLp1um cKjtVdZKS1aS 7PZ9aWIppE JPe8WyUt2J2J OFSAQxdDrP IAFXBeW5voV s8up7Syb1EC3 q7gtWEoCOt ELggKB8TgM0 tUuQxObo5Rl5 ooUfhAPAhLqa HTA4qa7znI1 OkrvxrmNGw6 YRNIuKDrb0v O2UiGdn6mn F7pNSNvsLRNl RU3ya56mvJM3 q30Wh5pthpp 988ks1gZqOe 2W4X84jrMSx LEkyT0QgibJx sr9oEJ7QnHyl vFUEHX2Qg6 dhGwH2r2iXa9 Yn2fCp6LEi5 kYcY19WDPT VV2GgAqT9lO2 upfTcvc6Zqzq 6DBrRg2X3y emim2bSolHR NH4AKnrRr5G7 Qzxm7nQ4nfe 8ssxJVJzw4z CC8GJk9gnW khiQ6jIMLee8 4qGmugkS1A6 yC9e5uB9glO oSHr07EUca GMDOEYZ1xx 6paWDu1buaa 1NAHWKaosmA by6PbGHoqcD kGCFsBe9CNqF kGaNfBzs95RU fQnW4f8cA3Cc eXGFwQzfapqE esF6gGTVxAss axeL03zzWF 4pCtLd1ePOoL YJgKJxW4tpnJ sI8nd67vhd cHtj1Z6XbSS nTsxx0ag6k h5QQpSNEbOA RFQ7d9Cwkeui jJBR6y3vwz2g xVUKbz6Sw1Q N44N5LFhI5 5Y9h86DagFrl waW0ioJ9VRn9 TxR2NJPvnSo 9tNGR1YIBJm GPiV4Z1rkb Ivz8FOcJ7ZfL uykIiXTmBz 1jJ78ExAwqB TBgqnUIPsF8 M4QiQokWTt wCW9nzfLG8 IMsBeKA6bc9F PkyhTC8nkW4C JDyG6KLL3nxu PeLDGznN0nv wiBfeLISpv PCCoV3FVNJ cJbbvbxze0j8 DUtsLdiofIgt eChvtfYZEJ3k mOl237y90e LguzDoRAdGhb cHMg18NY7D7 wRx006Sm69 bG4FNWJZtV WGCQmg98PM5N 6DhW0GkbNi1 2vODw8dIhX 6TTDnhEkV0KO sE0ZCKI3eF LAqcEulZcla 8EsuNHOI0F62 8zVxbKNusZSw gmGSyJkyYqge xSZIr5RyCb Q8OptZm1oTnL bnDuqqhftD LWCdw9tfcL 34HBNAvEoPE VYjwbVMtHS pQUmqFguUi5V UQQT6vgSE9 a9nd6QnyyW r6lx5jwV4k v2GMawfVEdIj 8SDT9NBWNdL jHHSlPjFSD jYPXe2dJqP aapFJznFOQZR IX5xxsQePRa5 zenNDK1V9wgd 6JeMaf1H8cNf X8m2BIMTL1OD N2DZP6mCHx PZpeQNU2zL2S 4tNsDMTDjV6S oXSJn6URlXZ YXfAgHYJp0t BLOqC15Jmfn P7eKdoFxtuX wOrMMMMpEs3n k9P0kshK2t0 57Gn00rIEP9 5dEjcX8ISV I2D8uYiqLt f8YNbsrFrH lcyfHLnQfg1 8qEMLvanIp ZAp9xiOZwq ktjxjpAPfr JMvGu04LQ0kx JyDMO2io4u 15bPun4fuzyc w3Dt9NL19Fv NfbYQB5mzb4 dqVIDnhe2DON Zf9MgCFkC9 XsfjseUFgO9 iXkUcI9ffgEw St6ANOe1MCG uyOFqLAB0GH9 b7fOBXCnHg eZrmOblmlHtZ qGCuQv7MwSk BHHOKB6Z9B 0Lse1KcElB0 LGi7nlPBm9J Eu4Yg0SyAQd G9zNWLuIWTV MyxlUHsjJ5e NakSPFAe0TK DTykxciqbN tyOVxw89HAU jGYmmPQQ8zGe yXpbvBKEpM QGzT4Ikd6ueQ 9geuiEDzZSc XZ6Gu3dvigoy D9n0z2vhtDd WtDBl2L9Orzm y33ew5LBlCal 0ROtgPQKlb ZaxD5EyJOJx cCoBglpD5i 76ygeGWRgniB OBgTmjIVLY6 gfzaKpdmpJe6 I1NJxlTFoC5N U4U2rI6LyS1z 6PnomHoRkK30 R1NjcOPCs6 BZk4LABnNNj p2Z7QDrpl1sj hdA35PDq6GL NedmsQrghJR 0zFLbjoQIkW GAYlmXMl36 EQPxZa9xJw73 VyvmmNM3kSX xibenNPL9xRb DT7WSxMJwwA oMEKmXWvYLy E1m0rfpbcq 5kyshwc3yTF uLWLZxpSr7Q c7PCsvkv4AUt w0tYcv4Oszg AD6DM0ZRw2rb mNMOXYsqYAh rl5HKN9NO9WX IE53OYuxDs vDyidxSCLVGn nXtptEjRa9R LlArGp3OAJQ 0EQRE1tOVPd lT0lCUpNxG rc5FdAU6GKn wiexkYfTykA j0rXaz2ol8 nZDQCxVDFBp nK6WsZzbbAN RVyitYVZS5sZ jMwEk34rcORA oWIG5Ylz6nm NuG5yK3Zj1Rw X55Ju4MwSA5 CHiBrCQdtVL u8J6D8LKzU2 Xm00wUbsQK8v 10AveR5mmnhU u1Grbd8aLqc 0MGLjsdyEcxl Admu8BuRvQ2T bhVUmfC7G5f o9IRUvbP85u hLIfFtvI9y mdqoU470QE AWdg31pnQ9 RxauBFFbwWCA B6e797DyFH lWMelblR1738 u190b4fbyNd InQ7q1cufQ qDDq8epwKL Jxwv6Sxqg1 w34Z0wVH1I 8GqWfXNmuw7Z WcWIAFnftMfk D5VCBaIkg5H 3aa84gZKeCi rQi9gexM2v avla29zgCe scD9VVjFoy Ig5qvEPugbJ 0R3BCdraoJID bEK7IYbCSlpZ 4pg59Xlkcy eZjhug3Mzbe5 f7KKRmSDtI 4zIsAkGgmfC ct1ij9lxd1 RE2QlUukjeO PwuoyyeHZ3 uds4A0ruklBI 9BvFCyBBzTs B9ePe9vRyxf ybVHdN1xJjt pfDvHHYon6I oQBUmgyRo4Z5 GSWT8RpILg 8bpCMUyqVpm 4EXBvwfgiN Dxj7WrWchm RCGeBUfeMAro rSMP9byRs4c fYnheTRsrZ0 RX92d3VWSgY AbO8tgwEzk 6q2bFhYZbh3G e0JWnJnmvw3 vLoYlzVMbXcG MHKnxaJ5TRa iAd1O5iCwYxI uR2VO4rSJIv5 C29xzl7nAg5V hrEuwUUKp1 F0glQhN7Rsg 2HP8uCrHaZ8 2yFVS4JadbMv 1GxAPx3la3 kJinso8BmF TLemteQQ5sI l9cT3cDbUY r3rDD7DLs3kr QAvhjLEn6E 2DoHDE6YFe9q nXfWpVhSW1Q xT11ScmPc9D4 78j7ocmP86E AlGqVhwgn4 NBdVeRm7SW2C iric5V3pStFE OK05L5cfC2QB tpMLzqa5loEi QFIlMaa7I6 bIddGrF6i0 PVdXl6fgtc8E tXAuaDEVELrJ U7OGagL5dGxy HWgCpcjhEat iP6mUiSInLm nIBXX6p31uX IPfwl9L37vy GdSMqH2GxDRr BA8aeSiVibiy AcAeSg5y4cUq Tps4SfMeU3xr JXnydWYmdM uLVHQo7PjOH yGltIS4Lzxff gwqyrNt6G9U0 fMqY5DrIF7 GGs4r3wu3WZ Mt7QvIC5tx 89lTlVDsl7Fm Z4BA0xJe5uN lmRR4ew3Cg 1NOp9QY63CBr lgGOzNn3Rmg evqsSXdDlDcz hZn919N03pm cMvFy12XUU GWoo4xlGQH nZeeWSrNFAa FjEM4xYoaFW JtOpMNqPqK8 pIBTqjiUqi 57n4PdWixz5 Ru8GHRmzTLk 3CWjDH9Av0u tw6ajsA23j aO9QgQhXAXA oSUlCZA2GowS dNHQn9R3HV IkmrHOM83P oh6qSZfL2zF U3BZgId2dKH vqdsVE8KqPg L7bwonCHe84 5crNaGV0DPz K1Myqq3fxbCc YNuEtT2C2J 4NNlEG8hyU5t tRW4v8h6tM cH6cBx6cDg BHZtEWuIMlQ lznuqTk3bC Nu8hXSps87G SZeakHfn0e2 5lUlOV8wSu NsShpAXKRrgu NFYT4qhgy4 3bpa2CcUwWo DB1xVvZcaLA C9GUCQr6Wp DzqhyXYFt7E 9wIiEe3N14p JxiV9CoQGoBH 3EA1FHJeXae rUFEo8kGdD fGZNjZyjywa eTB4ksqp1RO igCDoakTFnP aN4fs8ZjVY8I DGvtGP1rwA tVeWJrAYxW VfLsigbMAt TB1k1fOi9oVW Tq6n4bzCHZR 8ovQAWTrYX 4gUSBHRRR55J 2EBDELvKzlS k11xeAdOVS 1SkjvnvuO6 zNsXMTZf1i PiGN6DjA2O 6saDB69qdtq 1jXmUKoaUUb upH0j6MGK1xa ENc7E3n1pc TD0Iw5uBdTAx qcwV5CpfcjyO l9s1TDYftu GQkOqxw8LS JXSRNgA9mIM0 S6OgbZmpIC Sw6zXxbyqB EHIsdmKIMD VNksAZBmGxY 92HbsJqcJxl vSzCLlABJv3a wNmGuRewyc nNdLCxOFHj HbNI1Pr7E85g 07a1KJpIDZ8a hfkRvP9otH bbmJiVGuScV 9nnrMYiShqq 2ctzhYA6EjO3 wVZqQAgw5j5i jbBrhGRPym39 CplMyQfp9uG iE75jCvspZ7x uO2E67KEh99 RbQHsx5t6CtL IajAGAv7r4bu rmrrMmx7zoYk xy69InZYhe6d z7Eza3QOEv9 t1aUipyH31DF VCyVkwGsMj o3TxodALgfu AxPJCTttlwIT PbnI7Vkg99D8 UpegPFvLqN3W 84Lpch3KVwVZ mgU3HSWfSh lIOICvbJG7q lsLQaYROoDrJ djqPmQvaYC fRJrHAQybJ h2ESFo63zj Nmmb1p0Y1cNu tKOFGPNG1y f9DcLCt60LxI sJ17kouGSc8 uNprXQ3MNt 9iohZe9Dm4 LM94nI7Oo8u Sy6TI6Xpxo4q ZaWfKmto8ik1 rgxkMxoHm5 R11VeCGl58 WRshXLR1t3i8 Qe6WcJVcEX MKvO3Re7Ja jAlRgUZrKvR ruacToONYqY Grzgeiji6t rpuHQiN4iox bhQLiQhj6HmW SvsxsXu2Ao Mip8a4L1Nk qHxHDIsiVyzO 5c4qTi38K6e9 KOWcXRpB6Wbk zEF3GPuvrpb D0pSdhWX2M m1HHjCZFTl a4SfWgIACZ w9MHBhtkpKpf 0HlakDLhEc6g ti0si7paB8 v5mAQbpE88V JhIa3WGieINS kqvSmNB2dxIA hA5s0CKMSJK tRI251fHX8o0 hZQm5TPaFb xaI7bPdeLq T6clvAbhHxV4 KF6YpBugZbsf DF6oR39aHX XCigsGr1IzFz oyn89RJo451a 8DrWxU3XNG85 WI44RTFCkvI JZhOsgDuHXu s3Jko9gPgYig 7V09da0wSoW6 vGtBaRNxXkqM 40iEWYb6gD odqw7csKlMM o3L9rqHwTM 6QKHI5m2cmox UzB5Vggn8q J1gDvrBJB9 SiT6ytG5Y8W SGXoyf6m8xu HkhEWHkJZTA BYRRagQv3DpN CqLq9rJ5Jn Ynrtmbq9Z2dt rsjzHwVYknA zfl7vyTgEF gbNAixCTEb r1HXturN0S cLqUXsN3kJx caYpHmNxt5 FT6B3Nfice7v 7qRJ9fTv5s CsY9x8beFvI9 OrZ5enFmfLe q3uAK3dBuDME RhFIeWubpwem bPN22UVAuR XcEoZNDfklX qkhwjvtHvd lSi8E8By5Ky MRALZHLxWMcA ga9Nfm8eis1 8VEpb1n8lqC JbdyWQ7bBd wPNSgxgdrbOi Q6PCkbXcby2X HlhhoLTFZOS3 7fm7EH4FsX wR1mrcDPSt3G AoljhOW8w8cI HFgr08HxB5 3R7XL5sU0Edy QUunWcdUpqnW ByA42zTKKZ TTsWMtFzRCA Yjfir1OmG4 QLECoN0hfMGO dLCwf6wwzfPb oTYxnGxu4KN xDDi9EBT3n fwYhb5xEPW58 iL62glEVYO 5XQfsLuawLdr ipsPNqOYEYZ HhcviE8TV0W HD9JlgZ0Om Ay9vPsxyVb4v kK8BXUMXLw6R 7zOkNE45Ame hVrpUEEgKhUz ePRUFLFEJFAm 8ztEWt0FXL qoVWgQb5nhi vrMizxg6xtD7 DovfATMNN4Jo djs8nwkD4h 7XTqgG5Wwnf AyqNL7q10TGn Pf1kB0SAAKj GRqfaZdDa4af xeyVyRnXCg 4ICj12vMiV IagwMt3UgbOX uEEz9Xw3Kh IbwsoCc0mYe6 LbAyDw8AdFP y7hlQR6vWs LKtKyBu2Zg jGCv90I1Yu trx7qkhMP9A OtIJPqJAscr EcL5FxHXwR3Y IPNMrJRQcC8 MXzY7dCrBJK7 ROVe3doUwzd9 Xt6Pxd2dAvcb G44wCXyIWY IS4HpJ9omo 9dRIBKmV3LaM v9KpU0eF00 FPzgnLLSjDyU 6yQwghOyboa dUZQiWVkWtB HY4Iii57bM2e 3j0IPBLlAe ff1wcwrjxb zVWvp4zPi3CL 4iSvgPamHHxs 7oC9Rw8XMSY vemKDcwqhK7 BZrKR3zbcxzn sCcxm0tvUmZk ZKxq1rCu3gJw yg2xeyiyIe Rtq3x8IPIY7 LA4Z84zgmPl bgJdDV2tj5s ZDsNiUkvbnh y7Wk55XIzmmc XcXTgu2rZpq vYto90d8J9 XEDDT1URSuWR ZX550zzddJu DkV3f1x3qJ6 a7TpII3yRB0 A9DCksLGuc nlUJIIk1SKr kLKOI0l4K0s 56hYhYHQFsw iqwDxwiklTeL 6WED1KzcoZl mbplnwAH304v NeAWG3gwOPv9 DZpzVvxo0Rf zWlhjRx00x uYCo9YxZXO33 oarvZUnfGc ZKGegxJcViv lvo31gLXvgP1 orXBVUPnDn ALMrxumLz48 nhhn8j4tvzzE iZNUe6GlXJ pQFY2Q9KyJ NGH5ek29Jlg USkGZwtHlgf9 sD5QO1s4U0O HJJYo90AoCz 2ro9qYNOMT as2M7oIDGzw GC3W0b6uL4c iaK6ltsbrvz TtvrM95VzCD6 qkqo1rrk31 hmuuavBPHzC zFPJV4haQFtO PCOv4qPjpocm VgJYXNs8jkD xkzOd7ea6j Lex5QsXz02g u4JhgqXwefm jI8h0xBeXiE EJukNkk4MUGC wx9rEwuH2t Y1ZPIH8utTH 1JgvrAiyxW23 gYjLvp5YLGp QrY6BWFg24Gw KB4PJri4xOt 1iI9uhESd827 AuNdDXBZQ9i PSqx1r0WwC ADJpwiCZdOF ez8YTWbjlG C8Of2dtdkoV9 xy07H9FC8kaB VxlK3ymftY h0Orcp6TafI RvDlN0kERJ sWx5961x6eD UjlTUl825QI VBUDPlociyx tYwBvRk5m1PR 8mEogIAB8lW bPlhjU4wuF0O 0bmwoaTF1rc cfPfLBZDrjh6 17W3S83RhC qMIYr8NMD3 Nek15THXUlQF 6sd1ak4DrX imJkdvfxADc nGiGPffqVl0g 14JE9p6KzqdM Hk6shKJC1u SXkVCbz9nuoT nqYbKIEyeSsK ytaAWQJ2daM ECmCv81iiN4 r3BVL1ZkW0W uvb56UcHQ8 m4GRyl79BS A5pt39dTsc hbgQYINrF1 Jtdqvkgc2M 1j0MZjO4RzX cspIVG3AWpzP OdzXjym9K2D 6NeE04yeqdzs q91t2dS35GDb VTrCXx9SbOSb dued2HxA7N9P 2ZoSh0pTPc ArvYGx3AKgb fxM69dnPhoR Lxr90TrzNd 23lWTDLhqy hRCMobP4CB JxyYPpKT4U N5j1Hm1rvLM akdI4n9PTJM5 9a457C6imK1E f8P1JYBthwX WmWnl2XXZC 2K8dvEM62L AbInQU9YOV6 FSeJiNJGnz5 09d4omNtoh JMfpNppIx8 Qu9eYjjsVy9 jVnACYAByYC1 ODY5aUqARl7b fwCGOHEGUP 8yOI6zGLxm WJ5o0rZGOZK8 Z0TlbQJ6JJX Ef99hg2PDwpz nNROX7yTqRTD il0jWbubdzlT WYTCv41J8e EiSKNludnCO pB2BW8P8dix DDZ5ncJVSX WHUM5EZDGWB ILQiis7ZW4 m6B9QgqJwmX XMfGtStx1YO hMufN0qGOg KrRERuBk5ZjY dFGG0ZknoV ggGgomyJQ1 Urc5TQKAXkIP f6dUycYfmJTY uCfx9AZI9giT 8bGkzRWCl2Xs Q3VtS3lO2b l4F1LYT3dAzF 9zbREMTnar8 Vimk7A9DVpHn eBIYRoM8wyF WKDFOk6lDGUg ZhS0RWfpesLP SFLtMMMUmo5 UFBRhLCWsz3 CMBszzy19ZUB 8r16iAGFtK 3XDKE5XrW9T 9nnjsDecwY qS7EZHObEr j3sJKhUJOgL NUZV815ynk cJRG9evpYUH 4h4XepAO2YYA a8I0qQRzKVEZ yCvbd84cGz kn0zpLXrPUML DkrzZsj1XwY H9Eq4KlZrxd1 W1fhyRYzkT2 pFE2Fz2n29 DNtPdC4kh1 z7ZDYUyHcg9K 5L611AQEzVg7 vfKPd8cEvgVz sp0cVljE6qzs UiPLbzQELx NrXOXxp1BPaD BGj7VNeUrN wfeBP651gO ARGC9nxMdn zP6dcwhzeP Rd8Uo9Ak2WdK 22zi0dx99F sJyG6Wm7Eigz f4NJFH0UWbH MKpCu7oUJBR BWtK1Py1pb9h uofQWOEDQsj2 0L3M5AVf2dTO MTyrpKVivbP JXWxuWD0L35 8ZSyQBJUW0R fiqbEnNeewd gmAJFkm6zT 7SH8gAQ2hL RR88pdZhcFZE aq99gtAKDV 42w7OotxOv 7mPAb9mSsh8o OBjbkVK9HTEe tu5UNZxB4T4 JZdD8N1kz9 zvQLdyePU1q IfJfec24Ky R2LnxN3KO9 xJd2sqpghp BISqY8NwaQ7 qGeymGrIkFC zMhVGYIJwk L45ZEhgIB2yD fdjt15djtq qdibPQw8W2 sSKshZRB5o9 Ce5p9Oxa52 X2XdNL9JlQ 3eE6cqbrUrt muy34KUKJ1 9nMuF77WGnl gVarIqwPsYCu yompJmX1nyT fm9zTGKUKV eggC4YS1ePQO FXWmXUZc1i2 aSyMnik4PcIj TgrUthrUxG4c 92fvJPr0TIRl 1dW8zKt1j0 T0B7FncxhTf zFlKazWYPKp d2KuPl354cc nYbZQbOJ54 j83uoSDRZ1Sj 0f8mwD9B29 dj33diJsdlIu yM9NhlaoCm qbu9tzRcCSEE Lk36o5Y369p2 ZR5cDENBXKa FhqEhJkLl4 w6ARcxPfSktK iYDhjcHJ38 jo46rgD20DGW zoEFxWy5r7 NYOs1Ro6q1 IFPDI84N5D61 jYn0wX0HKy krzaUPVPRwY Q24T5d3BiZ HrPc9rJiLJE7 0EI2CQSCN6 DeJB5HF42V etTf4OijMqKR SSUfRGDI1t3c zo0RKkdwvN ZN8RHAVFmzTZ IZvWgqpsUca EHts8hTBUhN4 UstVpxUlG2dv Oj53MEAJcc2 5hfvgfd5gpF sAdlBFWyMMg JWS97UbffM SbyEx2tzqBSW pQDxhxCHlt PAwIgouH3cm EcGMzqQ8RIyM 9UZTTlGdNRM AU2Xy8I2IV9U d2JTNBuY9w 5vN3dcAWEBg 1Ovyrl46pES 7I0MNbux3e 8dfMey9TKnUD miVF4f0dTMbV 1RGgyyRf3w QlCqzUMoQmJ7 06KzOUhQSG5 8lcidthlQuT FGA6woncmDn m2Zj3nEMdJBT nl4TqWBesJ 5UhglDPLAHwq Y50ltlPxdFm tWm3WaUO1px EINPBbq7qeF3 MUqcscuixU25 tArJEgFCnH id1yF88EKd 1mHUxuALV3 eVx4qc5XPU3o BWQpZUo19Ph 6XDyWmKKuc OUDJGh6lc1z DEv1CSRUxSDI R19VeBx4h30 U6gdY0zyGm YE2CuNXCgwHe IqeVcn1vJVO PKUCq2B9s5gb KmHGwVdV7c Si7F7k4vmb vlpaU8pnA88F eVZrO6XIpgr sfnhtsTKB7q o7PMLLZJKcM N8HTbgg8flru WMCySgJjarf Qp6WcklSlp8n tEmQqbOVE9 F3AJd95qPC b7PCquRbnnIu 3f5HVNyvEu G3DHJQrJpQXC lXM0sXFBp8hp 8ggQ7gPbdEel rLxmfdW5Tv 3nbdNvuAVq 92DseYWv8rz dib5oXQ970 cPFCMR1ICc 8SFR38Xhrs4R oFAp2Z2rPI 7qDWrcSuuydh tyblpNQYXrD URTO1dZwn3j 3bwbmd2gm6G Nw6JR8pr3v P3dg400ARyg XDlQa1lHh94J bDY6cJaXwN Kk6QJzErkoNa dI5fz0c3rMmj MnltFDANVIcz 8PqONprbv9 4MnjMRKhDEY 7w2WwI1aDnJ LOWxOTmLGr 6l7EQz1ZRZ 4hd9PIo2sRID keoOnoN6OeJG Q3XvhuF4NM uzR0Xb95dzn xIsL8vbfEAfR sbSSTZCVWX1X MaiCUbnwTS hO65Gx2ibvB0 MdeLejYf8an KaNNjvCxAslG mVfbjxX91cXR kXsl6ekML4Zh eeac11ue4T7 PmfY7pNpUE9 YnUV7IMgiZ8 wpe6XvW1gxo vGHdKHYTh33 wfNDtHnYxUr q0XAxxZqfe4 PiGXqn36K86 0hYwwpVRBfm Ev3RRqiyrN b0JJQupO5b ZS1oQ4vALJQ zow3HxogPoH Ytr1K3opbX NFmN26PEyu tdm2YqUaNtD CnQ6eykx81 iV4Rl7xKnoP v1tYAq5h8ez kl8v8pcIGw90 00C4kq7YcF c6h1Fqdsmp TsbCnXSDWM Km9M7ZKnfNQx ksNZ4731L1xZ B6cwsMA2nT N754Q0eAar zV3btzrG1ZXB Bw6w6oDRJM Ghm9mI5etlng ifLW7T0f1vv4 OG9nF3lDLDV vrRTEyTaUN OnEWONlA5w qbAU8Q28rV7t vAAw1t4mId kuFSNHlRayCE wU4Tw28OGS Bwx70XhX972 YQ8hKU8wIN9O qygHCDzUy5 zt65tVN0SqA pZZCYjVJoH swjQk00RUYJ UNlpUQqh2d0 4RXxnDcMuW7 askYCXWSkz */}", "function MathUtils() {}", "signJwt() {\n throw new Error(\"Method not implemented.\");\n }" ]
[ "0.6921879", "0.5519261", "0.5273343", "0.5235905", "0.5002861", "0.49848893", "0.49768186", "0.49768186", "0.49768186", "0.49768186", "0.49768186", "0.49661732", "0.49661732", "0.49416947", "0.49241596", "0.4885842", "0.4877517", "0.48555717", "0.48481706", "0.48448783", "0.48325235", "0.47713992", "0.47687992", "0.47674608", "0.47638685", "0.4762276", "0.47505882", "0.47454748", "0.47397792", "0.4726299", "0.47023627", "0.4687264", "0.4687264", "0.4677422", "0.4667161", "0.46557525", "0.46541604", "0.46493098", "0.46439806", "0.4641216", "0.46299094", "0.46299094", "0.4625992", "0.4606244", "0.4583147", "0.45795223", "0.45759848", "0.45718935", "0.4569384", "0.45684552", "0.45633447", "0.4563187", "0.45384464", "0.45325065", "0.45325065", "0.45299336", "0.45276442", "0.45270768", "0.4524548", "0.45237938", "0.45237938", "0.45237938", "0.45237938", "0.45237938", "0.45237938", "0.45069313", "0.4506414", "0.45056", "0.4504668", "0.44983366", "0.44969502", "0.44906327", "0.4474174", "0.44693032", "0.44680974", "0.44675532", "0.4461486", "0.4459578", "0.44580755", "0.4455422", "0.44513223", "0.4451277", "0.44502455", "0.44383898", "0.4433782", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44333357", "0.44324577", "0.44265175", "0.44264638", "0.44258675", "0.44216526" ]
0.0
-1
Discovery for discovering API endpoints
constructor(options) { this.transporter = new google_auth_library_1.DefaultTransporter(); this.options = options || {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async discoverAllAPIs(discoveryUrl) {\n const headers = this.options.includePrivate\n ? {}\n : { 'X-User-Ip': '0.0.0.0' };\n const res = await this.transporter.request({\n url: discoveryUrl,\n headers,\n });\n const items = res.data.items;\n const apis = await Promise.all(items.map(async (api) => {\n const endpointCreator = await this.discoverAPI(api.discoveryRestUrl);\n return { api, endpointCreator };\n }));\n const versionIndex = {};\n // tslint:disable-next-line no-any\n const apisIndex = {};\n for (const set of apis) {\n if (!apisIndex[set.api.name]) {\n versionIndex[set.api.name] = {};\n apisIndex[set.api.name] = (options) => {\n const type = typeof options;\n let version;\n if (type === 'string') {\n version = options;\n options = {};\n }\n else if (type === 'object') {\n version = options.version;\n delete options.version;\n }\n else {\n throw new Error('Argument error: Accepts only string or object');\n }\n try {\n const ep = \n // tslint:disable-next-line: no-any\n set.endpointCreator(options, this);\n return Object.freeze(ep); // create new & freeze\n }\n catch (e) {\n throw new Error(util.format('Unable to load endpoint %s(\"%s\"): %s', set.api.name, version, e.message));\n }\n };\n }\n versionIndex[set.api.name][set.api.version] = set.endpointCreator;\n }\n return apisIndex;\n }", "async discoverAPI(apiDiscoveryUrl) {\n if (typeof apiDiscoveryUrl === 'string') {\n const parts = url.parse(apiDiscoveryUrl);\n if (apiDiscoveryUrl && !parts.protocol) {\n this.log('Reading from file ' + apiDiscoveryUrl);\n const file = await readFile(apiDiscoveryUrl, { encoding: 'utf8' });\n return this.makeEndpoint(JSON.parse(file));\n }\n else {\n this.log('Requesting ' + apiDiscoveryUrl);\n const res = await this.transporter.request({\n url: apiDiscoveryUrl,\n });\n return this.makeEndpoint(res.data);\n }\n }\n else {\n const options = apiDiscoveryUrl;\n this.log('Requesting ' + options.url);\n const url = options.url;\n delete options.url;\n const parameters = {\n options: { url, method: 'GET' },\n requiredParams: [],\n pathParams: [],\n params: options,\n context: { google: { _options: {} }, _options: {} },\n };\n const res = await apirequest_1.createAPIRequest(parameters);\n return this.makeEndpoint(res.data);\n }\n }", "async discoverAPI(apiPath, options = {}) {\n const endpointCreator = await this._discovery.discoverAPI(apiPath);\n const ep = endpointCreator(options, this);\n ep.google = this; // for drive.google.transporter\n return Object.freeze(ep);\n }", "async function alexaDiscoveryEndpoints(requestToken){\n\tconst domoticzConnector = getDomoticzFromToken(requestToken);\n\tconst devices = await domoticzConnector.getAllDevices();\n\tconst mappedDevices = alexaMapper.fromDomoticzDevices(devices);\n\treturn alexaMapper.handleDiscovery(mappedDevices);\n}", "function discoverEndpoint(request, done) {\n var service = request.service || {};\n if (hasCustomEndpoint(service) || request.isPresigned()) return done();\n\n var operations = service.api.operations || {};\n var operationModel = operations[request.operation];\n var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';\n var isEnabled = resolveEndpointDiscoveryConfig(request);\n var hasRequiredEndpointDiscovery = service.api.hasRequiredEndpointDiscovery;\n if (isEnabled || hasRequiredEndpointDiscovery) {\n // Once a customer enables endpoint discovery, the SDK should start appending\n // the string endpoint-discovery to the user-agent on all requests.\n request.httpRequest.appendToUserAgent('endpoint-discovery');\n }\n switch (isEndpointDiscoveryRequired) {\n case 'OPTIONAL':\n if (isEnabled || hasRequiredEndpointDiscovery) {\n // For a given service; if at least one operation requires endpoint discovery then the SDK must enable endpoint discovery\n // by default for all operations of that service, including operations where endpoint discovery is optional.\n optionalDiscoverEndpoint(request);\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n }\n done();\n break;\n case 'REQUIRED':\n if (isEnabled === false) {\n // For a given operation; if endpoint discovery is required and it has been disabled on the SDK client,\n // then the SDK must return a clear and actionable exception.\n request.response.error = util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'Endpoint Discovery is disabled but ' + service.api.className + '.' + request.operation +\n '() requires it. Please check your configurations.'\n });\n done();\n break;\n }\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n requiredDiscoverEndpoint(request, done);\n break;\n case 'NULL':\n default:\n done();\n break;\n }\n}", "function discoverEndpoint(request, done) {\n var service = request.service || {};\n if (hasCustomEndpoint(service) || request.isPresigned()) return done();\n\n if (!isEndpointDiscoveryApplicable(request)) return done();\n\n request.httpRequest.appendToUserAgent('endpoint-discovery');\n\n var operations = service.api.operations || {};\n var operationModel = operations[request.operation];\n var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';\n switch (isEndpointDiscoveryRequired) {\n case 'OPTIONAL':\n optionalDiscoverEndpoint(request);\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n done();\n break;\n case 'REQUIRED':\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n requiredDiscoverEndpoint(request, done);\n break;\n case 'NULL':\n default:\n done();\n break;\n }\n}", "function ApiProvider() {\n\t\tthis.endpoints = {};\n\t}", "function discover(resource) {\n for (var key in resource) {\n if (resource[key].spec && resource[key].spec.method && allowedMethods.indexOf(resource[key].spec.method.toLowerCase())>-1) {\n addMethod(appHandler, resource[key].action, resource[key].spec); } \n else {\n console.log('auto discover failed for: ' + key); }\n }\n}", "debugEndpointProvider() {\n console.log(this.epProvider.getEndPointByName('allData'));\n console.log(this.epProvider.buildEndPointWithQueryStringFromObject({\n limit: 10,\n sort: 'title',\n page: 1,\n filter: 'marketing-automation,ad-network',\n direction: 1,\n }, '/fetch-all'));\n }", "function _api (endpoint, callback) {\r\n endpoint = endpoint.replace(/^\\/+/, '').replace(/\\/+$/, '');\r\n _get(_default_host + endpoint, callback);\r\n }", "function ApiServiceRegistry() {\n\t }", "function API(){}", "function API(){}", "function optionalDiscoverEndpoint(request) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var endpoints = AWS.endpointCache.get(cacheKey);\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //or endpoint operation just failed in 1 minute\n return;\n } else if (endpoints && endpoints.length > 0) {\n //found endpoint record from cache\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n } else {\n //endpoint record not in cache or outdated. make discovery operation\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n addApiVersionHeader(endpointRequest);\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1\n }]);\n endpointRequest.send(function(err, data) {\n if (data && data.Endpoints) {\n AWS.endpointCache.put(cacheKey, data.Endpoints);\n } else if (err) {\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute\n }]);\n }\n });\n }\n}", "function optionalDiscoverEndpoint(request) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var endpoints = AWS.endpointCache.get(cacheKey);\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //or endpoint operation just failed in 1 minute\n return;\n } else if (endpoints && endpoints.length > 0) {\n //found endpoint record from cache\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n } else {\n //endpoint record not in cache or outdated. make discovery operation\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n addApiVersionHeader(endpointRequest);\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1\n }]);\n endpointRequest.send(function(err, data) {\n if (data && data.Endpoints) {\n AWS.endpointCache.put(cacheKey, data.Endpoints);\n } else if (err) {\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute\n }]);\n }\n });\n }\n}", "getEndpoints(options) {\n\n let _this = this,\n allEndpoints = [],\n foundEndpoints = [];\n\n // Get all functions\n for (let i = 0; i < Object.keys(_this.project.components).length; i++) {\n let component = _this.project.components[Object.keys(_this.project.components)[i]];\n if (!component.modules) continue;\n for (let j = 0; j < Object.keys(component.modules).length; j++) {\n let module = component.modules[Object.keys(component.modules)[j]];\n if (!module.functions) continue;\n for (let k = 0; k < Object.keys(module.functions).length; k++) {\n let func = module.functions[Object.keys(module.functions)[k]];\n for (let l = 0; l < func.endpoints.length; l++) {\n allEndpoints.push(func.endpoints[l]);\n }\n }\n }\n }\n\n // Return if no options specified\n if (!options) return allEndpoints;\n if (options && Object.keys(options).length === 1 && options.returnPaths === true) return allEndpoints.map(function(d) { return d._config.sPath });\n\n // If options specified, loop through functions and find the ones specified\n for (let i = 0; i < allEndpoints.length; i++) {\n let endpoint = allEndpoints[i];\n\n if (options.component && options.module && options.function && options.endpointPath && options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function && endpoint.path == options.endpointPath && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.function && options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function && endpoint.path == options.endpointPath) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.function && options.endpointMethod && !options.endpointPath) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.function && !options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.endpointMethod && !options.function && !options.endpointPath) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && !options.function && !options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.endpointMethod && !options.module && !options.function && !options.endpointPath) {\n if (endpoint._config.component == options.component && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && !options.module && !options.function && !options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.paths && options.paths.indexOf(endpoint._config.sPath) !== -1) {\n foundEndpoints.push(endpoint);\n continue;\n }\n }\n\n return foundEndpoints;\n }", "async loadApi(api){\n if(!gapi.client) throw \"Must call load first\";\n\n const doc = this.getDiscoveryDoc(api);\n return gapi.client.load(doc);\n }", "initRoutes() {\n this.app.get(\n `${this.apiBasePath}/person/:personId/appearances`,\n (req, res, next) => {\n personController.getAppearances(req, res, next);\n },\n );\n\n this.app.get(\n `${this.apiBasePath}/person/:personId/movies`,\n (req, res, next) => {\n personController.getMovieAppearances(req, res, next);\n },\n );\n\n this.app.get(\n `${this.apiBasePath}/person/:personId/tv`,\n (req, res, next) => {\n personController.getTvAppearances(req, res, next);\n },\n );\n }", "static apiRoute() {\n return 'api'\n }", "registerApi(api) {\n Object.entries(api.services).forEach(([service, serviceValue]) => {\n Object.entries(serviceValue.methods).forEach(([method, methodValue]) => {\n this.register({\n id : `${service}.${method}`,\n method,\n service,\n type: methodValue.type || serviceValue.type || api.type || 'ajax',\n url : methodValue.url || serviceValue.url || api.url\n })\n })\n })\n }", "function applicationsTests({ apiGET, apiPOST }) {}", "getEndpoints() {\n return JSON.parse(JSON.stringify(_apiEndpoints));\n }", "printServicesInfo() {\n let endPoints = listEndpoints(this.app);\n logger.debug(\"Endpoints are : \", endPoints);\n }", "endpointsInfo() {\n\n let endpointNameString = '';\n if (this.apiName != null) {\n endpointNameString = ' for ' + this.apiName;\n }\n\n console.log('\\n==== ENDPOINTS BEGIN' + endpointNameString + ' >>>>');\n console.log(this.endpoints);\n console.log('<<<< ENDPOINTS END' + endpointNameString + ' ====\\n');\n\n }", "get endpoints() {\n return this.getListAttribute('endpoints');\n }", "function createApiEndpoint(requestor, endpoint) {\n var isCollection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n var _get = function _get() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return requestor.makeRequest('get', '/' + endpoint, params);\n };\n var _post = function _post(data) {\n return requestor.makeRequest('post', '/' + endpoint, data);\n };\n\n /**\n *\n * @param {*} params\n */\n var apiEndpoint = function apiEndpoint() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n // calling endpoint() is equivalent to endpoint.all()\n return _get(params);\n };\n\n if (isCollection) {\n apiEndpoint.all = _get;\n apiEndpoint.create = _post;\n apiEndpoint.find = function (id) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return requestor.makeRequest('get', '/' + endpoint + '/' + id, params);\n };\n apiEndpoint.update = function (id, data) {\n return requestor.makeRequest('put', '/' + endpoint + '/' + id, data);\n };\n apiEndpoint.delete = apiEndpoint.remove = function (id) {\n return requestor.makeRequest('delete', '/' + endpoint + '/' + id);\n };\n apiEndpoint.one = function (key) {\n return requestor.endpoint(endpoint + '/' + key, endpoint + '_' + key, false);\n };\n } else {\n apiEndpoint.get = _get;\n apiEndpoint.post = _post;\n apiEndpoint.put = function (data) {\n return requestor.makeRequest('put', '/' + endpoint, data);\n };\n apiEndpoint.delete = function () {\n return requestor.makeRequest('delete', '/' + endpoint);\n };\n }\n\n // Wrap the endpoint with a proxy to handle undefined property as another api endpoint\n // undefined property on collection endpoint return entity endpoint\n // and collection endpoint on entity endpoint\n var apiEndpointProxy = new Proxy(apiEndpoint, {\n get: function get(apiEndpoint, prop) {\n if (prop in apiEndpoint) {\n return apiEndpoint[prop];\n }\n\n return requestor.endpoint(endpoint + '/' + prop, endpoint + '_' + prop, !isCollection);\n }\n });\n\n return apiEndpointProxy;\n}", "function requiredDiscoverEndpoint(request, done) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var cacheKeyStr = AWS.EndpointCache.getKeyString(cacheKey);\n var endpoints = AWS.endpointCache.get(cacheKeyStr); //endpoint cache also accepts string keys\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //push request object to a pending queue\n if (!requestQueue[cacheKeyStr]) requestQueue[cacheKeyStr] = [];\n requestQueue[cacheKeyStr].push({request: request, callback: done});\n return;\n } else if (endpoints && endpoints.length > 0) {\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n done();\n } else {\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n addApiVersionHeader(endpointRequest);\n\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKeyStr, [{\n Address: '',\n CachePeriodInMinutes: 60 //long-live cache\n }]);\n endpointRequest.send(function(err, data) {\n if (err) {\n var errorParams = {\n code: 'EndpointDiscoveryException',\n message: 'Request cannot be fulfilled without specifying an endpoint',\n retryable: false\n };\n request.response.error = util.error(err, errorParams);\n AWS.endpointCache.remove(cacheKey);\n\n //fail all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.response.error = util.error(err, errorParams);\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n } else if (data) {\n AWS.endpointCache.put(cacheKeyStr, data.Endpoints);\n request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n\n //update the endpoint for all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n }\n done();\n });\n }\n}", "discover(thing_name) {\n return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {\n this.connection_manager.acquire()\n .then((connection) => {\n const request = new aws_crt_1.http.HttpRequest('GET', `/greengrass/discover/thing/${thing_name}`, new aws_crt_1.http.HttpHeaders([['host', this.endpoint]]));\n const stream = connection.request(request);\n let response = '';\n const decoder = new util_1.TextDecoder('utf8');\n stream.on('response', (status_code, headers) => {\n if (status_code != 200) {\n reject(new DiscoveryError(`Discovery failed (headers: ${headers})`, status_code));\n }\n });\n stream.on('data', (body_data) => {\n response += decoder.decode(body_data);\n });\n stream.on('end', () => {\n const json = JSON.parse(response);\n const discover_response = model.DiscoverResponse.from_json(json);\n resolve(discover_response);\n });\n stream.on('error', (error) => {\n reject(new DiscoveryError(error.toString()));\n });\n stream.activate();\n })\n .catch((reason) => {\n reject(new aws_crt_1.CrtError(reason));\n });\n }));\n }", "function callbackGetGenericApi(req, res) {\n var apiConfig=\n (req.method==\"GET\")?getConfig\n :(req.method==\"POST\")?postConfig:[];\n /* check first if services is not loaded */\n if (apiConfig.length==0)\n return res.json({statusCode: 404, message: \"Missing API configuration\", Data: []});\n\n ///api/:type/:path?\n /* decouple request api */\n var request = {\n type:req.params.type,\n t_type:req.params.type+\".\"+req.method,\n header:req.headers||{},\n body:req.body,\n path:req.params.path||\"\",\n query:req.query||{}\n };\n\n requestApi(apiConfig,request,function(d) {\n return res.json(d);\n })\n }", "endpoint() {\n //\n }", "function showEndpoint(response){\n}", "function getAPIEndPoints(key) {\n const API_URL = \"https://5dc588200bbd050014fb8ae1.mockapi.io\";\n\n const API_ENDPONTS = {\n GETUSERS: \"/assessment\"\n };\n return API_URL + API_ENDPONTS[key];\n}", "getList() { return this.api(); }", "async function loadEndpoints()\n{\n let result = [];\n\n const { db, sessionId } = this.global;\n\n const endpoints = await queryEndpoint.selectAllEndpoints(db, sessionId);\n\n // Selection is one by one since existing API does not seem to provide\n // linkage between cluster and what endpoint it belongs to.\n //\n // TODO: there should be a better way\n for (const endpoint of endpoints) {\n const endpointClusters\n = await queryEndpointType.selectAllClustersDetailsFromEndpointTypes(db, [ { endpointTypeId : endpoint.endpointTypeRef } ]);\n result.push({...endpoint, clusters : endpointClusters.filter(c => c.enabled == 1) });\n }\n\n return result;\n}", "function getEndpoints() {\n fetch(\"/api/endpoints\")\n .then(function (resp) {\n return resp.json();\n })\n .then(function (endpoints) {\n for (const zone of Object.values(endpoints)) {\n const gcpZone = {\n key: zone.Region,\n label: zone.RegionName,\n pingUrl: zone.URL + \"/api/ping\",\n latencies: [],\n median: \"\",\n };\n\n regions[gcpZone.key] = gcpZone;\n }\n\n // once we're done fetching all endpoints, let's start pinging\n pingAllRegions(INITIAL_ITERATIONS);\n });\n}", "function getUserEndpoints() {\n return function (req, res) {\n res.send({\n GetUserByID: \"/users/id/:userid\",\n GetUserCourses: \"/users/id/:userid/courses\",\n GetAllUsers: \"/users/all\",\n GetAllUsersByUni: \"/users/all/:university\",\n });\n };\n}", "registerAPI (apiObj) {\n for (let name of Object.keys(apiObj)) {\n if (apiObj.hasOwnProperty(name))\n this.register(name, apiObj[name]);\n }\n }", "function handleDiscovery(event, context) {\n var devicetype = 'Insteon';\n\n var headers = {\n messageID: event.header.messageId,\n namespace: event.header.namespace,\n name: event.header.name.replace(\"Request\",\"Response\"),\n payloadVersion: '2'\n };\n\n var appliances = [];\n\n getHSDevices(devicetype,function(devices){\n\n // Loop through the devices and populate applicances\n for(var i=0;i<devices.length;i++){\n var device = devices[i];\n \n var devactions = [\"turnOn\", \"turnOff\"];\n \n if (device.dimmable) {\n devactions.push(\"setPercentage\",\"incrementPercentage\",\"decrementPercentage\");\n }\n \n var applianceDiscovered = {\n actions: devactions,\n additionalApplianceDetails: {},\n applianceId: device.id,\n manufacturerName: devicetype,\n modelName: device.type,\n version: \"1\",\n friendlyName: device.name,\n friendlyDescription: device.name+\" located in \"+device.room,\n isReachable: true\n };\n appliances.push(applianceDiscovered);\n }\n\n appliances.sort(function(a, b) {\n return a.friendlyName.localeCompare(b.friendlyName);\n });\n var payloads = {\n discoveredAppliances: appliances\n };\n var result = {\n header: headers,\n payload: payloads\n };\n\n // Warning! Logging this in production might be a security problem.\n log('Discovery', JSON.stringify(result));\n\n context.succeed(result);\n });\n}", "function api(aPathParam, aQueryParam) {\n return new Promise((resolve) => {\n // Use superagent\n // FIXME - where do we get the hostname from?\n const response = {\n todos: [\n {\n text: 'Use Redux',\n completed: false,\n },\n {\n text: 'Use Saga',\n completed: false,\n },\n ],\n };\n resolve(response);\n });\n}", "function init() {\n log.trace(module, init);\n const dir = `${SERVER_ROOT}/api/routes`;\n // Find all Javascript files in dir.\n util.walk(dir, (filePath) => {\n filePath = path.posix.normalize(filePath.replace(/\\\\/g, '/'));\n if (path.extname(filePath) == '.js') {\n const relPath = filePath.replace(dir, '');\n // Try to load the module\n var epModule = require(filePath);\n // Check for REL, METHOD and CALLBACK.\n if (util.isNullOrUndefined(epModule.REL) ||\n util.isNullOrUndefined(epModule.METHOD) ||\n util.isNullOrUndefined(epModule.INPUTS) ||\n util.isNullOrUndefined(epModule.CALLBACK)) {\n // Not a valid module - log and skip.\n return log.warn(`Javascript source file ${filePath} does not define an endpoint`);\n }\n // Compute the endpoint path from the filePath. If the module is called 'index.js',\n // strip the filename from the path.\n var epPath = relPath.replace('.js', '');\n if (path.basename(epPath) == 'index') {\n epPath = path.dirname(epPath);\n }\n // Append the endpoint to the table.\n log.info(`Adding endpoint ${epModule.REL}=${epPath}`);\n module.exports.endpoints.push({\n 'rel': epModule.REL,\n 'href': epPath,\n 'method': epModule.METHOD,\n 'inputs': epModule.INPUTS,\n 'callback': epModule.CALLBACK\n });\n }\n });\n}", "function Swagger(remotes, options, models) {\n // Unfold options.\n var _options = options || {};\n var name = _options.name || 'swagger';\n var version = _options.version;\n var basePath = _options.basePath;\n\n // We need a temporary REST adapter to discover our available routes.\n var adapter = remotes.handler('rest').adapter;\n var routes = adapter.allRoutes();\n var classes = remotes.classes();\n\n var extension = {};\n var helper = Remoting.extend(extension);\n\n var apiDocs = {};\n var resourceDoc = {\n apiVersion: version,\n swaggerVersion: '1.1',\n basePath: basePath,\n apis: []\n };\n\n classes.forEach(function (item) {\n resourceDoc.apis.push({\n path: '/' + name + '/' + item.name,\n description: item.ctor.sharedCtor && item.ctor.sharedCtor.description\n });\n\n apiDocs[item.name] = {\n apiVersion: resourceDoc.apiVersion,\n swaggerVersion: resourceDoc.swaggerVersion,\n basePath: resourceDoc.basePath,\n apis: [],\n models: models\n };\n\n helper.method(api, {\n path: item.name,\n returns: { type: 'object', root: true }\n });\n function api(callback) {\n callback(null, apiDocs[item.name]);\n }\n addDynamicBasePathGetter(remotes, name + '.' + item.name, apiDocs[item.name]);\n });\n\n routes.forEach(function (route) {\n var split = route.method.split('.');\n var doc = apiDocs[split[0]];\n var classDef;\n\n if (!doc) {\n console.error('Route exists with no class: %j', route);\n return;\n }\n\n classDef = classes.filter(function (item) {\n return item.name === split[0];\n })[0];\n\n if (classDef && classDef.sharedCtor && classDef.sharedCtor.accepts && split.length > 2 /* HACK */) {\n route.accepts = (route.accepts || []).concat(classDef.sharedCtor.accepts);\n }\n\n doc.apis.push(routeToAPI(route));\n });\n\n /**\n * The topmost Swagger resource is a description of all (non-Swagger) resources\n * available on the system, and where to find more information about them.\n */\n helper.method(resources, {\n returns: [{ type: 'object', root: true }]\n });\n function resources(callback) {\n callback(null, resourceDoc);\n }\n addDynamicBasePathGetter(remotes, name + '.resources', resourceDoc);\n\n remotes.exports[name] = extension;\n return extension;\n}", "getMe(id, announce) {\n let descriptor = {\n type: 'DiscoveryService',\n healthCheckRoute: '/health',\n schemaRoute: '/swagger.json',\n docsPath: announce.docsPath,\n timestamp: new Date(),\n id: id,\n region: announce.region,\n stage: announce.stage,\n status: 'Online',\n version: announce.version\n };\n\n let p = new Promise((resolve, reject) => {\n let ip = require('ip');\n debug(`IP is ${ip.address()}`);\n descriptor.endpoint = \"http://\"+ip.address()+\":\"+config.port\n resolve(descriptor);\n });\n return p;\n }", "function RestedAPI(options) {\n var $instance = this;\n var $static = $instance && $instance.constructor || RestedAPI;\n\n $static.options(options);\n\n return $static.routes();\n }", "function api (req, res, ctx) {\n return router(match(req.url), req, res, ctx)\n}", "function getPublicApi() {\n return {\n\n };\n }", "list(extraParams = {}) {\n const { root, ...params } = extraParams\n\n if (extraParams.hasOwnProperty('root') && root) {\n params.apiEndpoint = `${this.apiEndpoint}/${root}`\n }\n\n return super.list(params)\n }", "getAll() {\n let urlFull = this.controler;\n return BaseAPIConfig.get(urlFull);\n }", "function convertSwagger(source){\n var apiInfo = clone(source,false);\n apiInfo.resources = {};\n\n\tif (apiInfo.servers && apiInfo.servers.length) {\n\t\tvar u = url.parse(apiInfo.servers[0].url);\n\t\tapiInfo.host = u.host;\n\t\tapiInfo.basePath = u.path;\n\t\tapiInfo.schemes = [];\n\t\tapiInfo.schemes.push(u.protocol.replace(':',''));\n\t}\n\n for (var p in apiInfo.paths) {\n for (var m in apiInfo.paths[p]) {\n if ('.get.post.put.delete.head.patch.options.trace.'.indexOf(m)>=0) {\n var sMethod = apiInfo.paths[p][m];\n var ioMethod = {};\n ioMethod.httpMethod = m.toUpperCase();\n var sMethodUniqueName = sMethod.operationId ? sMethod.operationId : m+'_'+p.split('/').join('_');\n sMethodUniqueName = sMethodUniqueName.split(' ').join('_'); // TODO {, } and : ?\n ioMethod.name = sMethodUniqueName;\n ioMethod.summary = sMethod.summary;\n ioMethod.description = sMethod.description;\n ioMethod.parameters = {};\n var sParams = sMethod.parameters ? sMethod.parameters : [];\n if (apiInfo.paths[p].parameters) {\n sParams = sParams.concat(apiInfo.paths[p].parameters);\n }\n for (var p2 in sParams) {\n var param = sParams[p2];\n var ptr = param[\"$ref\"];\n if (ptr && ptr.startsWith('#/parameters/')) {\n ptr = ptr.replace('#/parameters/','');\n param = clone(apiInfo.parameters[ptr],false);\n }\n if (ptr && ptr.startsWith('#/components/parameters/')) {\n ptr = ptr.replace('#/components/parameters/','');\n param = clone(apiInfo.components.parameters[ptr],false);\n }\n param.location = param[\"in\"];\n delete param[\"in\"];\n\t\t\t\t\tif (!param.type && param.schema && param.schema.type) {\n\t\t\t\t\t\tparam.type = param.schema.type;\n\t\t\t\t\t}\n ioMethod.parameters[param.name] = param;\n }\n ioMethod.path = p;\n ioMethod.responses = sMethod.responses;\n var tagName = 'Default';\n if (sMethod.tags && sMethod.tags.length>0) {\n tagName = sMethod.tags[0];\n }\n if (!apiInfo.resources[tagName]) {\n apiInfo.resources[tagName] = {};\n if (apiInfo.tags) {\n for (var t in apiInfo.tags) {\n var tag = apiInfo.tags[t];\n if (tag.name == tagName) {\n apiInfo.resources[tagName].description = tag.description;\n apiInfo.resources[tagName].externalDocs = tag.externalDocs;\n }\n }\n }\n }\n if (!apiInfo.resources[tagName].methods) apiInfo.resources[tagName].methods = {};\n apiInfo.resources[tagName].methods[sMethodUniqueName] = ioMethod;\n }\n }\n }\n delete apiInfo.paths; // to keep size down\n if (apiInfo.definitions) rename(apiInfo,'definitions','schemas');\n if (apiInfo.components && apiInfo.components.schemas) rename(apiInfo,'components.schemas','schemas');\n return apiInfo;\n}", "async function downloadDiscoveryDocs(options) {\n await exports.gfs.mkdir(options.downloadPath);\n const headers = options.includePrivate\n ? {}\n : { 'X-User-Ip': '0.0.0.0' };\n console.log(`sending request to ${options.discoveryUrl}`);\n const res = await gaxios_1.request({ url: options.discoveryUrl, headers });\n const apis = res.data.items;\n const indexPath = path.join(options.downloadPath, 'index.json');\n exports.gfs.writeFile(indexPath, res.data);\n const queue = new p_queue_1.default({ concurrency: 25 });\n console.log(`Downloading ${apis.length} APIs...`);\n const changes = await queue.addAll(apis.map(api => async () => {\n console.log(`Downloading ${api.id}...`);\n const apiPath = path.join(options.downloadPath, api.id.replace(':', '-') + '.json');\n const url = api.discoveryRestUrl;\n const changeSet = { api, changes: [] };\n try {\n const res = await gaxios_1.request({ url });\n // The keys in the downloaded JSON come back in an arbitrary order from\n // request to request. Sort them before storing.\n const newDoc = sortKeys(res.data);\n let updateFile = true;\n try {\n const oldDoc = JSON.parse(await exports.gfs.readFile(apiPath));\n updateFile = shouldUpdate(newDoc, oldDoc);\n changeSet.changes = getDiffs(oldDoc, newDoc);\n }\n catch (_a) {\n // If the file doesn't exist, that's fine it's just new\n }\n if (updateFile) {\n exports.gfs.writeFile(apiPath, newDoc);\n }\n }\n catch (e) {\n console.error(`Error downloading: ${url}`);\n }\n return changeSet;\n }));\n return changes;\n}", "constructor(config) {\n this.configureApi(config);\n }", "function buildEndpoints() {\n ctrl.devices.forEach(function(device) {\n if (!endpointHasDevice(device)) {\n ctrl.endpoints.push(buildEndpoint(device))\n }\n })\n cleanEndpoints()\n }", "async get(req, res) {\n const { path } = req.params;\n\n const found = await this.configurationService.getByPath(path)\n\n if (found) {\n return res.status(200).json(found)\n }\n\n return res.status(404).json({ msg: 'Not found elements' })\n }", "function requiredDiscoverEndpoint(request, done) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var cacheKeyStr = AWS.EndpointCache.getKeyString(cacheKey);\n var endpoints = AWS.endpointCache.get(cacheKeyStr); //endpoint cache also accepts string keys\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //push request object to a pending queue\n if (!requestQueue[cacheKeyStr]) requestQueue[cacheKeyStr] = [];\n requestQueue[cacheKeyStr].push({request: request, callback: done});\n return;\n } else if (endpoints && endpoints.length > 0) {\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n done();\n } else {\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n addApiVersionHeader(endpointRequest);\n\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKeyStr, [{\n Address: '',\n CachePeriodInMinutes: 60 //long-live cache\n }]);\n endpointRequest.send(function(err, data) {\n if (err) {\n request.response.error = util.error(err, { retryable: false });\n AWS.endpointCache.remove(cacheKey);\n\n //fail all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.response.error = util.error(err, { retryable: false });\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n } else if (data) {\n AWS.endpointCache.put(cacheKeyStr, data.Endpoints);\n request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n\n //update the endpoint for all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n }\n done();\n });\n }\n}", "async connect() {\n const _alice = '//Alice';\n const _bob = '//Bob';\n const _charlie = '//Charlie';\n const _dave = '//Dave';\n if (!self.api) {\n self.api = await ApiPromise.create({\n provider: self.wsProvider,\n types: {\n Address: 'MultiAddress',\n LookupSource: 'MultiAddress',\n },\n });\n }\n if (!self.myself) {\n self.myself = self.keyring.addFromUri(_alice);\n self.alice = self.keyring.addFromUri(_alice);\n self.bob = self.keyring.addFromUri(_bob);\n self.charlie = self.keyring.addFromUri(_charlie);\n self.dave = self.keyring.addFromUri(_dave);\n }\n return self.api;\n }", "function discover(deviceId, objectType, objectId, resourceId, fullCallback) {\n var pathname,\n trueCallback;\n\n if (isPresent(objectId, resourceId, fullCallback)) {\n logger.debug(context, 'Executing a resource discover operation on resource /%s/%s/%s in device [%d]',\n objectType, objectId, resourceId, deviceId);\n\n pathname = '/' + objectType + '/' + objectId + '/' + resourceId;\n trueCallback = fullCallback;\n } else if (isPresent(objectId, resourceId)) {\n logger.debug(context, 'Executing a instance discover operation on resource /%s/%s in device [%d]',\n objectType, objectId, deviceId);\n\n pathname = '/' + objectType + '/' + objectId;\n trueCallback = resourceId;\n } else {\n logger.debug(context, 'Executing a type discover operation on resource /%s in device [%d]',\n objectType, deviceId);\n\n pathname = '/' + objectType;\n trueCallback = objectId;\n }\n\n function createReadRequest(obj, callback) {\n var request = {\n host: (config.ipProtocol === 'udp6') ? '::1' : '127.0.0.1',\n port: config.port,\n method: 'GET',\n proxyUri: 'coap://' + (config.ipProtocol === 'udp6' ?\n '[' + obj.address + ']' : obj.address) + ':' + obj.port,\n pathname: pathname,\n options: {\n 'Accept': 'application/link-format'\n }\n };\n\n callback(null, request);\n }\n\n if (!objectType && !objectId && !resourceId) {\n logger.error(context, 'Method called with wrong number of parameters. Couldn\\'t identify callback');\n } else {\n async.waterfall([\n apply(registry.get, deviceId),\n createReadRequest,\n coapUtils.sendRequest,\n coapUtils.generateProcessResponse(objectType, objectId, resourceId, '2.05')\n ], trueCallback);\n }\n}", "lookupAvailableResources() {\n const done = this.async();\n const path = this.destinationPath('resources/api');\n _fsUtils.getSubDirectoryPaths(path).then((dirList) => {\n const pathRegex = new RegExp(`${path}/?`);\n this.availableResources = dirList.map((item) => {\n return item.replace(/^[a-zA-Z]*:/,'') // Handle windows drive letter\n .replace(/\\\\/g, '/') // Handle windows path separator\n .replace(pathRegex, '/');\n });\n done();\n }).catch((ex) => {\n this.env.error('Error listing existing API resources');\n done(ex);\n });\n }", "getDataRoutes(callback) {\n return this.client.get({\n url: `${ROUTE_ENDPOINT}`,\n }, done(callback))\n }", "function handleDiscovery(event, context) {\n /**\n * Craft the final response back to Alexa Smart Home Skill. This will include all the\n * discoverd appliances.\n */\n var result = {\n event: {\n header: {\n namespace: 'Alexa.Discovery',\n name: 'Discover.Response',\n payloadVersion: '3',\n messageId: event.directive.header.messageId,\n },\n payload: {\n endpoints: [\n {\n endpointId: 'music1',\n friendlyName: 'Kodi',\n description: 'Media on Kodi',\n manufacturerName: 'Cubox-i',\n displayCategories: [],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.PowerController',\n version: '3',\n properties: {\n supported: [\n {\n name: 'powerState',\n },\n ],\n proactivelyReported: false,\n retrievable: false,\n },\n },\n {\n interface: 'Alexa.RemoteVideoPlayer',\n type: 'AlexaInterface',\n version: '1.0',\n },\n {\n interface: 'Alexa.ChannelController',\n type: 'AlexaInterface',\n version: '3',\n },\n {\n interface: 'Alexa.Launcher',\n type: 'AlexaInterface',\n version: '1.0',\n },\n {\n type: 'AlexaInterface',\n interface: 'Alexa.PlaybackController',\n version: '3',\n supportedOperations: [\n 'Next',\n 'Pause',\n 'Play',\n 'Previous',\n 'Stop',\n 'FastForward',\n 'StartOver',\n 'Rewind',\n ],\n },\n {\n type: 'AlexaInterface',\n interface: 'Alexa.Speaker',\n version: '3',\n properties: {\n supported: [\n {\n name: 'volume',\n },\n {\n name: 'muted',\n },\n ],\n },\n },\n ],\n },\n {\n endpointId: 'tv1',\n friendlyName: 'TV',\n description: \"Matt's TV\",\n manufacturerName: 'Sony',\n displayCategories: [],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.PowerController',\n version: '3',\n properties: {\n supported: [\n {\n name: 'powerState',\n },\n ],\n proactivelyReported: false,\n retrievable: false,\n },\n },\n ],\n },\n {\n endpointId: 'nexus9',\n friendlyName: 'Tablet',\n description: 'Tablet on the wall',\n manufacturerName: 'HTC',\n displayCategories: [],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.PowerController',\n version: '3',\n properties: {\n supported: [\n {\n name: 'powerState',\n },\n ],\n proactivelyReported: false,\n retrievable: false,\n },\n },\n ],\n },\n {\n endpointId: 'all1',\n friendlyName: 'everything',\n description: 'Turn lights, music and TV on or off',\n manufacturerName: 'all',\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: true,\n },\n ],\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'playstation',\n description: 'Turns on TV and AVR, switches to Playstation input',\n friendlyName: 'Playstation',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'movies',\n description: 'Turns on TV and movies',\n friendlyName: 'Movies',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'tvshows',\n description: 'Turns on TV and TV shows',\n friendlyName: 'TV Shows',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightsbright',\n description: 'Light scene',\n friendlyName: 'bright',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightsreading',\n description: 'Light scene',\n friendlyName: 'reading',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightsrelax',\n description: 'Light scene',\n friendlyName: 'relax',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightsbedtime',\n description: 'Light scene',\n friendlyName: 'bedtime',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightsred',\n description: 'Light scene',\n friendlyName: 'red',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightsminimal',\n description: 'Light scene',\n friendlyName: 'minimal',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightsparty',\n description: 'Light scene',\n friendlyName: 'party',\n manufacturerName: \"Matt's Smart Home\",\n },\n {\n displayCategories: ['ACTIVITY_TRIGGER'],\n capabilities: [\n {\n type: 'AlexaInterface',\n interface: 'Alexa.SceneController',\n version: '3',\n supportsDeactivation: false,\n },\n ],\n endpointId: 'lightssmart',\n description: 'Light scene',\n friendlyName: 'smart',\n manufacturerName: \"Matt's Smart Home\",\n },\n ],\n },\n },\n };\n log('Discovery', JSON.stringify(result));\n context.succeed(result);\n}", "loadApis(data) {\n for (var key in data.links) {\n if (data.links[key].rel !== 'self') {\n this.apis.push(data.links[key]);\n }\n }\n this.$log.debug('ApisService', 'available apis', this.apis);\n }", "constructor (api) { this.api = api }", "constructor (api) { this.api = api }", "constructor (api) { this.api = api }", "async function getEndpoint(url) {\n const headers = new Headers();\n headers.append('x-rapidapi-host', RAPID_API_HOST);\n headers.append('x-rapidapi-key', RAPID_API_KEY);\n try {\n const response = await fetch(url + ENDPOINTS.MODIFIERS, { method: 'GET', headers });\n if (response.ok) {\n const apiData = await response.json();\n return apiData;\n } else {\n return response.ok;\n }\n } catch (err) {\n console.log('fetch failed', err);\n }\n}", "function convertLiveDocs(apiInfo){\n rename(apiInfo,'title','name');\n rename(apiInfo,'prefix','publicPath');\n rename(apiInfo,'server','basePath');\n apiInfo.resources = {};\n for (var e in apiInfo.endpoints) {\n var ep = apiInfo.endpoints[e];\n var eName = ep.name ? ep.name : 'Default';\n\n if (!apiInfo.resources[eName]) apiInfo.resources[eName] = {};\n apiInfo.resources[eName].description = ep.description;\n\n for (var m in ep.methods) {\n var lMethod = ep.methods[m];\n if (!apiInfo.resources[eName].methods) apiInfo.resources[eName].methods = {};\n var mName = lMethod.MethodName ? lMethod.MethodName : 'Default';\n if (mName.endsWith('.')) mName = mName.substr(0,mName.length-1);\n mName = mName.split(' ').join('_');\n rename(lMethod,'HTTPMethod','httpMethod');\n rename(lMethod,'URI','path');\n rename(lMethod,'Synopsis','description');\n rename(lMethod,'MethodName','name');\n\n lMethod.path = fixPathParameters(lMethod.path);\n\n var params = {};\n for (var p in lMethod.parameters) {\n var lParam = lMethod.parameters[p];\n if (!lParam.type) lParam.type = 'string';\n if (lParam.type == 'json') lParam.type = 'string';\n if (!lParam.location) {\n if (lMethod.path.indexOf(':'+lParam.name)>=0) {\n lParam.location = 'path';\n }\n else {\n lParam.location = 'query';\n }\n }\n if (lParam.location == 'boddy') lParam.location = 'body'; // ;)\n params[lParam.name] = lParam;\n delete lParam.name;\n delete lParam.input; // TODO checkbox to boolean?\n delete lParam.label;\n rename(lParam,'options','enum');\n }\n lMethod.parameters = params;\n if (Object.keys(params).length==0) delete lMethod.parameters;\n\n apiInfo.resources[eName].methods[mName] = lMethod;\n }\n\n }\n delete apiInfo.endpoints; // to keep size down\n return apiInfo;\n}", "getFragmentsForSchema(apiDiscoveryUrl, schema, apiPath, tasks) {\n if (schema.methods) {\n for (const methodName in schema.methods) {\n if (schema.methods.hasOwnProperty(methodName)) {\n const methodSchema = schema.methods[methodName];\n methodSchema.sampleUrl = apiPath + '.' + methodName + '.frag.json';\n tasks.push((cb) => {\n this.logResult(apiDiscoveryUrl, `Making fragment request...`);\n this.logResult(apiDiscoveryUrl, methodSchema.sampleUrl);\n this.makeRequest({ uri: methodSchema.sampleUrl }, (err, response) => {\n if (err) {\n this.logResult(apiDiscoveryUrl, `Fragment request err: ${err}`);\n if (!err.message ||\n err.message.indexOf('AccessDenied') === -1) {\n return cb(err);\n }\n else {\n this.logResult(apiDiscoveryUrl, 'Ignoring error.');\n }\n }\n this.logResult(apiDiscoveryUrl, `Fragment request complete.`);\n if (response && response.codeFragment &&\n response.codeFragment['Node.js']) {\n let fragment = response.codeFragment['Node.js'].fragment;\n fragment = fragment.replace(/\\/\\*/gi, '/<');\n fragment = fragment.replace(/\\*\\//gi, '>/');\n fragment = fragment.replace(/`\\*/gi, '`<');\n fragment = fragment.replace(/\\*`/gi, '>`');\n const lines = fragment.split('\\n');\n lines.forEach((line, i) => {\n lines[i] = '*' + (line ? ' ' + lines[i] : '');\n });\n fragment = lines.join('\\n');\n methodSchema.fragment = fragment;\n }\n cb();\n });\n });\n }\n }\n }\n if (schema.resources) {\n for (const resourceName in schema.resources) {\n if (schema.resources.hasOwnProperty(resourceName)) {\n this.getFragmentsForSchema(apiDiscoveryUrl, schema.resources[resourceName], apiPath + '.' + resourceName, tasks);\n }\n }\n }\n }", "initGetAllEndpoint() {\n this.router.get('/', (req, res) => this.getDAO()\n .getAll({ user: req.user })\n .then(users => res.status(200).send(users))\n .catch(err => {\n debug('[getAll]', err.message);\n return this.sendErr(res, 400, err.message);\n }));\n }", "async onReady() {\n if (!this.config.ip) {\n this.log.warn('[START] No IP-address set');\n return;\n }\n this.log.info(`[START] Starting sonnen adapter`);\n this.ip = this.config.ip;\n if (this.config.pollInterval) {\n this.pollingTime = this.config.pollInterval;\n }\n this.log.debug(`[INFO] Configured polling interval: ${this.pollingTime}`);\n // all states changes inside the adapters namespace are subscribed\n this.subscribeStates('*');\n this.log.debug(`[START] Check API`);\n if (this.config.token) {\n this.log.debug('[START] Auth-Token provided... trying official API');\n this.requestOptions.headers['Auth-Token'] = this.config.token;\n try {\n await (0, axios_1.default)({ url: `http://${this.ip}/api/v2/latestdata`, ...this.requestOptions });\n this.apiVersion = 'v2';\n this.log.debug('[START] Check ok, using official API');\n return void this.main();\n }\n catch (e) {\n this.log.error(`Auth-Token provided, but could not use official API: ${e.message}`);\n }\n }\n try {\n await (0, axios_1.default)({ url: `http://${this.ip}:8080/api/v1/status`, timeout: 2000 });\n this.log.debug(`[START] 8080 API detected`);\n this.apiVersion = 'v1';\n return void this.main();\n }\n catch (e) {\n this.log.debug(`[START] It's not 8080, because ${e.message}`);\n }\n try {\n // test if both works, else use legacy, because of incomplete implementation of API\n await (0, axios_1.default)(`http://${this.ip}:7979/rest/devices/battery/M03`);\n await (0, axios_1.default)(`http://${this.ip}:7979/rest/devices/battery/M034`);\n this.apiVersion = 'old';\n this.log.debug(`[START] 7979 API detected`);\n return void this.oldAPImain();\n }\n catch (e) {\n this.log.debug(`[START] It's not 7979, because ${e.message}`);\n }\n try {\n await (0, axios_1.default)(`http://${this.ip}:3480/data_request?id=sdata&output_format=json`);\n this.apiVersion = 'legacy';\n return void this.legacyAPImain();\n }\n catch (e) {\n this.log.warn(`[START] Could not get API version... restarting in 30 seconds: ${e.message}`);\n this.restartTimer = setTimeout(this.restart, 30000);\n }\n }", "get apiEndpoint() {\n return HttpHelper.apiEndpoint;\n }", "function findEndpoints(contextId) {\n var answer = [];\n var contextFolder = Camel.getCamelContextFolder(workspace, contextId);\n if (contextFolder) {\n var endpoints = (contextFolder[\"children\"] || []).find(function (n) { return \"endpoints\" === n.title; });\n if (endpoints) {\n angular.forEach(endpoints.children, function (endpointFolder) {\n var entries = endpointFolder ? endpointFolder.entries : null;\n if (entries) {\n var endpointPath = entries[\"name\"];\n if (endpointPath) {\n var name = tidyJmxName(endpointPath);\n var link = Camel.linkToBrowseEndpointFullScreen(contextId, endpointPath);\n answer.push({\n contextId: contextId,\n path: endpointPath,\n name: name,\n tooltip: \"Endpoint\",\n link: link\n });\n }\n }\n });\n }\n }\n return answer;\n }", "function apiHandler(req, reply) {\n\n var rb = new RepresentationBuilder(settings.relsUrl);\n var resource = rb.create({}, req.url);\n\n // grab the routing table and iterate\n var routes = req.server.table();\n for (var i = 0; i < routes.length; i++) {\n var route = routes[i];\n\n // :\\\n var halConfig = route.settings.app && route.settings.app.hal;\n\n if (halConfig && halConfig.apiRel) {\n var rel = halConfig.apiRel;\n var href = routes[i].path;\n\n // grab query options\n if (halConfig.query) {\n href += halConfig.query;\n }\n\n // check if link is templated\n var link = new hal.Link(rb.resolve(rel), href);\n if (/{.*}/.test(href)) {\n link.templated = true;\n }\n\n // todo process validations for query parameters\n resource.link(link);\n }\n }\n\n // handle any curies\n rb.addCuries(resource);\n reply(resource).type('application/hal+json');\n }", "getAPIResource(opts){\n let { type, uri, id } = opts;\n if( type === 'pathways' ){\n if( uri !== null ){\n return this.getPathway( uri );\n } else {\n throw new Error('Invalid parameter. Pathways api calls require a uri parameter');\n }\n }\n if( type === 'factoids' ){\n if( id !== null ){\n return this.getFactoid(opts.id);\n } else {\n throw new Error('Invalid paramter. Factoids api calls require a id parameter');\n }\n }\n }", "async load() {\n // setup API routes\n // eslint-disable-next-line\n this.routes = express.Router({\n caseSensitive: false,\n });\n\n // user Routes\n this.routes.route('/test')\n .get((req, res) => {\n res.send({hello: 'world'});\n });\n\n // route requiring authentication\n this.routes.route('/test')\n .get(this.server.auth.middleware, (req, res) => {\n res.send({hello: req.user});\n });\n\n // register the routes to the /api prefix and version\n this.server.app.use(this.urlPrefix, this.routes);\n }", "constructor(apiName = null) {\n if (apiName != null) this.apiName = apiName;\n this.endpoints = [];\n }", "function RestApiGenerator(objection) {\n this._objection = objection;\n this._logger = _.noop;\n this._models = Object.create(null);\n this._findQueries = Object.create(null);\n this._routePrefix = '/';\n this._exclude = [];\n this._databaseGetter = null;\n this._adapter = expressAdapter;\n this._pluralizer = function (word) {\n return word + 's';\n };\n}", "function extendingEndpoints() {\n var segments = Array.prototype.slice.call(arguments, 0);\n return function () {\n var path = '';\n segments.forEach(function (pathSegment) {\n path = path + pathSegment;\n createEndpointFromPath(path);\n console.log(' registered path %s', path);\n });\n }\n}", "function startEndpointTests() {\n\tQUnit.test('GET People - endpoint - no query', function(assert) {\n\t\tvar done = assert.async();\n\t\to('People').get(function(data) {\n\t\t\tassert.ok(data.length >= 0, printResult(this,data));\n\t\t\tdone();\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n\n\tQUnit.test('GET People - endpoint - .top(1)', function(assert) {\n\t\tvar done = assert.async();\n\t\to('People').top(1).get(function(data) {\n\t\t\tassert.ok(data.length >= 0, printResult(this,data));\n\t\t\tdone();\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n\n\tQUnit.test('GET People(\\''+testEntity.UserName+'\\') - endpoint - no query', function(assert) {\n\t\tvar done = assert.async();\n\t\to('People(\\''+testEntity.UserName+'\\')').get(function(data) {\n\t\t\tassert.ok(data.UserName === testEntity.UserName, printResult(this,data));\n\t\t\tdone();\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n\n\tQUnit.test('GET People - endpoint - query: .take(5) and .skip(2)', function(assert) {\n\t\tvar done = assert.async();\n\t\to('People').take(5).skip(2).get(function(data) {\n\t\t\tassert.ok(data.length >= 0, printResult(this,data));\n\t\t\tdone();\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n\n\tQUnit.test('GET People - endpoint - query: .take(5) and .expand(\"Trips\")', function(assert) {\n\t\tvar done = assert.async();\n\t\to('People').take(5).expand('Trips').get(function(data) {\n\t\t\tassert.ok(data.length >= 0 && (data[0] && data[0].Trips), printResult(this,data));\n\t\t\tdone();\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n\n\tQUnit.test('GET People(\\''+testEntity.UserName+'\\') with q.js promise - endpoint - no query', function(assert) {\n\t\tvar done = assert.async();\n\t\to('People(\\''+testEntity.UserName+'\\')').get().then(function(o) {\n\t\t\tassert.ok(o.data.UserName === testEntity.UserName, printResult(o,o.data));\n\t\t\tdone();\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n\n\tQUnit.test('GET People(\\''+testEntity.UserName+'\\') and Group with q.js promise all - endpoint - no query', function(assert) {\n\t\tvar done = assert.async();\n\t\tQ.all([\n\t\t\to('People(\\''+testEntity.UserName+'\\')').get(),\n\t\t\to('People?$filter=UserName eq \\'Yeah\\'')\n\t\t]).then(function(o) {\n\t\t\tassert.ok(o[0].data.UserName==testEntity.UserName, printResult(o[0],o[0].data));\n\t\t\tassert.ok(o[1].data.length >=0, printResult(o[1],o[1].data));\n\t\t\tdone();\n\t\t}).fail(function(err) {\n\t\t\tassert.ok(false, printResult(this, err));\n\t\t\tdone();\n\t\t});\n\t});\n\n\tQUnit.test('GET People(\\''+testEntity.UserName+'\\') and PATCH AAA People(\\''+testEntity.UserName+'\\'), change and save() it with q.js promise - endpoint - no query', function(assert) {\n\t\tvar done1 = assert.async();\n\t\tvar done2 = assert.async();\t\n\t\tvar name='Test_'+Math.random();\n\t\t\n\t\to('People(\\''+testEntity.UserName+'\\')').get().then(function(o) {\n\t\t\to.data.FirstName=name;\n\t\t\tassert.ok(o.data.UserName===testEntity.UserName, printResult(o,o.data));\n\t\t\tdone1();\n\t\t\treturn(o.save());\n\t\t}).then(function(o) {\n\t\t\tassert.ok(o.data.UserName === testEntity.UserName && o.data.FirstName===name, printResult(o,o.data));\n\t\t\tdone2();\n\t\t}).fail(function(err) {\n\t\t\tassert.ok(false, printResult(this, err));\n\t\t\tdone1();\n\t\t\tdone2();\n\t\t});\n\t});\n\t\n\tQUnit.test('GET People(\\''+testEntity.UserName+'\\') and PATCH People(2), change and save() it with q.js promise but provoke error - endpoint - no query', function(assert) {\n\t\tvar done1 = assert.async();\n\t\tvar done2 = assert.async();\t\n\t\tvar name='Test_'+Math.random();\n\t\t\n\t\to('People(\\''+testEntity.UserName+'\\')').get().then(function(o) {\n\t\t\tassert.ok(o.data.UserName===testEntity.UserName, printResult(o,o.data));\n\t\t\to.data.Gender = 1;\n\t\t\tdone1();\n\t\t\treturn(o.save());\n\t\t}).then(function(o) {\n\t\t\t//not reachable because of error\n\t\t}).fail(function(err) {\n\t\t\tassert.ok(err, 'Passed! Error as expected.');\n\t\t\tdone2();\n\t\t});\n\t});\n\n\tQUnit.test('PATCH People(\\''+testEntity.UserName+'\\') - endpoint - no query', function(assert) {\n\t\tvar done = assert.async();\n\t\tvar name='Test_'+Math.random();\n\t\to('People(\\''+testEntity.UserName+'\\')').patch({FirstName:name}).save(function(data) {\n\t\t\tassert.ok(data.length===0, printResult(this,data));\n\t\t\tdone();\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n\n\t//DELETES the test data, move it to the end of this file!\n\tQUnit.test('DELETE Products(\\''+testEntity.UserName+'\\') - endpoint - no query', function(assert) {\n\t\tvar done = assert.async();\n\t\tvar name='Test_'+Math.random();\n\t\to('People(\\''+testEntity.UserName+'\\')').delete().save(function(data) {\n\t\t\tassert.ok(data.length===0, printResult(this,data));\n\t\t\tdone();\t\t\t\n\t\t}, function(e) { \n\t\t\tassert.ok(e === 200, printResult(this, e));\n\t\t\tdone()\n\t\t});\n\t});\n}", "function _queryNimbleApi (path, params, method, accessToken) {\n return _queryRemoteApi(constants.nimbleApiRoot, path, params, method, {\n \"Authorization\": \"Bearer \" + accessToken,\n });\n}", "function iniciarAPI() {\n\treturn new Promise((resolve, reject) => {\n\n\t\t// Servidor Restify\n\t\tvar servidor = restify.createServer()\n\t\tservidor.use(cookieParser.parse)\n\t\tservidor.use(restify.plugins.bodyParser({\n\t\t\tmapParams: true\n\t\t}))\n\t\tservidor.listen(process.env.PORT || 3978, function () {\n\t\t\tresolve(servidor)\n\t\t})\n\n\t})\n}", "function isEndpointDiscoveryApplicable(request) {\n var service = request.service || {};\n if (service.config.endpointDiscoveryEnabled === true) return true;\n\n //shared ini file is only available in Node\n //not to check env in browser\n if (util.isBrowser()) return false;\n\n for (var i = 0; i < endpointDiscoveryEnabledEnvs.length; i++) {\n var env = endpointDiscoveryEnabledEnvs[i];\n if (Object.prototype.hasOwnProperty.call(process.env, env)) {\n if (process.env[env] === '' || process.env[env] === undefined) {\n throw util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'environmental variable ' + env + ' cannot be set to nothing'\n });\n }\n if (!isFalsy(process.env[env])) return true;\n }\n }\n\n var configFile = {};\n try {\n configFile = AWS.util.iniLoader ? AWS.util.iniLoader.loadFrom({\n isConfig: true,\n filename: process.env[AWS.util.sharedConfigFileEnv]\n }) : {};\n } catch (e) {}\n var sharedFileConfig = configFile[\n process.env.AWS_PROFILE || AWS.util.defaultProfile\n ] || {};\n if (Object.prototype.hasOwnProperty.call(sharedFileConfig, 'endpoint_discovery_enabled')) {\n if (sharedFileConfig.endpoint_discovery_enabled === undefined) {\n throw util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'config file entry \\'endpoint_discovery_enabled\\' cannot be set to nothing'\n });\n }\n if (!isFalsy(sharedFileConfig.endpoint_discovery_enabled)) return true;\n }\n return false;\n}", "constructor() {\n super();\n this.name = 'serverless-plugin-swagger-endpoints';\n }", "function apis (req, res, next) {\n const headers = [\n {'header': 'X-Api-Key', 'value': app.settings.apiKey},\n {'header': 'X-Admin-Auth-Token', 'value': app.settings.adminWebToken},\n ];\n\n return app.helpers.ajax({\n url: `${app.settings.baseApi}/apis`,\n headers: headers\n })\n .then((e) => {\n res.setHeader('Content-Type', 'application/json');\n res.commit(e.responseText)\n })\n .catch((e) => {res.error(e)});\n }", "function API(router, baseurl) {\n var wildcard = require('wildcard');\n var express = require('express');\n var expressRouter = express.Router();\n\n // handle requests to manage the routesets\n var bodyParser = require('body-parser');\n var jsonParser = bodyParser.json();\n\n expressRouter.route('/')\n .get(function (req, res) {\n res.send({\n routesets: baseurl+'/routesets'\n });\n });\n\n expressRouter.route('/routesets')\n .get(function(req, res) {\n router.getRouteSets(req.query.all !== undefined)\n .then(function (routesets) {\n res.send(\n routesets.map(function (rs) {\n return {\n name: rs.name,\n routes: rs.routes,\n self: baseurl + '/routesets/' + rs.name\n };\n }).filter(function (rs) {\n return (!req.query.name || wildcard(req.query.name,rs.name));\n })\n );\n })\n .catch(function (err) {\n res.status(500).send(err);\n });\n })\n .post(jsonParser, function(req,res) {\n var rs = req.body;\n if(!rs || !rs.name) {\n res.status(400).send('name is required');\n } else {\n router.getAppRouteSet(rs.name,true).then(function(routeset) {\n routeset.setRoutes(rs.routes);\n return routeset.store();\n }).then(function() {\n res.status(201).send('Created');\n }).catch(function (err) {\n res.status(500).send(err);\n });\n\n }\n });\n\n expressRouter.route('/routesets/:name')\n .get(function(req, res) {\n var rsName = req.params.name;\n var rs;\n if(rsName === '_default_') {\n rs = Promise.resolve(router.defaultRouteSet);\n } else {\n rs = router.getAppRouteSet(rsName);\n }\n\n rs.then(function(routeset) {\n res.send(\n {\n name: routeset.name,\n routes: routeset.routes,\n self: baseurl+'/routesets/' + routeset.name\n }\n );\n }).catch(function(err) {\n res.sendStatus(404);\n });\n })\n .put(jsonParser, function(req,res) {\n var rsName = req.params.name;\n var rs = req.body;\n\n if(rsName === '_default_') {\n res.status(400).send('_default_ cannot be update via the API');\n } else {\n router.getAppRouteSet(rsName,true).then(function (routeset) {\n routeset.setRoutes(rs.routes);\n return routeset.store();\n }).then(function(routeset) {\n res.send(\n {\n name: rsName,\n routes: routeset.routes,\n self: baseurl+'/routesets/' + rsName\n }\n );\n }).catch(function (err) {\n console.error(err);\n console.error(err.stack);\n res.status(500).send(err);\n });\n\n }\n })\n .delete(jsonParser, function(req,res) {\n var rsName = req.params.name;\n\n if(rsName === '_default_') {\n res.status(400).send('_default_ cannot be update via the API');\n } else {\n router.getAppRouteSet(rsName,true).then(function (routeset) {\n delete router.appRouteSets[rsName];\n return routeset.delete();\n }).then(function() {\n res.sendStatus(200);\n }).catch(function (err) {\n console.error(err);\n console.error(err.stack);\n res.status(500).send(err);\n });\n\n }\n });\n\n return expressRouter;\n}", "init() {\n this.router.get(\"/\", (req, res, next) => {\n res.status(200).json(this._service.defaultMethod());\n });\n }", "function Api() {\n \n //Calls the endpoint and returns the body.\n function fetch(endpoint) {\n //Avoid wrong input.\n url = (url.startsWith('http')) ? url : 'http://'+url;\n url = (url.endsWith('/')) ? url : url += '/';\n endpoint = (endpoint.startsWith('/')) ? endpoint.replace('/', '') : endpoint;\n const finUrl = url + endpoint;\n \n // To not break any existing scripts using pre-options syntax\n if (arguments.length === 3) {\n const options = arguments[1];\n const cb = arguments[2];\n const headers = (options[\"headers\"]) ? options[\"headers\"] : {};\n } else if (arguments.length === 2) {\n const cb = arguments[1];\n const headers = {};\n } else {\n const cb = function(){};\n const headers = {};\n }\n\n //TODO: If data has been preloaded or downloaded before, load the already downloaded data.\n \n request({\n url: finUrl,\n headers: headers\n }, function(error, response, body) {\n //Error cases\n if(error) cb(error);\n else if(response && response.statusCode == 400) cb('400 returned.');\n //TODO: Add more error cases (no body, error statusCodes, ...)\n else cb(undefined, body);\n })\n }\n\n //Set object methods with this\n this.fetch = fetch;\n}", "static makeAPICall(endpoint, input, options = {}) {\n switch (endpoint) {\n case GET_TOKEN:\n if (options.body === undefined) {\n options.body = {};\n }\n options.body.client_id = process.env.REACT_APP_CLIENT_ID;\n return this._fetchFromAPI(this.authUrlBeginning + \"token/\", options);\n case CREATE_USER:\n return this._fetchFromAPI(this.urlBeginning + \"createUser/\", options);\n case VALIDATE_TOKEN:\n return this._addAuthorization(this.urlBeginning + \"validateToken/\");\n case FORGOT_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/\", options);\n case RESET_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/confirm\", options);\n case UPLOAD_DOCUMENT:\n return this._addAuthorization(this.urlBeginning + \"uploadDoc/\", options);\n case UPLOAD_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"uploadAnnot/\", options);\n case GET_ALL_ANNOTE_BY_CURRENT_USER:\n return this._addAuthorization(this.urlBeginning + \"getAllMyAnnots/\" + (input == null ? \"\" : input));\n case GET_ALL_ANNOTE:\n return this._addAuthorization(this.urlBeginning + \"getAllAnnots/\" + (input == null ? \"\" : input));\n case GET_ANNOTATIONS_FILENAME_USER:\n return this._addAuthorization(this.urlBeginning + \"getAnnotationsByFilenameUser/\" + input + this.json);\n case EXPORT_CURRENT_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"exportAnnotations/\" + input + this.json);\n case DOWNLOAD_ANNOTATIONS_BY_ID:\n return this._addAuthorization(this.urlBeginning + \"downloadAnnotations/\" + input + this.json);\n\n // ICD APIs\n case ANCESTORS:\n return this._addAuthorization(this.urlBeginning + \"ancestors/\" + input + this.json);\n case FAMILY:\n return this._addAuthorization(this.urlBeginning + \"family/\" + input + this.json);\n case CODE_AUTO_SUGGESTIONS:\n return this._addAuthorization(this.urlBeginning + \"codeAutosuggestions/\" + input + this.json);\n case CODE_DESCRIPTION:\n return this._addAuthorization(this.urlBeginning + \"codeDescription/\" + input + this.json);\n default:\n return null;\n }\n }", "function security (req, res, next)\n{\n\tif (! has_started_serving_apis)\n\t{\n\t\tif (is_openbsd) // drop \"rpath\"\n\t\t\tpledge.init(\"error stdio tty prot_exec inet dns recvfd\");\n\n\t\thas_started_serving_apis = true;\n\t}\n\n\tconst api = url.parse(req.url).pathname;\n\n\t// Not an API !\n\tif ((! api.startsWith(\"/auth/v1/\")))\n\t\treturn next();\n\n\tconst cert\t\t\t= req.socket.getPeerCertificate(true);\n\tconst min_class_required\t= MIN_CERTIFICATE_CLASS_REQUIRED.get(api);\n\n\tif (! min_class_required)\n\t{\n\t\treturn END_ERROR (\n\t\t\tres, 404,\n\t\t\t\t\"No such API. Please visit: \"\t+\n\t\t\t\t\"<http://auth.iudx.org.in> for documentation.\"\n\t\t);\n\t}\n\n\tcert.serialNumber\t= cert.serialNumber.toLowerCase();\n\tcert.fingerprint\t= cert.fingerprint.toLowerCase();\n\n\tif (is_iudx_certificate(cert))\n\t{\n\t\tlet\tinteger_cert_class\t= 0;\n\t\tconst\tcert_class\t\t= cert.subject[\"id-qt-unotice\"];\n\n\t\tif (cert_class)\n\t\t{\n\t\t\tinteger_cert_class = parseInt(\n\t\t\t\tcert_class.split(\":\")[1],10\n\t\t\t) || 0;\n\t\t}\n\n\t\tif (integer_cert_class < 1)\n\t\t\treturn END_ERROR(res, 403, \"Invalid certificate class\");\n\n\t\tif (integer_cert_class < min_class_required)\n\t\t{\n\t\t\treturn END_ERROR (\n\t\t\t\tres, 403,\n\t\t\t\t\t\"A class-\" + min_class_required\t+\n\t\t\t\t\t\" or above certificate \"\t+\n\t\t\t\t\t\"is required to call this API\"\n\t\t\t);\n\t\t}\n\n\t\tif (api.endsWith(\"/introspect\") && integer_cert_class !== 1)\n\t\t{\n\t\t\treturn END_ERROR (\n\t\t\t\tres, 403,\n\t\t\t\t\t\"A class-1 certificate is required \" +\n\t\t\t\t\t\"to call this API\"\n\t\t\t);\n\t\t}\n\n\t\tconst error = is_secure(req,res,cert,true); // validate emails\n\n\t\tif (error !== \"OK\")\n\t\t\treturn END_ERROR (res, 403, error);\n\n\t\tpool.query(\"SELECT crl FROM crl LIMIT 1\", [], (error,results) =>\n\t\t{\n\t\t\tif (error || results.rows.length === 0)\n\t\t\t{\n\t\t\t\treturn END_ERROR (\n\t\t\t\t\tres, 500,\n\t\t\t\t\t\"Internal error!\", error\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst CRL = results.rows[0].crl;\n\n\t\t\tif (has_certificate_been_revoked(req.socket,cert,CRL))\n\t\t\t{\n\t\t\t\treturn END_ERROR (\n\t\t\t\t\tres, 403,\n\t\t\t\t\t\"Certificate has been revoked\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (! (res.locals.body = body_to_json(req.body)))\n\t\t\t{\n\t\t\t\treturn END_ERROR (\n\t\t\t\t\tres, 400,\n\t\t\t\t\t\"Body is not a valid JSON\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tres.locals.cert\t\t= cert;\n\t\t\tres.locals.cert_class\t= integer_cert_class;\n\t\t\tres.locals.email\t= cert\n\t\t\t\t\t\t\t.subject\n\t\t\t\t\t\t\t.emailAddress\n\t\t\t\t\t\t\t.toLowerCase();\n\n\t\t\treturn next();\n\t\t});\n\t}\n\telse\n\t{\n\t\tocsp.check({cert:cert.raw, issuer:cert.issuerCertificate.raw},\n\t\tfunction (err, ocsp_response)\n\t\t{\n\t\t\tif (err)\n\t\t\t{\n\t\t\t\treturn END_ERROR (\n\t\t\t\t\tres, 403,\n\t\t\t\t\t\"Your certificate issuer did \"\t+\n\t\t\t\t\t\"NOT respond to an OCSP request\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (ocsp_response.type !== \"good\")\n\t\t\t{\n\t\t\t\treturn END_ERROR (\n\t\t\t\t\tres, 403,\n\t\t\t\t\t\"Your certificate has been \"\t+\n\t\t\t\t\t\"revoked by your certificate issuer\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Certificates issued by other CAs\n\t\t\t// may not have an \"emailAddress\" field.\n\t\t\t// By default consider them as a class-1 certificate\n\n\t\t\tconst error = is_secure(req,res,cert,false);\n\n\t\t\tif (error !== \"OK\")\n\t\t\t\treturn END_ERROR (res, 403, error);\n\n\t\t\tres.locals.cert_class\t= 1;\n\t\t\tres.locals.email\t= \"\";\n\n\t\t\t// but if the certificate has a valid \"emailAddress\"\n\t\t\t// field then we consider it as a class-2 certificate\n\n\t\t\tif (is_valid_email(cert.subject.emailAddress))\n\t\t\t{\n\t\t\t\tres.locals.cert_class\t= 2;\n\t\t\t\tres.locals.email\t= cert\n\t\t\t\t\t\t\t\t.subject\n\t\t\t\t\t\t\t\t.emailAddress\n\t\t\t\t\t\t\t\t.toLowerCase();\n\t\t\t}\n\n\t\t\tif (res.locals.cert_class < min_class_required)\n\t\t\t{\n\t\t\t\treturn END_ERROR (\n\t\t\t\t\tres, 403,\n\t\t\t\t\t\"A class-\" + min_class_required\t+\n\t\t\t\t\t\" or above certificate is\"\t+\n\t\t\t\t\t\" required to call this API\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (! (res.locals.body = body_to_json(req.body)))\n\t\t\t{\n\t\t\t\treturn END_ERROR (\n\t\t\t\t\tres, 400,\n\t\t\t\t\t\"Body is not a valid JSON\"\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tres.locals.cert\t= cert;\n\n\t\t\treturn next();\n\t\t});\n\t}\n}", "static RequestHostList() {}", "function queryAPI(endpoint) {\n return Promise.any([\n query(API_URL_1, endpoint),\n query(API_URL_2, endpoint)\n ]).catch(() => {\n return Promise.reject(\n Error(`Failed to fetch endpoint ${endpoint}`)\n )\n });\n}", "_registerRoutes() {\n this.app.get('/:guild/metrics', (req, res) => {\n let guild = this.guilds.guilds[req.params.guild];\n if (typeof guild !== 'undefined') {\n guild.getMetrics((contentType, metrics) => {\n res.set('Content-Type', contentType);\n res.end(metrics);\n });\n } else {\n res.send('Guild not found');\n }\n });\n }", "static ROUTE_LIST () {\n const index = {\n endpoint: '/',\n type: 'get'\n }\n const create = {\n endpoint: '/create',\n type: 'get'\n }\n const store = {\n endpoint: '/',\n type: 'post'\n }\n const show = {\n endpoint: '/:id',\n type: 'get'\n }\n const edit = {\n endpoint: '/:id/edit',\n type: 'get'\n }\n const update = {\n endpoint: '/:id',\n type: 'put'\n }\n const destory = {\n endpoint: '/:id',\n type: 'delete'\n }\n return {\n index: { ...index },\n create: { ...create },\n store: { ...store },\n show: { ...show },\n edit: { ...edit },\n update: { ...update },\n destory: { ...destory },\n }\n }", "static bindDocs(api){\n\t\treturn (ctx,next)=>{\n\t\t\tctx.swaggerDocs = api;\n\t\t\tctx.define={\n\t\t\t\tmodel:{\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\tparams:{\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn next();\n\t\t}\n\t}", "function expressGETConfig(){\r\n app.get('/api/config',(req,res) =>{\r\n res.json(currentConfig.TAG_LIST);\r\n });\r\n //console.log(\"2a. GET to Server\");\r\n}", "onRoute (info) {\n openApi.addRoute(info, {\n basePath: env.REST_API_PREFIX\n })\n }", "function configure(cb) {\n winston.debug('Configuring discover...');\n async.parallel(\n {\n discover: function configureDiscover(config) {\n config(null, {\n serviceVariable: nconf.get('discover:serviceVariable') || 'DISCOVER'\n });\n },\n docker: function configureDocker(config) {\n config(null, {\n socketPath: nconf.get('docker:socketPath'),\n host: nconf.get('docker:host'),\n port: nconf.get('docker:port'),\n version: nconf.get('docker:version')\n });\n },\n etcd: function configureEtcd(config) {\n config(null, {\n host: nconf.get('etcd:host'),\n port: nconf.get('etcd:port'),\n prefix: nconf.get('etcd:prefix')\n });\n },\n host: function configureHost(config) {\n\n var hostIp = '127.0.0.1', // Default host IP if we can't find one in network interfaces\n hostId = os.hostname(); // Default host name if not explicitly configured\n\n async.parallel([\n\n function (done) {\n // Get instance ID from AWS for host ID\n request({ url: 'http://169.254.169.254/latest/meta-data/instance-id', timeout: 2000 }, function (err, res, body) {\n if (!err && body) {\n hostId = body;\n }\n done();\n });\n },\n\n function (done) {\n // Get the host IP address from the public interface\n var interfaces = os.networkInterfaces()['eth0'];\n if (interfaces) {\n interfaces.forEach(function (item) {\n if (item.family === 'IPv4') {\n hostIp = item.address;\n }\n });\n }\n done();\n }\n\n ], function () {\n config(null, {\n ip: nconf.get('host:ip') || hostIp,\n realm: nconf.get('host:realm') || 'default',\n id: nconf.get('host:id') || hostId\n });\n });\n }\n },\n function (err, config) {\n if (err) {\n winston.error('Unable to configure Discover due to: ' + err);\n return cb(err);\n }\n winston.debug('Configuring discover complete: ' + JSON.stringify(config, null, ' '));\n cb(null, config);\n }\n );\n }", "function api (req, res) {\n return Prismic.api(configuration.apiEndpoint, {\n accessToken: configuration.accessToken,\n req: req\n })\n}", "getAPI(request, response) {\n let message = {};\n message.name = 'implementation pending';\n message.version = 'implementation pending';\n return response.jsonp(message);\n }", "function setResourceListingPaths(app) {\n for (var key in resources) {\n app.get(\"/\" + key.replace(\"\\.\\{format\\}\", \".json\"), function(req, res) {\n var r = resources[req.url.substr(1).split('?')[0].replace('.json', '.{format}')];\n if (!r) {\n return stopWithError(res, {'description': 'internal error', 'code': 500}); }\n else {\n res.header('Access-Control-Allow-Origin', \"*\");\n res.header(\"Content-Type\", \"application/json; charset=utf-8\");\n var key = req.url.substr(1).replace('.json', '.{format}').split('?')[0];\n var data = applyFilter(req, res, resources[key]);\n data.basePath = basePath;\n if (data.code) {\n res.send(data, data.code); }\n else {\n res.header('Access-Control-Allow-Origin', \"*\");\n res.header(\"Access-Control-Allow-Methods\", \"GET, POST, DELETE, PUT\");\n res.header(\"Access-Control-Allow-Headers\", \"Content-Type\");\n res.header(\"Content-Type\", \"application/json; charset=utf-8\");\n res.send(JSON.stringify(applyFilter(req, res, r)));\n }\n }\n });\n }\n}", "function addMethod(app, callback, spec) {\n var rootPath = spec.path.split(\"/\")[1];\n var root = resources[rootPath];\n \n if (root && root.apis) {\n for (var key in root.apis) {\n var api = root.apis[key];\n if (api && api.path == spec.path && api.method == spec.method) {\n // found matching path and method, add & return\n appendToApi(root, api, spec);\n return;\n }\n }\n }\n\n var api = {\"path\" : spec.path};\n if (!resources[rootPath]) {\n if (!root) {\n var resourcePath = \"/\" + rootPath.replace(\"\\.\\{format\\}\", \"\"); \n root = {\n \"apiVersion\" : apiVersion, \"swaggerVersion\": swaggerVersion, \"basePath\": basePath, \"resourcePath\": resourcePath, \"apis\": [], \"models\" : []\n }; \n }\n resources[rootPath] = root;\n }\n\n root.apis.push(api);\n appendToApi(root, api, spec);\n\n // TODO: add some XML support\n // convert .{format} to .json, make path params happy\n var fullPath = spec.path.replace(\"\\.\\{format\\}\", \".json\").replace(/\\/{/g, \"/:\").replace(/\\}/g,\"\");\n var currentMethod = spec.method.toLowerCase();\n if (allowedMethods.indexOf(currentMethod)>-1) {\n app[currentMethod](fullPath, function(req,res) {\n res.header('Access-Control-Allow-Origin', \"*\");\n res.header(\"Access-Control-Allow-Methods\", \"GET, POST, DELETE, PUT\");\n res.header(\"Access-Control-Allow-Headers\", \"Content-Type\");\n \n res.header(\"Content-Type\", \"application/json; charset=utf-8\");\n\n if (!canAccessResource(req, req.url.substr(1).split('?')[0].replace('.json', '.*'), req.method)) {\n res.send(JSON.stringify({\"description\":\"forbidden\", \"code\":403}), 403);\n } else { \n try {\n callback(req,res); }\n catch (ex) {\n if (ex.code && ex.description) {\n res.send(JSON.stringify(ex), ex.code); }\n else {\n console.error(spec.method + \" failed for path '\" + require('url').parse(req.url).href + \"': \" + ex);\n res.send(JSON.stringify({\"description\":\"unknown error\",\"code\":500}), 500);\n }\n }\n }\n }); \n } else {\n console.log('unable to add ' + currentMethod.toUpperCase() + ' handler'); \n return;\n }\n}", "_adminApiSetup() {\n if ( this.#isConfigured !== true ) {\n this.log.warn('[uibuilder:web.js:_adminApiSetup] Cannot run. Setup has not been called.')\n return\n }\n\n this.adminRouter = express.Router({ mergeParams: true }) // eslint-disable-line new-cap\n\n /** Serve up the v3 admin apis on /<httpAdminRoot>/uibuilder/admin/ */\n this.adminRouterV3 = require('./admin-api-v3')(this.uib, this.log)\n this.adminRouter.use('/admin', this.adminRouterV3)\n this.routers.admin.push( { name: 'Admin API v3', path: `${this.RED.settings.httpAdminRoot}uibuilder/admin`, desc: 'Consolidated admin APIs used by the uibuilder Editor panel', type: 'Router' } )\n\n /** Serve up the package docs folder on /<httpAdminRoot>/uibuilder/techdocs (uses docsify) - also make available on /uibuilder/docs\n * @see https://github.com/TotallyInformation/node-red-contrib-uibuilder/issues/108\n */\n const techDocsPath = path.join(__dirname, '..', '..', 'docs')\n this.adminRouter.use('/docs', express.static( techDocsPath, this.uib.staticOpts ) )\n this.routers.admin.push( { name: 'Documentation', path: `${this.RED.settings.httpAdminRoot}uibuilder/docs`, desc: 'Documentation website powered by Docsify', type: 'Static', folder: techDocsPath } )\n this.adminRouter.use('/techdocs', express.static( techDocsPath, this.uib.staticOpts ) )\n this.routers.admin.push( { name: 'Tech Docs', path: `${this.RED.settings.httpAdminRoot}uibuilder/techdocs`, desc: 'Documentation website powered by Docsify', type: 'Static', folder: techDocsPath } )\n\n // TODO: Move v2 API's to V3\n this.adminRouterV2 = require('./admin-api-v2')(this.uib, this.log)\n this.routers.admin.push( { name: 'Admin API v2', path: `${this.RED.settings.httpAdminRoot}uibuilder/*`, desc: 'Various older admin APIs used by the uibuilder Editor panel', type: 'Router' } )\n\n /** Serve up the admin root for uibuilder on /<httpAdminRoot>/uibuilder/ */\n this.RED.httpAdmin.use('/uibuilder', this.adminRouter, this.adminRouterV2)\n }", "function RestService() {\n // This is the spoke we'll be in touch with. When returning will wrap it with Plug.\n var spoke = through.obj();\n\n // It's always good to init services on the second tick\n process.nextTick(function () {\n spoke.write(messages.log(\"STARTING API\"));\n\n var api = express();\n\n api.get(\"/dogs\", function (req, res) {\n // We can access the hub as a stream\n spoke.write(messages.log(\"DOGS REQUEST\"));\n\n // or with MueRequest\n requestDogs(spoke, function (err, dogs) {\n res.json({dogs: dogs.dogs});\n })\n })\n api.get(\"/dogs/add/:type/:name\", function (req, res) {\n // Application logic validation should be handled here,\n // Business logic validation should be handled within the DOG ADDING service\n\n addDog(spoke, {type: req.params.type, name: req.params.name}, function (err, addedDog) {\n res.json(addedDog);\n })\n })\n\n api.listen(3000);\n });\n\n // Really important to wrap it with Plug. Otherwise, if you return a through stream, you'll get into a recursion.\n return Plug(spoke);\n}", "function BookRestApi() {\n var bookProvider = BookProvider;\n var searchProvider = Search;\n var self = this;\n\n /**\n * Retuns all the books from the storage. Should be used with care. Apply paging later?\n * @param req express request\n * @param res express response\n */\n this.findAllBooks = function (req, res) {\n bookProvider.findAll(function (error, data) {\n if (error) {\n res.send(JSON.stringify({\"error\": error}))\n } else {\n res.send(JSON.stringify(data));\n }\n });\n };\n\n /**\n * Creates a new book from the clients' JSON. Updates both the MongoDB and the search index.\n *\n * @param req express request\n * @param res express response\n */\n this.newBook = function (req, res) {\n if (!req.body) {\n res.send(500, \"Wrong format - maybe malformed json?\");\n return;\n }\n\n bookProvider.save(req.body, function (error, bookSaved) {\n if (error) {\n LOG('Error saving book. Mongodb: ' + error);\n res.send(500, 'Error saving book!');\n } else {\n searchProvider.index('book', 'document', elasticSearch(bookSaved), bookSaved._id.toHexString(), null, function (data) {\n LOG(JSON.stringify(data));\n });\n res.send(JSON.stringify(bookSaved));\n }\n })\n };\n\n\n /**\n * Search for books endpoint. Waits for 'q' parameter with the keywords to search against, separated by comma. Like\n * ?q=madam,1,none,starting\n *\n * @param req express request\n * @param res express response\n */\n this.searchForBooks = function (req, res) {\n if (!req.query.q) {\n self.findAllBooks(req, res);\n return;\n }\n var qryObj = {\n \"query\": {\n \"query_string\": {\n \"query\": req.query.q\n }\n }\n };\n searchProvider.search('book', 'document', qryObj, null, function (data) {\n var elasticResponse = JSON.parse(data);\n if (elasticResponse.error) {\n LOG('Error from Bonsai: ' + data);\n res.send(500, \"Error from Bonsai\");\n return;\n }\n var hits = elasticResponse.hits.hits;\n LOG(hits.length + \" hits found for query \" + req.query.id);\n\n var ids = hits.map(function (hit) {\n return hit._source.id;\n });\n bookProvider.findByIds(ids, function (err, data) {\n if (err) {\n LOG(err);\n res.send(500, \"Error searching for books.\");\n return;\n }\n res.send(data)\n });\n\n });\n };\n\n this.update = function (req, res) {\n bookProvider.update(req.body, function (err, data) {\n if (err) {\n res.send(500, 'Error saving book!');\n }\n else {\n searchProvider.update('book', 'document', data._id, elasticSearch(data), function (d) {\n LOG(JSON.stringify(d));\n });\n res.send(data);\n }\n });\n };\n\n var elasticSearch = function (book) {\n return {\n \"name\": book.name,\n \"text\": [book.Text, book.Title, book.Author, book.Tags.join(\" \")].join(\" \"),\n \"id\": book._id\n }\n };\n}" ]
[ "0.74323714", "0.7372563", "0.67343646", "0.6592401", "0.6319553", "0.6132138", "0.59894264", "0.5960525", "0.584235", "0.57043034", "0.5701774", "0.5640919", "0.5640919", "0.5608991", "0.5608991", "0.5608159", "0.5574559", "0.5551448", "0.55217737", "0.5521378", "0.54896516", "0.54872346", "0.54721135", "0.5462845", "0.5448862", "0.5439817", "0.5429978", "0.54113424", "0.5399042", "0.5377063", "0.53664225", "0.5357904", "0.535452", "0.5348599", "0.5344053", "0.5323276", "0.53220576", "0.53218305", "0.5316514", "0.53156024", "0.53128695", "0.5312851", "0.52717334", "0.5263174", "0.52389705", "0.52167463", "0.5206058", "0.5198089", "0.51914334", "0.5188501", "0.51868796", "0.5162482", "0.5143823", "0.5129552", "0.512892", "0.5127588", "0.5124833", "0.5092792", "0.50787187", "0.50763273", "0.50763273", "0.50763273", "0.50703734", "0.5055543", "0.5053526", "0.50422746", "0.5039265", "0.50361425", "0.5033809", "0.5031379", "0.50220084", "0.50212574", "0.50191903", "0.501318", "0.4994666", "0.49854147", "0.49836853", "0.4982758", "0.49811423", "0.49775404", "0.49759948", "0.4970281", "0.4955329", "0.49539503", "0.4953079", "0.4951157", "0.49466965", "0.49435908", "0.4940942", "0.4932964", "0.4931663", "0.49165794", "0.49061286", "0.4904926", "0.49026722", "0.489639", "0.48892146", "0.48870674", "0.48781383", "0.4876667", "0.48743254" ]
0.0
-1
Generate and Endpoint from an endpoint schema object.
makeEndpoint(schema) { return (options) => { const ep = new endpoint_1.Endpoint(options); ep.applySchema(ep, schema, schema, ep); return ep; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deriveEndpoint(edge, index, ep, conn) {\n return options.deriveEndpoint ? options.deriveEndpoint(edge, index, ep, conn) : options.endpoint ? options.endpoint : ep.type;\n }", "set endpoint(endpoint) {\n\t\tif (Array.isArray(endpoint)) {\n\t\t\tthis._endpoint = endpoint.map((i) => new Reference(i));\n\t\t} else {\n\t\t\tthis._endpoint = [new Reference(endpoint)];\n\t\t}\n\t}", "createPayloadEndpoint(opts) {\n if (opts === undefined) opts = {};\n\n // Return the proper structure expected for the endpoint\n const endpoint = {\n capabilities: this.checkValue(opts.capabilities, []),\n description: this.checkValue(opts.description, 'Sample Endpoint Description'),\n displayCategories: this.checkValue(opts.displayCategories, ['OTHER']),\n endpointId: this.checkValue(opts.endpointId, 'endpoint-001'),\n // \"endpointId\": this.checkValue(opts.endpointId, 'endpoint_' + (Math.floor(Math.random() * 90000) + 10000)),\n friendlyName: this.checkValue(opts.friendlyName, 'Sample Endpoint'),\n manufacturerName: this.checkValue(opts.manufacturerName, 'Sample Manufacturer'),\n };\n\n if (opts.hasOwnProperty('cookie')) endpoint.cookie = this.checkValue('cookie', {});\n\n return endpoint;\n }", "function createApiEndpoint(requestor, endpoint) {\n var isCollection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n\n var _get = function _get() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return requestor.makeRequest('get', '/' + endpoint, params);\n };\n var _post = function _post(data) {\n return requestor.makeRequest('post', '/' + endpoint, data);\n };\n\n /**\n *\n * @param {*} params\n */\n var apiEndpoint = function apiEndpoint() {\n var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n // calling endpoint() is equivalent to endpoint.all()\n return _get(params);\n };\n\n if (isCollection) {\n apiEndpoint.all = _get;\n apiEndpoint.create = _post;\n apiEndpoint.find = function (id) {\n var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return requestor.makeRequest('get', '/' + endpoint + '/' + id, params);\n };\n apiEndpoint.update = function (id, data) {\n return requestor.makeRequest('put', '/' + endpoint + '/' + id, data);\n };\n apiEndpoint.delete = apiEndpoint.remove = function (id) {\n return requestor.makeRequest('delete', '/' + endpoint + '/' + id);\n };\n apiEndpoint.one = function (key) {\n return requestor.endpoint(endpoint + '/' + key, endpoint + '_' + key, false);\n };\n } else {\n apiEndpoint.get = _get;\n apiEndpoint.post = _post;\n apiEndpoint.put = function (data) {\n return requestor.makeRequest('put', '/' + endpoint, data);\n };\n apiEndpoint.delete = function () {\n return requestor.makeRequest('delete', '/' + endpoint);\n };\n }\n\n // Wrap the endpoint with a proxy to handle undefined property as another api endpoint\n // undefined property on collection endpoint return entity endpoint\n // and collection endpoint on entity endpoint\n var apiEndpointProxy = new Proxy(apiEndpoint, {\n get: function get(apiEndpoint, prop) {\n if (prop in apiEndpoint) {\n return apiEndpoint[prop];\n }\n\n return requestor.endpoint(endpoint + '/' + prop, endpoint + '_' + prop, !isCollection);\n }\n });\n\n return apiEndpointProxy;\n}", "function configureEndpoint() {\n\tif(!o().isEndpoint()) {\n\t\to().config({\n\t\t\tendpoint:'http://services.odata.org/V4/%28S%28wptr35qf3bz4kb5oatn432ul%29%29/TripPinServiceRW/',\n\t\t\tversion:4,\n\t\t\tstrictMode:true\n\t\t});\n\t}\n}", "endpoint(e) {\n\t\tlet value = GhostInstance.endpoints;\n\t\tconst paths = e.split('.');\n\t\tpaths.forEach((path) => {\n\t\t\tvalue = value[path] || {};\n\t\t});\n\n\t\tif (typeof value === 'object') {\n\t\t\tif (value.path) {\n\t\t\t\tvalue = Object.assign({}, value);\n\t\t\t} else {\n\t\t\t\tvalue = {};\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t}", "function callApi (endpoint, schemas, typeSchemas, options, clientId) {\n // checkif endpoint already contains base asi url or base web url\n const fullUrl = (endpoint.indexOf(API_ROOT) !== -1) || (endpoint.indexOf(API_WEB_ROOT) !== -1)\n ? endpoint\n : API_ROOT + endpoint\n\n return fetch(fullUrl, options)\n .then(response => {\n if (!response.ok) {\n return Promise.reject(new ResponseError(response))\n }\n return response.json().then(json => ({ json, response }))\n }).then(({ json, response }) => {\n if (!response.ok) {\n return Promise.reject(json)\n }\n\n // normalize static types\n if (typeSchemas) {\n if (Array.isArray(typeSchemas)) {\n console.error('NORMALIZE: not supported operation - types schemas array', json, typeSchemas)\n } else {\n console.error('NORMALIZE: not supported operation - types schema', json, typeSchemas)\n }\n }\n return normalizeResponse({ json, schemas })\n }).catch(error => Promise.reject(error))\n}", "static fromEndpointAttributes(scope, id, attrs) {\n class Import extends core_1.Resource {\n constructor() {\n super(...arguments);\n this.endpointId = attrs.endpointId;\n this.connections = new connections_1.Connections({ securityGroups: attrs.securityGroups });\n this.targetNetworksAssociated = new core_1.ConcreteDependable();\n }\n }\n return new Import(scope, id);\n }", "function Schema_from_swagger(schema_content) {\n 'use strict';\n // use new\n\n this.resolve = (input_json_obj) => {\n //const schema = getSwaggerV2Schema(schema_content, '/default_endpoint')\n const schema = schema_content;\n const ok = schemaValidator(schema, input_json_obj);\n if (ok) {\n return input_json_obj;\n } else {\n throw new Error('mismatch: The constraint aspect of template failed');\n }\n };\n\n this.generate = (obj) => this.resolve(obj);\n}", "function endpoint(path, method) {\n function Endpoint(path, method) {\n this.path = path;\n this.method = method;\n }\n allEndpoints.push( new Endpoint(path, method) );\n}", "function create_url(endpoint) {\n // TODO: ここを書き換えてURL作る\n // return '/api/guchi' + endpoint\n return URL_BASE + '/deai/' + endpoint;\n}", "function endpoint(path, query, body) {\n return function () {\n body = body || getJSON(path);\n createEndpointFromObject(path, query, body);\n console.log(' registered path %s', path);\n }\n}", "function createEndpointFromPath(path, query, filePath) {\n filePath = filePath || path;\n return createEndpointFromObject(path, query, getJSON(filePath));\n}", "function _getEndpointUri(endpoint) {\n return _endpoint.gebo + _endpoint[endpoint];\n }", "_attachEndpoint(func, endpoint) {\n\t\t// Validate method and path\n\t\t/* istanbul ignore next */\n\t\tif (!endpoint.method || !endpoint.path) {\n\t\t\treturn this.log(\n\t\t\t\t`Endpoint ${endpoint.type} for function ${func.name} has no method or path`\n\t\t\t)\n\t\t}\n\t\t// Add HTTP endpoint to Express\n\t\tthis.app[endpoint.method.toLowerCase()](\n\t\t\tendpoint.path,\n\t\t\t(request, response) => {\n\t\t\t\tthis.log(`${endpoint}`)\n\t\t\t\t// Execute Lambda with corresponding event, forward response to Express\n\t\t\t\tlet lambdaEvent = endpoint.getLambdaEvent(request)\n\t\t\t\tthis._executeLambdaHandler(func, lambdaEvent)\n\t\t\t\t\t.then(result => {\n\t\t\t\t\t\tthis.log(' ➡ Success')\n\t\t\t\t\t\tif (process.env.SLS_DEBUG) console.info(result)\n\t\t\t\t\t\tendpoint.handleLambdaSuccess(response, result)\n\t\t\t\t\t})\n\t\t\t\t\t.catch(error => {\n\t\t\t\t\t\tthis.log(` ➡ Failure: ${error.message}`)\n\t\t\t\t\t\tif (process.env.SLS_DEBUG) console.error(error.stack)\n\t\t\t\t\t\tendpoint.handleLambdaFailure(response, error)\n\t\t\t\t\t})\n\t\t\t}\n\t\t)\n\t}", "function extendingEndpoints() {\n var segments = Array.prototype.slice.call(arguments, 0);\n return function () {\n var path = '';\n segments.forEach(function (pathSegment) {\n path = path + pathSegment;\n createEndpointFromPath(path);\n console.log(' registered path %s', path);\n });\n }\n}", "registerEndpoint(fn, options)\n {\n if (!fn) throw new Error('Must include a function to register endpoint');\n\n options.modelName = this.modelName;\n const endpoint = buildEndpoint(this, options, fn);\n if (!options.private) this.publicEndpoints.push(endpoint);\n this[options.name] = fn;\n }", "createEntity(entity) {\n this.endpoints[entity.name] = this.createBasicCRUDEndpoints(entity);\n }", "function expandBindings(endpoints) {\n\treturn Object.keys(endpoints).reduce((expanded, method) => {\n\t\tconst bindingDefinition = endpoints[method];\n\t\tif (typeof bindingDefinition === \"object\") {\n\t\t\texpanded[method] = bindingDefinition;\n\t\t}\n\t\telse {\n\t\t\texpanded[method] = {\n\t\t\t\tpost: bindingDefinition,\n\t\t\t\tredirect: bindingDefinition\n\t\t\t};\n\t\t}\n\t\treturn expanded;\n\t}, {});\n}", "function callApi(endpoint, option, schema) {\n \n const fullUrl = (endpoint.indexOf(API_ROOT) === -1) ? API_ROOT + endpoint : endpoint;\n\n return fetch(fullUrl, option)\n .then(response => {\n if (response.status === 204) {\n return { json: undefined, response: response };\n }\n return response.json().then(json => ({ json, response }));\n }).then(({ json, response }) => {\n if (!response.ok) {\n return Promise.reject(json);\n }\n\n if (json) {\n let resultObjects;\n\n if (json.results) {\n resultObjects = json.results;\n } else {\n resultObjects = json;\n }\n return Object.assign({}, normalize(resultObjects, schema), {next: json.next});\n } else {\n return {};\n }\n })\n}", "function setupEndpoint() {\n if (host.val().indexOf('/') != -1) {\n var hostArr = host.val().split('/');\n\n path = \"http://\" + hostArr[0] + \":\" + port.val();\n hostArr.shift(); // remove host\n\n if (hostArr.length > 0) { // anything left?\n path += \"/\" + hostArr.join('/');\n }\n } else {\n path = \"http://\" + host.val() + \":\" + port.val();\n }\n endpoint = path;\n }", "function parse(any, opts) {\n let schemaOrProtocol = specs.read(any);\n return schemaOrProtocol.protocol ?\n services.Service.forProtocol(schemaOrProtocol, opts) :\n types.Type.forSchema(schemaOrProtocol, opts);\n}", "function initEndpointRunner(appMetadata, requestContext, taskMetadata) {\n class EndpointRunner extends BaseStore {\n _buildEndpointRequest(options) {\n return this._buildKinveyRequest(BASE_ROUTE, 'custom', options);\n }\n\n _makeEndpointRequest(requestOptions, endpointName, callback) {\n if (this._taskMetadata.objectName === endpointName && this._taskMetadata.hookType === 'customEndpoint') {\n const error = new Error('EndpointRunnerError');\n error.description = 'Not Allowed';\n error.debug = 'Recursive requests to the same endpoint are prohibited.';\n return callback ? setImmediate(() => callback(error)) : Promise.reject(error);\n }\n return this._makeRequest(requestOptions, callback);\n }\n\n endpoint(endpointName) {\n const execute = (body = {}, cb) => {\n const callback = !cb && typeof body === 'function' ? body : cb;\n const requestBody = typeof body === 'function' ? {} : body;\n\n const requestOptions = this._buildEndpointRequest();\n\n requestOptions.method = 'POST';\n requestOptions.url += endpointName;\n requestOptions.body = requestBody || {};\n return this._makeEndpointRequest(requestOptions, endpointName, callback);\n };\n\n return {\n execute,\n endpointName,\n _useUserContext: this._useUserContext,\n _useBl: this._useBl,\n _appMetadata: this._appMetadata,\n _requestContext: this._requestContext\n };\n }\n }\n\n function generateEndpointRunner(storeOptions = {}) {\n storeOptions.useBl = true;\n return new EndpointRunner(storeOptions, appMetadata, requestContext, taskMetadata);\n }\n\n return generateEndpointRunner;\n}", "get endpoint() {\n return this.getStringAttribute('endpoint');\n }", "get endpoint() {\n return this.getStringAttribute('endpoint');\n }", "get endpoint() {\n return this.getStringAttribute('endpoint');\n }", "function parse(any, opts) {\n var schemaOrProtocol = specs.read(any);\n return schemaOrProtocol.protocol ?\n services.Service.forProtocol(schemaOrProtocol, opts) :\n types.Type.forSchema(schemaOrProtocol, opts);\n}", "function buildEndpoints() {\n ctrl.devices.forEach(function(device) {\n if (!endpointHasDevice(device)) {\n ctrl.endpoints.push(buildEndpoint(device))\n }\n })\n cleanEndpoints()\n }", "function createEndpointFromObject(path, query, body) {\n // OPTIONS gives server permission to use CORS\n server.createRoute({\n request: {\n url: path,\n query: query || {},\n method: 'options',\n },\n response: {\n code: 200,\n delay: config.latency,\n body: {},\n headers: {\n 'Access-Control-Allow-Origin': config.allowOrigin,\n // allow several methods since some endpoints are writable\n 'Access-Control-Allow-Methods': 'GET, PUT, POST',\n 'Access-Control-Allow-Credentials': 'true'\n }\n }\n });\n return server.get(path)\n .query(query)\n .responseHeaders({\n 'Access-Control-Allow-Origin': config.allowOrigin,\n 'Access-Control-Allow-Methods': 'GET, PUT, POST',\n 'Access-Control-Allow-Credentials': 'true'\n })\n .body(body)\n .delay(config.latency);\n}", "endpoint() {\n //\n }", "function validateEndpointOptions(options)\n{\n if (!options.hasOwnProperty('name') || !checkType(options.name, 'string'))\n throw new Error('Name is required for endpoints');\n if (!options.http || !checkType(options.http, 'object')) throw new Error('http object is required for endpoints');\n if (!options.http.verb || !checkType(options.http.verb, 'string'))\n throw new Error('http.verb is required for endpoints');\n if (!options.http.path || !checkType(options.http.path, 'string'))\n throw new Error('http.path is required for endpoints');\n\n //Check that options.args have all the required informaton here\n options.args = options.args || [];\n options.args.forEach(arg =>\n {\n if (!arg.arg || !checkType(arg.arg, 'string'))\n throw new Error(\"Argument property 'arg' is required for endpoint arugments\");\n if (!arg.type || !checkType(arg.type, 'string'))\n throw new Error(\"Argument property 'type' is required for endpoint arugments\");\n });\n}", "function resetEndpoint(endpoint) {\n return endpoint = \"https://localhost:44367/api/movie/\";\n }", "get endpoint () {\n\t\treturn this._endpoint;\n\t}", "function discoverEndpoint(request, done) {\n var service = request.service || {};\n if (hasCustomEndpoint(service) || request.isPresigned()) return done();\n\n var operations = service.api.operations || {};\n var operationModel = operations[request.operation];\n var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';\n var isEnabled = resolveEndpointDiscoveryConfig(request);\n var hasRequiredEndpointDiscovery = service.api.hasRequiredEndpointDiscovery;\n if (isEnabled || hasRequiredEndpointDiscovery) {\n // Once a customer enables endpoint discovery, the SDK should start appending\n // the string endpoint-discovery to the user-agent on all requests.\n request.httpRequest.appendToUserAgent('endpoint-discovery');\n }\n switch (isEndpointDiscoveryRequired) {\n case 'OPTIONAL':\n if (isEnabled || hasRequiredEndpointDiscovery) {\n // For a given service; if at least one operation requires endpoint discovery then the SDK must enable endpoint discovery\n // by default for all operations of that service, including operations where endpoint discovery is optional.\n optionalDiscoverEndpoint(request);\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n }\n done();\n break;\n case 'REQUIRED':\n if (isEnabled === false) {\n // For a given operation; if endpoint discovery is required and it has been disabled on the SDK client,\n // then the SDK must return a clear and actionable exception.\n request.response.error = util.error(new Error(), {\n code: 'ConfigurationException',\n message: 'Endpoint Discovery is disabled but ' + service.api.className + '.' + request.operation +\n '() requires it. Please check your configurations.'\n });\n done();\n break;\n }\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n requiredDiscoverEndpoint(request, done);\n break;\n case 'NULL':\n default:\n done();\n break;\n }\n}", "function EndpointImpl() {\n\t\tvar endpointImpl = this;\n\t\tvar config = {};\n\t\tvar cometd = null; // current cometd instance\n\t\tvar connected = false;\n\t\tvar connectCalled = false; // for automatic connect on first use\n\n\t\t// FeedImpl attachment points\n\t\tthis.onStateChange = null;\n\t\tthis.onData = null;\n\n\t\t// ----- private endpointImpl methods -----\n\n\t\tfunction debug(msg) {\n\t\t\tif (config.logLevel === \"debug\" && console && console.log)\n\t\t\t\tconsole.log(msg);\n\t\t}\n\n\t\tfunction info(msg) {\n\t\t\tif (console && console.info)\n\t\t\t\tconsole.info(msg);\n\t\t}\n\n\t\tfunction warn(msg) {\n\t\t\tif (console && console.warn)\n\t\t\t\tconsole.warn(msg);\n\t\t}\n\n\t\tfunction convertToAbsoluteURL(url) {\n\t\t\tif (/^https?:\\/\\//i.test(url))\n\t\t\t\treturn url;\n\t\t\tif (/^\\/\\//.test(url))\n\t\t\t\treturn location.protocol + url;\n\t\t\tif (/^\\//.test(url))\n\t\t\t\treturn location.protocol + \"//\" + location.host + url;\n\t\t\treturn location.protocol + \"//\" + location.host + location.pathname + url;\n\t\t}\n\n\t\tfunction updateConnectedState(newConnected) {\n\t\t\tvar wasConnected = connected;\n\t\t\tif (wasConnected !== newConnected) {\n\t\t\t\tinfo(wasConnected ? \"Connection lost\" : \"Connection established\");\n\t\t\t\tconnected = newConnected;\n\t\t\t\tendpointImpl.onStateChange({ connected: newConnected });\n\t\t\t}\n\t\t}\n\n\t\t// Function that manages the connection status with the Bayeux server\n\t\tfunction onMetaConnect(message) {\n\t\t\tif (cometd === null || cometd.isDisconnected()) {\n\t\t\t\tupdateConnectedState(false);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tupdateConnectedState(message.successful === true);\n\t\t}\n\n\t\tfunction onMetaUnsuccessful() {\n\t\t\tupdateConnectedState(false)\n\t\t}\n\n\t\tfunction onServiceState(message) {\n\t\t\tdebug(\"Received state \" + JSON.stringify(message));\n\t\t\tendpointImpl.onStateChange(message.data);\n\t\t}\n\n\t\tfunction onServiceData(message) {\n\t\t\tdebug(\"Received data \" + JSON.stringify(message));\n\t\t\tendpointImpl.onData(message.data, false);\n\t\t}\n\n\t\tfunction onServiceTimeSeriesData(message) {\n\t\t\tdebug(\"Received time series data \" + JSON.stringify(message));\n\t\t\tendpointImpl.onData(message.data, true);\n\t\t}\n\n\t\tfunction connect(url) {\n\t\t\tconnectCalled = true;\n\t\t\tif (!org.CometD) {\n\t\t\t\twarn(\"No CometD, working without connection\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (config.url === undefined && dx.contextPath !== undefined)\n\t\t\t\tconfig.url = dx.contextPath + \"/cometd\"; // default webservice path\n\t\t\tif (typeof url === \"string\") {\n\t\t\t\tconfig.url = url;\n\t\t\t} else if (typeof url === \"object\") {\n\t\t\t\tconfig = extend(config, url);\n\t\t\t}\n\t\t\tconfig.url = convertToAbsoluteURL(config.url);\n\t\t\tinfo(\"Connecting with url: \" + config.url);\n\t\t\tif (cometd === null) {\n\t\t\t\tcometd = new org.CometD();\n\t\t\t\tcometd.addListener(\"/meta/connect\", onMetaConnect);\n\t\t\t\tcometd.addListener(\"/meta/unsuccessful\", onMetaUnsuccessful);\n\t\t\t\tcometd.addListener(\"/service/state\", onServiceState);\n\t\t\t\tcometd.addListener(\"/service/data\", onServiceData);\n\t\t\t\tcometd.addListener(\"/service/timeSeriesData\", onServiceTimeSeriesData);\n\t\t\t}\n\t\t\tcometd.configure(config);\n\t\t\tcometd.handshake();\n\t\t}\n\n\t\t// ----- public endpointImpl methods -----\n\n\t\tthis.logLevel = function (level) {\n\t\t\tconfig.logLevel = level;\n\t\t};\n\n\t\tthis.isConnected = function () {\n\t\t\treturn connected;\n\t\t};\n\n\t\tthis.connect = connect;\n\n\t\tthis.disconnect = function () {\n\t\t\tif (cometd !== null) {\n\t\t\t\tinfo(\"Disconnecting\");\n\t\t\t\tcometd.disconnect(true);\n\t\t\t\tcometd = null;\n\t\t\t\tconnected = false;\n\t\t\t}\n\t\t};\n\n\t\tthis.publish = function (service, message) {\n\t\t\tdebug(\"Publishing to \" + service + \": \" + JSON.stringify(message));\n\t\t\tcometd.publish(\"/service/\" + service, message);\n\t\t};\n\n\t\tthis.connectIfNeeded = function () {\n\t\t\tif (!connectCalled)\n\t\t\t\tconnect();\n\t\t};\n\t}", "async function getEndpoint(config) {\n if (typeof config.endpoint === 'function') {\n return await config.endpoint()\n }\n\n const region = await config.region()\n return new URL(`https://dynamodb.${region}.amazonaws.com`)\n}", "function _registerRESTEndpoint(resource, endpoint, address) {\n if ( endpoint && typeof endpoint == 'object') {\n bus.publish('restapi.register', {\n \"resource\": resource,\n endpoint: endpoint.path,\n method: endpoint.method.toUpperCase(),\n expects: endpoint.expects,\n produces: endpoint.produces,\n address: address\n })\n } else {\n throw \"REST ENDPOINT REGISTRATION FAILED: Invalid parameter passed to register a REST endpoint!\";\n }\n }", "function subEndpoints(prefix, suffixes) {\n return function () {\n Array.prototype.forEach.call(suffixes, function (suffix) {\n var path = prefix + suffix;\n createEndpointFromPath(path);\n console.log(' registered path %s', path);\n });\n }\n}", "function create_dep_edges(context, path) {\n context = context || schema;\n path = path || [];\n _.each(context, function(val, key) {\n var newpath = path.concat(key);\n if (_.head(key) >= 'A' && _.head(key) <= 'Z') {\n if (_.isFunction(val)) {\n dep_edges.push(['_', newpath.join('.'), 'extends']);\n } else if (_.isString(val) && _.head(val) === '@') {\n dep_edges.push([val.slice(1), newpath.join('.'), 'extends']);\n } else if (_.isArray(val)) {\n if (!_.isFunction(val[0])) throw new Error('First element of array must be a function');\n if (val[1] && !_.isObject(val[1])) throw new Error('Second element of array must be an object');\n var options = val[1] || {};\n if (options.extends) {\n dep_edges.push([options.extends, newpath.join('.'), 'extends']);\n // link contexts as well\n var ext_path = options.extends.split('.');\n var ext_ctx = _.initial(ext_path).concat('$' + _.last(ext_path)).join('.');\n dep_edges.push([ext_ctx, path.concat('$' + key).join('.'), 'extends']);\n } else {\n dep_edges.push(['_', newpath.join('.'), 'extends']);\n }\n if (options.pre) {\n var pres = _.isArray(options.pre) ? options.pre : [options.pre];\n _.each(pres, pre => dep_edges.push([pre, newpath.join('.'), 'pre']));\n }\n if (options.post) {\n var posts = _.isArray(options.post) ? options.post : [options.post];\n _.each(posts, post => dep_edges.push([post, newpath.join('.'), 'post']));\n }\n } else {\n throw new Error('Unexpected format for schema key: ' + newpath.join('.'));\n }\n } else if (_.head(key) >= 'a' && _.head(key) <= 'z') {\n if (_.isString(val)) {\n if (_.head(val) !== '@') {\n throw new Error('Unexpected string value for \"' + path.concat(key).join('.') + '\": ' + val);\n }\n } else if (_.isObject(val)) {\n create_dep_edges(context[key], path.concat(key));\n } else {\n throw new Error('Value for \"' + path.concat(key).join('.') + \"' path must be an object\");\n }\n } else if (_.head(key) === '$') {\n if (_.isObject(val)) {\n if (context.$_ && !path.concat(key).includes('$_')) {\n _.each(context.$_, function(v, k) {\n if (k === key || _.head(k) === '$') return;\n if (_.isFunction(v) || _.isArray(v)) {\n val[k] = v;\n } else {\n val[k] = _.clone(v);\n }\n });\n val.$_ = _.assign({}, context.$_, val.$_);\n }\n _.each(_.filter(_.keys(val), function(subkey) {\n return subkey !== '_' && _.head(subkey) !== '$';\n }), function(subkey) {\n dep_edges.push([newpath.concat(subkey).join('.'), newpath.join('.'), 'contained']);\n });\n create_dep_edges(context[key], path.concat(key));\n } else {\n throw new Error('Value for \"' + newpath.join('.') + \"' subcontext must be an object\");\n }\n } else if (key === '_' || _.head(key) === '@') {\n // Do nothing\n } else {\n throw new Error('Unexpected format for schema key: ' + path.concat(key).join('.'));\n }\n });\n }", "function closeTagBegin(tag, offset)\n{\n with(this)\n {\n if (tag.toLowerCase() == \"definitions\" || tag.toLowerCase() == \"wsdl:definitions\")\n {\n var porttypeindex, name, value, bindingObj;\n for(var i = 0; i < tempBindings.length; i++)\n {\n var type = tempBindings[i].bindingType;\n if (type)\n {\n // search this binding type in the portType array to find\n // out the index of the portType...\n for(var j = 0; j < tempPortType.length; j++)\n { \n if (type.toLowerCase().indexOf(tempPortType[j].toLowerCase()) != -1)\n {\n porttypeindex = type.indexOf(tempPortType[j]);\n if (porttypeindex)\n {\n if (tempBindings[i].bindingProtocol)\n {\n bindingObj = new Object();\n name = \"binding[\" + i + \"]\";\n value = tempBindings[i].bindingName;\n name = name + \"porttype[\" + j + \"]\"; \n name = name + tempBindings[i].bindingProtocol; \n if (tempBindings[i].bindingProtocolVerb)\n {\n name = name + \":\" + tempBindings[i].bindingProtocolVerb; \n } \n bindingObj.name = name;\n bindingObj.value = value;\n binding.push(bindingObj);\n break;\n }\n } \n }\n }\n }\n } \n \n // service array...\n// var serviceObj;\n// for(i = 0; i < tempService.length; i++)\n// {\n// if (tempService[i])\n// {\n// serviceObj = new Object;\n// serviceObj.name = \"service[\" + i + \"]\";\n// serviceObj.value = tempService[i];\n// service.push(serviceObj);\n// }\n// }\n \n // portType array...\n var portTypeObj;\n for(i = 0; i < tempPortType.length; i++)\n {\n if (tempPortType[i])\n {\n portTypeObj = new Object;\n portTypeObj.name = \"porttype[\" + i + \"]\";\n portTypeObj.value = tempPortType[i];\n porttype.push(portTypeObj);\n }\n } \n } // if (tag.toLowerCase() == \"definitions\")\n if (tag.toLowerCase() == \"binding\" || tag.toLowerCase() == \"wsdl:binding\")\n { \n // push the temporary binding object into the temporary bindings array...\n tempBindings.push(tempBinding); \n }\n }\n\treturn true;\n}", "constructor(endpoint, options) {\n super(endpoint, options);\n }", "constructor(endpoint, options) {\n super(endpoint, options);\n }", "get endpoint() {\n\t\treturn this.__endpoint;\n\t}", "function parseSchema(name, schema) {\n var name = name.replace('.json', '');\n\n if (name === 'manifest') {\n manifest = schema;\n return;\n }\n\n if (schema.hasOwnProperty('endpoint')) {\n var res = /\\.(post|put|delete|get)/g.exec(name);\n\n if (res && !schema.hasOwnProperty('http_method')) {\n schema.http_method = res[1].toUpperCase();\n }\n\n var root = /([a-z0-9\\-_]+)/i.exec(schema.endpoint);\n root = root[0];\n\n if (!endpoints.hasOwnProperty(root)) {\n endpoints[root] = {};\n }\n\n var uid_name = schema.http_method.toUpperCase()+' '+schema.endpoint;\n endpoints[root][uid_name] = schema;\n endpoint_map[uid_name] = schema;\n } else {\n \n }\n }", "function connect(schema) {\n _opts.url = schema + '.json';\n let _schema = {};\n _modelsPath = schema.replace('/_schemas', '/db/');\n\n if (h.isValidPath(schema + '.json')) {\n _schema.url = schema + '.json';\n _schema.content = require(_schema.url);\n _self._schema = _schema;\n if (_schema.content) {\n _self = loadCollections(_schema.content, _self);\n }\n\n return _self;\n } else {\n throw new Error(`The schema url:\n [${_opts.url}]\ndoes not seem to be valid. Recheck the path and try again`);\n }\n}", "function create(feed) {\n return opdsSchema.generate(feed, {\n //version: '1.0',\n //encoding: 'UTF-8',\n standalone: true,\n pretty: true,\n });\n}", "function exportIodocs(src){\n var obj = clone(src,false);\n obj.swagger = '2.0';\n obj.info = {};\n obj.info.version = obj.version || '1';\n obj.info.title = obj.name;\n obj.info.description = obj.description;\n obj.paths = {};\n\n var u = url.parse(obj.basePath+obj.publicPath);\n obj.schemes = [];\n obj.schemes.push(u.protocol.replace(':',''));\n obj.host = u.host;\n obj.basePath = u.path;\n\n delete obj.version;\n delete obj.title;\n delete obj.description;\n delete obj.publicPath;\n delete obj.privatePath; // for oauth etc\n delete obj.protocol;\n delete obj.name;\n delete obj.auth; // TODO\n delete obj.oauth; // TODO\n delete obj.headers; // TODO\n rename(obj,'schemas','definitions');\n if (obj.definitions) fixSchema(obj.definitions);\n\n for (var r in obj.resources) {\n var resource = obj.resources[r];\n // do tags\n for (var m in resource.methods) {\n var method = resource.methods[m];\n method.path = fixPathParameters(method.path);\n\n if (!obj.paths[method.path]) obj.paths[method.path] = {};\n var path = obj.paths[method.path];\n\n var httpMethod = method.httpMethod.toLowerCase();\n if (!path[httpMethod]) path[httpMethod] = {};\n\n var op = path[httpMethod];\n op.operationId = m;\n op.description = method.description;\n op.parameters = [];\n\n for (var p in method.parameters) {\n var param = method.parameters[p];\n param.name = p;\n if (param.title) rename(param,'title','name');\n if ((param.type == 'textarea') || (param.type == 'enumerated')) param.type = 'string';\n if (param.type == 'long') param.type = 'number';\n if (param.type == 'string[]') {\n param.type = 'array';\n param.items = {};\n param.items.type = 'string';\n }\n rename(param,'location','in');\n if (!param[\"in\"]) {\n if (method.path.indexOf('{'+param.name+'}')>=0) {\n param[\"in\"] = 'path';\n }\n else {\n param[\"in\"] = 'query';\n }\n }\n if ((param[\"in\"] == 'body') && (param.type != 'object')) {\n param[\"in\"] = 'formData'; // revalidate\n }\n if (param[\"in\"] == 'pathReplace') {\n param[\"in\"] = 'path';\n }\n if (param[\"in\"] == 'path') {\n param.required = true;\n }\n if (typeof param.required == 'string') {\n param.required = (param.required === 'true');\n }\n if (param.properties) {\n delete param.type;\n param.schema = {};\n param.schema.type = 'object';\n param.schema.properties = param.properties;\n delete param.properties;\n delete param[\"default\"];\n fixSchema(param.schema);\n }\n if (param.items) fixSchema(param.items);\n op.parameters.push(param);\n }\n op.tags = [];\n op.tags.push(r);\n\n op.responses = {};\n op.responses[\"200\"] = {};\n op.responses[\"200\"].description = 'Success';\n\n }\n }\n\n delete obj.resources;\n return obj;\n}", "create(schemaName, callable){\n const blueprint = new CreateBlueprint(schemaName);\n callable(blueprint);\n\n this.blueprints.push(blueprint);\n }", "constructor() {\n super();\n this.name = 'serverless-plugin-swagger-endpoints';\n }", "defineSchema() {\n\n }", "function _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}", "function _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}", "function generateEndpointURL () {\n var querystring = $.param({\n advisor_profile_id: this[options.advisorIdAttribute],\n start_at: this[options.startDateAttribute].toISOString(),\n ndays: options.nDays\n });\n return API_ENDPOINT + '?' + querystring;\n }", "function generateEndpointURL () {\n var querystring = $.param({\n start_at: this[options.startDateAttribute].toISOString(),\n ndays: options.nDays\n });\n return routes('sliced_back_office_advisor_profile_availabilities', {\n advisor_profile_id: this[options.advisorIdAttribute],\n format: 'json'\n }) + '?' + querystring;\n }", "function _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n }", "static get(name, id, opts) {\n return new Endpoint(name, undefined, Object.assign(Object.assign({}, opts), { id: id }));\n }", "getSchema(_class, body){\n const [name, schema] = _class.constructor.name.split('Handler'); //Getting name and schema from class from which this function called e.g User and Schema\n \n const className = `${name}Handler${schema}Index`; // Creating a className by joining name and schema e.g UserHandlerSchemaIndex \n \n const requiredClass = require(path.join(__dirname,this.indexPath,className)); // Creating a required class to call a specific validation function.\n\n const bodyIndex = new requiredClass(this.Joi); // Passing Joi Validator to the Class.\n\n return bodyIndex[body](); // Calling Validation function to validate the body e.g create()\n }", "addPayloadEndpoint(opts) {\n if (this.event.payload.endpoints === undefined) this.event.payload.endpoints = [];\n\n this.event.payload.endpoints.push(this.createPayloadEndpoint(opts));\n }", "function _createInstanceIndexResource(_, instance, endpoint, options, prototype) {\n\tfunction _getFacetVal(aVal) {\n\t\treturn (typeof aVal === \"object\") ? aVal.$value : aVal;\n\t}\n\n\tfunction _computeUrl(_, inst) {\n\t\tvar url = null;\n\t\tvar device = \"desktop\"; // by default desktop\n\t\tif (prototype && prototype.$links) {\n\t\t\t// get the right default url for the device\n\n\t\t\tObject.keys(prototype.$links).map(function(key) {\n\t\t\t\tif (key.indexOf(\"$search\") === 0 && prototype.$links[key].$devices === device && prototype.$links[key].$default && !url) {\n\t\t\t\t\tentity.$urlTemplate.expression = prototype.$links[key].$url;\n\t\t\t\t\turl = entity.$urlTemplate;\n\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tif (!url) {\n\t\t\turl = entity.$urlTemplate;\n\t\t}\n\t\telasticHelpers.debugTrace(options, \"compute url: \" + sys.inspect(entity.$urlTemplate));\n\t\treturn url && url.resolve({\n\t\t\t$baseUrl: endpoint.getBaseUrl(_),\n\t\t\t$key: instance.computeKey()\n\t\t});\n\t}\n\n\tfunction _computeSite(_, inst) {\n\t\tif (prototype && inst && inst._data && prototype.$site && inst._data[prototype.$site]) {\n\t\t\treturn inst._data[prototype.$site];\n\t\t}\n\t\treturn null;\n\t}\n\n\n\tfunction decodeTemplate(_, inst, templ) {\n\t\tif (!templ) return;\n\t\tvar template = templ;\n\t\tif (typeof templ === \"string\") template = new resourceProxy.Template(templ);\n\t\tvar res = template.expression;\n\t\tif (!template.matches) return res;\n\t\ttemplate.matches.forEach_(_, function(_, match) {\n\t\t\tvar prop = match.substring(1, match.length - 1);\n\t\t\tif (inst._meta.$properties[prop]) res = res.replace(match, resourceHelpers.formatValue(inst._meta.$properties[prop], inst[prop](_)) || \"\");\n\t\t\telse if (inst._meta.$relations[prop]) {\n\t\t\t\tif (inst._meta.$relations[prop].isPlural) res = res.replace(match, inst[prop](_).toArray(_).map_(_, function(_, elem) {\n\t\t\t\t\treturn decodeTemplate(_, elem, inst._meta.$relations[prop].targetEntity.$valueTemplate);\n\t\t\t\t}).join(\",\"));\n\t\t\t\telse res = res.replace(match, decodeTemplate(_, inst[prop](_), inst._meta.$relations[prop].targetEntity.$valueTemplate));\n\t\t\t}\n\t\t});\n\t\treturn res;\n\t}\n\tvar opt = options || {};\n\telasticHelpers.debugTrace(options, \"ElasticIndex.createResource: enter: \" + instance.$uuid);\n\tvar entity = instance.getEntity(_);\n\t// get prototype\n\tvar facets = entity.getSearchFacets(_);\n\tvar inst = instance;\n\tvar data = {};\n\tvar searchFields = entity.getSearchFields(_);\n\t// manage right\n\n\t(entity.getSearchFields(_) || []).forEach_(_, function(_, field) {\n\t\tvar val = null;\n\t\tvar p;\n\n\t\tif (field !== \"$access\" && (p = entity.$properties[field])) {\n\t\t\tval = resourceHelpers.formatValue(p, inst[field](_));\n\t\t} else if (p = entity.$relations[field]) {\n\t\t\tvar rel = entity.$relations[field];\n\t\t\tvar relData = inst[field](_);\n\t\t\tvar childOpt = opt;\n\t\t\tif (rel.getIsChild()) {\n\t\t\t\tchildOpt = _unfixFunctionsOptions(opt);\n\t\t\t\tchildOpt.isChild = true;\n\t\t\t}\n\t\t\tif (rel.isPlural) {\n\t\t\t\trelData.toArray(_).forEach_(_, function(_, item) {\n\t\t\t\t\t(val = val || []).push(rel.getIsChild() ? _createInstanceIndexResource(_, item, endpoint, childOpt, prototype) : {\n\t\t\t\t\t\t$key: item.computeKey(),\n\t\t\t\t\t\t$value: decodeTemplate(_, item, rel.targetEntity.$valueTemplate)\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (relData) {\n\t\t\t\t\tval = rel.getIsChild() ? _createInstanceIndexResource(_, relData, endpoint, childOpt, prototype) : {\n\t\t\t\t\t\t$key: relData.computeKey(),\n\t\t\t\t\t\t$value: decodeTemplate(_, relData, rel.targetEntity.$valueTemplate)\n\t\t\t\t\t};\n\t\t\t\t} else val = null;\n\t\t\t}\n\n\t\t}\n\t\telasticHelpers.debugTrace(options, \"ElasticIndex.createResource: compute field: \" + field + \"; value: \" + val);\n\t\t//\n\t\tif (val) {\n\t\t\tdata[field] = val;\n\t\t\t// facets is a structure like\n\t\t\t// {\n\t\t\t//\t\tclassField: [\"facet1Name\", \"facet2Name\"]\n\t\t\t// }\n\t\t\t// one field can be part of several facets\n\t\t\tif (facets && facets[field]) facets[field].forEach(function(f) {\n\t\t\t\telasticHelpers.debugTrace(options, \"ElasticIndex.createResource: field facet: \" + f);\n\t\t\t\tdata[\"facet_\" + f] = Array.isArray(val) ? val.map(_getFacetVal) : _getFacetVal(val);\n\t\t\t});\n\t\t}\n\t});\n\t// add some data to the resource\n\t(opt.rawData || []).forEach_(_, function(_, relName) {\n\t\telasticHelpers.debugTrace(options, \"ElasticIndex.createResource: set rawData for relation: \" + relName);\n\t\tvar rel = entity.$relations[relName];\n\t\tif (!rel) return;\n\t\tdata[\"$rawData\"] = data[\"$rawData\"] || {};\n\t\tvar relData = inst[relName](_);\n\t\tif (rel.isPlural) relData.toArray(_).forEach_(_, function(_, item) {\n\t\t\t(data.$rawData[relName] = data.$rawData[relName] || []).push(item.$uuid);\n\t\t});\n\t\telse if (relData) {\n\t\t\tdata.$rawData[relName] = relData.$uuid;\n\t\t\telasticHelpers.debugTrace(options, \"ElasticIndex.createResource: rawData found for \" + relName + \": \" + relData.$uuid);\n\t\t}\n\t});\n\tif (data && Object.keys(data).length !== 0) { // only if data is not empty to don't store un\n\t\tif (!options.isFunctionIndex) {\n\t\t\tdata[\"$access\"] = inst.$access ? inst.$access.toLowerCase() : \"_all\"; // regexp only work on lowercase\n\t\t} else {\n\t\t\tdata[\"$access\"] = data.fusionFunction ? data.fusionFunction.toLowerCase() : \"_all\"; // regexp only work on lowercase\n\t\t}\n\n\t\tif (!options.isFunctionIndex) {\n\t\t\tvar siteVal = _computeSite(_, inst);\n\t\t\tdata[\"$site\"] = siteVal ? siteVal.toLowerCase() : \"_all\"; // regexp only work on lowercase\n\n\t\t}\n\t}\n\telasticHelpers.debugTrace(options, \"ElasticIndex.createResource: compute templates\");\n\tif (!(options && options.isChild)) {\n\t\tdata.$description = decodeTemplate(_, inst, entity.$summaryTemplate || entity.$valueTemplate);\n\t\tif (entity.$iconTemplate) data.$icon = decodeTemplate(_, inst, entity.$iconTemplate);\n\t\t//\n\t\tvar url = (opt.computeUrl || _computeUrl)(_, instance);\n\t\tif (url) data.$url = url; // default url\n\n\t\tvar method = opt.computeUrlMethod && opt.computeUrlMethod(_, instance);\n\t\tif (method) data.$method = method;\n\t}\n\t//\n\treturn data;\n}", "function service(arg) {\n if (_typeof(arg) === 'object') {\n // When we add query params, our backend will complain if we don't have a\n // trailing slash.\n var path = arg.path.slice(-1) === '/' ? arg.path : arg.path.concat('/');\n var url = new URL(endpoint.concat(path));\n\n if ('params' in arg) {\n for (var key in arg.params) {\n if (arg.params.hasOwnProperty(key)) {\n var val = arg.params[key];\n url.searchParams.append(key, val);\n }\n }\n }\n\n return url;\n } else {\n return endpoint.concat(arg);\n }\n}", "_bundle (schema){\n return SwaggerParser.bundle(schema);\n }", "function renderEndPointShapes(edge) {\n if(!edge){\n return;\n }\n\n var edge_pts = anchorPointUtilities.getAnchorsAsArray(edge);\n if(typeof edge_pts === 'undefined'){\n edge_pts = [];\n } \n var sourcePos = edge.sourceEndpoint();\n var targetPos = edge.targetEndpoint();\n\n // This function is called inside refreshDraws which is called\n // for updating Konva shapes on events, but sometimes these values\n // will be NaN and Konva will show warnings in console as a result\n // This is a check to eliminate those cases since if these values \n // are NaN nothing will be drawn anyway.\n if (!sourcePos.x || !targetPos.x) {\n return;\n }\n\n edge_pts.unshift(sourcePos.y);\n edge_pts.unshift(sourcePos.x);\n edge_pts.push(targetPos.x);\n edge_pts.push(targetPos.y); \n\n \n if(!edge_pts)\n return;\n\n var src = {\n x: edge_pts[0],\n y: edge_pts[1]\n }\n\n var target = {\n x: edge_pts[edge_pts.length-2],\n y: edge_pts[edge_pts.length-1]\n }\n\n var nextToSource = {\n x: edge_pts[2],\n y: edge_pts[3]\n }\n var nextToTarget = {\n x: edge_pts[edge_pts.length-4],\n y: edge_pts[edge_pts.length-3]\n }\n var length = getAnchorShapesLength(edge) * 0.65;\n \n renderEachEndPointShape(src, target, length,nextToSource,nextToTarget);\n \n }", "constructor(baseEndpoint = '') {\n this[FIELDS.emitter] = new EventEmitter();\n this[FIELDS.baseEndpoint] = baseEndpoint;\n }", "function CreateEndpointCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "schema() { }", "function wrapEndpoint(model, fn, options)\n{\n return function (req, res, next)\n {\n const args = gatherArgs(req, options);\n return fn\n .apply(model, args)\n .then(result =>\n {\n res.status(200).send(result);\n })\n .catch(next);\n };\n}", "getEndpoints(options) {\n\n let _this = this,\n allEndpoints = [],\n foundEndpoints = [];\n\n // Get all functions\n for (let i = 0; i < Object.keys(_this.project.components).length; i++) {\n let component = _this.project.components[Object.keys(_this.project.components)[i]];\n if (!component.modules) continue;\n for (let j = 0; j < Object.keys(component.modules).length; j++) {\n let module = component.modules[Object.keys(component.modules)[j]];\n if (!module.functions) continue;\n for (let k = 0; k < Object.keys(module.functions).length; k++) {\n let func = module.functions[Object.keys(module.functions)[k]];\n for (let l = 0; l < func.endpoints.length; l++) {\n allEndpoints.push(func.endpoints[l]);\n }\n }\n }\n }\n\n // Return if no options specified\n if (!options) return allEndpoints;\n if (options && Object.keys(options).length === 1 && options.returnPaths === true) return allEndpoints.map(function(d) { return d._config.sPath });\n\n // If options specified, loop through functions and find the ones specified\n for (let i = 0; i < allEndpoints.length; i++) {\n let endpoint = allEndpoints[i];\n\n if (options.component && options.module && options.function && options.endpointPath && options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function && endpoint.path == options.endpointPath && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.function && options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function && endpoint.path == options.endpointPath) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.function && options.endpointMethod && !options.endpointPath) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.function && !options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint._config.function == options.function) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && options.endpointMethod && !options.function && !options.endpointPath) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.module && !options.function && !options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component && endpoint._config.module == options.module) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && options.endpointMethod && !options.module && !options.function && !options.endpointPath) {\n if (endpoint._config.component == options.component && endpoint.method == options.endpointMethod) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.component && !options.module && !options.function && !options.endpointPath && !options.endpointMethod) {\n if (endpoint._config.component == options.component) {\n foundEndpoints.push(options.returnPaths ? endpoint._config.sPath : endpoint);\n }\n continue;\n }\n if (options.paths && options.paths.indexOf(endpoint._config.sPath) !== -1) {\n foundEndpoints.push(endpoint);\n continue;\n }\n }\n\n return foundEndpoints;\n }", "function route(endpoint){\n app.get(`/${endpoint}`, (req, res)=>{\n if (endpoint !== \"\") {\n sqlDB.connect(config, ()=>{\n const request = new sqlDB.Request();\n request.query(`SELECT * FROM ${endpoint}`, (err, result)=>{\n if (err) console.log(err);\n res.send(result.recordset);\n });\n })\n }\n else res.send(\"Hello, you have reached contacts-api. Please navigate to /contacts, /categories, or /companies to continue.\");\n })\n}", "function _getIngestEndpoint(dsn) {\n\t return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n\t}", "init (schema) {\n console.log('[Port] Initializing schema', schema)\n\n // Convert JS code to string\n if (schema.model.code && (typeof schema.model.code !== 'string')) {\n console.log('[Port] Convert code in schema to string')\n schema.model.code = schema.model.code.toString()\n }\n\n // Check for worker flag\n if (typeof schema.model.worker === 'undefined') {\n schema.model.worker = true\n }\n\n // Check if name is present, if not - get name from the file\n if (typeof schema.model.name === 'undefined') {\n // Two options here\n if (schema.model.url) {\n // 1. Get the name from the file name\n schema.model.name = schema.model.url.split('/').pop().split('.')[0]\n console.log('[Port] Use name from url: ', schema.model.name)\n } else if (schema.model.code) {\n // 2. Get the name from the url\n schema.model.name = schema.model.code.name\n console.log('[Port] Use name from code: ', schema.model.name)\n }\n }\n\n this.schema = clone(schema)\n\n if (this.params.portContainer) {\n console.log('[Port] Init port element')\n // Get layout name\n const layout = (this.schema.design && this.schema.design.layout) ? this.schema.design.layout : 'blocks'\n const portElement = htmlToElement(templates[layout])\n this.params.portContainer.appendChild(portElement)\n // Get input, output and model containers\n this.inputsContainer = portElement.querySelector('#inputs')\n this.outputsContainer = portElement.querySelector('#outputs')\n this.modelContainer = portElement.querySelector('#model')\n // Make run button active\n if (!this.schema.model.autorun) {\n let runButton = portElement.querySelector('#run')\n runButton.style.display = 'inline-block'\n runButton.onclick = () => {\n this.run()\n }\n }\n } else {\n this.inputsContainer = this.params.inputsContainer\n this.outputsContainer = this.params.outputsContainer\n this.modelContainer = this.params.modelContainer\n }\n\n // Init overlay\n this.inputsContainer.appendChild(this.overlay)\n\n console.log('[Port] Init inputs, outputs and model description')\n\n // Update model URL if needed\n if (this.schema.model.url && !this.schema.model.url.includes('/') && this.schemaUrl && this.schemaUrl.includes('/')) {\n let oldModelUrl = this.schema.model.url\n console.log(this.schemaUrl)\n this.schema.model.url = window.location.protocol + '//' + window.location.host + this.schemaUrl.split('/').slice(0, -1).join('/') + '/' + oldModelUrl\n console.log('[Port] Changed the old model URL to absolute one:', oldModelUrl, this.schema.model.url)\n }\n\n // Iniitialize model description\n if (this.modelContainer && this.schema.model) {\n if (this.schema.model.title) {\n let h = document.createElement('h4')\n h.className = 'port-title'\n h.innerText = this.schema.model.title\n this.modelContainer.appendChild(h)\n }\n if (this.schema.model.description) {\n let desc = document.createElement('p')\n desc.className = 'model-info'\n desc.innerText = this.schema.model.description + ' '\n let a = document.createElement('a')\n a.innerText = '→'\n a.href = this.schema.model.url\n desc.appendChild(a)\n this.modelContainer.appendChild(desc)\n }\n }\n\n // Initialize inputs\n this.schema.inputs.forEach((input, i) => {\n console.log(input)\n let element\n switch (input.type) {\n case 'int':\n case 'float':\n case 'string':\n element = new elements.InputElement(input)\n break\n case 'checkbox':\n element = new elements.CheckboxElement(input)\n break\n case 'range':\n element = new elements.RangeElement(input)\n window['M'].Range.init(element.inputElement)\n break\n case 'text':\n element = new elements.TextareaElement(input)\n break\n case 'select':\n case 'categorical':\n element = new elements.SelectElement(input)\n break\n case 'file':\n element = new elements.FileElement(input)\n break\n case 'image':\n element = new elements.ImageElement(input)\n break\n }\n\n if (input.onchange && !element.inputElement.onchange) {\n setTimeout(() => {\n this.output(input.onchange(element.getValue()))\n }, 0)\n }\n\n // Add onchange listener to original input element if model has autorun flag\n if (this.schema.model.autorun || input.reactive || input.onchange) {\n if (input.type === 'file') {\n element.cb = this\n } else {\n element.inputElement.onchange = () => {\n console.log('[Input] Change event')\n if (input.onchange) {\n this.output(input.onchange(element.getValue()))\n }\n if (this.schema.model.autorun || input.reactive) {\n this.run()\n }\n }\n }\n }\n\n // Add element to input object\n input.element = element\n this.inputsContainer.appendChild(element.element)\n })\n\n // Init Material framework\n var selectElements = document.querySelectorAll('select')\n window['M'].FormSelect.init(selectElements, {})\n\n // Init Model\n // ----------\n if (this.schema.model.type === 'py') {\n // Add loading indicator\n this._showOverlay()\n let script = document.createElement('script')\n script.src = 'https://pyodide.cdn.iodide.io/pyodide.js'\n script.onload = () => {\n window['M'].toast({html: 'Loaded: Python'})\n window['languagePluginLoader'].then(() => {\n fetch(this.schema.model.url)\n .then(res => res.text())\n .then(res => {\n console.log('[Port] Loaded python code:', res)\n this.pymodel = res\n // Here we filter only import part to know load python libs\n let imports = res.split('\\n').filter(str => (str.includes('import ')) && !(str.includes('#')) && !(str.includes(' js '))).join('\\n')\n console.log('Imports: ', imports)\n window['pyodide'].runPythonAsync(imports, () => {})\n .then((res) => {\n window['M'].toast({html: 'Loaded: Dependencies'})\n this._hideOverlay()\n })\n .catch((err) => {\n console.log(err)\n window['M'].toast({html: 'Error loading libs'})\n this._hideOverlay()\n })\n })\n .catch((err) => {\n console.log(err)\n window['M'].toast({html: 'Error loading python code'})\n this._hideOverlay()\n })\n })\n }\n document.head.appendChild(script)\n } else if (['function', 'class', 'async-init', 'async-function'].includes(this.schema.model.type)) {\n // Initialize worker with the model\n if (this.schema.model.worker) {\n this.worker = new Worker('./worker-temp.js')\n if (this.schema.model.url) {\n fetch(this.schema.model.url)\n .then(res => res.text())\n .then(res => {\n console.log('[Port] Loaded js code for worker')\n this.schema.model.code = res\n this.worker.postMessage(this.schema.model)\n })\n } else if (typeof this.schema.model.code !== 'undefined') {\n this.worker.postMessage(this.schema.model)\n } else {\n window['M'].toast({html: 'Error. No code provided'})\n }\n\n this.worker.onmessage = (e) => {\n this._hideOverlay()\n const data = e.data\n console.log('[Port] Response from worker:', data)\n if ((typeof data === 'object') && (data._status)) {\n switch (data._status) {\n case 'loaded':\n window['M'].toast({html: 'Loaded: JS model (in worker)'})\n break\n }\n } else {\n this.output(data)\n }\n }\n this.worker.onerror = (e) => {\n this._hideOverlay()\n window['M'].toast({html: e.message, classes: 'error-toast'})\n console.log('[Port] Error from worker:', e)\n }\n } else {\n // Initialize model in main window\n console.log('[Port] Init model in window')\n let script = document.createElement('script')\n script.src = this.schema.model.url\n script.onload = () => {\n window['M'].toast({html: 'Loaded: JS model'})\n this._hideOverlay()\n console.log('[Port] Loaded JS model in main window')\n\n // Initializing the model (same in worker)\n if (this.schema.model.type === 'class') {\n console.log('[Port] Init class')\n const modelClass = new window[this.schema.model.name]()\n this.modelFunc = (...a) => {\n return modelClass[this.schema.model.method || 'predict'](...a)\n }\n } else if (this.schema.model.type === 'async-init') {\n console.log('[Port] Init function with promise')\n window[this.schema.model.name]().then((m) => {\n console.log('[Port] Async init resolved: ', m)\n this.modelFunc = m\n })\n } else {\n console.log('[Port] Init function')\n this.modelFunc = window[this.schema.model.name]\n }\n }\n document.head.appendChild(script)\n }\n } else if (this.schema.model.type === 'tf') {\n // Initialize TF\n let script = document.createElement('script')\n script.src = 'dist/tf.min.js'\n script.onload = () => {\n console.log('[Port] Loaded TF.js')\n this._hideOverlay()\n window['tf'].loadLayersModel(this.schema.model.url).then(res => {\n console.log('[Port] Loaded Tensorflow model')\n })\n }\n document.head.appendChild(script)\n }\n\n // Init render\n // -----------\n if (this.schema.render && this.schema.render.url) {\n console.log('[Port] Init render in window')\n let script = document.createElement('script')\n script.src = this.schema.render.url\n script.onload = () => {\n window['M'].toast({html: 'Loaded: JS render'})\n console.log('[Port] Loaded JS render')\n\n // Initializing the render (same in worker)\n if (this.schema.render.type === 'class') {\n console.log('[Port] Init render as class')\n const renderClass = new window[this.schema.render.name]()\n this.renderFunc = (...a) => {\n return renderClass[this.schema.render.method || 'render'](...a)\n }\n } else if (this.schema.render.type === 'async-init') {\n console.log('[Port] Init render function with promise')\n window[this.schema.render.name]().then((m) => {\n console.log('[Port] Async rebder init resolved: ', m)\n this.renderFunc = m\n })\n } else {\n console.log('[Port] Init render as function')\n this.renderFunc = window[this.schema.render.name]\n }\n }\n document.head.appendChild(script)\n }\n }", "constructor(endpoint, calls = ['list', 'getById', 'create', 'update', 'remove']) {\n this.endpoint = endpoint;\n this.calls = calls;\n }", "createSchema() {\n this.schema = this.extensionManager.schema;\n }", "function buildUrl(schema) {\n return function (domain, path) {\n console.log(`${schema}://${domain}/${path}`); \n }\n }", "refreshEndpoints() {\n this._parsedEndpoints = this._parseEndpoints();\n }", "getHaxJSONSchema(type,haxProperties,target=this){return this.HAXWiring.getHaxJSONSchema(type,haxProperties,target)}", "refreshEndpointList() {\n return __awaiter(this, void 0, void 0, function* () {\n let writableLocations = [];\n let readableLocations = [];\n let databaseAccount;\n if (this.enableEndpointDiscovery) {\n databaseAccount = yield this._getDatabaseAccount();\n if (databaseAccount) {\n writableLocations = databaseAccount.WritableLocations;\n readableLocations = databaseAccount.ReadableLocations;\n }\n // Read and Write endpoints will be initialized to default endpoint if we were not able\n // to get the database account info\n [this.writeEndpoint, this.readEndpoint] = yield this._updateLocationsCache(writableLocations, readableLocations);\n this.isEndpointCacheInitialized = true;\n return [this.writeEndpoint, this.readEndpoint];\n }\n else {\n return [this.writeEndpoint, this.readEndpoint];\n }\n });\n }", "function check_for_endpoints(){\n \t\tvar first_item = -1\n \t\t\t, end_item = -1;\n \t\tfor(var i=0; i<elements_array.length; i++){\n \t\t\tif(elements_array[i].type == 'START'){\n \t\t\t\tfor(var x=0; x<connections_array.length; x++){\n \t\t\t\t\tif(elements_array[i].connect_id == connections_array[x].source){\n \t\t\t\t\t\tfirst_item = connections_array[x].target; // 'START' item's target\n \t\t\t\t\t}\t\n \t\t\t\t}\n \t\t\t} else if(elements_array[i].type == 'END'){\n/* \t\t\t\tfor(var x=0; x<connections_array.length; x++){\n \t\t\t\t\tif(elements_array[i].id == connections_array[x].target){\n \t\t\t\t\t\tend_item = connections_array[x].source;\n \t\t\t\t\t}\t\n \t\t\t\t}*/\n \t\t\t\tend_item = elements_array[i].id; // 'END' item\n \t\t\t}\n \t\t}\n \t\treturn {first_id: first_item, end_id: end_item};\n \t}", "validate( method, endpoint ) {\n\n // Capture the endpoints, and convert them into a regex.\n const endpoints = META.endpoints[method].map((endpoint) => new RegExp( endpoint.endpoint.replace(/:[^/]+/, '[^/]+?') ));\n\n // Valid endpoints should match against a regex.\n for(let i = 0; i < endpoints.length; i++ ) {\n\n // Test the endpoint against the regex.\n if( endpoints[i].test(endpoint) ) return true;\n\n }\n\n // Invalid endpoints will not match.\n return false;\n\n }", "function plugin(target){\n target.addBinding('validate',validateBinding);\n target.addBinding('resolveLinks',resolveLinksBinding);\n target.addBinding('subschema',subschemaBinding);\n target.addBinding('coerce',coerceBinding);\n}", "get endpoints() {\n return this.getListAttribute('endpoints');\n }", "function JsdService(SchemaObj) {\n BaseObj.call(this);\n\n // The schema definition.\n this.definition = {};\n\n if (isDef(SchemaObj)) {\n this.definition = SchemaObj;\n }\n}", "function iodocsUpgrade(data){\n \tvar data = data['endpoints'];\n\tvar newResource = {};\n\tnewResource.resources = {};\n\tfor (var index2 = 0; index2 < data.length; index2++) {\n\t\tvar resource = data[index2];\n\t\tvar resourceName = resource.name;\n\t\tnewResource.resources[resourceName] = {};\n\t\tnewResource.resources[resourceName].methods = {};\n\t\tvar methods = resource.methods;\n\t\tfor (var index3 = 0; index3 < methods.length; index3++) {\n\t\t\tvar method = methods[index3];\n\t\t\tvar methodName = method['MethodName'];\n\t\t\tvar methodName = methodName.split(' ').join('_');\n\t\t\tnewResource.resources[resourceName].methods[methodName] = {};\n\t\t\tnewResource.resources[resourceName].methods[methodName].name = method['MethodName'];\n\t\t\tnewResource.resources[resourceName].methods[methodName]['httpMethod'] = method['HTTPMethod'];\n\t\t\tnewResource.resources[resourceName].methods[methodName]['path'] = method['URI'];\n\t\t\tnewResource.resources[resourceName].methods[methodName].parameters = {};\n\t\t\tif (!method.parameters) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar parameters = method.parameters;\n\t\t\tfor (var index4 = 0; index4 < parameters.length; index4++) {\n\t\t\t\tvar param = parameters[index4];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name] = {};\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['title'] = param.name;\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['required'] = (param['Required'] == 'Y');\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['default'] = param['Default'];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['type'] = param['Type'];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['description'] = param['Description'];\n\t\t\t}\n\t\t}\n\t}\n return newResource;\n}", "async function createOrUpdateSchema() {\n const subscriptionId =\n process.env[\"LOGIC_SUBSCRIPTION_ID\"] || \"34adfa4f-cedf-4dc0-ba29-b6d1a69ab345\";\n const resourceGroupName = process.env[\"LOGIC_RESOURCE_GROUP\"] || \"testResourceGroup\";\n const integrationAccountName = \"testIntegrationAccount\";\n const schemaName = \"testSchema\";\n const schema = {\n content:\n '<?xml version=\"1.0\" encoding=\"utf-16\"?>\\r\\n<xs:schema xmlns:b=\"http://schemas.microsoft.com/BizTalk/2003\" xmlns=\"http://Inbound_EDI.OrderFile\" targetNamespace=\"http://Inbound_EDI.OrderFile\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:schemaInfo default_pad_char=\" \" count_positions_by_byte=\"false\" parser_optimization=\"speed\" lookahead_depth=\"3\" suppress_empty_nodes=\"false\" generate_empty_nodes=\"true\" allow_early_termination=\"false\" early_terminate_optional_fields=\"false\" allow_message_breakup_of_infix_root=\"false\" compile_parse_tables=\"false\" standard=\"Flat File\" root_reference=\"OrderFile\" />\\r\\n <schemaEditorExtension:schemaInfo namespaceAlias=\"b\" extensionClass=\"Microsoft.BizTalk.FlatFileExtension.FlatFileExtension\" standardName=\"Flat File\" xmlns:schemaEditorExtension=\"http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:element name=\"OrderFile\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:recordInfo structure=\"delimited\" preserve_delimiter_for_empty_data=\"true\" suppress_trailing_delimiters=\"false\" sequence_number=\"1\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:complexType>\\r\\n <xs:sequence>\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:groupInfo sequence_number=\"0\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:element name=\"Order\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:recordInfo sequence_number=\"1\" structure=\"delimited\" preserve_delimiter_for_empty_data=\"true\" suppress_trailing_delimiters=\"false\" child_delimiter_type=\"hex\" child_delimiter=\"0x0D 0x0A\" child_order=\"infix\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:complexType>\\r\\n <xs:sequence>\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:groupInfo sequence_number=\"0\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:element name=\"Header\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:recordInfo sequence_number=\"1\" structure=\"delimited\" preserve_delimiter_for_empty_data=\"true\" suppress_trailing_delimiters=\"false\" child_delimiter_type=\"char\" child_delimiter=\"|\" child_order=\"infix\" tag_name=\"HDR|\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:complexType>\\r\\n <xs:sequence>\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:groupInfo sequence_number=\"0\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:element name=\"PODate\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"1\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"PONumber\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo justification=\"left\" sequence_number=\"2\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"CustomerID\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"3\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"CustomerContactName\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"4\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"CustomerContactPhone\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"5\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n </xs:sequence>\\r\\n </xs:complexType>\\r\\n </xs:element>\\r\\n <xs:element minOccurs=\"1\" maxOccurs=\"unbounded\" name=\"LineItems\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:recordInfo sequence_number=\"2\" structure=\"delimited\" preserve_delimiter_for_empty_data=\"true\" suppress_trailing_delimiters=\"false\" child_delimiter_type=\"char\" child_delimiter=\"|\" child_order=\"infix\" tag_name=\"DTL|\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:complexType>\\r\\n <xs:sequence>\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:groupInfo sequence_number=\"0\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n <xs:element name=\"PONumber\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"1\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"ItemOrdered\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"2\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"Quantity\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"3\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"UOM\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"4\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"Price\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"5\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"ExtendedPrice\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"6\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n <xs:element name=\"Description\" type=\"xs:string\">\\r\\n <xs:annotation>\\r\\n <xs:appinfo>\\r\\n <b:fieldInfo sequence_number=\"7\" justification=\"left\" />\\r\\n </xs:appinfo>\\r\\n </xs:annotation>\\r\\n </xs:element>\\r\\n </xs:sequence>\\r\\n </xs:complexType>\\r\\n </xs:element>\\r\\n </xs:sequence>\\r\\n </xs:complexType>\\r\\n </xs:element>\\r\\n </xs:sequence>\\r\\n </xs:complexType>\\r\\n </xs:element>\\r\\n</xs:schema>',\n contentType: \"application/xml\",\n location: \"westus\",\n metadata: {},\n schemaType: \"Xml\",\n tags: { integrationAccountSchemaName: \"IntegrationAccountSchema8120\" },\n };\n const credential = new DefaultAzureCredential();\n const client = new LogicManagementClient(credential, subscriptionId);\n const result = await client.integrationAccountSchemas.createOrUpdate(\n resourceGroupName,\n integrationAccountName,\n schemaName,\n schema\n );\n console.log(result);\n}", "get convertedSchema() {\n let schema = {\n $schema: \"http://json-schema.org/schema#\",\n title: this.label,\n type: \"object\",\n required: [],\n properties: this.fieldsToSchema(this.fields),\n };\n return schema;\n }", "function getEndpoint(routeList, route_only){\n var route = \"\";\n for(var i in routeList){\n route = route.concat(routeList[i],'/');\n }\n if(route_only === true){\n return {route:route}\n } else {\n return {ref:db.ref().child(route), route:route};\n }\n}", "static Edge(begin, end) {\n return new Edge({\n begin: begin,\n end: end\n });\n }", "function generateEndpointURL () {\n var querystring = $.param({\n advisor_profile_id: this[options.advisorIdAttribute],\n start_at: this[options.startDateAttribute].toISOString(),\n ndays: options.nDays\n });\n return routes('back_office_availabilities', { format: 'json' }) + '?' + querystring;\n }", "postProcessgetHaxJSONSchema(schema){return this.HAXWiring.postProcessgetHaxJSONSchema(schema)}", "function finalizeRequest(endpoint, data) {\n\n // No need to do anything if the URL is static (no parameters)\n if (!endpoint.parameters) {\n return { url: endpoint.url, payload: data };\n }\n\n // Swap all the parameter placeholders with the arguments.\n let url = endpoint.url;\n for (let index = 0; index < Object.keys(endpoint.parameters).length; index++) {\n if (data[endpoint.parameters[index]] === null || data[endpoint.parameters[index]] === undefined) {\n throw new Error(\"URL Path parameter missing\");\n }\n\n url = url.replace(`{${index}}`, data[endpoint.parameters[index]]);\n delete data[endpoint.parameters[index]];\n }\n\n return { url, payload: data };\n}", "endpoint(path, stream=false) {\n const _endpoint = !stream ? this._endpoint : this._stream;\n\t\treturn `${_endpoint}${path}.json`;\n\t}", "function optionalDiscoverEndpoint(request) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var endpoints = AWS.endpointCache.get(cacheKey);\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //or endpoint operation just failed in 1 minute\n return;\n } else if (endpoints && endpoints.length > 0) {\n //found endpoint record from cache\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n } else {\n //endpoint record not in cache or outdated. make discovery operation\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n addApiVersionHeader(endpointRequest);\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1\n }]);\n endpointRequest.send(function(err, data) {\n if (data && data.Endpoints) {\n AWS.endpointCache.put(cacheKey, data.Endpoints);\n } else if (err) {\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute\n }]);\n }\n });\n }\n}", "function optionalDiscoverEndpoint(request) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var endpoints = AWS.endpointCache.get(cacheKey);\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //or endpoint operation just failed in 1 minute\n return;\n } else if (endpoints && endpoints.length > 0) {\n //found endpoint record from cache\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n } else {\n //endpoint record not in cache or outdated. make discovery operation\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n addApiVersionHeader(endpointRequest);\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1\n }]);\n endpointRequest.send(function(err, data) {\n if (data && data.Endpoints) {\n AWS.endpointCache.put(cacheKey, data.Endpoints);\n } else if (err) {\n AWS.endpointCache.put(cacheKey, [{\n Address: '',\n CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute\n }]);\n }\n });\n }\n}", "function discoverEndpoint(request, done) {\n var service = request.service || {};\n if (hasCustomEndpoint(service) || request.isPresigned()) return done();\n\n if (!isEndpointDiscoveryApplicable(request)) return done();\n\n request.httpRequest.appendToUserAgent('endpoint-discovery');\n\n var operations = service.api.operations || {};\n var operationModel = operations[request.operation];\n var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';\n switch (isEndpointDiscoveryRequired) {\n case 'OPTIONAL':\n optionalDiscoverEndpoint(request);\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n done();\n break;\n case 'REQUIRED':\n request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);\n requiredDiscoverEndpoint(request, done);\n break;\n case 'NULL':\n default:\n done();\n break;\n }\n}", "function createConnection () {\n connection = App.models.endpoint({\n id: options.connectTo,\n client: client,\n onMessage: renderReply\n });\n }", "function convertSwagger(source){\n var apiInfo = clone(source,false);\n apiInfo.resources = {};\n\n\tif (apiInfo.servers && apiInfo.servers.length) {\n\t\tvar u = url.parse(apiInfo.servers[0].url);\n\t\tapiInfo.host = u.host;\n\t\tapiInfo.basePath = u.path;\n\t\tapiInfo.schemes = [];\n\t\tapiInfo.schemes.push(u.protocol.replace(':',''));\n\t}\n\n for (var p in apiInfo.paths) {\n for (var m in apiInfo.paths[p]) {\n if ('.get.post.put.delete.head.patch.options.trace.'.indexOf(m)>=0) {\n var sMethod = apiInfo.paths[p][m];\n var ioMethod = {};\n ioMethod.httpMethod = m.toUpperCase();\n var sMethodUniqueName = sMethod.operationId ? sMethod.operationId : m+'_'+p.split('/').join('_');\n sMethodUniqueName = sMethodUniqueName.split(' ').join('_'); // TODO {, } and : ?\n ioMethod.name = sMethodUniqueName;\n ioMethod.summary = sMethod.summary;\n ioMethod.description = sMethod.description;\n ioMethod.parameters = {};\n var sParams = sMethod.parameters ? sMethod.parameters : [];\n if (apiInfo.paths[p].parameters) {\n sParams = sParams.concat(apiInfo.paths[p].parameters);\n }\n for (var p2 in sParams) {\n var param = sParams[p2];\n var ptr = param[\"$ref\"];\n if (ptr && ptr.startsWith('#/parameters/')) {\n ptr = ptr.replace('#/parameters/','');\n param = clone(apiInfo.parameters[ptr],false);\n }\n if (ptr && ptr.startsWith('#/components/parameters/')) {\n ptr = ptr.replace('#/components/parameters/','');\n param = clone(apiInfo.components.parameters[ptr],false);\n }\n param.location = param[\"in\"];\n delete param[\"in\"];\n\t\t\t\t\tif (!param.type && param.schema && param.schema.type) {\n\t\t\t\t\t\tparam.type = param.schema.type;\n\t\t\t\t\t}\n ioMethod.parameters[param.name] = param;\n }\n ioMethod.path = p;\n ioMethod.responses = sMethod.responses;\n var tagName = 'Default';\n if (sMethod.tags && sMethod.tags.length>0) {\n tagName = sMethod.tags[0];\n }\n if (!apiInfo.resources[tagName]) {\n apiInfo.resources[tagName] = {};\n if (apiInfo.tags) {\n for (var t in apiInfo.tags) {\n var tag = apiInfo.tags[t];\n if (tag.name == tagName) {\n apiInfo.resources[tagName].description = tag.description;\n apiInfo.resources[tagName].externalDocs = tag.externalDocs;\n }\n }\n }\n }\n if (!apiInfo.resources[tagName].methods) apiInfo.resources[tagName].methods = {};\n apiInfo.resources[tagName].methods[sMethodUniqueName] = ioMethod;\n }\n }\n }\n delete apiInfo.paths; // to keep size down\n if (apiInfo.definitions) rename(apiInfo,'definitions','schemas');\n if (apiInfo.components && apiInfo.components.schemas) rename(apiInfo,'components.schemas','schemas');\n return apiInfo;\n}", "getSchemas() {\n return {\n indices: this.getIndices(),\n mappings: this.getMappings()\n };\n }", "convertSchemaToAjvFormat (schema) {\n if (schema === null) return\n\n if (schema.type === 'string') {\n schema.fjs_type = 'string'\n schema.type = ['string', 'object']\n } else if (\n Array.isArray(schema.type) &&\n schema.type.includes('string') &&\n !schema.type.includes('object')\n ) {\n schema.fjs_type = 'string'\n schema.type.push('object')\n }\n for (const property in schema) {\n if (typeof schema[property] === 'object') {\n this.convertSchemaToAjvFormat(schema[property])\n }\n }\n }", "async function endpointsCreateOrUpdateAzureStorageBlobContainer() {\n const subscriptionId =\n process.env[\"STORAGEMOVER_SUBSCRIPTION_ID\"] || \"60bcfc77-6589-4da2-b7fd-f9ec9322cf95\";\n const resourceGroupName = process.env[\"STORAGEMOVER_RESOURCE_GROUP\"] || \"examples-rg\";\n const storageMoverName = \"examples-storageMoverName\";\n const endpointName = \"examples-endpointName\";\n const endpoint = {\n properties: {\n description: \"Example Storage Blob Container Endpoint Description\",\n blobContainerName: \"examples-blobcontainer\",\n endpointType: \"AzureStorageBlobContainer\",\n storageAccountResourceId:\n \"/subscriptions/60bcfc77-6589-4da2-b7fd-f9ec9322cf95/resourceGroups/examples-rg/providers/Microsoft.Storage/storageAccounts/examplesa\",\n },\n };\n const credential = new DefaultAzureCredential();\n const client = new StorageMoverClient(credential, subscriptionId);\n const result = await client.endpoints.createOrUpdate(\n resourceGroupName,\n storageMoverName,\n endpointName,\n endpoint\n );\n console.log(result);\n}", "function requiredDiscoverEndpoint(request, done) {\n var service = request.service;\n var api = service.api;\n var operationModel = api.operations ? api.operations[request.operation] : undefined;\n var inputShape = operationModel ? operationModel.input : undefined;\n\n var identifiers = marshallCustomIdentifiers(request, inputShape);\n var cacheKey = getCacheKey(request);\n if (Object.keys(identifiers).length > 0) {\n cacheKey = util.update(cacheKey, identifiers);\n if (operationModel) cacheKey.operation = operationModel.name;\n }\n var cacheKeyStr = AWS.EndpointCache.getKeyString(cacheKey);\n var endpoints = AWS.endpointCache.get(cacheKeyStr); //endpoint cache also accepts string keys\n if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {\n //endpoint operation is being made but response not yet received\n //push request object to a pending queue\n if (!requestQueue[cacheKeyStr]) requestQueue[cacheKeyStr] = [];\n requestQueue[cacheKeyStr].push({request: request, callback: done});\n return;\n } else if (endpoints && endpoints.length > 0) {\n request.httpRequest.updateEndpoint(endpoints[0].Address);\n done();\n } else {\n var endpointRequest = service.makeRequest(api.endpointOperation, {\n Operation: operationModel.name,\n Identifiers: identifiers,\n });\n endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);\n addApiVersionHeader(endpointRequest);\n\n //put in a placeholder for endpoints already requested, prevent\n //too much in-flight calls\n AWS.endpointCache.put(cacheKeyStr, [{\n Address: '',\n CachePeriodInMinutes: 60 //long-live cache\n }]);\n endpointRequest.send(function(err, data) {\n if (err) {\n var errorParams = {\n code: 'EndpointDiscoveryException',\n message: 'Request cannot be fulfilled without specifying an endpoint',\n retryable: false\n };\n request.response.error = util.error(err, errorParams);\n AWS.endpointCache.remove(cacheKey);\n\n //fail all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.response.error = util.error(err, errorParams);\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n } else if (data) {\n AWS.endpointCache.put(cacheKeyStr, data.Endpoints);\n request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n\n //update the endpoint for all the pending requests in batch\n if (requestQueue[cacheKeyStr]) {\n var pendingRequests = requestQueue[cacheKeyStr];\n util.arrayEach(pendingRequests, function(requestContext) {\n requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address);\n requestContext.callback();\n });\n delete requestQueue[cacheKeyStr];\n }\n }\n done();\n });\n }\n}", "static async create(context, faker) {\n const obj = new SchemaHelper(context, faker);\n }" ]
[ "0.6567618", "0.563212", "0.54849434", "0.54841", "0.5437757", "0.5389481", "0.5346032", "0.53214276", "0.52909744", "0.5205821", "0.5177365", "0.51664466", "0.5159697", "0.5092623", "0.5089627", "0.5069809", "0.5061949", "0.50262016", "0.5016462", "0.49969277", "0.49825656", "0.49483395", "0.4943889", "0.49064496", "0.49064496", "0.49064496", "0.4890194", "0.48776254", "0.48249775", "0.47902107", "0.46701664", "0.46592134", "0.46332482", "0.4631965", "0.46222955", "0.46216017", "0.46194026", "0.46132863", "0.45990297", "0.45618898", "0.45607558", "0.45607558", "0.45546493", "0.45463336", "0.45270717", "0.45255944", "0.4519242", "0.4492849", "0.44915968", "0.44881985", "0.44839293", "0.44839293", "0.44828627", "0.44679108", "0.4459883", "0.44588506", "0.4446974", "0.44451407", "0.44362947", "0.4435009", "0.44311804", "0.44305223", "0.44280106", "0.44246337", "0.44236085", "0.44228703", "0.4422778", "0.44197404", "0.44191802", "0.44115457", "0.4410213", "0.44079572", "0.44064873", "0.43989915", "0.43936795", "0.43866566", "0.4381209", "0.43702716", "0.43621072", "0.43618423", "0.43528393", "0.43470156", "0.4344305", "0.43379435", "0.43371755", "0.4330668", "0.43240413", "0.43105367", "0.4307789", "0.4303977", "0.4277068", "0.4277068", "0.4271715", "0.42684653", "0.42674348", "0.42645928", "0.4262511", "0.42617533", "0.4252773", "0.42521057" ]
0.7860793
0
Log output of generator. Works just like console.log
log(...args) { if (this.options && this.options.debug) { console.log(...args); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output() {\n if (debugEnabled) {\n return console.log.apply(this, arguments);\n }\n}", "function log()\n {\n var l = arguments.length;\n var thing;\n var obs_l;\n var ob;\n var output = \"\";\n\n for (var i = 0; i < l; i++)\n {\n obs = [];\n\n thing = arguments[i];\n if (typeof thing == \"string\")\n output += thing + \"\\t\";\n else\n output += stringify(thing) + \" \";\n\n obs_l = obs.length;\n while (obs_l--)\n {\n ob = obs[obs_l];\n delete ob.__CONSOLE_VISITED__;\n }\n }\n\n print(output);\n }", "function _log() {\n if (typeof (console) !== \"undefined\") {\n console.log('==START==');\n for (var i = 0; i < arguments.length; i++) {\n console.log(arguments[i]);\n }\n console.log('==END==');\n }\n }", "log() {\n if (this.debug) {\n console.log(...arguments)\n }\n }", "log() {\n\t\tconsole.log(this.toString());\n\t}", "function log() {\n\t return stream.write(util.format.apply(this, arguments) + '\\n');\n\t}", "function log() {\n\t return stream.write(util.format.apply(this, arguments) + '\\n');\n\t}", "function log() {\n\t return stream.write(util.format.apply(this, arguments) + '\\n');\n\t}", "function log() {\n\t return stream.write(util.format.apply(this, arguments) + '\\n');\n\t}", "function log() {\n\t return stream.write(util.format.apply(this, arguments) + '\\n');\n\t}", "function log() {\n\t return stream.write(util.format.apply(this, arguments) + '\\n');\n\t}", "function log() {\n\t return stream.write(util.format.apply(this, arguments) + '\\n');\n\t}", "function log() {\n return stream.write(util.format.apply(this, arguments) + '\\n');\n }", "_log() {\n if (this.debug) {\n console.log(...arguments);\n }\n }", "function _log() {\n // nodejs\n if (typeof module !== 'undefined' && module.exports) {\n for (var i in arguments) {\n process.stdout.write(arguments[i]);\n }\n } else {\n console.log(arguments);\n }\n}", "break() {\n this.write('log', '', null, false);\n }", "function log() {\n\t\t return stream.write(util.format.apply(util, arguments) + '\\n');\n\t\t}", "function log() {\n\t return stream.write(util.format.apply(util, arguments) + '\\n');\n\t}", "function log() {\n\t return stream.write(util.format.apply(util, arguments) + '\\n');\n\t}", "output (...msg) {\n log.clearProgress()\n // eslint-disable-next-line no-console\n console.log(...msg)\n log.showProgress()\n }", "function output(result){ console.log(result); }", "log (message) {\n // eslint-disable-next-line no-console\n if (this.verbose) console.log(message)\n }", "function log() {\n dump(Array.slice(arguments).join(' ') + '\\n');\n }", "function log(err, stdout, stderr, cb) {\n console.log(stdout);\n cb();\n }", "function log() {\n if (programArgs.verbose) {\n console.log(Array.prototype.slice.apply(arguments).join(' '));\n }\n}", "function log() {\n return stream.write(util.format.apply(this, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(this, arguments) + '\\n');\n}", "function log() {\n console.log(arguments);\n }", "function logHelper(){\n\tconsole.log(\"-------------------------------------------------------------------------------\");\n\n\tfor(let i=0; i<arguments.length; ++i){\n\t\tconsole.log(arguments[i]);\n\t}\n}", "function log() {\n return stream.write(util.format.apply(this, arguments) + '\\n');\n}", "function log() {\n if (logging) {\n for (let i = 0; i < logBody.length; i++)\n console.log(logBody[i])\n }\n }", "logger() {\n console.log({\n acc: this.acc,\n operator: this.operator,\n leftOperand: this.leftOperand,\n rightOperand: this.rightOperand,\n state: this.state\n })\n }", "function write() {\n console.log(\"TODO: Implement write\", arguments);\n }", "function l(input) {\n\n\tif(writeLogs === true) {\n\t\tconsole.log(input);\n\t}\n}", "function log() {\n\t console.log('%s - %s', timestamp(), format.apply(null, arguments));\n\t}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n\t console.log('%s - %s', timestamp(), format$1.apply(null, arguments));\n\t}", "function log() {\n console.log('%s - %s', timestamp(), format.apply(null, arguments));\n }", "printDebugLog() {\n this.printMemoryForDebug(this.memory, this.pointer);\n console.debug(`pointer is at ${this.pointer}`);\n console.debug(`relative base is ${this.base}`);\n console.debug(`flags: J:${this.flags.jumped ? 'X' : '-'}`);\n console.debug(`input queue: ${this.input}`);\n console.debug(`output queue: ${this.output}`);\n console.debug('');\n }", "function log() {\n return stream.write(util$3.format.apply(util$3, arguments) + '\\n');\n}", "function log() {\n return stream.write(util$3.format.apply(util$3, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function log() {\n return stream.write(util.format.apply(util, arguments) + '\\n');\n}", "function Logger(number, result) {\n console.log(`#${number} : ${JSON.stringify(result)}`);\n}", "function log() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n}", "function log(){\r\n\r\n var message = '\\n';\r\n\r\n for ( let i = 0; i < arguments.length; i++ )\r\n message += '\\t' + arguments[i] + '\\n';\r\n\r\n console.log( message );\r\n}", "_log (str) {\n if (this.context.runnerOptions.stream) console.log(str)\n else this._logs.push(str)\n }", "function log(){\r\n var msg = '[gandalf] ' + Array.prototype.join.call(arguments, '');\r\n if (window.console && window.console.log) {\r\n window.console.log(msg);\r\n }\r\n }", "log() {}", "function msg() {\n if (!check.assigned(message.get('log'))) {\n console.log(arguments[0]);\n return;\n }\n message.get('log').put(arguments[0], arguments[1], __filename.split('/').pop(), arguments.callee.caller.name.toString());\n }", "function log() {\n if (console && typeof console.log === 'function') {\n for (var i = 0, ii = arguments.length; i < ii; i++) {\n console.log(arguments[i]);\n }\n }\n }" ]
[ "0.6642426", "0.64244914", "0.6358331", "0.628039", "0.6263746", "0.6221142", "0.6221142", "0.6221142", "0.6221142", "0.6221142", "0.6221142", "0.6221142", "0.621446", "0.6173134", "0.6168273", "0.6126686", "0.6117331", "0.6096275", "0.6096275", "0.6094995", "0.6085013", "0.6052374", "0.6033003", "0.6028545", "0.5996068", "0.5982942", "0.5982942", "0.59666324", "0.5960853", "0.5951474", "0.59447867", "0.59344035", "0.59336865", "0.5922571", "0.59099275", "0.59099257", "0.59099257", "0.59099257", "0.5907534", "0.5893307", "0.5891802", "0.5891802", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.58612007", "0.5846716", "0.58429337", "0.5825118", "0.5805793", "0.58050984", "0.58014363", "0.5801042", "0.57915485" ]
0.5876745
42
Generate all APIs and return as inmemory object.
async discoverAllAPIs(discoveryUrl) { const headers = this.options.includePrivate ? {} : { 'X-User-Ip': '0.0.0.0' }; const res = await this.transporter.request({ url: discoveryUrl, headers, }); const items = res.data.items; const apis = await Promise.all(items.map(async (api) => { const endpointCreator = await this.discoverAPI(api.discoveryRestUrl); return { api, endpointCreator }; })); const versionIndex = {}; // tslint:disable-next-line no-any const apisIndex = {}; for (const set of apis) { if (!apisIndex[set.api.name]) { versionIndex[set.api.name] = {}; apisIndex[set.api.name] = (options) => { const type = typeof options; let version; if (type === 'string') { version = options; options = {}; } else if (type === 'object') { version = options.version; delete options.version; } else { throw new Error('Argument error: Accepts only string or object'); } try { const ep = // tslint:disable-next-line: no-any set.endpointCreator(options, this); return Object.freeze(ep); // create new & freeze } catch (e) { throw new Error(util.format('Unable to load endpoint %s("%s"): %s', set.api.name, version, e.message)); } }; } versionIndex[set.api.name][set.api.version] = set.endpointCreator; } return apisIndex; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "generateModels() {\n let models_constructor = new ModelConstructor(openapi_dictionary, guiModels);\n return models_constructor.generateModels(this.api.openapi);\n }", "async _generateAssets (apis, token) {\n\t\tconsole.log('Building Resources');\n\t\tconst assetParams = [];\n\t\tfor (let api of apis.value) {\n\t\t\tconst swagger = await this._getSwagger(api.name, token);\n\t\t\tconst swaggerJson = JSON.parse(swagger).value;\n\t\t\tconst apiServiceName = `${api.name}`;\n\t\t\tconst apiServiceRevisionName = `${apiServiceName}-${api.properties.apiRevision}`;\n\t\t\tconst apiProperties = api && api.properties || {};\n\t\t\tconst displayName = apiProperties.displayName || '';\n\t\t\tconst attributes = {\n\t\t\t\tazureServiceName: this.config.serviceName,\n\t\t\t\tazureResourceGroupName: this.config.resourceGroupName,\n\t\t\t\tazureApiName: apiServiceName\n\t\t\t};\n\t\t\tconst environmentName = this.config.environmentName;\n\t\t\tconst apiDescription = apiProperties.description || '';\n\t\t\tconst swaggerEncoded = Buffer.from(JSON.stringify(swaggerJson)).toString('base64');\n\t\t\tconst host = swaggerJson.host;\n\t\t\tconst basePath = swaggerJson.basePath;\n\t\t\tconst version = api.versionGroup || '0.1';\n\t\t\tconst webhookUrl = this.config.webhookUrl || '';\n\t\t\tconst icon = this.config.icon;\n\t\t\tconst iconData = getIconData(icon);\n\t\t\t\n\t\t\t// Create Resource Definitions\n\t\t\tconst apiService = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'APIService',\n\t\t\t\tname: apiServiceName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tdescription: apiDescription,\n\t\t\t\t\ticon: iconData\n\t\t\t\t}\n\t\t\t};\n\t\t\n\t\t\tconst apiServiceRevision = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'APIServiceRevision',\n\t\t\t\tname: apiServiceRevisionName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tapiService: apiServiceName,\n\t\t\t\t\tdefinition: {\n\t\t\t\t\t\ttype: 'oas2',\n\t\t\t\t\t\tvalue: swaggerEncoded\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\n\t\t\tconst apiServiceInstance = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'APIServiceInstance',\n\t\t\t\tname: apiServiceName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tapiServiceRevision: apiServiceRevisionName,\n\t\t\t\t\tendpoint: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thost: host,\n\t\t\t\t\t\t\tprotocol: 'https',\n\t\t\t\t\t\t\tport: 443\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\tconst consumerInstanceInstance = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'ConsumerInstance',\n\t\t\t\tname: apiServiceName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tapiServiceInstance: apiServiceName,\n\t\t\t\t\tstate: 'PUBLISHED',\n\t\t\t\t\tsubscription: {\n\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\tautoSubscribe: false,\n\t\t\t\t\t\tsubscriptionDefinition: 'consumersubdef'\n\t\t\t\t\t},\n\t\t\t\t\tversion: version,\n\t\t\t\t\ttags: (attributes ? Object.values(attributes) : [])\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tif (basePath) {\n\t\t\t\tapiServiceInstance.spec.endpoint[0].routing = { basePath: basePath };\n\t\t\t}\n\n\t\t\t// Save to FS\n\t\t\tcommitToFs(apiService, this.config.outputDir, [\n\t\t\t\tapiService,\n\t\t\t\tapiServiceRevision,\n\t\t\t\tapiServiceInstance,\n\t\t\t\tconsumerInstanceInstance\n\t\t\t]);\n\t\t}\n\t\treturn;\n\t}", "async generateResources () {\n\t\tconsole.log('Logging into Azure');\n\t\tconst token = JSON.parse(await this._authorize()).access_token;\n\t\tconsole.log('Listing Azure APIs');\n\t\tconst apis = JSON.parse(await this._listAPIs(token));\n\t\treturn this._generateAssets(apis, token);\n\t}", "apiDefinationGeneratorTest(obj) {\n let newProps = {};\n newProps['methods'] = {};\n newProps['properties'] = {};\n newProps['name'] = obj.constructor.name;\n\n if (obj.version) {\n newProps['version'] = obj.version;\n }\n\n newProps['events'] = {\n 'listening': [this, this.listening],\n 'wssError': [this, this.wssError],\n 'wssConnection': [this, this.wssOnConnection],\n 'wssMessage': [this, this.wssOnMessage],\n };\n\n do {\n //console.log(obj);\n for (let index of Object.getOwnPropertyNames(obj)) {\n if (obj[index]) {\n if ((typeof obj[index]) == 'function') {\n let jsDoc = ''\n\n // The constructor function contains all the code for the class,\n // including the comments between functions which is where the\n // jsDoc definition for the function lives.\n if (obj['constructor']) {\n let done = false;\n\n // The first line of this specific function will be the last line\n // in the constructor we need to look at. The relevant jsDoc\n // should be right above.\n let firstLine = obj[index].toString().split(/\\n/)[0];\n\n // We are going to parse every line of the constructor until we\n // find the first line of the function we're looking for.\n for (let line of obj['constructor'].toString().split(/\\n/)) {\n if (!done) {\n // Start of a new jsDoc segment. Anything we already have is\n // not related to this function.\n if (line.match(/\\/\\*\\*/)) {\n jsDoc = line + '\\n';\n }\n\n // There should be no lines that start with a \"}\" within the\n // jsDoc definition so if we find one we've meandered out of\n // the jsDoc definition. This makes sure that later\n // functions that have no jsDoc defition don't get jsDoc\n // definitions from earlier functions (the earlier functions\n // will end with \"}\").\n else if (line.replace(/^\\s*/g, '').match(/^}/)) {\n jsDoc = '';\n }\n\n // If this line from the constructor matches the first line\n // from this function (with leading whitespace removed), we\n // have what we came for. Don't process future lines.\n else if (line.replace(/^\\s*/g, '') == firstLine) {\n done = true;\n }\n\n // Either this line is part of the jsDoc or it's junk, Either\n // way, append it to the jsDoc we're extracting. If it's\n // junk it will be cleared by the start of the next jsDoc\n // segment or the end of a function.\n else {\n jsDoc += line + '\\n';\n }\n }\n }\n }\n\n // Now we just tidy up the jsDoc fragment we extracted. More to do\n // here.\n if (jsDoc.match(/\\/\\*\\*/)) {\n jsDoc = jsDoc.split(/\\/\\*\\*/)[1];\n }\n else {\n jsDoc = '';\n }\n if (jsDoc.match(/\\*\\//)) {\n jsDoc = jsDoc.split(/\\*\\//)[0];\n }\n\n let functionProperties = obj[index];\n functionProperties['namedArguments'] = {};\n functionProperties['numberedArguments'] = [];\n functionProperties['private'] = false;\n functionProperties['description'] = '';\n functionProperties['returns'] = '';\n if (jsDoc.length > 0) {\n jsDoc = jsDoc.replace(/^\\s*/mg, '');\n for (let line of (jsDoc.split(/\\n/))) {\n if (line.match(/^\\@private/i)) {\n functionProperties['private'] = true;\n }\n else if (line.match(/^\\@param/i)) {\n let parsedLine = this.parseJsDocLine(line);\n functionProperties['numberedArguments'].push(parsedLine)\n functionProperties['namedArguments'][parsedLine[0]] = parsedLine;\n }\n else if (line.match(/^\\@return/i)) {\n functionProperties['returns'] = line;\n }\n else {\n functionProperties['description'] += line;\n }\n }\n //console.log(index);\n //console.log(jsDoc);\n //console.log(functionProperties);\n newProps['methods'][index] = functionProperties;\n newProps['methods'][index]['uri'] = index;\n }\n }\n else if (typeof obj[index] != 'object') {\n newProps['properties'][index] = {\n 'uri': index,\n 'getter': 'TODO'\n }\n }\n else {\n //console.log(\"not a function: \", index, typeof obj[index]);\n }\n }\n }\n } while (obj = Object.getPrototypeOf(obj));\n\n return newProps;\n }", "construct(self) {\n var obj = {};\n this.paths.forEach((val, path) => {\n const key = path.slice(1).replace(/ [a-z]/, x => x[1].toUpperCase(1));\n switch (val.constructor) {\n case PlatformApiFunction:\n obj[key] = input => val.impl.call(self, input);\n break;\n case PlatformApiGetter:\n obj[key] = () => val.impl.call(self);\n break;\n default: throw new Error(\n `PlatformApi had path of weird constructor ${val.constructor}`);\n }\n });\n }", "function makeApiFiles(api, apiOutputDir, sourceDir, libname) {\n var apiHeaderTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabAPI.h.ejs\")));\n var apiCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabAPI.cpp.ejs\")));\n var apiPlayFabModelTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModels.h.ejs\")));\n var apiPlayFabModelCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModels.cpp.ejs\")));\n var apiPlayFabModelDecoderHTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModelDecoder.h.ejs\")));\n var apiPlayFabModelDecoderCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModelDecoder.cpp.ejs\")));\n \n var generatedHeader;\n var generatedBody;\n var apiLocals = {};\n apiLocals.api = api;\n apiLocals.hasClientOptions = api.name === \"Client\";\n apiLocals.sdkVersion = exports.sdkVersion;\n apiLocals.libname = libname;\n \n generatedHeader = apiHeaderTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"API.h\"), generatedHeader);\n generatedBody = apiCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"API.cpp\"), generatedBody);\n \n generatedHeader = apiPlayFabModelTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"Models.h\"), generatedHeader);\n generatedBody = apiPlayFabModelCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"Models.cpp\"), generatedBody);\n \n generatedHeader = apiPlayFabModelDecoderHTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"ModelDecoder.h\"), generatedHeader);\n generatedBody = apiPlayFabModelDecoderCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"ModelDecoder.cpp\"), generatedBody);\n}", "function getPublicApi() {\n return {\n\n };\n }", "generateOperations() {\n if (this._Operations) {\n return;\n }\n\n this._signHeadersList = this._signHeadersList || this.signHeadersList; // backward support\n this._serviceName = this._serviceName || this.serviceName;\n this._serviceVersion = this._serviceVersion || this.serviceVersion;\n\n // the holder class\n const Operations = function(needMeta, meta) {\n this.needMeta = needMeta;\n this.meta = meta;\n };\n\n // assign instance properties into prototype\n assign(Operations.prototype, this);\n\n // update supported methods, but need to bind it back to the original instance\n Operations.prototype.wmHeaders = this.wmHeaders.bind(this);\n\n this._Operations = Operations;\n\n // wrapper for each operation\n\n //\n // Each operation could specify multiple tags.\n // Each tag goes in swagger.apis[<tag>] as a group of all operations belonging to it\n // Any operations that don't have tags go into the default group.\n // In each group, there's apis object that holds the details of the operations inside it\n //\n each(this.swagger.apis, group => {\n if (!isFunction(group) && isObject(group)) {\n each(group, (fn, operationId) => {\n if (operationId !== \"help\" && isFunction(fn) && !Operations.prototype[operationId]) {\n const api = group.apis[operationId];\n const spec = this.swagger.spec.paths[api.path][api.method];\n Operations.prototype[operationId] = function swapiOperationWrapper(params, options) {\n const meta = this.useMeta();\n return apiFuncInvoke({\n api,\n spec,\n meta,\n client: this,\n fn,\n params,\n options: options || {},\n operationId\n });\n };\n // add details from Swagger\n Operations.prototype[operationId].details = group.operations[operationId];\n }\n });\n }\n });\n\n Operations.prototype.useMeta = function useMeta() {\n if (this.needMeta && !this.meta) {\n throw new Error(\"swapi operation needs meta\");\n }\n return this.meta;\n };\n\n Operations.prototype.invoke = function invoke(tag, operationId, params, options) {\n return invokeWithMeta({\n meta: this.useMeta(),\n client: this,\n tag,\n operationId,\n params,\n options\n });\n };\n }", "async function generate(opts) {\n const apiFinder = parse_1.parse(opts);\n const data = apiFinder(opts.api);\n const results = {\n ...opts,\n data,\n };\n if (opts.outputJsonPath) {\n await output_1.outputJson(opts.outputJsonPath, data);\n }\n if (opts.outputReadmePath) {\n await output_1.outputReadme(opts.outputReadmePath, data);\n }\n return results;\n}", "static makeAPICall(endpoint, input, options = {}) {\n switch (endpoint) {\n case GET_TOKEN:\n if (options.body === undefined) {\n options.body = {};\n }\n options.body.client_id = process.env.REACT_APP_CLIENT_ID;\n return this._fetchFromAPI(this.authUrlBeginning + \"token/\", options);\n case CREATE_USER:\n return this._fetchFromAPI(this.urlBeginning + \"createUser/\", options);\n case VALIDATE_TOKEN:\n return this._addAuthorization(this.urlBeginning + \"validateToken/\");\n case FORGOT_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/\", options);\n case RESET_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/confirm\", options);\n case UPLOAD_DOCUMENT:\n return this._addAuthorization(this.urlBeginning + \"uploadDoc/\", options);\n case UPLOAD_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"uploadAnnot/\", options);\n case GET_ALL_ANNOTE_BY_CURRENT_USER:\n return this._addAuthorization(this.urlBeginning + \"getAllMyAnnots/\" + (input == null ? \"\" : input));\n case GET_ALL_ANNOTE:\n return this._addAuthorization(this.urlBeginning + \"getAllAnnots/\" + (input == null ? \"\" : input));\n case GET_ANNOTATIONS_FILENAME_USER:\n return this._addAuthorization(this.urlBeginning + \"getAnnotationsByFilenameUser/\" + input + this.json);\n case EXPORT_CURRENT_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"exportAnnotations/\" + input + this.json);\n case DOWNLOAD_ANNOTATIONS_BY_ID:\n return this._addAuthorization(this.urlBeginning + \"downloadAnnotations/\" + input + this.json);\n\n // ICD APIs\n case ANCESTORS:\n return this._addAuthorization(this.urlBeginning + \"ancestors/\" + input + this.json);\n case FAMILY:\n return this._addAuthorization(this.urlBeginning + \"family/\" + input + this.json);\n case CODE_AUTO_SUGGESTIONS:\n return this._addAuthorization(this.urlBeginning + \"codeAutosuggestions/\" + input + this.json);\n case CODE_DESCRIPTION:\n return this._addAuthorization(this.urlBeginning + \"codeDescription/\" + input + this.json);\n default:\n return null;\n }\n }", "generateApiList() {\n return _globby(this.destinationPath('templates/'), {\n onlyDirectories: true,\n deep: false\n }).then((dirList) => {\n this._apiList = dirList.map((dir) => _path.basename(dir));\n if(this._apiList.length <= 0) {\n this.env.error('This project does not have any APIs to assign hooks to');\n }\n });\n }", "function API(){}", "function API(){}", "generateViews() {\n let views_constructor = new ViewConstructor(openapi_dictionary, this.models);\n return views_constructor.generateViews(View, this.api.openapi);\n }", "instantiateAll () {\n const files = this.findGeneratorFiles('./templates', /\\.js$/);\n\n files.forEach((filename) => {\n const Constructor = require(filename);\n const object = new Constructor();\n this.viewGenerators[object.constructor.name] = object;\n if (!this.viewGeneratorsContentType[object.getName()]) {\n this.viewGeneratorsContentType[object.getName()] = [];\n }\n this.viewGeneratorsContentType[object.getName()] = this.viewGeneratorsContentType[object.getName()].concat(object.getContentTypes());\n });\n }", "function Api() {\n \n //Calls the endpoint and returns the body.\n function fetch(endpoint) {\n //Avoid wrong input.\n url = (url.startsWith('http')) ? url : 'http://'+url;\n url = (url.endsWith('/')) ? url : url += '/';\n endpoint = (endpoint.startsWith('/')) ? endpoint.replace('/', '') : endpoint;\n const finUrl = url + endpoint;\n \n // To not break any existing scripts using pre-options syntax\n if (arguments.length === 3) {\n const options = arguments[1];\n const cb = arguments[2];\n const headers = (options[\"headers\"]) ? options[\"headers\"] : {};\n } else if (arguments.length === 2) {\n const cb = arguments[1];\n const headers = {};\n } else {\n const cb = function(){};\n const headers = {};\n }\n\n //TODO: If data has been preloaded or downloaded before, load the already downloaded data.\n \n request({\n url: finUrl,\n headers: headers\n }, function(error, response, body) {\n //Error cases\n if(error) cb(error);\n else if(response && response.statusCode == 400) cb('400 returned.');\n //TODO: Add more error cases (no body, error statusCodes, ...)\n else cb(undefined, body);\n })\n }\n\n //Set object methods with this\n this.fetch = fetch;\n}", "async genAccomodations(){\n //Not yet implemented\n }", "function ApiClient() {\n\n}", "function exportIodocs(src){\n var obj = clone(src,false);\n obj.swagger = '2.0';\n obj.info = {};\n obj.info.version = obj.version || '1';\n obj.info.title = obj.name;\n obj.info.description = obj.description;\n obj.paths = {};\n\n var u = url.parse(obj.basePath+obj.publicPath);\n obj.schemes = [];\n obj.schemes.push(u.protocol.replace(':',''));\n obj.host = u.host;\n obj.basePath = u.path;\n\n delete obj.version;\n delete obj.title;\n delete obj.description;\n delete obj.publicPath;\n delete obj.privatePath; // for oauth etc\n delete obj.protocol;\n delete obj.name;\n delete obj.auth; // TODO\n delete obj.oauth; // TODO\n delete obj.headers; // TODO\n rename(obj,'schemas','definitions');\n if (obj.definitions) fixSchema(obj.definitions);\n\n for (var r in obj.resources) {\n var resource = obj.resources[r];\n // do tags\n for (var m in resource.methods) {\n var method = resource.methods[m];\n method.path = fixPathParameters(method.path);\n\n if (!obj.paths[method.path]) obj.paths[method.path] = {};\n var path = obj.paths[method.path];\n\n var httpMethod = method.httpMethod.toLowerCase();\n if (!path[httpMethod]) path[httpMethod] = {};\n\n var op = path[httpMethod];\n op.operationId = m;\n op.description = method.description;\n op.parameters = [];\n\n for (var p in method.parameters) {\n var param = method.parameters[p];\n param.name = p;\n if (param.title) rename(param,'title','name');\n if ((param.type == 'textarea') || (param.type == 'enumerated')) param.type = 'string';\n if (param.type == 'long') param.type = 'number';\n if (param.type == 'string[]') {\n param.type = 'array';\n param.items = {};\n param.items.type = 'string';\n }\n rename(param,'location','in');\n if (!param[\"in\"]) {\n if (method.path.indexOf('{'+param.name+'}')>=0) {\n param[\"in\"] = 'path';\n }\n else {\n param[\"in\"] = 'query';\n }\n }\n if ((param[\"in\"] == 'body') && (param.type != 'object')) {\n param[\"in\"] = 'formData'; // revalidate\n }\n if (param[\"in\"] == 'pathReplace') {\n param[\"in\"] = 'path';\n }\n if (param[\"in\"] == 'path') {\n param.required = true;\n }\n if (typeof param.required == 'string') {\n param.required = (param.required === 'true');\n }\n if (param.properties) {\n delete param.type;\n param.schema = {};\n param.schema.type = 'object';\n param.schema.properties = param.properties;\n delete param.properties;\n delete param[\"default\"];\n fixSchema(param.schema);\n }\n if (param.items) fixSchema(param.items);\n op.parameters.push(param);\n }\n op.tags = [];\n op.tags.push(r);\n\n op.responses = {};\n op.responses[\"200\"] = {};\n op.responses[\"200\"].description = 'Success';\n\n }\n }\n\n delete obj.resources;\n return obj;\n}", "async function main() {\n const children = await readdir(apiPath);\n const dirs = children.filter(x => {\n return !x.endsWith('.ts') && !x.includes('compute');\n });\n const contents = nunjucks.render(templatePath, { apis: dirs });\n await writeFile(indexPath, contents);\n const q = new p_queue_1.default({ concurrency: 50 });\n console.log(`Generating docs for ${dirs.length} APIs...`);\n let i = 0;\n const promises = dirs.map(dir => {\n return q\n .add(() => execa(process.execPath, [\n '--max-old-space-size=8192',\n './node_modules/.bin/compodoc',\n `src/apis/${dir}`,\n '-d',\n `./docs/${dir}`,\n ]))\n .then(() => {\n i++;\n console.log(`[${i}/${dirs.length}] ${dir}`);\n });\n });\n await Promise.all(promises);\n}", "function runNgOpenApiGen() {\n return __awaiter(this, void 0, void 0, function* () {\n const options = cmd_args_1.parseOptions();\n const refParser = new json_schema_ref_parser_1.default();\n const input = options.input;\n try {\n const openApi = yield refParser.bundle(input, {\n dereference: {\n circular: false\n },\n resolve: {\n http: {\n timeout: options.fetchTimeout == null ? 20000 : options.fetchTimeout\n }\n }\n });\n const gen = new NgOpenApiGen(openApi, options);\n gen.generate();\n }\n catch (err) {\n console.error(`Error on API generation from ${input}: ${err}`);\n process.exit(1);\n }\n });\n}", "generate() {\n // Make sure the temporary directory is empty before starting\n gen_utils_1.deleteDirRecursive(this.tempDir);\n fs_extra_1.default.mkdirsSync(this.tempDir);\n try {\n // Generate each model\n const models = [...this.models.values()];\n for (const model of models) {\n this.write('model', model, model.fileName, 'models');\n }\n // Generate each service\n const services = [...this.services.values()];\n for (const service of services) {\n this.write('service', service, service.fileName, 'services');\n }\n // Context object passed to general templates\n const general = {\n services: services,\n models: models\n };\n // Generate the general files\n this.write('configuration', general, this.globals.configurationFile);\n this.write('response', general, this.globals.responseFile);\n this.write('requestBuilder', general, this.globals.requestBuilderFile);\n this.write('baseService', general, this.globals.baseServiceFile);\n if (this.globals.moduleClass && this.globals.moduleFile) {\n this.write('module', general, this.globals.moduleFile);\n }\n const modelImports = this.globals.modelIndexFile || this.options.indexFile\n ? models.map(m => new imports_1.Import(m.name, './models', m.options)) : null;\n if (this.globals.modelIndexFile) {\n this.write('modelIndex', Object.assign(Object.assign({}, general), { modelImports }), this.globals.modelIndexFile);\n }\n if (this.globals.serviceIndexFile) {\n this.write('serviceIndex', general, this.globals.serviceIndexFile);\n }\n if (this.options.indexFile) {\n this.write('index', Object.assign(Object.assign({}, general), { modelImports }), 'index');\n }\n // Now synchronize the temp to the output folder\n gen_utils_1.syncDirs(this.tempDir, this.outDir, this.options.removeStaleFiles !== false);\n console.info(`Generation from ${this.options.input} finished with ${models.length} models and ${services.length} services.`);\n }\n finally {\n // Always remove the temporary directory\n gen_utils_1.deleteDirRecursive(this.tempDir);\n }\n }", "function main() {\n return __awaiter(this, void 0, void 0, function* () {\n //My local development folders. Change if different.\n let d = 'C:/Users/Nlanson/Desktop/Coding/Yomi/test/data/manga'; //Location of manga\n let c = 'C:/Users/Nlanson/Desktop/Coding/Yomi/test/data/collections.json'; //Location of collections.json\n yield YomiInitialiser.run(d, c, 'prod');\n });\n}", "function Api(){\n}", "function Api() {\n _classCallCheck(this, Api);\n\n this.express = (0, _express2.default)();\n this.middleware();\n this.routes();\n this.generateDb();\n }", "async connect() {\n const _alice = '//Alice';\n const _bob = '//Bob';\n const _charlie = '//Charlie';\n const _dave = '//Dave';\n if (!self.api) {\n self.api = await ApiPromise.create({\n provider: self.wsProvider,\n types: {\n Address: 'MultiAddress',\n LookupSource: 'MultiAddress',\n },\n });\n }\n if (!self.myself) {\n self.myself = self.keyring.addFromUri(_alice);\n self.alice = self.keyring.addFromUri(_alice);\n self.bob = self.keyring.addFromUri(_bob);\n self.charlie = self.keyring.addFromUri(_charlie);\n self.dave = self.keyring.addFromUri(_dave);\n }\n return self.api;\n }", "compile() {\n console.log('Compiling', name);\n const fields = [];\n for (let [path, entry] of this.paths) {\n if (entry.constructor === PlatformApiGetter) {\n // TODO: nesting!\n fields.push(entry.type);\n }\n }\n this.structType.fields = fields;\n }", "createAPI(data) {\n return null;\n }", "build() {\n var $this = this;\n\n // Carregar parametros\n var version = this.config('build.version', '0.0.0');\n var name = this.config('build.config.php.name', 'netforce/sdk-php');\n var description = this.config('build.config.php.description', 'NetForce SDK PHP');\n var keyword = this.config('build.config.php.keyword', 'netforce');\n var ns = this.config('build.config.php.namespace', 'NetForce\\Sdk');\n\n // Preparar diretorios\n var pathBase = this.getPath('php', { version: this.config('build.version', '0.0.0') });\n var pathStubs = __dirname + '/php/src/stubs';\n\n // Se pasta existir deve limpar\n if (fs.existsSync(pathBase)) {\n rimraf.sync(pathBase);\n }\n\n var pathModels = path.resolve(pathBase, 'src', 'Models');\n var pathResources = path.resolve(pathBase, 'src', 'Resources');\n var pathServices = path.resolve(pathBase, 'src');\n\n // Arquivos /root\n //this.copyStub(__dirname + '/php/.gitignore', pathBase + '/.gitignore');\n this.copyStub(__dirname + '/php/composer.json', pathBase + '/composer.json', {\n ns : Str.replaceAll('\\\\\\\\', '\\\\\\\\', ns),\n version,\n name,\n description,\n keyword,\n });\n\n // Arquivos /src/Base\n this.copyStub(__dirname + '/php/src/Client.txt', pathBase + '/src/Base/Client.php', {\n ns : ns, \n version : version,\n env_production : this.config('build.endpoints.production', '???'),\n env_sandbox : this.config('build.endpoints.sandbox', '???'),\n env_local : this.config('build.endpoints.local', '???'),\n });\n this.copyStub(__dirname + '/php/src/Response.txt', pathBase + '/src/Base/Response.php', { ns });\n this.copyStub(__dirname + '/php/src/Resource.txt', pathBase + '/src/Base/Resource.php', { ns });\n this.copyStub(__dirname + '/php/src/Model.txt', pathBase + '/src/Base/Model.php', { ns });\n this.copyStub(__dirname + '/php/src/ApiClient.txt', pathServices + '/ApiClient.php', { ns });\n\n // Models /src/Models\n Arr.each(this.models, (key, model) => {\n $this.buildModel(pathModels, model, pathStubs, { ns });\n });\n \n // Resources /src/Resources\n Arr.each(this.resources, (key, resource) => {\n $this.buildResource(pathResources, resource, pathStubs, { ns });\n });\n \n // Services /src\n var services = [];\n Arr.each(this.services, (key, service) => {\n services.push($this.buildService(pathServices, service, pathStubs, { ns }));\n });\n }", "function RestApiGenerator(objection) {\n this._objection = objection;\n this._logger = _.noop;\n this._models = Object.create(null);\n this._findQueries = Object.create(null);\n this._routePrefix = '/';\n this._exclude = [];\n this._databaseGetter = null;\n this._adapter = expressAdapter;\n this._pluralizer = function (word) {\n return word + 's';\n };\n}", "function load () {\n const modules = registerModules(api)\n\n api.modules = modules\n\n return Promise.resolve(modules)\n }", "generate() {\n // 1. read custom resources\n this.readResources(this.serverless.service);\n\n // 2. read template outputs if any\n this.readOutputs(this.serverless.service);\n\n // 3. read functions\n this.readFunctions(this.serverless.service);\n\n // 4. create yaml\n return this.dumpYamlTemplate();\n }", "function generateApiSet(templateId) {\n return {\n create: function(options, callback) {\n\n options.data = Object(options.data);\n options.data._tp = [ObjectId(templateId)];\n\n CRUD.create({\n templateId: templateId,\n data: options.data,\n options: options.options,\n callback: callback\n });\n },\n read: function(options, callback) {\n CRUD.read({\n templateId: templateId,\n noJoins: options.noJoins,\n query: options.query,\n options: options.options,\n callback: callback\n });\n },\n update: function(options, callback) {\n CRUD.update({\n templateId: templateId,\n query: options.query,\n data: options.data,\n options: options.options,\n callback: callback\n });\n },\n delete: function(options, callback) {\n CRUD.delete({\n templateId: templateId,\n query: options.query,\n options: options.options,\n callback: callback\n });\n }\n };\n}", "constructor(apiEndpoint = null) {\n HttpHelper.apiEndpoint = apiEndpoint;\n\n this._auth = new Auth();\n this._accounts = new Accounts();\n this._products = new Products();\n this._deviceGroups = new DeviceGroups();\n this._devices = new Devices();\n this._deployments = new Deployments();\n this._logStreams = new LogStreams();\n this._webhooks = new Webhooks();\n }", "async function copyAPI() {\n for (const pkg of packages) {\n const packageDir = glob.sync(path.resolve(root, `packages/**/${pkg}`))[0];\n\n await safeCopy(\n path.resolve(packageDir, `dist/${pkg}.api.json`),\n `./src/docs/api/${pkg}.api.json`\n );\n }\n}", "async generate(){\r\n return this.call('generate',...(Array.from(arguments)));\r\n }", "function generateResourceListing(options) {\n const controllers = options.controllers;\n const opts = options.options || {};\n\n const paths = buildPaths(controllers);\n const definitions = buildDefinitions(controllers);\n\n const listing = {\n swagger: '2.0',\n info: {\n description: 'Baucis generated API',\n version: options.version,\n title: 'api'\n // termsOfService: 'TOS: to be defined.',\n // contact: {\n // email: 'me@address.com'\n // },\n // license: {\n // name: 'TBD',\n // url: 'http://license.com'\n // }\n },\n // host: null,\n basePath: options.basePath,\n tags: buildTags(options),\n schemes: ['http', 'https'],\n consumes: ['application/json'],\n produces: ['application/json', 'text/html'],\n paths,\n definitions,\n parameters: params.generateCommonParams()\n // responses: getReusableResponses(),\n // securityDefinitions: {},\n // security: [] // Must be added via extensions\n // externalDocs: null\n };\n\n if (opts.security) {\n listing.security = opts.security;\n }\n if (opts.securityDefinitions) {\n listing.securityDefinitions = opts.securityDefinitions;\n }\n\n return listing;\n}", "function api (genFn) {\n let cr = bluebird.coroutine(genFn);\n return function (req, resp, next) {\n return cr(req, resp, next)\n .then(function(value) {\n resp.json(value);\n })\n .catch(next);\n };\n}", "function createApi() {\n var common = require('../helpers/common.js')();\n\n return {\n\n /**\n * Returns a promise that does nothing in particular.\n */\n createTable: function() {\n return Q.fcall(function () {\n });\n },\n\n /**\n * Returns a promise that does nothing in particular.\n */\n createIndexes: function() {\n return Q.fcall(function () {\n });\n },\n\n /**\n * Create an instance of a mailbox.\n */\n create: function(number, context, fields, id) {\n id = common.optionalArgument(fields, id, 'number');\n\n var instance = {\n mailboxNumber: number,\n mailboxName: undefined,\n password: undefined,\n name: undefined,\n email: undefined,\n read: undefined,\n unread: undefined,\n greetingBusy: undefined,\n greetingAway: undefined,\n greetingName: undefined,\n\n getId: function() {\n return id;\n },\n\n getContext: function() {\n return context;\n }\n };\n\n return common.populateFields(instance, fields);\n },\n\n /**\n * Returns an array of all mailboxes belonging to the specified context\n */\n findByContext: function(context) {\n var self = this;\n\n return Q.fcall(function () {\n var mailboxArray = [];\n\n for (var index in mailboxes) {\n var mailbox = mailboxes[index];\n if (mailbox.getContext().getId() === context.getId()) {\n var fields = {mailboxName: mailbox.mailboxName,\n password: mailbox.password,\n name: mailbox.name,\n email: mailbox.email,\n read: mailbox.read,\n unread: mailbox.unread,\n greetingBusy: mailbox.greetingBusy,\n greetingAway: mailbox.greetingAway,\n greetingName: mailbox.greetingName};\n\n mailboxArray.push(self.create(mailbox.mailboxNumber,\n mailbox.getContext(),\n fields,\n mailbox.getId()));\n }\n }\n\n return mailboxArray;\n });\n },\n\n /**\n * Returns a count of all mailboxes belonging to the specified context\n */\n countByContext: function(context) {\n var count = 0;\n\n for (var index in mailboxes) {\n if (mailboxes[index].getContext().getId() === context.getId()) {\n count++;\n }\n }\n\n return count;\n },\n\n /**\n * Return a mailbox instance from the mock database.\n */\n get: function(number, context) {\n var self = this;\n\n return Q.fcall(function () {\n for (var index in mailboxes) {\n if (mailboxes[index].mailboxNumber === number &&\n mailboxes[index].getContext().getId() === context.getId()) {\n\n var mailbox = mailboxes[index];\n var fields = {mailboxName: mailbox.mailboxName,\n password: mailbox.password,\n name: mailbox.name,\n email: mailbox.email,\n read: mailbox.read,\n unread: mailbox.unread,\n greetingBusy: mailbox.greetingBusy,\n greetingAway: mailbox.greetingAway,\n greetingName: mailbox.greetingName};\n\n return self.create(mailbox.mailboxNumber,\n mailbox.getContext(),\n fields,\n mailbox.getId());\n }\n }\n\n return null;\n });\n },\n\n /**\n * Save a mailbox instance to the mock database.\n */\n save: function(instance) {\n var self = this;\n\n return Q.fcall(function () {\n var id = instance.getId();\n var fields = {mailboxName: instance.mailboxName,\n password: instance.password,\n name: instance.name,\n email: instance.email,\n read: instance.read,\n unread: instance.unread,\n greetingBusy: instance.greetingBusy,\n greetingAway: instance.greetingAway,\n greetingName: instance.greetingName};\n\n if (!id) {\n id = getNextId();\n }\n\n mailboxes[id] = self.create(instance.mailboxNumber,\n instance.getContext(),\n fields,\n id);\n });\n },\n\n /**\n * Updates the unread count.\n *\n * @param {Mailbox} instance - mailbox instance\n * @param {Function} mwi - a function to update mwi counts that returns a\n * promise\n * @returns {Q} promise - a promise containing the result of updating the\n * message counts\n */\n newMessage: function(instance, mwi) {\n return updateMwi(instance, mwi, modifier);\n\n function modifier (row) {\n var read = +row.read || 0;\n var unread = +row.unread || 0;\n\n return {\n read: read,\n unread: unread + 1\n };\n }\n },\n\n /**\n * Deletes a mailbox instance from the mock database.\n */\n remove: function(instance) {\n\n return Q.fcall(function () {\n var id = instance.getId();\n\n if (!id) {\n throw new Error('instance has no id.');\n }\n\n if (!(id in mailboxes)) {\n throw new Error('instance does not exist in database.');\n }\n\n delete mailboxes[id];\n });\n },\n\n /**\n * Updates read/unread counts.\n *\n * @param {Mailbox} instance - mailbox instance\n * @param {Function} mwi - a function to update mwi counts that returns a\n * promise\n *\n * @returns {Q} promsie - a promise containing the result of updating the\n * message counts\n */\n readMessage: function(instance, mwi) {\n return updateMwi(instance, mwi, modifier);\n\n function modifier (row) {\n var read = +row.read || 0;\n // make sure unread will be 0 if currently null\n var unread = +row.unread || 1;\n\n return {\n read: read + 1,\n unread: unread - 1\n };\n }\n },\n\n /**\n * Updates the read/unread counts.\n *\n * @param {Mailbox} instance - mailbox instance\n * @param {bool} messageRead - whether deleted message had been read or not\n * @param {Function} mwi - a function to update mwi counts that returns a\n * promise\n * @returns {Q} promise - a promise containing the result of updating the\n * message counts\n */\n deletedMessage: function(instance, messageRead, mwi) {\n return updateMwi(instance, mwi, modifier);\n\n function modifier (row) {\n var read = +row.read || 0;\n // make sure unread will be 0 if currently null\n var unread = +row.unread || 0;\n\n if (read && messageRead) {\n read -= 1;\n }\n\n if (unread && !messageRead) {\n unread -= 1;\n }\n\n return {\n read: read,\n unread: unread\n };\n }\n },\n\n /**\n * Test function, resets the contents of the mailbox mock database\n */\n testReset: function(newMailboxes, newNextId) {\n if (newMailboxes !== undefined) {\n mailboxes = newMailboxes;\n } else {\n mailboxes = {};\n }\n\n if (newNextId !== undefined) {\n nextId = newNextId;\n } else {\n nextId = 1;\n }\n }\n\n };\n\n /**\n * Dummy function? XXX I'm really not sure what to do with this\n *\n * @param {Mailbox} instance - mailbox instance\n * @param {Function} mwi - a function to update mwi counts that returns a\n * promise\n * @param {Function} modifier - a function that takes a database result and\n * returns an object containing the updated read/unread counts\n * @returns {Q} promise - a promise containing the result of updating the\n * message counts\n */\n function updateMwi(instance, mwi, modifier) {\n var mailbox = mailboxes[instance.getId()];\n\n return Q.fcall(function () {\n });\n }\n}", "_construct() {\n for (let url in methods) {\n const urlParts = url.split('/');\n const name = urlParts.pop(); // key for function\n\n let tmp = this;\n for (let p = 1; p < urlParts.length; ++p) { // acts like mkdir -p\n tmp = tmp[urlParts[p]] || (tmp[urlParts[p]] = {});\n }\n\n tmp[name] = (() => {\n const method = methods[url]; // closure forces copy\n return (params) => {\n return this._call(method, params);\n };\n })();\n }\n\n this._debug(`Trakt.tv: module loaded, as ${this._settings.useragent}`);\n }", "buildAbstractions() {\n this._asJSON = tools_dfdb_1.Tools.DeepCopy({\n collections: this._collections\n });\n this._asMD5 = tools_dfdb_1.Tools.ObjectToMD5(this._asJSON);\n }", "getList() { return this.api(); }", "function memory() {\n let objects = {};\n\n return handle;\n\n function handle(req, res, next) {\n if (res.status_ >= 300 || req.headers['x-mock-memory'] + '' === '0') {\n return next();\n }\n\n try {\n // get data from status, mock, and classify middlewares\n let data = res.body_;\n let random = res.body_;\n let schema = res.schema;\n let action = req.action;\n\n // use memory\n switch (action.type) {\n case 'get':\n data = load(schema, data);\n store(schema, data);\n break;\n case 'getById':\n data = load(schema, {id: action.id, __memory: true});\n if (data) {\n if (data.__memory) {\n setId(random, data.id, schema);\n data = random;\n }\n store(schema, data);\n } else {\n data = 'deleted';\n }\n break;\n case 'delete':\n case 'deleteById':\n remove(action.id);\n break;\n case 'updateById':\n data = update(action.id, action.body);\n store(action.bodySchema, data);\n break;\n case 'create':\n store(action.bodySchema, data);\n data = update(getId(data), action.body);\n store(action.bodySchema, data);\n break;\n default:\n // ignore\n }\n\n if (data === 'deleted') {\n return res.status(404).json({\n kunwareError: 'Unknown entity',\n });\n }\n\n res.body_ = data;\n } catch (ex) {\n // don't die on memory issues\n console.log(ex.stack);\n }\n\n next();\n }\n\n // remember given data\n function store(schema, data) {\n let type = data && (schema.type || 'object');\n\n switch (type) {\n case 'object':\n let id = getId(data);\n if (id) objects[id] = data;\n _.forEach(schema.properties, function(schema, name) {\n store(schema, data[name]);\n });\n return this;\n\n case 'array':\n data.forEach(function(item) {\n store(schema.items, item);\n });\n return this;\n\n default:\n return this;\n }\n }\n\n // load known data into given data\n function load(schema, data) {\n let type = data && (schema.type || 'object');\n\n switch (type) {\n case 'object':\n // load known object or null\n let id = getId(data);\n if (id && objects[id] === 'deleted') return null;\n if (id && objects[id]) data = objects[id];\n\n if (!data.__memory) {\n _.forEach(schema.properties, function(schema, name) {\n data[name] = load(schema, data[name]);\n });\n }\n\n return data;\n\n case 'array':\n // filter deleted objects\n // otherwise load known data\n return data.filter(function(item) {\n let id = getId(item);\n return !id || objects[id] !== 'deleted';\n }).map(function(item) {\n return load(schema.items, item);\n });\n\n default:\n return data;\n }\n }\n\n function update(id, data) {\n if (objects[id] === 'deleted') return 'deleted';\n return _.assign(objects[id] || {}, data);\n }\n\n // remember that an object was deleted\n function remove(id) {\n objects[id] = 'deleted';\n }\n}", "function loadAPI() {\n // wait for all classes to be loaded\n // on attend que les classes soient chargées\n if (checkApiLoading('loadAPI();',['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Standard'])===false) {\n return;\n }\n\n // load API keys configuration, then load the interface\n // on charge la configuration de la clef API, puis on charge l'application\n Geoportal.GeoRMHandler.getConfig(['123454565444344'], null,null, {\n onContractsComplete: initMap\n });\n}", "forApi() {\n return {\n entities: this.entities || 0,\n lastEntity: this.lastEntity\n };\n }", "registerAPI (apiObj) {\n for (let name of Object.keys(apiObj)) {\n if (apiObj.hasOwnProperty(name))\n this.register(name, apiObj[name]);\n }\n }", "function convertLiveDocs(apiInfo){\n rename(apiInfo,'title','name');\n rename(apiInfo,'prefix','publicPath');\n rename(apiInfo,'server','basePath');\n apiInfo.resources = {};\n for (var e in apiInfo.endpoints) {\n var ep = apiInfo.endpoints[e];\n var eName = ep.name ? ep.name : 'Default';\n\n if (!apiInfo.resources[eName]) apiInfo.resources[eName] = {};\n apiInfo.resources[eName].description = ep.description;\n\n for (var m in ep.methods) {\n var lMethod = ep.methods[m];\n if (!apiInfo.resources[eName].methods) apiInfo.resources[eName].methods = {};\n var mName = lMethod.MethodName ? lMethod.MethodName : 'Default';\n if (mName.endsWith('.')) mName = mName.substr(0,mName.length-1);\n mName = mName.split(' ').join('_');\n rename(lMethod,'HTTPMethod','httpMethod');\n rename(lMethod,'URI','path');\n rename(lMethod,'Synopsis','description');\n rename(lMethod,'MethodName','name');\n\n lMethod.path = fixPathParameters(lMethod.path);\n\n var params = {};\n for (var p in lMethod.parameters) {\n var lParam = lMethod.parameters[p];\n if (!lParam.type) lParam.type = 'string';\n if (lParam.type == 'json') lParam.type = 'string';\n if (!lParam.location) {\n if (lMethod.path.indexOf(':'+lParam.name)>=0) {\n lParam.location = 'path';\n }\n else {\n lParam.location = 'query';\n }\n }\n if (lParam.location == 'boddy') lParam.location = 'body'; // ;)\n params[lParam.name] = lParam;\n delete lParam.name;\n delete lParam.input; // TODO checkbox to boolean?\n delete lParam.label;\n rename(lParam,'options','enum');\n }\n lMethod.parameters = params;\n if (Object.keys(params).length==0) delete lMethod.parameters;\n\n apiInfo.resources[eName].methods[mName] = lMethod;\n }\n\n }\n delete apiInfo.endpoints; // to keep size down\n return apiInfo;\n}", "function loadAPI() {\n // wait for all classes to be loaded\n // on attend que les classes soient chargées\n if (checkApiLoading('loadAPI();',['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Simple'])===false) {\n return;\n }\n\n // load API keys configuration, then load the interface\n // on charge la configuration de la clef API, puis on charge l'application\n Geoportal.GeoRMHandler.getConfig(['nhf8wztv3m9wglcda6n6cbuf'], null,null, {\n onContractsComplete: initMap\n });\n}", "constructor (api) { this.api = api }", "constructor (api) { this.api = api }", "constructor (api) { this.api = api }", "function loadAPI() {\n // wait for all classes to be loaded\n // on attend que les classes soient chargées\n if (checkApiLoading('loadAPI();',['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Default'])===false) {\n return;\n }\n\n // load API keys configuration, then load the interface\n // on charge la configuration de la clef API, puis on charge l'application\n Geoportal.GeoRMHandler.getConfig(['nhf8wztv3m9wglcda6n6cbuf'], null,null, {\n onContractsComplete: initMap\n });\n}", "function allResources(api) {\n var resources = [];\n var visitor = function (res) {\n resources.push(res);\n res.resources().forEach(function (x) { return visitor(x); });\n };\n api.resources().forEach(function (x) { return visitor(x); });\n return resources;\n}", "async _createApi(pingStore) {\n const app = new Koa();\n\n // Make the ping store available to the routes.\n app.context.pingStore = pingStore;\n\n app.use(koaLogger());\n\n // Set up the router middleware.\n app.use(router.routes());\n app.use(router.allowedMethods());\n\n // Start and wait until the server is up and then return it.\n return await new Promise((resolve, reject) => {\n const server = app.listen(this._port, (err) => {\n if (err) reject(err);\n else resolve(server);\n });\n\n // Add a promisified close method to the server.\n server.closeAsync = () => new Promise((resolve) => {\n server.close(() => resolve());\n });\n });\n }", "function createApi(dependencies) {\n return {\n /**\n * Returns first if it matches the type, second otherwise.\n *\n * @param {object} first - optional argument\n * @param {object} second - non optional argument\n * @param {string} type - expected type of non optional argument\n */\n optionalArgument: function(first, second, type) {\n dependencies.logger.trace('common.optionalArgument called');\n\n if (typeof(first) === type) {\n return first;\n } else {\n return second;\n }\n },\n\n /**\n * Populates the instance with fields if they contain appropriate keys.\n *\n * @param {object} instance - repository instance\n * @param {object} fields - key/value field mappings\n */\n populateFields: function(instance, fields) {\n dependencies.logger.trace('common.populateFields called');\n\n fields = fields || {};\n Object.keys(instance).forEach(function(field) {\n if (typeof(instance[field]) !== 'function' &&\n fields[field] !== undefined) {\n instance[field] = fields[field];\n }\n });\n\n return instance;\n },\n\n /**\n * Creates the given table using the given provider.\n *\n * @param {object} table - a node-sql table definition\n * @param {object} provider - a database specific provider instance\n * @returns {Q} promise - a promise containing the result of creating\n * the table\n */\n createTable: function(table, provider) {\n dependencies.logger.trace('common.createTable called');\n\n var query = table.create().ifNotExists().toQuery();\n query.text = provider.autoIncrement(query.text);\n\n return provider.runQuery(query);\n },\n\n /**\n * Creates an index for the table using the name and fields given.\n *\n * @param {object} table - node-sql table definition\n * @param {string} name - index name\n * @param {string[]} fields - array of field names\n * @param {object} provider - database provider\n * @returns {Q} promise - a promise containing the result of creating\n * the index\n */\n createIndex: function(table, name, fields, provider) {\n dependencies.logger.trace('common.createIndex called');\n\n fields = (Array.isArray(fields)) ? fields: [fields];\n\n var indexFields = fields.map(function(field) {\n return table[field];\n });\n var index = table.indexes().create(name).unique();\n var query = index.on.apply(index, indexFields).toQuery();\n\n return provider.runQuery(query);\n },\n\n /**\n * Returns a single instance tied to the given table using a where clause\n * and the given constructor to construct the instance.\n *\n * @param {object} table - a node-sql table definition\n * @param {object} where - a node-sql where clause\n * @param {object} provider - a database specific provider instance\n * @param {function} constructor - a constructor for the repository being\n * operated on\n */\n get: function(table, where, provider, constructor) {\n dependencies.logger.trace('common.get called');\n\n // this set to repo instance, can use this.create to get instance\n var query = table\n .select(table.star())\n .from(table)\n .where(where)\n .toQuery();\n\n return provider.runQuery(query)\n .then(function(result) {\n var row = result.rows[0];\n\n return instanceFromRow(row, constructor);\n });\n },\n\n /**\n * Returns an array of instances for the given query using the given\n * constructor.\n *\n * @param {object} query - a node-sql query instance\n * @param {object} provider - a database specific provider instance\n * @param {function} constructor - a constructor for the repository being\n * operated on\n */\n find: function(query, provider, constructor) {\n dependencies.logger.trace('common.find called');\n\n return provider.runQuery(query)\n .then(function(result) {\n var instances = result.rows.map(function(row) {\n return instanceFromRow(row, constructor);\n });\n\n return instances;\n });\n },\n\n /**\n * Returns an integer count using the given query.\n *\n * @param {object} table - a node-sql table definition\n * @param {object} query - a node-sql query instance\n * @param {object} provider - a database specific provider instance\n */\n count: function(table, query, provider) {\n dependencies.logger.trace('common.count called');\n\n return provider.runQuery(query)\n .then(function(result) {\n var countRow = result.rows[0];\n var count = +countRow[Object.keys(countRow)[0]];\n\n return count;\n });\n },\n\n /**\n * Saves the instance using the given table and provider.\n *\n * @param {pbject} instance - the instance to save to the database\n * @param {object} table - a node-sql table definition\n * @param {object} provider - a database specific provider instance\n */\n save: function(instance, table, provider) {\n dependencies.logger.trace('common.save called');\n\n var query;\n var fields;\n\n // update or insert?\n if (instance.getId()) {\n fields = getFields(instance, table, function(all, current, value) {\n all[current] = value;\n\n return all;\n }, {});\n query = table\n .update(removeEmptyFields(fields))\n .where(table.id.equals(instance.getId()))\n .toQuery();\n } else {\n fields = getFields(instance, table, function(all, current, value) {\n var field = table[current].value(value);\n all.push(field);\n\n return all;\n }, []);\n query = table\n .insert.apply(table, fields)\n .toQuery();\n }\n\n return provider.runQuery(query);\n },\n\n remove: function(instance, table, provider) {\n dependencies.logger.trace('common.remove called');\n\n var query = table\n .delete()\n .where(table.id.equals(instance.getId()))\n .toQuery();\n\n return provider.runQuery(query);\n }\n };\n\n /**\n * Returns an instance from the given row using the given constructor.\n *\n * @param {object} row - a database row\n * @param {function} constructor - a constructor for the repository being\n * operated on\n */\n function instanceFromRow(row, constructor) {\n dependencies.logger.trace('common.instanceFromRow called');\n\n var instance = null;\n\n if (row) {\n instance = constructor(row.id);\n Object.keys(instance).forEach(function(key) {\n if (instance[key] === undefined) {\n var field = Case.snake(key);\n instance[key] = row[field];\n }\n });\n }\n\n return instance;\n }\n\n /**\n * Returns the fields that should be saved to the database from the given\n * instance using the table definition as a reference.\n *\n * @param {pbject} instance - the instance to save to the database\n * @param {object} table - a node-sql table definition\n * @param {function} step - a step function for accumulating fields\n * @param {object} initial - an initial value to reduce the fields over\n * @returns {collection} - a collection containing the fields that should be\n * saved\n */\n function getFields(instance, table, step, initial) {\n dependencies.logger.trace('common.getFields called');\n\n var fields = table.columns.reduce(function(all, column) {\n // reference or property?\n if (column.references) {\n var referenceName = column.name.split('_')[0];\n var referenceField = column.name.split('_')[1];\n var method = util.format('get%s', Case.title(referenceName));\n\n if (instance[method]) {\n all = step(all, column.name, instance[method]().getId());\n }\n } else {\n var property = Case.camel(column.name);\n\n if (instance[property] && typeof(instance[property]) !== 'function') {\n all = step(all, column.name, instance[property]);\n }\n }\n\n return all;\n }, initial);\n\n return fields;\n }\n\n /**\n * Removes any field from the object with an undefined value. Nulls are\n * conserved to ensure fields can be updated to a null value.\n *\n * @param {Object} fields - object used to update a record\n */\n function removeEmptyFields(fields) {\n dependencies.logger.trace('common.removeEmptyFields called');\n\n var result = {};\n Object.keys(fields).forEach(function(field) {\n if (fields[field] !== undefined) {\n result[field] = fields[field];\n }\n });\n\n return result;\n }\n}", "function init(){\n\n\t//initialize as sync.\n\tconst schemaConfig = require('../config/generic.schema');\n\tconst genericModel = require('../models/generic.model');\n\tconst genericCtrl = require('../controllers/generic.controller');\n\n\tlet collections = schemaConfig.collections;\n\tfor(let i in collections){\n\t\tlet collection = collections[i];\n\t\tlet model = genericCtrl[collection.name];\n\n\t\tconsole.log(`Generic api url: /api${collection.api} \\t [GET, POST, PUT, DELETE]`);\n\t\t//routes\n\t\trouter.route(collection.api)\n\t\t .get(model.getList)\n\t\t .post(validate(validateParam[collection.name]), model.insert);\t\t\n\n\t\trouter.route(collection.api+'/:id')\n\t\t .get(model.getById)\n\t\t .put(validate(validateParam[collection.name]), model.update)\n\t\t .delete(model.delete);\n\t}\n\tconsole.log(\"\\nGeneric routes built . . .\");\n\tconsole.log(\"-----------------------------------\");\n}", "function Api() {\n _classCallCheck(this, Api);\n\n this.express = (0, _express2.default)();\n this.middleware();\n this.routes();\n }", "getSmartApi() {\n return {\n ready: (...args) => (0, smart_1.ready)(this, ...args),\n authorize: options => (0, smart_1.authorize)(this, options),\n init: options => (0, smart_1.init)(this, options),\n client: state => new Client_1.default(this, state),\n options: this.options,\n utils: {\n security\n }\n };\n }", "parse() {\n const basePath = path.join(this.iotjs, 'docs/api');\n\n fs.readdir(basePath, (err, files) => {\n this.verboseLog(`Read '${basePath}' directory.`);\n\n if (err) {\n console.error(err.message);\n return false;\n }\n\n const promises = files.filter(file => !file.includes('reference')).map(file => {\n const name = file.slice(\n config.docname.pre.length,\n -config.docname.post.length\n ).toLowerCase().replace('file-system', 'fs');\n\n this.addModuleToOutput(name);\n\n return new Promise((resolve, reject) => {\n const filePath = path.join(basePath, file);\n\n fs.readFile(filePath, 'utf8', (error, data) => {\n this.verboseLog(`- Read '${filePath}' --> ${name} module`);\n\n if (error) {\n reject(error.message);\n } else {\n resolve({ name, data });\n }\n });\n });\n });\n\n Promise.all(promises).then((data) => {\n this.verboseLog('\\nParse each read file content to get their available functions list.');\n\n data.forEach((file) => {\n this.verboseLog(`- Parse ${file.name} module:`);\n\n let doc = false;\n let label = '';\n let detail = '';\n let insertText = '';\n let documentation = [];\n\n file.data.split('\\n').forEach(line => {\n // Prototype line match.\n if (!config.regex.new.test(line) && config.regex.proto.test(line)) {\n // Found a new prototype before an example, save the last known prototype if necessary.\n if (doc) {\n this.addFunctionToModule(file.name, {\n label: label,\n kind: 2,\n detail: detail,\n documentation: documentation.join('\\n'),\n insertText: insertText,\n });\n }\n\n const functionName = line.substring(4).replace(config.regex.args, '').split('.').pop();\n const functionDetail = line.substring(4);\n\n label = functionName;\n detail = functionDetail;\n insertText = functionName;\n documentation = [];\n doc = true;\n\n this.verboseLog(` = ${functionDetail}`);\n\n return;\n }\n\n // Documentation line match.\n if (!config.regex.event.test(line) &&\n !config.regex.exDef.test(line) &&\n !config.regex.exLess.test(line) &&\n !config.regex.proto.test(line) && doc) {\n documentation.push(line);\n } else {\n // Store the function documentation.\n if (doc) {\n this.addFunctionToModule(file.name, {\n label: label,\n kind: 2,\n detail: detail,\n documentation: documentation.join('\\n'),\n insertText: insertText,\n });\n }\n\n documentation = [];\n doc = false;\n }\n });\n });\n\n this.verboseLog('Modules are parsed.\\n');\n\n this.writeOutputToDestonation();\n }).catch((error) => {\n console.error(error);\n });\n });\n }", "start() {\n return this.api.getSchema().then(openapi_schema => {\n fieldsRegistrator.registerAllFieldsComponents();\n this.initModels();\n this.initViews();\n this.mountApplication();\n }).catch(error => {\n debugger;\n throw new Error(error);\n });\n }", "function ApiProvider() {\n\t\tthis.endpoints = {};\n\t}", "init() {\n const readdir = require('fs').readdirSync;\n const join = require('path').join;\n\n const self = this;\n\n const models = readdir(join(__dirname, './models')); // get all models name in ./models dir\n models.forEach((model)=> {\n // creates model name that contain model name + Model word ant start with upper symbol\n var name = model.split('.')[0];\n\n // attaches each model to PostgresConnector for the fastest getting\n self._models[name] = self.client.import(`./models/${model}`);\n });\n\n\n const classes = readdir(join(__dirname, './model_methods'));\n classes.forEach(currentClass=> {\n var name = currentClass.split('.')[0].toLowerCase();\n self[name] = new (require(`./model_methods/${currentClass}`))(self)\n })\n return;\n }", "function iodocsUpgrade(data){\n \tvar data = data['endpoints'];\n\tvar newResource = {};\n\tnewResource.resources = {};\n\tfor (var index2 = 0; index2 < data.length; index2++) {\n\t\tvar resource = data[index2];\n\t\tvar resourceName = resource.name;\n\t\tnewResource.resources[resourceName] = {};\n\t\tnewResource.resources[resourceName].methods = {};\n\t\tvar methods = resource.methods;\n\t\tfor (var index3 = 0; index3 < methods.length; index3++) {\n\t\t\tvar method = methods[index3];\n\t\t\tvar methodName = method['MethodName'];\n\t\t\tvar methodName = methodName.split(' ').join('_');\n\t\t\tnewResource.resources[resourceName].methods[methodName] = {};\n\t\t\tnewResource.resources[resourceName].methods[methodName].name = method['MethodName'];\n\t\t\tnewResource.resources[resourceName].methods[methodName]['httpMethod'] = method['HTTPMethod'];\n\t\t\tnewResource.resources[resourceName].methods[methodName]['path'] = method['URI'];\n\t\t\tnewResource.resources[resourceName].methods[methodName].parameters = {};\n\t\t\tif (!method.parameters) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvar parameters = method.parameters;\n\t\t\tfor (var index4 = 0; index4 < parameters.length; index4++) {\n\t\t\t\tvar param = parameters[index4];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name] = {};\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['title'] = param.name;\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['required'] = (param['Required'] == 'Y');\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['default'] = param['Default'];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['type'] = param['Type'];\n\t\t\t\tnewResource.resources[resourceName].methods[methodName].parameters[param.Name]['description'] = param['Description'];\n\t\t\t}\n\t\t}\n\t}\n return newResource;\n}", "function getLocalApi() {\n var api = [\n/* 'sin',\n 'cos',\n 'abs',\n 'sqrt', */\n 'color',\n 'size',\n 'colorMode',\n 'background',\n 'smooth',\n 'random',\n 'radians',\n 'stroke',\n 'point',\n 'noStroke',\n 'fill',\n 'beginShape',\n 'vertex',\n 'endShape'\n ];\n \n var tmpl = 'var ${method} = function() { return ${ctx}.${method}.apply(${ctx}, arguments); }';\n\n var cmds = [];\n for (var i = 0; i < api.length; i++) {\n var cmd = tmpl.replace(/\\${method}/g, api[i])\n .replace(/\\${ctx}/g, 'processing');\n cmds.push(cmd);\n }\n var localApi = cmds.join(';');\n // alert(localFns);\n return localApi;\n}", "static bindDocs(api){\n\t\treturn (ctx,next)=>{\n\t\t\tctx.swaggerDocs = api;\n\t\t\tctx.define={\n\t\t\t\tmodel:{\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\tparams:{\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn next();\n\t\t}\n\t}", "async discoverAPI(apiPath, options = {}) {\n const endpointCreator = await this._discovery.discoverAPI(apiPath);\n const ep = endpointCreator(options, this);\n ep.google = this; // for drive.google.transporter\n return Object.freeze(ep);\n }", "function generateEverything() {\n const maxPpl = 30000\n const maxCompanies = 1000\n const returnable = {\n people: [],\n companies: [],\n friendships: []\n }\n for(let i = 0; i < maxPpl; i++) {\n returnable.people.push(createPerson(maxCompanies, maxPpl))\n returnable.friendships.push(...createFriendsList(i, maxPpl))\n }\n for(let i = 0; i < maxCompanies; i++) {\n returnable.companies.push(createCompany())\n }\n return returnable\n}", "function APIObject(aManifest) {\n this._init(aManifest);\n}", "constructor() {\n super();\n\n this.generateModules();\n }", "function ApiServiceRegistry() {\n\t }", "function AirplaneFactory2(name, prodYear, amount) {\n const apfAPI = {\n introduce() {\n console.log(\n `The ${name} was made on ${prodYear} and there are ${amount} of them available today`\n );\n },\n };\n return apfAPI;\n}", "function DynAPILibrary() {\n this.DynObject = DynObject;\n this.DynObject();\n\n // list of js files: this.scripts['../src/api/dynlayer_ie.js'] = {dep, objects, pkg, fn};\n this.scripts = {};\n\n // list of package names: this.packages['dynapi.api'] = dynapi.api = {_objects,_path}\n this.packages = {};\n\n // list of object names: this.objects['DynLayer'] = this.scripts['../src/api/dynlayer_ie.js']\n this.objects = {};\n\n this._c = 0;\n this.loadList = [];\n this.loadIndex = -1;\n this.path = null;\n this.busy = true;\n}", "function doGenerate(swagger, options) {\n if (!options.templates) {\n options.templates = path.join(__dirname, 'templates');\n }\n\n var output = path.normalize(options.output || 'src/app/api');\n var prefix = options.prefix || 'Api';\n\n if (swagger.swagger !== '2.0') {\n console.error(\n 'Invalid swagger specification. Must be a 2.0. Currently ' +\n swagger.swagger\n );\n process.exit(1);\n }\n swagger.paths = swagger.paths || {};\n swagger.models = swagger.models || [];\n var models = processModels(swagger, options);\n var services = processServices(swagger, models, options);\n\n // Apply the tag filter. If includeTags is null, uses all services,\n // but still can remove unused models\n const includeTags = options.includeTags;\n if (typeof includeTags == 'string') {\n options.includeTags = includeTags.split(',');\n }\n const excludeTags = options.excludeTags;\n if (typeof excludeTags == 'string') {\n options.excludeTags = excludeTags.split(',');\n }\n applyTagFilter(models, services, options);\n\n // Read the templates\n var templates = {};\n var files = fs.readdirSync(options.templates);\n files.forEach(function (file, index) {\n var pos = file.indexOf('.mustache');\n if (pos >= 0) {\n var fullFile = path.join(options.templates, file);\n templates[file.substr(0, pos)] = fs.readFileSync(fullFile, 'utf-8');\n }\n });\n\n // read the fallback templates\n var fallbackTemplates = path.join(__dirname, 'templates');\n fs.readdirSync(fallbackTemplates)\n .forEach(function (file) {\n var pos = file.indexOf('.mustache');\n if (pos >= 0) {\n var fullFile = path.join(fallbackTemplates, file);\n if (!(file.substr(0, pos) in templates)) {\n templates[file.substr(0, pos)] = fs.readFileSync(fullFile, 'utf-8');\n }\n }\n });\n\n // Prepare the output folder\n const modelsOutput = path.join(output, 'models');\n const servicesOutput = path.join(output, 'services');\n mkdirs(modelsOutput);\n mkdirs(servicesOutput);\n\n var removeStaleFiles = options.removeStaleFiles !== false;\n var generateEnumModule = options.enumModule !== false;\n\n // Utility function to render a template and write it to a file\n var generate = function (template, model, file) {\n var code = Mustache.render(template, model, templates)\n .replace(/[^\\S\\r\\n]+$/gm, '');\n fs.writeFileSync(file, code, 'UTF-8');\n console.info('Wrote ' + file);\n };\n\n // Calculate the globally used names\n var moduleClass = toClassName(prefix + 'Module');\n var moduleFile = toFileName(moduleClass);\n // Angular's best practices demands xxx.module.ts, not xxx-module.ts\n moduleFile = moduleFile.replace(/\\-module$/, '.module');\n var configurationClass = toClassName(prefix + 'Configuration');\n var configurationInterface = toClassName(prefix + 'ConfigurationInterface');\n var configurationFile = toFileName(configurationClass);\n\n function applyGlobals(to) {\n to.prefix = prefix;\n to.moduleClass = moduleClass;\n to.moduleFile = moduleFile;\n to.configurationClass = configurationClass;\n to.configurationInterface = configurationInterface;\n to.configurationFile = configurationFile;\n return to;\n }\n\n // Write the models and examples\n var modelsArray = [];\n for (var modelName in models) {\n var model = models[normalizeModelName(modelName)];\n if (model.modelIsEnum) {\n model.enumModule = generateEnumModule;\n }\n applyGlobals(model);\n\n // When the model name differs from the class name, it will be duplicated\n // in the array. For example the-user would be TheUser, and would be twice.\n if (modelsArray.includes(model)) {\n continue;\n }\n modelsArray.push(model);\n generate(\n templates.model,\n model,\n path.join(modelsOutput, model.modelFile + '.ts')\n );\n if (options.generateExamples && model.modelExample) {\n var value = resolveRefRecursive(model.modelExample, swagger);\n var example = JSON.stringify(value, null, 2);\n example = example.replace(/'/g, \"\\\\'\");\n example = example.replace(/\"/g, \"'\");\n example = example.replace(/\\n/g, \"\\n \");\n model.modelExampleStr = example;\n generate(\n templates.example,\n model,\n path.join(modelsOutput, model.modelExampleFile + '.ts')\n );\n }\n }\n if (modelsArray.length > 0) {\n modelsArray[modelsArray.length - 1].modelIsLast = true;\n }\n if (removeStaleFiles) {\n var modelFiles = fs.readdirSync(modelsOutput);\n modelFiles.forEach((file, index) => {\n var ok = false;\n var basename = path.basename(file);\n for (var modelName in models) {\n var model = models[normalizeModelName(modelName)];\n if (basename == model.modelFile + '.ts'\n || basename == model.modelExampleFile + '.ts'\n && model.modelExampleStr != null) {\n ok = true;\n break;\n }\n }\n if (!ok) {\n rmIfExists(path.join(modelsOutput, file));\n }\n });\n }\n\n // Write the model index\n var modelIndexFile = path.join(output, 'models.ts');\n if (options.modelIndex !== false) {\n generate(templates.models, { models: modelsArray }, modelIndexFile);\n } else if (removeStaleFiles) {\n rmIfExists(modelIndexFile);\n }\n\n // Write the StrictHttpResponse type\n generate(templates.strictHttpResponse, {},\n path.join(output, 'strict-http-response.ts'));\n\n // Write the services\n var servicesArray = [];\n for (var serviceName in services) {\n var service = services[serviceName];\n service.generalErrorHandler = options.errorHandler !== false;\n applyGlobals(service);\n servicesArray.push(service);\n\n generate(\n templates.service,\n service,\n path.join(servicesOutput, service.serviceFile + '.ts')\n );\n }\n if (servicesArray.length > 0) {\n servicesArray[servicesArray.length - 1].serviceIsLast = true;\n }\n if (removeStaleFiles) {\n var serviceFiles = fs.readdirSync(servicesOutput);\n serviceFiles.forEach((file, index) => {\n var ok = false;\n var basename = path.basename(file);\n for (var serviceName in services) {\n var service = services[serviceName];\n if (basename == service.serviceFile + '.ts') {\n ok = true;\n break;\n }\n }\n if (!ok) {\n rmIfExists(path.join(servicesOutput, file));\n }\n });\n }\n\n // Write the service index\n var serviceIndexFile = path.join(output, 'services.ts');\n if (options.serviceIndex !== false) {\n generate(templates.services, { services: servicesArray }, serviceIndexFile);\n } else if (removeStaleFiles) {\n rmIfExists(serviceIndexFile);\n }\n\n // Write the module\n var fullModuleFile = path.join(output, moduleFile + '.ts');\n if (options.apiModule !== false) {\n generate(templates.module, applyGlobals({\n services: servicesArray\n }),\n fullModuleFile);\n } else if (removeStaleFiles) {\n rmIfExists(fullModuleFile);\n }\n\n // Write the configuration\n {\n var rootUrl = '';\n if (swagger.hasOwnProperty('host') && swagger.host !== '') {\n var schemes = swagger.schemes || [];\n var scheme = schemes.length === 0 ? '//' : schemes[0] + '://';\n rootUrl = scheme + swagger.host;\n }\n if (swagger.hasOwnProperty('basePath') && swagger.basePath !== ''\n && swagger.basePath !== '/') {\n rootUrl += swagger.basePath;\n }\n\n generate(templates.configuration, applyGlobals({\n rootUrl: rootUrl,\n }),\n path.join(output, configurationFile + '.ts')\n );\n }\n\n // Write the BaseService\n {\n generate(templates.baseService, applyGlobals({}),\n path.join(output, 'base-service.ts'));\n }\n}", "_instantiateWasm() {\n const instantiateWasmTask = async () => {\n if (this.wasmInstance) {\n return;\n } else {\n let response = await instantiateWasm();\n this.wasmInstance = response.instance;\n this.wasmByteMemory = response.byteMemory;\n }\n };\n\n return instantiateWasmTask();\n }", "function convertToOpenAPI(info, data) {\n const builder = new openapi3_ts_1.OpenApiBuilder();\n builder.addInfo(Object.assign(Object.assign({}, info.base), { title: info.base.title || '[untitled]', version: info.base.version || '0.0.0' }));\n info.contact && builder.addContact(info.contact);\n const tags = [];\n const paths = {};\n let typeCount = 1;\n const schemas = {};\n data.forEach(item => {\n [].concat(item.url).forEach(url => {\n if (typeof url !== 'string') {\n // TODO\n return;\n }\n url = url\n .split('/')\n .map((item) => (item.startsWith(':') ? `{${item.substr(1)}}` : item))\n .join('/');\n if (!tags.find(t => t.name === item.typeGlobalName)) {\n const ctrlMeta = controller_1.getControllerMetadata(item.typeClass);\n tags.push({\n name: item.typeGlobalName,\n description: (ctrlMeta && [ctrlMeta.name, ctrlMeta.description].filter(s => s).join(' ')) ||\n undefined,\n });\n }\n if (!paths[url]) {\n paths[url] = {};\n }\n [].concat(item.method).forEach((method) => {\n method = method.toLowerCase();\n function paramFilter(p) {\n if (p.source === 'Any') {\n return ['post', 'put'].every(m => m !== method);\n }\n return p.source !== 'Body';\n }\n function convertValidateToSchema(validateType) {\n if (validateType === 'string') {\n return {\n type: 'string',\n };\n }\n if (validateType === 'int' || validateType === 'number') {\n return {\n type: 'number',\n };\n }\n if (validateType.type === 'object' && validateType.rule) {\n let properties = {};\n const required = [];\n Object.keys(validateType.rule).forEach(key => {\n const rule = validateType.rule[key];\n properties[key] = convertValidateToSchema(rule);\n if (rule.required !== false) {\n required.push(key);\n }\n });\n const typeName = `GenType_${typeCount++}`;\n builder.addSchema(typeName, {\n type: validateType.type,\n required: required,\n properties,\n });\n return {\n $ref: `#/components/schemas/${typeName}`,\n };\n }\n if (validateType.type === 'enum') {\n return {\n type: 'string',\n };\n }\n return {\n type: validateType.type,\n items: validateType.itemType\n ? validateType.itemType === 'object'\n ? convertValidateToSchema({ type: 'object', rule: validateType.rule })\n : { type: validateType.itemType }\n : undefined,\n enum: Array.isArray(validateType.values)\n ? validateType.values.map(v => convertValidateToSchema(v))\n : undefined,\n maximum: validateType.max,\n minimum: validateType.min,\n };\n }\n function getTypeSchema(p) {\n if (p.schema) {\n return p.schema;\n }\n else if (p.validateType && p.validateType.type) {\n return convertValidateToSchema(p.validateType);\n }\n else {\n const type = utils_1.getGlobalType(p.type);\n const isSimpleType = ['array', 'boolean', 'integer', 'number', 'object', 'string'].some(t => t === type.toLowerCase());\n // TODO complex type process\n return {\n type: isSimpleType ? type.toLowerCase() : 'object',\n items: type === 'Array'\n ? {\n type: 'object',\n }\n : undefined,\n };\n }\n }\n // add schema\n const components = item.schemas.components || {};\n Object.keys(components).forEach(typeName => {\n if (schemas[typeName] && schemas[typeName].hashCode !== components[typeName].hashCode) {\n console.warn(`[egg-controller] type: [${typeName}] has multi defined!`);\n return;\n }\n schemas[typeName] = components[typeName];\n });\n // param\n const inParam = item.paramTypes.filter(paramFilter);\n // req body\n const inBody = item.paramTypes.filter(p => !paramFilter(p));\n let requestBody;\n if (inBody.length) {\n const requestBodySchema = {\n type: 'object',\n properties: {},\n };\n inBody.forEach(p => {\n if (p.required || util_1.getValue(() => p.validateType.required)) {\n if (!requestBodySchema.required) {\n requestBodySchema.required = [];\n }\n requestBodySchema.required.push(p.paramName);\n }\n requestBodySchema.properties[p.paramName] = getTypeSchema(p);\n });\n const reqMediaType = 'application/json';\n requestBody = {\n content: {\n [reqMediaType]: {\n schema: requestBodySchema,\n },\n },\n };\n }\n // res\n let responseSchema = item.schemas.response || {};\n const refTypeName = responseSchema.$ref;\n if (refTypeName) {\n const definition = item.schemas.components[refTypeName.replace('#/components/schemas/', '')];\n if (definition) {\n responseSchema = { $ref: refTypeName };\n }\n else {\n console.warn(`[egg-controller] NotFound {${refTypeName}} in components.`);\n responseSchema = { type: 'any' };\n }\n }\n const responses = {\n default: {\n description: 'default',\n content: {\n 'application/json': {\n schema: responseSchema,\n },\n },\n },\n };\n paths[url][method] = {\n operationId: item.functionName,\n tags: [item.typeGlobalName],\n summary: item.name,\n description: item.description,\n parameters: inParam.length\n ? inParam.map(p => {\n const source = p.source === 'Header' ? 'header' : p.source === 'Param' ? 'path' : 'query';\n return {\n name: p.paramName,\n in: source,\n required: source === 'path' || p.required || util_1.getValue(() => p.validateType.required),\n schema: getTypeSchema(p),\n };\n })\n : undefined,\n requestBody,\n responses,\n };\n });\n });\n });\n // add schema\n Object.keys(schemas).forEach(key => {\n delete schemas[key].hashCode;\n builder.addSchema(key, schemas[key]);\n });\n tags.forEach(tag => builder.addTag(tag));\n Object.keys(paths).forEach(path => builder.addPath(path, paths[path]));\n return JSON.parse(builder.getSpecAsJson());\n}", "getApi(api_name) {\n const self = this;\n return new self.KnetikCloud[api_name]();\n }", "function generateCodeSamples() {\n console.log(' + generating code samples')\n\n const samples = require(path.resolve(`${process.env.LIB_DIR}samples`))\n const endpoints = require(path.resolve(`${process.env.LIB_DIR}spec`)).load().paths\n\n // Only parses languages for which there exists a template\n let languages = []\n fs.readdirSync(`${process.env.TMPL_DIR}code`).forEach(filename => {\n languages.push(filename.substring(0, filename.indexOf('.')))\n })\n\n const ejs = require('ejs')\n\n for (const language of languages) {\n for (const url in endpoints) {\n const endpoint = endpoints[url]\n // Ignore OAuth endpoints\n // ex: '/restapi/oauth/authorize' gets ignored\n if (url.match(/^'?\\/[^\\/]*\\/oauth/)) continue\n\n for (let method in endpoint) {\n const operation = endpoint[method]\n if (operation.deprecated) continue\n\n const tag = operation.tags[0]\n\n const opDir = samples.dirPathTo(operation)\n\n // opPath is the file-system path for a specific endpoint\n // ex: './Glip/Posts/Create Post/code-samples/createGlipPost.js'\n //\n // ./ (root)\n // ./glip-team-messaging/ (x-tag-group)\n // ./chats\n // ./posts/ (tag)\n // './create-post/' (summary)\n // ./code-samples\n // ./createGlipPost.js (operationId)\n // './delete-post/'\n // './get-post/'\n // ./messaging/\n\n // if the folder to the file doesn't already exist, create it\n fs.mkdirSync(opDir, { recursive: true })\n\n let override = samples.overridePathTo(operation, language)\n let code\n\n // For the C# SDK ONLY (maybe java later?)\n // the naming convention uses a \".List()\" & \".Get()\" for cases where two operations exist at a single endpoint.\n // Example:\n // HTTP GET \"/restapi/v1.0/account/{accountId}/extension/{extensionId}/call-log\" uses \".List()\"\n // HTTP GET \"/restapi/v1.0/account/{accountId}/extension/{extensionId}/call-log/{callRecordId}\" uses \".Get()\"\n if(['cs' /*, 'java' */].includes(language) && method === 'get' && !url.endsWith('}')) {\n const regexEscapedUrl = `^${url.replace(/[\\{\\}\\\\]/g, '\\\\$&')}\\/\\{\\\\w+?\\}$`\n const urlPattern = new RegExp(regexEscapedUrl)\n if(Object.keys(endpoints).some(ep => urlPattern.test(ep))) {\n method = 'list'\n }\n }\n\n // If an override exists for this specific operation, do not generate a new one\n // simply copy from the override directory\n if (!fs.existsSync(override)) {\n // Render and write the template for the current language\n code = ejs.render(fs.readFileSync(path.resolve(`${process.env.TMPL_DIR}code/${language}.ejs`), 'utf8'), {\n ejs: ejs,\n url: url,\n method: method,\n operation: operation,\n defs: require(path.resolve(`${process.env.LIB_DIR}definitions`)),\n object: fs.readFileSync(path.resolve(`${process.env.TMPL_DIR}objects/${language}.ejs`), 'utf8')\n })\n } else {\n code = fs.readFileSync(override)\n }\n\n fs.writeFileSync(samples.filePathTo(operation, language), code)\n }\n }\n }\n\n console.log(' - code samples generated')\n}", "function convertSwagger(source){\n var apiInfo = clone(source,false);\n apiInfo.resources = {};\n\n\tif (apiInfo.servers && apiInfo.servers.length) {\n\t\tvar u = url.parse(apiInfo.servers[0].url);\n\t\tapiInfo.host = u.host;\n\t\tapiInfo.basePath = u.path;\n\t\tapiInfo.schemes = [];\n\t\tapiInfo.schemes.push(u.protocol.replace(':',''));\n\t}\n\n for (var p in apiInfo.paths) {\n for (var m in apiInfo.paths[p]) {\n if ('.get.post.put.delete.head.patch.options.trace.'.indexOf(m)>=0) {\n var sMethod = apiInfo.paths[p][m];\n var ioMethod = {};\n ioMethod.httpMethod = m.toUpperCase();\n var sMethodUniqueName = sMethod.operationId ? sMethod.operationId : m+'_'+p.split('/').join('_');\n sMethodUniqueName = sMethodUniqueName.split(' ').join('_'); // TODO {, } and : ?\n ioMethod.name = sMethodUniqueName;\n ioMethod.summary = sMethod.summary;\n ioMethod.description = sMethod.description;\n ioMethod.parameters = {};\n var sParams = sMethod.parameters ? sMethod.parameters : [];\n if (apiInfo.paths[p].parameters) {\n sParams = sParams.concat(apiInfo.paths[p].parameters);\n }\n for (var p2 in sParams) {\n var param = sParams[p2];\n var ptr = param[\"$ref\"];\n if (ptr && ptr.startsWith('#/parameters/')) {\n ptr = ptr.replace('#/parameters/','');\n param = clone(apiInfo.parameters[ptr],false);\n }\n if (ptr && ptr.startsWith('#/components/parameters/')) {\n ptr = ptr.replace('#/components/parameters/','');\n param = clone(apiInfo.components.parameters[ptr],false);\n }\n param.location = param[\"in\"];\n delete param[\"in\"];\n\t\t\t\t\tif (!param.type && param.schema && param.schema.type) {\n\t\t\t\t\t\tparam.type = param.schema.type;\n\t\t\t\t\t}\n ioMethod.parameters[param.name] = param;\n }\n ioMethod.path = p;\n ioMethod.responses = sMethod.responses;\n var tagName = 'Default';\n if (sMethod.tags && sMethod.tags.length>0) {\n tagName = sMethod.tags[0];\n }\n if (!apiInfo.resources[tagName]) {\n apiInfo.resources[tagName] = {};\n if (apiInfo.tags) {\n for (var t in apiInfo.tags) {\n var tag = apiInfo.tags[t];\n if (tag.name == tagName) {\n apiInfo.resources[tagName].description = tag.description;\n apiInfo.resources[tagName].externalDocs = tag.externalDocs;\n }\n }\n }\n }\n if (!apiInfo.resources[tagName].methods) apiInfo.resources[tagName].methods = {};\n apiInfo.resources[tagName].methods[sMethodUniqueName] = ioMethod;\n }\n }\n }\n delete apiInfo.paths; // to keep size down\n if (apiInfo.definitions) rename(apiInfo,'definitions','schemas');\n if (apiInfo.components && apiInfo.components.schemas) rename(apiInfo,'components.schemas','schemas');\n return apiInfo;\n}", "static build() {\n return __awaiter(this, void 0, void 0, function* () {\n // Await registration of all bots from the application files.\n // Upon error in registration, stop the application.\n yield BotManager.registerAllBotsInDirectory();\n // We'll run preparation handlers for all bots as this should only be done once.\n yield BotManager.prepareAllBots();\n // Some more flavor.\n yield Morgana_1.Morgana.success(\"Bot Manager preparations complete!\");\n });\n }", "async function seedApiTokens() {\n\tconst mongoDB = new MongoLib();\n\n\ttry {\n\t\tconst tokensPromises = ApiTokens.map(async token => {\n\t\t\tawait mongoDB.create('api-tokens', token);\n\t\t});\n\n\t\tawait Promise.all(tokensPromises);\n\n\t\tdebug(chalk.bgGreen('Tokens Public and Admin Generate!'));\n\t\tprocess.exit(1);\n\t} catch (error) {\n\t\tdebug(chalk.bgRed('Something Came out Wrong!', error));\n\t\tprocess.exit(2);\n\t}\n}", "function objectGenerator(config, pluginName) {\n const storage = new Storage(config);\n return {\n storage: {\n get(key, defaultVal) {\n return storage.get(`${pluginName}.${key}`, defaultVal);\n },\n put(key, value) {\n return storage.put(`${pluginName}.${key}`, value);\n },\n },\n };\n}", "function apiLoaded() {\r\n initAPI();\r\n launchRco();\r\n}", "async load() {\n log.info(this);\n // Get Host Objects\n\n // Check if NetData is available on the server, install it if it is not.\n await this.getNetDataStatus();\n\n // Configure NetData receiver on XOA vm\n await this.configureXoaToReceiveData();\n \n const host_param = { host: { type: \"string\" }};\n const can_administrate_host = { host: ['host', 'host', 'administrate'] };\n\n // Method Definitions\n const methods = {\n isConfiguredToReceiveStreaming: {\n description: 'Check if the XOA host has the expected stream configuration.',\n permission: 'admin'\n }, configureXoaToReceiveData: {\n description: 'Install and configure NetData on XOA VM.',\n permission: 'admin'\n }, getLocalApiKey: {\n description: 'Get the UUID of the XOA VM, used as the api key by all hosts.',\n permission: 'admin'\n }, configureHostToStreamHere: {\n description: 'Call the XAPI methods to setup NetData on a given host and stream data to XOA',\n permission: 'admin',\n params: host_param,\n resolve: can_administrate_host\n }, isNetDataInstalledOnHost: {\n description: 'Check if NetData service is installed on the given host machine.',\n permission: 'admin',\n params: host_param,\n resolve: can_administrate_host\n }, getHostApiKey: {\n description: 'Get the API Key that is a given host is streaming with.',\n permission: 'admin',\n params: host_param,\n resolve: can_administrate_host\n }, installNetData: {\n description: 'Install latest up-stream NetData package.',\n permission: 'admin'\n }};\n\n const apiMethods = Object.entries(methods).map(([method_name, attributes]) => {\n const method = (params) => this[method_name](params);\n for (const [key, value] of Object.entries(attributes)) {\n method[key] = value\n };\n return [method_name, method]\n });\n\n this._unsetApiMethods = this._xo.addApiMethods({\n netdata: Object.fromEntries(apiMethods)\n });\n }", "build() {\n var $this = this;\n\n // Carregar parametros\n var version = this.config('build.version', '0.0.0');\n var name = this.config('build.config.js.name', 'nws-sdk');\n var internal_name = this.config('build.config.js.internal_name', 'nws');\n var keyword = this.config('build.config.js.keyword', 'netforce');\n var github = this.config('build.config.js.github', 'git@github.com:netforcews/sdk-js.git');\n\n // Preparar diretorios\n var pathBase = this.getPath('js', { version: this.config('build.version', '0.0.0') });\n var pathStubs = __dirname + '/js/src/stubs';\n\n // Se pasta existir deve limpar\n if (fs.existsSync(pathBase)) {\n rimraf.sync(pathBase);\n }\n\n var pathModels = path.resolve(pathBase, 'src', 'Models');\n var pathResources = path.resolve(pathBase, 'src', 'Resources');\n var pathServices = path.resolve(pathBase, 'src');\n\n // Arquivos /root\n //this.copyStub(__dirname + '/js/.gitignore', pathBase + '/.gitignore');\n this.copyStub(__dirname + '/js/.babelrc', pathBase + '/.babelrc');\n this.copyStub(__dirname + '/js/.npmrc.txt', pathBase + '/.npmrc');\n this.copyStub(__dirname + '/js/package.json', pathBase + '/package.json', {\n version : version,\n name : name,\n keyword : keyword,\n github : github,\n });\n this.copyStub(__dirname + '/js/webpack.config.js', pathBase + '/webpack.config.js', { 'version' : version });\n this.copyStub(__dirname + '/js/browser.js', pathBase + '/browser.js', { 'internal_name' : internal_name });\n\n // Arquivos /src/Base\n this.copyStub(__dirname + '/js/src/Client.js', pathBase + '/src/Base/Client.js', { 'version' : version });\n this.copyStub(__dirname + '/js/src/Global.js', pathBase + '/src/Base/Global.js');\n this.copyStub(__dirname + '/js/src/Consts.js', pathBase + '/src/Base/Consts.js', {\n 'env_production' : this.config('build.endpoints.production', '???'),\n 'env_sandbox' : this.config('build.endpoints.sandbox', '???'),\n 'env_local' : this.config('build.endpoints.local', '???'),\n });\n this.copyStub(__dirname + '/js/src/Model.js', pathBase + '/src/Base/Model.js');\n this.copyStub(__dirname + '/js/src/Resource.js', pathBase + '/src/Base/Resource.js');\n this.copyStub(__dirname + '/js/src/ApiClient.js', pathServices + '/ApiClient.js');\n\n // Models /src/Models\n Arr.each(this.models, (key, model) => {\n $this.buildModel(pathModels, model, pathStubs);\n });\n\n // Resources /src/Resources\n Arr.each(this.resources, (key, resource) => {\n $this.buildResource(pathResources, resource, pathStubs);\n });\n\n // Services /src\n var services = [];\n Arr.each(this.services, (key, service) => {\n services.push($this.buildService(pathServices, service, pathStubs));\n });\n\n // Gerar arquivo index.js\n this.copyIndex(services, pathBase);\n }", "generateGetAll() {\n\n }", "function main() {\n var _a;\n return __awaiter(this, void 0, void 0, function () {\n var sourceFile, generatedFileName, apiName, error_1;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n _b.trys.push([0, 2, , 3]);\n return [4 /*yield*/, Ambrosia.initializeAsync(Ambrosia.LBInitMode.CodeGen)];\n case 1:\n _b.sent();\n sourceFile = Utils.getCommandLineArg(\"sourceFile\");\n generatedFileName = (_a = Utils.getCommandLineArg(\"generatedFileName\", \"TestOutput\")) !== null && _a !== void 0 ? _a : \"TestOutput\";\n apiName = Path.basename(generatedFileName).replace(Path.extname(generatedFileName), \"\");\n // If want to run as separate generation steps for consumer and publisher\n //Meta.emitTypeScriptFileFromSource(sourceFile, { fileKind: Meta.GeneratedFileKind.Consumer, mergeType: Meta.FileMergeType.None, emitGeneratedTime: false, generatedFileName: generatedFileName+\"_Consumer\" });\n //Meta.emitTypeScriptFileFromSource(sourceFile, { fileKind: Meta.GeneratedFileKind.Publisher, mergeType: Meta.FileMergeType.None, emitGeneratedTime: false, generatedFileName: generatedFileName+\"_Publisher\" });\n // Use this for single call to generate both consumer and publisher\n Meta.emitTypeScriptFileFromSource(sourceFile, { apiName: apiName, fileKind: Meta.GeneratedFileKind.All, mergeType: Meta.FileMergeType.None, emitGeneratedTime: false, generatedFilePrefix: generatedFileName, strictCompilerChecks: false });\n return [3 /*break*/, 3];\n case 2:\n error_1 = _b.sent();\n Utils.tryLog(error_1);\n return [3 /*break*/, 3];\n case 3: return [2 /*return*/];\n }\n });\n });\n}", "function APIClass() {\n\t// Config\n\tthis.api_url_base = \"http://\" + window.location.hostname + \":\";\n\tthis.default_config = new Config(PORT.ORCHESTRATOR, CONTENT_TYPE.NONE, METHOD.GET);\n\n\n\t/**\n\t * Open HTTP Request\n\t * @param api_config\n\t * @param uri\n\t * @returns {XMLHttpRequest}\n\t */\n\tthis.open_request = function(api_config, uri) {\n\t\tlet url = this.api_url_base + api_config.port + uri;\n\t\tconsole.log(\"[API] [\" + api_config.method + \"] \" + url);\n\n\t\tlet http = new XMLHttpRequest();\n\t\thttp.open(api_config.method, url, true);\n\t\tif(api_config.contentType !== CONTENT_TYPE.NONE) {\n\t\t\thttp.setRequestHeader(\"Content-Type\", api_config.contentType);\n\t\t}\n\t\thttp.setRequestHeader(\"Authorization\", \"Basic \" + window.localStorage.getItem(\"defpi_token\"));\n\t\treturn http;\n\t};\n\n\t/**\n\t * Send method for API request\n\t * @param {object}\t\t\t\tapi_config\n\t * @param {string} \t\turi\n\t * @param {object} \t\tdata\n\t * @param {function} \t\tcallback\n\t * @param {function(number)} error\n\t */\n\tthis.send = function(api_config, uri, data, callback, error) {\n\t\tif(api_config === null) api_config = this.default_config;\n\n\t\tlet http = this.open_request(api_config, uri);\n\t\thttp.onreadystatechange = function() {\n\t\t\tif(http.readyState === http.DONE ) {\n\t\t\t\tif (http.status >= 200 && http.status <= 207) {\n\t\t\t\t\tif (this.getResponseHeader(\"Content-Type\") === \"application/javascript\" || this.getResponseHeader(\"Content-Type\") === \"application/json\") {\n\t\t\t\t\t\tlet response = JSON.parse(http.response);\n\t\t\t\t\t\tcallback(response);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcallback(http.response);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(\"[Api] HTTP CODE: \" + http.status);\n\t\t\t\t\tif(error != null) { error(http.status); return; }\n\n\t\t\t\t\tconsole.log(\"Server down?\");\n\t\t\t\t\t//document.location = \"/\";\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\thttp.send(data);\n\t};\n\n}", "constructor(api) {\n this.api = api;\n }", "function createLocalAPIClient() {\r\n\t\t\tvar idata = Class.interfaceDataOf(appClass,ILocalAPIImports);\r\n\t\t\tvar importTable = null;\r\n\t\t\tif (idata != null) importTable = idata.get();\r\n\t\t\treturn new LocalAPIClient(importTable,apiHubs);\r\n\t\t}", "async instantiate(ctx) {\n\n let emptyList = [];\n await ctx.stub.putState('buyers', Buffer.from(JSON.stringify(emptyList)));\n await ctx.stub.putState('sellers', Buffer.from(JSON.stringify(emptyList)));\n await ctx.stub.putState('shippers', Buffer.from(JSON.stringify(emptyList)));\n await ctx.stub.putState('providers', Buffer.from(JSON.stringify(emptyList)));\n await ctx.stub.putState('financeCos', Buffer.from(JSON.stringify(emptyList)));\n }", "_reload() {\n js2py = require(\"../../shift-codegen-py/src\");\n this._generator = new js2py.PyCodeGen({\n topLevelComment: false,\n });\n }", "getInstances() {}", "async buildCode() {\n\t\tawait this._codeSource.generated.generate();\n\t}", "extendCli (cli) {\n cli\n .command('metadata <targetDir> [...inputPaths]', 'Generate required metadata for the API reference docs')\n .option('-o <dir>', 'Output directory. Defaults to <targetDir>/api/')\n .action(async (targetDir, inputPaths, options) => {\n if (inputPaths.length === 0) {\n throw new Error('Please specify at least one path to a folder containing API docs.')\n }\n\n const outputPath = options.o ? path.resolve(options.o) : path.resolve(context.sourceDir, 'api')\n const docgenMainScript = require.resolve('titanium-docgen')\n const command = [\n 'node',\n docgenMainScript,\n '-f', 'json-raw',\n inputPaths.shift(),\n ...inputPaths.reduce((acc, cur) => {\n acc.push('-a', cur)\n return acc\n }, []),\n '-o', outputPath\n ]\n logger.wait('Generating API metadata file...')\n try {\n logger.debug(`Running command ${command.join(' ')}`)\n await execAsync(command.join(' '))\n logger.success(`Done! Metadata file generated to ${path.join(outputPath, 'api.json')}`)\n } catch (e) {\n logger.error('Failed to generate API metadata.')\n throw e\n }\n })\n }", "function instantiateAPI() {\n new DroneDeploy({version: 1}).then(function(dronedeploy){\n dronedeploy.Plans.getCurrentlyViewed().then(function(plan){\n var zoom = getZoom(plan.geometry);\n\n dronedeploy.Tiles.get({planId: plan.id, layerName: 'ortho', zoom: zoom.zoom})\n .then(function(res){\n var tiles = getTilesFromGeometry(res.template, zoom.zoom, zoom.xwidth, zoom.ywidth, zoom.topTile, zoom.leftTile);\n var canvas = document.createElement('canvas'); // use canvas to draw image and obtain its dataURL\n canvas.width = 256 * zoom.xwidth;\n canvas.height = 256 * zoom.ywidth;\n var ctx = canvas.getContext('2d');\n var dataURL;\n var imageProgress = 0;\n // iterate through our tiles and convert it to a canvas object\n for (var y = 0; y < zoom.ywidth; y++) {\n for (var x = 0; x < zoom.xwidth; x++) {\n var img = document.createElement('img');\n var corsRedirectURL = 'https://cors-anywhere.herokuapp.com/';\n img.src = corsRedirectURL + tiles[(y * zoom.xwidth) + x];\n img.dataset.x = x;\n img.dataset.y = y;\n img.crossOrigin = \"Anonymous\";\n img.onload = function () {\n ctx.drawImage(this, 256 * this.dataset.x, 256 * this.dataset.y, 256, 256);\n imageProgress++;\n if (imageProgress == zoom.xwidth* zoom.ywidth) {\n // at this point we have processed all tiles and can obtain the canvas dataURL\n dataURL = canvas.toDataURL();\n dataURLToPDf(zoom,dataURL,plan);\n }\n };\n }\n }\n //Letting user know that the pdf is being processed\n dronedeploy.Messaging.showToast('Downloading PDF... Please Wait', {timeout: 1000});\n });\n });\n });\n\n\n }", "constructor() {\n\n this.format = require('string-format');\n this.lodash = require('lodash');\n\n this.verbs = this.mapVerbs();\n this.implementedAnnotations = this.mapImplementedAnnotations();\n this.types = this.mapTypes();\n this.formats = this.mapFormats();\n this.parametersIn = this.mapParametersIn();\n this.name = 'node';\n this.fileExtension = '.js';\n this._IDType = 'int';\n this.capitalizeModelName = true;\n this.capitalizePropertyName = true;\n this.destinationFolderPath = 'Models';\n this.projectName = 'App';\n this._IDPrefix = 'Id';\n this._IDType = 'int';\n this.models = [];\n this.arrayImplementer = '[]';\n }", "async execute ({ build }) {\n\n // Pulls attributes out of build object\n // TODO - accept OUTPUT_DIRECTORY override\n let {\n id,\n blueprint,\n stages\n } = build\n\n // Inflates blueprint metadata\n // TODO - handle missing blueprint object\n blueprint = inflate({ blueprint });\n\n await this.writeBuildManifest({ build })\n\n // Runs stage of the build array\n // TODO - conflate each stage to its respective generator,\n // skipping / throwing errors on those whos generator is missing\n return Promise.each(stages, async ({ generator_id, configuration }) => {\n // stages.forEach(async ({ generator_id, configuration }) => {\n\n // Pulls generator from registry\n const generator = this.generators.find(g => g.id === generator_id)\n if (!generator) return\n const { generator_path, project_path } = generator\n\n // Sets output_directory default to build ID by default\n const output_directory = id || '';\n\n // Assigns `dest` option for generator\n // TODO - handle condition of missing blueprint.identifier\n const dest = path.join(this.options.cwd, OUTPUT_DIRECTORY, output_directory, blueprint.identifier, project_path);\n\n // Try to load up the generator from generator_path, catch error\n // TODO - this final check should be abstracted into a separate function\n try {\n // const GeneratorClass = require(generator_path); // eslint-disable-line import/no-dynamic-require\n const generatorPrototype = require(generator_path); // eslint-disable-line import/no-dynamic-require\n const resolved = require.resolve(generator_path);\n\n // Defines options for\n const generator_options = {\n blueprint,\n dest,\n resolved,\n configuration\n }\n\n // Logging\n // console.info(`Executing ${GeneratorClass.name} generators:`)\n console.info(`Executing generators:`)\n return new Promise(async (resolve, rejcet) => {\n const generatorInstance = new Generator(generatorPrototype, generator_options)\n\n // Invokes `generator.forEachSchema` once for each in blueprint.schemas\n await Promise.all(blueprint.schemas.map((schema) => generatorInstance.forEachSchema({ schema: schema, ...this.options })))\n\n // Invokes `generator.write()` once\n await generatorInstance.write(this.options)\n\n // Invokes generator.compileTemplatesInPlace()\n await generatorInstance.compileTemplatesInPlace()\n\n return resolve()\n })\n\n // Logs which generator is being run\n } catch (err) {\n if (err.code === 'MODULE_NOT_FOUND') {\n console.log('RUNTIME ERROR - GENERATOR NOT FOUND')\n } else {\n console.log('RUNTIME ERROR - OTHER')\n throw err;\n }\n return reject(err)\n }\n\n }).then(() => {\n // Thank you message\n console.log('\\nBuild complete\\nThank you for using Codotype :)\\nFollow us on github.com/codotype\\n')\n })\n }", "generate (type) {\n return generate(type)\n }", "function setupMobGenerator(){\n var combatant_stats;\n var expert_stats;\n var spellcaster_stats;\n var npcs = [];\n var publicAPI = {\n npcs,\n combatant_stats,\n expert_stats,\n spellcaster_stats,\n generateGenericNPC\n }; \n return publicAPI\n\n // **************************\n\n // Factory for general combatant type mobs. \n // Takes as arguments: \n // base: A base tempalate array to use. This will always be one of: combatant_stats, expert_stats, \n // or spellcaster_stats which will contain an object holding all the information from the book.\n // name: The name of the NPC. Defaults to \"rando NPC\" 'cos that's fun :p \n // cr: A string that is a number from 1 to 25 or \"half\" or \"third\" representing the CR of the NPC to be created, \n // abilities: an array of three strings in order from highest ability scrore to lowest. The only valid\n // strings are: \"str\",\"dex\",\"con\",\"int\",\"wis\", or \"cha\" \n // skills: An array of strings represnting skill names in the order master skills before good skills.\n function generateGenericNPC(base, name = \"rando NPC\", cr, abilities, skills) {\n var mob = {\n \"id\": `npc_${name}_${cr}_${skills.length}`,\n \"cr\": cr, \n \"name\": name,\n \"str\": 0,\n \"dex\": 0,\n \"con\": 0,\n \"int\": 0,\n \"wis\": 0,\n \"cha\": 0,\n \"hp\": base[cr].hp,\n \"initive\": 0,\n \"eac\": base[cr].eac,\n \"kac\": base[cr].kac,\n \"fort\": base[cr].fort,\n \"ref\": base[cr].ref,\n \"will\": base[cr].will,\n \"lowattack\": base[cr].lowattack,\n \"highattack\": base[cr].highattack,\n \"defaultenergydmg\": base[cr].energydmg,\n \"defaultkineticdmg\": base[cr].kineticdmg,\n \"defautmeleedmg\": base[cr].stdmeleedmg,\n \"defaultmeleethreedmg\": base[cr].threemeleedmg,\n \"defaultmeleefourdmg\": base[cr].fourmeleedmg,\n \"abilitydc\": base[cr].abilitydc,\n \"spelldc\": base[cr].spelldc,\n \"skills\": [],\n \"weapons\": [],\n rollBasicDamage: rollDamage,\n rollBasicAttack: rollAttack,\n rollSkillCheck: rollSkill\n };\n\n // assign abilities\n for (let i = 0; i < abilities.length; i++) {\n switch (abilities[i]) {\n case \"str\":\n mob.str += base[cr].abilitymods[i];\n console.log(`Str now ${mob.str}`);\n break;\n case \"dex\":\n mob.dex += base[cr].abilitymods[i];\n console.log(`Dex now ${mob.dex}`);\n break;\n case \"con\":\n mob.con += base[cr].abilitymods[i];\n console.log(`Con now ${mob.con}`);\n break;\n case \"int\":\n mob.int += base[cr].abilitymods[i];\n console.log(`Int now ${mob.int}`);\n break;\n case \"wis\":\n mob.wis += base[cr].abilitymods[i];\n console.log(`Wis now ${mob.wis}`);\n break;\n case \"cha\":\n mob.cha += base[cr].abilitymods[i];\n console.log(`Cha now ${mob.cha}`);\n }\n\n }\n //assign skills: the skills in the array will always be considered to be in order\n //Master Skills -> Good Skills \n\n for (let i = 0; i < skills.length; i++) {\n let ability = 0;\n let skill = { \"name\": skills[i], \"modifier\": 0 };\n\n // determine the ability modifier to use\n if (skill.name === \"Computers\" ||\n skill.name === \"Culture\" ||\n skill.name === \"Engineering\" ||\n skill.name === \"Life Science\" ||\n skill.name === \"Medicine\" ||\n skill.name === \"Physical Science\"\n ) {\n skill.modifier += mob.int;\n }\n else if (skill.name === \"Acrobatics\" ||\n skill.name === \"Piloting\" ||\n skill.name === \"Sleight of Hand\" ||\n skill.name === \"Stealth\"\n ) {\n skill.modifier += mob.dex;\n }\n else if (skill.name === \"Mysticicm\" ||\n skill.name === \"Perception\" ||\n skill.name === \"Sense Motive\" ||\n skill.name === \"Survival\"\n ) {\n skill.modifier += mob.wis;\n }\n else if (skill.name === \"Bluff\" ||\n skill.name === \"Diplomacy\" ||\n skill.name === \"Disguise\" ||\n skill.name === \"Intimidate\"\n ) {\n skill.modifier += mob.cha;\n }\n else if (skill.name === \"Athletics\") {\n skill.modifier += mob.str;\n }\n\n if (i <= base[cr].masterskillcount - 1) {\n //assign master skills\n skill.modifier += base[cr].masterskill;\n }\n else {\n //assign good skills\n skill.modifier += base[cr].goodskill;\n }\n\n mob.skills.push(skill);\n }\n\n // generates a random die roll based on the damage dice in the mob entry and addes the appropriate modifiers\n function rollDamage(damageType) {\n var damagedice;\n var damagemod;\n switch (damageType) {\n case \"energy\":\n damagedice = mob.defaultenergydmg;\n damagemod = 0;\n break;\n case \"kinetic\":\n damagedice = mob.defaultkineticdmg;\n damagemod = 0;\n break;\n case \"melee\":\n damagedice = mob.defautmeleedmg;\n damagemod = mob.str;\n break;\n case \"threemelee\":\n damagedice = mob.defaultmeleethreedmg;\n damagemod = mob.str;\n break;\n case \"fourmelee\":\n damagedice = mob.defaultmeleefourdmg;\n damagemod = mob.str;\n }\n var crToAdd = !isNaN(cr) ? Number(cr) : 0;\n var rolls = Helpers.rolldice(damagedice);\n var die = damagedice.slice(damagedice.indexOf(\"d\"));\n var damage = 0;\n var report = \"[\";\n\n for (let i = 0; i < rolls.length; i++) {\n damage += rolls[i] + crToAdd + damagemod;\n report += ` ${rolls[i]} on ${die} `;\n }\n report += \"]\";\n return {\"result\":damage, report};\n }\n\n function rollAttack(attackType) {\n var attackbonus;\n switch (attackType) {\n case \"high\":\n attackbonus = mob.highattack;\n break;\n case \"low\":\n attackbonus = mob.lowattack;\n }\n var roll = Helpers.rolldice(\"1d20\")[0];\n var attack = roll + attackbonus;\n if(roll === 20){\n var report = \"[ POTENTIAL CRITICAL! ]\";\n }\n else{\n var report = `[ ${roll} on 1d20 ]`;\n }\n return {\"result\":attack, report};\n \n\n }\n\n function rollSkill(skillnumber){\n var roll = Helpers.rolldice(\"1d20\")[0];\n var result = roll + mob.skills[skillnumber].modifier;\n var report = `[ ${roll} on 1d20 ]`;\n return {result, report};\n }\n\n npcs.push(mob);\n return mob;\n } \n}", "function Main() {\n buildinterface();\n interfaceLogic();\n }" ]
[ "0.65616477", "0.6193087", "0.6144607", "0.60761553", "0.604633", "0.60436165", "0.60384524", "0.5923885", "0.5916891", "0.58548397", "0.5840231", "0.5826503", "0.5826503", "0.58237714", "0.58223194", "0.5743405", "0.573896", "0.57174766", "0.5708785", "0.56931084", "0.5691715", "0.56828517", "0.56814253", "0.5663044", "0.5658798", "0.56581223", "0.5627959", "0.5627346", "0.55785793", "0.5572471", "0.5544431", "0.5504648", "0.550351", "0.5455646", "0.5455163", "0.54251903", "0.542001", "0.5419806", "0.5397642", "0.5387597", "0.537994", "0.53601414", "0.5344592", "0.5337401", "0.53187054", "0.53129715", "0.5307502", "0.53051794", "0.53031987", "0.53031987", "0.53031987", "0.5300094", "0.52963257", "0.5293427", "0.52885634", "0.52849317", "0.52783954", "0.52727395", "0.5271729", "0.52649", "0.5258999", "0.52584237", "0.5254612", "0.52454257", "0.5233395", "0.52233225", "0.52175695", "0.5201499", "0.5199843", "0.5198466", "0.51955986", "0.5195107", "0.5189186", "0.5155871", "0.5148567", "0.5144507", "0.5141386", "0.5141197", "0.51388705", "0.51383007", "0.51369727", "0.5122793", "0.51085365", "0.50955415", "0.50954336", "0.50926805", "0.50790673", "0.5076087", "0.50731605", "0.5069577", "0.50684774", "0.5067531", "0.5067049", "0.5061483", "0.5061031", "0.50554645", "0.50508773", "0.5047196", "0.5045026", "0.5040699" ]
0.5934592
7
Generate API file given discovery URL
async discoverAPI(apiDiscoveryUrl) { if (typeof apiDiscoveryUrl === 'string') { const parts = url.parse(apiDiscoveryUrl); if (apiDiscoveryUrl && !parts.protocol) { this.log('Reading from file ' + apiDiscoveryUrl); const file = await readFile(apiDiscoveryUrl, { encoding: 'utf8' }); return this.makeEndpoint(JSON.parse(file)); } else { this.log('Requesting ' + apiDiscoveryUrl); const res = await this.transporter.request({ url: apiDiscoveryUrl, }); return this.makeEndpoint(res.data); } } else { const options = apiDiscoveryUrl; this.log('Requesting ' + options.url); const url = options.url; delete options.url; const parameters = { options: { url, method: 'GET' }, requiredParams: [], pathParams: [], params: options, context: { google: { _options: {} }, _options: {} }, }; const res = await apirequest_1.createAPIRequest(parameters); return this.makeEndpoint(res.data); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function genApiURL ( offset ) {\n URL = gamesURL + apiKey + formatOffset + offset;\n return URL;\n}", "function buildSpecUrl() {\n let {protocol, host} = window.location\n let url = window.PRELOAD.swagger_url || '/docs?format=openapi'\n return `${protocol}//${host}${url}`\n}", "async discoverAllAPIs(discoveryUrl) {\n const headers = this.options.includePrivate\n ? {}\n : { 'X-User-Ip': '0.0.0.0' };\n const res = await this.transporter.request({\n url: discoveryUrl,\n headers,\n });\n const items = res.data.items;\n const apis = await Promise.all(items.map(async (api) => {\n const endpointCreator = await this.discoverAPI(api.discoveryRestUrl);\n return { api, endpointCreator };\n }));\n const versionIndex = {};\n // tslint:disable-next-line no-any\n const apisIndex = {};\n for (const set of apis) {\n if (!apisIndex[set.api.name]) {\n versionIndex[set.api.name] = {};\n apisIndex[set.api.name] = (options) => {\n const type = typeof options;\n let version;\n if (type === 'string') {\n version = options;\n options = {};\n }\n else if (type === 'object') {\n version = options.version;\n delete options.version;\n }\n else {\n throw new Error('Argument error: Accepts only string or object');\n }\n try {\n const ep = \n // tslint:disable-next-line: no-any\n set.endpointCreator(options, this);\n return Object.freeze(ep); // create new & freeze\n }\n catch (e) {\n throw new Error(util.format('Unable to load endpoint %s(\"%s\"): %s', set.api.name, version, e.message));\n }\n };\n }\n versionIndex[set.api.name][set.api.version] = set.endpointCreator;\n }\n return apisIndex;\n }", "function serveApiDefinition(fpath, req, res) {\n fs.readFile(fpath, 'utf-8', function(err, c) {\n if(err) {\n res.end('');\n } else {\n c = c.replace(/%%HOST%%/, req.headers.host);\n res.end(c);\n }\n });\n}", "function api_create_url(){\n // Store our API URL parameters in this utility object\n var params = {\n \"method\": \"flickr.photosets.getPhotos\",\n \"api_key\": window.api_key,\n \"photoset_id\": window.photoset_id,\n \"format\": \"json\",\n \"nojsoncallback\": \"1\",\n \"extras\": \"url_m\"\n };\n\n // Construct the URL from the params\n var url = \"https://api.flickr.com/services/rest/?\";\n for (var prop in params){ url += prop+\"=\"+params[prop]+\"&\"; }\n\n return url;\n}", "async function generate(opts) {\n const apiFinder = parse_1.parse(opts);\n const data = apiFinder(opts.api);\n const results = {\n ...opts,\n data,\n };\n if (opts.outputJsonPath) {\n await output_1.outputJson(opts.outputJsonPath, data);\n }\n if (opts.outputReadmePath) {\n await output_1.outputReadme(opts.outputReadmePath, data);\n }\n return results;\n}", "function gen_url(object){\n var server = config.get('api_conf.server');\n var port = config.get('api_conf.port');\n var version = config.get('api_conf.version');\n var account = config.get('api_conf.account');\n\n url = \"http://\" + server + \":\" + port + \"/\" + version + \"/\" + account \n //Check if the container/object exist, if they exist \n //concatenate it to the url variable \n if(config.has('api_conf.container')){\n url += \"/\" + config.get('api_conf.container'); \n } \n if(config.has('api_conf.object')){\n url += \"/\" + config.get('api_conf.object');\n }\n url += object; \n\n return url;\n}", "get apiUrl() {\n return `http://${this.host}:${this.tempApiPort}/api`; // setups up the url that the api is located at and used as a shortcut for our fetch api scripts to retrieve data\n }", "function makeUrl() {\n return \"https://api.themoviedb.org/3/discover/movie?\"+\n \"api_key=7206d76e96b3e78b399d05fbcda1ea0d&language=en-US%20en-GB&\"+\n \"sort_by=popularity.desc&include_adult=false&include_video=false&page=\" + random(50);\n }", "function _buildApiUrl (datasetname, configkey) {\n\t\tlet url = API_BASE;\n\t\turl += '?key=' + API_KEY;\n\t\turl += datasetname && datasetname !== null ? '&dataset=' + datasetname : '';\n\t\turl += configkey && configkey !== null ? '&configkey=' + configkey : '';\n\t\t//console.log('buildApiUrl: url=' + url);\n\t\t\n\t\treturn url;\n\t}", "function getAPI() {\n\treturn \"http://\" + apiUrl + \":\" + apiPort + \"/\" + apiResource;\n}", "function makeApiFiles(api, apiOutputDir, sourceDir, libname) {\n var apiHeaderTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabAPI.h.ejs\")));\n var apiCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabAPI.cpp.ejs\")));\n var apiPlayFabModelTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModels.h.ejs\")));\n var apiPlayFabModelCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModels.cpp.ejs\")));\n var apiPlayFabModelDecoderHTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModelDecoder.h.ejs\")));\n var apiPlayFabModelDecoderCppTemplate = ejs.compile(readFile(path.resolve(sourceDir, \"templates/PlayFabModelDecoder.cpp.ejs\")));\n \n var generatedHeader;\n var generatedBody;\n var apiLocals = {};\n apiLocals.api = api;\n apiLocals.hasClientOptions = api.name === \"Client\";\n apiLocals.sdkVersion = exports.sdkVersion;\n apiLocals.libname = libname;\n \n generatedHeader = apiHeaderTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"API.h\"), generatedHeader);\n generatedBody = apiCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"API.cpp\"), generatedBody);\n \n generatedHeader = apiPlayFabModelTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"Models.h\"), generatedHeader);\n generatedBody = apiPlayFabModelCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"Models.cpp\"), generatedBody);\n \n generatedHeader = apiPlayFabModelDecoderHTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Classes/PlayFab\" + api.name + \"ModelDecoder.h\"), generatedHeader);\n generatedBody = apiPlayFabModelDecoderCppTemplate(apiLocals);\n writeFile(path.resolve(apiOutputDir, \"PluginFiles/PlayFab/Source/PlayFab/Private/PlayFab\" + api.name + \"ModelDecoder.cpp\"), generatedBody);\n}", "function apiURL(service) { //Función para formar la ruta completa a la API \n return BaseApiUrl + service;\n}", "function create_url(endpoint) {\n // TODO: ここを書き換えてURL作る\n // return '/api/guchi' + endpoint\n return URL_BASE + '/deai/' + endpoint;\n}", "static async build(url) {\n let resp = await fetch(url + \"/v1/parameters\");\n let params = await resp.text();\n let client = new Client(url, params, module);\n return client;\n }", "async function downloadDiscoveryDocs(options) {\n await exports.gfs.mkdir(options.downloadPath);\n const headers = options.includePrivate\n ? {}\n : { 'X-User-Ip': '0.0.0.0' };\n console.log(`sending request to ${options.discoveryUrl}`);\n const res = await gaxios_1.request({ url: options.discoveryUrl, headers });\n const apis = res.data.items;\n const indexPath = path.join(options.downloadPath, 'index.json');\n exports.gfs.writeFile(indexPath, res.data);\n const queue = new p_queue_1.default({ concurrency: 25 });\n console.log(`Downloading ${apis.length} APIs...`);\n const changes = await queue.addAll(apis.map(api => async () => {\n console.log(`Downloading ${api.id}...`);\n const apiPath = path.join(options.downloadPath, api.id.replace(':', '-') + '.json');\n const url = api.discoveryRestUrl;\n const changeSet = { api, changes: [] };\n try {\n const res = await gaxios_1.request({ url });\n // The keys in the downloaded JSON come back in an arbitrary order from\n // request to request. Sort them before storing.\n const newDoc = sortKeys(res.data);\n let updateFile = true;\n try {\n const oldDoc = JSON.parse(await exports.gfs.readFile(apiPath));\n updateFile = shouldUpdate(newDoc, oldDoc);\n changeSet.changes = getDiffs(oldDoc, newDoc);\n }\n catch (_a) {\n // If the file doesn't exist, that's fine it's just new\n }\n if (updateFile) {\n exports.gfs.writeFile(apiPath, newDoc);\n }\n }\n catch (e) {\n console.error(`Error downloading: ${url}`);\n }\n return changeSet;\n }));\n return changes;\n}", "async discoverAPI(apiPath, options = {}) {\n const endpointCreator = await this._discovery.discoverAPI(apiPath);\n const ep = endpointCreator(options, this);\n ep.google = this; // for drive.google.transporter\n return Object.freeze(ep);\n }", "function _buildApiUrl (datasetname, coursekey) {\n\t\tlet url = API_BASE;\n\t\turl += '?key=' + API_KEY;\n\t\turl += datasetname && datasetname !== null ? '&dataset=' + datasetname : '';\n\t\turl += coursekey && coursekey !== null ? '&coursekey=' + coursekey : '';\n\t\t//console.log('buildApiUrl: url=' + url);\n\t\t\n\t\treturn url;\n\t}", "static get API_URL() {\r\n const port = 1337; // Change this to your server port\r\n return `http://localhost:${port}/`;\r\n }", "function getUrl() {\n url = \"https://api.nasa.gov/EPIC/api/natural/date/\" + date + \"?api_key=\" + API_KEY;\n}", "get __generateRequestURL() {\n const {\n folderName,\n name\n } = this.fsProcessor.file;\n\n return String(`${this.resource}/_api/web/GetFolderByServerRelativeUrl('${folderName}')/Files('${name}')/$value`);\n }", "function exportIodocs(src){\n var obj = clone(src,false);\n obj.swagger = '2.0';\n obj.info = {};\n obj.info.version = obj.version || '1';\n obj.info.title = obj.name;\n obj.info.description = obj.description;\n obj.paths = {};\n\n var u = url.parse(obj.basePath+obj.publicPath);\n obj.schemes = [];\n obj.schemes.push(u.protocol.replace(':',''));\n obj.host = u.host;\n obj.basePath = u.path;\n\n delete obj.version;\n delete obj.title;\n delete obj.description;\n delete obj.publicPath;\n delete obj.privatePath; // for oauth etc\n delete obj.protocol;\n delete obj.name;\n delete obj.auth; // TODO\n delete obj.oauth; // TODO\n delete obj.headers; // TODO\n rename(obj,'schemas','definitions');\n if (obj.definitions) fixSchema(obj.definitions);\n\n for (var r in obj.resources) {\n var resource = obj.resources[r];\n // do tags\n for (var m in resource.methods) {\n var method = resource.methods[m];\n method.path = fixPathParameters(method.path);\n\n if (!obj.paths[method.path]) obj.paths[method.path] = {};\n var path = obj.paths[method.path];\n\n var httpMethod = method.httpMethod.toLowerCase();\n if (!path[httpMethod]) path[httpMethod] = {};\n\n var op = path[httpMethod];\n op.operationId = m;\n op.description = method.description;\n op.parameters = [];\n\n for (var p in method.parameters) {\n var param = method.parameters[p];\n param.name = p;\n if (param.title) rename(param,'title','name');\n if ((param.type == 'textarea') || (param.type == 'enumerated')) param.type = 'string';\n if (param.type == 'long') param.type = 'number';\n if (param.type == 'string[]') {\n param.type = 'array';\n param.items = {};\n param.items.type = 'string';\n }\n rename(param,'location','in');\n if (!param[\"in\"]) {\n if (method.path.indexOf('{'+param.name+'}')>=0) {\n param[\"in\"] = 'path';\n }\n else {\n param[\"in\"] = 'query';\n }\n }\n if ((param[\"in\"] == 'body') && (param.type != 'object')) {\n param[\"in\"] = 'formData'; // revalidate\n }\n if (param[\"in\"] == 'pathReplace') {\n param[\"in\"] = 'path';\n }\n if (param[\"in\"] == 'path') {\n param.required = true;\n }\n if (typeof param.required == 'string') {\n param.required = (param.required === 'true');\n }\n if (param.properties) {\n delete param.type;\n param.schema = {};\n param.schema.type = 'object';\n param.schema.properties = param.properties;\n delete param.properties;\n delete param[\"default\"];\n fixSchema(param.schema);\n }\n if (param.items) fixSchema(param.items);\n op.parameters.push(param);\n }\n op.tags = [];\n op.tags.push(r);\n\n op.responses = {};\n op.responses[\"200\"] = {};\n op.responses[\"200\"].description = 'Success';\n\n }\n }\n\n delete obj.resources;\n return obj;\n}", "function constructFlurryAppInfoEndpoint(){\n url_app_metric_specific = 'getApplication';\n url_new_Flurry = base_url_Flurry + 'appInfo/' + url_app_metric_specific + '/?apiAccessCode=' + apiAccessCode + '&apiKey=' + apiKey;\n return url_new_Flurry;\n}", "function buildTrainApiURl() {\n\n // if (new Date().getHours() >= 11) {\n // return 'https://huxley2.azurewebsites.net/delays/read/30?accessToken=b09cb836-f190-445d-8b96-372eb024141d&expand=true';\n // } else {\n // return 'https://huxley2.azurewebsites.net/delays/tot/30?accessToken=b09cb836-f190-445d-8b96-372eb024141d&expand=true';\n // }\n return 'https://huxley2.azurewebsites.net/delays/tot/30?accessToken=b09cb836-f190-445d-8b96-372eb024141d&expand=true';\n}", "_createApiUrl() {\n this._apiUrl = `https://api.trello.com/1/cards/${this._cardId}/attachments/${this._attachmentId}`;\n }", "loadAPI(api) {\n if (api !== '') {\n let files = [];\n let overrides = new Map();\n\n for (let param of api.slice(1).split('&')) {\n let [key, value] = param.split('=');\n\n if (value !== undefined) {\n // Test also overrides.\n files.push(value);\n\n if (key.startsWith('override')) {\n // Discord changes \\ to / in urls, ignoring escaping, so escape manually.\n overrides.set(key.slice(9, -1).replace(/\\//g, '\\\\'), value);\n }\n }\n }\n\n if (files.length) {\n let pathSolver = (src, params) => {\n let override = overrides.get(basename(src).toLowerCase());\n\n if (override) {\n return override;\n } else {\n return localOrHive(src, params);\n }\n };\n\n let render = true;\n\n for (let file of files) {\n fetch(file)\n .then(async (response) => {\n let buffer;\n\n if (file.endsWith('.mdl')) {\n buffer = await response.text();\n } else {\n buffer = await response.arrayBuffer();\n }\n\n this.test(file, buffer, render, pathSolver);\n\n render = false;\n });\n }\n }\n }\n }", "function getResourceUrl() { return \"http://\"+location.href.split(\"//\")[1].split(\"/\").splice(0,3).join(\"/\")+'.json?api_key='+MoviePilot.apikey;}", "static makeAPICall(endpoint, input, options = {}) {\n switch (endpoint) {\n case GET_TOKEN:\n if (options.body === undefined) {\n options.body = {};\n }\n options.body.client_id = process.env.REACT_APP_CLIENT_ID;\n return this._fetchFromAPI(this.authUrlBeginning + \"token/\", options);\n case CREATE_USER:\n return this._fetchFromAPI(this.urlBeginning + \"createUser/\", options);\n case VALIDATE_TOKEN:\n return this._addAuthorization(this.urlBeginning + \"validateToken/\");\n case FORGOT_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/\", options);\n case RESET_PASSWORD:\n return this._fetchFromAPI(this.urlBeginning + \"password_reset/confirm\", options);\n case UPLOAD_DOCUMENT:\n return this._addAuthorization(this.urlBeginning + \"uploadDoc/\", options);\n case UPLOAD_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"uploadAnnot/\", options);\n case GET_ALL_ANNOTE_BY_CURRENT_USER:\n return this._addAuthorization(this.urlBeginning + \"getAllMyAnnots/\" + (input == null ? \"\" : input));\n case GET_ALL_ANNOTE:\n return this._addAuthorization(this.urlBeginning + \"getAllAnnots/\" + (input == null ? \"\" : input));\n case GET_ANNOTATIONS_FILENAME_USER:\n return this._addAuthorization(this.urlBeginning + \"getAnnotationsByFilenameUser/\" + input + this.json);\n case EXPORT_CURRENT_ANNOTATIONS:\n return this._addAuthorization(this.urlBeginning + \"exportAnnotations/\" + input + this.json);\n case DOWNLOAD_ANNOTATIONS_BY_ID:\n return this._addAuthorization(this.urlBeginning + \"downloadAnnotations/\" + input + this.json);\n\n // ICD APIs\n case ANCESTORS:\n return this._addAuthorization(this.urlBeginning + \"ancestors/\" + input + this.json);\n case FAMILY:\n return this._addAuthorization(this.urlBeginning + \"family/\" + input + this.json);\n case CODE_AUTO_SUGGESTIONS:\n return this._addAuthorization(this.urlBeginning + \"codeAutosuggestions/\" + input + this.json);\n case CODE_DESCRIPTION:\n return this._addAuthorization(this.urlBeginning + \"codeDescription/\" + input + this.json);\n default:\n return null;\n }\n }", "function API(){}", "function API(){}", "static get API_URL() {\n const port = 1337; // Change this to your server port\n return `http://localhost:${port}`;\n }", "function generateURL(host, protocol, resourceType) {\n var url = new URL(\"http://{{host}}:{{ports[https][0]}}/common/security-features/subresource/\");\n url.protocol = protocol == Protocol.INSECURE ? \"http\" : \"https\";\n url.hostname = host == Host.SAME_ORIGIN ? \"{{host}}\" : \"{{domains[天気の良い日]}}\";\n\n if (resourceType == ResourceType.IMAGE) {\n url.pathname += \"image.py\";\n } else if (resourceType == ResourceType.FRAME) {\n url.pathname += \"document.py\";\n } else if (resourceType == ResourceType.WEBSOCKET) {\n url.port = {{ports[wss][0]}};\n url.protocol = protocol == Protocol.INSECURE ? \"ws\" : \"wss\";\n url.pathname = \"echo\";\n } else if (resourceType == ResourceType.WORKER) {\n url.pathname += \"worker.py\";\n } else if (resourceType == ResourceType.WORKLET) {\n url.pathname += \"worker.py\";\n } else if (resourceType == ResourceType.FETCH) {\n url.pathname += \"xhr.py\";\n }\n return {\n name: protocol + \"/\" + host + \" \" + resourceType,\n url: url.toString()\n };\n}", "function GetApiPath() {\n return '/api/data/v9.0/';\n }", "async function getEndpoint(url) {\n const headers = new Headers();\n headers.append('x-rapidapi-host', RAPID_API_HOST);\n headers.append('x-rapidapi-key', RAPID_API_KEY);\n try {\n const response = await fetch(url + ENDPOINTS.MODIFIERS, { method: 'GET', headers });\n if (response.ok) {\n const apiData = await response.json();\n return apiData;\n } else {\n return response.ok;\n }\n } catch (err) {\n console.log('fetch failed', err);\n }\n}", "function createWeatherURL() {\n weatherURL = \"https://api.openweathermap.org/data/2.5/forecast?q=davis,ca,us&units=imperial&appid=\" + APIKey;\n}", "formatEndpoint(str)\n {\n var url;\n var apiKey = \"?api_key=c06e14cd13b2c6373fdc8f9f3dd47eb3\";\n var base_uri = \"https://api.themoviedb.org/3/\";\n switch(str)\n {\n case \"Trending\":\n url = base_uri+'trending/movie/week'+apiKey;\n break;\n case \"Popular\":\n url = base_uri+'movie/popular'+apiKey;\n break;\n case \"Now Playing\":\n url = base_uri+'movie/now_playing'+apiKey;\n break;\n default: \n url = base_uri+'trending/movie/week'+apiKey;\n break;\n }\n return url;\n }", "function makeUrl(type,name){\n return 'https://wind-bow.glitch.me/twitch-api/'+type+'/'+name;\n}", "function convertLiveDocs(apiInfo){\n rename(apiInfo,'title','name');\n rename(apiInfo,'prefix','publicPath');\n rename(apiInfo,'server','basePath');\n apiInfo.resources = {};\n for (var e in apiInfo.endpoints) {\n var ep = apiInfo.endpoints[e];\n var eName = ep.name ? ep.name : 'Default';\n\n if (!apiInfo.resources[eName]) apiInfo.resources[eName] = {};\n apiInfo.resources[eName].description = ep.description;\n\n for (var m in ep.methods) {\n var lMethod = ep.methods[m];\n if (!apiInfo.resources[eName].methods) apiInfo.resources[eName].methods = {};\n var mName = lMethod.MethodName ? lMethod.MethodName : 'Default';\n if (mName.endsWith('.')) mName = mName.substr(0,mName.length-1);\n mName = mName.split(' ').join('_');\n rename(lMethod,'HTTPMethod','httpMethod');\n rename(lMethod,'URI','path');\n rename(lMethod,'Synopsis','description');\n rename(lMethod,'MethodName','name');\n\n lMethod.path = fixPathParameters(lMethod.path);\n\n var params = {};\n for (var p in lMethod.parameters) {\n var lParam = lMethod.parameters[p];\n if (!lParam.type) lParam.type = 'string';\n if (lParam.type == 'json') lParam.type = 'string';\n if (!lParam.location) {\n if (lMethod.path.indexOf(':'+lParam.name)>=0) {\n lParam.location = 'path';\n }\n else {\n lParam.location = 'query';\n }\n }\n if (lParam.location == 'boddy') lParam.location = 'body'; // ;)\n params[lParam.name] = lParam;\n delete lParam.name;\n delete lParam.input; // TODO checkbox to boolean?\n delete lParam.label;\n rename(lParam,'options','enum');\n }\n lMethod.parameters = params;\n if (Object.keys(params).length==0) delete lMethod.parameters;\n\n apiInfo.resources[eName].methods[mName] = lMethod;\n }\n\n }\n delete apiInfo.endpoints; // to keep size down\n return apiInfo;\n}", "function createUrl(val){\n return `http://localhost:3000/api/${val}`;\n \n}", "static get API_URL(){\n\t\tconst port = 8081;\n\t\treturn `http://localhost:${port}`\n\t}", "function getapi(){\n\tif (window.location.protocol != \"https:\"){\n\t\treturn \"http://wev.se/etc/api\";\n\t} else{\n\t\treturn \"https://wev.se/etc/api\";\n\t}\n}", "getAPI(request, response) {\n let message = {};\n message.name = 'implementation pending';\n message.version = 'implementation pending';\n return response.jsonp(message);\n }", "function createURL() {\n var query_url = api_url.concat(patientID,auth,accessToken);\n actualQuery();\n }", "function makeApiRequest(word, offset, response) {\n let startIndex;\n (!offset || offset <= 0) ? startIndex = 1 : startIndex = Number(offset);\n let fullUri = gcseUri + word + '&start=' + startIndex;\n let tempStr = '';\n https.get(fullUri, (res) => {\n res.on('data', (res) => {\n tempStr += res;\n })\n .on('end', () => {\n let obj = JSON.parse(tempStr);\n let items = obj['items'];\n let resObj = [];\n items.forEach(item => {\n let tempObj = {\n url: item['link'],\n snippet: item['snippet'],\n thumbnail: item['image']['thumbnailLink'],\n context: item['image']['contextLink']\n };\n resObj.push(tempObj);\n });\n response.send(resObj);\n });\n });\n}", "function convertSwagger(source){\n var apiInfo = clone(source,false);\n apiInfo.resources = {};\n\n\tif (apiInfo.servers && apiInfo.servers.length) {\n\t\tvar u = url.parse(apiInfo.servers[0].url);\n\t\tapiInfo.host = u.host;\n\t\tapiInfo.basePath = u.path;\n\t\tapiInfo.schemes = [];\n\t\tapiInfo.schemes.push(u.protocol.replace(':',''));\n\t}\n\n for (var p in apiInfo.paths) {\n for (var m in apiInfo.paths[p]) {\n if ('.get.post.put.delete.head.patch.options.trace.'.indexOf(m)>=0) {\n var sMethod = apiInfo.paths[p][m];\n var ioMethod = {};\n ioMethod.httpMethod = m.toUpperCase();\n var sMethodUniqueName = sMethod.operationId ? sMethod.operationId : m+'_'+p.split('/').join('_');\n sMethodUniqueName = sMethodUniqueName.split(' ').join('_'); // TODO {, } and : ?\n ioMethod.name = sMethodUniqueName;\n ioMethod.summary = sMethod.summary;\n ioMethod.description = sMethod.description;\n ioMethod.parameters = {};\n var sParams = sMethod.parameters ? sMethod.parameters : [];\n if (apiInfo.paths[p].parameters) {\n sParams = sParams.concat(apiInfo.paths[p].parameters);\n }\n for (var p2 in sParams) {\n var param = sParams[p2];\n var ptr = param[\"$ref\"];\n if (ptr && ptr.startsWith('#/parameters/')) {\n ptr = ptr.replace('#/parameters/','');\n param = clone(apiInfo.parameters[ptr],false);\n }\n if (ptr && ptr.startsWith('#/components/parameters/')) {\n ptr = ptr.replace('#/components/parameters/','');\n param = clone(apiInfo.components.parameters[ptr],false);\n }\n param.location = param[\"in\"];\n delete param[\"in\"];\n\t\t\t\t\tif (!param.type && param.schema && param.schema.type) {\n\t\t\t\t\t\tparam.type = param.schema.type;\n\t\t\t\t\t}\n ioMethod.parameters[param.name] = param;\n }\n ioMethod.path = p;\n ioMethod.responses = sMethod.responses;\n var tagName = 'Default';\n if (sMethod.tags && sMethod.tags.length>0) {\n tagName = sMethod.tags[0];\n }\n if (!apiInfo.resources[tagName]) {\n apiInfo.resources[tagName] = {};\n if (apiInfo.tags) {\n for (var t in apiInfo.tags) {\n var tag = apiInfo.tags[t];\n if (tag.name == tagName) {\n apiInfo.resources[tagName].description = tag.description;\n apiInfo.resources[tagName].externalDocs = tag.externalDocs;\n }\n }\n }\n }\n if (!apiInfo.resources[tagName].methods) apiInfo.resources[tagName].methods = {};\n apiInfo.resources[tagName].methods[sMethodUniqueName] = ioMethod;\n }\n }\n }\n delete apiInfo.paths; // to keep size down\n if (apiInfo.definitions) rename(apiInfo,'definitions','schemas');\n if (apiInfo.components && apiInfo.components.schemas) rename(apiInfo,'components.schemas','schemas');\n return apiInfo;\n}", "function Api() {\n \n //Calls the endpoint and returns the body.\n function fetch(endpoint) {\n //Avoid wrong input.\n url = (url.startsWith('http')) ? url : 'http://'+url;\n url = (url.endsWith('/')) ? url : url += '/';\n endpoint = (endpoint.startsWith('/')) ? endpoint.replace('/', '') : endpoint;\n const finUrl = url + endpoint;\n \n // To not break any existing scripts using pre-options syntax\n if (arguments.length === 3) {\n const options = arguments[1];\n const cb = arguments[2];\n const headers = (options[\"headers\"]) ? options[\"headers\"] : {};\n } else if (arguments.length === 2) {\n const cb = arguments[1];\n const headers = {};\n } else {\n const cb = function(){};\n const headers = {};\n }\n\n //TODO: If data has been preloaded or downloaded before, load the already downloaded data.\n \n request({\n url: finUrl,\n headers: headers\n }, function(error, response, body) {\n //Error cases\n if(error) cb(error);\n else if(response && response.statusCode == 400) cb('400 returned.');\n //TODO: Add more error cases (no body, error statusCodes, ...)\n else cb(undefined, body);\n })\n }\n\n //Set object methods with this\n this.fetch = fetch;\n}", "function getUrl() {\n var url = \"https://raw.githubusercontent.com/radytrainer/test-api/master/test.json\";\n return url;\n}", "async function get_api_url () {\n const { protocol, host, port } = await get_options();\n return `${protocol}://${host}:${port}/gui`;\n}", "function generator() {\n\n\tvar host = 'http://127.0.0.1:5658';\n\tvar link = '/new';\n\tfetch(host + link, { method: 'get', credentials: 'same-origin', headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });\n\n}", "async function downloadSpec() {\n return new Promise((resolve, reject) => {\n console.log(' + downloading spec')\n\n const https = require(path.resolve(`${process.env.LIB_DIR}https`)) // Not to be confused with Node's built-in HTTPs module\n\n var spec\n https.get(process.env.SWAGGER_SPEC_REMOTE).then((data) => {\n spec = yaml.safeLoad(data)\n\n // Some manual changes are necessary. These are copied directly from Tyler Liu's code and may\n // eventually become uncessary when the remote OpenAPI spec is updated to fix these issues.\n\n delete spec.paths['/scim/health'] // Replaced by '/scim/v2/health'\n delete spec.paths['/scim/Users'] // Replaced by '/scim/v2/Users'\n delete spec.paths['/scim/ServiceProviderConfig']\n\n // https://git.ringcentral.com/platform/api-metadata-specs/issues/48\n {\n let post = spec.paths['/restapi/v1.0/account/{accountId}/greeting'].post\n post.parameters = post.parameters.filter(p => p.name !== 'answeringRuleId')\n post.parameters.push({\n name: 'answeringRule',\n in: 'formData',\n '$ref': '#/definitions/CustomCompanyGreetingAnsweringRuleInfo'\n })\n } {\n let post = spec.paths['/restapi/v1.0/account/{accountId}/extension/{extensionId}/greeting'].post\n post.parameters = post.parameters.filter(p => p.name !== 'answeringRuleId')\n post.parameters.push({\n name: 'answeringRule',\n in: 'formData',\n '$ref': '#/definitions/CustomGreetingAnsweringRuleInfoRequest'\n })\n }\n\n spec.definitions['CustomCompanyGreetingAnsweringRuleInfo'] = spec.definitions['CustomGreetingAnsweringRuleInfoRequest'] = {\n type: 'object',\n properties: {\n id: {\n type: 'string'\n }\n }\n }\n\n fs.mkdirSync(path.resolve(process.env.DOWNLOADED_SPECS), { recursive: true })\n\n fs.writeFileSync(path.resolve(`${process.env.DOWNLOADED_SPECS}rc-platform.yml`), yaml.safeDump(spec))\n\n console.log(' - spec downloaded')\n\n resolve()\n }).catch(e => {\n reject('Operation Failed: gitlab unavailable, ensure you are connected to Corp VPN')\n })\n })\n}", "static get API_URL() {\n return 'https://dog.ceo/api/breeds/list/all';\n }", "async loadApi(api){\n if(!gapi.client) throw \"Must call load first\";\n\n const doc = this.getDiscoveryDoc(api);\n return gapi.client.load(doc);\n }", "function generateSearchUrl(paginationOffset, dataLimit, apiToken) {\n return 'https://api.pipedrive.com/v1/organizations?start=' + paginationOffset + '&limit=' + dataLimit + '&api_token=' + apiToken;\n}", "function _requestFile() {\n\tif (AUTO_IMPORT && _validateURL(HOSTED_FILE)) {\n\t\tfetch(HOSTED_FILE)\n\t\t.then(res => res.json())\n\t\t.then((out) => {\n\t\t\t_mergeSettings(out, ENV_SETTINGS, HOSTED_FILE, AUTO_IMPORT, function(){});\n\t\t})\n\t\t.catch(err => { \t\t\n\t\t\tconsole.log('Environment Marker: Something went wrong when trying to retrieve the file from the URL.');\t\t\n\t\t});\n\t}\n}", "function getGlobDataAPI(){\n\n}", "function constructAPIURL(area, arg) {\n area = can.trim(area);\n arg = can.trim(arg);\n var baseURL = dgServiceURL + area + \"/\" + arg;\n return baseURL;\n}", "constructor(url) {\n this.API_URL = url\n }", "static get DEFAULT_API_BASE_URL() { return 'https://api.todobot.io'; }", "async function urlFromOrgId (client, serverNumber, orgId, layerName) {\n const url = `https://services${serverNumber}.arcgis.com/${orgId}/arcgis/rest/services/${layerName}/FeatureServer/0?f=json`\n let { body } = await client( { url } )\n body = JSON.parse(`[${body}]`)\n const { serviceItemId } = body[0]\n let ret = `https://opendata.arcgis.com/datasets/${serviceItemId}_0.csv`\n console.log(`Calling ${ret}`)\n return ret\n}", "function _api (endpoint, callback) {\r\n endpoint = endpoint.replace(/^\\/+/, '').replace(/\\/+$/, '');\r\n _get(_default_host + endpoint, callback);\r\n }", "buildUrlEndpoint(action) {\n\t\t\tconst host = this._configuration.getDomain() + '/api/Bookmark/'\n\t\t\tconst endpoint = action || '';\n\t\t\treturn host + endpoint;\n\t\t}", "function generateUrl({ category, blacklist }) {\n const query = blacklist.length ? `/?blacklistFlags=${blacklist.join()}` : ''\n\n return `https://sv443.net/jokeapi/v2/joke/${category}${query}`\n}", "function makeURL(domain, userApiKey) {\r\n var base = \"https://api.shodan.io/shodan/host/search?key=\";\r\n var url = base + userApiKey + '&query=hostname:' + domain;\r\n console.log(url);\r\n return url;\r\n}", "makeApi(module, action, id, params) {\n module = module['ucFirst']();\n var url = module;\n if (action !== \"\") {\n url += '/' + action;\n if (typeof (id) !== 'undefined' && id !== null) {\n url += '/' + id;\n }\n }\n url += '.json';\n if (typeof (params) !== 'undefined') {\n var first = true;\n for (var i in params) {\n if (first) {\n url += \"?\";\n first = false;\n }\n else {\n url += \"&\";\n }\n url += i + \"=\" + params[i];\n }\n }\n return url;\n }", "function get_api_url(kind, db, ts, mtf) {\n \"use strict\";\n return [lnt_url_base, \"api\", \"db_\" + db, \"v4\", ts, kind, mtf].join('/');\n}", "function api_url(data){\n\treturn base_url+data;\n}", "function buildFlikrAPIUrl () {\n\t\t\tvar href = \"http://api.flickr.com/services/rest/\",\n\t\t\t\tmethod = \"flickr.photosets.getPhotos\", \t\t// Flikr API Method goes here\n\t\t\t\tkey = \"cc1bcb9a1e5c62de76976c1d79239bac\", \t\t// Flikr API Key\n\t\t\t\tid = \"bwolvin14\";\t\t\t\t\t\t \t\t// Flikr User ID\n\t\t\t\n\t\t\treturn href + \"?method=\" + method + \"&photoset_id=\" + getPhotoSetID() + \"&api_key=\" + key + \"&user_id=\" + id + \"&format=json\";\n\t\t}", "function apiBuilder(endpoint, params) {\n var url = 'https://api.stackexchange.com/2.2/',\n urlPath = url + endpoint;\n params.key ='Kdg9mxpgwALz)u5ubehUFw((';\n if (params !== undefined) {\n var query = [];\n for(var prop in params) {\n if (params.hasOwnProperty(prop)) {\n query.push( prop + '=' + encodeURI(params[prop]));\n }\n }\n urlPath = urlPath + '?' + query.join('&');\n }\n return urlPath;\n }", "function getJsonApiUrl(declaration, params) {\n const endpoint = get(declaration, 'endpoint');\n // Use if a fully-formed url, otherwise pass to buildUrl\n return endpoint.indexOf('https://') === 0 ? endpoint : buildUrl(endpoint, params);\n }", "function urlMaker() {\n url_string = \"\"\n\n // adding the first character\n url_string = url_string.concat(\"?\")\n\n // concatinating the filternames\n configSet.filters.forEach(element => {\n url_string = url_string.concat('filter_name_list=', element, '&')\n })\n\n // concatinating the thresholds\n configSet.confidence_thresholds.forEach(element => {\n url_string = url_string.concat('confidence_threshold_list=', element, '&')\n })\n\n // concatinating the column name\n url_string = url_string.concat('column_name=', configSet.col_name, '&')\n\n // concatinating the CSV URL/Path\n url_string = url_string.concat('csv_url=', encodeURIComponent(configSet.csv_url))\n\n // remove the extra & sign in the loop\n // url_string = url_string.slice(0, -1)\n return url_string\n}", "function generateApiUri(id, secret, params) {\n var baseUri = \"https://api.foursquare.com/v2/venues/search\";\n var reqUri = `${baseUri}?client_id=${id}&client_secret=${secret}&v=20151001`;\n for (var key in params) {\n if (params.hasOwnProperty(key))\n reqUri += `&${key}=${encodeURIComponent(params[key])}`;\n }\n\n return reqUri;\n}", "function generateEndpointURL () {\n var querystring = $.param({\n advisor_profile_id: this[options.advisorIdAttribute],\n start_at: this[options.startDateAttribute].toISOString(),\n ndays: options.nDays\n });\n return API_ENDPOINT + '?' + querystring;\n }", "endpoint(path, stream=false) {\n const _endpoint = !stream ? this._endpoint : this._stream;\n\t\treturn `${_endpoint}${path}.json`;\n\t}", "function constructFlurryAllAppsInfoEndpoint(){\n url_app_metric_specific = 'getAllApplications';\n url_new_Flurry = base_url_Flurry + 'appInfo/' + url_app_metric_specific + '/?apiAccessCode=' + apiAccessCode;\n return url_new_Flurry;\n}", "function withPreferredEndpoint(url) {\n return url.replace(\"https://api.github.com/repos/glassechidna/trackiam\", preferredEndpoint);\n}", "function makeUrl(config, path) {\n var url = nurl.parse(path)\n for (var key in config) {\n if (key in { sdkUrl: 1, examplesRoot: 1 }) continue // TODO fixme\n var val = config[key]\n if (DefaultConfig[key] != val) url = url.setQueryParam(key, val)\n }\n return url.href\n}", "function createCompleteUri(uri) {\n // Add the passed parameter to the base\n return ApiUrlBase + uri;\n}", "async function copyAPI() {\n for (const pkg of packages) {\n const packageDir = glob.sync(path.resolve(root, `packages/**/${pkg}`))[0];\n\n await safeCopy(\n path.resolve(packageDir, `dist/${pkg}.api.json`),\n `./src/docs/api/${pkg}.api.json`\n );\n }\n}", "function build_url(type, api, req) {\n var url = 'http://' + req.headers.host + '/' + type + '/' + api._id,\n qs = [],\n key,\n arr_i;\n\n for (key in req.query) {\n if (req.query.hasOwnProperty(key)) {\n if (req.query[key] instanceof Array) {\n for (arr_i = 0; arr_i < req.query[key].length; arr_i++) {\n if (req.query[key][arr_i].trim() !== '') {\n qs.push(key + '[]=' + req.query[key][arr_i]);\n }\n }\n } else {\n if (req.query[key].trim() !== '') {\n qs.push(key + '=' + req.query[key]);\n }\n }\n }\n }\n\n if (qs.length > 0) {\n url = url + '?' + qs.join('&');\n }\n\n return url;\n }", "function getBaseApiEndpoint(dsn) {\n\t const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n\t const port = dsn.port ? `:${dsn.port}` : '';\n\t return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n\t}", "function generateApiKey() {\n deploymentsService.generateApiKey(vm.deployment).then(function (data) {\n if (!data.hasOwnProperty('apiKey')) {\n alertsService.pushAlert('Could not generate API key.', 'warning');\n return false;\n }\n var webhookUrl = location.protocol+'//'+location.hostname;\n webhookUrl += '/api.php?ak='+data.apiKey+'&ap='+data.apiPassword;\n vm.apiUrl = webhookUrl;\n }, function (reason) {\n alertsService.pushAlert(reason, 'warning');\n });\n }", "function LoadAPIKeyFromConfigStrategy () {\n}", "function generateResourceListing(options) {\n const controllers = options.controllers;\n const opts = options.options || {};\n\n const paths = buildPaths(controllers);\n const definitions = buildDefinitions(controllers);\n\n const listing = {\n swagger: '2.0',\n info: {\n description: 'Baucis generated API',\n version: options.version,\n title: 'api'\n // termsOfService: 'TOS: to be defined.',\n // contact: {\n // email: 'me@address.com'\n // },\n // license: {\n // name: 'TBD',\n // url: 'http://license.com'\n // }\n },\n // host: null,\n basePath: options.basePath,\n tags: buildTags(options),\n schemes: ['http', 'https'],\n consumes: ['application/json'],\n produces: ['application/json', 'text/html'],\n paths,\n definitions,\n parameters: params.generateCommonParams()\n // responses: getReusableResponses(),\n // securityDefinitions: {},\n // security: [] // Must be added via extensions\n // externalDocs: null\n };\n\n if (opts.security) {\n listing.security = opts.security;\n }\n if (opts.securityDefinitions) {\n listing.securityDefinitions = opts.securityDefinitions;\n }\n\n return listing;\n}", "function build (options) {\n var base = ''\n + window.location.protocol\n + '//'\n + window.location.hostname\n + (window.location.port\n ? (':' + window.location.port)\n : '')\n\n var query = queryString({\n apiKey: options.apiKey,\n keyword: options.keyword,\n visitorIPAddress: options.ipAddress,\n visitorUserAgent: options.userAgent,\n domain: 'shopping.com',\n trackingId: options.trackingId\n })\n\n if (options.as === 'curl') {\n var url = base + '/publisher?' + query\n return 'curl ' + JSON.stringify(url)\n } else if (options.as === 'curl-dryrun') {\n var url = base + '/dryrun/publisher?' + query\n return 'curl ' + JSON.stringify(url) + ' -u admin'\n } else {\n var url = base + '/publisher?' + query\n return url\n }\n }", "function constructFlurryEndpoint(){\n var base_url_Flurry = 'http://api.flurry.com/',\n apiAccessCode = 'FX2FBFN9RQXW8DKJH4WB',\n apiKey = checkApiKey(), //'VW7Z3VDXXSK7HM6GKWZ3',\n url_metric_type = checkMetricType(),\n url_app_metric_specific = checkAppMetricSpecific(),\n url_startDate = checkStartDate(),\n url_endDate = checkEndDate(),\n url_country = 'ALL';\n url_new_Flurry = base_url_Flurry + url_metric_type + '/' + url_app_metric_specific + '/?apiAccessCode=' + apiAccessCode + '&apiKey=' + apiKey + '&startDate=' + url_startDate + '&endDate=' + url_endDate + '&country=' + url_country;\n // var DEBUG_url_new_Flurry = 'http://api.flurry.com/appMetrics/ActiveUsers?apiAccessCode=FX2FBFN9RQXW8DKJH4WB&apiKey=VW7Z3VDXXSK7HM6GKWZ3&startDate=2015-01-01&endDate=2015-10-31&country=ALL';\n // alert('URL for Endpoint is temp hardconded');\n cc('API URL: '+url_new_Flurry,'success');\n return url_new_Flurry;\n}", "function makeNormalUrl(urlPart) {\n return domainBase + apiBaseUrl + urlPart;\n}", "function makeNormalUrl(urlPart) {\n return domainBase + apiBaseUrl + urlPart;\n}", "function createWeatherUrl() {\r\n let baseUrl = 'https://api.openweathermap.org/data/2.5/weather'\r\n let searchQuery = '?zip=' + $('.whereToSkate').val()\r\n let apiKey = '&APPID=c6074c7eba5c1cd1fa563dd6e3da11ad'\r\n let fullUrl = baseUrl + searchQuery + apiKey\r\n getWeather(fullUrl);\r\n}", "get url() {\n return `/api/projects/file/${this.projectId}${this.filePath}`\n }", "function constructURL(params){\n \n delimiter = '/';\n \n url = new Array(domainName, pathToAPI);\n\n if(params.module){\n \n url.push(params.module);\n\n if(params.id && params.datatype){\n \n url.push(params.datatype + params.id);\n \n }\n\n }else throw {code: 400, message: \"No module name\"};\n url.push(\"\");\n return url.join(delimiter);\n \n}", "function getAPIEndPoints(key) {\n const API_URL = \"https://5dc588200bbd050014fb8ae1.mockapi.io\";\n\n const API_ENDPONTS = {\n GETUSERS: \"/assessment\"\n };\n return API_URL + API_ENDPONTS[key];\n}", "extendCli (cli) {\n cli\n .command('metadata <targetDir> [...inputPaths]', 'Generate required metadata for the API reference docs')\n .option('-o <dir>', 'Output directory. Defaults to <targetDir>/api/')\n .action(async (targetDir, inputPaths, options) => {\n if (inputPaths.length === 0) {\n throw new Error('Please specify at least one path to a folder containing API docs.')\n }\n\n const outputPath = options.o ? path.resolve(options.o) : path.resolve(context.sourceDir, 'api')\n const docgenMainScript = require.resolve('titanium-docgen')\n const command = [\n 'node',\n docgenMainScript,\n '-f', 'json-raw',\n inputPaths.shift(),\n ...inputPaths.reduce((acc, cur) => {\n acc.push('-a', cur)\n return acc\n }, []),\n '-o', outputPath\n ]\n logger.wait('Generating API metadata file...')\n try {\n logger.debug(`Running command ${command.join(' ')}`)\n await execAsync(command.join(' '))\n logger.success(`Done! Metadata file generated to ${path.join(outputPath, 'api.json')}`)\n } catch (e) {\n logger.error('Failed to generate API metadata.')\n throw e\n }\n })\n }", "async _generateAssets (apis, token) {\n\t\tconsole.log('Building Resources');\n\t\tconst assetParams = [];\n\t\tfor (let api of apis.value) {\n\t\t\tconst swagger = await this._getSwagger(api.name, token);\n\t\t\tconst swaggerJson = JSON.parse(swagger).value;\n\t\t\tconst apiServiceName = `${api.name}`;\n\t\t\tconst apiServiceRevisionName = `${apiServiceName}-${api.properties.apiRevision}`;\n\t\t\tconst apiProperties = api && api.properties || {};\n\t\t\tconst displayName = apiProperties.displayName || '';\n\t\t\tconst attributes = {\n\t\t\t\tazureServiceName: this.config.serviceName,\n\t\t\t\tazureResourceGroupName: this.config.resourceGroupName,\n\t\t\t\tazureApiName: apiServiceName\n\t\t\t};\n\t\t\tconst environmentName = this.config.environmentName;\n\t\t\tconst apiDescription = apiProperties.description || '';\n\t\t\tconst swaggerEncoded = Buffer.from(JSON.stringify(swaggerJson)).toString('base64');\n\t\t\tconst host = swaggerJson.host;\n\t\t\tconst basePath = swaggerJson.basePath;\n\t\t\tconst version = api.versionGroup || '0.1';\n\t\t\tconst webhookUrl = this.config.webhookUrl || '';\n\t\t\tconst icon = this.config.icon;\n\t\t\tconst iconData = getIconData(icon);\n\t\t\t\n\t\t\t// Create Resource Definitions\n\t\t\tconst apiService = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'APIService',\n\t\t\t\tname: apiServiceName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tdescription: apiDescription,\n\t\t\t\t\ticon: iconData\n\t\t\t\t}\n\t\t\t};\n\t\t\n\t\t\tconst apiServiceRevision = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'APIServiceRevision',\n\t\t\t\tname: apiServiceRevisionName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tapiService: apiServiceName,\n\t\t\t\t\tdefinition: {\n\t\t\t\t\t\ttype: 'oas2',\n\t\t\t\t\t\tvalue: swaggerEncoded\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\n\t\t\tconst apiServiceInstance = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'APIServiceInstance',\n\t\t\t\tname: apiServiceName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tapiServiceRevision: apiServiceRevisionName,\n\t\t\t\t\tendpoint: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thost: host,\n\t\t\t\t\t\t\tprotocol: 'https',\n\t\t\t\t\t\t\tport: 443\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\tconst consumerInstanceInstance = {\n\t\t\t\tapiVersion: 'v1alpha1',\n\t\t\t\tkind: 'ConsumerInstance',\n\t\t\t\tname: apiServiceName,\n\t\t\t\ttitle: displayName,\n\t\t\t\tattributes,\n\t\t\t\tmetadata: {\n\t\t\t\t\tscope: {\n\t\t\t\t\t\tkind: 'Environment',\n\t\t\t\t\t\tname: environmentName\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tspec: {\n\t\t\t\t\tapiServiceInstance: apiServiceName,\n\t\t\t\t\tstate: 'PUBLISHED',\n\t\t\t\t\tsubscription: {\n\t\t\t\t\t\tenabled: true,\n\t\t\t\t\t\tautoSubscribe: false,\n\t\t\t\t\t\tsubscriptionDefinition: 'consumersubdef'\n\t\t\t\t\t},\n\t\t\t\t\tversion: version,\n\t\t\t\t\ttags: (attributes ? Object.values(attributes) : [])\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tif (basePath) {\n\t\t\t\tapiServiceInstance.spec.endpoint[0].routing = { basePath: basePath };\n\t\t\t}\n\n\t\t\t// Save to FS\n\t\t\tcommitToFs(apiService, this.config.outputDir, [\n\t\t\t\tapiService,\n\t\t\t\tapiServiceRevision,\n\t\t\t\tapiServiceInstance,\n\t\t\t\tconsumerInstanceInstance\n\t\t\t]);\n\t\t}\n\t\treturn;\n\t}", "api_name() {\n\n }", "function getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n }", "function marvelFactory(config) {\n return function(path) {\n var timestamp = new Date().getTime();\n var hash = md5(timestamp + config.privateKey + config.publicKey);\n var url = config.hostname + '/v' + config.version + '/public' + path + '?limit=100&apikey=' + config.publicKey + '&ts=' + timestamp + '&hash=' + hash;\n console.log(url);\n\n return fetchJSON(url);\n }\n}", "function buildUrl(lp, ef) {\n \"use strict\";\n var domain = \"https://content.guardianapis.com/\";\n var api_key = \"api-key=8b7ca0fc-3914-4473-9c07-e9b56781ce88\";\n var req_fields = \"&show-fields=thumbnail%2Cbyline%2Cbody\";\n\n if (ef != \"\") {\n ef = ef + \"&\";\n }\n else {\n ef = \"?\";\n }\n\n var url = \"\" + domain + lp + ef + api_key + req_fields;\n return url;\n}", "async function generateShortUrl(url) {\n try {\n const result = await fetch('https://rel.ink/api/links/', {\n method: 'POST',\n body: JSON.stringify({\n url: url\n }),\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n }\n });\n const data = await result.json();\n const shortUrl = `https://rel.ink/${data.hashid}`;\n displayToPage(shortUrl);\n showPreloader(false);\n } catch (error) {\n console.error(`Error: ${error}`);\n }\n\n}", "function beatportApi(url, next) {\n\tvar baseQry = {\n\t\thost: 'api.beatport.com',\n\t\tport: 80,\n\t\tpath: url\n\t};\n\thttp.get(baseQry, function(res){\n\t\tif(res.statusCode === 200) {\n\t\t\tvar chunks = '';\n\t\t\tres.on('data', function(chunk) {\n\t\t\t\tchunks += chunk;\n\t\t\t});\n\t\t\tres.on('end', function(chunk){\n\t\t if(typeof chunk !== 'undefined') chunks += chunk;\n\t\t\t\tnext(null, JSON.parse(chunks));\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log('response code != 200');\n\t\t\tnext(res.statusCode, null);\n\t\t}\n\t});\n}", "function getBaseApiEndpoint(dsn) {\n const protocol = dsn.protocol ? `${dsn.protocol}:` : '';\n const port = dsn.port ? `:${dsn.port}` : '';\n return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;\n}" ]
[ "0.656145", "0.6030883", "0.5935256", "0.59350294", "0.58844376", "0.5838028", "0.57900196", "0.5760698", "0.57544667", "0.57283306", "0.5676726", "0.5670042", "0.5663588", "0.56103104", "0.55902857", "0.5535263", "0.55132025", "0.5500699", "0.5480999", "0.54696363", "0.54557115", "0.5449722", "0.5445687", "0.54445547", "0.54223114", "0.5408955", "0.5405568", "0.5398795", "0.5371627", "0.5371627", "0.5370524", "0.5353904", "0.5339025", "0.53078645", "0.52998674", "0.52855754", "0.5283002", "0.52815735", "0.5280733", "0.5260658", "0.524688", "0.5235453", "0.5230348", "0.5228069", "0.5209256", "0.52039254", "0.5199643", "0.5195153", "0.51950806", "0.51942205", "0.51664686", "0.5157752", "0.51553667", "0.51463133", "0.5145552", "0.51420397", "0.514005", "0.5136263", "0.5134309", "0.5124396", "0.51197004", "0.51144946", "0.5106678", "0.51040864", "0.50964665", "0.5095126", "0.50921047", "0.5086582", "0.50812113", "0.50806296", "0.50696164", "0.50690037", "0.50542265", "0.5053361", "0.50493836", "0.5037697", "0.50360894", "0.5030011", "0.5014046", "0.50114065", "0.49973702", "0.49930525", "0.4989427", "0.4987005", "0.49857476", "0.49813762", "0.49813762", "0.4979301", "0.497798", "0.4971468", "0.49703845", "0.4967646", "0.4967317", "0.49659333", "0.49650222", "0.49647114", "0.4956973", "0.4937976", "0.4930223", "0.49275738" ]
0.71088165
0
Adds a bomb to the board at x,y
function makeExplosion(xPos, yPos){ console.log("makeExplosion at ", xPos,yPos); playSound("boom"); var size = 3; var width = 3 * 20; var offset = (width - 20) / 2; var x = xPos * 20 - offset; var y = yPos * 20 - offset; $(".border, .leader").addClass("shake"); $(".border").one("animationend",function(){ $(".border, .leader").removeClass("shake"); }) var particle = {}; particle.el = $("<div class='boom'><div class='shock'/><div class='body'/></div>"); particle.el.css("height", width); particle.el.css("width", width); particle.el.css("transform","translate3d("+x+"px,"+y+"px,0)"); setTimeout(function(el) { return function(){ el.remove(); }; }(particle.el),500); //Move function $(".board").append(particle.el); // Make Bomb Puffs for(var i = 0; i < 8; i++){ var options = { x : xPos * 20, // absolute non-relative position on gameboard y : yPos * 20, // absolute non-relative position on gameboard angle: getRandom(0,359), // just on the x,y plane, works with speed zR : getRandom(-15,15), // zRotation velocity oV : -.008, // opacity velocity width : getRandom(20,55), // size of the particle className : 'puff', // adds this class to the particle <div/> lifespan: 125, // how many frames it lives } // Need to put this offset code into the makeParticle function // You should pass it an x,y of 0 var offset = (options.width - 20) / 2; options.x = options.x - offset; options.y = options.y - offset; options.height = options.width; options.speed = 1 + (2 * (1 - options.width / 50)); // The bigger the particle, the lower the speed makeParticle(options); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function placeBomb(x,y) {\n with (cellArray[arrayIndexOf(x,y)]) {\n if ((! isBomb) && (! isExposed)) {\n isBomb = true;\n for (i=x-1; i<=x+1; i++) {\n for (j=y-1; j<=y+1; j++) {\n addNeighbor(i,j); } } \n return true;} \n else\n return false; } }", "putBomb() {\n\n // search position of player\n let left = this.x * widthCase;\n let top = this.y * widthCase;\n\n //create bomb\n let id = \"bomb\" + this.bombs.length;\n const bomb = document.createElement('div');\n bomb.style.position = \"absolute\";\n bomb.className = 'bomb';\n bomb.setAttribute(\"id\", id);\n bomb.style.width = widthCase + \"px\"; // A changer si changment dans scss\n bomb.style.height = widthCase + \"px\";\n bomb.style.left = left + \"px\";\n bomb.style.top = top + \"px\";\n bomb.style.backgroundImage = 'url(\"../pictures/bomb.png\")';\n bomb.style.backgroundSize = \"cover\";\n\n const caseBomb = document.querySelector(`[row=\"${top/widthCase}\"][column=\"${left/widthCase}\"]`);\n caseBomb.appendChild(bomb);\n this.attributes.attribut.actuelBomb++;\n this.sizeArray++\n\n //update map.grounds and coordinate\n let x = this.x;\n let y = this.y;\n let b = {\n x: x,\n y: y,\n bomb: bomb,\n id: id\n }\n map.grounds[y][x].bomb = b;\n\n this.bombs.push(b);\n //trigger detonate\n this.triggerDetonate(b);\n \n this.escapeDetonate(x, y)\n \n }", "putBomb() {\n if (this.bombs.length < this.maxBombs) {\n this.bombs.push(new Bomb(this.ctx, this.tileCoord.col, this.tileCoord.row, this.tileSize))\n }\n }", "function bombCheck() {\n\tif (x==1 && y==2 || x==18 && y==3 || x==18 && y==9 || x==13 && y==2 || x==3 && y==7 || x==14 && y==6 || x==17 && y==7) {\n\t\tconst position = getPosition();\n\t\tposition.append(bombImg);\n\t\talert('You hit the bomb!')\n\t\thealth -= 10;\n\t}\n}", "function Place(x, y, piece){\r\n\tstate.board[y][x] = piece;\r\n}", "function Bomb(x,y,width,height){\n\tthis.y=y;\n\tthis.x=x;\n\tthis.width=width;\n\tthis.height=height;\n\tthis.imageBomb = bombImg;\n\tthis.dateCreation= new Date();\n\tthis.bombExploding= false;\n\tthis.drawBomb = function(){\n\t\tctx.drawImage(this.imageBomb, this.x, this.y, this.width, this.height);\n\t}\n}", "placePieceAt(y , x , row , col, boardArr) {\n var piece = game.addSprite(game.startingX + x*game.squareSize*3 + col*game.squareSize, game.startingY + y * game.squareSize*3 + row*game.squareSize, 'O');\n \n game.board[y][x][row][col] = \"o\"\n game.previousPiece = \"o\";\n }", "function generate_bomb() \n{\n for (var i = 0; i < rows; i++) \n {\n for (var j = 0; j < cols; j++) \n {\n var ratio = bombCount / (rows * cols);\n if (rdm(0, 1) < ratio) \n {\n $cell[(i * cols) + j].classList.add('cell-bomb');\n $cell[(i * cols) + j].classList.add('x' + j);\n $cell[(i * cols) + j].classList.add('y' + i);\n bombs.posX[(i * cols) + j] = j;\n bombs.posY[(i * cols) + j] = i;\n }\n }\n }\n}", "function addBoat(board) {\n let added = false;\n while(!added){ \n let x = getRandomNumber();\n let y = getRandomNumber();\n\n if(x + 1 < board.length && board[x][y] === '~' && board[x+1][y] === '~'){\n board[x][y] = 'O';\n board[x + 1][y] = 'O';\n added = true;\n }\n }\n}", "function paintSquare(x,y) {\r\n\t\r\n\tconsole.log(\"Current cell: \" + x + \",\" + y);\r\n\r\n\t\r\n\tfill(200,200,200);\r\n\trect(table[x][y].getX()*30,table[x][y].getY()*30,30,30);\r\n\r\n\tlet cellBombCount = table[x][y].getBombCount();\r\n\t\t\tif(cellBombCount == 1) {\r\n\t\t\t\t// blue\r\n\t\t\t\tfill(25,28,232);\r\n\t\t\t\t//stroke(25,28,232);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"1\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\telse if(cellBombCount == 2) {\r\n\t\t\t\t// cyan\r\n\t\t\t\tfill(89,204,249);\r\n\t\t\t\t//stroke(89,204,249);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"2\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(cellBombCount == 3) {\r\n\t\t\t\t// green\r\n\t\t\t\tfill(80,244,66);\r\n\t\t\t\t//stroke(80,244,66);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"3\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(cellBombCount == 4) {\r\n\t\t\t\t// yellow\r\n\t\t\t\tfill(245,255,58);\r\n\t\t\t\t//stroke(245,255,58);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"4\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(cellBombCount == 5) {\r\n\t\t\t\t// orange\r\n\t\t\t\tfill(249,180,19);\r\n\t\t\t\t//stroke(249,180,19);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"5\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(cellBombCount == 6) {\r\n\t\t\t\t//red\r\n\t\t\t\tfill(249,54,19);\r\n\t\t\t\t//stroke(249,54,19);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"6\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(cellBombCount == 7) {\r\n\t\t\t\t// pink\r\n\t\t\t\tfill(255,48,196);\r\n\t\t\t\t//stroke(255,48,196);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"7\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(cellBombCount == 8) {\r\n\t\t\t\t// purple\r\n\t\t\t\tfill(164,32,247);\r\n\t\t\t\t//stroke(164,32,247);\r\n\t\t\t\ttextSize(20);\r\n\t\t\t\ttext(\"8\",table[x][y].getX()*30+10,table[x][y].getY()*30+22);\r\n\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse { // no surrounding bombs, or is a bomb\r\n\t\t\t\tif(table[x][y].getFlagged()) {\r\n\t\t\t\t\ttable[x][y].setUnFlagged();\r\n\t\t\t\t\tbombsLeft++;\r\n\t\t\t\t}\r\n\r\n\r\n\t\t\t\tif(x == 0) {\r\n\t\t\t\t\tif(y == 0) { // upper left corner\r\n\t\t\t\r\n\r\n\t\t\t\t\t\tif(!table[x+1][y].getIsBomb() \t&& !table[x+1][y].getIsShown()) {table[x+1][y].setIsShown(); paintSquare(x+1,y)};\r\n\t\t\t\t\t\tif(!table[x][y+1].getIsBomb() \t&& !table[x][y+1].getIsShown()) {table[x][y+1].setIsShown(); paintSquare(x,y+1)};\r\n\t\t\t\t\t\tif(!table[x+1][y+1].getIsBomb() && !table[x+1][y+1].getIsShown()) {table[x+1][y+1].setIsShown(); paintSquare(x+1,y+1)};\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(y == 15) { // lower left corner\r\n\t\t\t\t\t\tif(!table[x][y-1].getIsBomb() \t&& !table[x][y-1].getIsShown()) {table[x][y-1].setIsShown(); paintSquare(x,y-1)};\r\n\t\t\t\t\t\tif(!table[x+1][y-1].getIsBomb() && !table[x+1][y-1].getIsShown()) {table[x+1][y-1].setIsShown(); paintSquare(x+1,y-1)};\r\n\t\t\t\t\t\tif(!table[x+1][y].getIsBomb() \t&& !table[x+1][y].getIsShown()) {table[x+1][y].setIsShown(); paintSquare(x+1,y)};\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tif(!table[x][y-1].getIsBomb() \t&& !table[x][y-1].getIsShown()) {table[x][y-1].setIsShown(); paintSquare(x,y-1)};\r\n\t\t\t\t\t\tif(!table[x+1][y-1].getIsBomb() && !table[x+1][y-1].getIsShown()) {table[x+1][y-1].setIsShown(); paintSquare(x+1,y-1)};\r\n\t\t\t\t\t\tif(!table[x+1][y].getIsBomb() \t&& !table[x+1][y].getIsShown()) {table[x+1][y].setIsShown(); paintSquare(x+1,y)};\r\n\t\t\t\t\t\tif(!table[x][y+1].getIsBomb() \t&& !table[x][y+1].getIsShown()) {table[x][y+1].setIsShown(); paintSquare(x,y+1)};\r\n\t\t\t\t\t\tif(!table[x+1][y+1].getIsBomb() && !table[x+1][y+1].getIsShown()) {table[x+1][y+1].setIsShown(); paintSquare(x+1,y+1)};\r\n\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t} \r\n\t\t\t\t// right hand side\r\n\t\t\t\telse if (x == 29) {\r\n\t\t\t\t\t//upper right corner\r\n\t\t\t\t\tif(y == 0) {\r\n\t\t\t\t\t\tif(!table[x-1][y].getIsBomb() \t&& !table[x-1][y].getIsShown()) {table[x-1][y].setIsShown(); paintSquare(x-1,y)};\r\n\t\t\t\t\t\tif(!table[x-1][y+1].getIsBomb() && !table[x-1][y+1].getIsShown()) {table[x-1][y+1].setIsShown(); paintSquare(x-1,y+1)};\r\n\t\t\t\t\t\tif(!table[x][y+1].getIsBomb() \t&& !table[x][y+1].getIsShown()) {table[x][y+1].setIsShown(); paintSquare(x,y+1)};\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// lower right corner\r\n\t\t\t\t\telse if (y == 15) {\r\n\t\t\t\t\t\tif(!table[x-1][y].getIsBomb() \t&& !table[x-1][y].getIsShown()) {table[x-1][y].setIsShown(); paintSquare(x-1,y)};\r\n\t\t\t\t\t\tif(!table[x-1][y-1].getIsBomb() && !table[x-1][y-1].getIsShown()) {table[x-1][y-1].setIsShown(); paintSquare(x-1,y-1)};\r\n\t\t\t\t\t\tif(!table[x][y-1].getIsBomb() \t&& !table[x][y-1].getIsShown()) {table[x][y-1].setIsShown(); paintSquare(x,y-1)};\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tif(!table[x][y-1].getIsBomb() \t&& !table[x][y-1].getIsShown()) {table[x][y-1].setIsShown(); paintSquare(x,y-1)};\r\n\t\t\t\t\t\tif(!table[x-1][y-1].getIsBomb() && !table[x-1][y-1].getIsShown()) {table[x-1][y-1].setIsShown(); paintSquare(x-1,y-1)};\r\n\t\t\t\t\t\tif(!table[x-1][y].getIsBomb() \t&& !table[x-1][y].getIsShown()) {table[x-1][y].setIsShown(); paintSquare(x-1,y)};\r\n\t\t\t\t\t\tif(!table[x-1][y+1].getIsBomb() && !table[x-1][y+1].getIsShown()) {table[x-1][y+1].setIsShown(); paintSquare(x-1,y+1)};\r\n\t\t\t\t\t\tif(!table[x][y+1].getIsBomb() \t&& !table[x][y+1].getIsShown()) {table[x][y+1].setIsShown(); paintSquare(x,y+1)};\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// all other boxes: x does not limit these boxs, y still does \r\n\t\t\t\telse {\r\n\t\t\t\t\tif(y == 0) { // top row excpet corners\r\n\t\t\t\t\t\tif(!table[x-1][y].getIsBomb() \t&& !table[x-1][y].getIsShown()) {table[x-1][y].setIsShown(); paintSquare(x-1,y)};\r\n\t\t\t\t\t\tif(!table[x+1][y].getIsBomb() \t&& !table[x+1][y].getIsShown()) {table[x+1][y].setIsShown(); paintSquare(x+1,y)};\r\n\t\t\t\t\t\tif(!table[x-1][y+1].getIsBomb() && !table[x-1][y+1].getIsShown()) {table[x-1][y+1].setIsShown(); paintSquare(x-1,y+1)};\r\n\t\t\t\t\t\tif(!table[x][y+1].getIsBomb() \t&& !table[x][y+1].getIsShown()) {table[x][y+1].setIsShown(); paintSquare(x,y+1)};\r\n\t\t\t\t\t\tif(!table[x+1][y+1].getIsBomb() && !table[x+1][y+1].getIsShown()) {table[x+1][y+1].setIsShown(); paintSquare(x+1,y+1)};\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (y == 15) { // bottom row except corners\r\n\t\t\t\t\t\tif(!table[x-1][y].getIsBomb() \t&& !table[x-1][y].getIsShown()) {table[x-1][y].setIsShown(); paintSquare(x-1,y)};\r\n\t\t\t\t\t\tif(!table[x-1][y-1].getIsBomb() && !table[x-1][y-1].getIsShown()) {table[x-1][y-1].setIsShown(); paintSquare(x-1,y-1)};\r\n\t\t\t\t\t\tif(!table[x][y-1].getIsBomb() \t&& !table[x][y-1].getIsShown()) {table[x][y-1].setIsShown(); paintSquare(x,y-1)};\r\n\t\t\t\t\t\tif(!table[x+1][y-1].getIsBomb() && !table[x+1][y-1].getIsShown()) {table[x+1][y-1].setIsShown(); paintSquare(x+1,y-1)};\r\n\t\t\t\t\t\tif(!table[x+1][y].getIsBomb() \t&& !table[x+1][y].getIsShown()) {table[x+1][y].setIsShown(); paintSquare(x+1,y)};\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse { // rest of the boxes\r\n\t\t\t\t\t\tif(!table[x-1][y-1].getIsBomb() && !table[x-1][y-1].getIsShown()) {table[x-1][y-1].setIsShown(); paintSquare(x-1,y-1)};\r\n\t\t\t\t\t\tif(!table[x][y-1].getIsBomb() \t&& !table[x][y-1].getIsShown()) {table[x][y-1].setIsShown(); paintSquare(x,y-1)};\r\n\t\t\t\t\t\tif(!table[x+1][y-1].getIsBomb() && !table[x+1][y-1].getIsShown()) {table[x+1][y-1].setIsShown(); paintSquare(x+1,y-1)};\r\n\t\t\t\t\t\tif(!table[x-1][y].getIsBomb() \t&& !table[x-1][y].getIsShown()) {table[x-1][y].setIsShown(); paintSquare(x-1,y)};\r\n\t\t\t\t\t\tif(!table[x+1][y].getIsBomb() \t&& !table[x+1][y].getIsShown()) {table[x+1][y].setIsShown(); paintSquare(x+1,y)};\t\r\n\t\t\t\t\t\tif(!table[x-1][y+1].getIsBomb() && !table[x-1][y+1].getIsShown()) {table[x-1][y+1].setIsShown(); paintSquare(x-1,y+1)};\r\n\t\t\t\t\t\tif(!table[x][y+1].getIsBomb() \t&& !table[x][y+1].getIsShown()) {table[x][y+1].setIsShown(); paintSquare(x,y+1)};\r\n\t\t\t\t\t\tif(!table[x+1][y+1].getIsBomb() && !table[x+1][y+1].getIsShown()) {table[x+1][y+1].setIsShown(); paintSquare(x+1,y+1)};\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// fill for the current empty cell\r\n\t\t\t\tfill(200,200,200);\r\n\t\t\t\tstroke(0);\r\n\t\t\t\trect(x*30,y*30,30,30);\r\n\t\t\t}\r\n\t\t\t\t\t\r\n}", "setBombArea(pos) {\n if (this.canSetBomb(pos)) {\n this._nextState.map[pos.x][pos.y] = elements.empty;\n this._nextState.bombArea.push({x : pos.x, y: pos.y});\n this.bombKillEnemy(pos);\n }\n }", "function addNeighbor(x,y) {\n if (checkBounds(x,y)) {\n with (cellArray[arrayIndexOf(x,y)]) {\n ++neighborBombs; } } }", "function addMine(board, i, j) {\r\n var cell = {\r\n type: MINE,\r\n minesAroundCount: 0,\r\n isShown: false,\r\n isMine: true,\r\n isMarked: false,\r\n isCanClick: true\r\n }\r\n board[i][j] = cell;\r\n gGame.mines.push({ i, j });\r\n}", "plantBomb() {\n\n // if there's enough bombs left\n if (this.amountBombs > 0) {\n\n // place bomb inside your game\n this.game.bombs.push(new Bomb({x: this.position.x, y: this.position.y}, 1500, 2, this.assets, this.gridSize, this.game));\n\n this.updateBombCount(-1);\n\n this.game.playMusic(SETBOMBMUSIC);\n\n // send position of your bomb to all enemies\n let bombDetails = {id: this.id, x: this.position.x, y: this.position.y, amountBombs: this.amountBombs};\n let playerDetails = {id: this.id, amountWalls: this.amountWalls, amountBombs: this.amountBombs, health: this.health};\n\n this.game.broadcastBomb(bombDetails);\n this.game.broadcastInventory(playerDetails);\n }\n }", "function Cell(coordinate, isBomb) {\n this.coordinate = coordinate; //x.y\n this.isBomb = isBomb; //true if this is a bomb cell\n this.bombNeightbor = []; //array of near cell which are bomb cell (sometimes it can contains the cell itself, but it doesn't matter)\n\n /**\n * Adding a neightbor cell\n * @param bombCell\n */\n this.addBombNeightbor = (bombCell) => {\n\n //check if it has already been registered\n if (this.bombNeightbor.indexOf(bombCell.coordinate.getId()) > -1) {\n return;\n }\n\n //add it\n this.bombNeightbor.push(bombCell.coordinate.getId());\n\n }\n}", "function placeBombRandomLoc() {\n bombPlaced = false;\n while (!bombPlaced) {\n with (Math) {\n i = floor(random() * (maxX+1));\n j = floor(random() * (maxY+1)); }\n bombPlaced = (placeBomb(i,j)) } }", "addObstacle(x, y, width, height) {\n for (let i = 0; i < width; i++) {\n for (let j = 0; j < height; j++) {\n this.setTile(1, x+i, y+j, 1);\n }\n }\n }", "function bomb()\n{\n\talert(\"Sorry, you click the mine! Restart Again!\");\n\tfor(var i=0; i<Mine_row; i++)\n\t{\n\t\tfor(var j=0; j<Mine_col; j++)\n\t\t{\n\t\t\tmines[i*Mine_col + j] = -2;\n\t\t}\n\t}\n\tfirstOpen(mines);\n\tGameState.IsLocking=false;\n}", "placePiece(x,y,piece) {\n\n }", "checkForBomb(x, y) {\n\t\t// Vorfilterung um nicht jedes Mal die Liste durchzuiterieren\n\t\tif (!this.gameMap.isBombAtPosition(x, y)) {\n\t\t\treturn;\n\t\t}\n\t\tfor (var index in this.bombs) {\n\t\t\t// ist notwendig, aber warum? Trotzdem kann this.bombs[index] noch null sein.\n\t\t\tif (this.bombs.hasOwnProperty(index)) {\n\t\t\t\tvar bomb = this.bombs[index];\n\t\t\t\tif ((bomb != null) && (bomb.getXPosition() == x) && (bomb.getYPosition()) == y) {\n\t\t\t\t\twinston.info(\"[backend] bome sparked by another bomb!\");\n\t\t\t\t\tthis.bombIgnition(bomb);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function removeBomb(x,y) {\n if (cellArray[arrayIndexOf(x,y)].isBomb) {\n for (i=x-1; i<=x+1; i++) {\n for (j=y-1; j<=y+1; j++) {\n removeNeighbor(i,j); } } \n cellArray[arrayIndexOf(x,y)].isBomb = false;\n return true; } \n else\n return false; }", "function noBomb(x){\n squares[x].classList.remove(\"hidden\")\n squares[x].classList.remove(\"flag\")\n let newArround = arround\n //look at the squares arround taking into account if it's in a border\n if(x === 0){\n newArround = upLeftArround\n } else if ( x === 9){\n newArround = upRightArround\n } else if (x === 90){\n newArround = downLeftArround\n } else if (x === 99){\n newArround = downRightArround\n } else if (x<9){\n newArround = upArround\n } else if (x>90){\n newArround = downArround\n } else if (x%10 === 0){\n newArround = leftArround\n } else if ((x+1)%10 ===0){\n newArround = rightArround\n }\n\n //count the bombs arround the square\n let bombs = newArround.reduce(function(accum, square) {\n if(squares[x+square].classList.contains('bomb')){\n return accum + 1\n } else { return accum}\n }, 0)\n //if there are no bombs we repeat the accion with the squares arround it\n if(bombs===0){\n newArround.forEach(y => {if(squares[y+x].classList.contains(\"hidden\")){noBomb(y+x)}})\n } else {\n //write in the square the number of bombs arround\n squares[x].innerHTML = bombs;\n switch(bombs){\n case 1: \n squares[x].style.color = \"blue\";\n break;\n case 2:\n squares[x].style.color = \"rgb(17, 82, 17)\"\n break;\n case 3:\n squares[x].style.color = \"rgb(161, 23, 23)\";\n break;\n case 4:\n squares[x].style.color = \"rgb(56, 22, 90)\";\n break; \n case 5:\n squares[x].style.color = \"rgb(185, 125, 13)\";\n break; \n case 6:\n squares[x].style.color = \"rgb(5, 96, 119)\";\n break; \n case 7:\n squares[x].style.color = \"rgb(80, 35, 23)\";\n break; \n }\n }\n}", "function blowUpBomb(bomb) {\n\n // bomb has already exploded so don't blow up again\n if (!bomb.alive) return;\n\n bomb.alive = false;\n\n // remove bomb from grid\n cells[bomb.row][bomb.col] = null;\n\n // explode bomb outward by size\n const dirs = [{\n // up\n row: -1,\n col: 0\n }, {\n // down\n row: 1,\n col: 0\n }, {\n // left\n row: 0,\n col: -1\n }, {\n // right\n row: 0,\n col: 1\n }];\n dirs.forEach((dir) => {\n for (let i = 0; i < bomb.size; i++) {\n const row = bomb.row + dir.row * i;\n const col = bomb.col + dir.col * i;\n const cell = cells[row][col];\n\n // stop the explosion if it hit a wall\n if (cell === types.wall) {\n return;\n }\n\n // center of the explosion is the first iteration of the loop\n entities.push(new Explosion(row, col, dir, i === 0 ? true : false));\n cells[row][col] = null;\n\n // bomb hit another bomb so blow that one up too\n if (cell === types.bomb) {\n\n // find the bomb that was hit by comparing positions\n const nextBomb = entities.find((entity) => {\n return (\n entity.type === types.bomb &&\n entity.row === row && entity.col === col\n );\n });\n blowUpBomb(nextBomb);\n }\n\n // stop the explosion if hit anything\n if (cell) {\n return;\n }\n }\n });\n}", "function makeBoard() {\n clearBoard();\n bombsFlagged = 0;\n cellsOpen = 0;\n updateNumBombs();\n // Now place the bombs on the board\n bombsToPlace = maxNumBombs;\n while (bombsToPlace != 0) {\n placeBombRandomLoc();\n bombsToPlace--; } }", "function addEnemy(x, y ){\n\tlet enemy = new Enemy(enemyShipImg, x, y, randomNum(-1, 1), randomNum(1, 2), 20, 30, 'ship', rockrtEnemyLife)\n\tenemyArr.push(enemy);\n}", "placePiece(sprite, pointer)\n {\n playSound(\"placeMyPiece\");\n //if we are waiting for the opponent, do nothing on click\n if(game.waiting)\n return\n if(game.multiplayer && game.checkForDoubleClick())\n return\n //the indexes in the 2D big array corresponding to the clicked square\n var bigIndexX = sprite.bigXindex\n console.log(\"bX: \", bigIndexX)\n var bigIndexY = sprite.bigYindex\n console.log(\"bY: \", bigIndexY)\n\n //the indexes in the 2D little array corresponding to the clicked square\n var littleIndexX = sprite.littleXindex\n console.log(\"lX: \", littleIndexX)\n var littleIndexY = sprite.littleYindex\n console.log(\"lY: \", littleIndexY)\n\n sprite.isEnabled = false\n\n if(game.magicBoardLogic[bigIndexX][bigIndexY] === \"magic\")\n {\n console.log('MAGIC')\n }\n\n else if(game.bigBoardLogic[bigIndexX][bigIndexY] === \"open\")\n console.log('OPEN')\n else if(game.bigBoardLogic[bigIndexX][bigIndexY] === \"closed\")\n {\n console.log('CLOSED')\n return\n }\n\n //if the clicked square OR BIGSQUARE is not empty, i.e it has a value other than a blank\n //string, don't do anything\n if(typeof game.board[bigIndexY][bigIndexX] === 'string')\n {\n //if magic overwrites closed, then if you click on a \"supposed\" closed board and it is magic itll loop)\n return\n }\n\n console.log(game.board[bigIndexY][bigIndexX][littleIndexY][littleIndexX])\n if(game.board[bigIndexY][bigIndexX][littleIndexY][littleIndexX] != \"\")\n return\n\n if(game.multiplayer)\n game.waiting = true;\n\n //place either an x or o, depending whose turn it is\n if(game.isXTurn)\n {\n var piece = game.addSprite(sprite.x, sprite.y, 'X');\n \n game.board[bigIndexY][bigIndexX][littleIndexY][littleIndexX] = \"x\"\n game.previousPiece = \"x\";\n }\n else{\n var piece = game.addSprite(sprite.x, sprite.y, 'O');\n \n game.board[bigIndexY][bigIndexX][littleIndexY][littleIndexX] = \"o\";\n game.previousPiece = \"o\";\n }\n\n\n game.updateTurnStatus(bigIndexX, bigIndexY, littleIndexX, littleIndexY)\n }", "putPiece (piece, pos) {\n\t\tthis.board[pos] = piece;\n\t\tpiece.setPos(pos);\n\t}", "function increaseTile(x, y) {\n if (board[x][y] === -1) return;\n board[x][y] += 1;\n}", "function bombPlayerOne() {\n if (playerOneBombs.length < playerOnePowerUps.bombs) {\n let ss = new createjs.SpriteSheet(game.q.getResult('bomb'));\n let temp = new createjs.Sprite(ss, \"bombIt\");\n temp.width = 59;\n temp.height = 59;\n temp.x = playerOne.x;\n temp.y = playerOne.y;\n game.stage.addChild(temp);\n playerOneBombs.push(temp);\n console.log(\"player one placed a bomb\");\n setTimeout(function () {\n explosion(temp);\n playerOneBombs.pop();\n }, bombTimer);\n }\n}", "function BombBoom(bomb) \n\t{\n\t\tvar explosion = document.createElement('div');\n\t\texplosion.className = 'explosion';\n\t\tdocument.body.appendChild(explosion);\n\t\texplosion.style.top = bomb.offsetTop + 'px';\n\t\texplosion.style.left = bomb.offsetLeft + 'px';\n\t\n\t\tconsole.log(\"kool222\")\n\t\tif (ElementCollide(hooman, explosion))\n\t\t{\n\t\t\tconsole.log(\"kool\")\n\t\t\thoomanHit = true; //sets player collision to true \n\t\t\thooman.classList.add('hit'); \t//plays human's animation when hit\n\t\t\tHP--; //decrease one health point\n\t\t\tlife[0].remove(); //removes life from top left of the screen\n\t\t\tif (HP == 0) //if all 3 lives are gone call die function\n\t\t\t{\n\t\t\t\tDie();\n\t\t\t} \n\t\t\tsetTimeout(function () \n\t\t\t{\n\t\t\t\thoomanHit = false; //sets player's state to normal\n\t\t\t\thooman.classList.remove('hit');\t//also removes the hit animation\n\t\t\t}, 1000);\n\t\t} \n\t\telse\n\t\t{\n\t\t\thigh.innerHTML = 'Points:' + Points;\n\t\t\tPoints = Points + 5; //if player didnt get hit increment score points\n\t\t\tPlayTime++;\t//increment play time\n\t\t}\n\t\tsetTimeout(function () \n\t\t{\n\t\t\texplosion.remove(); //explosion is removed after 100ms\n\t\t}, 100);\n\t}", "function MissileSpawn()\n\t{\n\t\tvar missile = document.createElement('div');\n\t\tmissile.className = 'bomb';\n\t\tdocument.body.appendChild(missile);\n\t\trespawn(missile);\n\t\tMissiles.push(missile);\n\t\tLeftSpeed.push(0);\n\t\tDownSpeed.push(1);\n\t}", "insertTile (tile) {\n this._cells[tile.posX][tile.posY] = tile;\n this.updateGrid(tile);\n }", "placeObject(obj){\n for (let i=obj.xPos;i<obj.xPos+obj.width && i<this.boardWidth;i++){\n for (let j=obj.yPos;j < obj.yPos + obj.height && j < this.boardHeight;j++){\n this.board[i][j]=obj.id;\n //console.log(i + \" \" + j + \" set to \" + obj.id);\n // if (i==0 && j == 231)\n // console.log(\"place 0 231 \"+ obj.id);\n }\n }\n }", "function createSawBlade(x,y) {\nvar hitZoneSize = 25;\nvar damageFromObstacle = 10;\nvar myObstacle = game.createObstacle(hitZoneSize,damageFromObstacle);\nmyObstacle.x = x;\nmyObstacle.y = y;\ngame.addGameItem(myObstacle);\nvar obstacleImage = draw.bitmap('img/sawblade.png');\nmyObstacle.addChild(obstacleImage);\nobstacleImage.x = -25;\nobstacleImage.y = -25;\n}", "add(x, y) {\r\n if (!(x in worldLabels)) {\r\n worldLabels[x] = {}\r\n } else if (worldLabels[x][y] == this.label) {\r\n return;\r\n }\r\n if (!(x in this.blocksTable)) {\r\n this.blocksTable[x] = {};\r\n }\r\n\r\n worldLabels[x][y] = this.label;\r\n var newBlock = new this.Block(x, y, this.blockSize);\r\n this.blocks.push(newBlock);\r\n this.blocksTable[x][y] = newBlock;\r\n\r\n\r\n this.blockIndexes.push([x, y]);\r\n }", "function isRocket_Clash_Bomb() {\r\n for (let i in stages.bomb) {\r\n if (\r\n stages.bomb[i].y >= rocket1.y &&\r\n stages.bomb[i].y <= rocket1.y + rocket1.height &&\r\n stages.bomb[i].x - rocket1.width <= rocket1.x &&\r\n stages.bomb[i].x >= rocket1.x\r\n ) {\r\n stages.bomb[i].x = -200;\r\n soundDestroy();\r\n drawBlast(\r\n imageBlast,\r\n rocket1.x,\r\n rocket1.y - 10,\r\n rocket1.width + 10,\r\n rocket1.height + 10\r\n );\r\n rocket1.x = 0;\r\n lives -= 1;\r\n }\r\n }\r\n }", "function createSawBlade(x, y) {\nvar hitZoneSize = 25;\nvar damageFromObstacle = 10;\nvar myObstacle = game.createObstacle(hitZoneSize,damageFromObstacle);\nmyObstacle.x = 320;\nmyObstacle.y = 364;\ngame.addGameItem(myObstacle); \nvar obstacleImage = draw.bitmap('img/sawblade.png');\nmyObstacle.addChild(obstacleImage);\nobstacleImage.x = -25;\nobstacleImage.y = -25;\n}", "function createMyObstacle(x,y) {\n var hitZoneSize = 25;\n var damageFromObstacle = 10;\n var sawBladeHitZone = game.createObstacle(hitZoneSize, damageFromObstacle);\n sawBladeHitZone.x = x;\n sawBladeHitZone.y = y;\n game.addGameItem(sawBladeHitZone);\n var obstacleImage = draw.bitmap('img/angrydog.png');\n sawBladeHitZone.addChild(obstacleImage);\n obstacleImage.scaleX = .05\n obstacleImage.scaleY = .05\n obstacleImage.x = -25;\n obstacleImage.y = -25; \n}", "function Tombstone(x, y) {\n\tconsole.log(\"Create new tombstone\");\n\t//this.setup(descr);\n\n\tthis.cx = x; this.cy = y - 10;\n\tthis.tombstoneSprite = g_sprites.Tombstone;\n\tthis.width = this.tombstoneSprite.width; \n\tthis.height = this.tombstoneSprite.height;\n\n\tthis._scale = 1;\n\n\tspatialManager.register(this);\n\n}", "move(x, y) {\n this.x = x;\n this.y = y;\n\n const player = document.getElementById(\"player2\");\n player.style.left = (this.x * widthCase) + \"px\";\n player.style.top = (this.y * widthCase) + \"px\";\n\n this.attributes.addLife(this.x,this.y);\n this.attributes.addBomb(this.x,this.y);\n this.attributes.addDamageBomb(this.x,this.y);\n this.attributes.removeLife(this.x,this.y)\n\n }", "function placeInTable(x, y) {\n const piece = document.createElement('div');\n piece.classList.add('piece');\n piece.classList.add(`p${currPlayer}`);\n piece.style.animationName = `row${y}`; //animate drop depth based on row#\n piece.style.top = -50 * (y + 2); //(top is refering to top of table (each square is 50px + 2 for the space between)\n\n const spot = document.getElementById(`${y}-${x}`); //location for piece to drop to\n spot.append(piece);\n}", "addBombs(numberBombs)\n {\n let bombLoop = 0;\n\n while(bombLoop < numberBombs)\n {\n let bombX = Math.floor(Math.random() * this.xSize);\n let bombY = Math.floor(Math.random() * this.ySize);\n if (!this.isBomb(bombX, bombY))\n {\n this.gameState[bombX][bombY].bomb = true;\n\n bombLoop++;\n }\n } \n }", "destroys(x, y, element, bomb) {\n\t\tvar cleanTile = true;\n\t\tthis.checkForKill(x, y, bomb);\n\t\tthis.checkForBomb(x, y);\n\t\tif ((this.gameMap.isGoodieAtPosition(x, y)) && (bomb.getBomberId() in this.men)) {\n\t\t\tthis.men[bomb.getBomberId()].addScore((Object.keys(this.men).length - 1) * c.SCORE_GOODIE);\n\t\t}\n\t\tif (this.gameMap.isBoxAtPosition(x, y)) {\n\t\t\tif (this.gameMap.countDownBoxAtPosition(x, y)) {\n\t\t\t\tif (bomb.getBomberId() in this.men)\n\t\t\t\t\tthis.men[bomb.getBomberId()].addScore((Object.keys(this.men).length - 1) * c.SCORE_BOX);\n\t\t\t\tif (Math.random() * 100 < c.CHANCE_OF_GOODIES) {\n\t\t\t\t\tbomb.addGoodie({\n\t\t\t\t\t\t'x': x,\n\t\t\t\t\t\t'y': y\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcleanTile = false;\n\t\t\t}\n\t\t}\n\t\tif (cleanTile && this.gameMap.isRemoveable(x, y)) {\n\t\t\tthis.gameMap.setTile(x, y, c.FILTER_BOMB | element);\n\t\t}\n\t}", "function placeBombs(board, bombCount) {\n for (let i = 0; i < bombCount; i++) {\n var rand = getRandomIntInclusive(0, (gRands.length - 1));\n board[gRands[rand].i][gRands[rand].j].value = BOMB;\n board[gRands[rand].i][gRands[rand].j].isBomb = true;\n gRands.splice(rand, 1);\n }\n}", "updateBigBoard(bCol, bRow, lCol, lRow) {\n //place either an x or o, depending whose turn it is\n\n if (game.board[bRow][bCol] === 'Draw')\n {\n\n var bigPiece1 = game.addSpriteWithWidth(game.startingX + bCol*game.squareSize*3, game.startingY + bRow*game.squareSize*3, 'poopemoji', game.squareSize*3, game.squareSize*3)\n bigPiece1.big = true\n game.bigPlacedPieces.push(bigPiece1);\n }\n else if(game.isXTurn)\n {\n var bigPiece = game.addSpriteWithWidth(game.startingX + bCol*game.squareSize*3, game.startingY + bRow*game.squareSize*3, 'X', game.squareSize*3, game.squareSize*3)\n game.bigPlacedPieces.push(bigPiece);\n bigPiece.big = true\n game.board[bRow][bCol] = \"x\";\n }\n else{\n var bigPiece = game.addSpriteWithWidth(game.startingX + bCol*game.squareSize*3, game.startingY + bRow*game.squareSize*3, 'O', game.squareSize*3, game.squareSize*3)\n game.bigPlacedPieces.push(bigPiece);\n bigPiece.big = true\n game.board[bRow][bCol] = \"o\";\n }\n\n game.magicBoardLogic[bCol][bRow] = \"magic\"\n game.bigBoardLogic[bCol][bRow] = \"closed\"\n console.log(\"IN updateBigBoard, length of game.bigPlacedPieces = \" + game.bigPlacedPieces.length)\n }", "placeInTable(y, x) {\n const piece = document.createElement('div');\n piece.classList.add('piece');\n piece.style.backgroundColor = this.currPlayer.color;\n piece.style.top = -50 * (y + 2);\n\n const spot = document.getElementById(`${y}-${x}`);\n spot.append(piece);\n }", "explodeBomb(bomb, r) {\n\t\tvar x = bomb.getXPosition();\n\t\tvar y = bomb.getYPosition();\n\t\tbomb.setAnim(3);\n\t\tthis.makeNoise(c.SOUND_KEY_EXPL, -1);\n\t\tthis.checkForKill(x, y, bomb);\n\t\tthis.gameMap.setTile(x, y, c.FILTER_BOMB | c.MAP_BOMB_CENTER);\n\t\tvar i = 1;\n\t\tif (r == 0) {\n\t\t\tthis.commit();\n\t\t\treturn;\n\t\t}\n\t\t// explode right\n\t\t// stop if next tile is already unbreakable\n\t\tif (this.gameMap.isDestroyable(x + 1, y)) {\n\t\t\twhile ((i < (r + 1)) && (this.gameMap.isDestroyable(x + i, y)) && (x + i < this.width) && bomb.compareMax('r', i)) {\n\t\t\t\tif (bomb.isNotStrong() && this.gameMap.isRemoveable(x + i, y)) bomb.setMax('r', i);\n\t\t\t\tif (i == r) this.destroys(x + i, y, c.MAP_BOMB_HORI, bomb);\n\t\t\t\tthis.gameMap.setTile(x + i - 1, y, c.FILTER_BOMB | c.MAP_BOMB_HORI);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\t//this.destroys(x + i - 1, y, c.MAP_BOMB_ENDR, bomb);\n\t\t\tif (this.gameMap.isExplostionAtPosition(x + i - 1, y))\n\t\t\t\tthis.gameMap.setTile(x + i - 1, y, c.FILTER_BOMB | c.MAP_BOMB_ENDR);\n\t\t}\n\t\tbomb.setIgn('r', i - 1);\n\t\ti = 1;\n\t\t// explode left\n\t\tif (this.gameMap.isDestroyable(x - 1, y)) {\n\t\t\twhile (i < (r + 1) && (this.gameMap.isDestroyable(x - i, y)) && (x - i > 0) && bomb.compareMax('l', i)) {\n\t\t\t\tif (bomb.isNotStrong() && this.gameMap.isRemoveable(x - i, y)) bomb.setMax('l', i);\n\t\t\t\tif (i == r) this.destroys(x - i, y, c.MAP_BOMB_HORI, bomb);\n\t\t\t\tthis.gameMap.setTile(x - i + 1, y, c.FILTER_BOMB | c.MAP_BOMB_HORI);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\t//this.destroys(x - i + 1, y, c.MAP_BOMB_ENDL, bomb);\n\t\t\tif (this.gameMap.isExplostionAtPosition(x - i + 1, y))\n\t\t\t\tthis.gameMap.setTile(x - i + 1, y, c.FILTER_BOMB | c.MAP_BOMB_ENDL);\n\t\t}\n\t\tbomb.setIgn('l', i - 1);\n\t\ti = 1;\n\t\t// explode top\n\t\tif (this.gameMap.isDestroyable(x, y + 1)) {\n\t\t\twhile (i < (r + 1) && (this.gameMap.isDestroyable(x, y + i)) && (y + i < this.height) && bomb.compareMax('b', i)) {\n\t\t\t\tif (bomb.isNotStrong() && this.gameMap.isRemoveable(x, y + i)) bomb.setMax('b', i);\n\t\t\t\tif (i == r) this.destroys(x, y + i, c.MAP_BOMB_VERT, bomb);\n\t\t\t\tthis.gameMap.setTile(x, y + i - 1, c.FILTER_BOMB | c.MAP_BOMB_VERT);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\t//this.destroys(x, y + i - 1, c.MAP_BOMB_ENDB, bomb);\n\t\t\tif (this.gameMap.isExplostionAtPosition(x, y + i - 1))\n\t\t\t\tthis.gameMap.setTile(x, y + i - 1, c.FILTER_BOMB | c.MAP_BOMB_ENDB);\n\t\t}\n\t\tbomb.setIgn('b', i - 1);\n\t\ti = 1;\n\t\t// explode bottom\n\t\tif (this.gameMap.isDestroyable(x, y - 1)) {\n\t\t\twhile (i < (r + 1) && (this.gameMap.isDestroyable(x, y - i)) && (y - i > 0) && bomb.compareMax('t', i)) {\n\t\t\t\tif (bomb.isNotStrong() && this.gameMap.isRemoveable(x, y - i)) bomb.setMax('t', i);\n\t\t\t\tif (i == r) this.destroys(x, y - i, c.MAP_BOMB_VERT, bomb);\n\t\t\t\tthis.gameMap.setTile(x, y - i + 1, c.FILTER_BOMB | c.MAP_BOMB_VERT);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\t//this.destroys(x, y - i + 1, c.MAP_BOMB_ENDT, bomb);\n\t\t\tif (this.gameMap.isExplostionAtPosition(x, y - i + 1))\n\t\t\t\tthis.gameMap.setTile(x, y - i + 1, c.FILTER_BOMB | c.MAP_BOMB_ENDT);\n\t\t}\n\t\tbomb.setIgn('t', i - 1);\n\t\tthis.commit(true);\n\t}", "function placeInTable(y, x) {\n\t// TODO: make a div and insert into correct table cell\n\tconst move = document.createElement('div');\n\tmove.classList.add('piece');\n\t//decides what color for the piece to be\n\tmove.classList.add(`p${currPlayer}`);\n\t//adds animation for the fall\n\tmove.classList.add(`fall`);\n\n\t//this code was in the Solution key but I am unsure what it is for:\n\t// move.style.top = -50 * (y + 2);\n\n\t//add the position ID to the current position and then append the created div to that position\n\tconst position = document.getElementById(`${y}-${x}`);\n\tposition.append(move);\n}", "function placeInTable(y, x) {\n // TODO: make a div and insert into correct table cell\n let currentPiece = document.createElement(\"div\");\n currentPiece.setAttribute(\"class\", \"piece\");\n currentPiece.classList.add(`p${currPlayer}`)\n\n let targetCell = document.getElementById(`${y}-${x}`);\n targetCell.append(currentPiece);\n board[y][x] = currPlayer;\n}", "addPlace(x, y) {\n const place = { x: x, y: y, empty: true };\n\n this.map.push(place);\n }", "function openBombCells(board){\n var openedBombCells=[];\n for(var i=0;i<board.length;i++){\n for(var x=0;x<board[0].length;x++)\n if(board[i][x].value==='x') {\n openedBombCells.push([i, x]);\n board[i][x].open=1;\n }\n }\n return openedBombCells;\n}", "placeBombs(numberOfBombs){\n let tileCount = this.rows*this.cols;\n let bombIndices = [];\n while(bombIndices.length < numberOfBombs){\n let randomIndex = Math.floor(Math.random()*tileCount);\n if(bombIndices.indexOf(randomIndex) > -1) continue;\n bombIndices[bombIndices.length] = randomIndex;\n }\n\n for(let bombIndex of bombIndices){\n let j = Math.floor(bombIndex/this.rows);\n let i = bombIndex % this.rows;\n this.grid[i][j].isBomb = true;\n }\n }", "function insertBall() {\n const ball = new Ball(\n 640 / 2, // x\n 480 / 2, // y\n 16, // width\n 16, // height\n ctx, // papper\n \"white\"// farg\n );\n gameObjects.push(ball); // tryck in i listan\n}", "function moverBola() {\n posicionActualBola[0] += xDireccionBola;\n posicionActualBola[1] += yDireccionBola;\n dibujarBola();\n revisarColisiones();\n gameOver();\n}", "pushNewPos(x, y, stack)\n\t{\n\t\tconsole.log (\"==> \", x, \", \", y);\n let npos = new Position();\n\t\tnpos.setx(x);\n\t\tnpos.sety(y);\n\t\tif (this.maze.validPosition(x,y))\n\t\t\tstack.push(npos);\n\t}", "tryWall(x, y) {\n if (x >= 0 && x < this.tiles[0].length && y >= 0 && y < this.tiles.length &&\n this.tiles[y][x] === 'E') {\n this.tiles[y][x] = 'W';\n }\n }", "addTile(tile, wallSize) {\n this.currentGame.turn++;\n this.currentGame.wallSize = wallSize;\n this.tiles.push(tile);\n this.ai.tracker.gained(this.currentGame.position, tile);\n this.ai.updateStrategy();\n this.discardTile(true);\n }", "function countBomb(i, j) {\n return minefield[i-1][j-1] + minefield[i-1][j] + minefield[i-1][j+1] +\n minefield[i][j-1] + minefield[i][j+1] +\n minefield[i+1][j-1] + minefield[i+1][j] + minefield[i+1][j+1];\n\n }", "function push(dir, x, y) {\n // find the offset from the player's tile of the tile to push\n var xadd = 0;\n var yadd = 0;\n if (dir === 0) xadd = 1;\n if (dir === 1) yadd = -1;\n if (dir === 2) xadd = -1;\n if (dir === 3) yadd = 1;\n var tile_x = x + xadd;\n var tile_y = y + yadd;\n if (tile_x >= MAP_WIDTH || tile_x < 0 || tile_y >= MAP_HEIGHT || tile_y < 0) return;\n // find tile that will be pushed (if possible) \n if (map[tile_y][tile_x]['move']) {\n // make sure no blocks in the way of a pushable block\n if (map[tile_y+yadd][tile_x+xadd]['type'] === ' ') {\n // recurse for sliding tiles\n if (map[tile_y][tile_x]['slide']) {\n slide(dir, tile_x, tile_y, xadd, yadd);\n return;\n }\n // set the tiles' x and newx, so they animate\n map[tile_y][tile_x]['x'] = tile_x;\n map[tile_y][tile_x]['newx'] = tile_x + xadd;\n map[tile_y+yadd][tile_x+xadd]['x'] = tile_x;\n map[tile_y+yadd][tile_x+xadd]['newx'] = tile_x + xadd;\n map[tile_y][tile_x]['y'] = tile_y;\n map[tile_y][tile_x]['newy'] = tile_y + yadd;\n map[tile_y+yadd][tile_x+xadd]['y'] = tile_y;\n map[tile_y+yadd][tile_x+xadd]['newy'] = tile_y + yadd;\n\n }\n }\n}", "function createSawBlade(x,y) {\n \n var hitZoneSize = 25;\n var damageFromObstacle = 10;\n var myObstacle = game.createObstacle(hitZoneSize,damageFromObstacle);\n var obstacleImage = draw.bitmap('img/sawblade.png');\n obstacleImage.x = -25;\n obstacleImage.y = -25;\n \n myObstacle.x = x;\n myObstacle.y = y;\n \n game.addGameItem(myObstacle);\n myObstacle.addChild(obstacleImage);\n }", "updatePlacedPieces(sprite)\n {\n if(sprite.key === \"X\" || sprite.key === \"O\")\n game.placedPieces.push(sprite)\n }", "function updateBombPos() {\n for(let r = 0; r < numberofbombs; r++) {\n bombvelocity[r] += bombacceleration[r];\n bombposY[r] += bombvelocity[r]\n \n hit = collidePointCircle(mouseX, mouseY - duck.height * duckScalar / 2, bombposX[r], bombposY[r], bombSize);\n}\n \n if (hit) {\n endGame();\n }\n \n //Resetting bombs to top of screen\n if (time > fallTime) {\n initbombpos();\n time = 0;\n }\n}", "function addPiece(board, column){\n\n if (board[column].full === false){\n\n for (var i=0; i<6; i++){\n\n if (board[column].content[i].value === 0){\n if (turn1 === true){\n board[column].content[i].value = 1; \n }\n else if(turn1 === false){\n board[column].content[i].value = 2;\n };\n\n if (i === 5){\n board[column].full = true;\n }\n return\n }\n }\n }\n}", "function actionMove (col, row){\n addXO(col,row)\n}", "function placePiece(piece, x, y) {\n // class string\n var cl = \"piece\";\n // white or black\n if (piece[0] == \"w\") {\n cl += \" white\";\n } else {\n cl += \" black\";\n }\n // piece type\n switch(piece[1]) {\n case \"r\":\n cl += \" rook\";\n break;\n case \"n\":\n cl += \" knight\";\n break;\n case \"b\":\n cl += \" bishop\";\n break;\n case \"q\":\n cl += \" queen\";\n break;\n case \"k\":\n cl += \" king\";\n break;\n case \"p\":\n cl += \" pawn\";\n break;\n }\n // add piece to board\n $(\"#\" + x + y).append('<img class=\"' + cl + '\" id=\"' + piece +\n '\" src=\"chess/' + piece[0] + piece[1] + '.png\">');\n}", "function createSawBlade(x,y){\n var hitZoneSize = 25;\n var damageFromObstacle = 10;\n var sawBladeHitZone = game.createObstacle(hitZoneSize, damageFromObstacle);\n sawBladeHitZone.x = x;\n sawBladeHitZone.y = y;\n game.addGameItem(sawBladeHitZone);\n var obstacleImage = draw.bitmap('img/sawblade.png');\n sawBladeHitZone.addChild(obstacleImage);\n obstacleImage.x = -25;\n obstacleImage.y = -25; \n\n \n }", "function addBall() {\n\tvar rows = gBoard.length;\n\tvar colls = gBoard[0].length;\n\tvar i = getRandomIntInclusive(0, rows - 1);\n\tvar j = getRandomIntInclusive(0, colls - 1);\n\n\tvar randomCell = gBoard[i][j];\n\tif (randomCell.type === WALL) return;\n\telse if (randomCell.gameElement !== null) return;\n\telse if (gIsGameOn) {\n\t\tgBoard[i][j].gameElement = BALL\n\t\tgBallsToCollect++;\n\t}\n\n\trenderCell({ i, j }, BALL_IMG);\n}", "fillAt(row, col, piece) {\r\n this.board[row][col] = piece;\r\n }", "putShip(){\n let newBoard = this.state.board;\n let a = Math.floor(Math.random() * 10);\n let b = Math.floor(Math.random() * 10);\n if(newBoard[a][b] === 1){\n this.putShip()\n } else{\n newBoard[a][b] = SHIP\n this.setState({board: newBoard});\n }\n }", "placeInTable(y, x) {\n const piece = document.createElement('div');\n piece.classList.add('piece');\n // Add in custom color functionality.\n piece.style.backgroundColor = this.currPlayer.color;\n piece.style.top = -50 * (y + 2);\n\n const spot = document.getElementById(`${y}-${x}`);\n spot.append(piece);\n }", "function drawMine(){\n // Draw the mine using buttons.\n // Set each button with id i-j to refer to the location in the 2d array. \n // Attribute clicked stores how many times this button is clicked.\n for(let i = 1; i <= height; i++){\n for (let j = 1; j <= width; j++){\n $(\"#mine-field\").append(\"<a class = 'btn' x = \" + i + \" y = \" + j + \n \" hasBomb = \" + minefield[i][j] + \" id = \" + i + \"-\" + j + \n \" clicked = 0 rclicked = 0\" + \">\" + \"</a>\");\n }\n $(\"#mine-field\").append(\"<br>\");\n }\n }", "function createSawBlade(x,y) {\n var hitZoneSize = 25;\n var damageFromObstacle = 30;\n var myObstacle = game.createObstacle(hitZoneSize,damageFromObstacle);\n myObstacle.x = x;\n myObstacle.y = y;\n game.addGameItem(myObstacle);\n var obstacleImage = draw.bitmap('img/spikey clock.png');\n myObstacle.addChild(obstacleImage);\n obstacleImage.x = -25;\n obstacleImage.y = -25;\n }", "function Bomb(side, damage, lifetime, damageRadius, pos) {\n\tPlayerItem.call(this, side);\n\tTimeItem.call(this, lifetime);\n\n\tthis.damage = damage;\n\tthis.radius = damageRadius;\n\tthis.pos = pos;\n this.kind = 'bomb';\n\n\t// Initialize all values\n\tfunction init() {\n\t\tthis.kind = 'bomb';\n\t}\n\tthis.init = init;\n\n\tfunction update() {\n\t\tvar res = this.increaseTurn();\n\t\treturn res;\n\t}\n\tthis.update = update;\n\n\tthis.init();\n}", "function makeBoard(myArray) {\n var l, c, count;\n \n // Empty board\n board = [];\n for (l = 0; l < lines+2; l++) {\n board[l] = [];\n for (c = 0; c < collumns+2; c++) {\n board[l][c] = 0;\n }\n }\n \n // Place mines in board (only valid positions)\n count = 0;\n for (l = 1; l <= lines; l++) {\n for (c = 1; c <= collumns; c++) {\n if (myArray[count] === 1) {\n \t// Places bomb (-1) in given position, and increases count on neighboring cells\n \tboard[l][c] = -1;\n \tincreaseTile(l-1, c-1);\n \tincreaseTile(l-1, c );\n \tincreaseTile(l-1, c+1);\n \tincreaseTile(l, c-1);\n \tincreaseTile(l, c+1);\n \tincreaseTile(l+1, c-1);\n \tincreaseTile(l+1, c );\n \tincreaseTile(l+1, c+1);\n }\n count++;\n }\n }\n}", "function createBoard() {\n\tflagsLeft.innerHTML = bombAmount\n\n\t\n\tconst bombsArray = Array(bombAmount).fill('bomb') // fill the first array with bombs\n\tconst emptyArray = Array(width * width - bombAmount).fill('valid') //fill the second array with valid elements i.e. all non-bombs\n\tconst gameArray = emptyArray.concat(bombsArray) // concatenantion of both of above arrays\n\tconst shuffledArray = gameArray.sort(() => Math.random() - 0.5) //get shuffled game array with random bombs\n\n\t//this loop goes width*width times and creates our elements with a click and right click function attached to them\n\tfor (let i = 0; i < width * width; i++) {\n\t\tconst square = document.createElement('div')\n\t\tsquare.setAttribute('id', i)\n\t\tsquare.classList.add(shuffledArray[i])\n\t\tgrid.appendChild(square)\n\t\tsquares.push(square)\n\n\t\t//normal click\n\t\tsquare.addEventListener('click', function (e) {\n\t\t\tclick(square)\n\t\t})\n\n\t\t//right click\n\t\tsquare.oncontextmenu = function (e) {\n\t\t\te.preventDefault()\n\t\t\taddFlag(square)\n\t\t}\n\t}\n\n\t//This loop shows the total number of surrounding bombs around a valid element\n\tfor (let i = 0; i < squares.length; i++) {\n\t\tlet total = 0\n\t\tconst isLeftEdge = (i % width === 0)\n\t\tconst isRightEdge = (i % width === width - 1)\n\n\t\t\n\t\tif (squares[i].classList.contains('valid')) {\n\t\t\t//These 8 if conditions check all surrounding elements for bombs, and if present then show total no. of bombs on valid element\n\t\t\tif (i > 0 && !isLeftEdge && squares[i - 1].classList.contains('bomb')) total++\n\t\t\tif (i > 9 && !isRightEdge && squares[i + 1 - width].classList.contains('bomb')) total++\n\t\t\tif (i >= 10 && squares[i - width].classList.contains('bomb')) total++\n\t\t\tif (i >= 11 && !isLeftEdge && squares[i - 1 - width].classList.contains('bomb')) total++\n\t\t\tif (i <= 98 && !isRightEdge && squares[i + 1].classList.contains('bomb')) total++\n\t\t\tif (i < 90 && !isLeftEdge && squares[i - 1 + width].classList.contains('bomb')) total++\n\t\t\tif (i <= 88 && !isRightEdge && squares[i + 1 + width].classList.contains('bomb')) total++\n\t\t\tif (i <= 89 && squares[i + width].classList.contains('bomb')) total++\n\t\t\tsquares[i].setAttribute('data', total)\n\t\t}\n\t}\n}", "addPiece({piece, x, y}) {\n\n\t\tif ( ! this.pieceCanFit({piece, x, y}) ) {\n\t\t\tconsole.error('piece cannot fit! cannot add piece to board.');\n\t\t\treturn false;\n\t\t}\n\n\t\t// check piece's squares data (0's and 1's) and set the corresponding squares' data for this.squares\n\t\tconst squaresForPiece = this.getBoardSquaresForPiece({piece, x, y});\n\t\tsquaresForPiece.forEach((info) => {\n\t\t\tif (info.boardSquare !== null)\n\t\t\t\tinfo.boardSquare.fill();\n\t\t});\n\n\t\treturn true;\n\t}", "function move(x, y){\n\t\t\tvar a;\n\t\t\tswitch (y.val){\n\t\t\t\tcase \"\":\n\t\t\t \t\ta = new Board([], \"\");\n\t\t\t \t\tbreak;\n\t\t\t \tcase \"x\":\n\t\t\t \t\ta = new Board([], \"x\");\n\t\t\t \t\tbreak;\n\t\t\t \tcase \"o\":\n\t\t\t \t\ta = new Board([], \"o\");\n\t\t\t \t\tbreak;\n\t\t\t}\n\t\t\ta.next = y.next;\n\t\t\tfor (var i = 0; i < 9; i++){\n\t\t\t\tswitch (y.spaces[i].val){\n\t\t\t\t\tcase \"\":\n\t\t\t \t\t\ta.spaces[i] = new Board([], \"\");\n\t\t\t\t \t\tbreak;\n\t\t\t\t \tcase \"x\":\n\t\t\t \t\t\ta.spaces[i] = new Board([], \"x\");\n\t\t\t\t \t\tbreak;\n\t\t\t\t \tcase \"o\":\n\t\t\t\t \t\ta.spaces[i] = new Board([], \"o\");\n\t\t\t\t \t\tbreak;\n\t\t\t\t}\n\t\t\t\tfor (var j = 0; j < 9; j++){\n\t\t\t\t\tswitch (y.spaces[i].spaces[j].val){\n\t\t\t\t\t\tcase \"\":\n\t\t\t \t\t\t\ta.spaces[i].spaces[j] = new space(\"\", 9*i + j);\n\t\t\t \t\t\t\tbreak;\n\t\t\t\t \t\tcase \"x\":\n\t\t\t \t\t\t\ta.spaces[i].spaces[j] = new space(\"x\", 9*i + j);\n\t\t\t\t\t \t\tbreak;\n\t\t\t\t\t \tcase \"o\":\n\t\t\t\t\t\t\ta.spaces[i].spaces[j] = new space(\"o\", 9*i + j);\n\t\t\t\t \t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar b;\n\t\t\tif (clicks%2 == 0){\n\t\t\t\tb = \"x\";\n\t\t\t}\n\t\t\telse{\n\t\t\t\tb = \"o\";\n\t\t\t}\n\t\t\tvar c = x%9;\n\t\t\tvar d = Math.floor(x/9);\n\n\t\t\ta.spaces[d].spaces[c].val = b;\n\t\t\tif(a.spaces[d].val == \"\"){\n\t\t\t\tif(check5(c, bool, a.spaces[d])){\n\t\t\t\t\ta.spaces[d].val = b;\n\t\t\t\t\tif(check5(d, bool, a)){\n\t\t\t\t\t\ta.val = b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (empty(a.spaces[c]).length == 0){\n\t\t\t\ta.next = -1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\ta.next = c;\n\t\t\t}\n\t\t\treturn a\n\t\t}", "canBomb() {\n\n //check not an over bomb \n if (map.grounds[this.y][this.x].bomb) {\n return;\n }\n else if (this.attributes.attribut.actuelBomb == this.attributes.attribut.maxBombs){\n return;\n \n }\n else {\n this.putBomb();\n }\n\n //check max bomb\n \n }", "function mA(x,y){\n\t\t\tEnemyx.push (x);\n\t\t\tEnemyy.push (y);\n\t\t\tEnemyLx.push(x);\n\t\t\tEnemyLy.push(y);\n\t}", "function initiateBoard(){\n\tblankx=wid-1;\n\tblanky=height-1;\n\tfor(i=0;i<=numTiles;i++) position[i]=i;\n}", "addNewEnemy(){\n do{\n this.x = 100*Math.floor(Math.random() * 10) + 10;\n if(this.x <=20) this.x = 20;\n } while (this.x > 1000); \n this.y = 0;\n var enemy=this.enemies.create(this.x,this.y,\"enemy1\");\n \n enemy.setFrame(2);\n enemy.setScale(0.4);\n enemy.checkWorldBounds = true;\n enemy.outOfBoundsKill = true;\n enemy.setVelocityY(100);\n }", "function getZoneWithBomb(direction) {\n var x1 = 0, x2 = building.width - 1,\n y1 = 0, y2 = building.height - 1;\n \n switch (direction) {\n case 'U': // Up\n x1 = batman.x; x2 = batman.x;\n y2 = batman.y - 1;\n break;\n case 'UR': // Up-Right\n x1 = batman.x + 1;\n y2 = batman.y - 1;\n break;\n case 'R': // Right\n x1 = batman.x + 1;\n y1 = batman.y; y2 = batman.y;\n break;\n case 'DR': // Down-Right\n x1 = batman.x + 1;\n y1 = batman.y + 1;\n break;\n case 'D': // Down\n x1 = batman.x; x2 = batman.x;\n y1 = batman.y + 1;\n break;\n case 'DL': // Down-Left\n x2 = batman.x - 1;\n y1 = batman.y - 1;\n break;\n case 'L': // Left\n x2 = batman.x - 1;\n y1 = batman.y; y2 = batman.y;\n break;\n case 'UL': // Up-Left\n x2 = batman.x - 1;\n y2 = batman.y - 1;\n break;\n default:\n throw 'The direction \"' + direction + '\" is not supported.';\n }\n // consider previous knowledge.\n if (building.canHaveBomb.x1 > x1) x1 = building.canHaveBomb.x1;\n else building.canHaveBomb.x1 = x1;\n if (building.canHaveBomb.x2 < x2) x2 = building.canHaveBomb.x2;\n else building.canHaveBomb.x2 = x2;\n if (building.canHaveBomb.y1 > y1) y1 = building.canHaveBomb.y1;\n else building.canHaveBomb.y1 = y1;\n if (building.canHaveBomb.y2 < y2) y2 = building.canHaveBomb.y2;\n else building.canHaveBomb.y2 = y2;\n // the zone has been identified.\n return {\n x1: x1,\n x2: x2,\n y1: y1,\n y2: y2\n };\n}", "function spawn_zombie(){\r\n\tif(zombie_coords.length < 100){\r\n\t\tvar point = genPoint();\r\n\t\tzombie_coords.push(point);\r\n\t\tzombie_speed.push(genSpeedModifier(0.2));\r\n\t}\r\n}", "function countBombs(x,y) {\r\n\tlet count = 0;\r\n\tconsole.log(x,y);\r\n\r\n\t// left hand side\r\n\tif(x == 0) {\r\n\t\tif(y == 0) { // upper left corner\r\n\t\t\t\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\r\n\r\n\t\t}\r\n\t\telse if(y == 15) { // lower left corner\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t}\r\n\t\telse {\r\n\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\r\n\t\r\n\t\t}\r\n\t} \r\n\t// right hand side\r\n\telse if (x == 29) {\r\n\t\t//upper right corner\r\n\t\tif(y == 0) {\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t}\r\n\t\t// lower right corner\r\n\t\telse if (y == 15) {\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\t\r\n\t\t}\r\n\t}\r\n\t// all other boxes: x does not limit these boxs, y still does \r\n\telse {\r\n\t\tif(y == 0) { // top row excpet corners\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\t\r\n\t\t}\r\n\t\telse if (y == 15) { // bottom row except corners\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\t\r\n\t\t}\r\n\t\telse { // rest of the boxes\r\n\t\t\tif(table[x-1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y-1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x-1][y].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y].getIsBomb()) {count ++};\t\r\n\t\t\tif(table[x-1][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x][y+1].getIsBomb()) {count ++};\r\n\t\t\tif(table[x+1][y+1].getIsBomb()) {count ++};\r\n\t\t}\r\n\t}\r\n\r\n\treturn count;\r\n}", "function placeInTable(y, x) {\n // make a div and insert into correct table cell\n let token = document.createElement('div');\n token.classList.add('piece');\n currPlayer === 1? token.classList.add('piece1'):token.classList.add('piece2');\n //select the (x,y) cell in the htmlBoard\n let correctCell = document.getElementById(`${y}-${x}`);\n //append the created dic to the correct cell\n correctCell.append(token);\n}", "function moveBird (sprite) {\n //check for screen wrap\n if (sprite.x > SCREEN_WIDTH) {\n sprite.x = -sprite.width;\n //start at random height on canvas within two edge tiles\n var tileHeight = 32;\n var min = (tileHeight * 2);\n var max = SCREEN_HEIGHT - (tileHeight * 2);\n sprite.y = Math.floor(Math.random() * (max - min + 1)) + min;\n }\n sprite.x += 2;\n }", "function moveBombs()\n{\n //for each bomb\n balloonAmmo.forEach(oneBomb =>\n {\n //if bomb has been fired\n if (oneBomb.fired)\n {\n //move bomb down according to gravity\n oneBomb.y += 0.98 * oneBomb.speed;\n oneBomb.speed++;\n //console.log(bombIndex);\n }\n //if bomb hasn't been fired\n else\n {\n if (keys !== null)\n {\n //move bomb up with balloon when \"w\" or \"arrow up\" pressed\n if (keys[38] || keys[87])\n {\n oneBomb.velY -= 1.5;\n }\n //move bomb up with balloon when \"s\" or \"arrow down\" pressed\n if (keys[40] || keys[83])\n {\n oneBomb.velY += 3;\n }\n //move bomb up with balloon when \"a\" or \"arrow left\" pressed\n if (keys[37] || keys[65])\n {\n oneBomb.velX -= 2;\n }\n //move bomb up with balloon when \"d\" or \"arrow right\" pressed\n if (keys[39] || keys[68])\n {\n oneBomb.velX += 1.5;\n }\n }\n\n //decceleration based on drag coefficient\n oneBomb.velX *= oneBomb.drag;\n oneBomb.velY *= oneBomb.drag;\n\n //position change based on velocity change\n oneBomb.x += oneBomb.velX;\n oneBomb.y += oneBomb.velY;\n\n player.yPos + (player.ySize - 25)\n\n //in bounds x axis\n if (oneBomb.x > WIDTH - player.xSize / 2 - 15)\n {\n oneBomb.x = WIDTH - player.xSize / 2 - 15;\n }\n else if (oneBomb.x < (player.xSize / 2 - 15))\n {\n oneBomb.x = player.xSize / 2 - 15;\n }\n\n //in bounds y axis\n if (oneBomb.y > HEIGHT - balloonGround - player.ySize + 95)\n {\n oneBomb.y = HEIGHT - balloonGround - player.ySize + 95;\n }\n else if (oneBomb.y < (player.ySize - 25))\n {\n oneBomb.y = (player.ySize - 25);\n }\n }\n })\n}", "movement(x, y, prevBoard) {\n const newBoard = this.gameObj.deepCopyBoard(prevBoard)\n const size = this.gameObj.size\n if (x >= 0 && x < size && y>= 0 && y < size) {\n newBoard[this.x][this.y].occupiedBy = null\n newBoard[x][y].occupiedBy = this.id\n this.direction = this.orientation(x, y, this.x, this.y)\n this.x = x\n this.y = y\n }\n \n return newBoard\n }", "function addingBalls() {\n\tvar randI = Math.floor(Math.random()* (ROWS-1));\n\tvar randJ = Math.floor(Math.random()* (COLS-1));\n\n\tif ((gBoard[randI][randJ].type === FLOOR) && (gBoard[randI][randJ].gameElement === null)) {\n\t\tgBoard[randI][randJ].gameElement = BALL;\n\t\tvar currPos = {i: randI, j: randJ};\n\t\trenderCell(currPos, BALL_IMG);\n\t\tgBallCounter++;\n\t}\t\n}", "function updateBoard(entity) {\n board[entity.position.row][entity.position.column].pop();\n board[entity.position.row][entity.position.column].push(entity);\n}", "addCell(x, y, isLive = true, neighbours = 0) {\n const newCell = new Cell(isLive, neighbours);\n if (!this.cells[y]) this.cells[y] = {};\n this.cells[y][x] = newCell;\n }", "function placeInTable(y, x) {\n // TODO: make a div and insert into correct table cell\n const cell = document.getElementById(`${y}-${x}`);\n //create the piece for the cell\n const piece = document.createElement(\"div\");\n //add the class for styling\n piece.classList.add(\"piece\");\n piece.classList.add(`p${currPlayer}`);\n\n //append to the cell\n cell.append(piece);\n\n //add animation to make it drop\n let top = -20;\n const dropInterval = setInterval(function () {\n piece.style.top = `${top}px`;\n top++;\n\n if (top >= 0) {\n clearInterval(dropInterval);\n }\n }, 10); //every 10ms drop 1px\n}", "function placeInTable (y, x) {\n // DONE TODO: make a div and insert into correct table cell\n const div = document.createElement ('div');\n div.classList.add ('piece');\n let spot = document.getElementById (`${y}-${x}`);\n div.classList.add (`p${currPlayer}`);\n spot.append (div);\n //div.classList.add ('id', `${y}-${x}]`);\n // div.classList.add ('column-top', `${y}-${x}]`);\n}", "function addBall(board) {\n\tvar i = getRandomInt(0, board.length - 1);\n\tvar j = getRandomInt(0, board[0].length - 1);\n\twhile ((board[i][j].gameElement === null) &&\n\t\t(board[i][j].type === FLOOR)) {\n\n\t\tboard[i][j].gameElement = BALL;\n\t\trenderCell({ i, j }, BALL_IMG);\n\t\tgBallsAdded++;\n\t\tbreak;\n\t}\n}", "function bomb() {\n\t//picks a random number between 0 and 5 (includes decimal spaces). If the number is less than one\n\t// the function returns 0 (meaning there is a bomb in this tile). Otherwise it returns 0 (meaning\n\t// there is no bomb). the chances of a bomb are 1/8, statistically their are two bombs per row.\n\t//difficulty goes down each completion\n\tvar b = random(0, difficulty);\n\tif (b > 1) {\n\t\tb = 0;\n\t} else {\n\t\tbombs += 1;\n\t\tb = 1;\n\t}\n\treturn b;\n}", "function enemyFire() {\r\n const [col, row] = enemyFireLocation();\r\n //miss\r\n if (board[col+row] === '~') {\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).addClass(\"miss\")\r\n //hit\r\n } else {\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).removeClass(\"placed\")\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).removeClass(\"place\")\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).addClass(\"hit\")\r\n //adds adjacent squares as next targets\r\n addTargets([col, row]);\r\n }\r\n //add letter from board class onto table\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).text(board[col+row]);\r\n }", "addHouse(X) {\r\n this.house.addChild(this.building);\r\n this.house.addChild(this.light);\r\n this.house.position = ({x: X, y: 100});\r\n this.stage.addChild(this.house);\r\n }", "function placeInTable(y, x) {\n let gamePiece = document.createElement('div');\n let cell = document.getElementById(`${y}-${x}`);\n gamePiece.classList.add(\"piece\");\n gamePiece.classList.add(`p${currPlayer}`);\n cell.append(gamePiece);\n console.log(\"checking what cell\", cell);\n}", "function bombAppear() {\n const randomNum = Math.floor(Math.random() * currentAlienPositions.length)\n const alienToDropBomb = currentAlienPositions[randomNum]\n const bombStartPosition = alienToDropBomb + width\n if (cells[bombStartPosition].classList.contains('alien')) {\n return bombAppear()\n }\n const bombId = Math.random() * Math.random() * 100\n bombTimers[bombId] = { timerId: bombId, position: bombStartPosition }\n const bombCurrentPosition = bombTimers[bombId].position\n const bombTimer = bombTimers[bombId].timerId\n cells[bombStartPosition].classList.add('bomb')\n bombDrop(bombTimer, bombCurrentPosition)\n}", "function hitBomb(player, bomb)\n{\n //game pauses\n this.physics.pause();\n //player turns red as if dead\n player.setTint(0xff0000);\n //last image of player when dead is the turn animation\n player.anims.play('turn');\n //gameOver is true as a result\n gameOver = true;\n}", "function addAnimal() {\n let randX = randomInteger(1, matrixSize.xAce-1),\n randY = randomInteger(1, matrixSize.yAce-1);\n if (matrix[randY][randX] !== bush) {\n matrix[randY][randX] = something;\n } else {\n matrix[randY][randX] = something;\n }\n return matrix;\n}" ]
[ "0.7952302", "0.72114384", "0.70820004", "0.7045776", "0.68686396", "0.68005866", "0.67621773", "0.64761996", "0.643432", "0.64154553", "0.6413736", "0.6398815", "0.63926667", "0.6384411", "0.63651574", "0.6342274", "0.63390434", "0.6338396", "0.6310249", "0.62979966", "0.6278897", "0.6226146", "0.61962336", "0.61959356", "0.61878264", "0.6177095", "0.6174241", "0.6133571", "0.6100053", "0.60905015", "0.6078392", "0.60670674", "0.60661215", "0.6042724", "0.6029026", "0.60002464", "0.59963715", "0.59863365", "0.59810895", "0.59598166", "0.5954505", "0.59538996", "0.5942059", "0.59407", "0.5908017", "0.5907732", "0.59072345", "0.5902218", "0.59003514", "0.58961564", "0.5892985", "0.5891266", "0.5890678", "0.58892715", "0.5888863", "0.58854467", "0.58753645", "0.58651227", "0.5862314", "0.58563495", "0.58537954", "0.5846612", "0.584185", "0.5837551", "0.5833758", "0.5811569", "0.58079517", "0.58079195", "0.58076596", "0.58007526", "0.5795147", "0.5793733", "0.5792218", "0.57862556", "0.5775945", "0.5768133", "0.57600164", "0.5756337", "0.5747155", "0.5746074", "0.5745923", "0.5735833", "0.5735305", "0.57322586", "0.5732216", "0.5728141", "0.5727424", "0.5721632", "0.5720878", "0.5719417", "0.57036126", "0.56961375", "0.5695169", "0.56947297", "0.5681076", "0.5675087", "0.56559855", "0.5654212", "0.56536865", "0.5651684", "0.5643799" ]
0.0
-1
not the best email regEx but works for now
function TestEmail(e) { var errorMsg = "* Please enter a valid email *"; var emailRegEx = new RegExp('[a-z0-9!#$%\&\'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%\&\'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?'); if(!emailRegEx.test(e.target.value)){ document.querySelector("div.signUpfakeimg span[class='error email']").textContent = errorMsg; } else { errorMsg = ""; document.querySelector("div.signUpfakeimg span[class='error email']").textContent = errorMsg; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validEmail(email) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(email);\n }", "function check_email(email) {\r\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\r\n if (pattern.test(email) === false) {\r\n return '0';\r\n } else {\r\n return '1';\r\n }\r\n}", "function validEmailAddress(email) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(email);\n}", "function isValidEmailAddress( email ) {\n var rVal = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return rVal.test( email );\n}", "function validateEmail(mail)\n{\n return (/^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(\\.\\w{2,3})+$/.test(mail))\n}", "function validarEmail(email){\n var regex = /^\\w+([\\.\\+\\-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,4})+$/.test(email); \n return regex;\n }", "function regExpEmail() {\n // Récupération des données saisies\n const emailValid = contact.email;\n // Injection du HTML\n const checkEmail = document.querySelector(\"#emailErrorMsg\");\n\n // Indication de la bonne saisie ou l'erreur dans le HTML\n if (/^[a-zA-Z0-9.-_]+[@]{1}[a-zA-Z0-9.-_]+[.]{1}[a-z]{2,10}$/.test(emailValid)) {\n checkEmail.innerHTML = \"<i class='fas fa-check-circle form'></i>\";\n return true;\n } else {\n checkEmail.innerHTML = \"<i class='fas fa-times-circle form'></i> format incorrect\";\n }\n }", "function isValidEmail(email){\n\t/*the part befor @ can't have <>()....*/\n\t/*and the email need to have format of something@somthing.somthing*/\n \tvar re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,})$/;\n \treturn re.test(email);\n}", "function email (s) {\n\t return low.string(s) &&\n\t /^.+@.+\\..+$/.test(s)\n\t}", "function email(string) {\n return /.+@.+\\..+/.test(string);\n }", "function checkEmail(n)\r\n{\r\n\treturn n.search(/^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$/)!=-1?!0:!1\r\n\t\r\n}", "function ValidateEmail(inputText){\n var mailformat = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n if(inputText.match(mailformat))\n return true;\n else\n return false;\n }", "validate(email) {\n const expression = /(?!.*\\.{2})^([a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+(\\.[a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+)*|\"((([ \\t]*\\r\\n)?[ \\t]+)?([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*(([ \\t]*\\r\\n)?[ \\t]+)?\")@(([a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|[a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF][a-z\\d\\-._~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]*[a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])\\.)+([a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|[a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF][a-z\\d\\-._~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]*[a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])\\.?$/i;\n\n return expression.test(String(email).toLowerCase());\n }", "validate(email) {\n const expression = /(?!.*\\.{2})^([a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+(\\.[a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+)*|\"((([ \\t]*\\r\\n)?[ \\t]+)?([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*(([ \\t]*\\r\\n)?[ \\t]+)?\")@(([a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|[a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF][a-z\\d\\-._~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]*[a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])\\.)+([a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|[a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF][a-z\\d\\-._~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]*[a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])\\.?$/i;\n\n return expression.test(String(email).toLowerCase());\n }", "function checkEmail(email) \n{ \n var mailformat = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/; \n if(email.match(mailformat)) \n return true; \n else \n return false;\n}", "function isnotVlaidEmail(str){\n\t\t\t strmail=str;\n\t\t\t firstat = strmail.indexOf(\"@\");\n\t\t\t lastat = strmail.lastIndexOf(\"@\");\n\t\t\t strmain=strmail.substring(0,firstat);\n\t\t\t strsub=strmail.substring(firstat,str.length);\n\t\t\t flag=false;\n\t\t\t if(strmail.length>120)\n\t\t\t { flag=true;alert(\"1\");}\n\t\t\t if(strmain.indexOf(' ')!=-1 || firstat==0 || firstat!=lastat || strsub.indexOf(' ')!=-1 )\n\t\t\t {flag=true;}\n\n\t\t\tstringMailCheck1=\"!#$%^&*()_+|<>?/=-~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf3=1;\n\t\t\tfor(j=0;j<strsub.length;j++)\n\t\t\t{if(stringMailCheck1.indexOf(strsub.charAt(j))!=-1)\n\t\t\t{f3=0;}}\n\t\t\tif(f3==0)\n\t\t\t{flag=true;}\n\n\t\t\tstringMailCheck2=\"!@#$%^&*()+|<>?/=-~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf4=1;\n\t\t\tfor(j=0;j<strmain.length;j++)\n\t\t\t{if(stringMailCheck2.indexOf(strmain.charAt(j))!=-1)\n\t\t\t{f4=0;}}\n\t\t\tif(f4==0)\n\t\t\t{flag=true;}\n\t\t\t\n\t\t\t k=0;\n\t\t\t strlen=strsub.length;\n\t\t\t for(i=0;i<strlen-1;i++)\n\t\t\t { if(strsub.charAt(i)=='.')\n\t\t\t {k=k+1;}}\n\t\t\t if(k>2)\n\t\t\t { flag=true;}\n\t\t\t if(firstat==-1 || lastat==-1)\n\t\t\t {flag=true;}\n\t\t\t if(Number(strmain))\n\t\t\t {flag=true;}\n\t\t\t if(firstat != lastat )\n\t\t\t {flag=true;}\n\t\t\t firstdot=strmail.indexOf(\".\",firstat);\n\t\t\t lastdot=strmail.lastIndexOf(\".\");\n\t\t\t if(firstdot == -1 || lastdot == -1 || lastdot==strmail.length-1)\n\t\t\t {flag=true;}\n\t\t\t\n\t\t\treturn flag;\n}", "function isnotVlaidEmail(str){\n\t\t\t strmail=str;\n\t\t\t firstat = strmail.indexOf(\"@\");\n\t\t\t lastat = strmail.lastIndexOf(\"@\");\n\t\t\t strmain=strmail.substring(0,firstat);\n\t\t\t strsub=strmail.substring(firstat,str.length);\n\t\t\t flag=false;\n\t\t\t if(strmail.length>120)\n\t\t\t { flag=true;//alert(\"1\");\n\t\t\t }\n\t\t\t if(strmain.indexOf(' ')!=-1 || firstat==0 || firstat!=lastat || strsub.indexOf(' ')!=-1 )\n\t\t\t {flag=true;}\n\n\t\t\tstringMailCheck1=\"!#$%^&*()+|<>?/=~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf3=1;\n\t\t\tfor(j=0;j<strsub.length;j++)\n\t\t\t{if(stringMailCheck1.indexOf(strsub.charAt(j))!=-1)\n\t\t\t{f3=0;}}\n\t\t\tif(f3==0)\n\t\t\t{flag=true;}\n\n\t\t\tstringMailCheck2=\"!@#$%^&*()+|<>?/=~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf4=1;\n\t\t\tfor(j=0;j<strmain.length;j++)\n\t\t\t{if(stringMailCheck2.indexOf(strmain.charAt(j))!=-1)\n\t\t\t{f4=0;}}\n\t\t\tif(f4==0)\n\t\t\t{flag=true;}\n\t\t\t\n\t\t\t k=0;\n\t\t\t strlen=strsub.length;\n\t\t\t for(i=0;i<strlen-1;i++)\n\t\t\t { if(strsub.charAt(i)=='.')\n\t\t\t {k=k+1;}}\n\t\t\t if(k>3)\n\t\t\t { flag=true;}\n\t\t\t if(firstat==-1 || lastat==-1)\n\t\t\t {flag=true;}\n\t\t\t if(Number(strmain))\n\t\t\t {flag=true;}\n\t\t\t if(firstat != lastat )\n\t\t\t {flag=true;}\n\t\t\t firstdot=strmail.indexOf(\".\",firstat);\n\t\t\t lastdot=strmail.lastIndexOf(\".\");\n\t\t\t if(firstdot == -1 || lastdot == -1 || lastdot==strmail.length-1)\n\t\t\t {flag=true;}\n\t\t\t\n\t\t\treturn flag;\n}", "function checkEmail ( str ) {\n var myreg2 = /^[a-zA-Z]+[@]{1}[a-zA-Z]+[\\.]{1}[a-zA-Z]{2,3}$/;\n return myreg2.test(str);\n}", "function checkEmail(emailAddress) {\n var sQtext = '[^\\\\x0d\\\\x22\\\\x5c\\\\x80-\\\\xff]';\n var sDtext = '[^\\\\x0d\\\\x5b-\\\\x5d\\\\x80-\\\\xff]';\n var sAtom = '[^\\\\x00-\\\\x20\\\\x22\\\\x28\\\\x29\\\\x2c\\\\x2e\\\\x3a-\\\\x3c\\\\x3e\\\\x40\\\\x5b-\\\\x5d\\\\x7f-\\\\xff]+';\n var sQuotedPair = '\\\\x5c[\\\\x00-\\\\x7f]';\n var sDomainLiteral = '\\\\x5b(' + sDtext + '|' + sQuotedPair + ')*\\\\x5d';\n var sQuotedString = '\\\\x22(' + sQtext + '|' + sQuotedPair + ')*\\\\x22';\n var sDomain_ref = sAtom;\n var sSubDomain = '(' + sDomain_ref + '|' + sDomainLiteral + ')';\n var sWord = '(' + sAtom + '|' + sQuotedString + ')';\n var sDomain = sSubDomain + '(\\\\x2e' + sSubDomain + ')*';\n var sLocalPart = sWord + '(\\\\x2e' + sWord + ')*';\n var sAddrSpec = sLocalPart + '\\\\x40' + sDomain; // complete RFC822 email address spec\n var sValidEmail = '^' + sAddrSpec + '$'; // as whole string\n\n var reValidEmail = new RegExp(sValidEmail);\n\n if(reValidEmail.test(emailAddress)== true) {\n return true;\n }else{\n alert(\"Please input a valid email address!\")\n return false;\n }\n}", "function checkmail(){\r\n\tif((/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(compMail.val())))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function validarEmail(email){expr=/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;if(!expr.test(email)) return false;else return true;}", "_emailValidation(emailString) {\n console.log(emailString)\n if (/(.+)@(.+){2,}\\.(.+){2,}/.test(emailString)) {\n return true\n } else {\n return false\n }\n }", "function validate_email(field,alerttxt)\r\n{\r\n\tif (/^\\w+([\\+\\.-]?\\w+)*@\\w+([\\+\\.-]?\\w+)*(\\.\\w{2,6})+$/.test(field.value))\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n\telse \r\n\t{\r\n\t\tshow_it(field,alerttxt)\r\n\t\treturn false;\r\n\t}\r\n}", "function emailValidate(str){return /\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b/i.test(str/*email*/)} //@return{boolean} True if str is valid email address //@param{string} str The string to be tested // Should be copy/pasted to client-side JS // function test(){var ar=[\"random@example\",\"random@example.com\",\"randomexample.com\"],i=ar.length,out=[];while(i--){out.push(emailValidate(ar[i]))}Logger.log(out)} // Sample call: if(!LibraryjsUtil.emailValidate(email)){alert(\"Enter valid email address.\");return} // References: http://www.regular-expressions.info/email.html | http://www.regexmagic.com/patterns.html // Note: Since this function is usually called client-side, we might want to copy/paste; a sample call might resemble this: if(!/\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b/i.test(email)){alert(\"Enter valid email address.\");return}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return (/[^@]+@[^@]+/.test(s)\n );\n}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return (/[^@]+@[^@]+/.test(s)\n );\n}", "isEmail(value) {\n return new RegExp(\"^\\\\S+@\\\\S+[\\\\.][0-9a-z]+$\").test(\n String(value).toLowerCase()\n );\n }", "function isEmailValid(email) {\r\n // var expr = /^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$/;\r\n var expr = /^([a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+(\\.[a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+)*|\"((([ \\t]*\\r\\n)?[ \\t]+)?([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*(([ \\t]*\\r\\n)?[ \\t]+)?\")@(([a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|[a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF][a-z\\d\\-._~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]*[a-z\\d\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])\\.)+([a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|[a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF][a-z\\d\\-._~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]*[a-z\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])\\.?$/i;\r\n return expr.test(email);\r\n}", "function isEmail(e){\r\n var atSymbol = e.indexOf(\"@\");\r\n if(atSymbol<1) return true;\r\n var dot =e.lastIndexOf(\".\");\r\n if(dot<=atSymbol+2) return true;\r\n if(dot=== e.length-1) return true;\r\n \r\n return false;\r\n}", "function email(){\n var emailReg =/[a-z].*(@)[a-z]*(.)[a-z]{2,}$/;\n var validEmail = document.getElementById('email').value;\n if (emailReg.test(validEmail) === false)\n {\n throw \"invalid email address\";\n }\n }", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return /[^@]+@[^@]+/.test(s);\n}", "function emailValidation()\n {\n let re = /\\S+@\\S+\\.\\S+/;\n if (re.test(emailText)==false)\n {\n setErrorEmail(\"אנא הזן אימייל תקין\");\n setValidEmail(false);\n }\n else\n {\n setErrorEmail(\"\");\n setValidEmail(true);\n } \n }", "function validate_Email(sender_email) {\n var expression = /^[\\w\\-\\.\\+]+\\@[a-zA-Z0-9\\.\\-]+\\.[a-zA-z0-9]{2,4}$/;\n if (expression.test(sender_email)) {\n return true;\n }\n else {\n return false;\n }\n }", "function validate_Email(sender_email) {\n var expression = /^[\\w\\-\\.\\+]+\\@[a-zA-Z0-9\\.\\-]+\\.[a-zA-z0-9]{2,4}$/;\n if (expression.test(sender_email)) {\n return true;\n }\n else {\n return false;\n }\n }", "function isValidEmailAddress(emailAddress) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(emailAddress);\n }", "function isValidEmailAddress(emailAddress) {\r\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\r\n return pattern.test(emailAddress);\r\n }", "function validate_email_format(email){\n /// Returns true if email is valid, false otherwise ///\n var re = /^\\w+([-+.'][^\\s]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/;\n return re.test(email)\n}", "function emailValidation(email){\n const regEx = /\\S+@\\S+\\.\\S+/;\n const patternMatch = regEx.test(email);\n return patternMatch;\n}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return (/[^@]+@[^@]+/).test(s);\n}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return (/[^@]+@[^@]+/).test(s);\n}", "function email_regex(email) {\n\tvar regex = /^([a-zA-Z0-9_.+-])+\\@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n\treturn regex.test(email);\n}", "function validateEmail(email) \r\n{\r\n var re = /\\S+@\\S+\\.\\S+/;\r\n return re.test(email);\r\n}", "function isEmailAddress( text ) {\nvar email = EMAIL_ADDRESS_PATTERN;\nreturn email.test( text );\n}", "function check_mail(mail_str){\r\n var reyx=/^([a-zA-Z0-9_\\.-])+@([a-zA-Z0-9_\\.-])+\\.([a-zA-Z0-9_-])+/;\r\n if(! reyx.exec(mail_str)) return false;\r\n return true;\r\n}", "function isValidEmail(emailAddress) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(emailAddress);\n }", "function validEmail(str){ \n\tvar filter= new RegExp(/^.+@.+\\..{2,3}$/);\n\tif (!filter.test(str)){\n\t\treturn false;\n\t}\n\treturn true;\n}", "function validateEmailFormat()\n{\n var status;\n var x = $(\"#email\").val();\n var atpos = x.indexOf(\"@\");\n var dotpos = x.lastIndexOf(\".\");\n if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length)\n {\n status = \"invalid\";\n }\n return status;\n}", "function checkMail(email)\n{\n var str1=email;\n var arr=str1.split('@');\n var eFlag=true;\n if(arr.length != 2)\n {\n eFlag = false;\n }\n else if(arr[0].length <= 0 || arr[0].indexOf(' ') != -1 || arr[0].indexOf(\"'\") != -1 || arr[0].indexOf('\"') != -1 || arr[1].indexOf('.') == -1)\n {\n eFlag = false;\n }\n else\n {\n var dot=arr[1].split('.');\n if(dot.length < 2)\n {\n eFlag = false;\n }\n else\n {\n if(dot[0].length <= 0 || dot[0].indexOf(' ') != -1 || dot[0].indexOf('\"') != -1 || dot[0].indexOf(\"'\") != -1)\n {\n eFlag = false;\n }\n\n for(i=1;i < dot.length;i++)\n {\n if(dot[i].length <= 0 || dot[i].indexOf(' ') != -1 || dot[i].indexOf('\"') != -1 || dot[i].indexOf(\"'\") != -1 || dot[i].length > 4)\n {\n eFlag = false;\n }\n }\n }\n }\n return eFlag;\n}", "function checkMail(email)\n{\n var str1=email;\n var arr=str1.split('@');\n var eFlag=true;\n if(arr.length != 2)\n {\n eFlag = false;\n }\n else if(arr[0].length <= 0 || arr[0].indexOf(' ') != -1 || arr[0].indexOf(\"'\") != -1 || arr[0].indexOf('\"') != -1 || arr[1].indexOf('.') == -1)\n {\n eFlag = false;\n }\n else\n {\n var dot=arr[1].split('.');\n if(dot.length < 2)\n {\n eFlag = false;\n }\n else\n {\n if(dot[0].length <= 0 || dot[0].indexOf(' ') != -1 || dot[0].indexOf('\"') != -1 || dot[0].indexOf(\"'\") != -1)\n {\n eFlag = false;\n }\n\n for(i=1;i < dot.length;i++)\n {\n if(dot[i].length <= 0 || dot[i].indexOf(' ') != -1 || dot[i].indexOf('\"') != -1 || dot[i].indexOf(\"'\") != -1 || dot[i].length > 4)\n {\n eFlag = false;\n }\n }\n }\n }\n return eFlag;\n}", "function validEmailFormat(email) { \n var re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(email);\n}", "function checkmail(){\r\n\tif((/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(email.val())))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function validateEmail(mail) \n { \n if (/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(mail)) \n { \n return (true);\n } \n return (false); \n}", "function validEmail(email){\r\n // const re = /\\S+@\\S+\\.\\S+/; \r\n //const re2= /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,1}))$/;\r\n\r\n\r\n return re2.test(string(email).toLowerCase());\r\n}", "function checkemail(str) {\n\tvar filter =/^\\w+[\\+\\.\\w-]*@([\\w-]+\\.)*\\w+[\\w-]*\\.([a-z]{2,7}|\\d+)$/i;\n\treturn (filter.test(str))\n}", "function isEmail(email){ \n return (/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(email))\n }", "checkEmail(value) {\n\t\tif (value.includes('@') && value.includes('.') && !value.includes(' ')) {\n\t\t\treturn '';\n\t\t} else {\n\t\t\treturn 'Invalid email address'\n\t\t}\n\t}", "function isValidEmail(str) {\nif(str.indexOf(\"@\")==-1 || str.indexOf(\".\")==-1) return false;\nif(str.indexOf(\"@\")!=str.lastIndexOf(\"@\")) return false;\nvar strDeny='()<>@\\\\,;:\"[] ';\nvar strLeft=str.substring(0,str.indexOf (\"@\"));\nfor(var i=0;i<strLeft.length;i++) {\nif(strDeny.indexOf(strLeft.charAt(i))>-1) return false;\n}\nvar strRight=str.substring(str.indexOf(\"@\")+1);\nfor(var i=0;i<strRight.length;i++)\nif(\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-.\".indexOf(strRight.charAt(i))==-1) return false;\nif(strRight.indexOf(\".\")==0 || strRight.indexOf(\"-\")==0) return false;\nif(strRight.indexOf(\"-.\")>-1 || strRight.indexOf(\".-\")>-1) return false;\nif(strRight.lastIndexOf(\".\")==strRight.length-1) return false;\nif(strRight.lastIndexOf(\"-\")==strRight.length-1) return false;\nreturn true;\n}", "function isValidEmailAddress(emailAddress) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(emailAddress);\n }", "function validateEmail(){\n\tvar re = /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$/i;\n var result = re.test($.txtfieldMail.value);\n if(result == 0){\n \t$.txtfieldMail.value = \"\";\n \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidmail,function(){});\n }\n}", "function isValidEmailAddress(emailAddress) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(emailAddress);\n}", "function isEmail(text) {\n\n var words = text.toLowerCase();\n var urlRegex = /(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))/;\n var match;\n\n if(match = urlRegex.exec(words)) {\n return true;\n }\n return false;\n}", "function validEmail(value) {\n const addy = /\\S+@\\S+\\.\\S+/;\n if (value.match(addy)) return true;\n else return \"Please enter a valid email address.\";\n}", "function validarEmail(txtMail) {\n patron = /^(([^<>()[\\]\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/;\n return patron.test(txtMail);\n}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return typeof s === 'string' && s.indexOf('@') !== -1;\n}", "function isValidEmailAddress(emailAddress) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(emailAddress);\n}", "function isEmailAddressValid(str) {\n\n var pattern = /^[a-zA-Z_\\.0-9]+@[a-zA-Z_]+?\\.[a-zA-Z\\.]{2,10}$/;\n return str.match(pattern); \n}", "function validEMail(addr){\r\n\tvar filter = /^([\\d\\w\\.\\-\\+])+\\@(([\\d\\w\\-\\+])+\\.)+([a-zA-Z]{2,})$/;\r\n\treturn (filter.test(addr));\r\n}", "function validateEmail(mail)\n{\n if(/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(mail)){ return true; }\n\treturn false;\n}", "function emailIsValid(email) {\n return /\\S+@\\S+\\.\\S+/.test(email);\n }", "function isValidEmailAddress(emailAddress) {\n var pattern = new RegExp(/^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i);\n return pattern.test(emailAddress);\n }", "function emailFormatCheck(input) {\r\n var i = 0;\r\n do {\r\n if (i === input.length) {\r\n return false;\r\n }\r\n i++;\r\n } while (input.charAt(i) != '@');\r\n do {\r\n i++;\r\n if (i === input.length) {\r\n return false;\r\n }\r\n } while (input.charAt(i) != '.');\r\n return true;\r\n}", "function validateEmail(email) {\n\tconst regEX = /\\S+@\\S+\\.\\S+/;\n\tconst patternMatches = regEX.test(email);\n\treturn patternMatches;\n}", "function emailFormatter(email){\n\tvar format = /^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(\\.\\w{2,3})+$/.test(email);\n\tif (format){\n\t\treturn email;\n\t}\n}", "function validateEmail(anEmail) {\n var mailFormat = /^\\W+([\\.-]?\\W+)*@\\W+([\\.-]?\\W+)*(\\.\\W{2,3})+$/;\n if (anEmail.value.match(mailFormat)) {\n return true;\n } else {\n alert(\"The email format is wrong\");\n anEmail.style.border = \"2px solid red\";\n anEmail.focus();\n return false;\n }\n }", "function validateEmail(email)\r\n{\r\n var re = /\\S+@\\S+\\.\\S+/;\r\n return re.test(email);\r\n}", "function validarEmail(email) {\n var expr = /^\\w+([\\.+-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n\n if(email.search(expr) == -1) {\n return false;\n }\n\n return true;\n}", "function emailValidate(str) {\n\n return (str.indexOf(\".\") > 2) && (str.indexOf(\"@\") > 0);\n \n\n\n}", "function validEmail(thisEmail){\n var isMatch = thisEmail.match(/^[a-z0-9\\_\\.]+(@)[a-z0-9\\-]+\\.[a-z]{2,3}$/)\n if(isMatch){\n return true;\n }else{\n return false;\n }\n}", "function isValidEmail(str) \r\n{\r\n emailRe = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?(\\w)+)*\\.(\\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/\r\n if (!emailRe.test(str))\t{\r\n\t return false\n } else {\r\n\t return true\n }\r\n}", "function isValidEMail(str)\r\n{\r\n\tvar emailReg = /^([\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4})?$/;\r\n\t\r\n\tif(!emailReg.test(str)) {\r\n\t\treturn false;\r\n\t\t}\r\n\t\r\n\treturn true;\r\n}", "function comprobar_mail(email){\n\tvar filter=/^[A-Za-z0-9][A-Za-z0-9_\\.]*@[A-Za-z0-9_]+.[A-Za-z0-9_.]+[A-za-z]$/;\n\tvar aux = filter.test(email);\n\tif(aux == true)\n\t\treturn false;\n\treturn true;\n}", "function is_email(email){ \r\n var emailReg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/;\r\n return emailReg.test(email); }", "function validateEmail(email)\n{\n var splitted = email.match(\"^(.+)@(.+)$\");\n if (splitted == null) return false;\n if (splitted[1] != null)\n {\n var regexp_user = /^\\\"?[\\w-_\\.]*\\\"?$/;\n if (splitted[1].match(regexp_user) == null) return false;\n }\n if (splitted[2] != null)\n {\n var regexp_domain = /^[\\w-\\.]*\\.[A-Za-z]{2,4}$/;\n if (splitted[2].match(regexp_domain) == null)\n {\n var regexp_ip = /^\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\]$/;\n if (splitted[2].match(regexp_ip) == null) return false;\n } // if\n return true;\n }\n return false;\n}", "function isValidEmail(email) {\n\n var emailReg = new RegExp(/^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i);\n var valid = emailReg.test(email);\n\n if (!valid) {\n return false;\n } else {\n return true;\n }\n\n}", "function validateEmail() {\r\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n return re.test(email.val());\r\n}", "function ValidateEmail(email)\n{\n var re = /\\S+@\\S+\\.\\S+/;\n return re.test(email);\n}", "isEmailValid(email){\n \n // Long and scary RegExp. Didn't come up with it, found in the net\n // Seems to work!\n let regExpEmail = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n \n if(email.match(regExpEmail)){\n return true;\n } else {\n return false;\n };\n \n }", "function validarEmail() {\n // usaremos una expresion regular para que el mail cumpla un patron\n // \\S+ que comience con una secuencia de caracteres\n // seguido de una @exp\n // para terminar dos secuencias de caracteres con un punto entre ellas: \\S+\\.\\S+\n var exp = /\\S+@\\S+\\.\\S+/g;\n if (!exp.test(document.getElementById(\"email\").value)){\n document.getElementById(\"email\").value = \"error!\";\n document.getElementById(\"email\").focus();\n document.getElementById(\"email\").className=\"error\";\n document.getElementById(\"errores\").innerHTML = \"Error en el mail, formato no correcto.\";\n return false;\n }\n else {\n document.getElementById(\"email\").className=\"\";\n document.getElementById(\"errores\").innerHTML = \"\";\n return true;\n }\n}", "function validateEmail(sEmail) {\n //bsef14a011@pucit.edu.pk\n return /[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+/.test(sEmail);\n //return /[a-z]+@[a-z]+\\.[a-z]+/.test(sEmail);\n}", "function checkEmailFormat(email) {\n const regEx = /\\S+@\\S+\\.\\S+/;\n const emailFormat = regEx.test(email);\n return emailFormat;\n}", "function validateEmail(mail)\n{\n var filter = /^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$/;\n if(filter.test(mail))\n {\n return true;\n }\n else{\n return false;\n }\n}", "handleEmailCheck(email){\n return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/.test(email)\n }", "function regexValidateEmail($email) {\r\n var emailReg = /^([\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4})?$/;\r\n return emailReg.test($email);\r\n }", "function IsEmail(email){\nreturn /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(email);\n}", "function checkE(email) {\r\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n return re.test(String(email).toLowerCase());\r\n}", "function emailVerification(myForm) {\r\n\tre = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/\r\n\tif (re.test(myForm.emailAddr.value)) {\r\n\t\tdocument.getElementById(\"email\").innerHTML= \"Thanks \"+myForm.emailAddr.value;\t\r\n\t}\r\n\telse{\r\n\t\talert(\"Invalid email address\")\r\n\t}\r\n}", "function isEmail (s)\r\n{ \r\n\tre5 = /^([_a-z0-9-']+)(\\.[_a-z0-9-']+)*@([a-z0-9-]+)(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})$/i;\r\n\treturn re5.test(s);\r\n}", "function validateEmail(email) \n{\n var pattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,6}$/;\n if(email.match(pattern))\n {\n return true;\n }\n return false;\n}", "function isEmail(str){\n var reg = /^([\\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\\.[a-zA-Z0-9_-]{2,3}){1,2})$/;\n return reg.test(str);\n}", "function checkemail(str){\n\tvar testresults = false;\n\tvar filter=/^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$/i;\n\t\tif (filter.test(str)){\n\t\t\ttestresults=true;\n\t\t}\n\treturn (testresults);\n}", "function simpleEmailValidation(emailAddress) {\n\n}" ]
[ "0.7514335", "0.7440035", "0.7354689", "0.73307407", "0.732569", "0.7324078", "0.7309591", "0.7285584", "0.72843444", "0.72276485", "0.7226466", "0.7184625", "0.71750504", "0.71750504", "0.71682286", "0.7148892", "0.71475875", "0.7121435", "0.71166396", "0.70960945", "0.7085415", "0.7082746", "0.7077516", "0.7077188", "0.70659393", "0.70659393", "0.705534", "0.70516276", "0.7047889", "0.70428187", "0.70319915", "0.7009807", "0.70070505", "0.70070505", "0.70026416", "0.70013183", "0.699907", "0.6992154", "0.6990284", "0.6990284", "0.6984321", "0.6973524", "0.6973413", "0.6971603", "0.69636905", "0.6962397", "0.69575167", "0.69557333", "0.69557333", "0.69534713", "0.69522434", "0.6942366", "0.69382757", "0.6934828", "0.69310474", "0.6926813", "0.6918351", "0.69122154", "0.69045067", "0.6897668", "0.68917924", "0.68837166", "0.6879883", "0.6859484", "0.6858276", "0.6857991", "0.6853976", "0.6840521", "0.68387204", "0.6834775", "0.6830298", "0.68275255", "0.6825432", "0.6824165", "0.68232125", "0.68226707", "0.6810358", "0.68072826", "0.67976695", "0.6797066", "0.67839694", "0.6782895", "0.677877", "0.67752594", "0.6773236", "0.6770284", "0.6768234", "0.6764021", "0.6761454", "0.6760863", "0.6751476", "0.67501295", "0.6749358", "0.6746546", "0.6744391", "0.67441684", "0.67410576", "0.6739507", "0.6738798", "0.6736868", "0.67304426" ]
0.0
-1
"estamos con la bola encima, podemos soltar"
function allowDrop(ev) { // Este ccódigo evita el comportamiento por defecto de este evento ev.preventDefault(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ispisCene(){\n \n let ispisCena=racunajCenu(findDestPrice(dest),brOsoba);\n document.querySelector(\"#cena\").innerHTML = `${ispisCena}&euro;`;\n }", "jubilar() {\n let jubilacion = this.edad >= 45 ? true : false;\n\n return (\"\" + jubilacion);\n }", "function main(){\r\n\r\n const letra;\r\n console.log('Digite aqui uma letra do nosso alfabeto alfanumérico português: ', letra)\r\n\r\n if (letra === 'a' || letra === 'e' || letra === 'i' || letra === 'o' || letra === 'u' || letra === 'A' || letra === 'E' || letra === 'I' || letra === 'O' || letra === 'U') {\r\n console.log('É vogal / n')\r\n }else {\r\n console.log('É consoante / n')\r\n }\r\n\r\n}", "function dizerOla(nome) {\n console.log('Olá ' + nome);\n console.log(\"Ol\\u00E1 \" + nome); //interpolarização\n}", "static bienvenida(){\n\t \treturn `Bienvenido al cajero`;\n\t }", "function info(cadena) {\n\n var resultado = \"La cadena \\\"\"+cadena+\"\\\" \";\n \n // Comprobar mayúsculas y minúsculas\n if(cadena == cadena.toUpperCase()) {\n resultado += \" está formada sólo por mayúsculas\";\n }\n else if(cadena == cadena.toLowerCase()) {\n resultado += \" está formada sólo por minúsculas\";\n }\n else {\n resultado += \" está formada por mayúsculas y minúsculas\";\n }\n \n return resultado;\n }", "mostrar() {\n return `${this.nombre} tiene una urgencia de ${this.prioridad}`;\n }", "function comprovarPregunta () {\r\n this.capa.innerHTML=\"\";\r\n if (this.actual.toUpperCase() != this.correcte.toUpperCase()) {\r\n this.putImg(\"imatges/error.gif\")\r\n this.putSound(this.soMal);\r\n this.actual = \"\";\r\n }\r\n else\r\n {\r\n this.validate=1;\r\n this.putImg(this.dirImg + this.paraules[this.wordActual].imatge)\r\n this.putSound(this.paraules[this.wordActual].so);\r\n this.capa.innerHTML += \"<br>\" + this.paraules[this.wordActual].paraula.toUpperCase();\r\n this.actual = \"\";\r\n }\r\n}", "function fazerSuco(fruta1, fruta2){\n return 'suco de: ' + fruta1+fruta2\n}", "function saludo4(mensaje){\n return `Hola buen dia 3 ${mensaje}`;\n }", "static bienvenida() {\n return `Bienvenido a la entrevista`\n }", "function comprobarCadena(cadena){\n\n const blanco = '\\u25cf';\n var aceptada = false;\n // Se establecen 3 estados de parado\n // 0: No parado\n // 1: parado por no encontrar más transiciones\n // 2: Parado por sobrepasar el tiempo máximo de ejecución\n var parado = 0;\n var estadoActual = 'q0';\n var log = ''; //String donde guarda los pasos seguidos durante la comprobación\n var paso = 1;\n\n //convertimos el string cadena en un array de strings\n var cinta = cadena.split(\"\");\n var posCinta = 0;\n var tiempoInicial = new Date().getTime();\n var tiempoTrans = 0;\n const maxTiempo = 6000;\n\n while (parado == 0){ // Mientras no se haya parado la MT\n //lee un simbolo de la cinta\n var carLeido = cinta[posCinta];\n log += '<b>Paso '+ paso +':<br></b>';\n log += 'Lee ' + carLeido +'<br>';\n\n //Buscamos que exista una transicion para el estado con el simbolo de entrada leído\n var idTrans = estadoActual + carLeido;\n var trans = transiciones[idTrans];\n if(trans == undefined ) { //Lista de transiciones que coincide no encontrada\n parado = 1;\n log += 'Transición no encontrada. MT parada.<br>';\n }else{\n var direccion = trans.direccion;\n var nuevoSimb = trans.simbSalida;\n estadoActual = trans.estadoDestino;\n log += 'Transita a estado '+estadoActual+'.<br>';\n cinta[posCinta] = nuevoSimb;\n log += 'Escribimos '+nuevoSimb+'';\n\n if(direccion == 'R') { //avanzamos hacia la dcha de la cinta\n log += ' y avanza hacia la derecha.<br>';\n if(posCinta+1 == cinta.length) { //si la nueva posicion en la cinta supera a su longitud original\n if(cinta.length == 1 && cinta[0] === blanco) {\n log += 'Cinta vacía.<br>';\n }else{\n cinta.push(blanco);\n posCinta++;\n }\n }else if(posCinta == 0){ // Si estamos al inicio de la cinta\n if(nuevoSimb == blanco) {\n cinta.shift();\n log += 'Se borra espacio del principio.<br>';\n }else{\n posCinta++;\n }\n }else{\n posCinta++;\n }\n }else if(direccion == 'L'){ //si retrocede a la izquierda\n log += ' y avanza hacia la izquierda.<br>';\n if(posCinta == 0){ //si estamos de en el inicio de la cinta\n if(cinta.length == 1 && cinta[0] === blanco) {\n log += 'Cinta vacía.<br>';\n } else {\n cinta.unshift(blanco);\n posCinta = 0;\n }\n }else if(posCinta+1 == cinta.length){ //Si avanza hacia la izquierda y estamos en la última posición de la cinta\n if(cinta[posCinta] == blanco) {\n cinta.pop(); //Si es un blanco, se borra\n log += \"Se borra espacio del final.<br>\";\n posCinta--;\n }else{\n posCinta--;\n }\n }else{\n posCinta--;\n }\n } else {\n log += ' y no avanza en la cinta.<br>';\n }\n log += 'Estado de la cinta: '+ cinta + '.<br>';\n log += 'Actual posición del cabezal: '+posCinta +'.<br><br>';\n\n tiempoTrans = (new Date().getTime()) - tiempoInicial;\n if (tiempoTrans > maxTiempo) {\n parado = 2;\n log = \"Ha transcurrido el tiempo máximo de ejecución (\"+ maxTiempo +\"ms) de la MT.<br> Por favor, revisa las transiciones de la MT.<br>\";\n }\n paso++;\n }\n }\n\n // Si ha parado y no sido por sobrepasar el maxTiempo\n if (parado == 1) {\n var estadoFinal = $.grep(estados, function(n){\n return n.nombre == estadoActual;\n });\n\n if(estadoFinal[0].esFinal){\n aceptada = true;\n log += 'Último estado es final. MT aceptada.';\n }\n\n var tipo = 'reconocedor';\n\n // Comprobamos si es un MT reconocedor o transductor\n if($('#switchMT').is(':checked')){\n tipo = 'transductor';\n }\n\n if(tipo == 'transductor'){\n // Agregamos lo que queda de la cinta en el estado final y la leemos desde la cabecera\n if(posCinta!=0){\n log+='<br>Aviso: la lectura de la cinta no empieza en la posición inicial.<br>';\n }\n aceptada = '';\n for(var i=posCinta; i < cinta.length; i++) {\n aceptada+=cinta[i];\n }\n }\n }\n\n // Borra y escribe los datos del registro de pasos\n $('.log').empty().html(log);\n\n return aceptada;\n }", "function ZZcompoEM(Monstre) {\r\n var compo=\"\";\r\n\tfor (var i=0; i<tabEM.length; i++) {\r\n\t \tif (tabEM[i][0].toLowerCase()==Monstre.toLowerCase()) {\r\n\t \t if (tabEM[i][4]==1)\r\n\t\t\t compo=\"<IMG SRC='\"+SkinZZ+\"smallEM_variable.gif'> Divers composants <b>\"+tabEM[i][1]+\" \"+tabEM[i][0]+\" </b>(\"+tabEM[i][2]+\")\";\r\n \t\t else\r\n\t\t\t compo=\"<IMG SRC='\"+SkinZZ+\"smallEM_fixe.gif'> <b>\"+tabEM[i][1]+\" \"+tabEM[i][0]+\"</b> (Qualité \"+tabQualite[tabEM[i][3]]+\") pour l'écriture de <b>\"+tabEM[i][2]+\"</b>\";\r\n\t\t}\r\n\t}\r\n\treturn compo; \r\n}", "static bienvenida(){\n return `Bienvenido al cajero`;\n }", "static bienvenida(){\n return `Bienvenido al cajero`;\n }", "function comprarYeso(){\r\n if(Tamagotchi.puntos>=10){\r\n textoConsola.textContent+= \"\\r\\n\"\r\n textoConsola.textContent+= \"Compraste un yeso y sanaste a \" + Tamagotchi.nombre;\r\n cantidadLineas++\r\n Tamagotchi.puntos-=10;\r\n Tamagotchi.lesionado=false;\r\n }else{\r\n textoConsola.textContent+= \"\\r\\n\"\r\n textoConsola.textContent+= \"No tenes suficientes puntos\";\r\n cantidadLineas++\r\n }\r\n}", "function convertirJugada(jugadaJSCodigo){\nlet jugada = \"\";\n\n if(jugadaJSCodigo === 1 )\n jugada = \"PIEDRA\";\n else if(jugadaJSCodigo === 2)\n jugada = \"PAPEL\";\n else if (jugadaJSCodigo === 3)\n jugada = \"TIJERA\";\n\n return jugada;\n}", "function watAlsErEenMuisIs(){\n console.log('spring zo snel mogelijk op de tafel');\n}", "function ejercicio02(email){\nvar longitud = email.length;\nvar mayusc = email.toUpperCase();\ncont = 0;\nvar no = \"\";\n\nfor (i=0 ; i<=longitud ; i++)\n{ \n if(email.charAt(i) == \"m\" || email.charAt(i) == \"M\")\n {\n cont++;\n }\n}\nif (cont == 0)\n{\n cont = toString(cont)\n cont = \"ninguna\";\n no = \"no\";\n}\nreturn \"El correo\" + email + \"tiene\" + longitud + \"caracteres y en mayúsculas se quedaría así\" + mayusc + \". Además \" + no + \" contiene \" + cont + \" letras M\";\n\n}", "function comprovarCopia () {\r\n this.capa.innerHTML=\"\";\r\n if (this.actual.toLowerCase()!=this.correcte.toLowerCase())\r\n {\r\n this.putImg(\"imatges/error.gif\");\r\n this.putSound(this.soMal);\r\n this.actual = \"\";\r\n }\r\n else\r\n {\r\n this.putImg(this.dirImg + this.paraules[this.wordActual].imatge)\r\n this.putSound(this.paraules[this.wordActual].so);\r\n this.capa.innerHTML += \"<br>\" + this.actual;\r\n this.actual = \"\";\r\n this.validate=1;\r\n }\r\n}", "function auxLetras(promedio) {\n let simbolo;\n\n if (promedio > 0 && promedio <= 15)\n simbolo = 'M';\n else if (promedio >= 16 && promedio <= 31)\n simbolo = 'N';\n else if (promedio >= 32 && promedio <= 47)\n simbolo = 'H';\n else if (promedio >= 48 && promedio <= 63)\n simbolo = '#';\n else if (promedio >= 64 && promedio <= 79)\n simbolo = 'Q';\n else if (promedio >= 80 && promedio <= 95)\n simbolo = 'U';\n else if (promedio >= 96 && promedio <= 111)\n simbolo = 'A';\n else if (promedio >= 112 && promedio <= 127)\n simbolo = 'D';\n else if (promedio >= 128 && promedio <= 143)\n simbolo = '0';\n else if (promedio >= 144 && promedio <= 159)\n simbolo = 'Y';\n else if (promedio >= 160 && promedio <= 175)\n simbolo = '2';\n else if (promedio >= 176 && promedio <= 191)\n simbolo = '$';\n else if (promedio >= 192 && promedio <= 209)\n simbolo = '%';\n else if (promedio >= 210 && promedio <= 225)\n simbolo = '+';\n else if (promedio >= 226 && promedio <= 239)\n simbolo = '.';\n else if (promedio >= 240 && rgbPromedio <= 255)\n simbolo = ' ';\n return simbolo;\n\n}", "static bienvenida(){\n return `Bienvenido al cajero para Empresas`;\n }", "static bienvenida(){\n return `Bienvenido al cajero para Empresas`;\n }", "esconder(){\n console.log(`${this._nombre} corre a ${this._velocidad}m/s y da un salto de ${this._salto}m y se esconde`)\n }", "function saludar3(nombre) {\r\n return `hola ${nombre}`;\r\n}", "function activar_batiseñal() {\n return \"activada\";\n}", "static bienvenida(){\n\t\treturn 'Hola Bienvenido Empresa';\n\t}", "function letra(tecla) {\n //alert(tecla);\n var ltPCode;\n var acertouAq; // pesquisar se true letras que acertou\n var errouAq; // pesquisar letras que errou\n\n key = tecla;\n lt = String.fromCharCode(key).toLowerCase();\n ltPCode = lt.charCodeAt(0);\n\n acertouAq = acertou.indexOf(lt);\n errouAq = errou.indexOf(lt);\n\n if(key == 186){\n alert('Clique C ou outra consoante!');\n }else if(ltPCode == 97 || ltPCode == 98 || ltPCode == 99 || ltPCode == 100 || ltPCode == 101 || ltPCode == 102 || ltPCode == 103 || ltPCode == 104 || ltPCode == 105 ||\n ltPCode == 106 || ltPCode == 107 || ltPCode == 108 || ltPCode == 109 || ltPCode == 110 || ltPCode == 111 || ltPCode == 112 || ltPCode == 113 || ltPCode == 114 ||\n ltPCode == 115 || ltPCode == 116 || ltPCode == 117 || ltPCode == 118 || ltPCode == 119 || ltPCode == 120 || ltPCode == 121 || ltPCode == 122){\n\n if(acertou.length >= obj.length || imgAtual >= 6){\n\n }else if(perdeu == true) {\n\n }else if(acertouAq >= 0 || errouAq >= 0){\n alert('Você já tinha digitado a tecla \\\"'+lt+'\\\"');\n }else{\n ltPre = limpaLetra(lt);\n verLetra(ltPre);\n }\n\n }\n}", "function halo() {\n return '\"Halo Sanbers!\"';\n}", "function quitaEspacios(mensaje){\n mensaje = mensaje.toUpperCase();//hacemos que nuestra frase solo este en mayusculas\n let mensajeSinESpacio = \"\";\n for (letra of mensaje){//recorremos todo nuestro string\n if (letra !== \" \") {//si el caracter en esa iteracion no es un espacio en blanco \n mensajeSinESpacio = mensajeSinESpacio + letra;//se agrega a nuestra variable mensajeSinEspacio\n }\n }\n\n return mensajeSinESpacio;//REGRESA LA ORACION SIN ESPACIOS\n}", "static bienvenida() {\n return `Bienvenido al cajero`\n }", "function comprueba(letra){\n document.getElementById(letra).setAttribute(\"style\",\"visibility: hidden;\");\n var letraAcertada=false;\n for (var i = 0; i < secreta.length; i++) {\n if (letra==secreta.charAt(i)) {\n letraAcertada=true;\n muestra = muestra.substring(0, i) + secreta.charAt(i) + muestra.substring(i+1, muestra.length);\n document.getElementById(\"secreta\").innerHTML=muestra;\n }\n }\n if (!letraAcertada) {\n intentos--;\n }\n dibujaMuerto();\n finalizaPartida();\n}", "function faltaVisitar(paisesVisitados){\n var totalPaises = 193;\n return `Faltam visitar ${totalPaises - paisesVisitados} paises`;\n\n\n}", "resumen_estado_nave(){\n this.ajuste_potencia();\n if (typeof this._potencia_disponible !== \"undefined\"){\n if (this._potencia_disponible){\n let estado_plasma = \"\";\n for (let i = 0; i < this._injectores.length; i++) {\n estado_plasma += \"Plasma \"+i.toString()+\": \";\n let total = this._injectores[i].get_plasma+this._injectores[i].get_extra_plasma;\n estado_plasma += total+\"mg/s \";\n }\n console.log(estado_plasma);\n\n for (let i = 0; i < this._injectores.length; i++) {\n if (this._injectores[i].get_danio_por<100){\n if (this._injectores[i].get_extra_plasma>0){\n console.log(\"Tiempo de vida: \"+this._injectores[i].tiempo_vuelo().toString()+\" minutos.\");\n } else {\n console.log(\"Tiempo de vida infinito!\");\n break;\n }\n }\n }\n } else {\n console.log(\"Unable to comply.\")\n console.log(\"Tiempo de vida 0 minutos.\")\n }\n } else {\n throw \"_potencia_disponible: NO DEFINIDA\";\n }\n }", "function comprobarLexema(codigo) {\n if (codigo == 86 || codigo == 69 || codigo == 68 || codigo == 79 || codigo == 82 || codigo == 65) {\n return (\"verdadero\");\n } else if (codigo == 118 || codigo == 97 || codigo == 114 || codigo == 105 || codigo == 98 || codigo == 108 || codigo == 101) {\n return (\"variable\");\n\n } else if (codigo == 70 || codigo == 65 || codigo == 76 || codigo == 79 || codigo == 83) {\n return (\"falso\");\n }\n else if ((codigo >= 97 && codigo <= 122) || (codigo >= 65 && codigo <= 69) || (codigo >= 71 && codigo <= 90)) {\n return (\"letra\");\n } else if (codigo >= 48 && codigo <= 57) {\n return (\"digito\");\n } else if (codigo == 58 || codigo == 59 || codigo == 44 || codigo == 46) {//codigo 46 es el punto .\n return (\"Puntuacion\");\n\n } else if (codigo == 37 || codigo == 42 || codigo == 43 || codigo == 45 || codigo == 47 || codigo == 60 || codigo == 61 || codigo == 62) {\n return (\"Aritmeticos\");\n } else if (codigo == 40 || codigo == 41 || codigo == 91 || codigo == 93 || codigo == 123 || codigo == 125) {\n return (\"agrupacion\");\n } else if (codigo == 34 || codigo == 59) {\n return (\"Signo\");\n }\n else if (codigo == 65 || codigo == 70 || codigo == 76 || codigo == 79 || codigo == 83) {\n return (\"falso\");\n }\n\n}", "function escoltaPregunta ()\r\n{\r\n if(this.validate) {\r\n this.capa.innerHTML=\"\";\r\n this.putImg (this.dirImg+\"/\"+this.paraules[index].imatge);\r\n this.capa.innerHTML+=\"<br>\"+this.paraules[index].paraula.toUpperCase();\r\n this.putSound (this.paraules[index].so);\r\n }\r\n else {\r\n this.capa.innerHTML = \"\"\r\n this.putImg (this.dirImg+\"/\"+this.paraules[index].imatge);\r\n this.putSound (this.paraules[index].so);\r\n this.capa.innerHTML += \"<br>\" + this.actual+this.putCursor ('black');\r\n }\r\n}", "function kaliTerusRekursif(angka) {\r\n // you can only write your code here!\r\n let angkaString = angka.toString();\r\n let hasil = kaliRekursif(angka);\r\n let hasilString = hasil.toString();\r\n if(hasilString.length > 1){\r\n hasil = kaliTerusRekursif(hasil);\r\n }\r\n return hasil;\r\n \r\n}", "function escoltaDictat () {\r\n this.capa.innerHTML=\"\";\r\n if(!this.validate) {\r\n this.putSound (this.paraules[this.wordActual].so);\r\n this.capa.innerHTML += this.actual+this.putCursor ('black');\r\n }\r\n else {\r\n this.putSound(this.paraules[this.wordActual].so);\r\n this.putImg(this.dirImg + this.paraules[this.wordActual].imatge);\r\n this.capa.innerHTML += \"<br>\" + this.paraules[this.wordActual].paraula.toUpperCase();\r\n this.actual = \"\";\r\n }\r\n}", "function textoQuatro() {\n var texto = document.getElementById(\"texto_explicacao\");\n texto.innerHTML = '<b> In&eacute;rcia: </b> é a propriedade que os objetos têm de opor resitência à acelara&ccedil;&atilde;o.<br>\\n\\\n <b> Massa: </b> é uma medida da in&eacute;rcia, e mede a quantidade de mat&eacute;ria do objeto. \\n\\\n A massa &eacute; uma grandeza escalar, e sua unidade no Sistema Internacional &eacute; o quilograma(kg).<br>\\n\\\n <b>For&ccedil;a:</b> é o que causa a mudan&ccedil;a de velocidade ou deforma&ccedil;&atilde;o em um objeto.';\n}", "function saludo2(){\n return \"Hola buen dia 888\";\n }", "decrire() {\n return `${this.nom} a ${this.sante} points de vie, ${\n this.force\n } en force et ${this.xp} points d'expérience`;\n }", "decrire() {\n return `${this.nom} a ${this.sante} points de vie, ${\n this.force\n } en force et ${this.xp} points d'expérience`;\n }", "decrire() {\n return `${this.nom} a ${this.sante} points de vie, ${\n this.force\n } en force et ${this.xp} points d'expérience`;\n }", "function ejercicio03(email){\n console.log(email);\n longitud = email.length;\n var cont = 0;\n var no = \"\";\n var dominio = email.substring(email.indexOf(\"@\")+1,longitud);\n var carac = email.indexOf(\"@\");\n for (i=0; i<= longitud; i++)\n {\n if(email.charAt(i) == \"8\")\n {\n cont = cont +1;\n }\n }\n if (cont == 0)\n {\n cont = toString(cont)\n cont = \"ningun/os\";\n no = \"no\";\n } \n\n return \"El correo \" + email + \"pertenece al dominio \"+ dominio + \" y tiene \" + carac + \" caracteres sin contar el dominio ni el @. Además, el correo \"+ no + \" contiene \"+ cont +\" número[s]\"; \n}", "function imprimetexto(texto) {\n console.log(texto)\n}", "function compterNbVoyelle(){\n var voyelle = 0;\n var consonne = 0;\n for( i=0; i<mot.length; i++){\n if( (mot[i] === \"a\") || (mot[i] === \"e\") || (mot[i] === \"i\") || (mot[i] === \"o\") || (mot[i] === \"u\") || (mot[i] === \"y\") ){\n voyelle++;\n } else{\n consonne++;\n }\n }\n console.log(\"Il y a \" + voyelle + \" voyelle(s) et \" + consonne + \" consonne(s).\")\n}", "function calculadora() {\n //COnjunto de instrucciones\n console.log(\"Hola soy la calculadora\");\n console.log(\"Si soy yo\");\n\n return \"HOLA SOY LA CALCULADORA...!!!\";\n}", "function conArroz(plato) {\n return new Promise((resolve, reject) => {\n resolve(plato + ' arroz');\n // reject(new Error('no queda ajo'));\n });\n}", "function saludar(){\n console.log(\"¡Hola Mundo!...\");\n}", "function testCuentaPalabras() {\r\n const texto =\r\n \"Lorem ipsum dolor sit amet consectetur adipisicing elit. Iste temporibus non, eligendi harum adipisci eos provident quaerat eveniet illo placeat distinctio omnis pariatur maiores et voluptates perferendis laborum quam facere.\";\r\n const resultado = cuentaPalabras(texto);\r\n if (resultado.cantidadDePalabras == 30 && resultado.palabrasConA == 3) {\r\n console.log(\"testCuentaPalabras passed\");\r\n } else {\r\n throw \"testCuentaPalabras falló\";\r\n }\r\n}", "function bl(e,t,n,i){var o=e+\" \";switch(n){case\"s\":return t||i?\"nekaj sekund\":\"nekaj sekundami\";case\"ss\":return o+=1===e?t?\"sekundo\":\"sekundi\":2===e?t||i?\"sekundi\":\"sekundah\":e<5?t||i?\"sekunde\":\"sekundah\":\"sekund\";case\"m\":return t?\"ena minuta\":\"eno minuto\";case\"mm\":return o+=1===e?t?\"minuta\":\"minuto\":2===e?t||i?\"minuti\":\"minutama\":e<5?t||i?\"minute\":\"minutami\":t||i?\"minut\":\"minutami\";case\"h\":return t?\"ena ura\":\"eno uro\";case\"hh\":return o+=1===e?t?\"ura\":\"uro\":2===e?t||i?\"uri\":\"urama\":e<5?t||i?\"ure\":\"urami\":t||i?\"ur\":\"urami\";case\"d\":return t||i?\"en dan\":\"enim dnem\";case\"dd\":return o+=1===e?t||i?\"dan\":\"dnem\":2===e?t||i?\"dni\":\"dnevoma\":t||i?\"dni\":\"dnevi\";case\"M\":return t||i?\"en mesec\":\"enim mesecem\";case\"MM\":return o+=1===e?t||i?\"mesec\":\"mesecem\":2===e?t||i?\"meseca\":\"mesecema\":e<5?t||i?\"mesece\":\"meseci\":t||i?\"mesecev\":\"meseci\";case\"y\":return t||i?\"eno leto\":\"enim letom\";case\"yy\":return o+=1===e?t||i?\"leto\":\"letom\":2===e?t||i?\"leti\":\"letoma\":e<5?t||i?\"leta\":\"leti\":t||i?\"let\":\"leti\"}}", "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 getSaludo(nomRebutParametre) {\n return `Hola ${nomRebutParametre}, com estas ?`\n}", "function mondatSzam(){\n let szoveg = '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 let mondatSzamlalo = 0;\n for(i = 0; i<=szoveg.length-1; i++) {\n if(szoveg[i] == '?' || szoveg[i] == '.' || szoveg[i] == '!') {\n mondatSzamlalo++;\n }\n }\n if (mondatSzamlalo > 1) {\n return 'Több mondat';\n } else {\n return 'Egy mondat';\n }\n}", "decrire() \n {\n return `${this.nom} a ${this.sante} points de vie, ${\n this.force\n } en force et ${this.xp} points d'expérience`;\n }", "function proposerUnNombre () {\n var monNombreSecret = 0;\n var nombreSaisi = document.getElementById('nombreSaisi').value;\n if (1 < 0) { // ... A TOI DE JOUER !\n erreur(\"Ce puzzle n'est pas fini !\");\n } else {\n erreur(\"Ce puzzle n'est pas fini !\");\n }\n}", "function numberic_to_string(so)\n{\n var i;\n var j;\n var kq = \"\";\n var l;\n var dk;\n var tmp = \"\";\n var check = false;\n var a = new Array(32);\n\n //kiem tra kieu so\n //Loai het so 0 o dau\n while (so.length > 0 && so.charAt(0) == \"0\"){\n so = so.substring(1,so.length);\n }\n //alert(so);\n l = so.length;\n if (l > 28){\n return \"Số không hợp lệ\";\n }\n\n //Load cac chu so cua so can doc\n //vao mang a\n for (var i=1;i<=l;i++){\n a[i] = parseInt(so.charAt(i-1));\n }\n //Bat dau doc tu trai sang phai\n for (var i=1;i<=l;i++){\n\n if((l - i) % 3 == 2 && a[i] == 0 && (l - i >= 2)) {\n if (a[i + 1] != 0 || a[i + 2] != 0) {\n kq = kq + \"không \";\n }\n }\n\n if (a[i] == 2){\n kq = kq + \"hai \";\n }\n if (a[i] == 3){\n kq = kq + \"ba \";\n }\n if (a[i] == 6){\n kq = kq + \"sáu \";\n }\n if (a[i] == 7){\n kq = kq + \"bảy \";\n }\n if (a[i] == 8){\n kq = kq + \"tám \";\n }\n if (a[i] == 9){\n kq = kq + \"chín \";\n }\n\n\n //Xu ly cach doc so 4\n if (a[i] == 4) {\n if (i > 1 && (l - i) % 3 == 0){\n if (a[i - 1] > 1){\n kq = kq + \"tư \";\n }else{\n kq = kq + \"bốn \";\n }\n }else{\n kq = kq + \"bốn \";\n }\n } //a(i)=4\n\n //Xu ly cach doc so 5\n if (a[i] == 5){\n if (i > 1 && (l - i)% 3 == 0){\n if (a[i - 1] != 0 ){\n kq = kq + \"lăm \";\n }else{\n kq = kq + \"năm \";\n }\n }else{\n kq = kq + \"năm \";\n }\n } //a(i)=5\n\n //Xu ly cach doc so 1\n if (a[i] == 1) {\n //doc la muoi neu no la hang chuc\n if ((l - i) % 3 == 1) {\n kq = kq + \"mười \";\t//doc la mot neu la hang don vi\t//va hang chuc >1\n }else{\n if ((l - i) % 3 == 0 && (i > 1)){\n if (a[i - 1] > 1){\n kq = kq + \"mốt \";\n }else{\n kq = kq + \"một \";\n }\n }else{\n kq = kq + \"một \";\n }\n }\n } //a(i)=1\n\n\n //Doc tiep la muoi neu\n //No la so hang chuc va\n //Khac 1 va 0\n if ((l - i) % 3 == 1 && a[i] != 0 && a[i] != 1){\n kq = kq + \"mươi \";\n }\n\n if ((l - i) % 3 == 1 && a[i] == 0 && a[i + 1] != 0){\n kq = kq + \"linh \";\n }\n\n if ((l - i) % 3 == 2 && (a[i + 1] != 0 || a[i + 2] != 0)){\n kq = kq + \"trăm \";\n }\n\n if ((i + 2) <= l) {\n if (a[i] != 0 && (l - i) % 3 == 2){\n if (a[i + 1] == 0 && a[i + 2] == 0){\n kq = kq + \"trăm \";\n }\n }\n }\n\n if ((l - i) == 3){\n kq = kq + \"nghìn \";\n }\n if ((l - i) == 6){\n kq = kq + \"triệu \";\n }\n if ((l - i) == 9){\n kq = kq + \"tỷ \";\n }\n\n if ((l - i) == 12){\n check = true;\n for (j=i+1;i<l;i++){\n if (a[i + 1] != 0){\n check = false;\n }\n }\n if (check == false) {\n kq = kq + \"nghìn \";\n }else{\n kq = kq + \"nghìn tỷ \";\n }\n }\n\n if ((l - i) == 15){\n kq = kq + \"triệu tỷ \";\n }\n if ((l - i) == 18){\n kq = kq + \"tỷ tỷ \";\n }\n if ((l - i) == 21){\n kq = kq + \"nghìn tỷ tỷ \";\n }\n if ((l - i) == 24){\n kq = kq + \"triệu tỷ tỷ \";\n }\n if ((l - i) == 27){\n kq = kq + \"tỷ tỷ tỷ \";\n }\n if ((l - i) == 30){\n kq = kq + \"nghìn tỷ tỷ \";\n }\n\n //Xu ly bo 3 so khong\n if (((l - i) % 3 == 2) && (a[i] == 0) && (a[i + 1] == 0) && (a[i + 2] == 0)){\n i = i + 2;\n }\n\n //Xu ly tat ca so khong con lai\n if ((l - i) % 3 == 0){\n dk = 1;\n for (j=i+1;j<=l;j++){\n if (a[j] != 0){\n dk = 0;\n }\n }\n }\n if (dk == 1){\n break;\n }\n\n }\n\n //Viet hoa chu cai dau tien\n if (kq == \"\") kq = \"không\"\n while (kq.charAt(kq.length) == \",\"){\n kq = kq.substring(0,kq.length-1);\n }\n kq = kq.charAt(0).toUpperCase() + kq.substring(1,kq.length);\n return kq + \" đồng\";\n}", "function comprovarDictat () {\r\n this.capa.innerHTML=\"\";\r\n if (this.actual.toLowerCase() !=this.correcte.toLowerCase()) {\r\n this.putImg(\"imatges/error.gif\");\r\n this.putSound(this.soMal);\r\n this.actual = \"\";\r\n }\r\n else\r\n {\r\n this.putImg(this.dirImg + this.paraules[this.wordActual].imatge);\r\n this.putSound(this.paraules[this.wordActual].so);\r\n this.actual = \"\";\r\n this.capa.innerHTML += \"<br>\" + this.paraules[this.wordActual].paraula.toUpperCase();\r\n this.actual = \"\";\r\n this.validate=1;\r\n }\r\n}", "function NeniKDispozici(){\n alert(\"Omlouváme se, ale tento odkaz nyní není k dispozici. Funkční je prozatím jen Tříbarevná dioda\");\n}", "function a(e,a,t,n){switch(t){case\"s\":return a?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(a?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(a?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(a?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(a?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(a?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(a?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,a,i){switch(a){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,a,i){switch(a){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function e(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,r,a){switch(r){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function c(e,c,t,n){switch(t){case\"s\":return c?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(c?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(c?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(c?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(c?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(c?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(c?\" жил\":\" жилийн\");default:return e}}", "function saludar() {\r\n return `${nombre} ${apellido}`\r\n}", "function imprimirEdad(n,e){\n console.log(`${n} tiene ${e} años`)\n}", "function maakEenBroodjeKaas() {\r\n console.log(\"pak een boterham\");\r\n console.log(\"smeer er boter op\");\r\n console.log(\"leg er een plakje kaas op\");\r\n}", "function saludo() {\n let otro_nombre = \"Anahi\";\n return \"Hola \" + otro_nombre;\n\n}", "function t(e,t,n,o){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function falso(){\n\tif(cont==2||cont==3||cont==5||cont==6||cont==7||cont==8||cont==10||cont==11||cont==13||cont==17||cont==19){\n\t\talert(\"ESA ES MI CHICA! CORRECTO\");\n\t\tpuntos = puntos + 1;\n\t}else{\n\t\talert(\"MALA NOVIA!!! ERROR\");\n\t}\n\tconsole.log(puntos);\n\tcambiarPagina();\n}", "function getVardasPavarde() {\n var x = \"Marta\";\n var y = \"Martinaityte\";\n return x + y; // arba \"Marta Martinaityte\"\n return \"Marta Martinaityte\";\n return \"Marta\" + \" Martinaityte\";\n var z = x + \"<br>\"; // niekada neivyks\n}", "function simple(){\n aff('Exercice n°01 : Bienvenue');\n var name = 'loic';\n aff(`Bienvenue à vous -> ${name} !`);\n jump();\n}", "function saludar(nombre) {\n return \"Hola, \" + nombre;\n}", "function e(t,e,i,n){switch(i){case\"s\":return e?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return t+(e?\" секунд\":\" секундын\");case\"m\":case\"mm\":return t+(e?\" минут\":\" минутын\");case\"h\":case\"hh\":return t+(e?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return t+(e?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return t+(e?\" сар\":\" сарын\");case\"y\":case\"yy\":return t+(e?\" жил\":\" жилийн\");default:return t}}", "function comprovarEscriu () {\r\n this.validate=1;\r\n index=cerca(this.paraules,this.actual);\r\n this.capa.innerHTML=\"\";\r\n if (index != -1) {\r\n paraula = this.paraules[index];\r\n this.putImg (this.dirImg+\"/\"+paraula.imatge);\r\n this.capa.innerHTML += \"<br>\" + this.paraules[index].paraula.toUpperCase();\r\n this.putSound (paraula.so);\r\n this.ant = this.actual;\r\n this.actual = \"\";\r\n }\r\n else {\r\n this.putImg (\"imatges/error.gif\");\r\n this.putSound (\"so/error.wav\");\r\n this.actual = \"\";\r\n }\r\n}", "function mostrarAlumnoConMasEjerciciosResueltos(){\r\n let mensaje = `Alumno/s con más ejercicios resueltos: `\r\n mensaje += buscarAlumnoConMasEjResueltos();\r\n document.querySelector(\"#pMostrarAlumnoQueMasResolvio\").innerHTML = mensaje;\r\n}", "function exibirNota(nota) {\n console.log(\"A nota \\u00E9 \" + nota);\n}", "function mensaje(nombre, apellido, pais = \"Argentina\") {\n if (apellido)\n return nombre + \" \" + apellido + \" es de \" + pais;\n else\n return nombre + \" \" + \"es de\" + \" \" + pais;\n}", "function atkDuMonstre (monstre){\n cible();\n if (vieCible == vieGue){\n nomCible = \"au Guerrier\";\n }\n if (vieCible == viePre){\n nomCible = \"au Prêtre\";\n }\n if (vieCible == vieArc){\n nomCible = \"à l'Archer\";\n }\n if (vieCible == vieVol){\n nomCible = \"au Voleur\";\n }\n\tvieCible.value -= atkMonstre;\n\tvieCible.innerHTML = vieCible.value;\n\tdescription.innerHTML = monstre+\" inflige \"+atkMonstre+\" \"+nomCible;\n}", "function t(e,t,a,n){switch(a){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,a,n){switch(a){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function t(e,t,n,a){switch(n){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function saudar(isManha) {\n let saudacao;\n if (isManha) {\n saudacao = 'Bom dia!';\n }\n else {\n saudacao = 'Tenha uma boa vida!';\n }\n return saudacao; // causa erro por causa da flag \"strictNullChecks\": true, porque ela vem como true por padrão\n}", "function t(e,t,i,n){switch(i){case\"s\":return t?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return e+(t?\" секунд\":\" секундын\");case\"m\":case\"mm\":return e+(t?\" минут\":\" минутын\");case\"h\":case\"hh\":return e+(t?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return e+(t?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return e+(t?\" сар\":\" сарын\");case\"y\":case\"yy\":return e+(t?\" жил\":\" жилийн\");default:return e}}", "function e(t,e,r,i){switch(r){case\"s\":return e?\"хэдхэн секунд\":\"хэдхэн секундын\";case\"ss\":return t+(e?\" секунд\":\" секундын\");case\"m\":case\"mm\":return t+(e?\" минут\":\" минутын\");case\"h\":case\"hh\":return t+(e?\" цаг\":\" цагийн\");case\"d\":case\"dd\":return t+(e?\" өдөр\":\" өдрийн\");case\"M\":case\"MM\":return t+(e?\" сар\":\" сарын\");case\"y\":case\"yy\":return t+(e?\" жил\":\" жилийн\");default:return t}}", "function catchme(arr) {\n var nyawa = 3\n var tangkap = 0\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] == 'Villain') {\n tangkap++\n }\n if (arr[i] == '@') {\n nyawa--\n }\n if (nyawa == 0) {\n return `Mati lu, cuma dapet ${tangkap} Villain`\n }\n }\n return `Bagus! Anda menangkap ${tangkap}`\n}", "function mostraNotas(){}", "function terbilang(a) {\n var c = \" Satu Dua Tiga Empat Lima Enam Tujuh Delapan Sembilan Sepuluh Sebelas\".split(\" \");\n if (12 > a) var b = c[a];\n else 20 > a ? b = c[a - 10] + \" Belas\" : 100 > a ? (b = parseInt(String(a / 10).substr(0, 1)), b = c[b] + \" Puluh \" + c[a % 10]) : 200 > a ? b = \"Seratus \" + terbilang(a - 100) : 1E3 > a ? (b = parseInt(String(a / 100).substr(0, 1)), b = c[b] + \" Ratus \" + terbilang(a % 100)) : 2E3 > a ? b = \"Seribu \" + terbilang(a - 1E3) : 1E4 > a ? (b = parseInt(String(a / 1E3).substr(0, 1)), b = c[b] + \" Ribu \" + terbilang(a % 1E3)) : 1E5 > a ? (b = parseInt(String(a / 100).substr(0, 2)),\n a %= 1E3, b = terbilang(b) + \" Ribu \" + terbilang(a)) : 1E6 > a ? (b = parseInt(String(a / 1E3).substr(0, 3)), a %= 1E3, b = terbilang(b) + \" Ribu \" + terbilang(a)) : 1E8 > a ? (b = parseInt(String(a / 1E6).substr(0, 4)), a %= 1E6, b = terbilang(b) + \" Juta \" + terbilang(a)) : 1E9 > a ? (b = parseInt(String(a / 1E6).substr(0, 4)), a %= 1E6, b = terbilang(b) + \" Juta \" + terbilang(a)) : 1E10 > a ? (b = parseInt(String(a / 1E9).substr(0, 1)), a %= 1E9, b = terbilang(b) + \" Milyar \" + terbilang(a)) : 1E11 > a ? (b = parseInt(String(a / 1E9).substr(0, 2)), a %= 1E9, b = terbilang(b) + \" Milyar \" + terbilang(a)) :\n 1E12 > a ? (b = parseInt(String(a / 1E9).substr(0, 3)), a %= 1E9, b = terbilang(b) + \" Milyar \" + terbilang(a)) : 1E13 > a ? (b = parseInt(String(a / 1E10).substr(0, 1)), a %= 1E10, b = terbilang(b) + \" Triliun \" + terbilang(a)) : 1E14 > a ? (b = parseInt(String(a / 1E12).substr(0, 2)), a %= 1E12, b = terbilang(b) + \" Triliun \" + terbilang(a)) : 1E15 > a ? (b = parseInt(String(a / 1E12).substr(0, 3)), a %= 1E12, b = terbilang(b) + \" Triliun \" + terbilang(a)) : 1E16 > a && (b = parseInt(String(a / 1E15).substr(0, 1)), a %= 1E15, b = terbilang(b) + \" Kuadriliun \" + terbilang(a));\n a = b.split(\" \");\n c = [];\n for (b = 0; b < a.length; b++) \"\" != a[b] && c.push(a[b]);\n return c.join(\" \")\n}" ]
[ "0.6513028", "0.6451133", "0.6351627", "0.63440484", "0.6293781", "0.62623924", "0.6256874", "0.61911994", "0.6183974", "0.6123509", "0.61182415", "0.6112766", "0.6105381", "0.6055037", "0.6055037", "0.60407436", "0.603573", "0.60115165", "0.60095304", "0.59912765", "0.5979042", "0.5972379", "0.5972379", "0.5971331", "0.5964635", "0.5962989", "0.59601337", "0.59582204", "0.5941559", "0.5921977", "0.59124935", "0.5909869", "0.59061253", "0.58841914", "0.5854218", "0.5851353", "0.5839154", "0.5824427", "0.5824408", "0.5823122", "0.5821871", "0.5821871", "0.5821871", "0.58200127", "0.5815786", "0.58150655", "0.58134085", "0.5809147", "0.57962316", "0.57891816", "0.5788454", "0.5781495", "0.5745479", "0.5734007", "0.57253015", "0.572358", "0.57060647", "0.57040787", "0.569165", "0.5691106", "0.5690095", "0.5690095", "0.5682962", "0.566398", "0.56631964", "0.5660708", "0.56572765", "0.56548893", "0.56545204", "0.56544065", "0.565315", "0.5652633", "0.5652366", "0.56520754", "0.56482697", "0.5642567", "0.5642298", "0.56363124", "0.5635172", "0.56229264", "0.5621359", "0.5621359", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615948", "0.5615433", "0.56142914", "0.5613783", "0.5613104", "0.5610019", "0.5609356" ]
0.0
-1
Funcion a la que llamamos cuando se produce el "drag" Hacemos que el evento pueda transferir un dato ("informacion")
function drag(ev) { ev.dataTransfer.setData("Informacion", ev.target.id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drag(ev)\n{\n ev.dataTransfer.setData(\"message\", ev.target.id);\n}", "function dragInicio(ev) {\n ev.dataTransfer.setData(\"Text\", ev.target.id);\n}", "drag(event) {\n event.dataTransfer.setData(\"divId\", event.target.id);\n console.log(\"----drag----:\");\n }", "function drag (event) {\r\n console.log(\"drag FN start\");\r\n console.log(event);\r\n draggedPic = event.target; // TODO draggedPic\r\n event.dataTransfer.setData(\"text\", event.target.id);\r\n event.dataTransfer.effectAllowed = \"move\";\r\n}", "function drag(event) {\n event.dataTransfer.setData(\"artikel_id\", event.srcElement.id);\n\n}", "function drag(ev) {\n console.log(ev.dataTransfer);\n if(ev.target.id){\n console.log(ev.dataTransfer);\n ev.dataTransfer.setData(\"text\", ev.target.id);\n \n }\n console.log(ev.target.dataset.index);\n if(ev.target.dataset.index){\n console.log(\"tem ue\");\n ev.dataTransfer.setData(\"el-index\", ev.target.dataset.index);\n }\n}", "function eventosFichas() {\n\n var fichas = document.querySelectorAll(\".arrastrables div\");\n\n for (i = 0; i < fichas.length; i++) {\n fichas[i].addEventListener(\"dragstart\",\n function (event) {\n event.dataTransfer.setData(\"text\", event.target.id);\n });\n }\n}", "function start(ev) {\n //guardo el id del elemento que estoy arrastrando\n ev.dataTransfer.setData(\"name\", ev.target.id);\n console.log( ev.target.id);\n}", "drag(ev) {\n // console.log('drag')\n }", "function ondragstart(event) {\n var x = event.currentTarget\n x.style.border = \"dashed\"\n var datatransfer = event.dataTransfer.setData('text/plain', event.target.id)\n}", "function dragStartFunction(e) {\r\n e.dataTransfer.setData(\"target\", e.target.id)\r\n\r\n\r\n}", "function dragtaskStart(ev) {\n ev.dataTransfer.setData(\"text/plain\", ev.target.id);\n}", "startDrag(event) {\n event.dataTransfer.setData(\"text\", event.target.id);\n }", "function drag(e) {\n e.dataTransfer.setData('transfer', e.target.id);\n }", "function onDragStart(event) {\n //Store data to record movement\n this.data = event.data;\n this.alpha = 0.5;\n this.dragging = true;\n \n}", "function drag_start(event) {\n const style = window.getComputedStyle(event.target, null);\n event.dataTransfer.setData(\"text/plain\",\n (parseInt(style.getPropertyValue(\"left\"),10) - event.clientX) + ',' + (parseInt(style.getPropertyValue(\"top\"),10) - event.clientY));\n }", "dragStartSetData(e) {\n e.dataTransfer.setData(\"Text\", this.props.data.id);\n }", "function drag(event, datum) {\n event.dataTransfer.setData(\"connector\", JSON.stringify(datum));\n }", "function _onDrop(e)\n {\n // compatibilidad para firefox\n var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;\n if (isFirefox) {\n e.preventDefault();\n }\n\n // obtener origen del dulce\n var src = e.dataTransfer.getData(\"text\");\n var sr = src.split(\"_\")[1];\n var sc = src.split(\"_\")[2];\n\n // obtener destino del dulce\n var dst = e.target.id;\n var dr = dst.split(\"_\")[1];\n var dc = dst.split(\"_\")[2];\n\n // si la distancia es mayor a 1, no permitir el movimiento y alertar\n var ddx = Math.abs(parseInt(sr)-parseInt(dr));\n var ddy = Math.abs(parseInt(sc)-parseInt(dc));\n \n \n if (ddx > 1 || ddy > 1)\n {\n alert(\"El cambio solo puede ser con el dulce adyacente\");\n return;\n }\n else if (ddx == 1 && ddy == 1)\n {\n alert(\"Los cambios no pueden ser en diagonal\");\n return;\n }\n else{\n // intercambio de dulces\n var tmp_o = grid[sr][sc].src;\n var tmp_d = grid[dr][dc].src;\n grid[sr][sc].src = grid[dr][dc].src;\n grid[sr][sc].o.attr(\"src\",grid[sr][sc].src);\n grid[dr][dc].src = tmp_o;\n grid[dr][dc].o.attr(\"src\",grid[dr][dc].src);\n\n //validar intercambio\n var resBus = validarCoincidencias();\n console.log(\"Busqueda: \" + resBus);\n \n if(resBus==0)\n {\n alert(\"No genera combinación\");\n grid[sr][sc].src = tmp_o;\n grid[sr][sc].o.attr(\"src\",grid[sr][sc].src);\n grid[dr][dc].src = tmp_d;\n grid[dr][dc].o.attr(\"src\",grid[dr][dc].src);\n return;\n }\n\n // sumar un movimiento\n moves+=1;\n $(\"#movimientos-text\").html(moves);\n\n //buscar coincidencias\n buscarCoincidencias(); \n }\n }", "drag(evt) {\n\n console.log(evt.target.id);\n evt.dataTransfer.setData(\"text\", evt.target.id);\n }", "onDragStart({dataTransfer: dt, currentTarget: t}) { dt.setData('text', t.src) }", "function drag(ev) \n{\n ev.dataTransfer.setData(\"text\", ev.target.id);\n //$('#'+ev.target.id).draggable( {cursor: 'move'} );\n}", "onDragStart(e, name){\n console.log('now dragging',name);\n e.dataTransfer.setData(\"name\", name);\n }", "function drag(ev){\r\n\t//console.log(ev.target.parentNode);\r\n\tvar ss = (parseInt($(ev.target.parentNode).position().left,10) - ev.clientX) + ',' + (parseInt($(ev.target.parentNode).position().top,10) - ev.clientY);\r\n\tev.dataTransfer.setData(\"text/plain\", ss + ',' + $(ev.target.parentNode).attr('id'));\r\n\t//ev.dataTransfer.setDragImage(document.getElementById(\"draggit\"), 10, 10);\r\n\t//console.log(\"drag:target\", $(ev.target).position().left + \",\" + $(ev.target).position().top);\r\n\t//console.log(\"drag:offset\", ss);\r\n\t//console.log();\r\n}", "function drag(ev){\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n const zval = ev.target.getAttribute(\"data-z-value\");\n const zvalue = ( zval == null || zval === ' ') ? 0 : zval;\n\n const functionName = (! ev.target.getAttribute(\"data-polemic\")) ?\n ev.target.getAttribute(\"data-function\"): ev.target.getAttribute(\"data-polemic\");\n\n ev.dataTransfer.setData(\"text\",\n JSON.stringify({ name: functionName,\n function : ev.target.getAttribute(\"data-function\"),\n id: ev.target.id,\n value: ev.target.getAttribute(\"data-value\"),\n z: zvalue\n }));\n dragged = ev.target;\n //style with border on transfer\n ev.target.style.border = \"2px solid red\";\n}", "function dragStart(event) {\r\n event.dataTransfer.setData(\"Text\", event.target.id);\r\n}", "function dragStart(event) {\n event.dataTransfer.setData(\"text\", event.target.id); // or \"text/plain\" but just \"text\" would also be fine since we are not setting any other type/format for data value\n}", "function drag(e) {\r\n //draggedItem = e.target; No need for a global variable here\r\n e.dataTransfer.setData(\"text\", e.target.id); // set data in drag and drop event to dragged element's id\r\n dragging = true;\r\n}", "function dragStart(event) {\r\n\tevent.dataTransfer.setData(\"text\",event.target.id);\r\n}", "function dragstart_handler(e) {\r\n e.dataTransfer.setData(\"text/plain\", e.target.dataset.jsDraggable);\r\n}", "onDrag(event, obj){\n\t\tevent.dataTransfer.setData(\"draggedObject\", JSON.stringify(obj));\n\t}", "function drag(ev) {// credit to https://www.w3schools.com/HTML/html5_draganddrop.asp\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"Text\", ev.target.id);\n}", "function drag(event) {\n event.dataTransfer.setData(\"mbid\", $(event.srcElement).data(\"mbid\"));\n fillImg($(event.target), undefined) // Empty source\n}", "function dragStart(e){\n\te.dataTransfer.setData('text', e.target.id);\n}", "function startDrag (e) {\n //we are capturing the event object and using it to set some information about what is being dragged\n //in this case we are saying that we are storing some text and it is the id of element being moved\n //We need to set this, this iswhy it wasn't working earlier\n //Set the drag's format and data. Use the event target's id for the data\n e.dataTransfer.setData('text', e.target.dataset.audiosrc);\n console.log(\"dragging\");\n console.log(e.dataTransfer.getData('text'));\n }", "function drag(e) {\n draggedItem = e.target\n dragging = true\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n}", "function dragStart(event) {\n //console.log(event)\n event.dataTransfer.setData(\"choice\", event.target.id);\n event.dataTransfer.setData(\"letter\", event.target.innerHTML);\n}", "function drop(ev) {\n ev.preventDefault();\n var datos=ev.dataTransfer.getData(\"text\");\n ev.target.appendChild(document.getElementById( datos));\n var destino = ev.target.id\n console.log(\"destino: \"+destino);\n console.log(\"objeto: \"+datos);\n edit_Kanban(destino, datos)\n ev.stopPropagation();\n}", "function drag(event) {\n draggedItem = event.target;\n dragging = true;\n}", "function drop(ev) {\n // Prevenimos su comportamiento por defecto\n ev.preventDefault();\n // Hacemos que el evento reciba un dato (\"informacion\")\n var data = ev.dataTransfer.getData(\"Informacion\");\n // Si el elemento que hemos soltado era la bola\n if(data==\"bola\"){\n document.getElementById(\"papelera\").src=\"papeleraLLena.jpg\";\n }\n}", "function drag(e) {\n e.dataTransfer.setData(\"text\", e.target.id);\n}", "function dragDown() {\n xInicio = window.event.clientX;\n}", "_onDragStart() {\n this._isDragged = true;\n }", "function drop(ev) {\n ev.preventDefault();\n var dato = ev.dataTransfer.getData(\"Text\");\n ev.target.appendChild(document.getElementById(dato));\n document.getElementById(dato);\n ev.target.style.background = \"rgb(229, 229, 255)\";\n validarCampos(ev)\n}", "onDragStarted(mousePosition) {\n }", "function dragStep(ev) {\n ev.dataTransfer.setData(\"text\", $(ev.target).text());\n ev.dataTransfer.setData(\"id\", ev.target.id.split('_')[1]);\n}", "onDrag(mousePosition) {\n }", "drop(ev) {\n\t\tev.preventDefault();\n\t\tvar data = ev.dataTransfer.getData(\"text\");\n\t\tif(data.includes(\"func\"))\n\t\t{\n\t\t\tcopyID = \"drag\" + counter;\n\t\t\tcounter++;\n\t\t\tvar offLeft = document.getElementById(\"context\").offsetLeft;\n\t\t\tvar offTop = document.getElementById(\"context\").offsetTop;\n\t\t\tvar x = ev.clientX - offLeft; // Get the horizontal coordinate of mouse\n\t\t\tvar y = ev.clientY - offTop; // Get the vertical coordinate of mouse\n\t\t\t\n\t\t\t// console.log(\"Left =\" + offLeft + \", Top =\" + offTop );\n\t\t\t// console.log(\"X =\" + x + \", Y =\" + y );\n\t\t\tvar elem;\n\t\t\tswitch (data) {\n\t\t\t\tcase \"funcBody\":\n\t\t\t\t\telem = document.getElementById(\"funcBody\");\n\t\t\t\t\t// console.log(elem.offsetWidth + \" \" + elem.offsetHeight);\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\t// console.log(x + \" \" + y);\n\t\t\t\t\t// x -= elem.offsetWidth/2;\n\t\t\t\t\t// y -= elem.offsetHeight/2;\n\t\t\t\t\tthis.appendData(funcBody, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcRec\":\n\t\t\t\t\telem = document.getElementById(\"funcRec\");\n\t\t\t\t\t// console.log(elem.offsetWidth + \" \" + elem.offsetHeight);\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\t// console.log(x + \" \" + y);\n\t\t\t\t\tthis.appendData(funcRec, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcOp\":\n\t\t\t\t\telem = document.getElementById(\"funcOp\");\n\t\t\t\t\t// console.log(elem.offsetWidth + \" \" + elem.offsetHeight);\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\t// console.log(x + \" \" + y);\n\t\t\t\t\tthis.appendData(funcOp, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcExp\":\n\t\t\t\t\telem = document.getElementById(\"funcExp\");\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\tthis.appendData(funcExp, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"funcNExp\":\n\t\t\t\t\telem = document.getElementById(\"funcNExp\");\n\t\t\t\t\tx = Math.round((x-elem.offsetWidth/2) / 10) * 10;\n\t\t\t\t\ty = Math.round((y-elem.offsetHeight/2) / 10) * 10;\n\t\t\t\t\tthis.appendData(funcNExp, copyID, x, y);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tconsole.log(\"Invalid drop\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "function drag(e) {\n draggedItem = e.target;\n dragging = true;\n}", "function drag(){\n console.log(\"Being dragged around\");\n}", "drag_feedback(){\r\n this.dragging = true;\r\n }", "function mouseDragged(){\r\n inputForMDragging(mouseX, mouseY);\r\n\r\n\r\n}", "onDragMove(e) {\n if (this.dragging) {\n let value = (mousePosition.x - this.position.x*2)/this.width;\n this.setValue(value)\n this.dragFunction();\n }\n }", "function drag(e) {\r\n draggedItem = e.target;\r\n dragging = true;\r\n}", "function widgetDragStart(event) {\n var data = JSON.stringify({\n type: 'widget_drag',\n data: event.target.id\n });\n event.dataTransfer.setData('data', data);\n event.dataTransfer.dropEffect = 'move';\n}", "function dragGo(event) {\n var x, y;\n // Get cursor position with respect to the page.\n y = event.clientY + window.scrollY;\n\n //d.elNode.style.left = (d.elStartLeft + x - d.cursorStartX) + \"px\";\n if ((d.elStartTop + y - d.cursorStartY)>=(dims.headerw? (dims.headert+16) : (dims.top+16)) && (d.elStartTop + y - d.cursorStartY)<(dims.height+(dims.headerw? (dims.headert+16) : (dims.top+16)))-height) {\n if ((d.elStartTop + y - d.cursorStartY)<=3)\n y = d.cursorStartY - d.elStartTop;\n d.cp.style.top = (d.elStartTop + y - d.cursorStartY) + \"px\";\n if ((d.elStartTop + y - d.cursorStartY)>0)\n d.cp.setAttribute('style',setTopBorder(d.cp.getAttribute('style')));\n else\n d.cp.setAttribute('style',removeTopBorder(d.cp.getAttribute('style')));\n d.cph.style.top = (d.elStartTop + y - d.cursorStartY + d.baseH - 3) + \"px\";\n savePos(d.elStartTop + y - d.cursorStartY);\n }\n event.preventDefault();\n}", "function CdkDragMove() {}", "function CdkDragMove() {}", "function drag_meal(event) {\n event.dataTransfer.setData(\"text\", event.target.id);\n}", "function dragTrip(event) {\n event.dataTransfer.setData(\"text\", event.target.id);\n}", "function dragStart() {\n\t\tconsole.log('started draggin');\n\t}", "function dragMessage(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.innerText);\n}", "drag(x, y) {\n this.doDrag(x, y);\n }", "function onDragStart(event) {\r\n event.dataTransfer.setData('text/plain', event.target.id);\r\n }", "function actualizar_puntaje(){\r\n aplicar_animacion(seleccionar_combos())\r\n asignacion_de_eventos_drag_drop()\r\n}", "function drag(ev) {\n ev.dataTransfer.setData(\"id\", ev.target.id);\n let idWithoutNumber = ev.target.id.replace(/[0-9]/g, '');\n draggedItem = idWithoutNumber;\n //console.log(\"dragged id is set to : \" + draggedItem); // debug log\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 }", "function D_D (main_el,par,pos_x,pos_y,def_el,fdfex) {\n//main_el is a trigger, elemet that start drag&drop\n//par is for collision, so element can't go out of parent\n//with pos_x and pos_y you can set position for element\n//with def_el you can move another element\n//*fdfex is a function definition expression. And a function definition expression it is a function is passed as an argument to another function\n\nlet el = main_el;\nel.setAttribute('onselectstart',\"return false\");\n\nel.addEventListener('mousedown',mdD_D);\n\nif (def_el !== undefined && def_el != 0 && def_el != \"\"){\n\tel = def_el;\n}\n\nif (pos_x !== undefined && !isNaN(pos_x)) {\n\tel.style.left = Number(pos_x)+\"px\";\n}\nif (pos_y !== undefined && !isNaN(pos_x)) {\n\tel.style.top = Number(pos_y)+\"px\";\n}\n\nfunction mdD_D (e) {\n\twindow.addEventListener('mousemove',mvD_D);\n\twindow.addEventListener('mouseup',muD_D);\n\n\tlet elCrd = {\n\t\tx:el.offsetLeft,\n\t\ty:el.offsetTop,\n\t\tw:el.offsetWidth,\n\t\th:el.offsetHeight\n\t}\n\n\tlet mouse = {\n\t\tx:e.x,\n\t\ty:e.y\n\t}\n\n\tif (e.target != this & e.target.tagName != \"svg\" & e.target.tagName != \"line\") {\n\t\twindow.removeEventListener('mousemove',mvD_D);\n\n\t}else {\n\t\tel.style.boxShadow = \"0 0 5px 2px #b3e0f9\";\n\t}\n\n\tfunction mvD_D (e) {\n\nif (!isResizing){\n\nmouse.x = e.x - mouse.x;\nmouse.y = e.y - mouse.y;\n\nif (par) {\n//this if is for collision with parent\nlet speed = internalColision (el,mouse.x,mouse.y,par);\n//and this for change coords of element\nelCrd.x += speed.x;\nelCrd.y += speed.y;\n\n}else {\n\telCrd.x += mouse.x;\n\telCrd.y += mouse.y;\n}\n\n\t\telCrd.X = getCoords(el).left;\n\t\telCrd.Y = getCoords(el).top;\n\n//here I set another position of element with css\n\t\tif (fdfex !== undefined && fdfex !== \"\" && fdfex !== 0) {\n\t\t\tlet status = 1;\n\t\t\tif (typeof fdfex == \"function\") {\n\t\t\t\tfdfex(e,status);\n\t\t\t}\n\t\t\tif (typeof fdfex == \"object\") {\n\t\t\t\tlet move = fdfex.f(e,fdfex.arg,status,elCrd.X,elCrd.Y);\n\t\t\t}\n\t\t}\n\n\t\tel.style.left = elCrd.x + \"px\";\n\t\tel.style.top = elCrd.y + \"px\";\n\t\tmouse.x = e.x;\n\t\tmouse.y = e.y;\n}\n\n\t}\n\nfunction muD_D (e) {\n\twindow.removeEventListener('mousemove',mvD_D);\n\twindow.removeEventListener('mouseup',muD_D);\n\n//here I set another position of element with css\n\n\tif (fdfex !== undefined && fdfex !== \"\" && fdfex !== 0) {\n\t\tlet status = 0;\n\t\tif (typeof fdfex == \"function\") {\n\t\t\tfdfex(e,status);\n\t\t}\n\t\tif (typeof fdfex == \"object\") {\n\t\t\tlet change = fdfex.f(e,fdfex.arg,status,e.x,e.y);\n\t\t}\n\t}\n\n\tel.style.boxShadow = \"none\";\n\tisDraging = false;\n\t}\n}\n\nel.ondragstart = function() {\n return false;\n};\n\n}", "function dragOrder(ev) {// credit to https://www.w3schools.com/HTML/html5_draganddrop.asp //\n ev.dataTransfer.setData(\"text\", ev.target.id);\n\n let i = getIndexOfK(orderArray, ev.target.id);\n orderArray[i][3] = 'vacated';\n\n}", "onDragBegin(event,nodePath){\n var vm = this;\n\t\tevent.dataTransfer.setData(\"srcObjectNode\", nodePath);\n console.log(\"onDragBegin:\"+nodePath);\n event.stopPropagation(); \n $(\"#solvent_lastmile_drop_position_indicator\").css(\"display\",\"none\"); \n\n vm.setClientAppData(\"clipboardState\",{\"mode\":\"move\",\"component\":nodePath});\n\n\n $(\"#solvent_lastmile_drop_position_indicator\")\n .css({\"display\":\"block\"/*,\"min-width\":indicatorWidth*/})\n .position({\n my:\"center top\",\n at:\"center top\",\n of:window \n }) \n }", "function handleDragStart(e) {\n e.dataTransfer.setData(\"text\",e.target.id);\n}", "function drag_drag(d) {\n\t\t\t d.fx = d3.event.x;\n\t\t\t d.fy = d3.event.y;\n\t\t\t}", "function drag(e){\ndraggedItem=e.target;\ndragging=true;\n}", "function anadirEventoDulce(){\r\n $('img').draggable({\r\n containment: '.panel-tablero',\r\n\t\tdroppable: 'img',\r\n\t\trevert: true,\r\n\t\trevertDuration: 500,\r\n\t\tgrid: [100, 100],\r\n\t\tzIndex: 10,\r\n\t\tdrag: constrainCandyMovement\r\n });\r\n $('img').droppable({\r\n\t\tdrop: dejaDulce\r\n\t});\r\n activarEventoDulce();\r\n}", "agregarDrag() {\n fichas = document.querySelectorAll('.movible');\n fichas.forEach.call(fichas, (ficha) => {\n ficha.addEventListener('dragstart', this.dragStart, false);\n ficha.addEventListener('dragenter', this.handleDragEnter, false);\n ficha.addEventListener('dragover', this.handleDragOver, false);\n ficha.addEventListener('dragleave', this.handleDragLeave, false);\n ficha.addEventListener('drop', this.handleDrop, false);\n ficha.addEventListener('dragend', this.handleDragEnd, false);\n });\n }", "onMouseDrag(e) {}", "static dragEvents(){\n //enter drag\n Quas.on(\"dragenter dragstart\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).addCls(\"dragenter\");\n });\n\n //exit drag\n Quas.on(\"dragend dragleave\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).delCls('dragenter');\n });\n\n //prevent default on other drag events\n Quas.on(\"drag dragover\", \".drop\", function(e){\n e.preventDefault();\n });\n\n //dropping the file\n Quas.on(\"drop\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).delCls('dragenter');\n upload(e.dataTransfer.files, function(data){\n //todo progress bar\n closeToolModals();\n Quas.getEl(\"#post-tool-cloud\").visible(true);\n loadModal(\"cloud\");\n });\n });\n }", "function drag_start(event) {\n\tvar style = window.getComputedStyle(event.target, null);\n\tevent.dataTransfer.setData(\"application/x-moz-node\", (parseInt(style.getPropertyValue(\"left\"), 10) - event.clientX) + ',' + (parseInt(style.getPropertyValue(\"top\"), 10) - event.clientY) + ',' + event.target.getAttribute('id'));\n}", "function dragStart() {\n mx = d3.event.x;\n my = d3.event.y;\n }", "function dragstarted() {\n v0 = versor.cartesian(projection.invert(d3.mouse(this)));\n r0 = projection.rotate();\n q0 = versor(r0);\n}", "function editOnDragStart(){this._internalDrag=true;this.setMode('drag');}", "function dragStart(e) {\n e.dataTransfer.setData('text', e.target.id);\n setTimeout(() => {\n e.target.classList.add('invisible');\n }, 0);\n}", "function dragstart(element) {\r\n dragobjekt = element;\r\n dragx = posx - dragobjekt.offsetLeft;\r\n dragy = posy - dragobjekt.offsetTop;\r\n}", "function iniciar() {\n var zona = document.getElementById('zonaArrastre');\n zona.addEventListener('drop',manejadorDrop);\n zona.addEventListener('dragenter',manejadodrDragEnter);\n zona.addEventListener('dragleave',manejadorDragLeave);\n zona.addEventListener('dragover',manejadorDragOver);\n var input = document.getElementById('inputArchivos');\n input.addEventListener('input',manejadorInputArchivos);\n var reiniciar = document.getElementById('reiniciar');\n reiniciar.addEventListener('click',manejadorBotonReiniciar);\n window.addEventListener('dragover',prevenirComportamientoDefault);\n window.addEventListener('drop',prevenirComportamientoDefault);\n}", "function Form_Drag_OnMove(event)\n{\n\t//block the event\n\tBrowser_BlockEvent(event);\n\t//get current position\n\tvar currentPos = Browser_GetScreenCoordinates(event);\n\t//Calculate the current delta\n\tvar nLeft = currentPos.x - __DRAG_DATA.StartPosition.x;\n\tvar nTop = currentPos.y - __DRAG_DATA.StartPosition.y;\n\t//check tolerance\n\tif (Math.abs(nLeft) < __DRAGGING_TOLERANCE && Math.abs(nTop) < __DRAGGING_TOLERANCE)\n\t{\n\t\t//not worth dragging\n\t\tnLeft = 0;\n\t\tnTop = 0;\n\t}\n\telse\n\t{\n\t\t//update with scale\n\t\tnLeft /= __SIMULATOR.Scale * __SCREEN_RESOLUTION_MODIFIER;\n\t\tnTop /= __SIMULATOR.Scale * __SCREEN_RESOLUTION_MODIFIER;\n\t}\n\t//dragged?\n\tif (nLeft !== 0 || nTop !== 0)\n\t{\n\t\t//update the object\n\t\t__DRAG_DATA.Target.style.left = Math.max(0, __DRAG_DATA.TargetInitialPosition.x + nLeft) + \"px\";\n\t\t__DRAG_DATA.Target.style.top = Math.max(0, __DRAG_DATA.TargetInitialPosition.y + nTop) + \"px\";\n\t\t//forward to controller\n\t\tSimulator_OnScroll();\n\t}\n}", "onDrag({ context, event }) {\n const me = this,\n dd = me.dragData,\n start = dd.startDate;\n\n let client;\n\n if (me.constrainToTimeline) {\n client = me.client;\n } else {\n let target = event.target;\n\n // Can't detect target under a touch event\n if (/^touch/.test(event.type)) {\n const center = Rectangle.from(dd.context.element, null, true).center;\n\n target = DomHelper.elementFromPoint(center.x, center.y);\n }\n\n client = IdHelper.fromElement(target, 'timelinebase');\n }\n\n const depFeature = me.client.features.dependencies,\n x = context.newX,\n y = context.newY;\n\n if (!client) {\n if (depFeature) {\n depFeature.updateDependenciesForTimeSpan(dd.draggedRecords[0], dd.context.element);\n }\n return;\n }\n\n if (client !== me.currentOverClient) {\n me.onMouseOverNewTimeline(client);\n }\n\n //this.checkShiftChange();\n\n me.updateDragContext(context, event);\n\n // Snapping not supported when dragging outside a scheduler\n if (me.constrainDragToTimeline && (me.showExactDropPosition || me.client.timeAxisViewModel.snap)) {\n const newDate = client.getDateFromCoordinate(me.getCoordinate(dd.draggedRecords[0], context.element, [x, y])),\n timeDiff = newDate - dd.sourceDate,\n realStart = new Date(dd.origStart - 0 + timeDiff),\n offset = client.timeAxisViewModel.getDistanceBetweenDates(realStart, dd.startDate);\n\n if (dd.startDate >= client.timeAxis.startDate && offset != null) {\n DomHelper.addTranslateX(context.element, offset);\n }\n }\n\n // Let product specific implementations trigger drag event (eventDrag, taskDrag)\n me.triggerEventDrag(dd, start);\n\n let valid = me.checkDragValidity(dd, event);\n\n if (valid && typeof valid !== 'boolean') {\n context.message = valid.message || '';\n valid = valid.valid;\n }\n\n context.valid = valid !== false;\n\n if (me.showTooltip) {\n me.tip.realign();\n }\n\n if (depFeature) {\n depFeature.updateDependenciesForTimeSpan(\n dd.draggedRecords[0],\n dd.context.element.querySelector(client.eventInnerSelector)\n );\n }\n }", "onDragEnded(mousePosition) {\n }", "function Dragging_Move(event)\n{\n\t//has drag data?\n\tif (__DRAG_DATA && __DRAG_DATA.OnMove && __DRAG_DATA.TouchDetail === Browser_GetTouchId(event))\n\t{\n\t\t//call it\n\t\t__DRAG_DATA.OnMove(event);\n\t}\n}", "function Form_Drag_OnEnd(event)\n{\n\t//trigger final move\n\t__DRAG_DATA.OnMove(event);\n}", "function dragstarted() {\n v0 = versor.cartesian(projection.invert(d3.mouse(this)));\n r0 = projection.rotate();\n q0 = versor(r0);\n}", "function UltraGrid_Sizer_Drag_OnEnd(event)\n{\n\t//trigger final move\n\t__DRAG_DATA.OnMove(event);\n}", "function widgetDrag(e) {\n e.dataTransfer.setData(\"widgetID\", e.target.id);\n }", "function drag(event) {\n var checkerId = event.target.id;\n event.dataTransfer.setData(\"Text\", checkerId);\n\n srcCol = Math.floor((event.pageX - 7 - document.getElementById(checkerId).parentElement.offsetLeft) / 50);\n srcRow = Math.floor((event.pageY - 7 - document.getElementById(checkerId).parentElement.offsetTop) / 50);\n\n /*if(canMove(srcRow, srcCol)) {\n document.getElementById(checkerId).setAttribute(\"draggable\", true);\n }\n else {\n document.getElementById(checkerId).setAttribute(\"draggable\", false);\n }*/\n\n highlightSpaces(event.target.id);\n}" ]
[ "0.7279743", "0.7160809", "0.70878005", "0.70050955", "0.69658244", "0.69637895", "0.6928682", "0.69212824", "0.6917103", "0.68803", "0.68770295", "0.687124", "0.6871131", "0.6853929", "0.68068993", "0.6798106", "0.677846", "0.67727715", "0.675692", "0.6748166", "0.67340213", "0.67115176", "0.6707023", "0.670227", "0.6680329", "0.6675508", "0.66435915", "0.66407067", "0.664044", "0.663788", "0.66226447", "0.6579945", "0.6575341", "0.6558231", "0.6557706", "0.6555392", "0.65517306", "0.65241647", "0.65158236", "0.65158236", "0.65020436", "0.65020436", "0.65020436", "0.6489107", "0.64868546", "0.6483054", "0.64829063", "0.64602745", "0.6453847", "0.6428458", "0.6428043", "0.64273393", "0.6427044", "0.64243746", "0.64160883", "0.6409118", "0.6407678", "0.63948727", "0.6391189", "0.63888043", "0.63876754", "0.6375087", "0.63728905", "0.6371777", "0.6371777", "0.63691884", "0.6363511", "0.6362219", "0.6362091", "0.63614327", "0.63447416", "0.6335359", "0.6334497", "0.63298655", "0.6325385", "0.63181317", "0.6315432", "0.63137674", "0.6313361", "0.6309896", "0.6308595", "0.6307306", "0.629128", "0.6273302", "0.6270578", "0.6266314", "0.62619835", "0.6261266", "0.62551796", "0.62501603", "0.6249928", "0.6247481", "0.62456185", "0.62432146", "0.62339413", "0.6229342", "0.6226664", "0.6221967", "0.622064", "0.62146086" ]
0.7715458
0
Funcion a la que llamamos cuando se produce el "drpop"
function drop(ev) { // Prevenimos su comportamiento por defecto ev.preventDefault(); // Hacemos que el evento reciba un dato ("informacion") var data = ev.dataTransfer.getData("Informacion"); // Si el elemento que hemos soltado era la bola if(data=="bola"){ document.getElementById("papelera").src="papeleraLLena.jpg"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pop() {\n --topp;\n}", "Pop() {\n\n }", "pop() {\n\n }", "pop() {\n }", "pop(){\n let popped;\n if(this.isEmpty()){\n return ;\n }\n if (this.size==1) {\n popped = this.getAt(0);\n this.reset();\n this.size--\n return popped;\n }\n let lList = this.head;\n let i=1\n while(i<this.size-1){\n lList = lList.next;\n i++;\n }\n popped = lList.next.data\n lList.next = null;\n this.size -= 1;\n return popped;\n }", "function popData(){\n\tpopTable();\n\tpopRTable();\n\tpopDesc();\n\tpopTitle();\n\tpopOwner();\n}", "pop(){\r\n var data = this.stack[this.size - 1];\r\n this.stack = this.stack.slice(0, -1);\r\n this.size--;\r\n return data;\r\n }", "pop(){\r\n if (this.top === -1){\r\n return undefined;\r\n }else{\r\n delete this.storage[this.top];\r\n this.top -= 1;\r\n }\r\n }", "function moveDown(){\n //your code\n \n if(buyList.length !== 0){\n var data = buyList.pop(data);\n fridge.push(data)\n console.log(buyList);\n console.log(fridge);\n buyListDisplay.innerHTML = buyList\n fridgeListDisplay.innerHTML = fridge\n } else {\n return null\n }\n}", "pop() {\n // YOUR CODE HERE\n }", "pop() {\n\t\tlet result = this.top.value;\n\t\tlet p = this.top.link;\n\t\tthis.top = p;\n\t\treturn result;\n\t}", "pop(){\n if(this.top !== null){\n this.temp = this.top;\n this.top = this.temp.next;\n return this.temp.data;\n } else {\n return 'null';\n }\n }", "pop() {\n if (!this.length) {\n return null;\n }\n if (this.top === this.bottom) {\n this.bottom = null;\n }\n const holdingPointer = this.top;\n const newTop = this.top.next;\n this.top = newTop;\n this.length--;\n console.log(this);\n }", "pop(){\n if(this.top==-1)\n {\n return -1;\n }\n else\n {\n return this.items[this.top--]; //delete the one paranthesis from stack\n }\n }", "pop () {\n return this.dataStore[--this.top]\n }", "pop(){\n let out = null;\n if(this.head != null){\n out = this.head.getData();\n this.head = this.head.getNext();\n this.length--;\n }\n return out;\n }", "function pop()\n{\n if(topp==-1)\n return 0;\n else\n {\n var popped_ele=stackarr[topp];\n topp--;\n return popped_ele;\n }\n}", "pop(){\n if(this.size === 0) return null\n let poppedOff = this.first\n if(this.size === 1){\n this.first = null\n this.last = null\n } else {\n this.first = poppedOff.next\n poppedOff.next = null\n }\n this.size--\n return poppedOff\n }", "pop() {\r\n return this.data.removeFromFront();\r\n }", "function inPop(self, packet)\n{\n if(!Array.isArray(packet.js.pop) || packet.js.pop.length == 0) return warn(\"invalid pop of\", packet.js.pop, \"from\", packet.from);\n if(!dhash.isSHA1(packet.js.from)) return warn(\"invalid pop from of\", packet.js.from, \"from\", packet.from);\n\n packet.js.pop.forEach(function(address){\n var pop = seen(self, address);\n if(!pop.line) return warn(\"pop requested for\", address, \"but no line, from\", packet.from);\n var popping = {js:{popping:[packet.js.from, packet.from.ip, packet.from.port].join(',')}};\n send(self, pop, popping);\n });\n delete packet.js.pop;\n}", "function applyPop(array) {\n\t// create a popped variable\n\tlet popped;\n\t// assign it to an expression removing the last element from the array\n\tpopped = array.pop();\n\t// return the popped variable\n\treturn popped;\n}", "pop() {\n if (this.count == 0) return undefined; //checking whether array is empty\n let deleteItem = this.items[this.count - 1];\n this.count = this.count - 1;\n return deleteItem;\n }", "pop() {\n let currentNode = this.head;\n while (currentNode.next) {\n currentNode = currentNode.next;\n }\n const popped = currentNode.value;\n currentNode = null;\n return popped;\n }", "dequeue() {\n let temp = this.stack1[(this.stack1.length - 1)];\n console.log(\"Popped value is\", temp);\n return this.stack1.pop();\n }", "rpop() {\n return this.members.pop()\n }", "pop(){\n \n return (this.item.length ===0)?'Stack Underflow': this.item.pop();\n }", "pop(){\n var oldTop = this.top\n if ( this.top == null ){\n console.log(\"There are no nodes in this stack!\")\n }\n else if ( this.top.next == null ) {\n console.log(this.top.value)\n this.top = null\n return null\n }\n else {\n this.top = this.top.next\n console.log(\"Popped\"+ String( oldTop.value ))\n oldTop = null\n }\n return this.top\n // your code here\n }", "function popShift(arr) {\n let popped = arr.pop(); // Change this line\n let shifted = arr.shift(); // Change this line\n return [shifted, popped];\n}", "function popShift(arr) {\n let popped = arr.pop(); // change this line\n let shifted = arr.shift();// change this line\n return [shifted, popped];\n}", "pop(){ \n if(!this.head) return undefined;\n let current = this.head; \n let newTail = current;\n while(current.next){ // looping over the list and saving last node ( as current.next ) and secondfrom the last( as a newTail )\n newTail = current; // new tail shoul be one sted behind\n current = current.next; // current moving forward\n }\n this.tail = newTail;\n this.tail.next = null;\n console.log(\"POP - true\");\n this.length--;\n if(this.length === 0){\n this.head = null;\n this.tail = null;\n }\n return current;\n }", "pop(){\n const temp = this.data[this.length - 1];\n delete this.data[this.length-1];\n this.length --;\n return temp;\n }", "pop() {\n //delete the current top values within the stack\n delete this.items[this.top];\n //deduct 1 from the top to show the new top index\n this.top = this.top -1;\n }", "pop() {\n // store old top\n const node = this.top;\n this.top = node.next;\n return node.data;\n }", "dequeue() {\n return this.processes.shift();\n // console.log('dequeu',this.processes[0]);\n }", "function notePop() {\n frets.pop();\n midis.pop();\n ids.pop();\n strings.pop();\n relations.pop();\n count--;\n return index.pop();\n }", "pop() {\n return stack.pop();\n }", "dequeue(){\n if(!this.eQueue.length && !this.dQueue.length) throw Error(\"Empty Stack\");\n \n if(this.dQueue.length === 0){\n for(let item of this.eQueue){\n this.dQueue.push(item);\n }\n }\n return this.dQueue.pop();\n }", "function POP(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'POP[]');\n }\n\n state.stack.pop();\n }", "function dontPop(e)\n{\n}", "function mov(ori, des) { \n des.push(ori.pop()); \n}", "function popp(arr){\n console.log(arr.pop(0))\n console.log(arr)\n}", "function popShift(arr) {\r\n let popped = arr.pop(); // Change this line\r\n let shifted = arr.shift(); // Change this line\r\n return [shifted, popped];\r\n}", "pop() {\n\t\treturn this.__().pop();\n\t}", "pop() {\n\n if (this.top === null) { // 如果目前stack是空的\n return null;\n }\n \n let valueOfPoppedElement = this.top.value; // 傳節點的值而不是傳reference(參照、也就是節點的記憶體位置)\n\n if (this.top.next === null) {\n this.top = null;\n return valueOfPoppedElement;\n }\n\n this.top = this.top.next;\n\n return valueOfPoppedElement;\n }", "function moveDown() {\n //your code\n const fromBuyList = buyList.pop();\n if (fromBuyList) {\n fridge.push(fromBuyList);\n updateDisplay();\n } else {\n return;\n }\n}", "pop() {\n const lastItem = this.data[this.lenght - 1];\n delete this.data[this.lenght - 1];\n this.lenght--;\n return lastItem;\n }", "function pop(){\n\treturn this.dataStore[--this.top]\n}", "function pop() {\n if (topp == -1)\n return 0;\n else {\n var popped_ele = stackarr[topp];\n topp--;\n return popped_ele;\n }\n}", "pop() {\n let toBeReturned = this.peek()\n this.deleteAtHead()\n return toBeReturned\n }", "pop(){\n if(this.items.length == 0){\n return \"Underflow\";\n }\n else{\n return this.items.pop();\n }\n }", "pop(){\n if(this.isEmpty()){\n return undefined;\n }\n\n // volta um no contador para acessarmos a chave do ultimo elemento adicionado, \n // visto que após o adicionarmos, já adicionamos mais um ao contador.\n this.count--\n\n const topElement = this.items[this.count];\n\n delete this.items[this.count];\n\n return topElement;\n }", "function bagPop() {\n var tile = bag.pop();\n tile.status = 1;\n return tile;\n}", "function pop () {\n return this.dataStore[this.top--];\n}", "pop() {\n const lastItem = this.data[this.length - 1];\n\n delete this.data[this.length - 1];\n\n this.length--;\n\n return lastItem;\n }", "pop() {\n this.#size--;\n return this.#stack.pop();\n }", "pop () {\n const last = this.length - 1\n const x = this.data[last]\n this._collapseTo(last)\n return x\n }", "pop() {\n //1. Pop element from minStack to make it sync with mainStack,\n //2. Pop element from mainStack and return that value\n this.minStack.pop()\n return this.mainStack.pop()\n }", "pop() {\n let result = this.stack.pop()\n return result\n }", "pop(value){\n if(!this.first) return null;\n var removed;\n if(this.length===1){\n removed = this.first;\n this.first= null;\n this.last = null\n }\n else {\n removed = this.first;\n this.first= this.first.next;\n \n }\n this.length--;\n return removed;\n\n }", "redo(self) {\n let toRedo = {};\n\n if (this.undidStack.length == 0) return;\n toRedo = this.undidStack.splice(this.undidStack.length - 1, 1)[0];\n toRedo.do(self);\n this.didStack.push(toRedo);\n\n //Now check to see if the following ones can also be redone\n while (this.undidStack.length != 0 && this.undidStack[this.undidStack.length - 1].includeWithPrevious) {\n toRedo = this.undidStack.splice(this.undidStack.length - 1, 1)[0];\n toRedo.do(self);\n this.didStack.push(toRedo);\n }\n\n\n }", "pop(){\n if (this.end == null || this.start == null){\n return null\n }else if (this.end == this.start){\n let end = this.end;\n thid.end = null;\n this.start = null;\n return end;\n }else{\n let oldl = this.end;\n let newl = this.end.last;\n oldl.break();\n this.end = newl;\n return oldl\n }\n }", "pop() {\n // skip cancelled elements at the top of the stack\n while (this.head < this.tail && this.storage[this.tail - 1] === undefined) {\n this.tail -= 1;\n this.cancelCount -= 1;\n }\n\n if (this.head < this.tail) {\n let element = this.storage[this.tail - 1];\n this.storage[this.tail - 1] = undefined;\n this.tail -= 1;\n return element;\n }\n }", "pop(){\n if(!this.head){\n console.log('No item to pop. Underflow');\n return;\n }\n else{\n if(this.head.next == null){\n console.log('Popped element:', this.head.data);\n this.head = null;\n }\n else{\n let current = this.head;\n let previous;\n while(current.next != null){\n previous = current;\n current = current.next;\n }\n console.log('Popped element:', current.data);\n previous.next = null;\n }\n }\n this.size--;\n }", "function remove_inventory(){ \n//take the top item from the list \n\n\tproducts.shift(); \n\t// you dont need to do \"var anything\" because you dont need to assign the variable\n\n\tprinting(); \n\n}", "pop() {\n if (!this.head) return undefined\n let poppedNode = this.tail\n if (this.length === 1) {\n this.head = null\n this.tail = null\n } else {\n this.tail = poppedNode.prev\n this.tail.next = null\n poppedNode.prev = null\n }\n this.length--\n return poppedNode\n }", "pop() {\n const value = this.elements.shift()\n this.top--\n return value\n }", "deal(){\n return this.deck.pop();\n }", "pop(){\n if(!this.head){\n return null\n }else{\n const temp = this.head\n this.head = this.head.next\n this.length -=1\n return temp.value\n }\n\n }", "pop() {\n if (this.isEmpty()) {\n return null;\n }\n return this.data.shift();\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 }", "function pop(b) {\n if (b.population < 200000) {\n return console.log(b.name);\n }\n }", "function pop() {\r\n this.stack.pop();\r\n}", "function PopArg() {\r\n}", "function POP(state) {\n if (exports.DEBUG) console.log(state.step, 'POP[]');\n\n state.stack.pop();\n}", "desapilar() {\n if (!this.vacia()) {\n this.cant--;\n return this.element.pop();\n } else {\n return null;\n }\n\n }", "pop() {\n return this.items.removeHead();\n }", "pop(){\n return this.items.pop();\n }", "dispenseCard(){\n let card = undefined;\n card = this.drawPile.pop();\n return card;\n }", "pop(){\n if (this.size === 0){\n return null\n }\n let oldFirst = this.first;\n // only 1 node\n if (this.first === this.last){\n this.last = null;\n }\n this.first = oldFirst.next;\n oldFirst.next = null; // remove connection to the stack\n this.size--;\n return oldFirst.val;\n }", "pop() {\n if (!this.head) return null;\n let currentNode = this.head;\n let previous;\n \n while (currentNode.next) {\n previous = currentNode;\n currentNode = currentNode.next;\n }\n\n const popped = currentNode.value;\n \n if (!this.head.next) {\n this.head = null;\n } else {\n previous.next = null;\n }\n return popped;\n }", "pop(){\n // set item to last element of array\n const item = this.data[this.length - 1];\n\n // delete item\n delete this.data[this.length - 1];\n\n // reduce length by 1\n this.length--;\n\n return this.data;\n }", "pop() {\n if(this.head === null){\n return null;\n }\n\n const poppedVal = this.tail.val;\n\n if(this.head === this.tail){\n this.head = null;\n this.tail = null;\n this.length --;\n return poppedVal;\n }\n\n let current = this.head;\n while(current.next !== this.tail){\n current = current.next;\n }\n\n this.tail = current;\n current.next = null;\n this.length --;\n return poppedVal;\n }", "pop() {\n let current, newTail;\n current = this.head;\n newTail = current;\n if (this.length === 0) {\n return undefined;\n } else if (this.length > 1) {\n while (current.next) {\n newTail = current;\n current = current.next;\n }\n this.tail = newTail;\n this.tail.next = null;\n this.length--;\n return current;\n } else if (this.length === 1) {\n this.head = null;\n this.tail = null;\n this.length--;\n return current;\n }\n }", "popFromQueue() {\n this.shiftNextSprites()\n\n let tetromino = this.queue.shift()\n tetromino.reset()\n\n this.fillQueueWithBag()\n return tetromino\n }", "pop(){\n if (this.length === 0) return undefined;\n if (this.length === 1) {\n let popVal = this.head;\n this.head = null;\n this.tail = null;\n this.length--;\n return popVal;\n }\n else {\n let oldTail = this.tail;\n this.tail = oldTail.prev;\n this.tail.next = null;\n this.length--;\n return oldTail;\n }\n\n }", "function stackPop() {\n if( regSP < 0x100 ) {\n value = memory[regSP+0x100];\n regSP++;\n return value;\n } else {\n message( \"Stack empty\" );\n codeRunning = false;\n return 0;\n }\n}", "pop() {\n // If DLL is empty, return -1;\n if (!this.head) {\n return -1;\n }\n\n // Set a pointer to tail node (this will be the node which is removed)\n const removedNode = this.tail;\n\n // If DLL only has 1 node, reset DLL to be empty DLL\n if (this.size === 1) {\n this.head = null;\n this.tail = null;\n }\n // Otherwise, remove the tail node and update the tail pointer\n else {\n // Set a pointer to tail.prev\n const newtail = this.tail.prev;\n\n // Set next pointer of newtail to point to null\n newtail.next = null;\n\n // Set prev pointer of tail to point to null\n this.tail.prev = null;\n\n // Set this.tail to point to newtail\n this.tail = newtail;\n\n // Connect the head to the tail\n this.head.prev = this.tail;\n\n // Connect the tail to the head\n this.tail.next = this.head;\n }\n\n this.size--;\n return removedNode;\n }", "pop() {\n if (!this.first) {\n return null;\n }\n let returnedNode = this.first;\n if (this.first === this.last) {\n this.last = null;\n }\n this.first = this.first.next;\n --this.size;\n return returnedNode.value;\n }", "function slurpDirt() {\n let index = dirtLeft.findIndex(\n (e) => JSON.stringify(e) === JSON.stringify(position)\n );\n if (index !== -1) {\n dirtLeft.splice(index, 1);\n dirtCleared++;\n }\n }", "pop(){\n return this.items.pop();\n }", "pop() {\n // Check if there is a head.\n // Return undefined. \n if(!this.head) return undefined;\n // Store the tail in targetNode\n let targetNode = this.tail;\n // Check if the length is 1\n if(this.length == 1) { \n // set head and tail to null\n this.head = null;\n this.tail = null;\n }\n else {\n // Update tail to targetNOde.prev \n this.tail = targetNode.prev; \n // set tail.next to null\n this.tail.next = null;\n // Update the targetNode prev to be null. \n targetNode.prev = null; \n }\n // Decrement the length\n this.length--;\n // Return targetNode\n return targetNode;\n }", "pop() {\n return this.stack.pop();\n }", "delete() {\n const temp = this.storage.shift();\n this.size--;\n for (let i = 0; i < this.size; i++) {\n this.siftDown(i);\n } return temp;\n }", "pop() {\n if (!this.head) return undefined\n\n let poppedNode = this.tail\n\n if (this.length === 1) {\n this.head = null\n this.tail = null\n } else {\n this.tail = poppedNode.prev\n this.tail.next = null\n poppedNode.prev = null\n }\n\n this.length--\n return poppedNode\n }", "function POP(state) {\n if (DEBUG) console.log(state.step, 'POP[]');\n\n state.stack.pop();\n}", "popAt(stackIndex) {\n if(this.stackSet[stackIndex] === \"undefined\"){\n return undefined;\n }\n if(stackIndex === this.stackSet.length - 1){\n if(this.stackSet[stackIndex].data.length === 0){\n return undefined;\n }else{\n let poppedElementLast = this.stackSet[stackIndex].data.pop();\n return poppedElementLast;\n }\n }\n\n let poppedElement = this.stackSet[stackIndex].data.pop();\n for(let i = stackIndex + 1;i<this.stackSet.length;i++){\n if(i === this.stackSet.length - 1){\n if(this.stackSet[i].data.length === 0){\n this.stackSet[i-1].length--;\n this.stackSet.pop();\n break;\n }else{\n let shiftedElement = this.stackSet[i].data.shift();\n this.stackSet[i].length--;\n this.stackSet[i-1].data.push(shiftedElement);\n break;\n }\n }\n let shiftedElement = this.stackSet[i].data.shift();\n this.stackSet[i-1].data.push(shiftedElement);\n }\n return poppedElement;\n }", "pop(value) {\n if (!this.length) {\n return null;\n }\n const deletedValue = this.stackData.pop();\n this.length--;\n if (!this.length) {\n this.bottom = null;\n this.top = null;\n }\n return deletedValue;\n }", "pop (){\n if (this.count === 0) {\n return undefined;\n }\n this.count--;\n let result = this.items[this.count];\n delete this.items[this.count];\n return result;\n }", "pop() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function* () {\n let outlet = this.topOutlet;\n while (outlet) {\n if (yield outlet.pop()) {\n break;\n }\n else {\n outlet = outlet.parentOutlet;\n }\n }\n });\n }", "dequeue() {\n if (this.head !== null) {\n return 'No item !'\n } else {\n let itemToPop = this.head;\n this.head = this.head.next;\n return itemToPop;\n }\n }", "togglePopper() { \n this.atBeginning = !this.atBeginning; //! refers to opposite of atBeginning which is atEnd. Alternates the atBeginning value. This method when called will reverse the value each time.\n return this.atBeginning ? console.log(this.arr.pop()) : console.log(this.arr.shift());\n }" ]
[ "0.65960455", "0.6482743", "0.64658666", "0.63852954", "0.6162876", "0.6151666", "0.6146722", "0.6090012", "0.6076205", "0.59674066", "0.59550023", "0.59516966", "0.5943689", "0.5901418", "0.582198", "0.58213735", "0.58200467", "0.58169854", "0.580626", "0.58025384", "0.5799489", "0.57802594", "0.5765586", "0.5764663", "0.57377005", "0.5733843", "0.57212794", "0.5712994", "0.5694164", "0.5693687", "0.56914175", "0.56897646", "0.56891483", "0.56855786", "0.56732136", "0.5652185", "0.56485784", "0.5648273", "0.5638144", "0.5624829", "0.5622518", "0.5618782", "0.56183386", "0.56133205", "0.56109726", "0.5605361", "0.56037414", "0.55964965", "0.5585238", "0.55831194", "0.55825067", "0.55752873", "0.55715334", "0.55715", "0.5565515", "0.5548158", "0.5533802", "0.55193776", "0.5510445", "0.5507736", "0.55055207", "0.55017716", "0.5498109", "0.5497582", "0.5492605", "0.54916286", "0.5488211", "0.5487622", "0.54809475", "0.5478711", "0.547415", "0.5473841", "0.54735184", "0.5472033", "0.5471725", "0.54556", "0.54511964", "0.5449748", "0.5445497", "0.54408133", "0.543164", "0.5429902", "0.5424001", "0.5423406", "0.5407881", "0.54017", "0.54016376", "0.54004955", "0.5399564", "0.5392675", "0.5390826", "0.536314", "0.53579", "0.5354295", "0.5352251", "0.5351968", "0.5351157", "0.53491277", "0.5348065", "0.5342438", "0.5339462" ]
0.0
-1
Stop execution, and display a message
function endGame(){ writeToConsole("Total moves = " + moves + " out of " + (game.board_size.width)*(game.board_size.height)); throw new Error('This is not an error.'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Stop() {}", "stop() {}", "function stop() {\n\t\trunning = false;\n\t}", "stop() { this.#runtime_.stop(); }", "function stop(){\n\tstopPressed = 1;\n\tenableRunBtn(true);\n\topt1.disabled = false;\n\tsaveBtn.disabled = false;\n\tloadBtn.disabled = false;\n\tprogramSelect.disabled = false;\n\tstepLabel.innerHTML = \"Stopped. Steps: \" + general.stepCount;\n}", "function stop () {\n stopped = true\n }", "function die(message) {\n\t\t\tstop();\n\t\t\talert(message);\t\t\n\t\t}", "terminating() {}", "stopped () {}", "function stop() {\n if (isStopped) {\n return;\n }\n\n isStopped = true;\n }", "function stop() {\n\t\tif (!_stopFn) return;\n\t\t_stopFn();\n\t}", "stop(){\n \n }", "function stop() {\n _stop.apply(null, utils.toArray(arguments));\n }", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\n id(false);\n}", "function stop(id) {\r\n id(false);\r\n}", "function stop(id) {\r\n id(false);\r\n}", "function stop(id) {\r\n id(false);\r\n}", "function stopScript() {\n stop = true;\n stopWorking(true, false);\n }", "function stop(id) {\n id(false);\n}", "stop() {\n this.running = false;\n }", "function STOP() {\n return 1;\n }", "stopped() { }", "function stop() {\n // Clears our intervalId\n // We just pass the name of the interval to the clearInterval function.\n clearInterval(intervalId);\n console.log(\"done\");\n }", "function ptolemyStop(){\n// Do nothing\n}", "stop () {\n this.continue = false\n if (this.abortController) {\n this.abortController.abort()\n }\n }", "function exitDemo() {\n\tdemo_msgs = undefined;\n\tdemo_goal = undefined;\n\talertArea.style.display = 'none';\n\tloadWorkspace();\n\tstopCode();\n}", "stopped() {\r\n\r\n\t}", "stop() {\n this.running = false;\n }", "function stop(){\n noLoop();\n}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "stopped() {}", "function stop(id) {\n\t id(false);\n\t}", "function stopExecution() {\n // Request stop all tasks.\n _stopRequested = true;\n}", "terminate() {\n this.running = false;\n }", "function interrupt() {\n if (stopCurrentExecution) {\n stopCurrentExecution();\n stopCurrentExecution = null;\n }\n }", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stopped() {\n\n\t}", "stop(){\n //TODO: implement me.\n }", "stop() {\n this._child.send({\n cmd: 'stop',\n data: null\n });\n }", "stop() {\n if (this.state !== 2) return;\n this._state = 3;\n this.emit('stop');\n }", "function stop () {\n text = \"Has detenido el juego.\"\n result = \"Has acertado \" + correct + \" respuestas y has fallado \" + fail + \".\"\n document.getElementById('text').innerHTML = (text)\n document.getElementById('result').innerHTML = (result)\n clearTimeout(timer)\n}", "stop() {\n this.isStopped = true;\n }", "function stop() {\n console.log(\"commonHost.js: stop() invoked, stop() does nothing.\");\n}", "stopRunning() {\n Scriptorium.turtleCmd.stopTurtle(true, undefined)\n this.changeStopButton()\n if (this.isPC)\n this.editorArea.focus()\n }", "end(){\n this.request({\"component\":this.component,\"method\":\"end\",\"args\":[\"\"]})\n this.running = false\n }", "async stopped() {}", "async stopped() {}", "async stopped() {}", "async stopped() {}", "async stopped() {}", "stop() {\n this.continue = false\n }", "function stop(){\r\n\tstopped = 1;\r\n}", "stop() {\n // TODO: set a 'stop' mode, that waits for a button press\n // TODO: check if this instruction's overloaded to also change the CPU clock\n // speed on GBC\n return 0;\n }", "stop() {\n Notice.log(this.getId(), 'stop()');\n const {ACTIVE} = PluginState;\n try {\n this.checkValid();\n //TODO Fragment\n //TODO persistStopOptions(options)\n if (!this.isInStates([ACTIVE])) {\n return;\n }\n privates.doStop.call(this);\n } catch (e) {\n Notice.warn(this, e);\n }\n }", "stopped () {\n\n }", "stopped () {\n\n }", "stopped () {\n\n }", "stop() {\n if (!this.pause) {\n game.message = 'Press Enter to continue!';\n this.pause=true;\n clearInterval(this.move);\n clearInterval(this.generate);\n console.clear();\n console.log('Game Status: ',this.status(),'\\nAll Objects',this.activeObjects, '\\nMonsters',this.activeEnemies);\n }\n }", "stop(id){\n clearInterval(id);\n this.sucess=true;\n }", "function stop() {\n\n clearInterval(timerId);\n displayResults();\n }", "stop() {\n if (this.state === _VideoSIPGWConstants__WEBPACK_IMPORTED_MODULE_3__[\"STATE_OFF\"] || this.state === _VideoSIPGWConstants__WEBPACK_IMPORTED_MODULE_3__[\"STATE_FAILED\"]) {\n logger.warn('Video SIP GW session already stopped or failed!');\n return;\n }\n\n this._sendJibriIQ('stop');\n }", "function stopSom() {\n isRunning = false;\n}", "function stopEval() {\n G.continue = false;\n}", "function abort() {\r\n console.log.apply(null, arguments);\r\n program.help();\r\n process.exit(1);\r\n}", "stopped() {\n\n }", "stopped() {\n\n }", "stopped() {\n\n }", "function Stop() {\n}", "stop() {\n this.stopEventListeners();\n this.stopJobStatusUpdates();\n this.stopLogAutoFetch();\n if (this.requestLoop) {\n clearTimeout(this.requestLoop);\n }\n if (this.fsm) {\n this.fsm.stop();\n }\n if (this.runClock) {\n this.runClock.stop();\n }\n this.state.stopped = false;\n if (this.container) {\n this.container.innerHTML = '';\n }\n }", "async stopped() {\n\n\t}", "async stopped() {\n\n\t}", "async stopped() {\n\n\t}" ]
[ "0.7391522", "0.7187698", "0.68688756", "0.6823072", "0.68135434", "0.6739437", "0.6690364", "0.66731715", "0.6669365", "0.6596162", "0.65907514", "0.6568806", "0.6548563", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6547836", "0.6545161", "0.6545161", "0.6545161", "0.6537359", "0.65214515", "0.6516359", "0.65086037", "0.65053993", "0.6500791", "0.6497748", "0.6489205", "0.6469671", "0.6462254", "0.64563644", "0.6455257", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6442693", "0.6434788", "0.64300764", "0.64221287", "0.64105684", "0.64101666", "0.64101666", "0.64101666", "0.64101666", "0.64101666", "0.64101666", "0.64101666", "0.64101666", "0.64101666", "0.64033824", "0.6398587", "0.6392542", "0.63925284", "0.6380961", "0.6377072", "0.6371735", "0.63686687", "0.6367664", "0.6367664", "0.6367664", "0.6367664", "0.6367664", "0.6367058", "0.63632077", "0.6359278", "0.63478744", "0.6345752", "0.6345752", "0.6345752", "0.6329357", "0.632715", "0.63234985", "0.6317167", "0.63162434", "0.6304521", "0.6291027", "0.6286501", "0.6286501", "0.6286501", "0.6278968", "0.62734675", "0.6269887", "0.6269887", "0.6269887" ]
0.0
-1
Load the game, and create the board.
function loadGame(){ game = getJSON("http://navy.hulu.com/create?user=rhassan@andrew.cmu.edu"); board = []; // Display game information writeToConsole("GAME ID = " + game.game_id); writeToConsole("SHIPS = [" + game.ship_sizes + "]"); writeToConsole("BOARD = (" + game.board_size.width + ", " + game.board_size.height + ")"); // Intialize board to default values for(var w=0; w<game.board_size.width; w++){ board[w] = []; for(var h=0; h<game.board_size.height; h++){ board[w][h]=0; // signifies uninspected } } ships = game.ship_sizes; raiseSuccess("Game intialized"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function create_game_board(){\n update_number_of_players();\n create_player_areas();\n // create new game\n game_instance.deal_cards();\n \n render_cards();\n apply_card_event_handlers();\n \n game_instance.determine_winners();\n // determine_winners();\n // show_best_hands(); //for diagnostics\n }", "load() {\n if (!!this.saveArray) {\n this.board = this.saveArray[0];\n this.currentColour = this.saveArray[1];\n this.currentColour == 'white' ? this.otherColour = 'black' : this.otherColour = 'white';\n this.displayBoard();\n console.log(\"game loaded\");\n }\n }", "function loadGame() {\n ticTacToeBoard.createBoard();\n loadStatus();\n loadHistory();\n //display to index.htm\n document.getElementById(\"game\").innerHTML = ticTacToeBoard.displayBoard();\n}", "function initGame() {\n gBoard = buildBoard(gLevel);\n renderBoard();\n}", "function loadBoard(campaign, state) {\n var lev = state.current_level\n var boardConfig = campaign[lev.world_index].levels[lev.level_index].level\n\n var board = {\n num_cols: boardConfig.num_cols,\n num_rows: boardConfig.num_rows,\n coins: cloneDeep(boardConfig.coins),\n blocks: cloneDeep(boardConfig.blocks),\n traps: cloneDeep(boardConfig.traps),\n coinsCollected: 0\n }\n\n /**\n * Contains all data that is needed to visualize the board and game state.\n * How can you tell what data belongs in board.visualize?\n * Data should appear in board.visualize if, and only if, the data is\n * ignored in \"headless\" mode (i.e. non-visualization mode).\n */\n board.visualize = {\n\n // mutable data that persists across simulator steps\n persist: {},\n\n // immutable data that is valid for only one simulation step. Every\n // simulation step begins by erasing the contents of step.\n step: {}\n }\n\n if (\"hint\" in boardConfig) {\n board.visualize.persist.hint = boardConfig.hint\n }\n \n // the index of the bot being programmed by the code editor\n // TODO: this should be bot __id__ not bot __index__\n // TODO: this should go into board.visualize.persist\n board.visualize.programming_bot_index = boardConfig.programming_bot_index\n\n board.win_conditions = cloneDeep(boardConfig.win_conditions)\n\n board.constraints = cloneDeep(boardConfig.constraints)\n\n /**\n * The awards that will be given to the player once the level is\n * completed.\n */\n board.badges = cloneDeep(boardConfig.badges)\n\n // set to true once victory has been achieved\n board.victory = false\n\n board.markers = newMatrix(\n board.num_cols,\n board.num_rows,\n function () {\n return newMatrix(\n Direction.NUM_DIRECTIONS,\n BotColor.NUM_COLORS, undefined)\n })\n\n board.bots = []\n\n for (var i = 0; i < boardConfig.bots.length; i++) {\n var configBot = boardConfig.bots[i]\n var program = compilePuzzleCode(configBot.program, board)\n\n assert(program.constraintViolation == false,\n \"loadBoard: program.constraintViolation == false\")\n\n if (program.instructions == null) {\n // TODO: handle this error better\n console.error(\"Could not compile: \" + configBot.program)\n } else {\n var bot = {\n // bot.id is immutable, and unique only w.r.t. this board\n id: i,\n cellX: configBot.cellX,\n cellY: configBot.cellY,\n botColor: configBot.botColor,\n facing: configBot.facing,\n ip: 0,\n program: program\n }\n board.bots.push(bot)\n }\n }\n\n // newly created bots get id == board.next_bot_id\n // don't need to worry about int overflows on bot ids because JS uses floats\n board.next_bot_id = boardConfig.bots.length\n\n return board\n}", "function createBoard() {\n\tconst board = document.querySelector('.game');\n\tconst rows = document.createElement('tr');\n\n\t//Create the head row\n\trows.setAttribute('id', 'HeaderRow');\n\trows.classList.add('row');\n\trows.addEventListener('click', (e) => {\n\t\tgamePlay(e);\n\t});\n\n\t//Create the header column and append to header row\n\tfor (let col = 0; col < WIDTH; col++) {\n\t\tconst cols = document.createElement('td');\n\t\tcols.setAttribute('id', `c${col}`);\n\t\tcols.classList.add('colHead');\n\t\trows.append(cols);\n\t}\n\n\t// Append to board\n\tboard.append(rows);\n\n\t//Create the remaining boards\n\tfor (let myRow = 0; myRow < HEIGHT; myRow++) {\n\t\tconst row = document.createElement('tr');\n\t\tfor (let myCol = 0; myCol < WIDTH; myCol++) {\n\t\t\tconst cols = document.createElement('td');\n\t\t\tcols.setAttribute('id', `r${myRow}c${myCol}`);\n\t\t\tcols.dataset.row = myRow;\n\t\t\tcols.dataset.col = myCol;\n\t\t\tcols.classList.add('col');\n\t\t\trow.append(cols);\n\t\t}\n\t\tboard.append(row);\n\t}\n}", "function createBoard() {\n window.board = new Board(4, 13);\n createCards();\n window.board.placeCards();\n}", "function importBoard() {\n let grid = board.createGrid(); // will return our board element\n // let surface_element = document.createElement('div')\n // surface_element.style.position = \"relative\"\n // surface_element.style\n obstacles = obstacle.creationBasedOnArray(\n ArrayForObstacles[\"level\" + currentLevel]\n );\n parent_container.appendChild(grid); // assign the location in our dom we want to put it in\n}", "function game_initBoard(){\n\t//get map from data.\n\tvar mapdata=data_map[GLOBAL['gid']].map;\n\tvar spawntiles=[];\n\tGLOBAL['board']=[];\n\t//copy data into a board of tile objects\n\tfor(var i=0;i<mapdata.length;i++){\n\t\tGLOBAL['board'][i]=[];\n\t\tfor(var j=0;j<mapdata[i].length;j++){\n\t\t\tvar tile={x:i,y:j,type:mapdata[i][j]};\n\t\t\ttile.color=Math.round(170+(Math.random()*30));\n\t\t\tif(tile.type==2){\n\t\t\t\tspawntiles.push(tile);\n\t\t\t}\n\t\t\tGLOBAL['board'][i][j]=tile;\n\t\t}\n\t}\n\tvar xmax=46*GLOBAL['board'].length;\n\tvar ymax=46*GLOBAL['board'][0].length;\n\t//share the board offset, and spawn tiles.\n\n\tGLOBAL['gamevars'].xoffset=Math.round(($('#game')[0].width-xmax)/2);\n\tGLOBAL['gamevars'].yoffset=Math.round(($('#game')[0].height-ymax)/2);\n\tGLOBAL['gamevars'].spawnpoints=spawntiles;\n}", "function initGame() {\n\tdebugAlert(\"initGame\", false);\n\tif(gGameActive === true) return;\n\t\n\tgBoardRowCount = 8;//document.getElementById(\"row\").value;\n\tgBoardColumnCount = 6;//document.getElementById(\"column\").value;\n\t\n\t//Create the play area canvas and listeners\n\tgPlayAreaCanvas = createCanvas(getPlayAreaWidth(), getPlayAreaHeight());\n\tgPlayAreaCanvasDrawingContext = gPlayAreaCanvas.getContext(\"2d\");\n\taddListenerToElement(gPlayAreaCanvas,onMouseMovePlayArea,\"mousemove\");\n\taddListenerToElement(gPlayAreaCanvas,onMouseClickPlayArea,\"click\");\n\t\n\t//Create the tile chooser canvas and listeners\n\tgTileChooserCanvas = createCanvas(getTileLayoutWidth(), getTileLayoutHeight());\n\tgTileCanvasDrawingContext = gTileChooserCanvas.getContext(\"2d\");\n\taddListenerToElement(gTileChooserCanvas, onMouseClick,\"click\");\n\taddListenerToElement(gTileChooserCanvas, onDoubleClick,\"dblclick\");\n\taddListenerToElement(gTileChooserCanvas,onMouseMoveTileArea,\"mousemove\");\n\n\t//Create the tiles\n\tiRightElbow = new Image();\n\tiRightElbow.src = \"elbow.png\";\n\tiLeftElbow = new Image();\n\tiLeftElbow.src = \"elbow2.png\";\n\t\n\tiStraight = new Image();\n\tiStraight.src = \"straight.png\";\n\tiPlumber = new Image();\n\tiPlumber.src = \"plumber.jpg\";\n\tiToilet = new Image();\n\tiToilet.addEventListener(\"load\", function(){\n\t\t//after the resources are loaded start a new game\n\t\tflushHandle();\n\t\tnewGame();\n\t\tgGameActive = true;\n\t}, false);\n\tiToilet.src =\"toilet.png\";\n}", "function load() {\r\n\t\tvar loaded = $.parseJSON(localStorage.getItem(STORAGE_NAME)),\r\n\t\t\tcondition = loaded.condition;\r\n\t\tSIZE = loaded.size;\r\n\t\tTOTALCELLS = SIZE*SIZE;\r\n\t\tMINES = loaded.minecells.length;\r\n\t\tcells = loaded.cells;\r\n\t\tminecells = loaded.minecells;\r\n\t\ttime = loaded.time;\r\n\t\tclicks = loaded.clicks;\r\n\t\tnewGame(true, loaded.board, condition);\r\n\t}", "function load() {\n if (generate) return\n\n\n const canvas = canvasRef.current;\n canvas.width = width;\n canvas.height = height;\n ctx.current.clearRect(0, 0, canvasRef.current.width, canvasRef.current.height);\n let resGrid = buildGrid()\n\n let colDiff = Math.round((resGrid.length - loadGrid.grid.length) / 2)\n let rowDiff = Math.round((resGrid[0].length - loadGrid.grid[0].length) / 2)\n\n if (resGrid.length > loadGrid.grid.length) {\n for (let col = 0; col < loadGrid.grid.length; col++) {\n for (let row = 0; row < loadGrid.grid[col].length; row++) {\n resGrid[col + colDiff][row + rowDiff] = loadGrid.grid[col][row]\n }\n }\n setGrid(resGrid)\n } else {\n for (let col = 0; col < resGrid.length; col++) {\n for (let row = 0; row < resGrid[col].length; row++) {\n resGrid[col][row] = loadGrid.grid[col - colDiff][row - rowDiff];\n }\n }\n\n setGrid(resGrid)\n }\n renderLifeBox()\n genCount.current = 0\n }", "function initLoad()\n{\n console.log('page load');\n myGame.buildBoard();\n myGame.nextMove();\n myGame.reset();\n}", "function initialise() {\n\tboard = new Board();\n\n\tvar handler = createDiv();\n\thandler.parent('#bagh-chal');\n\thandler.id('handler');\n\n\t// --- Game Properties ---\n\tvar propertiesDiv = createDiv();\n\tpropertiesDiv.child(createElement('h3', 'Game'));\n\tpropertiesDiv.parent('#handler');\n\tpropertiesDiv.id('properties');\n\n\t// Turn\n\tvar turnSpan = createSpan('Turn: ');\n\tturnSpan.parent('#properties');\n\tturnSpan.child(turnP = createP('?'));\n\n\t// Goats In-Hand\n\tvar goatsInHandSpan = createSpan('Goats In-Hand: ');\n\tgoatsInHandSpan.parent('#properties');\n\tgoatsInHandSpan.child(goatsInHandP = createP('?'));\n\n\t// Goats Captured\n\tvar goatsCapturedSpan = createSpan('Goats Captured: ');\n\tgoatsCapturedSpan.parent('#properties');\n\tgoatsCapturedSpan.child(goatsCapturedP = createP('?'));\n\n\t// Tigers Trapped\n\tvar tigersTrappedSpan = createSpan('Tigers Trapped: ');\n\ttigersTrappedSpan.parent('#properties');\n\ttigersTrappedSpan.child(tigersTrappedP = createP('?'));\n\n\t// Status\n\tvar statusSpan = createSpan('Status: ');\n\tstatusSpan.parent('#properties');\n\tstatusSpan.child(statusP = createP('Running').class('running'));\n\n\t// --- Controls ---\n\tvar controlsDiv = createDiv();\n\tcontrolsDiv.parent('#handler');\n\tcontrolsDiv.id('controls');\n\tcontrolsDiv.child(createElement('h3', 'Controls'));\n\n\t// Game Mode\n\tcontrolsDiv.child(gameMode = createSelect());\n\tgameMode.option('Game Mode');\n\tgameMode.option('Player vs Player', 0);\n\tgameMode.option('Player vs AI', 1);\n\tgameMode.option('AI vs AI', 2);\n\tgameMode.value(1);\n\tgameMode.changed(updateHandler);\n\n\t// Play As\n\tcontrolsDiv.child(playAsSelect = createSelect());\n\tplayAsSelect.option('Play As');\n\tplayAsSelect.option('Tiger', 0);\n\tplayAsSelect.option('Goat', 1);\n\tplayAsSelect.value(playAsTiger ? 0 : 1);\n\tplayAsSelect.changed(changePlayAs);\n\n\t// Goat Algorithm/Depth\n\tcontrolsDiv.child(goatP = createP('Goat'));\n\tcontrolsDiv.child(goatAlgorithm = createSelect());\n\tgoatAlgorithm.option('Algorithm');\n\tgoatAlgorithm.option('Minimax', 0);\n\tgoatAlgorithm.option('Alpha-Beta', 1);\n\tgoatAlgorithm.option('MCTS', 2);\n\tgoatAlgorithm.value(1);\n\tgoatAlgorithm.changed(updateHandler);\n\n\tcontrolsDiv.child(goatDepth = createSelect());\n\tgoatDepth.option('Depth');\n\tgoatDepth.option('Depth 1 (Very Easy)', 1);\n\tgoatDepth.option('Depth 2 (Easy)', 2);\n\tgoatDepth.option('Depth 3 (Moderate)', 3);\n\tgoatDepth.option('Depth 4 (Hard)', 4);\n\tgoatDepth.option('Depth 5 (Very Hard)', 5);\n\tgoatDepth.value(3);\n\tgoatDepth.changed(reset);\n\n\tcontrolsDiv.child(goatTime = createSelect());\n\tgoatTime.option('Time');\n\tgoatTime.option('2s', 2);\n\tgoatTime.option('4s', 4);\n\tgoatTime.option('6s', 6);\n\tgoatTime.option('8s', 8);\n\tgoatTime.option('10s', 10);\n\tgoatTime.value(2);\n\tgoatTime.changed(reset);\n\n\t// Tiger Algorithm/Depth\n\tcontrolsDiv.child(tigerP = createP('Tiger'));\n\tcontrolsDiv.child(tigerAlgorithm = createSelect());\n\ttigerAlgorithm.option('Algorithm');\n\ttigerAlgorithm.option('Minimax', 0);\n\ttigerAlgorithm.option('Alpha-Beta', 1);\n\ttigerAlgorithm.option('MCTS', 2);\n\ttigerAlgorithm.value(1);\n\ttigerAlgorithm.changed(updateHandler);\n\n\tcontrolsDiv.child(tigerDepth = createSelect());\n\ttigerDepth.option('Depth');\n\ttigerDepth.option('Depth 1 (Very Easy)', 1);\n\ttigerDepth.option('Depth 2 (Easy)', 2);\n\ttigerDepth.option('Depth 3 (Moderate)', 3);\n\ttigerDepth.option('Depth 4 (Hard)', 4);\n\ttigerDepth.option('Depth 5 (Very Hard)', 5);\n\ttigerDepth.value(3);\n\ttigerDepth.changed(reset);\n\n\tcontrolsDiv.child(tigerTime = createSelect());\n\ttigerTime.option('Time');\n\ttigerTime.option('2s', 2);\n\ttigerTime.option('4s', 4);\n\ttigerTime.option('6s', 6);\n\ttigerTime.option('8s', 8);\n\ttigerTime.option('10s', 10);\n\ttigerTime.value(2);\n\ttigerTime.changed(reset);\n\n\t// Delay\n\tdelaySpan = createSpan('Min. Simulation Delay');\n\tdelaySpan.parent('#controls');\n\tdelaySpan.child(delaySlider = createSlider(0, 500, 250));\n\n\t// Reset\n\tcontrolsDiv.child(resetButton = createButton('Reset'));\n\tresetButton.mousePressed(reset);\n\n\t// Pause\n\tcontrolsDiv.child(pauseButton = createButton('Pause'));\n\tpauseButton.mousePressed(togglePause);\n\n\t// --- AI Debugging ---\n\tdebuggingDiv = createDiv();\n\tdebuggingDiv.parent('#handler');\n\tdebuggingDiv.id('debugging');\n\tdebuggingDiv.child(createElement('h3', 'AI Debugging'));\n\n\t// Iterations\n\tvar iterationsSpan = createSpan('Iterations: ');\n\titerationsSpan.parent('#debugging');\n\titerationsSpan.child(countP = createP('?'));\n\n\t// Time\n\tvar timeSpan = createSpan('Time to Run: ');\n\ttimeSpan.parent('#debugging');\n\ttimeSpan.child(timeP = createP('?'));\n\n\t// Score\n\tvar scoreSpan = createSpan('Score/Wins: ');\n\tscoreSpan.parent('#debugging');\n\tscoreSpan.child(scoreP = createP('?'));\n\n\t// Tiger Wins\n\t//var scoreSpan = createSpan('Tiger Wins: ');\n\t//scoreSpan.parent('#debugging');\n\t//scoreSpan.child(tigerWinsP = createP('?'));\n\n\t// Goat Wins\n\t//var scoreSpan = createSpan('Goat Wins: ');\n\t//scoreSpan.parent('#debugging');\n\t//scoreSpan.child(goatWinsP = createP('?'));\n\n\t// Draws\n\t//var scoreSpan = createSpan('Draws: ');\n\t//scoreSpan.parent('#debugging');\n\t//scoreSpan.child(drawsP = createP('?'));\n\n\t// Update what's disabled/hidden\n\t$('select > option:first-child').attr('disabled', true);\n\tupdateHandler();\n}", "create () {\n /****game.var adds a new \"class variable\" to game state, like in other languages****/\n\n //create background\n var background = game.add.sprite(game.world.centerX, game.world.centerY, 'background');\n background.anchor.set(0.5);\n background.width = game.screenWidth;\n background.height = 700;\n\n game.boardHeight = 102\n game.boardOffset = 15\n game.pieceWidth = 38\n game.pieceHeight = 25\n\n game.squareSize = 50\n //the size of the board, i.e nxn board, 3x3 for tictactoe\n game.n = 3\n game.isXTurn = true\n game.isDraw = false\n game.magicSquare = false\n game.firstTime = true\n\n\n game.turns = 0\n game.linesToAnimate = 0\n\n game.boardTurns = [];\n for (var i=0; i < game.n; i++) {\n game.boardTurns[i]=new Array(game.n)\n }\n\n for (var i=0; i < game.n; i++)\n {\n for (var j=0; j < game.n; j++)\n {\n game.boardTurns[i][j] = 0\n }\n }\n\n console.log(\"First Time\")\n\n //the top left coordinate to place the whole board at, we will make game\n //not hardcoded in the furture to center the board, but I believe we need jQuery\n //to get window size and I didn't feel like learning that right now\n game.startingX = game.screenWidth/2 - game.cache.getImage('board').width / 1.2\n game.startingY = 80\n\n //intialize waiting status to false, update accordingly later if multiplayer\n game.waiting = false\n\n //record of the pieces that have been placed\n game.placedPieces = []\n\n //record of the big pieces that have been placed\n game.bigPlacedPieces = []\n\n game.bigBoardLogic = []\n for (var i=0; i < game.n; i++) {\n game.bigBoardLogic[i]=new Array(game.n)\n }\n\n for (var i=0; i < game.n; i++)\n {\n for (var j=0; j < game.n; j++)\n {\n game.bigBoardLogic[i][j] = \"open\"\n }\n }\n\n game.magicBoardLogic = []\n for (var i=0; i < game.n; i++) {\n game.magicBoardLogic[i]=new Array(game.n)\n }\n\n for (var i=0; i < game.n; i++)\n {\n for (var j=0; j < game.n; j++)\n {\n game.magicBoardLogic[i][j] = \"null\"\n }\n }\n\n //asign functions ot the game object, so they can be called by the client\n this.assignFunctions()\n\n game.cursorSquares = []\n for (var i=0; i < game.n; i++) {\n game.cursorSquares[i]=new Array(game.n)\n }\n\n game.redSquares = []\n for (var i=0; i < game.n; i++) {\n game.redSquares[i]=new Array(game.n)\n for (var j=0; j < game.n; j++)\n {\n game.redSquares[i][j]=new Array(game.n)\n for (var k=0; k < game.n; k++)\n {\n game.redSquares[i][j][k]=new Array(game.n)\n }\n }\n }\n\n for (var i=0; i < game.n; i++)\n {\n for (var j=0; j < game.n; j++)\n {\n game.cursorSquares[i][j] = game.addSpriteWithWidth(game.startingX + i*game.squareSize*3, game.startingY + j*game.squareSize*3, 'greensquare', game.squareSize*3, game.squareSize*3)\n game.cursorSquares[i][j].alpha = 0\n for (var k=0; k < game.n; k++)\n {\n for (var l=0; l < game.n; l++)\n {\n game.redSquares[i][j][k][l] = game.addSprite(game.startingX + i*game.squareSize*3 + k*game.squareSize, game.startingY + j * game.squareSize*3 + l*game.squareSize, 'redsquare')\n game.redSquares[i][j][k][l].alpha = 0\n }\n }\n }\n }\n game.firstTime = false\n\n //create an internal representation of the board as a 2D array\n game.board = game.makeBoardAsArray(game.n)\n //create the board on screen and makes each square clickable\n game.makeBoardOnScreen()\n //add messages that display turn status, connection statuses\n this.addTexts()\n //folloowing logic is for multiplayer games\n if(game.singleplayer || game.vsAi)\n return\n\n game.previousPiece = \"\"\n //if this is the first play against an opponent, create a new player on the server\n game.startMultiplayer()\n\n }", "function boardSetup() {\n\n\tclearBoard();\n\t$('#game_info').show();\n\t// add tie break track\n\t$('#tie_break_track').append(\n\t\t$('<span/>').text('Tie Break:')\n\t);\n\tfor (i = 0; i < numPlayers; i ++) {\n\t\tvar c = tieBreak[i];\n\t\t$('#tie_break_track').append(\n\t\t\t$('<div/>')\n\t\t\t\t.addClass('tie_break_token')\n\t\t\t\t.css('background-color', playerColors[c])\n\t\t\t\t.text(Number(i+1))\n\t\t\t\t.attr('title', players[c].username)\n\t\t);\n\t\t// distribute starting resources depending on tie break order\n\t\tplayers[c].money += (startingMoney + Math.floor(i/2));\n\t\tplayers[c].numRibbons += i%2;\n\t}\n\n\t// add status bar\n\tvar $statusBar = $('<div/>').addClass('status_bar')\n\t\t.append(\n\t\t\t$('<span/>').addClass('status_bar--turn'),\n\t\t\t$('<span/>').addClass('status_bar--phase'),\n\t\t\t$('<span/>').addClass('status_bar--text')\n\t\t);\n\n\t$('#status_bar').append($statusBar);\n\n\t// add opponents' boards on the top\n\tfor (i = 0; i < numPlayers; i ++)\n\t\tif (myID != i) {\n\t\t\tvar $board = $('<div/>')\n\t\t\t\t\t.addClass('player_board')\n\t\t\t\t\t.css('background-color', playerColors[i])\n\t\t\t\t\t.val(i);\n\t\t\tvar $vase = $('<div/>').addClass('player_vase').addClass('player_vase--opponent');\n\n\t\t\tfor (j = 0; j < 3; j ++)\n\t\t\t\t$($vase).append(\n\t\t\t\t\t$('<img/>').attr('src', 'img/empty_vase.png')\n\t\t\t\t\t\t.addClass('icon--small empty_vase')\n\t\t\t\t);\n\n\t\t\tvar $upperBoard = $('<div/>').append(\n\t\t\t\t// name \n\t\t\t\t$('<span/>').text(players[i].username)\n\t\t\t\t\t.addClass('player_name'), \n\t\t\t\t// money\n\t\t\t\t$('<img/>').attr('src','img/money_icon.png')\n\t\t\t\t\t.addClass('icon--small'),\n\t\t\t\t$('<span/>').text(players[i].money)\n\t\t\t\t\t.addClass('player_money'),\n\t\t\t\t// score\n\t\t\t\t$('<img/>').attr('src','img/score_icon.png')\n\t\t\t\t\t.addClass('icon--small'),\n\t\t\t\t$('<span/>').text(players[i].score)\n\t\t\t\t\t.addClass('player_score'),\n\t\t\t\t// time\n\t\t\t\t$('<img/>').attr('src','img/time_icon.png')\n\t\t\t\t\t.addClass('icon--small'),\n\t\t\t\t$('<span/>').text(players[i].time)\n\t\t\t\t\t.addClass('player_time'),\n\t\t\t\t$('<br>'),\n\t\t\t\t$vase\n\t\t\t);\n\n\t\t\tvar $lowerBoard = $('<div/>').append(\n\t\t\t\t// ribbons\n\t\t\t\t$('<img/>').attr('src','img/ribbon_icon.png')\n\t\t\t\t\t.addClass('icon--small'),\n\t\t\t\t$('<span/>').text(players[i].numRibbons)\n\t\t\t\t\t.addClass('player_ribbon'),\n\t\t\t\t// action cubes\n\t\t\t\t$('<img/>').attr('src','img/action_cube_icon.png')\n\t\t\t\t\t.addClass('icon--small'),\n\t\t\t\t$('<span/>').text(players[i].actionCubes)\n\t\t\t\t\t.addClass('player_action_cube'),\n\t\t\t\t// number of played cards\n\t\t\t\t$('<img/>').attr('src','img/played_cards_icon.png')\n\t\t\t\t\t\t.addClass('icon--small'),\n\t\t\t\t$('<span/>').text(0)\n\t\t\t\t\t.addClass('player_number_played_cards'),\n\t\t\t\t\n\t\t\t\t$('<br>')\n\t\t\t);\n\n\t\t\tfor (j = 1; j < 4; j ++) {\n\t\t\t\tvar starColor = players[i].bonus[j-1] + 1;\n\t\t\t\t$lowerBoard.append(\n\t\t\t\t\t$('<img/>').attr('src', 'img/bonus_icon' + j + '.png')\n\t\t\t\t\t\t.addClass('icon--small')\n\t\t\t\t\t\t.css('background-color', shopColors[starColor]),\n\t\t\t\t\t$('<span/>').text(0)\n\t\t\t\t\t\t.addClass('bonus_star')\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t$($board).append(\n\t\t\t\t$upperBoard,\n\t\t\t\t$lowerBoard\n\t\t\t);\n\t\t\t$($lowerBoard).css({\n\t\t\t\t\t'background-color': playerColors[i],\n\t\t\t\t\t'z-index': 0\n\t\t\t\t})\n\t\t\t\t.addClass('lower_opponent_board')\n\t\t\t\t.hide();\n\n\t\t\t$('#opponent_board_area').append($board);\n\t\t\tplayers[i].addBoard($board);\n\t\t}\n\n\t\t$('#opponent_board_area').append(\n\t\t\t$('<button/>').text('More')\n\t\t\t\t.addClass('button button--expand_opponent_board')\n\t\t);\n\t// add info to your board at the bottom of the screen\n\t$('#my_board').css('background-color', playerColors[myID])\n\t\t.val(myID);\n\n\t$('#my_name .player_name').text(myusername);\n\n\t// starting resources\n\t$('#my_money .player_money').text(players[myID].money);\n\t$('#my_score .player_score').text(0);\n\t$('#my_ribbon .player_ribbon').text(players[myID].numRibbons);\t\n\t$('#my_action_cube .player_action_cube').text(0);\n\n\t// time_track\n\t$('#my_time_track').append(\n\t\t$('<img/>').attr('src','img/time_track0.png')\n\t\t\t.addClass('time_track_image')\n\t)\n\n\t// the rest\n\t$('#my_number_played_cards span').text(0);\n\t\n\tfor (i = 1; i < 4; i ++) {\n\t\tvar starColor = players[myID].bonus[i-1] + 1;\n\t\t$('#bonus_icon' + i).css('background-color', shopColors[starColor])\n\t\t\t.append(\n\t\t\t\t$('<img/>').attr('src', 'img/bonus_icon' + i + '.png')\n\t\t\t\t\t.addClass('icon')\n\t\t\t\t\t.attr('title', bonusTypeString[i-1])\n\t\t\t);\n\t\t\n\t\t$('#my_bonus' + i).css('background-color', shopColors[starColor])\n\t\t\t.append(\n\t\t\t\t$('<span/>').text(0)\n\t\t\t\t\t.addClass('bonus_star'),\n\t\t\t\t$('<img/>').attr('src', 'img/star_icon' + starColor + '.png')\n\t\t\t\t\t.addClass('icon--small')\n\t\t\t);\n\n\t\t$('#my_vase').append(\n\t\t\t$('<img/>').attr('src', 'img/empty_vase.png')\n\t\t\t\t.addClass('empty_vase')\n\t\t);\n\t}\n\n\t// add tool tokens and popup area that shows all tools with all levels\n\tshops = [[],[],[],[],[],[]];\n\tfor (i = 0; i < 6; i ++)\n\t\tshops[5].push(\n\t\t\tnew toolToken(i)\n\t\t);\n\t\t\n\t$('#tool_lookup').append(\n\t\t$('<button/>').text('Close')\n\t\t\t.addClass('button--expand_tool')\n\t);\n\n\tfor (i = 0; i < 3; i ++ ) {\n\t\t$('#tool_lookup').append(\n\t\t\t$('<br>'),\n\t\t\t$('<span/>').text('level ' + i).css('color', 'white')\n\t\t);\n\t\t$('#tool_lookup').append($('<br>'));\n\t\tfor (j = 0; j < 6; j ++) {\n\t\t\t$('#tool_lookup').append(\n\t\t\t\t$(\"<img/>\")\n\t\t\t\t\t.attr('src', 'img/tool' + j + 'lv' + i + '.jpg' )\n\t\t\t\t\t.addClass('tool--large')\n\t\t\t\t\t.val(i)\n\t\t\t);\n\t\t}\n\t}\n\n\t // add as many achievements as the number of players\n\t$('#achievement_area').empty();\n\t$('#achievement_area--large').empty();\n\t$('#achievement_area').append(\n\t\t$('<span/>').text('Achievements'),\n\t\t$('<br>'),\n\t\t$('<button/>').text('Expand')\n\t\t\t.addClass('button button--expand_achievement')\n\t\t\t.css({'position':'absolute','top':'0'})\n\t);\n\n\tfor (i = 0; i < achievements.length; i ++) {\n\t\tvar type = achievements[i].type;\n\t\tvar $accard = \n\t\t$('#achievement_area').append(\n\t\t\t$('<img/>').attr('src','img/achievement' + type + '.png')\n\t\t\t\t.addClass('achievement_card')\n\t\t\t\t.data({\n\t\t\t\t\ttype: type,\n\t\t\t\t\tindex: i\n\t\t\t\t}),\n\t\t\t$('<span/>').addClass('achievement_claimer_token')\n\t\t);\n\n\t\t$('#achievement_area--large').append(\n\t\t\t$('<img/>').attr('src','img/achievement' + type + '.png')\n\t\t\t\t.addClass('achievement_card--large')\n\t\t\t\t.data({\n\t\t\t\t\ttype: type,\n\t\t\t\t\tindex: i\n\t\t\t\t})\n\t\t);\n\t}\n\n\t$('#achievement_area--large').append(\n\t\t$('<button/>').text('Close')\n\t\t\t.addClass('button button--expand_achievement')\n\t);\n\n\t// initialize board component\n\tplayers[myID].addBoard(\n\t\t$('#my_board')\n\t);\n}", "function createGame() {\n const rowClassNames = ['topRow', 'middleRow', 'bottomRow'];\n const cellClassNames = ['LeftCell', 'CenterCell', 'RightCell'];\n const rowLength = rowClassNames.length;\n const columnLength = cellClassNames.length;\n const gameBoardContainer = document.querySelector('.gameBoardContainer');\n toggleHideElement('.inputs');\n toggleHideElement('.avatarOptions');\n toggleHideElement('.startBtn');\n for (let gridX = 0; gridX < rowLength; gridX++) {\n let row = document.createElement('div');\n row.classList.add(rowClassNames[gridX]);\n gameBoardContainer.appendChild(row);\n for (let gridY = 0; gridY < columnLength; gridY++) {\n let cell = document.createElement('div');\n let cellName = rowClassNames[gridX] + cellClassNames[gridY];\n cell.classList.add(cellName);\n cell.onclick = () => placePlayerMarker(cell);\n row.appendChild(cell);\n }\n }\n updatePlayer(playerOne);\n updatePlayer(playerTwo);\n updateAnnouncementBoard();\n}", "loadGame() {\n alert(\"Loading saved game!\");\n tiles = []; // empty tile array\n numPiecesChosen = []; // reset\n numPiecesMatched = 0;\n $(\".wrapper\").empty(); // clear everything\n this.currentBoard = new Board();\n this.currentBoard.loadBoard(function() {\n current.currentBoard.renderTiles(function() {\n current.addFlip(current);\n });\n });\n }", "function buildBoard(){\n\n\t\tvar boardSize = (GAME.board.width * defaultTile.tileSize) + 200; //padding\n\n\t\t//$gamearea.style.maxWidth = (boardSize + 20) +'px'; //extra space for scroll bar\n\t\t$map.style.height = boardSize +'px';\n\t\t$map.style.width = boardSize +'px';\n\t\t\n\t\t//Build our board! //0 or 1 based?\n\t\tfor(var w = 0; w < GAME.board.width; w++){\n\t\t\tGAME.board.tiles[w] = [];\n\t\t\tGAME.NPCs[w] = [];\n\t\t\tfor(var h = 0; h < GAME.board.height; h++){\t\n\n\t\t\t\t//Put our tile into our state board\n\t\t\t\tGAME.board.tiles[w][h] = createTile(w,h);\n\t\t\t\t\n\t\t\t\t//Creating a bunch of random GAME.NPCs\n\t\t\t\tif( (w + h) % 10 == 0){\n\t\t\t\t\tGAME.NPCs[w][h] = createNPC(w,h);\n\t\t\t\t}\n\n\t\t\t\t//tileHolder.appendChild(board.tiles[w][h].element);\n\t\t\t}\n\t\t}\n\n\t\tdisplayBoard(GAME.board);\n\t\tdisplayNPCs(GAME.NPCs);\n\n\t\t//we need to build our graph array AFTER npcs have been added so we know if the tiles are passable\n\t\tbuildGraphArray();\n\t}", "function setupGame() {\n const boardElement = document.getElementById('board')\n\n for (let y = 0; y < boardHeight; ++y) {\n const row = []\n for (let x = 0; x < boardWidth; ++x) {\n const cell = {}\n\n // Create a <div></div> and store it in the cell object\n cell.element = document.createElement('div')\n\n // Add it to the board\n boardElement.appendChild(cell.element)\n\n // Add to list of all\n row.push(cell)\n }\n\n // Add this row to the board\n board.push(row)\n }\n\n startGame()\n\n // Start the game loop (it will call itself with timeout)\n gameLoop()\n }", "function loadGameData()\n\t\t\t{\n\t\t\t\tif(gameName == \"fatcat7\")\n\t\t\t\t{\n\t\t\t\t\tgame = new FatCat7Game();\n\t\t\t\t\tisFreeSpinGame = true;\n\t\t\t\t}\n\t\t\t\telse if(gameName == \"bounty\")\n\t\t\t\t{\n\t\t\t\t\tgame = new BountyGame();\n\t\t\t\t\tisFreeSpinGame = true;\n\t\t\t\t}\n\t\t\t\telse if(gameName == \"gummibar\")\n\t\t\t\t{\n\t\t\t\t\tgame = new GummiBarGame();\n\t\t\t\t\tisFreeSpinGame = false;\n\t\t\t\t}\n\t\t\t\telse if(gameName == \"aprilmadness\")\n\t\t\t\t{\n\t\t\t\t\tgame = new AprilMadnessGame();\n\t\t\t\t\tisFreeSpinGame = true;\n\t\t\t\t}\n\t\t\t\telse if(gameName == \"moneybooth\")\n\t\t\t\t{\n\t\t\t\t\tgame = new MoneyBoothGame();\n\t\t\t\t\tisFreeSpinGame = false;\n\t\t\t\t}\n\t\t\t\telse if(gameName == \"astrologyanswers\")\n\t\t\t\t{\n\t\t\t\t\tgame = new AstrologyAnswersGame();\n\t\t\t\t\tisFreeSpinGame = false;\n\t\t\t\t\tisBothFreeSpinAndOtherBonus = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tgame.importGame(xmlData);\n\t\t\t}", "function buildGame() {\n\t\n\t// build a spritesheet up from the image we have loaded\n spriteSheet = new SpriteSheet({\n\t images: [spriteImage], \n\t frames: {width: CELL_SIZE, height: CELL_SIZE, count: 12, regX: 1, regY: 1},\n\t animations: {\n\t\t\tblank: [9],\n\t\t\tempty_cell: [0],\n\t\t\tyellow_cell: [1],\n\t\t\tred_cell: [2],\n\t\t\tplace_yellow: [9],//[4],\n\t\t\tplace_red: [9],//[5],\n\t\t\tfill_yellow: [4],//[7],\n\t\t\tfill_red: [5],//[8],\n\t\t\twin_yellow: [10],\n\t\t\twin_red: [11],\n\t\t}\n });\n \n // build a stage object to hold our game board\n stage = new Stage(game);\n stage.mouseEventsEnabled = true; // allow mouse events\n stage.enableMouseOver(); // allow mouseover events\n \n // set up a game ticker\n Ticker.addListener(stage);\n Ticker.useRAF = true;\n Ticker.setFPS(60);\n \n // initialise the game board\n map = [];\n for (var col = 0; col < max_col; col++) {\n \tvar line = [];\n \tfor (var row = 0; row < max_row + header_rows; row++) {\n \t\t/// create a new bitmap animation\n \t\tvar bma = new BitmapAnimation(spriteSheet);\n \t\t\n \t\t// set up the correct bitmap\n \t\tif (col > max_col) {\n \t\t\tbma.gotoAndPlay(\"blank\");\n \t\t} else {\n \t\t\tif (row == 0)\n\t \t\t{\n\t \t\t\tbma.gotoAndPlay(\"blank\");\n\t \t\t} else if (row == 1){\n\t \t\t\tbma.gotoAndPlay((current_team == YELLOW) ? \"place_yellow\" : \"place_red\");\n \t\t\t\tbma.onMouseOver = changePlaceMouseOver;\n \t\t\t\tbma.onMouseOut = changePlaceMouseOut;\n \t\t\t\tbma.onPress = placeDiscEvent;\n\t \t\t} else {\n\t \t\t\tbma.gotoAndPlay(\"empty_cell\");\n\t \t\t}\n \t\t}\n \t\t\n \t\t// configure the bitmap animation position\n \t\tbma.name = row + \",\" + col;\n \t\tbma.x = col * CELL_SIZE;\n \t\tbma.y = row * CELL_SIZE;\n \t\tstage.addChild(bma);\n\t \tline.push(bma);\n \t}\n \tmap.push(line);\n }\n}", "function newGame() {\n /* This uses a callback function as all of the other processes are dependant on the configuration information. */\n GAME.loadConfig(function() {\n GAME.loadSVGFiles(); // This will also begin to draw the starting room when complete. //\n GAME.createMaze();\n GAME.prepareCanvas(); // Draws a blank canvas in preparation for rooms. //\n PLAYER.setRandomRoom(); // Assign the player to a random room. //\n });\n}", "function setUpBoard () {\n makeCrystalScores();\n makeCrystalButtons();\n }", "function start(){\n\t \t// Local variables\n\t \tlet fs = require('fs');\n\t \tlet file = \"test.json\";\n\t \tlet myBoard;\n\t \tlet disc;\n\t \tlet height;\n\t \tlet width;\n\t \tlet turn;\n\t \tlet response;\n\t \tlet p1Disc;\n\t\tlet p2Disc;\n\n\t \tconsole.log('<<<<< Welcom to the game of Othello >>>>>\\n');\n\t \ttry{\n\t \t\tif(fs.existsSync(file))\n\t \t\t{\n\t \t\t\t//if file not empty\n\t \t\t\tif(fs.readFileSync(file) != null)\n\t \t\t\t{\n\t \t\t\t\tlet newBoard = loadFile(file);\n\t \t\t\t\t\n\t \t\t\t\tmyBoard = new board(newBoard.height, newBoard.width);\n\t\t\t\t\tmyBoard.board = newBoard.board;\n\n\t \t\t\t\t// if myBoard is not full\n\t \t\t\t\tif(!(myBoard.isBoardFull()))\n\t \t\t\t\t{\n\t \t\t\t\t\t// ask user if he would like to continue previous game\n\t \t\t\t\t\tresponse = prompt('Would you like to continue the game you saved? Enter Y for Yes or N for No > ').toUpperCase();\n\t \t\t\t\t\t// if yes \n\t \t\t\t\t\tif(response == 'Y')\n\t \t\t\t\t\t{\n\t \t\t\t\t\t\tturn = 1;\n\t \t\t\t\t\t\tdisc = 'B';\n\t \t\t\t\t\t\t// load content of file into board\n\t \t\t\t\t\t\tif(turn == 1){\n\t\t\t\t\t\t\t\tp1Disc = disc;\n\t\t\t\t\t\t\t\tp2Disc = disc == 'W' ? 'B' : 'W';\n\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\tp2Disc = disc;\n\t\t\t\t\t\t\t\tp1Disc = disc == 'W' ? 'B' : 'W';\n\t\t\t\t\t\t\t}\n\t \t\t\t\t\t\t\n\t \t\t\t\t\t}else if(response == 'N')// if no \n\t \t\t\t\t\t{\n\t \t\t\t\t\t\t//create new game\n\t \t\t\t\t\t\theight = prompt('What height for your board? ');\n\t\t\t\t\t\t\twhile(height < 4)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tconsole.log('\\nHeight is too small\\nPlease enter a number greater than 4 ');\n\t\t\t\t\t\t\t\theight = prompt('What height for your board? ');\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\twidth = prompt('\\nWhat width for your board? ');\n\t\t\t\t\t\t\twhile(width < 4)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tconsole.log('\\nWidth is too small\\n Please enter a number greater than 4 ');\n\t\t\t\t\t\t\t\twidth = prompt('What width for your board? ');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// SYNCHRONOUSLY read from keyboard\n\t\t\t\t\t\t\tconsole.log('Creating a board with size ' + height + ' x ' + width + '.');\n\t\t\t\t\t\t\t// Create new board object\n\t\t\t\t\t\t\tmyBoard = new board(height, width);\n\t\t\t\t\t\t\t//saveFile(\"test.json\", myBoard);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tturn = prompt('Enter player to start the game: 1 or 2 ');\n\t\t\t\t\t\t\twhile( turn < 1 || turn >= 3)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tconsole.log('Invalid number entered. Please try again');\n\t\t\t\t\t\t\t\tturn = prompt('Enter player to start the game: 1 or 2 ');\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tdisc = prompt('Enter disc color: W for White B for Black ').toUpperCase();\n\t\t\t\t\t\t\twhile(disc != 'W' && disc != 'B')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tconsole.log('Invalid Color. Please try again');\n\t\t\t\t\t\t\t\tdisc = prompt('Enter disc color: W for White B for Black ').toUpperCase();\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(turn == 1){\n\t\t\t\t\t\t\t\tp1Disc = disc;\n\t\t\t\t\t\t\t\tp2Disc = disc == 'W' ? 'B' : 'W';\n\t\t\t\t\t\t\t}else {\n\t\t\t\t\t\t\t\tp2Disc = disc;\n\t\t\t\t\t\t\t\tp1Disc = disc == 'W' ? 'B' : 'W';\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\theight = prompt('What height for your board? ');\n\t\t\t\twhile(height < 4)\n\t\t\t\t{\n\t\t\t\t\tconsole.log('\\nHeight is too small\\nPlease enter a number greater than 4 ');\n\t\t\t\t\theight = prompt('What height for your board? ');\t\n\t\t\t\t}\n\t\t\t\twidth = prompt('\\nWhat width for your board? ');\n\t\t\t\twhile(width < 4)\n\t\t\t\t{\n\t\t\t\t\tconsole.log('\\nWidth is too small\\n Please enter a number greater than 4 ');\n\t\t\t\t\twidth = prompt('What width for your board? ');\t\n\t\t\t\t}\n\n\t\t\t\t// SYNCHRONOUSLY read from keyboard\n\t\t\t\tconsole.log('Creating a board with size ' + height + ' x ' + width + '.');\n\t\t\t\t// Create new board object\n\t\t\t\tmyBoard = new board(height, width);\n\t\t\t\t//saveFile(file, myBoard);\n\n\t\t\t\tturn = prompt('Enter player to start the game: 1 or 2 ');\n\t\t\t\twhile( turn < 1 || turn >= 3)\n\t\t\t\t{\n\t\t\t\t\tconsole.log('Invalid number entered. Please try again');\n\t\t\t\t\tturn = prompt('Enter player to start the game: 1 or 2 ');\n\t\t\t\t}\n\n\t\t\t\tdisc = prompt('Enter disc color: W for White B for Black ').toUpperCase();\n\t\t\t\twhile(disc != 'W' && disc != 'B')\n\t\t\t\t{\n\t\t\t\t\tconsole.log('Invalid Color. Please try again');\n\t\t\t\t\tdisc = prompt('Enter disc color: W for White B for Black ').toUpperCase();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(turn == 1){\n\t\t\t\t\tp1Disc = disc;\n\t\t\t\t\tp2Disc = disc == 'W' ? 'B' : 'W';\n\t\t\t\t}else {\n\t\t\t\t\tp2Disc = disc;\n\t\t\t\t\tp1Disc = disc == 'W' ? 'B' : 'W';\n\t\t\t\t}\n\t \t\t}\n\t \t}catch(err){\n\t \t\tconsole.log(\"AN ERROR OCCURRED!\");\n\t \t\tconsole.error(err);\n\t \t}\n\t \t\n\t\tconsole.log('Player 1: ' + p1Disc + ' Player 2: ' + p2Disc +'\\n');\n\t\tconsole.log('Player ' + turn + ' starts the game...\\n');\n\n\t\t// Loop, asking user input, calling appropriate functions.\n\t\tlet row;\n\t\tlet col;\n\t\t//console.log(typeof myBoard);\n\t\twhile(!myBoard.isGameOver())\n\t\t{\n\t\t\tmyBoard.printBoard();\n\t\t\tif(!(myBoard.isValidMoveAvailable((turn == 1) ? p1Disc : p2Disc)))\n\t\t\t{\n\t\t\t\tconsole.log('No valid moves available for player ' + turn + '. You lose your turn.\\n');\n\t\t\t}else{\n\t\t\t\tdo{\n\t\t\t\t\tconsole.log('Turn> Player ' + turn + '(' + ((turn == 1) ? p1Disc : p2Disc) + ')');\n\t\t\t\t\trow = prompt('Enter row to place your disc:');\n\t\t\t\t\tcol = prompt('Enter col to place your disc:');\n\t\t\t\t\t\n\t\t\t\t\tif(row < 1 || row > width || col < 1 || col > height)\n\t\t\t\t\t{\n\t\t\t\t\t\tconsole.log('Sorry, invalid input. Try again. \\n');\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\trow--; // adjust it for zero-indexed array of board\n\t\t\t\t\tcol--; // adjust it for zero-indexed array of boardelse if(!myBoard.isValid(row, col, ((turn == 1) ? p1Disc : p2Disc)))\n\t\t\t\t\tif(!myBoard.isValid(row, col, (turn == 1 ? p1Disc : p2Disc))){\n\t\t\t\t\t\tconsole.log('Sorry, that is not a valid move. Try again');\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}while(true);\n\t\t\t\tmyBoard.placeDiskAt(row,col,((turn == 1) ? p1Disc : p2Disc));\n\t\t\t\tsaveFile(file, myBoard);\n\t\t\t}\n\t\t\tturn = (turn == 1) ? 2 : 1;\n\t\t}\n\n\t\twinner = myBoard.checkWinner();\n\t\tif(winner == 'B' || winner == 'W')\n\t\t{\n\t\t\tconsole.log('Game is over. The winner is Player ' + (winner == p1Disc ? 1 : 2) + winner + '.\\n');\n\t\t}else{\n\t\t\tconsole.log('Game is over. No winner.');\n\t\t}\n\t}", "function setupGame() {\n generateHTMLBoardSquares();\n\n const squareElements = document.getElementsByClassName(\"board-square\");\n\n for (var i = 0; i < squareElements.length; i++) {\n const element = squareElements[i];\n const square = new BoardSquares(element);\n boardSquares.push(square);\n }\n}", "function load()\n {\n populateMap(gameInfo.jediList);\n init();\n gameInfo.gameState = \"pickChar\";\n }", "function initGame(){\n resetGameStats()\n setLevel()\n gBoard = buildBoard()\n renderBoard(gBoard)\n gGame.isOn = true\n\n}", "createBoard() {\n\t\tfor (let i = 0; i < 6; i++) {\n\t\t\tfor (let j = 0; j < 6; j++) {\n\t\t\t\tlet tile = new MyTile(this.scene, this);\n\t\t\t\tlet pieceSize = 0.395 + 0.005;\n\t\t\t\ttile.addTransformation(['translation', -3 * pieceSize + pieceSize * j, -3 * pieceSize + pieceSize * i, 0]);\n\t\t\t\tthis.tiles.push(tile);\n\t\t\t}\n\t\t}\n\t\tfor (let i = 0; i < 8; i++) {\n\t\t\tthis.whitePieces.push(new MyPieceWhite(this.scene, 'whitePiece'));\n\t\t\tthis.blackPieces.push(new MyPieceBlack(this.scene, 'blackPiece'));\n\t\t}\n\t}", "function loadGame(){\n\t// images\n\tbgImage.src = \"images/backgframe_480.jpg\";\n\tdude.src = \"images/person.png\";\n\tscrollImage.src = \"images/scroll.png\";\n\t\n\t// required buttons\n \tpauseButtonImage.src = \"images/gmenub1.png\";\n\t\n \tpauseButtonImage2.src = \"images/gpauseButton.png\";\n\t\n\t// test buttons (debugging)\n \tgenerateButtonImage.src = \"images/button.png\";\n\tvictoryButtonImage.src = \"images/button.png\";\n\taddscoreButtonImage.src = \"images/button.png\";\n\taddGameOverButtonImage.src = \"images/button.png\";\n\n\t/*// turn off main menu music\n\tmusicOn = false;\n\tmusic.pause();*/\n\t\n\tinitGameSetting(); //rules.js\n}", "function load() {\n\n\n convertToIndex();\n buildGraph();\n graph.consolePrintGraph();\n gameIntro();\n $(\"#newGame\").click(start);\n}", "function gameCreate() {\n // get the level from url\n setLevel();\n GameNumber.updateNumLevels(document);\n GameNumber.setNextLevel(document);\n\n // set the game tutorial text\n GameHelp.setHelpText(GameNumber.currGame, document);\n\n // initialize tile selector\n tileDisplay = new TileDisplay(document);\n\n // Initialize board object\n board = new Board(PIXI, app, tileDisplay);\n\n // Initialize selector object\n selector = new Selector(graphics, app);\n\n // create the rulesets\n ruleSet = GameNumber.getRuleset();\n generateRulesetDisplay(ruleSet.accepting_rule, true);\n generateRulesetDisplay(ruleSet.rules, false);\n\n // init game ticker\n app.ticker.add(delta => gameLoop(delta));\n \n}", "function load()\n{\n\tsetupParts();\n\t\n\tmain();\n}", "initBoard () {\n\t\tthis.clearBoard();\n\t\t/* Init piece-list */\n\t\t/* White */\n\t\tthis.pieces = [\n\t\t\tnew Lance(COLOR.WHITE, position.toIdx(1, 'a')),\n\t\t\tnew Knight(COLOR.WHITE, position.toIdx(2, 'a')),\n\t\t\tnew Silver(COLOR.WHITE, position.toIdx(3, 'a')),\n\t\t\tnew Gold(COLOR.WHITE, position.toIdx(4, 'a')),\n\t\t\tnew King(COLOR.WHITE, position.toIdx(5, 'a')),\n\t\t\tnew Gold(COLOR.WHITE, position.toIdx(6, 'a')),\n\t\t\tnew Silver(COLOR.WHITE, position.toIdx(7, 'a')),\n\t\t\tnew Knight(COLOR.WHITE, position.toIdx(8, 'a')),\n\t\t\tnew Lance(COLOR.WHITE, position.toIdx(9, 'a')),\n\t\t\tnew Rook(COLOR.WHITE, position.toIdx(2, 'b')),\n\t\t\tnew Bishop(COLOR.WHITE, position.toIdx(8, 'b')),\n\t\t];\n\t\tfor (let i = 1; i <= NUM_COLS; i++) {\n\t\t\tthis.pieces.push(new Pawn(COLOR.WHITE, position.toIdx(i, 'c')));\n\t\t}\n\t\t/* Black */\n\t\tthis.pieces = this.pieces.concat([\n\t\t\tnew Lance(COLOR.BLACK, position.toIdx(1, 'i')),\n\t\t\tnew Knight(COLOR.BLACK, position.toIdx(2, 'i')),\n\t\t\tnew Silver(COLOR.BLACK, position.toIdx(3, 'i')),\n\t\t\tnew Gold(COLOR.BLACK, position.toIdx(4, 'i')),\n\t\t\tnew King(COLOR.BLACK, position.toIdx(5, 'i')),\n\t\t\tnew Gold(COLOR.BLACK, position.toIdx(6, 'i')),\n\t\t\tnew Silver(COLOR.BLACK, position.toIdx(7, 'i')),\n\t\t\tnew Knight(COLOR.BLACK, position.toIdx(8, 'i')),\n\t\t\tnew Lance(COLOR.BLACK, position.toIdx(9, 'i')),\n\t\t\tnew Rook(COLOR.BLACK, position.toIdx(2, 'h')),\n\t\t\tnew Bishop(COLOR.BLACK, position.toIdx(8, 'h')),\n\t\t]);\n\t\tfor (let i = 1; i <= NUM_COLS; i++) {\n\t\t\tthis.pieces.push(new Pawn(COLOR.BLACK, position.toIdx(i, 'g')));\n\t\t}\n\n\t\t/* Put pieces on board */\n\t\tthis.pieces.forEach((piece) => {\n\t\t\tthis.putPiece(piece, piece.pos);\n\t\t});\n\t}", "async function load() {\n await Datas.Settings.read();\n await Datas.Systems.read();\n //RPM.gameStack.pushTitleScreen();\n //RPM.datasGame.loaded = true;\n Manager.GL.initialize();\n Manager.GL.resize();\n Manager.Stack.requestPaintHUD = true;\n}", "function initGameBoard() {\n\t\tvar totalPlayer = game.getPlayerCount();\n\t\t$('.rubblish').hide();\n\t\t$('.rubblishBin').hide();\t\t\n\t\tfor(var i = 1; i < totalPlayer; i++) {\n\t\t\t$('#player'+ (i+1) +'-holder').hide();\n\t\t\t$('#player'+ (i+1) +'-cardNumber').hide();\n\t\t\t$('#player'+ (i+1) +'-CrystalArea').hide();\n\t\t}\n\t\t$('#player1-holder').hide();\n\t\t$('#player1-CrystalArea').hide();\n\t\t$('#Pass').hide();\n\t\t$('.rubblishBin').fadeIn(800);\n\t\t\n\t\tui.lockNewGame(true);\n\t\tclearCardHolders();\n\t\t\n\t\tvar map = playerMap[totalPlayer];\n\n\t\t// Set the player title on the game board\n\t\tvar counter = 0;\n\t\tfor(var i = 0; i < 4; i++) {\n\t\t\tvar title = $('#player' + (i + 1) + '-title');\n\t\t\tif(i <= totalPlayer) {\n\t\t\t\tif(map[counter] === (i + 1)) {\n\t\t\t\t\ttitle.html('Player ' + (counter + 1));\n\t\t\t\t\tcounter++;\n\t\t\t\t} else {\n\t\t\t\t\ttitle.html('');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttitle.html('');\n\t\t\t}\n\t\t}\n\n\t\taddCardToStockPile();\n\n\t\t// Add cards for human player\n\t\tvar cardArray = game.getPlayerCards(0);\n\t\tvar cardNumber = cardArray.length;\n\t\tfor(var i = 0; i < cardNumber; i++) {\n\t\t\tui.addCardToHumanPlayerTray(cardArray[i]);\n\t\t}\n\n\t\t// Add 4 cards for computer players\n\t\tfor(var i = 1; i < totalPlayer; i++) {\n\t\t\tui.initCardToComputerPlayerTray(i, 4);\n\t\t\tvar holder = document.getElementById('player' + map[i] + '-cardNumber');\n\t\t\tholder.innerHTML=\"X \" + game.getPlayerCardNumber(i);\n\t\t\tvar j = i - 1;\n\t\t\t$('#player'+ (i+1) +'-holder').delay(((i*800)+(j*800))).fadeIn(800);\n\t\t\t$('#player'+ (i+1) +'-cardNumber').delay(((i*800)+(j*800))).fadeIn(800);\n\t\t\t$('#player'+ (i+1) +'-CrystalArea').delay((((i*800)+800)+(j*800))).fadeIn(800);\n\t\t}\n\n\t\tui.lockNewGame(false);\n\t\t$('#player1-holder').delay(5600).fadeIn(800);\n\t\t$('#player1-CrystalArea').delay(5600).fadeIn(800);\n\t\t$('#Pass').delay(5600).fadeIn(800);\n\t\tui.showToast('Hello! It&rsquo;s your turn now. Please play a card.');\n\t\t$('#toast').hide();\n\t\t$('#toast').delay(6400).fadeIn('fast');\n\t\t\n\t}", "function initBoard(game) {\n for (var i = 0; i < COLUMN; i++) {\n game.board[i] = new Array(ROW);\n for(var y=0; y < ROW; y++){\n // genere des tiles aleatoire dans tour le tableau\n generateTile(game, new Coord(i, y));\n }\n }\n\n destroyTiles(game);\n\n for (i = 0; i < COLUMN; i++) {\n for(y=0; y < ROW; y++){\n drawTile(game.board[i][y]);\n }\n }\n\n}", "function init() {\n body = document.querySelector('body')\n\n homeScreen = document.createElement('div')\n homeScreen.classList.add('home-screen')\n body.appendChild(homeScreen)\n\n startButton = document.createElement('div')\n startButton.classList.add('start-button')\n body.appendChild(startButton)\n startButton.innerText = 'Start Game'\n\n banner = document.createElement('div')\n banner.classList.add('banner')\n body.appendChild(banner)\n banner.innerText = 'A Night out in Malibu!'\n\n headerBanner = document.createElement('div')\n headerBanner.classList.add('headerBanner')\n body.appendChild(headerBanner)\n\n startButton.addEventListener('click', startGame)\n\n board = document.createElement('div')\n board.classList.add('board', 'bg-image')\n body.appendChild(board)\n\n footer = document.createElement('footer')\n main = document.querySelector('html')\n main.appendChild(footer)\n\n scoreBoard = document.createElement('div')\n scoreBoard.classList.add('score-details')\n footer.appendChild(scoreBoard)\n\n resultDisplay = document.createElement('div')\n resultDisplay.classList.add('game-details')\n footer.appendChild(resultDisplay)\n\n audioFile = document.createElement('audio')\n audioFile.src = 'music/Madonna-IntotheGroove.mp3'\n footer.appendChild(audioFile)\n\n scoreBoard.innerText = 'Score: 0'\n resultDisplay.innerText = 'Good luck!'\n\n createBoard()\n}", "newGame() {\n\t\tvar current = this;\n $(\".wrapper\").empty(); // clear everything\n this.currentBoard = new Board();\n tiles = []; // empty tile array\n numPiecesChosen = []; // reset\n numPiecesMatched = 0;\n if (confirm(\"Do you wish to load a saved game? Press 'cancel' to start a new game.\")) {\n this.currentBoard.loadBoard(function() {\n current.currentBoard.renderTiles(function() {\n current.addFlip(current);\n });\n });\n } else {\n this.newGameSetup();\n this.currentBoard.fillBoard(function() {\n current.currentBoard.renderTiles(function() {\n current.addFlip(current);\n });\n });\n\n }\n }", "function initiateGame() {\n fillBoard(1);\n}", "function drawBoard(board) {\n\tif(loaded == elemToLoad) {\n\t\tclearBoard();\n\t\tfor (i in board) {\n\t\t\tfor (j in board[i]) {\n\t\t\t\tvar y = j-3;\n\t\t\t\ty *= -1;\n\t\t\t\ty += 4;\n\t\t\t\tdrawTile(i, j, i*tileSize, y*tileSize, board[i][j]);\n\t\t\t}\n\t\t}\n\t\tstage.draw();\n\t} else {\n\t\twindow.setTimeout(function() {drawBoard(board)}, 1000);\n\t}\n}", "function loadGameScreen () {\n /* reset all of the player's states */\n for (var i = 1; i < players.length; i++) {\n gameDisplays[i-1].reset(players[i]);\n }\n $gameLabels[HUMAN_PLAYER].removeClass(\"loser tied current\");\n clearHand(HUMAN_PLAYER);\n\n previousLoser = -1;\n recentLoser = -1;\n gameOver = false;\n\n $gamePlayerCardArea.show();\n $gamePlayerCountdown.hide();\n $gamePlayerCountdown.removeClass('pulse');\n chosenDebug = -1;\n updateDebugState(showDebug);\n \n /* randomize start lines for characters using legacy start lines.\n * The updateAllBehaviours() call below will override this for any\n * characters using new-style start lines.\n *\n * Also go ahead and commit any marker updates from selected lines.\n */\n players.forEach(function (p) {\n if(p.chosenState) {\n p.commitBehaviourUpdate();\n }\n }.bind(this));\n\n updateAllBehaviours(null, null, GAME_START);\n updateBiggestLead();\n\n /* set up the poker library */\n setupPoker();\n preloadCardImages();\n\n /* disable player cards */\n for (var i = 0; i < $cardButtons.length; i++) {\n $cardButtons[i].attr('disabled', true);\n }\n\n /* enable and set up the main button */\n allowProgression(eGamePhase.DEAL);\n}", "function run () {\n var $canvasBox;\n \n $('#newGameLink').removeAttr('disabled'); // can click new game link\n\n if (m.debug > m.NODEBUG) { console.log('screens.gameScreen.run'); }\n \n if (needsInit) {\n \n // disable mouse events on canvas and halt the game loop when we return to the menu\n $('#gameMenuLink')\n .click( function (event) {\n m.playtouch.unhookMouseEvents();\n m.Model.stopGameNow();\n m.Audio.beQuiet();\n m.screens.showScreen('menuScreen');\n });\n \n // shuffle and deal if we ask nicely\n $('#newGameLink')\n .click( function (event) {\n // disallow double-clicks, also disabled in the model while dealing\n if ( $(this).attr('disabled') === 'disabled' ) { return false; } \n $(this).attr('disabled', 'disabled'); \n // if you start a new game before winning, give 'em the not impressed face\n if (m.Settings.getPlaySounds() && !hasWon) {\n m.Sounds.playSoundFor(m.Sounds.QUIT);\n }\n \n // now we play\n setTimeout( function() {\n m.Model.stopGameNow();\n m.screens.showScreen('gameScreen');\n }, m.Settings.Delays.Quit);\n return false;\n });\n \n }\n needsInit = false;\n \n // start the game animation loop\n m.gameloop.setLoopFunction(m.view.refreshDisplay);\n \n // start a new game\n m.view.newGame($('#gameViewBox'));\n \n // hook up event handling\n m.playtouch.hookMouseEvents(); \n\n // resize the game pane if needed after a short delay\n $(window)\n .resize(function (event) {\n setTimeout( function () {\n mikeycell.view.setMetrics();\n }, 500);\n });\n\n }", "setupNewGame() {\n var board = [];\n for (var i = 0; i < this.numTiles; i++) {\n board[i] = 0;\n }\n\n this.gameState = {\n board: board,\n score: 0,\n won: false,\n over: false\n }\n this.addRandomTile();\n this.addRandomTile();\n return;\n }", "loadGame(p1Name, p2Name) {\n body[0].innerHTML = this._boardHTML;\n const player1Highlight = document.getElementById('player1');\n const player2Highlight = document.getElementById('player2');\n const boardSpaces = document.querySelectorAll('.box');\n player1Highlight.classList.add('active');\n\n //Conditional statements check if the players have entered a name and displays them if they have\n //otherwise, the 'X' and 'O' graphic will be displayed by default.\n if (p1Name.length > 0) {\n player1Highlight.innerText = p1Name;\n }\n if (p2Name.length > 0) {\n player2Highlight.innerText = p2Name;\n }\n\n //Loops through all board spaces and applies the class of 'free' indicated it is an empty space\n for (let i = 0; i < boardSpaces.length; i++) {\n boardSpaces[i].id = i;\n boardSpaces[i].classList.add('free');\n }\n }", "function createBoard(){\n\tdocument.body.style.setProperty('--size', size);\n\tdocument.body.style.setProperty('--grid-size', size+1);\n\n\tvar th = document.createElement('div');\n\tth.className = \"content head\";\n\tth.innerHTML = \"\";\n\tth.id = \"header\"\n\tdom.gameBoard.appendChild(th);\n\t//initialize alphabetical headers\n\tfor (var row = 0; row < size; row++) {\n\t\tvar letter = (row+10).toString(36);\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = letter;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\t}\n\n\tfor(var i = 0; i < size; i++){\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = i+1;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\n\t\tfor(var x = 1; x <= size; x++){\n\t\t\tvar cell = document.createElement(\"div\");\n\t\t\tcell.classList.add(\"content\");\n\n\t\t\t//logic for borders\n\t\t\tif (x == size){\n\t\t\t\tcell.classList.add(\"child-with-border\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcell.classList.add(\"child\");\n\t\t\t}\n\t\t\tif (i == size-1){\n\t\t\t\tcell.classList.add(\"child-edge\");\n\t\t\t}\n\t\t\tvar num = (i * (size) + x).toString();\n\t\t\tcell.id = \"cell\"+num;\n\t\t\tdom.gameBoard.appendChild(cell);\n\t\t}\n\t}\n}", "initBoard() {\n this.canvas = document.createElement('canvas');\n this.ctx = this.canvas.getContext('2d');\n this.width = this.canvas.width = this.tileWidth * this.columns;\n this.height = this.canvas.height = this.tileHeight * this.rows;\n this.canvas.style.border = \"none\";\n this.initStage();\n }", "function initializeGameBoard(debug){\n\n var boardID = [[0,0],[1,0],[2,0],[3,1],[4,2],[4,3],[4,4],[3,4],[2,4],[1,3],[0,2],[0,1],[1,1],[2,1],[3,2],[3,3],[2,3],[1,2],[2,2]]\n // for original game: \n //4 wood //4 wheat //4 sheep //3 brick //3 ore //1 desert\n var resourceList = [-1,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,4,4,4];\n var portList = [[-1,-1,1,4], [1,-1,2,5], [3,0,2,5], [4,2,0,0], [4,3,1,1], [3,4,1,1], [2,4,2,2], [0,3,0,3], [-1,1,0,3]];\n\n var rollList = [5,2,6,3,8,10,9,12,11,4,8,10,9,4,5,6,3,11];\n var portResourceList = [0,1,2,3,4,5,5,5,5]\n\n \n // if (!debug){\n //randomizes the elements in array\n self.fisherYates(resourceList);\n self.fisherYates(portResourceList);\n return [boardID, resourceList, portList, rollList, portResourceList];\n}", "function load_Game(){\n\nboard.empty()\nwinner_container.empty()\nreset_button.hide()\nactive = true\nplayer1 = true\ncreateBoard(9)\ncurrent_player_show()\n\n\nfunction createBoard(v){\n // Create a div for our current player image\n var current_player_div = $(\"<div></div>\").addClass(\"current_player\")\n \t// Create 3 rows\n for (var i = 0; i < v; i++){\n row = document.createElement(\"div\");\n row.className = \"row \" + \"row\" + i;\n row.setAttribute(\"data-row\", i)\n\n // Create 9 cells\n for(var j=0; j < v; j++){\n\n cell = document.createElement(\"div\");\n \ttoken = document.createElement(\"div\");\n cell.className = \"cell \" + \"cell\" + j;\n cell.setAttribute(\"data-cell\", j)\n token.className = \"token\";\n row.appendChild(cell);\n cell.appendChild(token);\n\n //for adding a number system to the macro board\n // where V is the total number of rows/columns \n // right now v=9 but v could be 27\n // \n // looks like:\n // 1 2 3\n // 1 x x x\n // 2 x x x\n // 3 x x x\n //\n // I should add some code that says divide by 3 until\n // there are 3 squares added to each class?\n\n\n if(i< (v/3)) {\n \tcell.className += \" BR1\";\n \t\t}\n \t\telse if(i>=(v/3) && i<(2*(v/3))){\n \t\t\tcell.className += \" BR2\";\t\n\t\t\t}else{\n\t\t\t\tcell.className += \" BR3\";\n\t\t\t}\n\n if(j< (v/3)) {\n \tcell.className += \" BC1\";\n \t\t}\n \t\telse if(j>=(v/3) && j<(2*(v/3))){\n \t\t\tcell.className += \" BC2\";\t\n\t\t\t}else{\n\t\t\t\tcell.className += \" BC3\";\n\t\t\t}\n\n }\n\n board.append(row)\n }\n // Create the matrix - Our \"back-end\" logic that connects to the front-end grid we created above.\n // We work with the matrix to deal wth the computations and conditional logic that allows our\n // game to come alive.\n matrix = new Array(9);\n\tfor (var i = 0; i < matrix.length; i++) {\n\t\tmatrix[i] = new Array(9);\n\t}\n\t//create big matrix\n\t\t\n\t//create little matrix\n\t//for storing win conditions\n\tlittlematrix = new Array(3);\n\tfor (var i = 0; i < littlematrix.length; i++) {\n\t\tlittlematrix[i] = new Array(3);\n\t}\n\n\n// Append the div we created at the very start of this function to the HTML generated div.\n// Add the \"my turn\" content that sits next to the image of the cat\n\n winner_container.append(current_player_div)\n current_player = $(\".current_player\")/*\n current_player.html(\"<span>My Turn!</span>\")\n*/\n} //createBoard END\n\n// Check which player's turn it is, then show the relevant image\nfunction current_player_show(){\n\t\n\tif ( player1 === true ) {\n\t\tcurrent_player.removeClass(\"sox\")\n\t\tcurrent_player.addClass(\"snowy\")\n\t} else if ( player1 === false ) {\n\t\tcurrent_player.removeClass(\"snowy\")\n\t\tcurrent_player.addClass(\"sox\")\n\t }\n\n}\n\n//create a function that returns a little row or little collumn value\nfunction little(dataRow,dataCell){\n\tvar LR = (dataRow)%3;\n\tvar LC = (dataCell)%3;\n\t//console.log(dataCell);\n\tvar LRLC=[LR,LC]\n\treturn LRLC;\n}\n\n//create a function that checks if little row, little collumn is full\nfunction full(dataRow,dataCell){\n\tvar LR = (dataRow)%3;\n\tvar LC = (dataCell)%3;\n\tfor (var i=0; i<=2;i++){\n\tif (typeof matrix[3*LR+i][3*LC] === 'undefined' || typeof matrix[3*LR][3*LC+i] === 'undefined' || typeof matrix[3*LR+i][3*LC+i] === 'undefined'){\n\t\treturn false;\n\t}\n\t\n\t}\n\tconsole.log('true?')\n\n\t\n\n}\n\n\n\n// When a user clicks on a cell\n$( \".cell\" ).click(function() {\n\n\t\n\tclickedRow = $(this).parent().attr('data-row') \n\tclickedCell = $(this).attr(\"data-cell\")\n\ttoken = $(this).find('div')\n\t\n\tvalid = true;\n\t\n\n\t// Check first if that square is already occupied, in this case alert the user to try another cell\n\tif ( $(this).find('div').hasClass( \"snowy\" ) || $(this).find('div').hasClass( \"sox\" ) ){\n\t\talert(\"Hey! Stop poking me\")\n\t} \n\n\t//create logic that only allows user to place in bc & br\n\tif(player1 == true || player1 === 'undefined'){\n\t\t//if BRBC is not already full\n\t\t//console.log(full(clickedRow,clickedCell))\n\t\tif (full(clickedRow,clickedCell)== false){\n\t\t//console.log('p1 bc '+clickedCell);\n\t\tP1BRBC= little(clickedRow, clickedCell);\n\t\t//console.log(P1BRBC[0]);\n\n\n\t\t}\n\t\telse{\n\t\tconsole.log('you can go anywhere')\n\t\tP1BRBC=undefined\t\n\t\t}\n\n\n\t\t//console.log('player1 '+'row '+P1BRBC[0]+'column '+P1BRBC[1])\n\t}else if(player1 == false){\n\t\tif (full(clickedRow,clickedCell)== false){\n\n\t\t//console.log(\"why \"+clickedCell);\t\n\t\tP2BRBC= little(clickedRow, clickedCell);\n\n\t\t}\n\t\telse{\n\t\tconsole.log('you can go anywhere')\n\t\tP2BRBC=undefined\t\n\t\t}\n\t\t//console.log('player2')\t\n\t}else{console.log('Too many players?')}\n\n\tif (typeof P2BRBC === 'undefined'){\n\t\t//console.log('first round you can go anywhere');\n\t\t//highlight\n\t\tfunction highlight1(classNameBRBC){\n\t\t\tvar x = document.getElementsByClassName(classNameBRBC);\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < x.length; i++) {\n\t\t\t//instead of changing the background add a class that changes the background\n\t\t\tx[i].className +=' highlight';\n\t\t\t}\n\t\t}\n\t\tif(P1BRBC[0]==0 && P1BRBC[1]==0)\n\t\t{ highlight1(\"BR1 BC1\");}\n\t\telse if(P1BRBC[0]==1 && P1BRBC[1]==0)\n\t\t{ highlight1(\"BR2 BC1\");}\n\t\telse if(P1BRBC[0]==2 && P1BRBC[1]==0)\n\t\t{ highlight1(\"BR3 BC1\");}\n\t\telse if(P1BRBC[0]==0 && P1BRBC[1]==1)\n\t\t{ highlight1(\"BR1 BC2\");}\n\t\telse if(P1BRBC[0]==1 && P1BRBC[1]==1)\n\t\t{ highlight1(\"BR2 BC2\");}\n\t\telse if(P1BRBC[0]==2 && P1BRBC[1]==1)\n\t\t{ highlight1(\"BR3 BC2\");}\n\t\telse if(P1BRBC[0]==0 && P1BRBC[1]==2)\n\t\t{ highlight1(\"BR1 BC3\");}\n\t\telse if(P1BRBC[0]==1 && P1BRBC[1]==2)\n\t\t{ highlight1(\"BR2 BC3\");}\n\t\telse if(P1BRBC[0]==2 && P1BRBC[1]==2)\n\t\t{ highlight1(\"BR3 BC3\");}\n\t}//else if(filled()){ you can go anywhere}\n\telse{\n\t\t//reset board background\n\t\tfunction reset(){\n\t\t\t//only change color of squares that habe not been won\n\t\t\tvar x = document.getElementsByClassName(\"cell\");\n\t\t\tvar i;\n\t\t\tfor (i = 0; i < x.length; i++) {\n\t\t\t\tif ($(x[i]).hasClass('highlight')){\n\t\t\t\t\t//instead remove highlight class\n\t\t\t\t\t$(x[i]).removeClass('highlight');\n\t\t\t\t}\n\t\t\t\telse if ($(x[i]).hasClass('highlight1')){\n\t\t\t\t\t$(x[i]).removeClass('highlight1');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(player1==true && P2BRBC !== undefined){\n\n\t\t\t\t//console.log('player2 '+'row '+P2BRBC[0]+'column '+P2BRBC[1]);\n\t\t\t\tif(P2BRBC[0] == 0 && clickedRow>2){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me you chose big row 2 or 3 and p2 chose little row 1\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P2BRBC[0] == 1 && (clickedRow<3 || clickedRow>5)){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me you clicked big Row 1 or 3 and p1 chose little row 1\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P2BRBC[0] == 2 && clickedRow<6){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P2BRBC[1] == 0 && clickedCell>3){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P2BRBC[1] == 1 && (clickedCell<3 || clickedCell>5)){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me\");\n\t\t\t\t\tvalid=false\n\t\t\t\t}else if(P2BRBC[1] == 2 && clickedCell<6){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t//console.log(P2BRBC[0]);\n\t\t\t\t\t//console.log(P2BRBC[1]);\n\t\t\t\t\tvalid=true;\n\t\t\t\t\treset();\n\t\t\t\t\tfunction highlight1(classNameBRBC){\n\t\t\t\t\t\tvar x = document.getElementsByClassName(classNameBRBC);\n\t\t\t\t\t\tvar i;\n\t\t\t\t\t\tfor (i = 0; i < x.length; i++) {\n\t\t\t\t\t\t//instead of changing the background add a class that changes the background\n\t\t\t\t\t\t//x[i].style.background = \"#ea7cf4\";\n\t\t\t\t\t\tx[i].className +=' highlight';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(P1BRBC[0]==0 && P1BRBC[1]==0)\n\t\t\t\t\t{ highlight1(\"BR1 BC1\");}\n\t\t\t\t\telse if(P1BRBC[0]==1 && P1BRBC[1]==0)\n\t\t\t\t\t{ highlight1(\"BR2 BC1\");}\n\t\t\t\t\telse if(P1BRBC[0]==2 && P1BRBC[1]==0)\n\t\t\t\t\t{ highlight1(\"BR3 BC1\");}\n\t\t\t\t\telse if(P1BRBC[0]==0 && P1BRBC[1]==1)\n\t\t\t\t\t{ highlight1(\"BR1 BC2\");}\n\t\t\t\t\telse if(P1BRBC[0]==1 && P1BRBC[1]==1)\n\t\t\t\t\t{ highlight1(\"BR2 BC2\");}\n\t\t\t\t\telse if(P1BRBC[0]==2 && P1BRBC[1]==1)\n\t\t\t\t\t{ highlight1(\"BR3 BC2\");}\n\t\t\t\t\telse if(P1BRBC[0]==0 && P1BRBC[1]==2)\n\t\t\t\t\t{ highlight1(\"BR1 BC3\");}\n\t\t\t\t\telse if(P1BRBC[0]==1 && P1BRBC[1]==2)\n\t\t\t\t\t{ highlight1(\"BR2 BC3\");}\n\t\t\t\t\telse if(P1BRBC[0]==2 && P1BRBC[1]==2)\n\t\t\t\t\t{ highlight1(\"BR3 BC3\");}\n\t\t\t\t\t//console.log('valid entry');\n\t\t\t\t}\n\t\t}\n\t\telse if(player1==false && P1BRBC !== undefined){\n\t\t\t\t\n\t\t\t\t//console.log('player1 '+'row '+P1BRBC[0]+'column '+P1BRBC[1])\n\t\t\t\tif(P1BRBC[0] == 0 && clickedRow>2){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me p1 chose little row 0\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P1BRBC[0] == 1 && (clickedRow<3 || clickedRow>5)){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me p1 chose little row 1\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P1BRBC[0] == 2 && clickedRow<6){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me p1 chose little row 2\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P1BRBC[1] == 0 && clickedCell>2){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me little collumn \" + P1BRBC[1]);\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P1BRBC[1] == 1 && (clickedCell<3 || clickedCell>5)){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me lc2\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}else if(P1BRBC[1] == 2 && clickedCell<6){\n\t\t\t\t\t//console.log(\"Hey! Stop poking me lc3\");\n\t\t\t\t\tvalid=false;\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\t//console.log('row '+ P1BRBC[0]);\n\t\t\t\t\t//console.log('column '+P1BRBC[1]);\n\t\t\t\t\tvalid=true;\n\t\t\t\t\treset();\n\t\t\t\t\t//highlight where you can go\n\t\t\t\t\tfunction highlight(classNameBRBC){\n\t\t\t\t\t\tvar x = document.getElementsByClassName(classNameBRBC);\n\t \t\t\t\tvar i;\n\t \t\t\t\tfor (i = 0; i < x.length; i++) {\n\t \t\t\t\t//instead of changing the background add a class that changes the background\n\t \t\t\t\tx[i].className +=' highlight1';\n\t \t\t\t//x[i].style.background = \"#a67cf4\";\n\t \t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(P2BRBC[0]==0 && P2BRBC[1]==0)\n\t\t\t\t\t{ highlight(\"BR1 BC1\");\n\t \t\t}\n\t\t\t\t\telse if(P2BRBC[0]==1 && P2BRBC[1]==0)\n\t\t\t\t\t{ highlight(\"BR2 BC1\");}\n\t\t\t\t\telse if(P2BRBC[0]==2 && P2BRBC[1]==0)\n\t\t\t\t\t{ highlight(\"BR3 BC1\");}\n\t\t\t\t\telse if(P2BRBC[0]==0 && P2BRBC[1]==1)\n\t\t\t\t\t{ highlight(\"BR1 BC2\");}\n\t\t\t\t\telse if(P2BRBC[0]==1 && P2BRBC[1]==1)\n\t\t\t\t\t{ highlight(\"BR2 BC2\");}\n\t\t\t\t\telse if(P2BRBC[0]==2 && P2BRBC[1]==1)\n\t\t\t\t\t{ highlight(\"BR3 BC2\");}\n\t\t\t\t\telse if(P2BRBC[0]==0 && P2BRBC[1]==2)\n\t\t\t\t\t{ highlight(\"BR1 BC3\");}\n\t\t\t\t\telse if(P2BRBC[0]==1 && P2BRBC[1]==2)\n\t\t\t\t\t{ highlight(\"BR2 BC3\");}\n\t\t\t\t\telse if(P2BRBC[0]==2 && P2BRBC[1]==2)\n\t\t\t\t\t{ highlight(\"BR3 BC3\");}\n\t\t\t\t\t//console.log('valid entry');\n\t\t\t\t}\n\t\t}\n\t}\n\n\n\n\tif (active === true && valid===true){ // user clicks an empty cell\n\n\t\tif (player1 === true) { // I'm breaking the DRY rule here (dont repeat yourself) sorry!\n\t\t\t//retreive some data?\n\t\t\ttoken.css(\"display\", \"block\") // CSS and classes for occupied cell styles\n\t \t\ttoken.addClass(\"snowy\")\n\t \t\ttoken.css(\"border\", \"none\")\n\t \t\ttoken.addClass(\"expandOpen\")\n\t \t\tmatrix[clickedRow][clickedCell] = \"p1\" // to show this matrix cell is now occupied\n\t \t\t//send this variable to the websocket\n\t \t\t\n\n\t \t\tcounter++ // add one to the turn counter\n\t \t\tif (typeof P2BRBC !== 'undefined'){\n\t \t\t\t//console.log(\"BR \"+P2BRBC[0]+\"BC \"+P2BRBC[1])\n\t \t\t\t//check if other player has already won the square\n\t \t\t\tif (littlematrix[P2BRBC[0]][P2BRBC[1]] !== \"p2\") {\n\t \t\t\t//console.log(littlematrix)\n\t \t\t\twin_condition_check((P2BRBC[0]+1),(P2BRBC[1]+1)); // check if our player has won\n\t \t\t\t}\n\t \t\t\telse{\n\t \t\t\t//check if player overturns square\n\t \t\t\tconsole.log(\"overturn check p1\")\n\t \t\t\toverturn_check(P2BRBC[0],P2BRBC[1],\"p1\")\n\t \t\t\t}\t\n\n\t \t\t}\n\t \t\t\n\t \t\t\n\t \t\tplayer1 = false; // Set variable to player 2\n\t \t\t\n\t\t}\n\n\t \telse if (player1 === false) { \n\t\t\ttoken.css(\"display\", \"block\")\n\t \t\ttoken.addClass(\"sox\")\n\t \t\ttoken.addClass(\"expandOpen\")\n\n\t \t\t//console.log(clickedRow)\n\t \t\t//console.log(clickedCell)\n\t \t\tmatrix[clickedRow][clickedCell] = \"p2\"\n\t \t\t\n\t \t\tcounter++\n\t \t\tif (typeof P1BRBC !== 'undefined'){\n\t \t\t\t//console.log(\"BR \"+P1BRBC[0]+\"BC \"+P1BRBC[1])\n\t \t\t\tif (littlematrix[P1BRBC[0]][P1BRBC[1]] !== \"p1\") {\n\t \t\t\t\t//console.log(littlematrix);\n\t \t\t\t\twin_condition_check((P1BRBC[0]+1),(P1BRBC[1]+1)) // check if our player has won\n\t \t\t\t}else{\n\t \t\t\t//check if player overturns square\n\t \t\t\tconsole.log(\"overturn check p2\")\n\t \t\t\toverturn_check(P1BRBC[0],P1BRBC[1],\"p2\")\n\t \t\t\t}\n\t \t\t}\n\t \t\tplayer1 = true\n\n\t \t\t\n\t \t}\n\t \t\n\t \tcurrent_player_show() \n\n\t}\n\n\n\n\n}); // End click_cell event listener\n\n// A button that appears to reload the game\n$(\"#reset\").click(function(){ \n\t\n\tcurrent_player.removeClass(\"snowy sox\")\n\tload_Game()\n\tcounter = 0\n\tstart_game_button.hide()\n\n\n})\n\n\n\n\nfunction win_condition_check(BR,BC){ //tion, sorry again. I've used a lot of conditional logic, attempting to scale it down only met with errors and tears.\n\t//console.log(\"big row \"+BR+\" big column \"+BC)\n\t// Check the console.logs for the intended results.\n\tif ((counter%2)===1) { // If it's player one's turn\n\t\t//Check in only BR,BC\n\t\t//Check in all the Bigger squares\n\t\tlittle_check(((BR-1)*3),((BC-1)*3));\n\t\t//little_check(0,3);\n\t\t//little_check(0,6);\n\t\t//little_check(3,0);\n\t\t//little_check(3,3);\n\t\t//little_check(3,6);\n\t\t//little_check(6,0);\n\t\t//little_check(6,3);\n\t\t//little_check(6,6);\n\n\t\t//\n\t\tfunction little_check(count,count2){\n\t\t\t\n\t\t\t//console.log(\"count \"+ count+\"count2 \"+count2);\t\t\t\n \t \t\tfor ( var x=count; x <= (count+2); x++) { // cycle the matrix rows...\n \t \t\t\tfor (var y=count2; y <= (count2+2); y++) { // ...and cycle the matrix cells\n\t\t\t\t\t//var BR=1;\n\n\t\t\t\t\t//console.log(\"matrx[x] \"+ x+\"martix[y] \"+y);\n\t\t\t\t\tif ((matrix[x][(count2+0)]) === \"p1\" && (matrix[x][(count2+1)]) === \"p1\" && (matrix[x][(count2+2)]) === \"p1\") { // If our cell has been 'tagged' p1 given x is (e.g 0) then: x0y0, x0y1, x0y2 would mean player one has 3 horizontal cells in a line = victory!\n\t\t\t\t\t\tif (player1 === true){\n\t\t\t\t\t\t//console.log(\"horizontal victory\")\n\t\t\t\t\t\t//console.log(\"player1 wins square row \"+BR+ \"column \"+BC )\n\t\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p1\";\n\t\t\t\t\t\treturn;\n\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\t\t\t\t\telse if\t( (matrix[(count+0)][y]) === \"p1\" && (matrix[(count+1)][y]) === \"p1\" && (matrix[(count+2)][y]) === \"p1\") { // Repeated for other conditions\n\t\t\t\t\t\tif (player1 === true){\n\t\t\t\t\t\t//console.log(\"vertical victory\")\n\t\t\t\t\t\t//console.log(\"player1 wins\")\n\t\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p1\";\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if ((matrix[(count+0)][(count2+0)]) === \"p1\" && (matrix[(count+1)][(count2+1)]) === \"p1\" && (matrix[(count+2)][(count2+2)]) === \"p1\") {\n\t\t\t\t\t\tif (player1 === true){\n\t\t\t\t\t\tconsole.log(\"LtopRdown diagonal\")\n\t\t\t\t\t\tconsole.log(\"player1 wins\")\n\t\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p1\";\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} \n\t\t\t\t\telse if\t( (matrix[(count+0)][(count2+2)]) === \"p1\" && (matrix[(count+1)][(count2+1)]) === \"p1\" && (matrix[(count+2)][(count2+0)]) === \"p1\") {\t\n\t\t\t\t\t\tif (player1 === true){\n\t\t\t\t\t\tconsole.log(\"Rtop Ldown diagonal\")\n\t\t\t\t\t\tconsole.log(\"player1 wins\")\n\t\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p1\";\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t \t} \n\t} // End player one check\n\n\n\tif ((counter%2)===0) {\t// Now for player 2\n\n\t\tlittle_check1(((BR-1)*3),((BC-1)*3));\n\t\t//little_check1(0,3);\n\t\t//little_check1(0,6);\n\t\t//little_check1(3,0);\n\t\t//little_check1(3,3);\n\t\t//little_check1(3,6);\n\t\t//little_check1(6,0);\n\t\t//little_check1(6,3);\n\t\t//little_check1(6,6);\n\n\t\t//\n\t\tfunction little_check1(count,count2){\n\n\n\t \t for (var x = count; x <= (count+2); x++) {\n\t\t\tfor (var y = count2; y <= (count2+2); y++) {\n\n\t\t\t\tif ((matrix[x][(count2+0)]) === \"p2\" && (matrix[x][(count2+1)]) === \"p2\" && (matrix[x][(count2+2)]) === \"p2\") {\n\t\t\t\t\n\t\t\t\t//console.log(player1)\n\n\t\t\t\tif (player1== false) {\n\t\t\t\t\tconsole.log(\"horizontal victory\")\n\t\t\t\t\tconsole.log(\"player2 wins\")\n\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p2\";\n\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\telse if\t((matrix[(count+0)][y]) === \"p2\" && (matrix[(count+1)][y]) === \"p2\" && (matrix[(count+2)][y]) === \"p2\") {\n\t\t\t\tif (player1== false) {\n\t\t\t\t\tconsole.log(\"vertical victory\")\n\t\t\t\t\tconsole.log(\"player2 wins\")\n\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p2\";\n\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if ((matrix[(count+0)][(count2+0)]) === \"p2\" && (matrix[(count+1)][(count2+1)]) === \"p2\" && (matrix[(count+2)][(count2+2)]) === \"p2\") {\n\t\t\t\tif (player1== false) {\t\n\t\t\t\t\tconsole.log(\"LtopRdown diagonal\")\n\t\t\t\t\tconsole.log(\"player2 wins\")\n\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p2\";\n\t\t\t\t\treturn;\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t\n\t\t\t\telse if\t((matrix[(count+0)][(count2+2)]) === \"p2\" && (matrix[(count+1)][(count2+1)]) === \"p2\" && (matrix[(count+2)][(count2+0)]) === \"p2\") {\t\n\t\t\t\t\tif (player1== false) {\n\t\t\t\t\tconsole.log(\"Rtop Ldown diagonal\")\n\t\t\t\t\tconsole.log(\"player2 wins\")\n\t\t\t\t\twinner_show(BR,BC)\n\t\t\t\t\tlittlematrix[(BR-1)][(BC-1)]=\"p2\";\n\t\t\t\t\treturn;\n\t\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\n\t\t}\n\t\t}\t\n\t} // End player 2 check\n\n\t\n\n\t// In the case of a DRAW. We announce this and allow the users to play again\n\t// check all 9 space\n\n\n\n} // Function win_condition_check END\n\nfunction overturn_check(BR,BC,P){\n\t\t\n\t\tvar overturn_counter=0;\n\t\tfor (var x = 3*BR; x <= (3*BR+2); x++) {\n\t\t\t\t//console.log(\"BR \"+BR+\"BC \"+BC+\"P \"+P)\n\n\t\t\t\tif ((matrix[x][(3*BC+0)]) == P && (matrix[x][(3*BC+1)]) == P && (matrix[x][(3*BC+2)]) == P) {\n\t\t\t\t\toverturn_counter+=1;\n\t\t\t\t\tconsole.log(\"BR \"+BR+\"BC \"+BC);\n\t\t\t\t\tconsole.log(overturn_counter);\n\t\t\t\t\tif (overturn_counter>1) {\n\t\t\t\t\t\tconsole.log(P +\" overturned the square\")\n\t\t\t\t\t\t//winner_show(BR,BC)\n\t\t\t\t\t\tlittlematrix[BR][BC]= P;\n\t\t\t\t\t\twin_condition_check((BR+1),(BC+1));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\tfor (var y = 3*BC; y <= (3*BC+2); y++) {\n\t\t\t\tif\t((matrix[(3*BR+0)][y]) == P && (matrix[(3*BR+1)][y]) == P && (matrix[(3*BR+2)][y]) == P) {\n\t\t\t\t\toverturn_counter+=1;\n\t\t\t\t\tconsole.log(\"BR \"+BR+\"BC \"+BC);\n\t\t\t\t\tconsole.log(overturn_counter);\n\t\t\t\t\tif (overturn_counter>1) {\n\t\t\t\t\tconsole.log(P + \" overturned the square\")\n\t\t\t\t\t//winner_show(BR,BC)\n\t\t\t\t\tlittlematrix[BR][BC]= P;\n\t\t\t\t\twin_condition_check((BR+1),(BC+1));\n\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t}\n\n}\n\n\nfunction winner_show(BR,BC){ \n\t\n\tif (player1 == true) { // a bit confusing, but basically, if the game has finished player 2 has finished \n\t\twinner_snowy_div = document.createElement(\"div\");\n\t\twinner_snowy_div.setAttribute(\"id\", \"winner_snowy\")\n\t winner_snowy_div.setAttribute(\"class\", \"winner snowy\")\n\t //change the background color in all cells BC, BR\n\t $( \".BC\"+BC+\".BR\"+BR ).css( \"background\", \"pink\" );\n\n\t winner_container.append(winner_snowy_div)\n\t\t\n\t\t//reset_button.show()\n\t\t//active = false\n\t\t//current_player.hide()\n\t}\n\n\tif (player1 == false) {\n\t\twinner_sox_div = document.createElement(\"div\");\n\t\twinner_sox_div.setAttribute(\"id\", \"winner_sox\")\n\t winner_sox_div.setAttribute(\"class\", \"winner sox\")\n\t winner_sox_div.innerHTML = \"<span>\" + 'I Win!' + \"</span>\"\n\t winner_container.append(winner_sox_div)\n\t\t\n\t\t$( \".BC\"+BC+\".BR\"+BR ).css( \"background\", \"sandybrown\" );\n\t\t//reset_button.show()\n\t\t//active = false\t\n\t\t//current_player.hide()\t\n\t}\n}\n\n\n }// Load Game end", "create() {\n game.handleOpponentLeaving = this.handleOpponentLeaving\n \n game.loadOpponent = this.loadOpponent\n game.disconnectSocket = this.disconnectSocket\n game.checkForDoubleClick = this.checkForDoubleClick\n game.animateOpponentLeaving = this.animateOpponentLeaving\n game.startMultiplayer = this.startMultiplayer\n game.updatePlacedPieces= this.updatePlacedPieces\n\n game.gametype = app.gameType;\n game.userkey = app.keyValue;\n game.nameOfUser = app.username;\n game.username = app.username;\n game.battleText = app.battleText;\n game.cash = parseInt(app.money);\n game.url = app.img_url;\n console.log(\"in load: \", game.gametype);\n game.opponentLeft = false;\n game.state.start('menu');\n }", "function load(){\n\tvar count;\n\tvar widthh=0;\n\tvar t=0;\n\tvar l=0;\n\tvar bgx=0;\n\tvar bgy=0;\n\tvar space;\n\n\tfor(let count = 0; count < puzzle.length; count++){\n\t\t$(puzzle[count]).addClass(\"puzzlepiece\");\n\t\tpuzzle[count].style.color=\"blue\";\n\t\tpuzzle[count].style.top=t+\"px\";\n\t\tpuzzle[count].style.left=l+\"px\";\n\t\t$(puzzle[count]).css({'background-position':bgx+'px '+bgy+'px'});\n\t\tbgx-=100;\n\n\t\tl+=100;\n\t\twidthh+=1;\n\t\tif(widthh%4==0){\n\t\t\tt+=100;\n\t\t\tl=0;\n\t\t\tbgy-=100;\n\t\t}\n\n\t}\n}", "function init() {\n board = [\n [0, 0, 0, 0, 0, 0], // col 0\n [0, 0, 0, 0, 0, 0], // col 1\n [0, 0, 0, 0, 0, 0], // col 2\n [0, 0, 0, 0, 0, 0], // col 3\n [0, 0, 0, 0, 0, 0], // col 4\n [0, 0, 0, 0, 0, 0], // col 5\n [0, 0, 0, 0, 0, 0], // col 6\n ];\n turn = 1;\n winner = null;\n render();\n}", "function initBoard(rows, columns) {\n createBoard(rows, columns);\n placePlayer();\n print('Creating board and placing Player...');\n}", "function newGame() {\n //hide game over screen\n $(\"#finish\").remove();\n //show board\n $(\"#board\").show();\n\n //reset variables, classes and attributes\n playerOne = [];\n playerTwo = [];\n moveCounter = 0;\n $('.box').css('background-image', 'none'); //clear background images\n \t\t$('#player1').addClass('active'); //set player one to active\n $(\"li.box\").removeAttr(\"clicked\").removeClass(\"box-filled-1 box-filled-2 filled\");\n $(\"li.box\").removeClass(\"box-filled-1 box-filled-2 filled\");\n\n //invoke previous game choice\n //board(playerOneName, playerTwoName);\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 createBoard(fromLoad, loadedBoard, condition) {\r\n\t\t// If new game, randomly add mines\r\n\t\tif (!fromLoad) {\r\n\t\t\tfor (var x = 0; x < MINES; x++) {\r\n\t\t\t\tvar rand = Math.floor(Math.random()*TOTALCELLS);\r\n\t\t\t\tif (cells[rand] == 'x') {\r\n\t\t\t\t\twhile (cells[rand] == 'x') {\r\n\t\t\t\t\t\trand = Math.floor(Math.random()*TOTALCELLS);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tcells[rand] = 'x';\r\n\t\t\t\tminecells.push(rand);\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t\t// Resize board and add cells\r\n\t\tvar dimension = SIZE * 25 + 'px';\r\n\t\tboardDiv.html('').css('width', dimension).css('height', dimension);\r\n\t\tfor (var x = 0; x < TOTALCELLS; x++) {\r\n\t\t\tboardDiv.append('<div class=\"cell clickable\" id=\"' + x + '\"></div>');\r\n\t\t\t\r\n\t\t\tclickablecells.push(x);\r\n\t\t\t\r\n\t\t\tif (!fromLoad) {\r\n\t\t\t\t// Calculate nearby mines\r\n\t\t\t\tif (cells[x] != 'x') {\r\n\t\t\t\t\tvar surrounding = 0;\r\n\t\t\t\t\tif (x % SIZE > 0) {\r\n\t\t\t\t\t\tif (cells[x - SIZE - 1] == 'x') surrounding++;\r\n\t\t\t\t\t\tif (cells[x - 1] == 'x') surrounding++;\r\n\t\t\t\t\t\tif (cells[x + SIZE - 1] == 'x') surrounding++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (x % SIZE < SIZE - 1) {\r\n\t\t\t\t\t\tif (cells[x - SIZE + 1] == 'x') surrounding++;\r\n\t\t\t\t\t\tif (cells[x + 1] == 'x') surrounding++;\r\n\t\t\t\t\t\tif (cells[x + SIZE + 1] == 'x') surrounding++;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (cells[x - SIZE] == 'x') surrounding++;\r\n\t\t\t\t\tif (cells[x + SIZE] == 'x') surrounding++;\r\n\t\t\t\t\tcells[x] = surrounding;\r\n\t\t\t\t}\r\n\t\t\t} else { // If loading game, fill in board\r\n\t\t\t\tvar c = $('#' + x);\r\n\t\t\t\tif (loadedBoard[x] == 'c') {\r\n\t\t\t\t\tshowCell(x, c, cells[x], condition == 'w');\r\n\t\t\t\t} else {\r\n\t\t\t\t\tc.html(loadedBoard[x]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\t\r\n\t}", "function createBoard() \n{\n\tvar grid = $('#grid');\n\t\n\tfor(var row = 0; row < boardSize; row++) \n\t{\n\t\tvar rowDiv = $('<div class=\"row\"></div>');\n\n\t\tfor(var col = 0; col < boardSize; col++)\n\t\t{\n\t\t\trowDiv.append('<div id=\"s' + row + col + '\" class=\"col square\" row=\"' + row + '\" col=\"' + col + '\"><div class=\"square-interior\"><p></p></div></div>');\n\t\t}\n\n\t\tgrid.append(rowDiv);\n\t}\n\n\t//Spawn a square somewhere to start off the game\n\tspawnTile();\n}", "function loadBoardFromText(text) {\n\tvar lines = text.split(\"\\n\");\n\tvar dimen = lines[0].split(\" \");\n\t// Do some validation on the log file\n\tif (lines.length < 2) {\n\t\talert(\"Incorrect puzzle file format, it is too short\");\n\t\tdocument.getElementById('log_file').disabled=false;\n\t\treturn;\n\t} if (dimen.length != 2) {\n\t\talert(\"Incorrect puzzle file format on line 1\"); \n\t\tdocument.getElementById('log_file').disabled=false;\n\t\treturn;\n\t}\n\tinitialBoard = text;\n\tvar exitOffset = parseInt(lines[1].split(\" \")[1]);\n\tboard = new Board(parseInt(dimen[0]), parseInt(dimen[1]), exitOffset);\n\tvar isFirst = true;\n\tfor (var i=1; i<lines.length; i++) {\n\t\tvar items = lines[i].split(\" \");\n\t\tif (items.length != 4) {\n\t\t\tif (items.length < 2) { break; }\n\t\t\talert(\"Incorrect puzzle file format on line \"+(i+1));\n\t\t\tdocument.getElementById('log_file').disabled=false;\n\t\t\treturn;\n\t\t}\n\t\tvar newVehicle = new Vehicle(isFirst, items[3].charAt(0)==\"T\", parseInt(items[2]), parseInt(items[0]), parseInt(items[1]));\n\t\tboard.addVehicle(newVehicle);\n\t\tif (isFirst) {\n\t\t\tisFirst = false;\n\t\t}\n\t}\n\tdrawFrame();\n}", "function Board(){}", "static async load()\n {\n await RPM.settings.read();\n await RPM.datasGame.read();\n RPM.gameStack.pushTitleScreen();\n RPM.datasGame.loaded = true;\n RPM.requestPaintHUD = true;\n }", "function makeBoard() {\n // Game mechanics code -- to keep track of the game state\n for (let row = 0; row < HEIGHT; row++) {\n let currentRow = [];\n for (let columns = 0; columns < WIDTH; columns++) {\n currentRow.push(null);\n }\n board.push(currentRow);\n }\n}", "function drawGame() {\n var x, y;\n var gameTable = '<table class=\"game-board\">';\n\n // The higher rows get added to the table first\n for (y = board.BOARD_HEIGHT - 1; y > -1; y--) {\n // Generate each row\n gameTable += '<tr>';\n for (x = 0; x < board.BOARD_WIDTH; x++) {\n gameTable += '<td class=\"' + board.space[x][y] + '\">&nbsp;</td>';\n }\n gameTable += '</tr>';\n }\n gameTable += '</table>';\n // Leave in plain js rather than jquery for efficiency\n document.getElementById(\"game\").innerHTML = gameTable;\n }", "function preload () {\n window.width = GAME_WIDTH;\n window.height = GAME_HEIGHT;\n gameFont = loadFont('data/fonts/GameOverFont.ttf');\n\n screens.push(new Background());\n screens.push(new Menu());\n screens.push(new Highscores());\n screens.push(new GameLauncher());\n screens.push(new Weather());\n /*game itself will be added from game launcher\n /*in order to maintain access to it from there */\n screens.push(createCancelButton());\n}", "function createGame () {}", "function initGame() {\r\n renderLevels()\r\n gGame = {\r\n isOn: true,\r\n isFirstClick: true,\r\n\r\n }\r\n gBoard = buildBoard();\r\n renderBoard(gBoard);\r\n startTimer()\r\n\r\n}", "load() {\n Logger.info(`The game(${this._id}) is loading...`)\n this.event_manager.trigger('game_load', [this])\n Logger.info('Loading the game mode')\n _.forEach(this._games, (game) => game._load())\n }", "function initializeGameBoard() {\n\n var gameBody = document.getElementById(\"canvas\");\n\n gameBody.width = game.width;\n gameBody.height = game.height;\n gameBody.className = \"canvas\";\n\n ctx = gameBody.getContext(\"2d\");\n }", "function populateBoard() {\n //clear old gameBoard\n $(gameBoard).empty();\n gameBoard.fadeOut(250);\n\n //shuffle the tiles\n var shuffledTiles = _.shuffle(tiles);\n\n //select 8 of the shuffled tiles\n var selectedTiles = shuffledTiles.slice(0,8);\n\n //create pair sets of selected tiles\n var tilePairs = [];\n _.forEach(selectedTiles, function(tile) {\n tilePairs.push(_.clone(tile));\n tilePairs.push(_.clone(tile));\n });\n tilePairs = _.shuffle(tilePairs); //shuffle the tile pairs so pairs are not always adjacent\n\n //begin populating the gameboard\n var row = $(document.createElement('div'));\n row.addClass('gameRow');\n var tileContainer;\n var flipper;\n var back;\n var face;\n\n //populate the gameboard\n _.forEach(tilePairs, function(tile, elemIndex) {\n //create a new row every 4 tiles\n if(elemIndex > 0 && 0 == elemIndex % 4) {\n gameBoard.append(row);\n row = $(document.createElement('div'));\n row.addClass('gameRow');\n }\n\n //create each element used in a tile\n tileContainer = $(document.createElement('div'));\n flipper = $(document.createElement('div'));\n back = $(document.createElement('img'));\n face = $(document.createElement('img'));\n\n //assign each element its necessary class\n tileContainer.addClass('tileContainer');\n flipper.addClass('flipper');\n back.addClass('back');\n face.addClass('face');\n\n //put all the pieces together\n tileContainer.append(flipper);\n flipper.append(back, face);\n\n //assign the images\n back.attr({\n src: tileBackSrc,\n alt: 'tile backside'\n });\n face.attr({\n src: tile.src,\n alt: 'image of tile ' + tile.tileNum\n });\n\n //assign the tile data to the container that accepts the click event\n tileContainer.data(tileDataKey, tile);\n\n //put the tile in the row\n row.append(tileContainer);\n });\n gameBoard.append(row); // finish gameboard population\n\n //scale tiles to current window size before they're visible\n tileScale();\n\n gameBoard.fadeIn(250);\n } //populateBoard()", "function setup() {\n\t//reset gridcontainer each time button is pressed\n\tdocument.getElementById('gameboard').innerHTML = '';\n\t\n\t// get user input\n\tvar rows = parseInt(document.getElementById('numrows').value, 10);\n\tvar cols = parseInt(document.getElementById('numcols').value, 10);\n\t\n\t// create and setup the game board\n\tgame = new BattleshipGame(rows, cols, 50, document.getElementById(\"gameboard\"));\n\tconsole.log('Set up new game with a ' + rows + ' by ' + cols + ' board.');\n\tconsole.log(game);\n}", "function gameStart() {\n\n // Set all grid empty\n dataBoard = _.chain(new Array(ROWS * COLS))\n .fill(null)\n .chunk(COLS)\n .value();\n\n stage = new Stage();\n\n // Insert a new block\n createNewBlock();\n resetTimer();\n\n}", "function setupGame(){\n generateHTMLBoardSquares();\n var [c,canvas] = createCanvas();\n\n\n const squareElements = document.getElementsByClassName(\"board-square\");\n\n for (var i = 0; i<squareElements.length; i++) {\n const element = squareElements[i];\n const square = new BoardSquares(element);\n boardSquares.push(square);\n }\n return [c,canvas]\n}", "function main() {\n constructDisplay()\n gameBoard = new Board()\n timer()\n autoMove()\n update()\n}", "function prepareBoard(){\n // Retreive the high score from localStorage and update the field\n updateHighScore(highScore)\n // TODO: after every board button click, remember the gameState and retrieve\n // it from localStorage on page load to then fill in\n}", "function buildBoard(size){\n\t\t\t$(\"#board\").append( $(\"<table id='boardId'>\").addClass(\"boardTable\") );\n\t\t\tfor (i = 0; i < size; ++i) {\n\t\t\t\t$(\".boardTable\").append( $(\"<tr>\").addClass(\"boardRow\") );\n\t\t\t\tfor (j = 0; j < size; ++j) {\n\t\t\t\t\t$(\".boardRow:last\").append( $(\"<td>\").addClass(\"boardCell\").data(\"column\",j)\n\t\t\t\t\t.click(function() {\n var __this = this;\n\t\t\t\t\t\tif(turn==0) {\n if (firstMove) {\n persistNewGame(function(err,game){\n if (err) {\n Materialize.toast('Sorry, something went wrong with creating the new game.', 4000);\n }\n firstMove = false;\n gameId = game.id;\n playColumn(jQuery.data(__this,\"column\"));\n });\n } else {\n playColumn(jQuery.data(__this,\"column\"));\n }\n }\n\t\t\t\t\t}));\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function startGame(){\n\tif(!$.editor.enable){\n\t\tfor(n=0;n<levels_arr.length;n++){\n\t\t\t$.stage[n].visible = false;\n\t\t}\n\t\t$.stage[gameData.levelNum].visible = true;\n\t}\n\t\n\tgameData.planes = [];\n\tgameData.runway = [];\n\tgameData.types = [];\n\tgameData.typeCount = 0;\n\tgameData.countPlane = 0;\n\tgameData.totalPlane = levels_arr[gameData.levelNum].level.total;\n\tgameData.speed = levels_arr[gameData.levelNum].level.speed;\n\tgameData.nextPlaneTimer = levels_arr[gameData.levelNum].level.planTimer;\n\tgameData.stageComplete = false;\n\t\n\tplayerData.score = playerData.displayScore = 0;\n\tplayerData.total = 0;\n\tupdateStatus();\n\t\n\tfor(var n=0;n<levels_arr[gameData.levelNum].runway.length;n++){\n\t\tcreateRunway(false, levels_arr[gameData.levelNum].runway[n].type, levels_arr[gameData.levelNum].runway[n].x, levels_arr[gameData.levelNum].runway[n].y, levels_arr[gameData.levelNum].runway[n].rotation);\n\t\t\n\t\tfor(var t=0;t<levels_arr[gameData.levelNum].runway[n].planes.length;t++){\n\t\t\tgameData.types.push(levels_arr[gameData.levelNum].runway[n].planes[t]);\t\t\n\t\t}\n\t}\n\t\n\tgameData.types = unique(gameData.types);\n\tshuffle(gameData.types);\n\t\n\tTweenMax.ticker.useRAF(false);\n\tTweenMax.lagSmoothing(0);\n\n\titemBoom.visible = false;\n\tcompleteContainer.visible = false;\n\t\n\tif(gameData.tutorial){\n\t\tgameData.tutorial = false;\n\t\ttoggleTutorial(true);\n\t}else{\n\t\tstartPlaneTimer(0);\n\t\tgameData.paused = false;\n\t}\n}", "function initGameBoard(height,width){\n\tvar gameboard = '<p id = score style=\"text-align:center\">Score: </p>';\n\tgameboard += '<table id=\"gameboard\">';\n\n\tfor(i = 0; i<height; i++){\n\t\tgameboard += '<tr>';\n\t\tfor (j = 0; j < width; j++){\n\t\t\tvar id = \"r\"+i+\"d\"+j;\n\t\t\tvar grid = '<td id=\"'+id+'\">';\n\t\t\tgameboard += grid;\n\t\t}\n\t\tgameboard += '</tr>';\n\t}\n\tgameboard += '</table>';\n\tgameboard += '<p style=\"text-align: center\"> Ohjaa matoa nuolinäppäimillä. Kuoleman jälkeen paina R syntyäksesi uudelleen </P>'\n\t$(\"#gameboard_div\").html(gameboard);\n\tinitSnake();\n\tdrawApple();\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}", "setupNewGame() {\n\t\tthis.gameState = {\n\t\t\tboard: this.addRandomTile(\n\t\t\t\tthis.addRandomTile(new Array(this.size * this.size).fill(0))\n\t\t\t),\n\t\t\tscore: 0,\n\t\t\twon: false,\n\t\t\tover: false\n\t\t};\n\t\tthis.totalmoves = 0;\n\t\tthis.validmoves = this.getHints().length;\n\t}", "function createBoard() {\n var board = {squares:[]};\n\n for (var x = 0; x < 8; x++) {\n for (var y = 0; y < 8; y++) {\n var asquare = square({x:x, y:y});\n if (asquare.position.y === 0 || asquare.position.y === 1 || asquare.position.y === 6 || asquare.position.y === 7) {\n var colour = (asquare.position.y === 0 || asquare.position.y === 1) ? \"red\" : \"black\";\n asquare.piece = new pieces.Piece({side:colour, position:asquare.position});\n }\n board['squares'][board['squares'].length] = asquare;\n }\n }\n board.id = createGameCheck(board);\n board.asJson = function () {\n var json = [];\n board.squares.forEach(function (sq, inx) {\n json[json.length] = sq.asJson();\n });\n return json;\n\n };\n return board;\n }", "_setupNewGame (rows, cols) {\n this._intervalID = null\n this._userNameWindowOpen = false\n\n if (!this._container.classList.contains('memContainer')) {\n this._container.classList.add('memContainer')\n this._container.classList.remove('highContainer')\n }\n\n if (!this._firstStart) {\n this._clearContainer(this._container)\n this._clearContainer(this._div)\n clearInterval(this._intervalID)\n this._mainDropDownActive = false\n this._sizeDropDownActive = false\n this._headerTemplate = this.shadowRoot.querySelector('#headerTemplate')\n .content.cloneNode(true)\n this._highScoreTemplate = this.shadowRoot.querySelector('#highscoreTemplate')\n .content.cloneNode(true)\n }\n this._a = null\n this._tiles = []\n this._firstTurnedTile = null\n this._secondTurnedTile = null\n this._pairs = 0\n this._cols = cols\n this._rows = rows\n this._tries = 0\n this._firstClick = true\n this._time = 0\n this._highScoreStorageName = `MemoryHighScores${this._cols}${this._rows}`\n\n this._tiles = this.getPictureArray(this._cols, this._rows)\n this._tiles.forEach((tile, index) => {\n this._a = document.importNode(this._templateDiv.firstElementChild, true)\n this._div.appendChild(this._a)\n\n this._a.firstElementChild.setAttribute('data-brickNumber', index)\n\n if ((index + 1) % this._cols === 0) {\n this._div.appendChild(document.createElement('br'))\n }\n })\n\n this._container.appendChild(this._div)\n\n this._timeArea.textContent = `Time: 0 s`\n this._playerNameArea.textContent = 'Name: ' + this._playerName\n this._triesArea.textContent = 'Number of tries: 0'\n\n this._setupMemoryListeners()\n this._firstStart = false\n }", "populateGameBoard(gameEngine, sheet) {\n //Populate each tile as dirt to begin.\n for (var i = 0; i < this.boardHeight; i++) {\n for (var j = 0; j < this.boardWidth; j++) {\n var tile = new Tile(gameEngine, sheet, this.startingX + (i * 64), this.startingY + (j * 64), i, j, 'dirt');\n this.gameBoard[i][j] = tile;\n }\n }\n this.generatePerimeter();\n this.generateObstacles(6, 4);\n this.placeExit(this.exitX, this.exitY);\n }", "function setupBoard() {\n\t// Make sure our boardsize is odd\n\tif (boardsize % 2 !== 1) {\n\t\talert('BAD BOARD SIZE, ARGH!');\n\t\treturn;\n\t} // if (boardsize % 2 !== 1)\n\n\t// Clean out the gameboard\n\t$board.empty();\n\n\t// Set up our deck - a scoring array works nicely here\n\tdeck = getScoringArray();\n\n\t// Do some building\n\tfor (var i = 0; i < boardsize + 1; ++i) {\n\t\t// Build a board row\n\t\tvar newLI = $('<li id=\"row_'+i+'\" class=\"row\"/>');\n\t\tvar newUL = $('<ul />');\n\t\tfor (var j = 0; j < boardsize + 1; ++j) {\n\t\t\t// Build the squares in the board\n\t\t\tif (i < boardsize) {\n\t\t\t\tif (j < boardsize) {\n\t\t\t\t\t// Normal gaming square\n\t\t\t\t\t//newUL.append('<li id=\"square_'+i+'_'+j+'\" class=\"square\">'+getRandInt(boardsize+1)+'</li>');\n\t\t\t\t\tnewUL.append('<li id=\"square_'+i+'_'+j+'\" class=\"square\"></li>');\n\t\t\t\t} else {\n\t\t\t\t\t// Row scoring cell\n\t\t\t\t\tnewUL.append('<li id=\"score_row_'+i+'\" class=\"score\"></li>');\n\t\t\t\t} // if (j < boardsize)\n\t\t\t} else {\n\t\t\t\tif (j < boardsize) {\n\t\t\t\t\t// Column scoring cell\n\t\t\t\t\tnewUL.append('<li id=\"score_col_'+j+'\" class=\"score\"></li>');\n\t\t\t\t} else {\n\t\t\t\t\t// Spare square - let's use it to show current score\n\t\t\t\t\tnewUL.append('<li id=\"score_current\" class=\"score\"></li>');\n\t\t\t\t} // if (j < boardsize) {\n\t\t\t} // if (i < boardsize)\n\t\t} // for (var j = 0; j < boardsize; ++j)\n\t\tnewLI.append(newUL);\n\t\t$board.append(newLI);\n\t} // for (var i = 0; i < boardsize; ++i)\n\n\t// Seed the first square\n\t$('li#square_'+Math.floor(boardsize/2)+'_'+Math.floor(boardsize/2)).text(getCard());\n\n\t// Calculate current scores once set up\n\tcalcScores();\n}", "function createBoard(){\n\tdocument.body.style.setProperty('--size', size);//set\n\tdocument.body.style.setProperty('--grid-size', size+1);//set\n\n\tvar th = document.createElement('div');\n\tth.className = \"content head\";\n\tth.innerHTML = \"\";\n\tth.id = \"header\"\n\tdom.gameBoard.appendChild(th);\n\t//initialize alphabetical headers\n\tfor (var row = 0; row < size; row++) {\n\t\tvar letter = (row+10).toString(36);\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = letter;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\t}\n\n\tfor(var i = 0; i < size; i++){\n\t\tvar th = document.createElement('div');\n\t\tth.className = \"content head\";\n\t\tth.innerHTML = i+1;\n\t\tth.id = \"header\"\n\t\tdom.gameBoard.appendChild(th);\n\n\t\tfor(var x = 1; x <= size; x++){\n\t\t\tvar cell = document.createElement(\"div\");\n\t\t\tcell.classList.add(\"content\");\n\t\t\t//logic for borderes\n\t\t\tif (x == size){\n\t\t\t\tcell.classList.add(\"child-with-border\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcell.classList.add(\"child\");\n\t\t\t}\n\t\t\tif (i == size-1){\n\t\t\t\tcell.classList.add(\"child-edge\");\n\t\t\t}\n\t\t\tvar num = (i * (size) + x).toString();\n\t\t\tcell.id = \"cell\"+num;\n\t\t\tdom.gameBoard.appendChild(cell);\n\t\t}\n\t}\n}", "function initGame() {\n // Assign variables\n gridSize = formGridSize.value;\n isXFirst = formFirstMove.value;\n oName = formOpponentSelection.value;\n inputX = \"❌\";\n inputO = \"⭕\";\n currentMark = inputX;\n oName === \"Player 2\" ? (isComputerActive = false) : (isComputerActive = true);\n\n // Change text based on inputs\n titleDesc.textContent = ` ${gridSize}x${gridSize} board`;\n p2Title.textContent = oName;\n p1Desc.textContent = `${inputX}'s`;\n if (isComputerActive) {\n p2Avatar.style.backgroundImage =\n \"url('https://images.vexels.com/media/users/3/157318/isolated/preview/2782b0b66efa5815b12c9c637322aff3-desktop-computer-icon-computer-by-vexels.png')\";\n }\n p2Desc.textContent = `${inputO}'s`;\n currentPlayerMessage = `${xName} (${inputX})`;\n\n // Hide/Unhide\n modal.classList.add(\"hide\");\n modalContainer.classList.add(\"hide\");\n content.classList.remove(\"hide\");\n\n // Creation\n createGrid(gridSize);\n addMainFunction();\n createBoardInstance(); // push empty board to gridHistory\n if (isXFirst == 0) {\n // switch to let O go first\n playerOMovesFirst();\n }\n}", "function gameInit(){\n \tconsole.log(\"in game init\");\n\t//create a parent to stick board in...\n\tvar gEle=document.createElementNS(svgns,'g');\n\tgEle.setAttributeNS(null,'transform','translate('+BOARDX+','+BOARDY+')');\n\tgEle.setAttributeNS(null,'id','game_'+gameId);\n\t//stick g on board\n\tdocument.getElementsByTagName('svg')[0].insertBefore(gEle,document.getElementsByTagName('svg')[0].childNodes[5]);\n\t//create the board...\n\t//var x = new Cell(document.getElementById('someIDsetByTheServer'),'cell_00',75,0,0);\n\tfor(i=0;i<BOARDWIDTH;i++){\n\t\tboardArr[i]=new Array();\n\t\tfor(j=0;j<BOARDHEIGHT;j++){\n\t\t\tboardArr[i][j]=new Cell(document.getElementById('game_'+gameId),'cell_'+j+i,75,j,i);\n\t\t}\n\t}\n\tconsole.log(\"in game init\");\n\t//new Piece(board,player,cellRow,cellCol,type,num)\n\t//create red\n\tpieceArr[0]=new Array();\n\tvar idCount=0;\n\tfor(i=0;i<5;i++){\n\t\tfor(j=0;j<5;j++){\n\t\t\tif((i==3 && j==3) || (i==4 && j==4)){\n\t\t\t\tpieceArr[0][idCount]=new Piece('game_'+gameId,0,j,i,'Checker',idCount);\n\t\t\t\tidCount++;\n\t\t\t}\n\t\t}\n\t}\n\t\t\t\t\n\t//create green\n\tpieceArr[1]=new Array();\n\tidCount=0\n\tfor(i=0;i<5;i++){\n\t\tfor(j=0;j<5;j++){\n\t\t\tif((i==3 && j==4) || (i==4 && j==3)){\n\t\t\t\tpieceArr[1][idCount]=new Piece('game_'+gameId,1,j,i,'Checker',idCount);\n\t\t\t\tidCount++;\n\t\t\t}\n\t\t}\n\t}\n\n\t//put the drop code on the document...\n\tdocument.getElementsByTagName('svg')[0].addEventListener('mouseup',releaseMove,false);\n\t//put the go() method on the svg doc.\n\tdocument.getElementsByTagName('svg')[0].addEventListener('mousemove',go,false);\n\t//put the player in the text\n\tdocument.getElementById('youPlayer').firstChild.data+=currentPlayer +\",current playerid:\"+playerId+\"1=green,0=red\";\n\tdocument.getElementById('opponentPlayer').firstChild.data+=opponentPlayer;\n\t\n\t//set the colors of whose turn it is\n\tif(turn==playerId){\n\t\tdocument.getElementById('youPlayer').setAttributeNS(null,'fill',\"orange\");\n\t\tdocument.getElementById('opponentPlayer').setAttributeNS(null,'fill',\"black\");\n\t}else{\n\t\tdocument.getElementById('youPlayer').setAttributeNS(null,'fill',\"black\");\n\t\tdocument.getElementById('opponentPlayer').setAttributeNS(null,'fill',\"orange\");\n\t}\n\t\n\tcheckTurnAjax('checkTurn',gameId);\n}", "function createBoard() {\n\t// clear previous board and saved word\n\tclearPreviousBoard(letterSpaces);\n\tclearPreviousBoard(guessRemaining);\n\t// reset image to blank board\n\tmanImage.setAttribute('src', `images/hangman7.png`);\n\t// reset the incorrectGuess to 6\n\tincorrectGuess = 6;\n\t// create guesses remaining\n\tfor (let i = 0; i < incorrectGuess; i++) {\n\t\tconst divElement = document.createElement('div');\n\t\tdivElement.classList.add('show-circle');\n\t\tdivElement.setAttribute('id', [i + 1]);\n\t\tguessRemaining.appendChild(divElement);\n\t}\n\n\t// loop through letters array and create divs for all of them\n\tfor (let i = 0; i < letters.length; i++) {\n\t\tconst divElement = document.createElement('div');\n\t\tdivElement.innerText = letters[i];\n\t\tdivElement.classList.add('letter-button');\n\t\tdivElement.setAttribute('id', letters[i]);\n\t\tletterSpaces.appendChild(divElement);\n\t}\n}", "loadGame() {\n this.player = new Player(100, 100);\n this.treasure = new Treasure()\n this.playerImg = loadImage(\"assets/character-down.png\");\n this.treasureImg = loadImage(\"assets/treasure.png\");\n this.score = 0\n this.bg = loadImage(\"assets/background.png\");\n }", "function loadGame() {\n mayiPivot = false;\n startButton.animate().alpha(0).duration(500).onEnd = function() {\n startButton.setHidden(true);\n startButton.setClickable(false);\n };\n dropSpider.animate().alpha(0).duration(500).onEnd = function() {\n dropSpider.setHidden(true);\n }\n mainOverlayBG.setHidden(false);\n mainOverlayBG.animate().alpha(1).duration(1100);\n gameBG.setHidden(false);\n gameBG.animate().alpha(1).duration(1100);\n deadpool.setHidden(false);\n deadpool.animate().alpha(1).duration(1200);\n gameHeader.setHidden(false);\n gameHeader.animate().alpha(1).duration(1200);\n gameHeart3.setHidden(false);\n gameHeart3.animate().alpha(1).duration(1200);\n spideyBody.setHidden(false);\n spideyBody.animate().alpha(1).duration(1200);\n spideyHead.setHidden(false);\n spideyHead.animate().alpha(1).duration(1200);\n gameScore.setHidden(false);\n gameTimer.setHidden(false);\n blackScreen.setHidden(false);\n blackScreen.animate().alpha(0.75).duration(1200);\n gameInstructions.animate().alpha(1).duration(1300).onEnd = function() {\n gameInstructions.setHidden(false);\n }\n gameInstructions.setClickable(true);\n}", "async function setupAndStart() {\n showLoadingView();\n let buffer = await getCategories();\n\n //Grab random 6 from the buffer array, removing it each step so we don't duplicate them\n categories = getRandomArrayEntries(buffer, 6);\n\n let $board = createGameBoard(categories);\n await fillTable($board);\n\n showGameView($board);\n}", "function newGame() {\n generateTileArray();\n refreshCanvas();\n\n}", "function createBoard() {\n\tfor (let i = 0; i < layout.length; i++) {\n\t\tconst square = document.createElement('div')\n\t\tgrid.appendChild(square)\n\t\tsquares.push(square)\n\n\t\t//add layout to the board\n\t\t//we want to check what is on the board on every position :\n\t\tif (layout[i] === 0) {\n\t\t\tsquares[i].classList.add('pac-dot')\n\t\t} else if (layout[i] === 1) {\n\t\t\tsquares[i].classList.add('wall')\n\t\t} else if (layout[i] === 2) {\n\t\t\tsquares[i].classList.add('ghost-lair')\n\t\t} else if (layout[i] === 3) {\n\t\t\tsquares[i].classList.add('power-pellet')\n\t\t}\n\t}\n}", "function generate() {\n // Last time validation, in case user ends up messing with vars\n adjustMines();\n \n generateBoard();\n \n generateJSON();\n \n board = [];\n}", "function load() {\n clearObjects(\"monsters\");\n clearObjects(\"monsterbullets\");\n clearObjects(\"goodthings\");\n clearObjects(\"bullets\");\n\n bulletsLeft = NUM_BULLETS;\n updateBulletsNumber();\n\n player = new Player();\n\n addLevel();\n goodThingsLeft = NUM_GOOD_THINGS;\n\n resetPlatforms();\n createPortals();\n\n for (i = 0; i < numMonsters; ++i) {\n createMonster(i == 0);\n }\n\n for (i = 0; i < NUM_GOOD_THINGS; ++i) {\n createGoodThing();\n }\n\n // Attach keyboard events\n document.addEventListener(\"keydown\", keydown, false);\n document.addEventListener(\"keyup\", keyup, false);\n\n startTimer();\n}", "makeBoardOnScreen(){\n // Here we'll create a new Group\n for (var i=0; i < game.n; i++) {\n for (var j=0; j < game.n; j ++) {\n //initialize 2D array board to be empty strings\n for (var k=0; k < game.n; k++) {\n for (var l=0; l < game.n; l++) {\n //create square\n var square = game.addSprite(game.startingX + i*game.squareSize*3 + k*game.squareSize, game.startingY + j * game.squareSize*3 + l*game.squareSize, 'square');\n //allow square to respond to input\n square.inputEnabled = true\n //indices used for the 4D array\n square.bigXindex = i\n square.bigYindex = j\n square.littleXindex = k\n square.littleYindex = l\n //make have placePiece be called when a square is clicked\n square.events.onInputDown.add(game.placePiece, game)\n }\n }\n }\n }\n game.drawLines()\n }", "Initialize() {\n let board = new BoardData_1.BoardData();\n let whitePieces = this.CreatePieces(this.Players[0], board, 1, 0, Enum_1.Side.White); //Remove if not needed\n let blackPieces = this.CreatePieces(this.Players[1], board, 6, 7, Enum_1.Side.Black); //Remove if not needed\n this.gameData = new GameData_1.GameData(this.Id, board);\n this.gameData.PickFirstPlayer(this.Players); //move this so it is done first\n //send initial game setup to clients\n for (var i = 0; i < this.Players.length; i++) {\n Server_1.SendNetworkMessage(\"InitializeGame\", this.gameData, this.Players[i].Connection);\n }\n this.GameHistory.Board = board.Copy();\n for (var i = 0; i < whitePieces.length; i++) {\n whitePieces[i].SetBoardData(this.gameData.Board);\n blackPieces[i].SetBoardData(this.gameData.Board);\n }\n console.log(\"Game started\");\n }", "function initGameBoard(height,width){\n\tconsole.log(\"test\")\n\tvar gameboard = '<p id = score style=\"text-align:center\">Score: </p>'\n gameboard += '<table id=\"gameboard\">'\n\n\tfor(i = 0; i<height; i++){\n\t\tgameboard += '<tr>';\n\t\tfor (j = 0; j < width; j++){\n\t\t\tvar id = \"r\"+i+\"d\"+j;\n\t\t\tvar grid = '<td id=\"'+id+'\"></td>';\n\t\t\tgameboard += grid;\n\t\t}\n\t\tgameboard += '</tr>';\n\t}\n\tgameboard += '</table>';\n\tgameboard += '<p style=\"text-align: center\"> Ohjaa matoa nuolinäppäimillä. Kuoleman jälkeen paina R syntyäksesi uudelleen </P>'\n\t$(\"#gameboard_div\").html(gameboard);\n\tinitSnake();\n\tdrawApple();\n}", "function loadRound(){\n\tenableButtons();\n\tupdateScore();\n\tunbindHandlers();\n\tshuffle();\n\n\tsetGame(0);\n\tsetGame(1);\n\tsetGame(2);\n\tbindSelectors();\n}", "generateGame() {\n\n this.generateGrounds();\n this.setPlayers();\n this.setPlayerStartArea();\n this.generateUnbreakableWalls();\n this.generateBreakableWalls();\n this.generateItems();\n GameElements.bombs.splice(0,GameElements.bombs.length);\n GameElements.explosions.splice(0,GameElements.explosions.length);\n \n }", "function newGame() {\n nRows = null;\n nCols = null;\n id = null;\n $(\"h1\").hide();\n $(\"#new_game\").hide();\n $(\"#board\").hide();\n $(\".set_game\").show();\n visitedCells = [];\n suspiciousCells = [];\n openedCells = [];\n}", "create() {\n // Reset the data to initial values.\n this.resetData();\n // Setup the data for the game.\n this.setupData();\n // Create the grid, with all its numbers.\n this.makeGrid();\n // Set up collisions for bullets/other harmful objects.\n this.setupBullets();\n // Create the player.\n this.makePlayer();\n // Create all audio assets.\n this.makeAudio();\n // Create the UI.\n this.makeUI();\n // Create the timer sprites (horizontal lines to the sides of the board.)\n this.makeTimerSprites();\n // Create particle emitter.\n this.makeParticles();\n gameState.cursors = this.input.keyboard.createCursorKeys(); // Setup taking input.\n\t}" ]
[ "0.7420864", "0.72548664", "0.7228805", "0.7216703", "0.715611", "0.70957667", "0.7085388", "0.70358056", "0.70005196", "0.692128", "0.691042", "0.6856177", "0.68503314", "0.6834303", "0.6823712", "0.68206155", "0.67755353", "0.6763411", "0.6713929", "0.67020357", "0.6700509", "0.66813946", "0.6655392", "0.6650496", "0.6648591", "0.663211", "0.6585252", "0.65766674", "0.65750045", "0.6542901", "0.6532062", "0.6526724", "0.65131086", "0.65084875", "0.6484974", "0.64828384", "0.6481761", "0.6473952", "0.646351", "0.6455434", "0.64500296", "0.64416915", "0.64337134", "0.6433246", "0.638481", "0.63827175", "0.6375829", "0.6374138", "0.6372556", "0.63717055", "0.636239", "0.6359913", "0.635368", "0.63532704", "0.6345284", "0.63408303", "0.6334214", "0.633408", "0.6333214", "0.6323799", "0.6305373", "0.629953", "0.6294035", "0.62876695", "0.62837696", "0.6282956", "0.62806165", "0.62765235", "0.6272478", "0.62720263", "0.6268327", "0.6266531", "0.6266046", "0.62553424", "0.6254925", "0.62502676", "0.6250049", "0.6246193", "0.6245266", "0.62383014", "0.62365836", "0.623265", "0.6230967", "0.62289226", "0.6226424", "0.6219822", "0.6214491", "0.6212585", "0.6206796", "0.6194645", "0.61932516", "0.61884594", "0.6184179", "0.6184141", "0.61720866", "0.6169723", "0.6169549", "0.6167418", "0.6166741", "0.61626136" ]
0.7423521
0
Check if (x,y) is a hit.
function isHit(x,y){ var move = makeMove(x,y); if (move!=null){ if (move.hit){ document.getElementById(y+'_'+x).setAttribute('class','hit'); //document.getElementById(y+'_'+x).innerHTML = moves; }else{ document.getElementById(y+'_'+x).setAttribute('class','miss'); //document.getElementById(y+'_'+x).innerHTML = moves; } return move.hit; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "testHit(x, y) {\n for (const i in this.position) {\n // console.log('x ' + x + ' otherx ' + this.position[i][0])\n if (x == this.position[i][0] && y == this.position[i][1]) {\n this.hit();\n return true;\n }\n }\n return false;\n }", "checkHit(givenX, givenY){\n\n let xcoor = givenX - this.getX(); //move to center\n let ycoor = givenY - this.getY();\n let out = false;\n\n //simple square hit detection\n if(xcoor < VERT_RAD/2.0 && xcoor > -VERT_RAD/2.0 \n && ycoor < VERT_RAD/2.0 && ycoor > -VERT_RAD/2.0 ){\n out = true;\n }\n\n return out;\n }", "detectHit(x, y)\n {\n if(dist(x, y, this.xPos, this.yPos) < 50)\n {\n return true;\n }\n return false;\n }", "function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }", "function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }", "function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }", "function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }", "function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }", "function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }", "function hit(x1, y1, x2, y2) {\n return Math.abs(x1 - x2) < CLICKBUSTER_THRESHOLD && Math.abs(y1 - y2) < CLICKBUSTER_THRESHOLD;\n }", "checkHit(givenX, givenY){\n throw new Error(\"No implementation of checkHit().\\n\");\n }", "checkIntersection(snake, x, y) {\n for (var i = 0; i < snake.length; i++) {\n var pos = snake.tail[i];\n if (pos[0] == x && pos[1] == y) {\n return true;\n }\n }\n return false;\n }", "function hitTest(r1, r2){\n return (((r1.x + r1.w >= r2.x) && (r1.x <= r2.x + r2.w)) &&\n ((r1.y + r1.h >= r2.y) && (r1.y <= r2.y + r2.h)));\n}", "function hit(a,b){\n\tvar hit = false;\n\tif(b.x + b.width >= a.x && b.x < a.x + a.width){\n\t\tif(b.y + b.height >= a.y && b.y < a.y + a.height){\n\t\t\thit = true;\n\t\t}\n\t}\n\tif(b.x <= a.x && b.x + b.width >= a.x + a.width){\n\t\tif(b.y <= a.y && b.y + b.height >= a.y + a.height){\n\t\t\thit = true;\n\t\t}\t\n\t}\n\tif(a.x <= b.x && a.x + a.width >= b.x + b.width){\n\t\tif(a.y <= b.y && a.y + a.height >= b.y + b.height){\n\t\t\thit = true;\n\t\t}\t\n\t}\n\t\n\treturn hit;\n}", "contains(x, y) {\n return (x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.w);\n }", "contains(x, y) {\n return (x >= this.x - this.w &&\n x <= this.x + this.w &&\n y >= this.y - this.h &&\n y <= this.y + this.h)\n }", "pointInBounds(x, y) {\n if (this.x1 < this.x2) {\n if ((x < this.x1) || (x > this.x2)) return false\n }\n else {\n if ((x < this.x2) || (x > this.x1)) return false\n }\n if (this.y1 < this.y2) {\n if ((y < this.y1) || (y > this.y2)) return false\n }\n else {\n if ((y < this.y2) || (y > this.y1)) return false\n }\n return true\n }", "contain(x2, y2) {\n let d = dist (x2, y2, this.x, this.y);\n if (d < this.r * 2) {\n return true;\n }\n else {\n return false;\n }\n }", "contains(x, y) {\n return x > this.left && x < this.right && y > this.top && y < this.bot;\n }", "detectHit(x, y) {\n // use the distance formula to compute how far the key is\n // from the supplied position\n if (dist(x,y, this.xPos, this.yPos) < 50) {\n // we are close! this is a hit\n\n // move the key\n this.xPos = random(0,width);\n this.yPos = random(0,height);\n\n // tell the main program that a hit occurred\n return true;\n }\n // not close - not a hit\n return false;\n }", "static isHit(source, y, x, indicator)\n {\n //for erosion\n if(indicator)\n {\n //Equal to the hitMaker\n if( source.data[y - 1][x - 1][0] == this.hitMarker[0] &&\n source.data[y - 1][x ][0] == this.hitMarker[1] &&\n source.data[y - 1][x + 1][0] == this.hitMarker[2] &&\n\n source.data[y ][x - 1][0] == this.hitMarker[3] &&\n source.data[y ][x ][0] == this.hitMarker[4] &&\n source.data[y ][x + 1][0] == this.hitMarker[5] &&\n\n source.data[y + 1][x - 1][0] == this.hitMarker[6] &&\n source.data[y + 1][x ][0] == this.hitMarker[7] &&\n source.data[y + 1][x + 1][0] == this.hitMarker[8])\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n //for dilation\n else\n {\n //true if only one is equal to hitMarker\n if( source.data[y - 1][x - 1][0] == this.hitMarker[0] ||\n source.data[y - 1][x ][0] == this.hitMarker[1] ||\n source.data[y - 1][x + 1][0] == this.hitMarker[2] ||\n\n source.data[y ][x - 1][0] == this.hitMarker[3] ||\n source.data[y ][x ][0] == this.hitMarker[4] ||\n source.data[y ][x + 1][0] == this.hitMarker[5] ||\n\n source.data[y + 1][x - 1][0] == this.hitMarker[6] ||\n source.data[y + 1][x ][0] == this.hitMarker[7] ||\n source.data[y + 1][x + 1][0] == this.hitMarker[8])\n {\n return true;\n }\n else\n {\n return false;\n }\n }\n }", "contains(x, y) {\n return x < this.right && x > this.left && y < this.bottom && y > this.top;\n }", "containsPoint(x, y) {\n return ((this.x <= x) && ((this.x + this.width) >= x) &&\n (this.y >= y) && ((this.y - this.height) <= y));\n }", "contains(px, py) {\n let d = dist(px, py, this.x, this.y);\n if (d < this.r) {\n return true;\n } else {\n return false;\n }\n }", "in(x, y) {\n if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h) {\n return true\n }\n }", "contains(x, y) {\n\t\tlet d = dist(x, y, this.x, this.y);\n\t\treturn d < this.r;\n\t}", "function itsAHit(proj, currEnemy)\r\n{\r\n //if the projectiles y coordinate is within the enemies current y range\r\n if(proj.y >= currEnemy.y && proj.y <= (currEnemy.y + currEnemy.height)){\r\n //if the projectiles x coordinate is within the enemies current x range\r\n if((proj.x+proj.width) >= currEnemy.x && proj.x <= (currEnemy.x+currEnemy.width)){\r\n //return true cuz its a hit\r\n return true;\r\n }\r\n else{\r\n //return false cuz not in x range\r\n return false;\r\n }\r\n }\r\n else{\r\n //return false cuz not in y range\r\n return false;\r\n }\r\n}", "function isIn(x, y, p) {\n if (x >= p.x\n && x <= p.x + p.w\n && y >= p.y\n && y <= p.y + p.h) {\n return true;\n }\n\n return false;\n }", "function checkCollisionPoint( s, x, y ) {\n return ( s.x - s.img.width/2 < x && s.x + s.img.width/2 > x && s.y - s.img.height/2 < y && s.y + s.img.height/2 > y );\n}", "hitTest(mouseLoc) {\n if ( mouseLoc.x > this.loc.x &&\n mouseLoc.x < this.loc.x + this.myWidth &&\n mouseLoc.y > this.loc.y &&\n mouseLoc.y < this.loc.y + this.myHeight )\n return true;\n\n return false;\n}", "function hit(elemOne, elemTwo)\n{\n\tvar posOneTop = elemOne.offsetTop,\n\tposOneLeft = elemOne.offsetLeft,\n\tposOneHeight = elemOne.offsetHeight,\n\tposOneWidth = elemOne.offsetWidth ;\n\n\tvar posTwoTop = elemTwo.offsetTop,\n\tposTwoLeft = elemTwo.offsetLeft,\n\tposTwoHeight = elemTwo.offsetHeight,\n\tposTwoWidth = elemTwo.offsetWidth ;\n\tvar leftTop = posTwoLeft > posOneLeft && posTwoLeft < posOneLeft+posOneWidth && posTwoTop > posOneTop && posTwoTop < posOneTop+posOneHeight,\n\trightTop = posTwoLeft+posTwoWidth > posOneLeft && posTwoLeft+posTwoWidth < posOneLeft+posOneWidth && posTwoTop > posOneTop && posTwoTop < posOneTop+posOneHeight,\n\tleftBottom = posTwoLeft > posOneLeft && posTwoLeft < posOneLeft+posOneWidth && posTwoTop+posTwoHeight > posOneTop && posTwoTop+posTwoHeight < posOneTop+posOneHeight,\n\trightBottom = posTwoLeft+posTwoWidth > posOneLeft && posTwoLeft+posTwoWidth < posOneLeft+posOneWidth && posTwoTop+posTwoHeight > posOneTop && posTwoTop+posTwoHeight < posOneTop+posOneHeight;\n return leftTop || rightTop || leftBottom || rightBottom;\n}", "function checkPlayerHit(x, y){\n\tfor (var i = 0; i < balls.length; i++){\n\t\tif (Math.pow(x - balls[i].x, 2) + Math.pow(y - balls[i].y, 2)\n\t\t\t<= Math.pow(balls[i].radius, 2)){\n\t\t\tactive = false;\n\t\t\tgame = -1;\n\t\t}\n\t}\n}", "contains(x, y) {\n let d = dist(x, y, this.x, this.y);\n return (d <= this.r);\n }", "function check_hitbox(x, y, shape) {\n\t// if shape is a circle, check if the coordinate pair lies within a distance\n\t// less than the raidus to the center of the circle\n\tif (shape.type == \"circle\") {\n\t\tlet r = shape.w / 2;\n\t\tif (dist(x, y, shape.x, shape.y) < r) {\n\t\t\treturn true;\n\t\t}\n\t}\n\t// if shape is a square, check if the coordinate pair lies within the bounding box\n\telse if (shape.type == \"square\") {\n\t\tlet r = shape.w / 2;\n\t\t// check if both x and y are within the side length of the square\n\t\tif (x > shape.x - r && x < shape.x + r && y > shape.y - r && y < shape.y + r) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function playerIsAt(x, y) {\n return (player.x === x && player.y === y);\n}", "hits(dino) {\n if (this.x < dino.x + dino.width &&\n this.x + this.width > dino.x &&\n this.y < dino.y + dino.height &&\n this.height + this.y > dino.y) {\n return true;\n console.log('heelo');\n }\n else {\n return false;\n }\n }", "function collisionCheck(x, y, array) {\n for(var i = 0; i < array.length; i++)\n {\n if(array[i].x == x && array[i].y == y)\n return true;\n }\n return false;\n }", "hitCheck(a, b){ // colision\n var ab = a._boundsRect;\n var bb = b._boundsRect;\n return ab.x + ab.width > bb.x && ab.x < bb.x + bb.width && ab.y + ab.height > bb.y && ab.y < bb.y + bb.height;\n }", "isInside(x,y) {\r\n return ((x >= 0) && (x < this.width) && (y >= 0) && (y < this.height));\r\n }", "contains(x, y) {\n let coords = this.getBoundingBox();\n return (x > coords.x && x < coords.x+coords.width && y > coords.y && y < coords.y+coords.height);\n }", "function hitTest (r1, r2) {\n if ((r1.position.x + r1.width > r2.position.x) &&\n (r1.position.x < r2.position.x + r2.width) &&\n (r1.position.y + r1.height > r2.position.y) &&\n (r1.position.y < r2.position.y + r2.height))\n return true;\n else\n return false;\n}", "hitTest(X, Y, OBJECT) {\r\n if (this.lightOn) {\r\n if (OBJECT.position.x > this.house.position.x && OBJECT.position.x < this.house.position.x + 250) {\r\n if (X > this.house.position.x && X < this.house.position.x + 300) {\r\n if (Y > this.house.position.y && Y < this.house.position.y + 300) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n }", "function collision_detector(first, second) {\r\n var x1 = first.get(\"X\");\r\n var y1 = first.get(\"Y\");\r\n var width1 = first.get(\"width\");\r\n var height1 = first.get(\"height\");\r\n var x2 = second.get(\"X\");\r\n var y2 = second.get(\"Y\");\r\n var width2 = second.get(\"width\");\r\n var height2 = second.get(\"height\");\r\n\r\n if (x2 > x1 && x2 < x1 + width1 || x1 > x2 && x1 < x2 + width2) {\r\n if (y2 > y1 && y2 < y1 + height1 || y1 > y2 && y1 < y2 + height2) {\r\n return true;\r\n }\r\n } else {\r\n return false;\r\n }\r\n}", "checkTileHit(x, y){\n\t\tif(!this.grid[x][y]['isHit']){\n\t\t\tvar didHit = false;\n\t\t\tthis.grid[x][y]['isHit'] = true;\n\n\t\t\tswitch(this.grid[x][y]['isShip']){\n\t\t\t\tcase shipType.CARRIER:\n\t\t\t\t\tthis.ships.CARRIER--;\n\t\t\t\t\tif(this.ships.CARRIER == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte hangarfartyget.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte hangarfartyget.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte hangarfartyget.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte hangarfartyget.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.BATTLESHIP:\n\t\t\t\t\tthis.ships.BATTLESHIP--;\n\t\t\t\t\tif(this.ships.BATTLESHIP == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte slagsskeppet.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte slagsskeppet.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte slagsskeppet.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte slagsskeppet.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.CRUISER:\n\t\t\t\t\tthis.ships.CRUISER--;\n\t\t\t\t\tif(this.ships.CRUISER == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte kryssaren.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte kryssaren.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte kryssaren.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte kryssaren.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.SUBMARINE:\n\t\t\t\t\tthis.ships.SUBMARINE--;\n\t\t\t\t\tif(this.ships.SUBMARINE == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte ubåten.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte ubåten.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte ubåten.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte ubåten.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.DESTROYER:\n\t\t\t\t\tthis.ships.DESTROYER--;\n\t\t\t\t\tif(this.ships.DESTROYER == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte jagaren.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte jagaren.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte jagaren.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte jagaren.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif(this.isPlayer){\n\t\t\t\t$(\".player-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isHit\", \"true\");\n\n\t\t\t\tif(didHit){\n\t\t\t\t\t$(\".player-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isShip\", \"true\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$(\".enemy-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isHit\", \"true\");\n\n\t\t\t\tif(didHit){\n\t\t\t\t\t$(\".enemy-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isShip\", \"true\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(this.isPlayer){\n\t\t\t\tp2.shots++;\n\t\t\t\tif(didHit){\n\t\t\t\t\tp2.hits++;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tp1.shots++;\n\t\t\t\tif(didHit){\n\t\t\t\t\tp1.hits++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\twasHit: false,\n\t\t\t\tshipHit: didHit\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\twasHit: true\n\t\t};\n\t}", "hit(meteor) {\n let corners = calculateCorners(meteor);\n for (let i = 0; i < 4; i++) {\n if (containsPoint(this, corners[i * 2], corners[i * 2 + 1])) {\n return true;\n }\n }\n return false;\n }", "function intersects(x1, y1, w1, h1, x2, y2, w2, h2)\n{\nif(y2 + h2 < y1 ||\nx2 + w2 < x1 ||\nx2 > x1 + w1 ||\ny2 > y1 + h1)\n{\nreturn false;\n}\nreturn true;\n}", "connectionPoint(x, y) {\n return (\n x > this.x &&\n x < this.x + this.w &&\n y > this.y &&\n y < this.y + this.h\n );\n }", "function overlapsPoint(x, y) {\n\t\treturn !(\n\t\t\tthis.x + this.boundingBox.left >= x ||\n\t\t\tthis.x + this.boundingBox.right <= x ||\n\t\t\tthis.y + this.boundingBox.top >= y ||\n\t\t\tthis.y + this.boundingBox.bottom <= y\n\t\t);\n\t}", "static collision(point, x, y, dist = 15) {\n return Math.abs(point.x - x) <= dist && Math.abs(point.y - y) <= dist;\n }", "function collisionDetection(x, y) {\n if (\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\n x - getShipLocation(angle)[0] <= 35 &&\n x - getShipLocation(angle)[0] >= -35 &&\n y - getShipLocation(angle)[1] <= 35 &&\n y - getShipLocation(angle)[1] >= -35\n ) {\n // Calls crash screen when a collision is detected\n crashScreen();\n }\n}", "contains(x, y) {\n return (dist(this.v.x, this.v.y, x, y) <= this.r)\n }", "function checkIntersect(p0, p1, point){\n\t\t\t\t// One point needs to be above, while the other needs to be below -> the above conditions must be different.\n\t\t\t\t\n\t\t\t\tif( (p0.y > point.y) !== (p1.y > point.y) ){\n\t\t\t\t\t// One is above, and the other below. Now find if the x are positioned so that the ray passes through. Essentially interpolate the x at the y of the point, and see if it is larger.\n\t\t\t\t\tlet x = (p1.x - p0.x)/(p1.y - p0.y)*(point.y - p0.y) + p0.x\n\t\t\t\t\t\n\t\t\t\t\tisInside = x > point.x ? !isInside : isInside\n\t\t\t\t\t\n\t\t\t\t} // if\n\t\t\t}", "checkCoordinates(obj) {\n for (let elem of game.coordinates) {\n if (obj.x === elem.x && obj.y === elem.y) {\n if (elem.occupied) {\n return true;\n } else {\n return false;\n }\n }\n }\n }", "checkIntersection(x, y, w, h) {\n if ((this.x <= x + w) && (this.x + this.width >= x) &&\n (this.y <= y + h) && (this.y + this.height >= y)) {\n return true;\n } else {\n return false;\n }\n }", "function containsPoint(square, x, y) {\n let corners = calculateCorners(square);\n return (corners[0] < x && corners[2] > x && corners[1] < y && corners[5] > y);\n\n}", "contains(x, y) {\n const { _coords } = this\n // Algorithm & implementation thankfully taken from:\n // -> http://alienryderflex.com/polygon/\n\n let i,\n j = this.numVertices - 1\n let oddNodes = 0\n\n for (i = 0; i < this.numVertices; ++i) {\n const ix = _coords[i * 2]\n const iy = _coords[i * 2 + 1]\n const jx = _coords[j * 2]\n const jy = _coords[j * 2 + 1]\n\n if (((iy < y && jy >= y) || (jy < y && iy >= y)) && (ix <= x || jx <= x))\n oddNodes ^= Math.floor(ix + ((y - iy) / (jy - iy)) * (jx - ix) < x) //todo:\n\n j = i\n }\n\n return oddNodes !== 0\n }", "function checkbox_hit(x, y) {\n\tfor(var i = 0; i < cb_positions.length; ++i) {\n\t\tvar x0 = cb_positions[i].x;\n\t\tvar x1 = x0 + cb_width;\n\t\tvar y0 = cb_positions[i].y;\n\t\tvar y1 = y0 + cb_width;\n\t\tif(x >= x0 && x <= x1 && y >= y0 && y <= y1)\n\t\t\treturn i;\n\t}\n\treturn -1;\n}", "function pointEq(a, b) {\n return a.x === b.x && a.y === b.y;\n}", "function collisionDetection(x, y) {\r\n if (\r\n // The range of the detection is 35 each side enabling high incrimentation sprite values to be caught\r\n x - getShipLocation(angle)[0] <= 35 &&\r\n x - getShipLocation(angle)[0] >= -35 &&\r\n y - getShipLocation(angle)[1] <= 35 &&\r\n y - getShipLocation(angle)[1] >= -35\r\n ) {\r\n // Calls crash screen when a collision is detected\r\n crashScreen();\r\n }\r\n}", "hitPlayer(player){\n let halfHeight = player.height / 2;\n let halfWidth = player.width / 2;\n\n if(player.x + halfWidth > this.x && player.x - halfWidth < this.x + (this.width / 2) \n && player.y + halfHeight > this.y && player.y - halfHeight < this.y + (this.height / 2)){\n return 1;\n }\n else{\n return 0;\n }\n }", "function hitTest(point, obj) {\n if (obj.type == \"word\" || obj.type == \"pic\") {\n if (isInside(point, obj)) {\n return true;\n }\n } else if (obj.type == \"circle\") {\n if (isInCircle(point, obj)) {\n return true;\n }\n } else if (obj.type == \"line\") {\n var x0 = point.x;\n var y0 = point.y;\n var x1 = obj.x;\n var y1 = obj.y;\n var x2 = obj.x + obj.x_diff;\n var y2 = obj.y + obj.y_diff;\n var x = ((y1-y0)*(y2-y1) - x0*(x2-x1) - x1*(y2-y1)*(y2-y1)/(x2-x1)) / (-(x2-x1) - (y2-y1)*(y2-y1)/(x2-x1)); \n var y = -(x2-x1) / (y2-y1) * (x-x0) + y0;\n var closestPoint = {x:x, y:y};\n var dist = pointDistance(closestPoint,point);\n if (dist < obj.width) {\n var both_endpts_dist = pointDistance(closestPoint, {x:x1, y:y1}) + pointDistance(closestPoint, {x:x2, y:y2});\n var seg_length = pointDistance({x:x1, y:y1}, {x:x2, y:y2});\n if (both_endpts_dist - seg_length < 1) {\n return true;\n }\n }\n }\n return false;\n}", "inside(x, y) {\n let box = this.bbox();\n return x > box.x && y > box.y && x < box.x + box.width && y < box.y + box.height;\n }", "isInside(x, y) {\n return !((x < 0) || (x >= this.width) || (y < 0) || (y >= this.height));\n }", "function collision_check(a,b) {\n let res = (Math.abs(a.x-b.x) * 2 < (16+8)) &&\n (Math.abs(a.y-b.y) * 2< (16+8))\n return res;\n}", "function hit() {\n\t\tvar nx = snake_array[0].x;\n \t\tvar ny = snake_array[0].y;\n \t\t//hit border\n\t\tif(nx == -1 || ny == -1 || nx == w/c_sz || ny == h/c_sz) {\n\t\t\tlose();\n\t\t}\n\n\t\t//hit itself\n\t\tfor(var i = 1; i < snake_array.length; i++) {\n\t\t\tif(snake_array[i].x == nx && snake_array[i].y == ny) {\n\t\t\t\tlose();\n\t\t\t}\n\t\t}\n\t}", "function isInRange(x, y) {\r\n var inRange = true;\r\n\r\n if (\r\n x < sceneX ||\r\n x > sceneEndX - tileSize ||\r\n y < sceneY ||\r\n y > sceneEndY - tileSize\r\n ) {\r\n inRange = false;\r\n }\r\n\r\n if (x == sceneEndX && y == 270) {\r\n inRange = true;\r\n }\r\n\r\n return inRange;\r\n}", "function isLocationInsideBoard(x, y)\r\n{\r\n if ((x >= 0) && (y >= 0) && (x <= 7) && (y <= 7))\r\n {\r\n return true;\r\n }\r\n return false;\r\n}", "contains(posX, posY)\n {\n let distance = dist(this.x, this.y, posX, posY); \n return (distance < this.r);\n }", "function checkHitOrMiss(x, y, isPlayersTurn)\r\n{\r\n var board = isPlayersTurn? board2 : board1 ;\r\n\r\n /* board[x][y] has -1 then there's nothing there. Its a miss*/\r\n // alert(x+\",\"+y+\"[\"+board[x][y]+\"]\");\r\n return (board[x][y] == -1)?false : true ;\r\n}", "hit(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y)\n if (d < this.size / 2 + enemy.size / 2) {\n return true;\n } else {\n return false;\n }\n }", "function tryMatch(dx, dy, xx, xy, yx, yy) {\n for (let i=0; i<selection.length; i++) {\n let match = false;\n \n let x = (selection[i][0] - dx) * xx + (selection[i][1] - dy) * yx;\n let y = (selection[i][0] - dx) * xy + (selection[i][1] - dy) * yy;\n \n for (let k=0; k<currentPiece.length; k++) {\n if (x == currentPiece[k][0] && y == currentPiece[k][1]) {\n match = true;\n break;\n }\n }\n \n if (!match) return false;\n }\n \n return true;\n }", "checkCollisionAt(x, y) {\n return this.gameEngine.checkCollisions(this.collider.createTheoriticalBoundingBox(x, y))\n }", "mouseOverCheck(x,y){\n let d = dist(x,y,this.locX,this.locY);\n if(d<this.ballSize/2){return true;}\n else{return false;}\n }", "function checkCollision(x1, y1, h1, w1, x2, y2, h2, w2) {\n\n if (x1 < x2 + w2 && x1 + w1 > x2 && y1 < y2 + h2 && y1 + h1 > y2) {\n return true;\n }\n else {\n return false;\n }\n}", "function checkIfPointIsInside(xp, yp, x, y) {\n var i, j, c = 0;\n for (i = 0, j = xp.length - 1; i < xp.length; j = i++) {\n if ((((yp[i] <= y) && (y < yp[j])) ||\n ((yp[j] <= y) && (y < yp[i]))) &&\n (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i]))\n c = !c;\n }\n return c;\n }", "function collision (px,py,pw,ph,ex,ey,ew,eh){\nreturn (Math.abs(px - ex) *2 < pw + ew) && (Math.abs(py - ey) * 2 < ph + eh);\n \n}", "function segmentHit(ax, ay, bx, by, cx, cy, dx, dy) {\n return orient2D(ax, ay, bx, by, cx, cy) *\n orient2D(ax, ay, bx, by, dx, dy) <= 0 &&\n orient2D(cx, cy, dx, dy, ax, ay) *\n orient2D(cx, cy, dx, dy, bx, by) <= 0;\n }", "function _oneOfPointsWithinRect(aX, aY, aW, aH, bX, bY, bW, bH) {\n\t// calculate corner points\n\tvar aTopLeft = {'x':aX, 'y':aY};\n\tvar aTopRight = {'x':aX + aW,'y':aY};\n\tvar aBotLeft = {'x':aX, 'y':aY + aH};\n\tvar aBotRight = {'x':aX + aW,'y':aY + aH};\n\n\tvar aPoints = [aTopLeft, aTopRight, aBotLeft, aBotRight];\n\n\t// go through aPoints from end to start because\n\t// presumed most common collision is player\n\t// with front to something, and just why not\n\tfor (var i = aPoints.length - 1; i >= 0; i--) {\n\t\tvar x = aPoints[i].x;\n\t\tvar y = aPoints[i].y;\n\t\tif (y >= bY && y <= bY + bH) {\n\t\t\t// we have vertical collision\n\t\t\tif (x >= bX && x <= bX + bW) {\n\t\t\t\t// we have horizontal collision as well\n\t\t\t\t// and therefore a total collision\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}", "function isIntersecting (hitbox1, hitbox2) {\n return (\n // top of hitbox1\n hitbox1.y < hitbox2.y + hitbox2.height &&\n // right of hitbox1\n hitbox1.x + hitbox1.width > hitbox2.x &&\n // bottom of hitbox1\n hitbox1.y + hitbox1.height > hitbox2.y &&\n // left of hitbox1\n hitbox1.x < hitbox2.x + hitbox2.width\n );\n}", "function attackHitTest(obj1, obj2) {\n\t/* app.main.ctx.save();\n app.main.ctx.translate(obj1.attackPosition.x,obj1.attackPosition.y);\n app.main.ctx.fillStyle = \"green\";\n app.main.ctx.fillRect(0,0,obj1.attackSize.x, obj1.attackSize.y);\n app.main.ctx.restore(); */\n\tif (obj1.attackPosition.x < obj2.position.x + obj2.size.x && obj1.attackPosition.x + obj1.attackSize.x > obj2.position.x && obj1.attackPosition.y < obj2.position.y + obj2.size.y && obj1.attackSize.y + obj1.attackPosition.y > obj2.position.y) {\n\t\treturn true;\n\t}\n}", "function pointIsBetween(a, b, c) {\n\n if (a.x !== b.x) {\n return within(a.x, c.x, b.x) && within(a.y, c.y, b.y);\n } else {\n return within(a.y, c.y, b.y);\n }\n }", "function collides(a, b) {\n if(a.x == b.x && a.y == b.y) return true;\n return false;\n }", "function checkOverlap(x,y){\n\tfor(var i = 0; i < holeArray.length; i++){\n\t\tif(x >= holeArray[i].x-100&&x <= holeArray[i].x+100&&y >= holeArray[i].y - 100&& y<= holeArray[i].y+100){\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}", "function checkHits(coords) {\n var hits = Object.values(roaches).filter(function(x){\n return Math.abs(x.x - coords.x) + Math.abs(x.y - coords.y) < HITBOX;\n });\n return hits;\n}", "checkHit(givenX, givenY){\n let out = OPERATIONS.NONE;\n let hit = false;\n\n let shapes = this.shapeList.iterator();\n\n while(!shapes.isEmpty() && !hit){\n //check the shape\n let shape = shapes.currItem();\n hit = shape.checkHit(givenX,givenY);\n\n if(hit){\n if(this.selectedButton != null){\n this.selectedButton.unselected();\n }\n this.selectedButton = shape;\n shape.selectedCurrently();\n\n out = shape.getEnum();\n hit = true;\n }\n\n shapes.next();\n }\n\n return out;\n }", "function checkSelf(x, y) {\n for (var j = 1; j < snakePositions.length - 1; j++) {\n var checkSegment = snakePositions[j];\n if (x == checkSegment[0] && y == checkSegment[1]) {\n return true;\n }\n }\n return false;\n}", "boundsCheck(xM, yM, x, y, w, h){ \n if(xM > x && xM < x + w && yM > y && yM < y+ h){\n return true; //mouse in boundary \n }else{\n return false; //mouse not in boundary \n } \n}", "hitTestSprite(sprite, offsetX, offsetY) {\n\n\n let hit = false;\n\n if (!sprite.circular) {\n\n let left = sprite.gx + offsetX,\n right = sprite.gx + sprite.width - offsetX,\n top = sprite.gy + offsetY,\n bottom = sprite.gy + sprite.height - offsetY;\n\n\n hit \n = this.x > left && this.x < right \n && this.y > top && this.y < bottom;\n }\n\n else {\n\n let vx = this.x - (sprite.gx + sprite.radius),\n vy = this.y - (sprite.gy + sprite.radius),\n distance = Math.sqrt(vx * vx + vy * vy);\n\n hit = distance < sprite.radius;\n }\n return hit;\n }", "boundsCheck(xM, yM, x, y, w, h){ \n if(xM > x && xM < x + w && yM > y && yM < y+ h){\n return true; //mouse in boundary \n }else{\n return false; //mouse not in boundary\n }\n }", "intersects_rect(rect) {\n console.log(\"hitbox\",hb_rect(this,0));\n console.log(\"rectpos\",rect[0]);\n if ((hb_rect(rect,0) >= hb_rect(this,0) && hb_rect(rect,0) <= hb_rect(this,2))\n || (hb_rect(rect,2) >= hb_rect(this,0) && hb_rect(rect,2) <= hb_rect(this,2))) {\n if ((hb_rect(rect,1) >= hb_rect(this,1) && hb_rect(rect,1) <= hb_rect(this,3))\n || (hb_rect(rect,3)-1 >= hb_rect(this,1) && hb_rect(rect,3)-1 <= hb_rect(this,3))) {\n console.log(\"hit\");\n return true;\n }\n else {console.log(\"xhit\")}\n }\n else {console.log(\"nohit\")}\n return false;\n }", "function checkEnemies(x,y) {\r\n if ((enemyRover1.x === x) && (enemyRover1.y === y)) {\r\n return false; //there is an enemy 1\r\n } else if ((enemyRover2.x === x) && (enemyRover2.y === y)) {\r\n return false; //there is an enemy 2\r\n } else {\r\n return true; //no enemies\r\n }\r\n}", "function hitTest(paddle, mouseX, mouseY) {\n\tvar horizontalCheck = (mouseX > paddle.x) && \n\t (mouseX < paddle.x + paddle.width);\n\treturn horizontalCheck;\n}", "function Same_coord(x1, y1, x2, y2, same) {\n if (same === 'same') {\n return ((x1 === x2) && (y1 === y2)) ? true : false;\n } else {\n return ((x1+same > x2) && (x1-same < x2) && (y1+same > y2)\n && (y1-same < y2)) ? true : false;\n }\n}", "clicked(x, y)\r\n {\r\n var d = dist(x, y, this.x, this.y);\r\n if(d < this.radius)\r\n {\r\n return true;\r\n }\r\n }", "canBeHit( dir , x0, y0, x1, y1 ){\n\t\tif ( Directions.isHorizontal(dir)){\n\t\t\treturn this.y0 - this.width < y0 && this.y1 + this.width > y0 || this.y0 - this.width < y1 && this.y1 + this.width > y1;\n\t\t}else{\n\t\t\treturn this.x0 - this.width < x0 && this.x1 + this.width > x0 || this.x0 - this.width < x1 && this.x1 + this.width > x1;\n\t\t}\n\t}", "function pixelWithinRect(x, y, rectX, rectY, rectW, rectH) {\n\tif (y >= rectY && y <= rectY + rectH) {\n\t\t// we have vertical collision\n\t\tif (x >= rectX && x <= rectX + rectW) {\n\t\t\t// we have horizontal collision as well\n\t\t\t// and therefore a total collision\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function hitBox( source, target ) {\n\treturn !(\n\t\t( ( source.y + source.height ) < ( target.y ) ) ||\n\t\t( source.y > ( target.y + target.height ) ) ||\n\t\t( ( source.x + source.width ) < target.x ) ||\n\t\t( source.x > ( target.x + target.width ) )\n\t);\n}", "function hitboxIntersectCheck (a, b) {\n\n //If error, ensure items have this.height / this.width.\n if (a.bottom() > b.top() && a.top() < b.bottom() && a.left() < b.right() && a.right() > b.left()) {\n\n return true;\n }\n\n return false;\n}", "function mapCollision(x, y){\r\n\tif((x >= 490 && x <= 510) && ((y >= 490 && y <= 600) || (y >= 0 && y <= 110)))\r\n\t\treturn true;\r\n\telse if((x >= 110 && x <= 320) && ((y >= 140 && y <= 160) || (y >= 440 && y <= 460)))\r\n\t\treturn true;\r\n\telse if((x >= 680 && x <= 890) && ((y >= 440 && y <= 460) || (y >= 140 && y <= 160)))\r\n\t\treturn true;\r\n\telse if((y >= 290 && y <= 310) && ((x >= 590 && x <= 680) || (x >= 320 && x <= 410)))\r\n\t\treturn true;\r\n\telse if((y >= 290 && y <= 310) && ((x >= 0 && x <= 110) || (x >= 890 && x <= 1000)))\r\n\t\treturn true;\r\n\telse if((y >= 250 && y <= 350) && ((x >= 410 && x <= 430) || (x >= 570 && x <= 590)))\r\n\t\treturn true;\r\n\telse\r\n\t\treturn false;\r\n}", "function validateCoord(x, y){\n x = Number(x);\n y = Number(y);\n let length = game.grid.length;\n return x >= 0 && x < length && y >= 0 && y < length;\n}" ]
[ "0.82810587", "0.7867772", "0.78559047", "0.7459645", "0.7459645", "0.7459645", "0.7459645", "0.7459645", "0.73976296", "0.73644", "0.7203255", "0.7178318", "0.7080101", "0.70623004", "0.701144", "0.700678", "0.6977696", "0.6976007", "0.69750476", "0.6967083", "0.6948406", "0.69057643", "0.6901649", "0.68999034", "0.68959767", "0.6877109", "0.68767077", "0.68163455", "0.67892075", "0.6785108", "0.67806983", "0.6773809", "0.67645603", "0.6757848", "0.67370903", "0.6724708", "0.66896635", "0.66471416", "0.6609768", "0.66027987", "0.65978", "0.65472704", "0.65467995", "0.6545082", "0.65131927", "0.6504599", "0.6501138", "0.64982104", "0.64958894", "0.6495309", "0.64840037", "0.6479529", "0.6474252", "0.64704704", "0.64701617", "0.6467169", "0.6463155", "0.64610964", "0.6448828", "0.6439205", "0.643666", "0.64190966", "0.640786", "0.6402608", "0.6401711", "0.6399335", "0.63974607", "0.63960135", "0.6386419", "0.6381029", "0.6376498", "0.6358142", "0.6355009", "0.6340825", "0.63267434", "0.6310175", "0.6309565", "0.6299294", "0.6298125", "0.6297114", "0.62938917", "0.6292032", "0.62667215", "0.6266096", "0.6262177", "0.62606186", "0.6247154", "0.62455606", "0.62436324", "0.62421507", "0.6223296", "0.62211335", "0.6217875", "0.62148666", "0.62102944", "0.6205854", "0.62023956", "0.6201644", "0.61939245", "0.6186833" ]
0.70968825
12
Given that a particular cell is a hit, try to find all blocks of the ship.
function exploreNeighbors(x,y){ function labelEmpty(x,y){ if (x>=0 && x<game.board_size.width && y>=0 && y<game.board_size.height){ document.getElementById(y+'_'+x).setAttribute('class','avoid'); board[x][y] = null; // Indicate that cell should never be examined } } function pursueShip(x,y, xp, yp){ ships.sort(); var maxSize = ships[ships.length -1]; var length = 0; while (length<=maxSize && isHit(x + xp*length, y + yp*length)){ // Label cells on either side as empty labelEmpty(x + xp*length + yp,y + yp*length + xp); labelEmpty(x + xp*length - yp,y + yp*length - xp); length++; } length = 1; xp = -xp; yp = -yp; while (length<=maxSize && isHit(x + xp*length, y + yp*length)){ // Label cells on either side as empty labelEmpty(x + xp*length + yp,y + yp*length + xp); labelEmpty(x + xp*length - yp,y + yp*length - xp); length++; } } // Pick a direction if (isHit(x+1,y)){ labelEmpty(x,y+1); labelEmpty(x,y-1); pursueShip(x,y,1,0); } else if (isHit(x-1,y)){ labelEmpty(x,y+1); labelEmpty(x,y-1); pursueShip(x,y,-1,0); } else if (isHit(x,y+1)){ labelEmpty(x+1,y); labelEmpty(x-1,y); pursueShip(x,y,0,1); } else if (isHit(x,y-1)){ labelEmpty(x+1,y); labelEmpty(x-1,y); pursueShip(x,y,0,-1); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findReachableTiles(x, y, range, isMoving) {\n var q = [];\n var start = [x, y, 0];\n var marked = [];\n marked.push(x * mapWidth + y);\n q.push(start);\n\n // Breadth first search to find all possible destinations\n while (q.length > 0) {\n\n pair = q.splice(0, 1)[0];\n // console.log(pair[0] + \" \" + pair[1]);\n\n // Move range check\n if (pair[2] >= range) continue;\n\n // Enumerate all possible moves\n for (dx = -1; dx <= 1; dx++) {\n for (dy = -1; dy <= 1; dy++) {\n\n // Make sure only vertical or horizontal moves\n if (dx != 0 && dy != 0) continue;\n\n var nx = pair[0] + dx;\n var ny = pair[1] + dy;\n var d = pair[2] + 1;\n\n // Bounds check\n if (nx < 0 || nx >= mapHeight || ny < 0 || ny >= mapWidth) continue;\n\n // Terrain check\n if (selectedCharacter.skill_no != 6 && blockMaps[nx][ny] != 0 && isMoving) continue;\n\n // bounds and obstacle check here\n if ($.inArray(nx * mapWidth + ny, marked) === -1) {\n marked.push(nx * mapWidth + ny);\n q.push([nx, ny, d]);\n }\n \n }\n } \n \n }\n\n $.each(marked, function(i, coord) {\n var x = Math.floor(coord / mapWidth);\n var y = coord % mapWidth;\n marked[i] = [x, y];\n //console.log(marked[i]);\n });\n return marked;\n}", "function detectHit() {\n //all about those wall hits\n if (ball.x+ball.radius > width) {\n //right wall\n //'bounce'\n ball.velocity.x = -ball.velocity.x;\n ball.x = width-ball.radius;\n\t return;\n }\n if (ball.x-ball.radius < 0) {\n //left wall\n\t ball.velocity.x = -ball.velocity.x;\n\t ball.x = ball.radius;\n\t return;\n }\n if (ball.y+ball.radius > height) {\n //upper height\n //'bounce'\n\t ball.velocity.y = -ball.velocity.y;\n\t ball.y = height-ball.radius;\n\t return;\n }\n \n // hit against base block\n if (ball.y-ball.radius < baseBlock.y+baseBlock.height && game.state === \"running\") {\n if (ball.x >= baseBlock.x && ball.x < baseBlock.x+baseBlock.width) {\n //if ball is between start and end of baseBlock aka you hit the block and aren't dead\n ball.velocity.x += baseBlock.dir*50;\n //bounce up\n ball.velocity.y = -ball.velocity.y;\n ball.y = baseBlock.y+baseBlock.height+ball.radius;\n } else {\n //this is the case that you didn't hit the block and you dead\n game.lives--;\n game.score = 0;\n resetbaseBlock();\n game.state = \"ready\";\n updateStatus();\n }\n\t return;\n }\n \n // we hit a block and we're making progress!\n if (ball.y+ball.radius < height-ROWS*blockHeight)\n //nothing is being hit, we good\n\t return;\n \n var col = Math.floor((ball.x-ball.radius)/blockWidth);\n var row = Math.floor((height-ball.y-ball.radius)/blockHeight);\n if (row < 0 || col < 0 || blocks[row][col].status === 1)\n //fractions less than 0 meaning that the ball has not hit anything yet\n\t return;\n \n //ball.x-ball.radius\n var x = col*blockWidth;\n //height - ball.y - ball.radius\n var y = height-row*blockHeight;\n if (ball.x+ball.radius >= x && ball.x-ball.radius < x+blockWidth && ball.y+ball.radius > y-blockHeight && ball.y-ball.radius < y) {\n //'bounce'\n ball.velocity.y = -ball.velocity.y;\n blocks[row][col].status = 1;\n scene.remove(blocks[row][col].object);\n game.score++;\n game.blockCount--;\n updateStatus();\n }\n}", "function hit_ship(coords, ships_global, room) {\n\n var ship_1 = ships_global[1].ships;\n var ship_2 = ships_global[2].ships;\n var ship_3 = ships_global[3].ships;\n var ship_4 = ships_global[4].ships;\n for (var i = 0; i < ship_1.length; i++) {\n ship_1[i].hit(coords, room);\n };\n for (var i = 0; i < ship_2.length; i++) {\n ship_2[i].hit(coords, room);\n };\n for (var i = 0; i < ship_3.length; i++) {\n ship_3[i].hit(coords, room);\n };\n for (var i = 0; i < ship_4.length; i++) {\n ship_4[i].hit(coords, room);\n };\n}", "function loadBlocksInObjectGrid(){\n console.log(\"Map has been loaded\");\n for(var y=0; y<15 ; y++){\n for(var x=0; x<17 ; x++){\n if( objectGrid[y][x] == 1){\n var newBlock = new destructibleBlock(x,y);\n } \n }\n }\n}", "function locate(element, ship, check) {\n for (var i = 0; i < Number(ship.className[6]); ++i) {\n if (Number(element.id[6]) + i === 10) {\n return \"block\";\n } \n var newElement = document.getElementById(\"ship_\" + element.id[4] + (Number(element.id[6] + i)));\n check = true;\n if (!shipIsInBoard(newElement, ship)) {\n check = false;\n break;\n }\n }\n return check;\n}", "hunt(cells) {\n if (cells.length > 0) {\n for (let i = 0; i < cells.length; i++) {\n let cell = cells[i];\n if (!cell.visited) {\n let neighbors = this.findNeighbors(cell);\n for (let j = 0; j < neighbors.length; j++) {\n let neighbor = neighbors[j];\n if (neighbor.visited) return { cell: cell, neighbor: neighbor };\n }\n }\n }\n } else {\n return null;\n }\n }", "function findNeighbouringBlocks(xpos, ypos){\n let neighbours = [];\n if (xpos > 0){\n neighbours.push([xpos - 1, ypos]);\n if (ypos > 0) {\n neighbours.push([xpos - 1, ypos - 1]);\n }\n if (ypos < levelMap[xpos].length - 1){\n neighbours.push([xpos - 1, ypos + 1]);\n }\n }\n if (xpos < levelMap.length - 1){\n neighbours.push([xpos + 1, ypos]);\n if (ypos > 0){\n neighbours.push([xpos + 1, ypos - 1]);\n }\n if (ypos < levelMap[xpos].length - 1){\n neighbours.push([xpos + 1, ypos + 1]);\n }\n }\n if (ypos > 0){\n neighbours.push([xpos, ypos - 1]);\n }\n if (ypos < levelMap[xpos].length - 1){\n neighbours.push([xpos, ypos + 1]);\n }\n return neighbours;\n }", "gatherMatchingBlocks(matches) {\n this.nullifyMatchesInGridArray(matches);\n\n let beingSwapped = matches.filter(e => e.beingSwapped);\n const arrTypes = [...new Set(matches.map(m => m.id))];\n\n /* in this case this is automatch and we need to set target\n blocks for each match so that the rest of certain color can \n go to target block position\n */\n\n // array of all matches types... for example [\"ball_red\", \"ball_green\"] etc.\n for (let _id of arrTypes) {\n if (beingSwapped.map(m => m.id).includes(_id)) { continue; }\n console.log(_id);\n let currentMatchItems = matches.filter(e => e.id === _id);\n let central = Math.floor(currentMatchItems.length / 2);\n let centralItem = matches.indexOf(matches.find(m => m === currentMatchItems[central]));\n matches[centralItem].beingSwapped = true; //?? might cause problems!!!!\n beingSwapped.push(matches[centralItem]);\n }\n\n for (let m = 0; m < beingSwapped.length; m++) {\n let thisColorMatchesIds = matches.filter(e => e.id === beingSwapped[m].id);\n for (let e = 0; e < thisColorMatchesIds.length; e++) {\n let targetBlock = thisColorMatchesIds.filter(x => x.beingSwapped)[0];\n let tweenTarget = this.blocks[thisColorMatchesIds[e].row][thisColorMatchesIds[e].col];\n\n if (!thisColorMatchesIds[e].beingSwapped) {\n let newX = this.globalBlocksPositions[targetBlock.row][targetBlock.col].x;\n let newY = this.globalBlocksPositions[targetBlock.row][targetBlock.col].y;\n TweenMax.to(tweenTarget.blockImg, .2, {\n x: newX,\n y: newY,\n alpha: 0,\n ease: Linear.easeNone,\n onComplete: () => { }\n });\n }\n else {\n TweenMax.to(tweenTarget.blockImg, .2, {\n alpha: 0,\n delay: .2,\n onComplete: () => { }\n });\n }\n }\n }\n }", "digCell(cell) {\r\n // Do not dig a flagged cell\r\n if (cell.flaged) return;\r\n\r\n if (cell.digged) {\r\n // Cell already digged, dig the 8 cells around\r\n this.forEachNeighbor( cell, (c2) => { this.uncover(c2); });\r\n }\r\n else {\r\n // Cell is not yet digged, uncover it\r\n this.uncover(cell);\r\n }\r\n }", "checkTileHit(x, y){\n\t\tif(!this.grid[x][y]['isHit']){\n\t\t\tvar didHit = false;\n\t\t\tthis.grid[x][y]['isHit'] = true;\n\n\t\t\tswitch(this.grid[x][y]['isShip']){\n\t\t\t\tcase shipType.CARRIER:\n\t\t\t\t\tthis.ships.CARRIER--;\n\t\t\t\t\tif(this.ships.CARRIER == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte hangarfartyget.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte hangarfartyget.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte hangarfartyget.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte hangarfartyget.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.BATTLESHIP:\n\t\t\t\t\tthis.ships.BATTLESHIP--;\n\t\t\t\t\tif(this.ships.BATTLESHIP == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte slagsskeppet.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte slagsskeppet.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte slagsskeppet.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte slagsskeppet.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.CRUISER:\n\t\t\t\t\tthis.ships.CRUISER--;\n\t\t\t\t\tif(this.ships.CRUISER == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte kryssaren.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte kryssaren.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte kryssaren.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte kryssaren.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.SUBMARINE:\n\t\t\t\t\tthis.ships.SUBMARINE--;\n\t\t\t\t\tif(this.ships.SUBMARINE == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte ubåten.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte ubåten.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte ubåten.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte ubåten.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase shipType.DESTROYER:\n\t\t\t\t\tthis.ships.DESTROYER--;\n\t\t\t\t\tif(this.ships.DESTROYER == 0){\n\t\t\t\t\t\tthis.ships.amount--;\n\n\t\t\t\t\t\tif(currentGame.isAiTurn){\n\t\t\t\t\t\t\tcurrentGame.printAction(p2.playername+\" sänkte jagaren.\");\n\t\t\t\t\t\t\tsendNotification(p2.playername+\" sänkte jagaren.\", \"success\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tcurrentGame.printAction(p1.playername+\" sänkte jagaren.\");\n\t\t\t\t\t\t\tsendNotification(p1.playername+\" sänkte jagaren.\", \"success\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdidHit = true;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif(this.isPlayer){\n\t\t\t\t$(\".player-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isHit\", \"true\");\n\n\t\t\t\tif(didHit){\n\t\t\t\t\t$(\".player-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isShip\", \"true\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$(\".enemy-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isHit\", \"true\");\n\n\t\t\t\tif(didHit){\n\t\t\t\t\t$(\".enemy-container div.grid_square[data-column='\"+x+\"'][data-row='\"+y+\"']\").attr(\"data-isShip\", \"true\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(this.isPlayer){\n\t\t\t\tp2.shots++;\n\t\t\t\tif(didHit){\n\t\t\t\t\tp2.hits++;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tp1.shots++;\n\t\t\t\tif(didHit){\n\t\t\t\t\tp1.hits++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\twasHit: false,\n\t\t\t\tshipHit: didHit\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\twasHit: true\n\t\t};\n\t}", "getBlockCollision(block, direction=\"down\") {\n\n // check direction parameter\n let validDirections = [\"left\", \"right\", \"down\"];\n\n try{\n if (!validDirections.some(dir => direction === dir)) {\n throw new Error(`${direction} is not a valid direction!`);\n }\n } catch (error) {\n // console.log(error);\n return false;\n }\n\n\n // get cell row and column\n let [row, col] = this.getCellIndices(block);\n try {\n // check that bounds are in the grid\n if (row < 0 || row >= this.numRows || col < 0 || col >= this.numCols) {\n throw new Error(`Out of bounds: row=${row}, col=${col}`);\n }\n\n if (direction === \"down\") {\n if (row < this.numRows - 1 && this.rows[row + 1][col].filled) {\n return true;\n }\n } else if (direction === \"left\") {\n let str = this.rows[row + 1][col - 1].filled ? \"filled\" : \"empty\";\n \n // check left\n if (row < this.numRows - 1 && this.rows[row][col - 1].filled) {\n return true;\n }\n\n // check down left\n if (row + 1 < this.numRows - 1 && this.rows[row + 1][col - 1].filled) {\n return true;\n }\n } else if (direction === \"right\") {\n // check right\n if (row < this.numRows - 1 && this.rows[row][col + 1].filled) {\n return true;\n }\n\n // check down right\n if (row + 1 < this.numRows - 1 && this.rows[row + 1][col + 1].filled) {\n return true;\n }\n }\n } catch (error) {\n // console.log(error);\n return false;\n }\n\n return false;\n }", "function allCellsVisited() {\n\tvar lookupKey;\n\tconsole.log(\"enter allCellsVisited\");\n\tfor(x=0; x<600; x+=10) {\n\t\tfor(y=0; y<600; y+=10) {\n\t\t\tlookupKey = x+\":\"+y;\n\t\t\tif(maze[lookupKey].visited==false) {\n\t\t\t\tconsole.log(\"exit allCellsVisited with false\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n if(timer) {\n clearInterval(timer);\n }\n\treturn true;\n}", "function openCell(ele) {\n\t\n\t//for first cell in game run plantMines function\n\tif(ele.getElementsByClassName('uncover')[0]== null){\n\t\tplantMines(ele);\n\t}\n\n\tuncoverCell(ele);\n\tvar neighborarr = new Array ();\n\t\n\tif(ele.bomb== true){\n\t\tgameEnd(false);\n\t}\n\t\n\telse{\n\t\n\t\tfunction expandCells(c){\n\n\t\t\tvar cell = c.getElementsByClassName('uncover')[0];\n\n\t\t\tif(cell != null){\n\t\t\t\tvar n = cell.getAttribute('num');\n\t\t\t\tif(n == '0'){\n\n\t\t\t\t\tvar string = c.id ; \n\t\t\t\t\t\t//regex to parse cell id\n\t\t\t\t\tvar stringarr = string.match(/[a-zA-Z]+|[0-9]+/g);\n\n\t\t\t\t\tvar i = parseInt(stringarr[1]);\n\t\t\t\t\tvar j = parseInt(stringarr[3]);\n\n\t\t\t\t\t//2 for loops to go through each neighboring cell \n\t\t\t\t\tfor(var k = -1 ;k<2 ;k++ ){ \n\t\t\t\t\t\tfor(var l = -1 ;l<2 ;l++ ){ \n\t\t\t\t\t\t\tvar neighbor = document.getElementById('row'+(i+k)+'col'+(j+l));\n \n \t\t\t\t\t\t\tif(neighbor != null && neighbor.className !=\"touched\" && (k!=0 ||l!=0 )){\n \t\t\t\t\t\t\t\n \t\t\t\t\t\t\t\tuncoverCell(neighbor);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar neighborN =ele.getElementsByClassName('uncover')[0];\n\n\t\t\t\t\t\t\t\tif(neighborN !=null && neighborN.getAttribute('num')=='0'){\n\t\t\t\t\t\t\t\t\tneighborarr.push(neighbor);\n\n \t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\texpandCells(ele);\n\n\t\tfor(var m = 0; m<neighborarr.length;m++){\n\t\t\texpandCells(neighborarr[m]);\n\t\t}\n\t\tvar touched = document.getElementsByClassName('touched');\n\t\t\tdocument.getElementById('score').innerHTML = touched.length;\n\t\t\n\t\tvar spacesleft = document.getElementsByClassName('untouched');\n\t\t\n\t\tif(spacesleft.length == mines){\n\t\t\t\tgameEnd(true);\n\t\t\t\n\t\t}\t\n\t\t\n\t}\n}", "function allCells_(block) {\n for (var key in cells_) { block(key, cells_[key]); }\n }", "findMines(theBoard) {\n\n let temp = theBoard;\n let { rows, cols } = this.props;\n\n for (let i = 0; i < rows; i++) {\n for (let j = 0; j < cols; j++) {\n\n if (!(theBoard[i][j].mine)) {\n let numMines = 0;\n\n /* Get all surrounding tiles to this tile */\n let surround = this.checkSurroundingArea(i, j, temp);\n\n /* Check if any of the surrounding tiles are mines, and update minecount if so */\n surround.map(tile => {\n \n if (tile.mine) {\n numMines++;\n }\n\n });\n\n temp[i][j].mineCount = numMines;\n }\n \n }\n }\n\n return temp;\n }", "findCollison(field) {\n const { x, y } = this.position\n this.cells.forEach((rows, i) => {\n rows.forEach((cell, j) => {\n if (cell && ((y + i >= numberOfRows) || field[y + i][x + j])) {\n this.isAlive = false\n return\n }\n })\n })\n }", "function hit() {\n\t\tvar nx = snake_array[0].x;\n \t\tvar ny = snake_array[0].y;\n \t\t//hit border\n\t\tif(nx == -1 || ny == -1 || nx == w/c_sz || ny == h/c_sz) {\n\t\t\tlose();\n\t\t}\n\n\t\t//hit itself\n\t\tfor(var i = 1; i < snake_array.length; i++) {\n\t\t\tif(snake_array[i].x == nx && snake_array[i].y == ny) {\n\t\t\t\tlose();\n\t\t\t}\n\t\t}\n\t}", "findNeighbors(grid) {\r\n // console.log(`current cell position X:${this.positionX}, Y:${this.positionY}`);\r\n\r\n // items.neighbors = \r\n\r\n //left item position\r\n if (this.positionX - 1 > -1) {\r\n // console.log(`Left neighbor`);\r\n this.neighbors.push(grid.items[this.positionY][this.positionX - 1]);\r\n }\r\n //right item position\r\n if (this.positionX + 1 <= grid.width - 1) {\r\n // console.log(`Right neighbor`);\r\n this.neighbors.push(grid.items[this.positionY][this.positionX + 1]);\r\n }\r\n\r\n //top left item position\r\n if (this.positionX - 1 > -1 && this.positionY - 1 > -1) {\r\n // console.log('Top Left')\r\n this.neighbors.push(grid.items[this.positionY - 1][this.positionX - 1]);\r\n }\r\n //top right item position\r\n if (this.positionX + 1 <= grid.width - 1 && this.positionY - 1 > -1) {\r\n // console.log('Top Right')\r\n this.neighbors.push(grid.items[this.positionY - 1][this.positionX + 1]);\r\n }\r\n //top item position\r\n if (this.positionY - 1 > -1) {\r\n // console.log(`Top neighbor`);\r\n this.neighbors.push(grid.items[this.positionY - 1][this.positionX]);\r\n }\r\n\r\n //bottom left item position\r\n if (this.positionX - 1 > -1 && this.positionY + 1 <= grid.height - 1) {\r\n // console.log('Bottom Left');\r\n this.neighbors.push(grid.items[this.positionY + 1][this.positionX - 1]);\r\n }\r\n\r\n //bottom right item position\r\n if (this.positionX + 1 <= grid.width - 1 && this.positionY + 1 <= grid.height - 1) {\r\n // console.log('Bottom Right')\r\n this.neighbors.push(grid.items[this.positionY + 1][this.positionX + 1]);\r\n }\r\n //bottom item position\r\n if (this.positionY + 1 <= grid.height - 1) {\r\n // console.log(`Bottom neighbor`);\r\n this.neighbors.push(grid.items[this.positionY + 1][this.positionX]);\r\n }\r\n }", "startGame(cell) {\r\n // reset game counter\r\n this.flags = 0;\r\n this.remain = this.width * this.height - this.mines;\r\n\r\n // Place a mine on the start position, to ensure the place will be empty\r\n cell.mined = true;\r\n\r\n // Place the requested number of mines\r\n while(this.flags < this.mines) {\r\n let y1 = Math.floor(Math.random() * this.height);\r\n let x1 = Math.floor(Math.random() * this.width);\r\n\r\n if (this.cellGet(x1, y1).mined === false) {\r\n this.cellGet(x1, y1).mined = true;\r\n this.flags += 1;\r\n }\r\n }\r\n\r\n // Remove the mine from the start position\r\n cell.mined = false;\r\n\r\n // Update the \"count\" field in all cells\r\n this.field.forEach( center => {\r\n center.count = 0;\r\n this.forEachNeighbor(center, (c2) => {\r\n center.count += (c2.mined ? 1 : 0);\r\n })\r\n center.updateView();\r\n });\r\n\r\n // Game is now started\r\n this.state = STATES.play;\r\n this.time = 0;\r\n }", "dropAllBlocks() {\n console.log(\"dropping all blocks\");\n var droppedBlock = false;\n for(var i = this.rows-2; i >= 0; i--) {\n for(var j = 0; j < this.cols; j++) {\n if(this.grid[i][j] != 0 && this.grid[i+1][j] === 0) {\n this.dropBlock(j,i);\n droppedBlock = true;\n }\n }\n }\n this.updateSprites();\n return droppedBlock;\n }", "function findNeighbours(r, c, t){\r\n\r\n // note that tile7 is also a valid tile to form a combination, since its the rainbow tile. thats why it pops up in adjacent checks like here below\r\n\r\n // right\r\n if(c + 1 < levelArray[r].length && (levelArray[r][c + 1]._animation.name == t || levelArray[r][c+1]._animation.name == 'tile7') && levelArray[r][c + 1].checked == false) { // if the given value c+1 is smaller than the length of the current r(ow), and on that c+1 position a tile is matching the given one\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);} // first add the original tile that was used for comparing to the array (irst check to see if it isnt in there already)\r\n if(!findIn2dArray([r, c + 1, t],resultArray)){resultArray.push([r, c + 1, t]);} // then add the newly found tile to it (first check to see if it isnt in there already)\r\n levelArray[r][c].checked = true; // without this, the routine would keep pingponging between 2 tiles, since they keep matching with each other\r\n findNeighbours(r, c + 1, t); // call the function from itself (recursion) to find new matching tiles and keep adding those to the array aswell\r\n }\r\n\r\n // left\r\n if(c - 1 >= 0 && (levelArray[r][c - 1]._animation.name == t || levelArray[r][c - 1]._animation.name == 'tile7') && levelArray[r][c - 1].checked == false) {\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);}\r\n if(!findIn2dArray([r, c - 1, t],resultArray)){resultArray.push([r, c - 1, t]);}\r\n levelArray[r][c].checked = true;\r\n findNeighbours(r, c - 1, t);\r\n }\r\n\r\n // above\r\n if(r - 1 >= 0 && (levelArray[r - 1][c]._animation.name == t || levelArray[r - 1][c]._animation.name == 'tile7') && levelArray[r - 1][c].checked == false) {\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);}\r\n if(!findIn2dArray([r - 1, c, t],resultArray)){resultArray.push([r - 1, c, t]);}\r\n levelArray[r][c].checked = true;\r\n findNeighbours(r - 1, c, t);\r\n }\r\n\r\n // below\r\n if(r + 1 < levelArray.length && (levelArray[r + 1][c]._animation.name == t || levelArray[r + 1][c]._animation.name == 'tile7') && levelArray[r + 1][c].checked == false) {\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);}\r\n if(!findIn2dArray([r + 1, c, t],resultArray)){resultArray.push([r + 1, c, t]);}\r\n levelArray[r][c].checked = true;\r\n findNeighbours(r + 1, c, t);\r\n }\r\n\r\n}", "function drawInfectedBlock(grid, row, col) {\r\n for (var i = row; i <= row + 1; i += 1) {\r\n for (var j = col; j <= col + 1; j += 1) {\r\n drawInfectedPoint(grid, i, j);\r\n } \r\n }\r\n }", "function getNeighbors(tile){\r\n var indexofTile=tile.index(); //get the index of the cell on the grid\r\n var neighbors=[]; \r\n checknextNeigbor(tile); //call the function to check if there is next neighbor and push it in the array \r\n checkpreviousNeigbor(tile); //call the function to check if there is previous neighbor and push it in the array \r\n //check if cell has up neighbor\r\n if(tile.parent().prev().children().eq(indexofTile).length) { \r\n var upTile=tile.parent().prev().children().eq(indexofTile);\r\n neighbors.push(upTile);\r\n checknextNeigbor(upTile);\r\n checkpreviousNeigbor(upTile);\r\n }\r\n //check if cell has down neighbor\r\n if(tile.parent().next().children().eq(indexofTile).length){\r\n var downTile=tile.parent().next().children().eq(indexofTile);\r\n neighbors.push(downTile);\r\n checknextNeigbor(downTile);\r\n checkpreviousNeigbor(downTile);\r\n \r\n }\r\n function checknextNeigbor(cell){ //the function to check if there is next neighbor and push it in the array \r\n if(cell.next().length){ //check if cell has next neighbor\r\n neighbors.push(cell.next()); \r\n }}\r\n function checkpreviousNeigbor(cell){ //the function to check if there is previous neighbor and push it in the array \r\n if(cell.prev().length){ //check if cell has next neighbor\r\n neighbors.push(cell.prev()); \r\n }}\r\n return neighbors; //return neighbors of certain cell\r\n}", "function findSolnHelper(cell) {\n\n if (cell.equals(cellMap.get(coords[coords.length - 1]))) {\n solnSet.push(cell);\n return true;\n }\n\n var foundEnd = false;\n while (!visitedSet.isEmpty()) {\n discovered.push(cell);\n visitedSet.push(cell);\n for (var i = 0; i < cell.connections.length; i++ ) {\n\n if (!contains(discovered, cell.connections[i])) {\n if (findSolnHelper(cell.connections[i])) {\n solnSet.push(visitedSet.pop());\n return true;\n } else {\n visitedSet.pop();\n\n }\n }\n }\n return foundEnd;\n }\n return false;\n}", "function occupied(type, x, y, dir) {\n var result = false\n eachblock(type, x, y, dir, function(x, y) {\n if ((x < 0) || (x >= nx) || (y < 0) || (y >= ny) || getBlock(x,y))\n result = true;\n });\n return result;\n }", "function countSurroundingMines (cell) {\n var count = 0;\n /*\n for (let c of board.cells) {\n if (c.row >= cell.row - 1 && c.row <= cell.row + 1 && c.col >= cell.col - 1 && c.col <= cell.col + 1) {\n if (c.isMine) {\n count++;\n }\n }\n }\n if (count > 0 && cell.isMine) {\n count--;\n }\n */\n var surroundings = lib.getSurroundingCells(cell.row, cell.col);\n for (let c of surroundings) {\n if (c.isMine) {\n count++;\n }\n }\n return count;\n}", "function checkHits(coords) {\n var hits = Object.values(roaches).filter(function(x){\n return Math.abs(x.x - coords.x) + Math.abs(x.y - coords.y) < HITBOX;\n });\n return hits;\n}", "function blockify(piece) {\n\t\tpiece.shape.moveTo(blockHeap);\n\t\t\n\t\t/*\n\t\tTODO: will have to use a 2d array as trying to use .getIntersections for each tile is not performant enough\n\t\t\n\t\t*/\n\t\t\n\t\tfor (var i = 0, len = tetrjs.config.board.height; i<len; i++) {\n\t\t\tfor (var j = 0, len2 = tetrjs.config.board.width; j<len; j++) {\n\t\t\t\tvar x = (j * tetrjs.config.board.blockSize) + tetrjs.config.board.blockSize/2;\n\t\t\t\tvar y = (i * tetrjs.config.board.blockSize) + tetrjs.config.board.blockSize/2;\n\t\t\t\tvar ints = tetrjs.game.getBlockHeap().getIntersections(x,y);\n\t\t\t\tfor (var k = 0; k < ints.length; k++) {\n\t\t\t\t\t//console.log(\"intersects\", ints[k].getAbsolutePosition());\n\t\t\t\t\t/*_layer.add( new Kinetic.Rect({\n\t\t\t\t\t\tx: x,\n\t\t\t\t\t\ty: y,\n\t\t\t\t\t\twidth: 1,\n\t\t\t\t\t\theight: 1,\n\t\t\t\t\t\tstroke: \"red\",\n\t\t\t\t\t\tstrokeWidth:1,\n\t\t\t\t\t\tdetectionType: \"path\"\n\t\t\t\t\t}) );*/\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcurrentShape = null;\n\t}", "function checkIfAnyBlockCanFallDown() {\n\n let blockMapNumberOfColumns;\n let blockMapNumberOfRows;\n let x;\n let y;\n let thereWasMovementInThisRound = false;\n playerLevelEnvironment.listOfBlocksThatCanBeMoved = [];\n\n // let's iterate thru all the blocks we have in playerLevelEnvironment.listOfBlocksInThePlayingArea\n let isRectangleFilled;\n for (let i = 0; i < playerLevelEnvironment.listOfBlocksInThePlayingArea.length; i++) {\n\n // clear currentGravityCalculationArea\n let numberOfRows = currentGravityCalculationArea.length;\n let numberOfColumns = currentGravityCalculationArea[0].length;\n for (y = 0; y < numberOfRows; y++) {\n for (x = 0; x < numberOfColumns; x++) {\n currentGravityCalculationArea[y][x] = 0;\n }\n }\n\n // calculate currentGravityCalculationArea, without the current block\n\n // go thru the blocks one by one in playerLevelEnvironment.listOfBlocksInThePlayingArea\n // draw every block except the one we calculate now\n for (let k = 0; k < playerLevelEnvironment.listOfBlocksInThePlayingArea.length; k++) {\n if (k !== i) {\n blockMapNumberOfRows = Object.keys(playerLevelEnvironment.listOfBlocksInThePlayingArea[k].blockMap).length;\n blockMapNumberOfColumns = Object.keys(playerLevelEnvironment.listOfBlocksInThePlayingArea[k].blockMap[0]).length;\n for (y = 0; y < blockMapNumberOfRows; y++) {\n for (x = 0; x < blockMapNumberOfColumns; x++) {\n isRectangleFilled = playerLevelEnvironment.listOfBlocksInThePlayingArea[k].blockMap[y][x];\n if (isRectangleFilled === 1) {\n const yOnGravityCalculationArea = playerLevelEnvironment.listOfBlocksInThePlayingArea[k].blockY + y;\n const xOnGravityCalculationArea = playerLevelEnvironment.listOfBlocksInThePlayingArea[k].blockX + x;\n const colorOnGravityCalculationArea = playerLevelEnvironment.listOfBlocksInThePlayingArea[k].blockIndex + 1;\n currentGravityCalculationArea[yOnGravityCalculationArea][xOnGravityCalculationArea] = colorOnGravityCalculationArea;\n }\n }\n }\n }\n }\n\n // let's try to move the block downwards and look for overlap\n\n numberOfRows = currentGravityCalculationArea.length;\n numberOfColumns = currentGravityCalculationArea[0].length;\n for (y = 0; y < numberOfRows; y++) {\n let line = '';\n for (x = 0; x < numberOfColumns; x++) {\n line = line + currentGravityCalculationArea[y][x];\n }\n }\n\n let blockCanBeMoved = true;\n const yModifier = 0;\n numberOfRows = currentGravityCalculationArea.length;\n blockMapNumberOfRows = Object.keys(playerLevelEnvironment.listOfBlocksInThePlayingArea[i].blockMap).length;\n blockMapNumberOfColumns = Object.keys(playerLevelEnvironment.listOfBlocksInThePlayingArea[i].blockMap[0]).length;\n\n for (y = 0; y < blockMapNumberOfRows; y++) {\n for (x = 0; x < blockMapNumberOfColumns; x++) {\n isRectangleFilled = playerLevelEnvironment.listOfBlocksInThePlayingArea[i].blockMap[y][x];\n if (isRectangleFilled === 1) {\n const yOnCalculationArea = playerLevelEnvironment.listOfBlocksInThePlayingArea[i].blockY + y + yModifier + 1;\n const xOnCalculationArea = playerLevelEnvironment.listOfBlocksInThePlayingArea[i].blockX + x;\n if (yOnCalculationArea > (numberOfRows - 2)) {\n // block reached the bottom\n blockCanBeMoved = false;\n break;\n }\n if (currentGravityCalculationArea[yOnCalculationArea][xOnCalculationArea] !== 0) {\n // block collided with another block\n blockCanBeMoved = false;\n }\n if (blockCanBeMoved === true) {\n // no problem\n }\n }\n }\n }\n if (blockCanBeMoved === true) {\n playerLevelEnvironment.listOfBlocksThatCanBeMoved.push(i);\n thereWasMovementInThisRound = true;\n } else {\n // block could not be moved\n }\n }\n\n calculateCurrentGravityCalculationArea();\n\n return thereWasMovementInThisRound;\n }", "assignNeighbours(){\n\n for (let i = 0; i < this.rows; i++) {\n for (let j = 0; j < this.cols; j++) {\n\n if(this.grid[i][j].isBomb){\n this.grid[i][j].surroundingBombs = -1;\n continue;\n }\n let neighbours = MineSweeper.getNeighbours((i == 0), (i == this.rows-1), (j == 0), (j == this.cols-1));\n\n let counter = 0;\n for(let neighbour of neighbours){\n let dr = neighbour[0];\n let dc = neighbour[1];\n if(this.grid[i+dr][j+dc].isBomb){\n counter++;\n }\n }\n this.grid[i][j].surroundingBombs = counter;\n }\n }\n }", "checkIfNeighborsAreWithingBoundry(boundry, hexesChecked, innerSet){\n //if we are on an edge\n //return false if at any point during the recursion we find that we've reached an edge, this means it is impossible for it to be full now\n //console.log(\"recurse on: \" + this.index.col + \", \"+ this.index.row)\n if(this.index.row == this.board.numRows-1 || this.index.row == 0){\n return false;\n }\n else if(this.index.col == this.board.numColumns-1 || this.index.col == 0){\n return false;\n }\n //ok, we are not an edge, now we can recurse to see if our neighbors are ok\n //\n var neighbors = this.getAllNeighbors();\n var newHexChecked = [];\n for(var i = 0; i< hexesChecked.length; i++){\n newHexChecked.push(hexesChecked[i]);\n }\n var foundDeadEnd = false;\n for(var i = 0; i<neighbors.length; i++){\n\n //if neighbors haven't been checkked or aren't in the already checked list\n if(!hexesChecked.includes(neighbors[i]) && !boundry.includes(neighbors[i])){\n newHexChecked.push(neighbors[i]);\n //neighbors[i].checkIfNeighborsAreWithingBoundry(boundry, newHexChecked, testSet);\n\n if(!neighbors[i].checkIfNeighborsAreWithingBoundry(boundry, newHexChecked, innerSet)){\n foundDeadEnd = true;\n return false;\n }\n }\n }\n if(!foundDeadEnd){\n innerSet.add(this);\n\n return true;\n }else{\n return false;\n }\n\n\n\n\n }", "uncoverEmptyTiles(theRow, theCol, theBoard) {\n\n /* gets all surrounding tiles to tile at [xpos][ypos] */\n\n let surround = this.checkSurroundingArea(theRow, theCol, theBoard);\n\n surround.map(tile => {\n\n /* Check if this tile isn't revealed, flagged or a mine and is empty */\n if (!tile.mine && !tile.revealed && !tile.flag) {\n\n theBoard[tile.row][tile.col].revealed = true;\n\n /* since this tile is empty, check recursively all around this tile too */\n if (tile.mineCount === 0) {\n\n this.uncoverEmptyTiles(tile.row, tile.col, theBoard);\n\n }\n }\n\n });\n\n return theBoard;\n }", "_checkCollision() {\n\n for (let ship of this.ships) {\n let pos = ship.getPosition();\n if (pos.y >= this.canvas.height) {\n // Killed ships are not moved, they stay at their location, but are invisible.\n // I don't want to kill the player with one invisible ship :)\n if (!ship.dead) {\n ship.kill();\n this.score.damage();\n this.base.removeShield();\n }\n }\n }\n }", "function checkCollision( block, xPos, yPos) {\n\n for(var i = 0; i < block.length; i++) {\n for(var j = 0;j < block[0].length; j++) {\n\n if( block[i][j] == 0 || i + yPos < 0)\n continue;\n if( j + xPos <0 || j + xPos >= col) /* Side wall collision */\n return true;\n if( i + yPos >= row) /* bottom wall collision */\n return true;\n if(board[i+yPos][j+xPos] != boardColour) /* Stack collision */\n return true;\n }\n }\n return false;\n}", "function surroundingChecker(player) {\n var y = player.y - 1;\n\tvar x = player.x - 1;\n userCommands = [\"equip\", \"potion\", \"look\"];\n var chestFound = false;\n var doorFound = false;\n\n for(var idx = y; idx < y+3; idx++) {\n \tfor(var idx2 = x; idx2 < x+3; idx2++) {\n \t// This if statement is how we skip checking the center tile(the one the player is on).\n \tif(idx === player.y && idx2 === player.x) {\n } else {\n \tvar area = mapArrays[idx][idx2];\n if(area.searchable) {\n chestFound = true;\n if(userCommands.includes(\"search\")) {\n } else {\n userCommands.push(\"search\");\n }\n }\n if(area.terrainType === \"monster\") {\n if(userCommands.includes(\"fight\")) {\n } else {\n userCommands.push(\"fight\");\n }\n }\n if(area.terrainType === \"door\") {\n doorFound = true;\n if(userCommands.includes(\"open door\")) {\n } else {\n userCommands.push(\"open door\");\n }\n }\n if(area.terrainType === \"firepit\" || area.terrainType === \"objectSwitch\") {\n if(userCommands.includes(\"use\")) {\n } else {\n userCommands.push(\"use\");\n }\n }\n // Add more later\n \t}\n }\n }\n if(chestFound) {\n $(\"#door-image\").stop().hide();\n $(\"#chest-image\").delay(300).fadeIn(300);\n } else if(doorFound) {\n $(\"#chest-image\").stop().hide();\n $(\"#door-image\").delay(300).fadeIn(300);\n } else {\n $(\"#door-image\").fadeOut(300);\n $(\"#chest-image\").fadeOut(300);\n }\n commandDisplayer();\n}", "findNeighbourCells(cell, distance) {\n let { resolution } = this.canvas;\n\n let neighbourCells = [];\n\n // Iterates through all surounding directions.\n for (let i = -1; i <= 1; i++) {\n for (let j = -1; j <= 1; j++) {\n // Only accepts indexes between the bounds of the bidimensional array.\n if (\n cell.x + i >= 0 &&\n cell.x + i < resolution &&\n cell.y + j >= 0 &&\n cell.y + j < resolution\n ) {\n // Excludes diagonal neighbours.\n if (Math.abs(i) ^ Math.abs(j)) {\n neighbourCells.push(\n this.cells[cell.x + i * distance][cell.y + j * distance]\n );\n }\n }\n }\n }\n\n return neighbourCells;\n }", "getNeighbourCells(cell, dist = 1) {\n let neighbours = [];\n neighbours.push(this._maze?.[cell.x]?.[cell.y-dist]);\n neighbours.push(this._maze?.[cell.x]?.[cell.y+dist]);\n neighbours.push(this._maze?.[cell.x-dist]?.[cell.y]);\n neighbours.push(this._maze?.[cell.x+dist]?.[cell.y]);\n\n /** Filter out out of bound cells */\n neighbours = neighbours.filter(cell => cell !== undefined);\n return neighbours;\n }", "getNumMines() {\n \n var currentLevel = levels[gameState.level]; // chosen difficulty level\n\n // iterate over all immediate neighbours\n for(var j = this.y - 1; j <= this.y + 1; j++) { // iterate over all cols\n for(var i = this.x - 1; i <= this.x + 1; i++) { // iterate over all rows\n \n if( i == this.x && j == this.y ) // cell whose neighbours to be checked\n continue;\n \n if( i < 0 || j < 0 || i >= currentLevel.numCols || j >= currentLevel.numRows ) // boundary conditions\n continue;\n \n if( grid[ ((j*currentLevel.numCols) + i ) ].hasMine ) // mine found\n this.numMines++;\n }\n }\n }", "function findNeighborTiles(map,xCoOrd, yCoOrd){\n var north = yCoOrd - 1;\n var south = yCoOrd + 1;\n var east = xCoOrd + 1;\n var west = xCoOrd - 1;\n\n \n if(isValidNeighbor(map.tiles[xCoOrd][south]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"south\"] = map.tiles[xCoOrd][south];\n if(isValidNeighbor(map.tiles[xCoOrd][north]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"north\"] = map.tiles[xCoOrd][north];\n if(isValidNeighbor(map.tiles[east][yCoOrd]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"east\"] = map.tiles[east][yCoOrd];\n if(isValidNeighbor(map.tiles[west][yCoOrd]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"west\"] = map.tiles[west][yCoOrd];\n if(isValidNeighbor(map.tiles[east][south]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"southeast\"] = map.tiles[east][south];\n if(isValidNeighbor(map.tiles[west][south]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"southwest\"] = map.tiles[west][south];\n if(isValidNeighbor(map.tiles[east][north]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"northeast\"] = map.tiles[east][north];\n if(isValidNeighbor(map.tiles[west][north]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"northwest\"] = map.tiles[west][north];\n //return whether current tile is a valid neighbor\n function isValidNeighbor(currentTile){\n if(currentTile !== undefined){\n if(currentTile.isPassable){\n return true;\n } else return false;\n }else return false;\n }\n}", "hits(b){\n\n //check if sprite (b) is in between the zone from top of gap to top of screeen and bottom of gap to bot of screen (Y axis)\n if (b.y < this.top || b.y > height-this.bottom){\n\n //check if sprite (b) is ALSO in between the width of the pipe (X axis)\n if(b.x > this.x && b.x < this.x + this.w){\n \n return true;\n \n }\n }\n }", "function aStarSearch(source, dest, grid) {\n // If the destination cell is the same as source cell\n if (cell_destination(source.first, source.second, dest) === true) {\n return;\n }\n // Create a closed list implemented as a boolean 2D array and //initialise it to false\n\n closedList = [];\n for (var i = 0; i < 12; i++) {\n closedList[i] = [];\n for (var j = 0; j < 12; j++) {\n closedList[i][j] = false;\n }\n }\n // Declare a 2D array of structure to hold the details\n //of that cell\n C = [];\n var i, j;\n for (i = 0; i < 12; i++) {\n C[i] = [];\n for (j = 0; j < 12; j++) {\n C[i][j] = {\n f: FLT_MAX,\n g: FLT_MAX,\n h: FLT_MAX,\n parent_i: -1,\n parent_j: -1,\n };\n }\n }\n // Initialising the parameters of the starting node\n var i = source.first;\n var j = source.second;\n C[i][j].f = 0.0;\n C[i][j].g = 0.0;\n C[i][j].h = 0.0;\n C[i][j].parent_i = i;\n C[i][j].parent_j = j;\n\n openList = [];\n // Put the starting cell on the open list and set its\n // 'f' as 0\n openList.push({ first: 0.0, second: { first: i, second: j } });\n var foundDest = false;\n var gNew, hNew, fNew;\n while (openList.length != 0) {\n p = openList[0];\n // Remove this vertex from the open list Add this vertex to the //closed list\n openList.shift();\n if (!cell_valid(p.second.first, p.second.second)) continue;\n i = p.second.first;\n j = p.second.second;\n closedList[i][j] = true;\n //Generating all the 8 successor of this cell\n x = [0, 0, -1, -1, -1, 1, 1, 1];\n y = [1, -1, 0, 1, -1, 0, 1, -1];\n for (i_ind = 0; i_ind < 8; i_ind++) {\n if (cell_valid(i + x[i_ind], j + y[i_ind]) === true) {\n if (cell_destination(i + x[i_ind], j + y[i_ind], dest) === true) {\n C[i + x[i_ind]][j + y[i_ind]].parent_i = i;\n C[i + x[i_ind]][j + y[i_ind]].parent_j = j;\n console.log(\"The destination cell is found\\n\");\n tracePath(C, dest);\n foundDest = true;\n return;\n } else if (\n closedList[i + x[i_ind]][j + y[i_ind]] === false &&\n cell_unblocked(grid, i + x[i_ind], j + y[i_ind]) === true\n ) {\n gNew = C[i][j].g + 1.0;\n if (choice == 1) {\n hNew = euclidian_distance(i + x[i_ind], j + y[i_ind], dest);\n } else if (choice == 2) {\n hNew = manhattan_distance(i + x[i_ind], j + y[i_ind], dest);\n } else {\n hNew = euclidian_distance(i + x[i_ind], j + y[i_ind], dest);\n }\n fNew = gNew + w * hNew;\n if (\n C[i + x[i_ind]][j + y[i_ind]].f == FLT_MAX ||\n C[i + x[i_ind]][j + y[i_ind]].f > fNew\n ) {\n openList.push({\n first: fNew,\n second: { first: i + x[i_ind], second: j + y[i_ind] },\n });\n C[i + x[i_ind]][j + y[i_ind]].f = fNew;\n C[i + x[i_ind]][j + y[i_ind]].g = gNew;\n C[i + x[i_ind]][j + y[i_ind]].h = hNew;\n C[i + x[i_ind]][j + y[i_ind]].parent_i = i;\n C[i + x[i_ind]][j + y[i_ind]].parent_j = j;\n }\n }\n }\n }\n }\n if (foundDest === false) console.log(\"Destination not found\");\n\n return;\n}", "findNeighbors(cell, filterVisited = false) {\n let neighbors = [];\n for (let i = 0; i < 4; i++) {\n switch (i) {\n case TOP : {\n let neighbor = this.cells[this.index(cell.x + 0, cell.y - 1)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n case RIGHT : {\n let neighbor = this.cells[this.index(cell.x + 1, cell.y + 0)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n case BOTTOM : {\n let neighbor = this.cells[this.index(cell.x + 0, cell.y + 1)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n case LEFT : {\n let neighbor = this.cells[this.index(cell.x - 1, cell.y + 0)];\n if (neighbor && (!filterVisited || (filterVisited && !neighbor.visited))) neighbors.push(neighbor);\n break;\n }\n }\n }\n return neighbors;\n }", "function hBlockCheck(){\n const tRowTest = game1.toprow.filter(element => element === \"X\");\n const mRowTest = game1.midrow.filter(element => element === \"X\");\n const bRowTest = game1.botrow.filter(element => element === \"X\");\n if (tRowTest.length === 2 && !game1.toprow.includes(\"O\")){\n const place = game1.toprow.findIndex(empty => empty != \"X\");\n switch (place){\n case 0:\n maybePlace(\"NW\");\n break;\n case 1:\n maybePlace(\"NC\");\n break;\n case -1:\n maybePlace(\"NE\");\n break;\n default:\n console.log(\"Something broke!\");\n break;\n }\n } else if (mRowTest.length === 2 && !game1.midrow.includes(\"O\")){\n const place = game1.midrow.findIndex(empty => empty != \"X\");\n switch (place){\n case 0:\n maybePlace(\"CW\");\n break;\n case 1:\n maybePlace(\"CC\");\n break;\n case -1:\n maybePlace(\"CE\");\n break;\n default:\n console.log(\"Something broke!\");\n break;\n }\n } else if (bRowTest.length === 2 && !game1.botrow.includes(\"O\")) {\n const place = game1.botrow.findIndex(empty => empty != \"X\");\n switch (place){\n case 0:\n maybePlace(\"SW\");\n break;\n case 1:\n maybePlace(\"SC\");\n break;\n case -1:\n maybePlace(\"SE\");\n break;\n default:\n console.log(\"Something broke!\");\n break;\n }\n } else {\n vBlockCheck();\n }\n}", "AIGuess(){\n const board = this.playerBoard;\n var lastHitRow, lastHitColumn;\n if(this.options.difficulty == 'easy'){\n var playerCells = board.cells.flat().filter(\n (cell) => cell.children[0].disabled == false\n );//list of all the cells we haven't shot at yet\n var guessCellNum = Math.floor(Math.random()*playerCells.length);\n (playerCells)[guessCellNum].children[0].disabled = true;\n }\n else if(this.options.difficulty == 'medium'){\n //var neighborCell = getNeighbourCells(row, col)\n if(this.lastHitShip == null){\n var playerCells = board.cells.flat().filter(\n (cell) => cell.children[0].disabled == false\n );//list of all the cells we haven't shot at yet\n var guessCellNum = Math.floor(Math.random()*playerCells.length);\n if((playerCells)[guessCellNum].classList.contains('ship')){\n this.lastHitShip = (playerCells)[guessCellNum];\n this.lastHitColumn = this.lastHitShip.cellIndex;\n this.lastHitRow = this.lastHitShip.parentNode.rowIndex;\n }\n (playerCells)[guessCellNum].children[0].disabled = true;\n }\n else{//lastHitShip is an actual ship and we need to check its orthagonal squares\n lastHitRow = this.lastHitRow-1;\n lastHitColumn = this.lastHitColumn-1;\n\n if(board.cells[lastHitRow+1][lastHitColumn].children[0].disabled == false){\n if(board.cells[lastHitRow+1][lastHitColumn].classList.contains('ship')){\n this.lastHitShip = board.cells[lastHitRow][lastHitColumn-1];\n this.lastHitColumn = this.lastHitShip.cellIndex;\n this.lastHitRow = this.lastHitShip.parentNode.rowIndex;\n }\n board.cells[lastHitRow+1][lastHitColumn].children[0].disabled = true;\n }\n else if(board.cells[lastHitRow-1][lastHitColumn].children[0].disabled == false){\n if(board.cells[lastHitRow-1][lastHitColumn].classList.contains('ship')){\n this.lastHitShip = board.cells[lastHitRow][lastHitColumn-1];\n this.lastHitColumn = this.lastHitShip.cellIndex;\n this.lastHitRow = this.lastHitShip.parentNode.rowIndex;\n }\n board.cells[lastHitRow-1][lastHitColumn].children[0].disabled = true;\n }\n else if(board.cells[lastHitRow][lastHitColumn+1].children[0].disabled == false){\n if(board.cells[lastHitRow][lastHitColumn+1].classList.contains('ship')){\n this.lastHitShip = board.cells[lastHitRow][lastHitColumn-1];\n this.lastHitColumn = this.lastHitShip.cellIndex;\n this.lastHitRow = this.lastHitShip.parentNode.rowIndex;\n }\n board.cells[lastHitRow][lastHitColumn+1].children[0].disabled = true;\n }\n else if(board.cells[lastHitRow][lastHitColumn-1].children[0].disabled == false){\n if(board.cells[lastHitRow][lastHitColumn-1].classList.contains('ship')){\n this.lastHitShip = board.cells[lastHitRow][lastHitColumn-1];\n this.lastHitColumn = this.lastHitShip.cellIndex;\n this.lastHitRow = this.lastHitShip.parentNode.rowIndex;\n }\n board.cells[lastHitRow][lastHitColumn-1].children[0].disabled = true;\n }\n else{\n this.lastHitShip = null;\n this.lastHitRow = null;\n this.lastHitColumn = null;\n }\n }\n }\n else{//difficulty == hard\n var playerShips = board.cells.flat().filter(\n (cell) => cell.classList.contains('ship') && cell.children[0].disabled == false\n );//list of all the ships we haven't hit yet\n var guessCellNum = Math.floor(Math.random()*playerShips.length);\n (playerShips)[guessCellNum].children[0].disabled = true;\n }\n this.checkWin('player');\n \n }", "querywrap(x, y, r)\n {\n if (r > this.maxRadius) r = this.maxRadius;\n\n // Squared distance\n let rsq = r * r;\n\n // Which cell are we in?\n let cellcentrex = (x - (this.mod(x, this.xcellsize))) / this.xcellsize;\n let cellcentrey = (y - (this.mod(y, this.ycellsize))) / this.ycellsize;\n\n // Use diagonal extent to find the cell range to search\n let cellminx = ((x - r) - (this.mod((x - r), this.xcellsize))) / this.xcellsize;\n let cellminy = ((y - r) - (this.mod((y - r), this.ycellsize))) / this.ycellsize;\n let cellmaxx = ((x + r) - (this.mod((x + r), this.xcellsize))) / this.xcellsize;\n let cellmaxy = ((y + r) - (this.mod((y + r), this.ycellsize))) / this.ycellsize;\n\n // console.log(`Checking numcells ${cellmaxx - cellminx}, ${cellmaxy - cellminy}`);\n\n let objs = [];\n\n if ((cellmaxy - cellminy) >= this.numcells) cellmaxy = cellminy + this.numcells - 1;\n if ((cellmaxx - cellminx) >= this.numcells) cellmaxx = cellminx + this.numcells - 1;\n\n for (let cy=cellminy; cy<=cellmaxy; cy++)\n {\n for (let cx=cellminx; cx<=cellmaxx; cx++)\n {\n let wx = this.wrap(cx), wy = this.wrap(cy);\n\n // if (once[wy][wx]) continue;\n // once[wy][wx] = 1;\n\n let cell = this.grid[wy][wx]\n if (!cell) continue;\n\n for (let t=0; t<cell.length; t++)\n {\n let item = cell[t];\n let pos = item;\n if (this.prop) pos = item[this.prop]\n let d = this.distsq(pos.x, pos.y, x, y);\n if (d <= rsq) objs.push(item);\n }\n }\n }\n\n return objs;\n }", "fire(Enemy){\n\n if(this.difficulty==1){\n\n let hitFound=false;\n\n while(hitFound!=true){\n\n let col = Math.floor((Math.random()*8)+0);\n let row= Math.floor((Math.random()*8)+0);\n console.log(\"attmepting to hit col: \" + col + \" row: \" + row )\n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n Enemy.hitBoard.attempt[row][col]=true;\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n Enemy.hitBoard.hit[row][col]=true;\n hitFound=true;\n\n }\n }\n }\n\n if(this.difficulty==2){\n //set orthogonal fire once it hits\n if(this.difficulty==2){\n //set orthogonal fire once it hits\n let hitFound=false;\n \n \n while(hitFound!=true){\n\n let col = Math.floor((Math.random()*8)+0);\n let row= Math.floor((Math.random()*8)+0);\n let tempCol=col;\n let tempRow=row; \n \n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n if(Enemy.boatBoard.isAHit(col,row)){\n \n //after hit is found, checks for spaces to the left\n tempCol+1;\n while(Enemy.boatBoard.isAHit(tempCol,row))\n {\n Enemy.boatBoard.hasBeenHit[row][tempCol]=true;\n Enemy.hitBoard.hit[row][tempCol]=true;\n tempCol+1;\n }\n \n //then it checks for spaces to the right of hit\n tempCol=col-1;\n while(Enemy.boatBoard.isAHit(tempCol,row))\n {\n Enemy.boatBoard.hasBeenHit[row][tempCol]=true;\n Enemy.hitBoard.hit[row][tempCol]=true;\n tempCol-1;\n }\n \n //checks for spaces above hit\n tempRow=row+1;\n while(Enemy.boatBoard.isAHit(col,tempRow))\n {\n Enemy.boatBoard.hasBeenHit[tempRow][col]=true;\n Enemy.hitBoard.hit[tempRow][col]=true;\n tempRow+1;\n }\n \n //checks for spaces below hit\n tempRow=row-1;\n \n while(Enemy.boatBoard.isAHit(col,tempRow))\n {\n Enemy.boatBoard.hasBeenHit[tempRow][col]=true;\n Enemy.hitBoard.hit[tempRow][col]=true;\n tempRow-1;\n } \n } \n Enemy.hitBoard.hit[row][col]=true;\n hitFound=true;\n }\n } \n \n \n\n }\n }\n\n if(this.difficulty==3){\n \n let hitFound=false;\n \n for(let row = 0; row<9; row++){\n for(let col =0; col<9; col++){\n\n if(Enemy.boatBoard.hasBeenHit[row][col]!=true){\n //in isAHit col and row are flipped since that's how it used for p1 and p2 in application.js\n if(Enemy.boatBoard.isAHit(col,row)===true){\n Enemy.boatBoard.hasBeenHit[row][col]=true;\n Enemy.hitBoard.attempt[row][col]=true;\n Enemy.hitBoard.hit[row][col]=true;\n\t\t\t\t\t\t\t\tEnemy.boatCount--;\n hitFound=true;\n }\n }\n if(hitFound===true){\n break;\n }\n }\n if(hitFound===true){\n break;\n }\n }\n \n }\n }", "function processCellSurroundings(gridArray) {\n const checkSurroundings = (gridArray, i, j, width) => {\n const topCell = gridArray[i - 1] ? gridArray[i - 1][j] : {};\n const topRightCell = gridArray[i - 1] && j < width - 1 ? gridArray[i - 1][j + 1] : {};\n const rightCell = j < width - 1 ? gridArray[i][j + 1] : {};\n const bottomRightCell = gridArray[i + 1] && j < width - 1 ? gridArray[i + 1][j + 1] : {};\n const bottomCell = gridArray[i + 1] ? gridArray[i + 1][j] : {};\n const bottomLeftCell = gridArray[i + 1] && j > 0 ? gridArray[i + 1][j - 1] : {};\n const leftCell = j > 0 ? gridArray[i][j - 1] : {};\n const topLeftCell = gridArray[i - 1] && j > 0 ? gridArray[i - 1][j - 1] : {};\n return [topCell, topRightCell, rightCell, bottomRightCell, bottomCell, bottomLeftCell, leftCell, topLeftCell].filter(cell => cell.isAlive);\n };\n\n for (let i = 0; i < World.height; i++) {\n for (let j = 0; j < World.width; j++) {\n gridArray[i][j].aliveNeighbors = checkSurroundings(gridArray, i, j, World.width);\n }\n }\n }", "checkProximity(row, col, theRow, theCol) {\n\n /* mine cant be on this tile */\n if (row === theRow && col === theCol) {\n return false;\n }\n\n /* mine cant be above this tile */\n if (row === theRow - 1 && col === theCol) {\n return false;\n }\n\n /* mine cant be below this tile */\n if (row === theRow + 1 && col === theCol) {\n return false;\n }\n\n /* mine cant be left of this tile */\n if (row === theRow && col === theCol - 1) {\n return false;\n }\n\n /* mine cant be right of this tile */\n if (row === theRow && col === theCol + 1) {\n return false;\n }\n\n /* mine cant be above and to the left of this tile */\n if (row === theRow - 1 && col === theCol - 1) {\n return false;\n }\n\n /* mine cant be above and to the right of this tile */\n if (row === theRow - 1 && col === theCol + 1) {\n return false;\n }\n\n /* mine cant be below and to the left of this tile */\n if (row === theRow + 1 && col === theCol - 1) {\n return false;\n }\n\n /* mine cant be below and to the right of this tile */\n if (row === theRow + 1 && col === theCol + 1) {\n return false;\n }\n\n return true;\n }", "findInBlock(n, b) {\n // Find the block\n let ib = Math.floor(b/B);\n let jb = b%B;\n let m=new Array();\n for (let i=ib*B; i<ib*B+B; i++) {\n for (let j=jb*B; j<jb*B+B; j++) {\n if (this.state[i][j] == X && this.options[i][j].indexOf(n) > -1) {\n m.push({i,j});\n }\n }\n }\n return m;\n }", "function checkHits()\n {\n // loops through entities to check for bounding box hits\n \n var total_enemies = array_of_enemies.length;\n var total_shots = array_of_shots.length;\n\n // -----------------------------------------------------------------------------\n // Check player shot hits on enemies\n // Check enemies crashing into player\n\n if( total_enemies > 0 )\n {\n for( var ep = 0 ; ep < total_enemies ; ep++ ) // ep = enemy pointer\n {\n // get the enemy object\n var enemy = array_of_enemies[ep];\n\n // Check player shot hits on enemies\n if( total_shots > 0 )\n {\n for( var sp = 0 ; sp < total_shots ; sp++ ) // sp = shot pointer\n {\n // get the shot object\n var shot = array_of_shots[sp];\n\n // TODO : add a back to the hit detection area > but for speed's sake, it is not needed...\n if( ((shot.x + shot.width) > enemy.x) && (shot.x <= (enemy.x + enemy.width)) && (shot.y <= (enemy.y + enemy.height - shot.height)) )\n {\n // score stuff\n score += enemy.points;\n // player.updatePoints( enemy.points );\n // console.log(\"score increased! - \", score);\n\n // shots\n array_of_shots.splice( sp , 1 ); // remove the shot \n total_shots--; // shorten the array\n sp--; // move the pointer back one shot\n\n // enemies\n array_of_enemies.splice( ep , 1 ); // remove the enemy\n total_enemies--; // shorten the array\n ep--; // move the pointer back one enemy\n\n // some other stuff...\n }\n }\n }\n\n // Check enemies hitting player\n // TODO : code here\n if( ((player.x + player.width) > enemy.x) && \n (player.x <= (enemy.x + enemy.width)) && \n (player.y <= (enemy.y + enemy.height)) && \n (player.y + player.height >= (enemy.y + enemy.height - player.height)) \n )\n {\n console.log(\"collision!\");\n\n // check if the point values are the same for the colliding objects\n if( player.points === enemy.points ){\n player.addPoints();\n } else {\n player.removePoints();\n }\n\n // remove the enemy\n array_of_enemies.splice( ep , 1 ); // remove the enemy\n total_enemies--; // shorten the array\n ep--; // move the pointer back one enemy\n }\n\n }\n }\n\n // TODO\n\n // -----------------------------------------------------------------------------\n // Check enemy shot hits on player\n\n // -----------------------------------------------------------------------------\n // Check player picking up power ups\n\n\n }", "checkAndMarkFleetHit(indexCoordinate, isBot = true) {\n const grids = isBot ? this.botDivs : this.playerDivs\n const player = isBot ? this.bot : this.humanPlayer\n\n // record the attack attempts coordinates on the player\n player.attackAttemptsCoordinates.push(indexCoordinate)\n \n // remove the default highlighting classes - we will re-painting the grid again anyway\n // grids[indexCoordinate].classList.remove(CSS_GRID_SELECT, CSS_DEFAULT_GRID_COLOR)\n grids[indexCoordinate].classList.remove(CSS_GRID_SELECT)\n let hitSuccessful = false\n grids[indexCoordinate].classList.add(CSS_GRID_MISSED)\n for (const fleetName in player.deployedFleets) {\n if (player.deployedFleets[fleetName].isIndexCoordinateMatched(indexCoordinate)) {\n\n const stateBeforeHit = player.deployedFleets[fleetName].isDestroyed() // before marking as hit on the fleet\n\n player.deployedFleets[fleetName].markHit(indexCoordinate)\n grids[indexCoordinate].classList.remove(CSS_GRID_MISSED)\n grids[indexCoordinate].classList.add(CSS_GRID_ATTACKED)\n hitSuccessful = true\n\n // increment the destroyed ship count if it was not destroyed but after hiting it, the fleet was destroyed\n if (player.deployedFleets[fleetName].isDestroyed()){\n this.markFleetAsDestroyed(fleetName, isBot)\n\n if (!stateBeforeHit) player.destroyedFleets++\n }\n }\n }\n \n return hitSuccessful\n }", "function mousePressed() {\n for (var i = 0; i < cols; i++) {\n for (var j = 0; j < rows; j++) {\n if (grid[i][j].contains(mouseX, mouseY)) { // checks every spot to see if it contains a mouse click\n grid[i][j].reveal(); // shows what's inside the clicked cell\n \n // if clicked on a mine\n if (grid[i][j].mine) {\n gameOver(); // game over\n alert(\"You lose... :(\");\n }\n }\n }\n }\n}", "handleCollision(obj) {\n const collisionTiles = this.findCollisionTiles(obj);\n // return arr of tuples containing tile coords ([row, col])\n if (collisionTiles) {\n collisionTiles.forEach(tileTuple => {\n this.resolveCollision(obj, ...tileTuple);\n });\n }\n }", "function countSurroundingMines (cell) {\n\tvar surroundingCells = lib.getSurroundingCells(cell.row, cell.col)\nvar count = 0;\nfor(var j=0; j<surroundingCells.length; j++){\n\tif(surroundingCells[j].isMine === true){\n\t\tcount++\n\t}\n\t//console.log (\"count is: \"+count)\n}return count\n\n}", "function newGrid() {\n // Checks how many living neighboring cells each cell has\n // Iterate the grid\n for (let i = 0; i < dimension; i++) {\n for (let j = 0; j < dimension; j++) {\n // Count surrounding living cells\n let cellsCount = 0;\n // Check the three cells above the current one\n if (i !== 0) { // continue only if this is not the first/zero row\n if (j !== 0) // continue only if this is not the first/zero column\n cellsCount += grid[i - 1][j - 1];\n cellsCount += grid[i - 1][j];\n if (j !== (dimension - 1)) // continue only if this is not the last column\n cellsCount += grid[i - 1][j + 1];\n }\n // Check the cell on the left\n if (j !== 0) // continue only if this is not the first/zero column\n cellsCount += grid[i][j - 1];\n // Check the cell on the right \n if (j !== (dimension - 1)) // continue only if this is not the last column\n cellsCount += grid[i][j + 1];\n // Check the three cells below the current one\n if (i !== (dimension - 1)) {\n if (j !== 0) // continue only if this is not the first/zero column\n cellsCount += grid[i + 1][j - 1];\n cellsCount += grid[i + 1][j];\n if (j !== (dimension - 1)) // continue only if this is not the last column\n cellsCount += grid[i + 1][j + 1];\n }\n\n // Check if the currnet cell is dead\n if (grid[i][j] === 0) {\n // Become alive if three surrounding cells are alive, else die\n if (cellsCount === 3) {\n copiedGrid[i][j] = 1;\n } else {\n copiedGrid[i][j] = 0;\n }\n } \n // Current cell is alive\n else if (grid[i][j] === 1) {\n // stay alive with 2 or 3 living neighbours, else die\n if (cellsCount === 2 || cellsCount === 3) {\n copiedGrid[i][j] = 1;\n } else {\n copiedGrid[i][j] = 0;\n }\n }\n }\n }\n\n // Copy the temporary grid in real one\n for (let j = 0; j < dimension; j++) {\n for (let k = 0; k < dimension; k++) {\n grid[j][k] = copiedGrid[j][k];\n }\n }\n\n drawGrid();\n}", "function showAllEmptys(coord) {\n for (var i = coord.i - 1; i <= coord.i + 1; i++) {\n if (i < 0 || i > gBoard.length - 1) continue;\n for (var j = coord.j - 1; j <= coord.j + 1; j++) {\n if (i === coord.i && j === coord.j) continue;\n if (j < 0 || j > gBoard[0].length - 1) continue;\n var cell = gBoard[i][j];\n\n if (cell.isFlaged) removeFlag(cell, true);\n\n if (!cell.isShown) {\n // !cell.isShown prevent from max call stack\n colorCell(i, j, 'white');\n //recurisve call\n if (cell.numOfBombsAround === 0) {\n showAllEmptys(cell.coord);\n }\n }\n }\n }\n}", "function countSurroundingMines (cell) {\n\n var surroundingCells = lib.getSurroundingCells(cell.row, cell.col);\n\n var count = 0;\n\n for (var i = 0; i < surroundingCells.length; i++){\n if (surroundingCells[i].isMine){\n count ++;\n }\n }\n return count;\n}", "findNeighbours() {\n const n = this.neighbours;\n const { row, col } = this.pos;\n n.topleft = boxes[row - 1]?.[col - 1]; // get top left corner\n n.top = boxes[row - 1]?.[col]; // get the top box\n n.topright = boxes[row - 1]?.[col + 1]; // get top right corner\n n.right = boxes[row]?.[col + 1]; // get the right box\n n.bottomright = boxes[row + 1]?.[col + 1]; // get bottom right corner\n n.bottom = boxes[row + 1]?.[col]; // get the bottom box\n n.bottomleft = boxes[row + 1]?.[col - 1]; // get bottom left corner\n n.left = boxes[row]?.[col - 1]; // get the left box\n // add all neighbours that exist to allNeighbours array\n this.allNeighbours = Object.values(n).filter((n) => n);\n }", "function blockUnder() {\r\n let blockPos = getPosOnBoard();\r\n return blockPos.some( block => //there is a piece underneath at least one of the squares \r\n (board[block.y + 1][block.x] !== 0) ? true : false\r\n );\r\n}", "function a_star(entity, mapTile, tiledMap, columns, rows)\n{\n\ttileWidth = tiledMap.tileMapManager.tileWidth;\n\ttileHeight = tiledMap.tileMapManager.tileHeight;\n\tif(!columns || !rows) {\n\t\tcolumns = tiledMap.cols;\n\t\trows = tiledMap.rows;\n\t} //TODO Check these calcs\n\t\n\t//Create start and destination as true nodes\n\tstart = new node((entity.x/tileWidth), (entity.y/tileHeight), -1, -1, -1, -1);\n\tdestination = new node((mapTile.x/tileWidth), (mapTile.y/tileHeight), -1, -1, -1, -1);\n\n\tvar open = []; //List of open nodes (nodes to be inspected)\n\tvar closed = []; //List of closed nodes (nodes we've already inspected)\n\n\tvar g = 0; //Cost from start to current node\n\tvar h = heuristic(start, destination); //Cost from current node to destination\n\tvar f = g+h; //Cost from start to destination going through the current node\n\n\t//Push the start node onto the list of open nodes\n\topen.push(start); \n\n\t//Keep going while there's nodes in our open list\n\twhile (open.length > 0)\n\t{\n\t\t//Find the best open node (lowest f value)\n\n\t\t//Alternately, you could simply keep the open list sorted by f value lowest to highest,\n\t\t//in which case you always use the first node\n\t\tvar best_cost = open[0].f;\n\t\tvar best_node = 0;\n\n\t\tfor (var i = 1; i < open.length; i++)\n\t\t{\n\t\t\tif (open[i].f < best_cost)\n\t\t\t{\n\t\t\t\tbest_cost = open[i].f;\n\t\t\t\tbest_node = i;\n\t\t\t}\n\t\t}\n\n\t\t//Set it as our current node\n\t\tvar current_node = open[best_node];\n\n\t\t//Check if we've reached our destination\n\t\tif (current_node.x == destination.x && current_node.y == destination.y)\n\t\t{\n\t\t\tvar path = [destination]; //Initialize the path with the destination node\n\n\t\t\t//Go up the chain to recreate the path \n\t\t\twhile (current_node.parent_index != -1)\n\t\t\t{\n\t\t\t\tcurrent_node = closed[current_node.parent_index];\n\t\t\t\tpath.unshift(current_node);\n\t\t\t}\n\n\t\t\treturn path;\n\t\t}\n\n\t\t//Remove the current node from our open list\n\t\topen.splice(best_node, 1);\n\n\t\t//Push it onto the closed list\n\t\tclosed.push(current_node);\n\n\t\t//Expand our current node (look in all 8 directions)\n\t\tfor (var new_node_x = Math.max(0, current_node.x-1); new_node_x <= Math.min(columns-1, current_node.x+1); new_node_x++)\n\t\t\tfor (var new_node_y = Math.max(0, current_node.y-1); new_node_y <= Math.min(rows-1, current_node.y+1); new_node_y++)\n\t\t\t{\n\t\t\t\tif (tiledMap.tiles[new_node_y] && tiledMap.tiles[new_node_y][new_node_x] && tiledMap.tiles[new_node_y][new_node_x].type == tiledMap.movementAttributes[\"open\"] //If the new node is open\n\t\t\t\t\t|| (destination.x == new_node_x && destination.y == new_node_y)) //or the new node is our destination\n\t\t\t\t{\n\t\t\t\t\t//See if the node is already in our closed list. If so, skip it.\n\t\t\t\t\tvar found_in_closed = false;\n\t\t\t\t\tfor (var i in closed)\n\t\t\t\t\t\tif (closed[i].x == new_node_x && closed[i].y == new_node_y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfound_in_closed = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\tif (found_in_closed)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t//See if the node is in our open list. If not, use it.\n\t\t\t\t\tvar found_in_open = false;\n\t\t\t\t\tfor (var i in open)\n\t\t\t\t\t\tif (open[i].x == new_node_x && open[i].y == new_node_y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfound_in_open = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\tif (!found_in_open)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar new_node = new node(new_node_x, new_node_y, closed.length-1, -1, -1, -1);\n\n\t\t\t\t\t\tnew_node.g = current_node.g + Math.floor(Math.sqrt(Math.pow(new_node.x-current_node.x, 2)+Math.pow(new_node.y-current_node.y, 2)));\n\t\t\t\t\t\tnew_node.h = heuristic(new_node, destination);\n\t\t\t\t\t\tnew_node.f = new_node.g+new_node.h;\n\n\t\t\t\t\t\topen.push(new_node);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t}\n\n\treturn [];\n}", "function spawnBlock() {\r\n for(let row = 0; row < thisBlock.matrix.length; row++) {\r\n for(let col = 0; col < thisBlock.matrix[row].length; col++) {\r\n if(thisBlock.matrix[row][col]) {\r\n // If block goes off screen\r\n if(thisBlock.row + row < 0) {\r\n return userGameOver();\r\n }\r\n thisField[thisBlock.row + row][thisBlock.col + col] = thisBlock.id;\r\n }\r\n }\r\n }\r\n\r\n // Line clearing\r\n let linesCleared = 0;\r\n for(let row = thisField.length - 1; row >= 0;) {\r\n if(thisField[row].every((cell) => !!cell)) {\r\n // Drop every row above\r\n linesCleared++;\r\n for(let r = row; r >= 0; r--) {\r\n thisField[r] = thisField[r - 1]\r\n }\r\n } else {\r\n row--;\r\n }\r\n }\r\n // If cleared lines then run numbers\r\n clearLines(linesCleared);\r\n // Next block spawn\r\n thisBlock = fetchNextBlock();\r\n}", "function showAllMines() {\n for (var i = 0; i < gBoard.length; i++) {\n for (var j = 0; j < gBoard.length; j++) {\n if (gBoard[i][j].isMine) {\n var elNextCell = getCellByCoord(i, j);\n elNextCell.classList.add('mine');\n }\n }\n }\n}", "function Findpath(xStart, yStart, xGoal, yGoal)\n{\n\n \n\n // reset the paths of the tiles from the previous pathfinding tile\n ResetPaths();\n\n var attempts = 0;\n\n var StartingTile = Tiles[xStart][yStart];\n\n if (StartingTile == null)\n {\n console.log(\"uh oh\");\n }\n\n // this array keeps track of all tiles that we need to check (aka the neighboring tiles of already explored tiles)\n var TileQueue = [];\n\n TileQueue.push(StartingTile);\n\n // this array keeps track of all the tiles we've already checked\n //let alreadyVisitedTiles = [StartingTile];\n var alreadyVisitedTiles = [];\n\n // we are returning the final path of the tiles, from beginning to end\n var FinalPath = [];\n\n let EndTileFound = false;\n\n // loop through every tile in the tile queue\n while(TileQueue.length > 0 && EndTileFound == false)\n {\n attempts++;\n var CurrentTile = TileQueue.pop();\n alreadyVisitedTiles.push(CurrentTile);\n // is this the end tile?\n if (CurrentTile.x == xGoal && CurrentTile.y == yGoal)\n {\n\n\n // return the path to get to this tile\n FinalPath = CurrentTile.Path;\n\n // add the finalTile to the path\n FinalPath.push(CurrentTile);\n\n EndTileFound = true;\n\n // we don't need to check the rest of the TileQueue\n break;\n }\n\n if (attempts == 1)\n {\n console.log(\"test\");\n }\n\n // add each of the neighboring tiles to the TileQueue, if we haven't visited them before\n CurrentTile.Neighbours.forEach(function (item, index){\n\n \n // get the path that the pathfinding algorithm took up to this point\n let CurrentPath = CurrentTile.Path;\n\n if((TileQueue.indexOf(item) == -1 ) &&\n alreadyVisitedTiles.indexOf(item) == -1)\n {\n // Javascript copies by reference by default, so we need to create a new object and assign it to the temporary variable...\n let TemporaryPath = []; \n Object.assign(TemporaryPath, CurrentPath); \n TemporaryPath.push(CurrentTile);\n \n\n // add the tile we are visiting the neighboring tile from (the current tile)\n item.Path = TemporaryPath;\n\n // add the neighboring tile to the TileQueue\n TileQueue.unshift(item);\n }\n\n });\n }\n\n if (FinalPath.length == 0)\n {\n console.log(FinalPath.length + Tiles[xStart][yStart].TileType + \" \" + Tiles[xGoal][yGoal].TileType + \" Attempts = \" + attempts);\n console.log(xStart + \",\" + yStart + \"|\");\n console.log(xGoal + \",\" + yGoal);\n\n console.log(alreadyVisitedTiles);\n }\n \n // return the finalPath\n return FinalPath;\n}", "static bfs(gameState, gameMap, node, radius) {\r\n\t\tlet isVisited = Array.apply(null, Array(gameMap.size)).map(function () { return false; })\r\n\t\tisVisited[node] = true;\r\n\t\t\r\n\t\tlet queue = [];\r\n\t\tlet curLayer = 0;\r\n\t\tlet curLayerTiles = 1;\r\n\t\tlet nextLayerTiles = 0;\r\n\t\tlet foundNodes = [];\r\n\r\n\t\tqueue.push(node);\r\n\t\twhile(queue.length > 0) {\r\n\t\t\tlet curTile = queue.shift();\r\n\r\n\t\t\t//don't add starting node\r\n\t\t\tif(curLayer != 0) {\r\n\t\t\t\tfoundNodes.push({\"index\": curTile, \"generalDistance\": curLayer});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tlet adjacentTiles = gameMap.getAdjacentTiles(gameState, curTile);\r\n\t\t\t//loop through adjacent tiles\r\n\t\t\tfor(let direction in adjacentTiles) {\r\n\t\t\t\tif (adjacentTiles.hasOwnProperty(direction)) {\r\n\t\t\t\t\tlet nextTile = adjacentTiles[direction];\r\n\t\t\t\t\tif(!isVisited[nextTile.index]) {\r\n\t\t\t\t\t\t//tile can be moved on(ignore cities)\r\n\t\t\t\t\t\tif(gameMap.isWalkable(gameState, nextTile)) {\r\n\t\t\t\t\t\t\tqueue.push(nextTile.index);\r\n\t\t\t\t\t\t\tisVisited[nextTile.index] = true;\r\n\t\t\t\t\t\t\tnextLayerTiles++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//check if all tiles of current depth are already visited\r\n\t\t\tif(--curLayerTiles == 0) {\r\n\t\t\t\t//move to next layer, if radius reached -> stop\r\n\t\t\t\tif(curLayer++ == radius) {\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\t\r\n\t\t\t\tcurLayerTiles = nextLayerTiles;\r\n\t\t\t\tnextLayerTiles = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn foundNodes;\r\n\t}", "function valid_placement(x, y, piece, cell_num)\n{\n if(!cell_num)\n {\n cell_num = 1;\n }\n var hor_step = 0;\n var vert_step = 0;\n if(piece.orientation === \"vert\")\n {\n vert_step = 1;\n }\n else\n {\n hor_step = 1;\n }\n if(on_board(x, y) && PS.data(x, y) === 0)\n { //if empty coord on board\n if(cell_num < piece.hits.length)\n {\n return valid_placement(x + hor_step, y + vert_step, piece, cell_num + 1); //check the next bead in line\n }\n else return true; //last bead checked, all clear\n }\n else\n {\n PS.statusText(\"Fails at \" + x + \",\" + y);\n return false;//not a free space\n }\n}", "function chooseNcheck() {\n //var userGuess = document.getElementById(\"needs to change\").onclick\n var userGuess = \"a1\"\n for (var battleship of battleships){\n for(var key of battleship) {\n if (userGuess === key){\n console.log('hit');\n hitCounter++\n if (hitCounter == 17)\n console.log('game over')\n for (var row of coords){\n for (var col of row){\n if (userGuess === col){\n row.splice(col.indexOf(key), 1, '')\n for (battleship of battleships){\n if (battleship = ''){\n console.log(\"sunk\")\n }\n }\n }\n }\n }\n }\n }\n }\n }", "function generateAIGuess(){\n //target half sunk ships\n for (let i = 0; i<10; i++){\n for (let j=0; j<10; j++){\n if (myArray[i][j]===3){\n let orientation = guessShipOrientation(i,j)\n console.log(orientation)\n //if orientation cannot be assumed yet (only one data point) -> keep checking adjacent cells\n if (typeof guessShipOrientation(i,j) == \"undefined\"){\n let nextGuess = checkAdjacentCells(i,j)\n console.log(nextGuess)\n if (nextGuess != false) return nextGuess;\n }\n //if orientation is known keep checking in that direction until ship fully sunk\n else{\n let nextGuess = checkOrientation(orientation,i,j)\n console.log(nextGuess)\n if (nextGuess != false) return nextGuess;\n }\n } \n }\n }\n //random guess if no open leads\n for (let i=0; i<500; i++){\n let x= Math.floor(Math.random() * 10)\n let y= Math.floor(Math.random() * 10)\n if (myArray[x][y] === 0 || myArray[x][y] == 2){\n //dont return single empty cell surrounded by misses\n if (checkAdjacentCells(x,y) != false) return [x,y]\n } \n }\n \n //if no more posibble random locations, check beside existing ships\n for (let i = 0; i<10; i++){\n for (let j=0; j<10; j++){\n if (myArray[i][j]===3){\n let nextGuess = checkAdjacentCells(i,j)\n if (nextGuess != false) return nextGuess;\n }\n }\n }\n}", "getNeighbors(i, j) {\n\t\tlet neighbors = 0;\n // This section checks above the cell\n //checks up left\n if (i-1 >= 0 && j-1 >= 0 && this.grid[i-1][j-1] > 0){\n neighbors++;\n }\n //checks up\n if (i-1 >= 0 && this.grid[i-1][j] > 0){\n neighbors++;\n }\n //checks up right\n if (i-1 >= 0 && j+1 < this.cols && this.grid[i-1][j+1] > 0){\n neighbors++;\n }\n // This section checks the right and left neighbors\n //checks left\n if (j-1 >= 0 && this.grid[i][j-1] > 0){\n neighbors++;\n }\n //checks right\n if (j+1 < this.cols && this.grid[i][j+1] > 0){\n neighbors++;\n }\n //This section checks below the cell\n //checks down left\n if (i+1 < this.rows && j-1 >= 0 && this.grid[i+1][j-1] > 0){\n neighbors++;\n }\n //checks down\n if (i+1 < this.rows && this.grid[i+1][j] > 0){\n neighbors++;\n }\n //checks down right\n if (i+1 < this.rows && j+1 < this.cols && this.grid[i+1][j+1] > 0){\n neighbors++;\n }\n\t\treturn neighbors;\n\t}", "function collisionDetection() {\n for(let i=0; i<blockColumnCount; i++) {\n for(let j=0; j<blockRowCount; j++) {\n let b = blocks[i][j];\n if(b.status == 1) {\n if(x > b.x && x < b.x+blockWidth && y > b.y && y < b.y+blockHeight) {\n speedY = -speedY;\n b.status = 0;\n points+= 1;\n hitBlockSound.play();\n\n if (points === blockRowCount * blockColumnCount) {\n // ctx.clearRect(0, 0, canvas.width, canvas.height)\n gameOver();\n console.log('GAME OVER');\n gameStatus = 'game-over';\n }\n }\n }\n }\n }\n}", "getNeighbors(currentCell) {\n var neighbors = [];\n\n // add logic to get neighbors and add them to the array\n for (var xOffset = -1; xOffset <= 1; xOffset++) {\n for (var yOffset = -1; yOffset <= 1; yOffset++) {\n var neighborColumn = currentCell.column + xOffset;\n var neighborRow = currentCell.row + yOffset;\n\n // do something with neighborColumn and neighborRow\n /* Step 9\n - updated it with isValidPosition\n - Checks to prevent the cell that is the currentCell to be added to the array\n */\n if(this.isValidPosition(neighborColumn, neighborRow)){\n var neighborCell = this.cells[neighborColumn][neighborRow];\n \n if(neighborCell != currentCell){\n neighbors.push(neighborCell);\n }\n }\n }\n}\n\n return neighbors;\n}", "function addCells(width, height) {\n for (var x = 0; x < width; x += boxSize) {\n for (var y = 0; y < height; y += boxSize) {\n\n let tempCoord = new Coord(x + boxSize/2 + padding, y + boxSize/2 + padding);\n let rightCoord = new Coord(x + 3*boxSize/2 + padding, y + boxSize/2 + padding);\n let belowCoord = new Coord(x + boxSize/2 + padding, y + 3*boxSize/2 + padding);\n\n let temp;\n let right;\n let below;\n\n if(!contains(coords, tempCoord)) {\n temp = new Cell(new Coord(x + boxSize/2 + padding, y + boxSize/2 + padding));\n coords.push(temp.getCoord());\n cellMap.set(temp.getCoord(), temp);\n } else {\n tempCoord = find(tempCoord);\n temp = cellMap.get(tempCoord);\n }\n\n if(!contains(coords, rightCoord)) {\n right = new Cell(new Coord(x + 3*boxSize/2 + padding, y + boxSize/2 + padding));\n\n\n if(inBounds(rightCoord)) {\n coords.push(right.getCoord());\n cellMap.set(right.getCoord(), right);\n temp.addNeighbor(right);\n right.addNeighbor(temp);\n }\n\n } else {\n rightCoord = find(rightCoord);\n right = cellMap.get(rightCoord);\n\n if(inBounds(rightCoord)) {\n temp.addNeighbor(right);\n right.addNeighbor(temp);\n }\n }\n\n if(!contains(coords, belowCoord)) {\n\n below = new Cell(new Coord(x + boxSize/2 + padding, y + 3*boxSize/2 + padding));\n\n if(inBounds(belowCoord)) {\n coords.push(below.getCoord());\n cellMap.set(below.getCoord(), below);\n temp.addNeighbor(below);\n below.addNeighbor(temp);\n }\n\n } else {\n belowCoord = find(belowCoord);\n below = cellMap.get(belowCoord);\n\n if(inBounds(belowCoord)) {\n temp.addNeighbor(below);\n below.addNeighbor(temp);\n }\n }\n }\n }\n user.path.push(cellMap.get(coords[0]));\n}", "function solveMaze(){\n var Xqueue=[parseInt(src_x)]; \n var Yqueue=[parseInt(src_y)]; \n let pathFound=false;\n var xLoc;\n var yLoc;\n\n while(Xqueue.length>0 && !pathFound){\n xLoc=Xqueue.shift();\n yLoc=Yqueue.shift();\n if(xLoc>1){\n if(tiles[xLoc-1][yLoc].state=='f'){\n pathFound=true;\n }\n }\n if(xLoc<tileColCount-1){\n if(tiles[xLoc+1][yLoc].state=='f'){\n pathFound=true;\n }\n }\n if(yLoc>1){\n if(tiles[xLoc][yLoc-1].state=='f'){\n pathFound=true;\n }\n }\n \n if(yLoc<tileRowCount-1){\n if(tiles[xLoc][yLoc+1].state=='f'){\n pathFound=true;\n }\n }\n if(xLoc>1){\n if(tiles[xLoc-1][yLoc].state=='e'){\n Xqueue.push(xLoc-1);\n Yqueue.push(yLoc);\n tiles[xLoc-1][yLoc].state=tiles[xLoc][yLoc].state+'l';\n // rect(xloc-1,yLoc,tileW,tileH,tiles[xLoc-1][yLoc].state);\n }\n }\n if(xLoc<tileColCount-1){\n if(tiles[xLoc+1][yLoc].state=='e'){\n Xqueue.push(xLoc+1);\n Yqueue.push(yLoc);\n tiles[xLoc+1][yLoc].state=tiles[xLoc][yLoc].state+'r';\n //rect(xloc+1,yLoc,tileW,tileH,tiles[xLoc+1][yLoc].state);\n }\n }\n if(yLoc>1){\n if(tiles[xLoc][yLoc-1].state=='e'){\n Xqueue.push(xLoc);\n Yqueue.push(yLoc-1);\n tiles[xLoc][yLoc-1].state=tiles[xLoc][yLoc].state+'u';\n // rect(xloc,yLoc-1,tileW,tileH,tiles[xLoc][yLoc-1].state);\n }\n }\n if(yLoc<tileRowCount-1){\n if(tiles[xLoc][yLoc+1].state=='e'){\n Xqueue.push(xLoc);\n Yqueue.push(yLoc+1);\n tiles[xLoc][yLoc+1].state=tiles[xLoc][yLoc].state+'d';\n // rect(xloc,yLoc+1,tileW,tileH,tiles[xLoc][yLoc+1].state);\n }\n }\n //setInterval(draw(),100);\n }\n if(!pathFound){\n output.innerHTML=\"No Solution\";\n }\n else{\n output.innerHTML=\"Solved\";\n let path=tiles[xLoc][yLoc].state; \n let pathLength=path.length;\n let currX=parseInt(src_x); \n let currY=parseInt(src_y); \n for(let i=0;i<pathLength-1;i++){\n if(path.charAt(i+1)=='u'){\n currY-=1;\n }\n if(path.charAt(i+1)=='d'){\n currY+=1;\n }\n if(path.charAt(i+1)=='l'){\n currX-=1;\n }\n if(path.charAt(i+1)=='r'){\n currX+=1;\n }\n tiles[currX][currY].state='p';\n }\n }\n}", "countMines() {\n if (this.mine) {\n this.neighborCount = 1;\n return;\n }\n \n var total = 0;\n for (var xoff = -1; xoff <= 1;xoff++ ) {\n var i = this.i + xoff;\n if (i < 0 || i >= this.cols) continue;\n \n for (var yoff = -1; yoff <= 1; yoff++) {\n var j = this.j + yoff;\n if (j < 0 || j >= this.rows) continue;\n // \n var neighbor = this.grid[i][j];\n this.neighbourCells.push(neighbor)\n if (neighbor.mine) {\n total++;\n }\n }\n }\n this.neighborCount = total;\n }", "function findPath(startPos, goalPos, pathNumber, ignoreTowerSpawns, ignoreTowers) {\n //copy mapGrid array to a temp array\n var grid = copyArray(gameLoop.returnMapOfPath(pathNumber));\n\n //Set Goal\n grid[goalPos.indexX][goalPos.indexY] = 'GOAL';\n\n // Each \"location\" will store its coordinates\n // and the shortest path required to arrive there\n var location = {\n distX: startPos.indexX,\n distY: startPos.indexY,\n path: [],\n block: 'START'\n };\n\n // Initialize the queue with the start location already inside\n var queue = [location];\n\n // Loop through the grid searching for the goal\n while (queue.length > 0) {\n // Take the first location off the queue\n var currentLocation = queue.shift();\n\n // Explore North\n var newLocation = exploreInDirection(currentLocation, 0, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n\n // Explore East\n var newLocation = exploreInDirection(currentLocation, 1, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n\n // Explore South\n var newLocation = exploreInDirection(currentLocation, 2, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n\n // Explore West\n var newLocation = exploreInDirection(currentLocation, 3, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n }\n\n // No valid path found\n return false;\n\n}", "findShip(row, col) {\n const neighborCell = getNeighbourCells(row, col).find(([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.classList.contains('ship')\n );\n\n const isHorizontal = neighborCell?.[0] === row;\n const shipStart = Array.from({ length: Math.max(rows, cols) }, (_, index) =>\n isHorizontal ? [row, col - index] : [row - index, col]\n ).find(\n ([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.classList.contains('ship') !==\n true\n );\n const shipEnd = Array.from({ length: Math.max(rows, cols) }, (_, index) =>\n isHorizontal ? [row, col + index] : [row + index, col]\n ).find(\n ([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.classList.contains('ship') !==\n true\n );\n\n const horizontalIndex = isHorizontal ? 1 : 0;\n const ship = Array.from(\n { length: shipEnd[horizontalIndex] - shipStart[horizontalIndex] + 1 },\n (_, index) =>\n isHorizontal ? [row, shipStart[1] + index] : [shipStart[0] + index, col]\n );\n const trimmedShip = ship.slice(1, -1);\n\n const largestShip =\n this.fleet.ships.length -\n Array.from(this.fleet.ships)\n .reverse()\n .findIndex((ship) => !ship.disabled);\n\n let canAddBorder = trimmedShip.length === largestShip;\n if (typeof neighborCell === 'undefined')\n canAddBorder ||= getNeighbourCells(row, col).every(\n ([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.children[0].disabled !== false\n );\n else\n canAddBorder ||=\n this.opponentBoard.cells[shipStart[0]]?.[shipStart[1]]?.children[0]\n .disabled !== false &&\n this.opponentBoard.cells[shipEnd[0]]?.[shipEnd[1]]?.children[0]\n .disabled !== false;\n return ship;\n }", "function spread () {\n\n // Select number of zombies that will spread. Limited by Google Maps API\n spreading_zombies = Math.floor(Math.random() * 3);\n for (var i = 0; i < spreading_zombies; i++) {\n\n // Select a block to spread from\n var point_index = Math.floor(Math.random() * not_surrounded.length);\n var point = not_surrounded[point_index];\n\n // Get a list of uninfected neighbors and select one of them randomly\n var vulnerable_list = vulnerable_neighbors(point[0], point[1]);\n var targetIndex = Math.floor(Math.random() * vulnerable_list.length);\n var target = vulnerable_list[targetIndex];\n\n // If this block is surrounded by infected, remove it. \n if (vulnerable_list.length == 1) {\n not_surrounded.splice(point_index, 1);\n } else if (vulnerable_list.length == 0) {\n not_surrounded.splice(point_index, 1);\n continue;\n }\n\n // Infect targeted block\n infectBlock(list_of_blocks[point[0]][point[1]], target[2], [target[0], target[1]])\n };\n\n flying_zombies = Math.floor(Math.random() * 4);\n for (var i = 0; i < flying_zombies; i++) {\n // Select a block to spread from\n var point_index = Math.floor(Math.random() * not_surrounded.length);\n var point = not_surrounded[point_index];\n var country = point[2];\n\n // Get migration patterns for countries\n var export_vals = migrations[country];\n\n // get random number r in range 0 to sum\n var r = Math.floor(Math.random() * export_vals[\"sum\"])\n\n var new_country;\n for (var key in export_vals) {\n if (key == \"sum\" ) {\n continue;\n }\n\n r -= export_vals[key];\n new_country = key;\n\n if (r <= 0) {\n break;\n } \n }\n\n if (airports[new_country] == undefined || airports[new_country].length < 1) {\n continue;\n }\n\n var airport_index = Math.floor(Math.random() * airports[new_country].length);\n var airport = airports[new_country][airport_index];\n infectBlockCountry(airport.lat, airport.lng, new_country, origin, origin);\n origin += 100;\n };\n}", "function countSurroundingMines (cell) {\n var count = 0;\n console.log(\"countSurroundingMines initiated\");\n var surroundingCells = lib.getSurroundingCells(cell.row, cell.col);\n for(var k = 0; k < surroundingCells.length; k++) {\n console.log('for loop working');\n if (surroundingCells[k].isMine === true) {\n count += 1;\n }\n }\n // return board.cells[k].surroundingMines;\n return count;\n }", "function applyRules() {\n let work = map.slice(0);\n map = grid();\n\n for (var row in map) {\n if (map.hasOwnProperty(row)) {\n for (var col in map[row]) {\n if (map[row].hasOwnProperty(col)) {\n\n //map[row][col] = null;\n\n let tile = work[row][col];\n let n = getNeighbors(work, row, col);\n let totalNeigbors = n.reduce(function (total, sum) {\n return (total || 0) + (sum || 0);\n });\n\n if (tile === 1) {\n\n // Any live cell with fewer than two live neighbors dies, as if by underpopulation.\n if (totalNeigbors < 2) {\n map[row][col] = 0;\n }\n // Any live cell with two or three live neighbors lives on to the next generation.\n else if (totalNeigbors == 2 || totalNeigbors == 3) {\n map[row][col] = 1;\n }\n // Any live cell with more than three live neighbors dies, as if by overpopulation.\n else if (totalNeigbors > 3) {\n map[row][col] = 0;\n }\n\n } else {\n\n // Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.\n if (totalNeigbors == 3) {\n map[row][col] = 1;\n }\n\n }\n\n }\n }\n }\n }\n }", "function loop(item2){\n\n for(var t=0;t<allElementsList.length;t++){\n for(var u=0;u<allElementsList[t].length;u++){\n\n //when element that was clicked has a number\n if(allElementsList[t][u]===item2 && elementsAroundMines.has(item2) && !flagList.includes(item2)){\n document.getElementById('underDiv'+(allElementsList[t][u]).toString()).innerHTML=elementsAroundMines.get(allElementsList[t][u]);\n listOfNeighboursThatAreAroundMines.push(item2);\n\n if(allElementsList[t] && allElementsList[t][u]!==undefined && !uncoveredList.includes(allElementsList[t][u]) && !minesList.includes(allElementsList[t][u])){\n uncoveredList.push(allElementsList[t][u]);\n }\n }\n //if element has no number\n else if(allElementsList[t][u]===item2 && !flagList.includes(item2)){\n neighbourList.push(item2)\n\n gameStatements(t,u);\n gameStatements(t,u-1);\n gameStatements(t,u+1);\n gameStatements(t-1,u-1);\n gameStatements(t-1,u);\n gameStatements(t-1,u+1);\n gameStatements(t+1,u-1);\n gameStatements(t+1,u);\n gameStatements(t+1,u+1);\n\n }\n \n }\n } \n }", "generateScan() {\n //let scan = [];\n const rows = [this.shipLocation.qy - 1, this.shipLocation.qy, this.shipLocation.qy + 1];\n const cols = [this.shipLocation.qx - 1, this.shipLocation.qx, this.shipLocation.qx + 1];\n let scan = rows.map( (row) => {\n let result = cols.map( (col) => {\n if( row >= 1 && row <= 8 && col >= 1 && col <= 8 ) {\n const numEnemies = this.findNearby( row, col );\n if( row === this.shipLocation.qy && col === this.shipLocation.qx ) {\n return <div className=\"col warp-cell player-cell\">{numEnemies}</div>\n }\n else {\n return <div className=\"col warp-cell\">{numEnemies}</div>\n }\n }\n else {\n return <div className=\"col warp-cell cannot-warp\">-</div>\n }\n });\n return <div className=\"row\">{result}</div>;\n });\n return scan;\n }", "query(item, r)\n {\n if (r > this.maxRadius) r = this.maxRadius;\n\n let pos = item;\n if (this.prop)\n pos = item[this.prop];\n\n // Squared distance\n let rsq = r * r;\n\n // Use diagonal extent to find the cell range to search\n let cellminx = ((pos.x - r) - (this.mod((pos.x - r), this.xcellsize))) / this.xcellsize;\n let cellminy = ((pos.y - r) - (this.mod((pos.y - r), this.ycellsize))) / this.ycellsize;\n let cellminz = ((pos.z - r) - (this.mod((pos.z - r), this.zcellsize))) / this.zcellsize;\n\n let cellmaxx = ((pos.x + r) - (this.mod((pos.x + r), this.xcellsize))) / this.xcellsize;\n let cellmaxy = ((pos.y + r) - (this.mod((pos.y + r), this.ycellsize))) / this.ycellsize;\n let cellmaxz = ((pos.z + r) - (this.mod((pos.z + r), this.zcellsize))) / this.zcellsize;\n\n if (cellminx < 0) cellminx = 0;\n if (cellmaxx >= this.numcells) cellmaxx = this.numcells-1;\n\n if (cellminy < 0) cellminy = 0;\n if (cellmaxy >= this.numcells) cellmaxy = this.numcells - 1;\n\n if (cellminz < 0) cellminz = 0;\n if (cellmaxz >= this.numcells) cellmaxz = this.numcells - 1;\n\n let objs = [];\n\n for (let cz=cellminz; cz<=cellmaxz; cz++)\n {\n for (let cy=cellminy; cy<=cellmaxy; cy++)\n {\n for (let cx=cellminx; cx<=cellmaxx; cx++)\n {\n let cell = this.grid[cz][cy][cx];\n\n if (!cell) continue;\n\n for (let t=0; t<cell.length; t++)\n {\n let neighbour = cell[t];\n\n if (neighbour == item)\n continue;\n\n // Handle xy position stored in a child property of item\n let npos = neighbour;\n if (this.prop) npos = neighbour[this.prop];\n\n let d = this.distsq(npos.x, npos.y, npos.z, pos.x, pos.y, pos.z);\n\n if (d <= rsq)\n objs.push(neighbour);\n }\n }\n }\n }\n\n return objs;\n }", "addBorder() {\n const passedCells = new Set();\n this.opponentBoard.cells.forEach((row, rowIndex) =>\n row.forEach((cell, colIndex) => {\n if (passedCells.has(`${rowIndex}_${colIndex}`)) return;\n if (cell.classList.contains('ship'))\n this.findShip(rowIndex, colIndex).forEach(([row, col]) =>\n passedCells.add(`${row}_${col}`)\n );\n })\n );\n }", "_calcCellState(pos){\n var cell=pos.split(':');\n var x=Number (cell[0]);\n var y=Number (cell[1]);\n var currState=this._getCellState(x, y);\n // Get adjacent cells\n var sum=0;\n sum+=this._getCellState(x-1, y-1);\n sum+=this._getCellState(x, y-1);\n sum+=this._getCellState(x+1, y-1);\n sum+=this._getCellState(x-1, y);\n sum+=this._getCellState(x+1, y);\n sum+=this._getCellState(x-1, y+1);\n sum+=this._getCellState(x, y+1);\n sum+=this._getCellState(x+1, y+1);\n\n // Living cell\n if(currState===1){\n // < 2 live neighbors\n if(sum<2){return false;}\n // 2 or 3\n if(sum===2 || sum===3){return true;}\n // > 3\n if(sum>3){return false;}\n }else{\n if(sum===3){return true;}\n }\n return false\n }", "findNeighbors(i, j) {\n this.Neighbors.enumerate().forEach(neighbor => {\n let yOffset;\n let xOffset;\n let piece = this.pieces[i][j];\n let point = new Point(piece.point.x + this.Neighbors[neighbor].x, piece.point.y + this.Neighbors[neighbor].y);\n let check = this.hashmap.getPointFromMap(point, this.pieces);\n if (check !== null) {\n this.pieces[i][j].neighbors.push(\n () => this.hashmap.getPointFromMap(point, this.pieces)\n //check\n );\n }\n });\n }", "function collision(top_x, bottom_x, top_y, bottom_y) {\n\t\tfor (var i = 0; i < rows; i++) {\n\t\t\tfor (var j = 0; j < cols; j++) {\n\t\t\t\tvar b = bricks[j][i];\n\t\t\t\tif (b.exists == 1) {\n\t\t\t\t\tif (top_y < (b.y + block_height) && bottom_y > b.y && top_x < (b.x + block_width) && bottom_x > b.x) {\n\t\t\t\t\t\tb.exists = 0;\n\t\t\t\t\t\tball.y_speed = -ball.y_speed;\n\t\t\t\t\t\tplayer1Score += 1;\n\t\t\t\t\t\tbrickcount -= 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function getNeighbours(tile) {\n var neighbors = []\n for(var j=0; j<tiles.length; j++) {\n var current = tiles[j];\n if(!current.isActive) continue;\n if((Math.abs(current.indexX - tile.indexX) <= 1) && (Math.abs(current.indexY - tile.indexY) <= 1))\n neighbors.push(current)\n }\n return neighbors;\n}", "amountCellsInSnake(cell) {\n return this.snake.filter(({x, y}) => x === cell.x && y === cell.y)\n .length;\n }", "initNeighbors() {\n this.hashmap = new HashPoints(this.pieces);\n this.pieces.forEach((row, i) => {\n row.forEach((piece, j) => {\n //if (piece instanceof Dock) piece.calcDir(j, i, this);\n this.findNeighbors(i, j);\n })\n });\n }", "function countSurroundingMines(cell) {\n var surrounding = lib.getSurroundingCells(cell.row, cell.col);\n let countBombs = 0;\n surrounding.forEach((cell) => {\n if (cell.isMine) {\n countBombs++;\n }\n });\n return countBombs;\n}", "function isHit(bullet, top, left, _d, _s, is_en, by_whom, BT){\n\t\t\t\tvar hit = false;\n \t\tvar timr = setInterval(function(){\n \t\t\t\tif (state.exit) {\n \t\t\t\t\t\tclearInterval(timr);\n \t\t\t\t\t\treturn false;\n \t\t\t\t}\n \t\t\t\tif (state.pause) {\n \t\t\t\t\t\treturn false;\n \t\t\t\t}\n \t\t\t\tif (top < 10 || top > 535 || left < 10 || left > 675) {\n \t\t\t\t\t\tclearInterval(timr);\n \t\t\t\t\t\texplode(bullet);\n \t\t\t\t\t\treturn false;\n \t\t\t\t}\n \t\t\t\tbullet.css(_d, _d == 'top' ? top += _s : left += _s);\n\t\t\t\t$('div[isEnemy='+ is_en +']').each(function(i,n) {\n\t\t\t var t_top = parseInt($(n).css('top'));\n\t\t\t var t_left = parseInt($(n).css('left'));\n\t\t\t if (t_top < top + 10 && t_top > top - 36 && t_left < left + 10 && t_left > left - 36 && !hit) {\n\t\t\t\t\t\t\t\t\thit = true;\n\t\t\t \t\tclearInterval(timr);\n\t\t\t \t\t// enemy\n\t\t\t \t\tif ($(n).attr('isEnemy') == 'true') {\n\t\t\t \t\t\t$(n).data('who',by_whom);\n\t\t\t \t\t\t$(n).trigger('click', BT);\n\t\t\t \t\t// player\n\t\t\t \t\t} else if ($(n).attr('isEnemy') == 'false') {\n\t\t\t \t\t\t$(n).click();\n\t\t\t \t\t} \n\t\t\t \t\texplode(bullet);\n\t\t\t\t\t\treturn;\n\t\t\t }\n\t\t\t });\n\t\t\t\tfor (var i in blocks) {\n\t\t\t\t \tvar t_top = parseInt(blocks[i].t) - 100;\n\t\t\t var t_left = parseInt(blocks[i].l);\n\t\t\t if (t_top < top + 10 && t_top > top - 36 && t_left < left + 10 && t_left > left - 36 & !hit) {\n\t\t\t\t\t\t\t\thit = true;\n\t\t\t\t\t\t\t\tif (blocks[i].clazz =='w') {\n\t\t \t\t\t\treturn;\n\t\t \t\t}\n\t\t \t\tclearInterval(timr);\n\t\t \t\t\t// type of blocks\n\t\t \t\t\tif (blocks[i].clazz == 'king') {\n\t\t \t\t\t\t\t$('div[isEnemy=false]').each(function() {\n\t\t \t\t\t\t\t\t$(this).destory('bomb', 10);\n\t\t \t\t\t\t\t});\n\t\t \t\t\t\t\t$('#rb'+i).destory('bomb', 10);\n\t\t\t\t\t\t\t\t\t\tdelete blocks[i];\n\t\t \t\t\t\t\tgameOver('fail');\n\t\t \t\t\t} else if (blocks[i].clazz == 'e' && $('#rb'+i).hasClass('halfBlood')) {\n\t\t \t\t\t\t\t$('#rb'+i).destory('mapbomb', 11);\n\t\t\t\t\t\t\t\t\t\tdelete blocks[i];\n\t\t \t\t\t} else if (blocks[i].clazz =='e') {\n\t\t \t\t\t\t\t$('#rb'+i).addClass('halfBlood');\n\t\t \t\t\t\t\t$('#rb'+i).css('background', 'url(images/'+ getScene('map') +'.png) 100% no-repeat');\n\t\t \t\t}\n\t\t\t\t\t\t\t\texplode(bullet);\n\t\t \t\t\tbreak;\n \t\t}\n\t\t\t\t}\n\t\t\t }, 10);\n }", "function updateCell(x, y) {\n\tvar sum = 0;\n\tvar state = map[x][y];\n\tvar surroundState;\n\t//console.log(surround);\n\tfor (var i = -2; i < 3; i++) {\n\t\t//console.log(i);\n\t\tif(i === 0) {\n\t\t\tcontinue;\n\t\t}\n\t\tsurroundState = judgeCell(x+i, y);\n\t\tif (map[x][y] === 1) {\n\t\t\tif (surroundState === 0) {\n\t\t\t\tupdateCell(x+i, y);\n\t\t\t}\n\t\t}\n\t\tif (surroundState === 1) {\n\t\t\tsum++;\n\t\t}\n\t\tsurroundState = judgeCell(x, y+i);\n\t\tif (map[x][y] === 1) {\n\t\t\tif (surroundState === 0) {\n\t\t\t\tupdateCell(x, y+i);\n\t\t\t}\n\t\t}\n\t\tif(surroundState === 1) {\n\t\t\tsum++;\n\t\t}\n\t}\n\tswitch(sum) {\n\tcase liveState:\n\t\tif (state === 0) {\n\t\t\tif (multiDimArraySearch(x,y,currentLiveCells) == -1) {\n\t\t\t\tcurrentLiveCells[currentLiveCells.length] = [x, y];\n\t\t\t\tchangedCells[changedCells.length] = [x, y];\n\t\t\t}\n\t\t}else if(state === 1) {\n\t\t\tcurrentLiveCells[currentLiveCells.length] = [x, y];\n\t\t}\n\t\tbreak;\n\tcase keepState:\n\t\tif (state == 1) {\n\t\t\tcurrentLiveCells[currentLiveCells.length] = [x, y];\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\tif (state == 1) {\n\t\t\tchangedCells[changedCells.length] = [x, y];\n\t\t}\n\t\tbreak;\n\t}\n}", "function fiveShips() {\n//Go through every row to find the comliumns\n for (row = 0; row < 10; row++){\n //Go through every column if the posistion is a 1 or not\n for (column = 0; column < 10; column++){\n //Display ships if it is a 1.\n if(board[row][column] == 1){\n $('td[data-index=\"' + row + '-' + column + '\"]').addClass(\"whereTheShipsWere\")\n // if (board[row][column] == 2) {\n // $('td[data-index]=\"' + row + '_' + column + '\"]').addClass(\"hitShip\")\n // }\n console.log(\"You've hit a ship at position: \" + row + column);\n }\n }\n }\n}", "function pre_detect()\n{\n for (var i = 0; i < $cell.length; i++)\n {\n \tvar bombAround = 0;\n // There's nothing around\n if (i + 1 <= $cell.length-1) \t\tif ($cell[i + 1].classList.contains('cell-bomb')) bombAround++;\n if (i - 1 >= 0 ) \t\t\t \t\tif ($cell[i - 1].classList.contains('cell-bomb')) bombAround++;\n\tif (i - cols>= 0 ) \t\t\t \t\tif ($cell[(i - cols)].classList.contains('cell-bomb')) bombAround++;\n \tif (i - cols + 1 >= 0) \t\t \t\tif ($cell[(i - cols) + 1].classList.contains('cell-bomb')) bombAround++;\n if (i - cols - 1 >= 0) \t\t\t\tif ($cell[(i - cols) - 1].classList.contains('cell-bomb')) bombAround++;\n if (i + cols <= $cell.length-1)\t\tif ($cell[(i + cols)].classList.contains('cell-bomb')) bombAround++;\n if (i + cols + 1 <= $cell.length-1) if ($cell[(i + cols) + 1].classList.contains('cell-bomb')) bombAround++;\n if (i + cols - 1 <= $cell.length-1) if ($cell[(i + cols) - 1].classList.contains('cell-bomb')) bombAround++;\n bombArounds[i] = bombAround;\n }\n}", "function countSurroundingMines (cell) {\n\tvar surroundingCells = lib.getSurroundingCells(cell.row, cell.col);\n\tlet count = 0;\n\tfor (let i=0;i<surroundingCells.length; i++){\n\t\tif(surroundingCells[i].isMine)\n\t\t\tcount+=1;\n\t}\n\treturn count;\n}", "function identifyValidTiles(nodeArray,exitNode){\n var depth = 0;\n index = exitNode;\n while(nodeArray[index].visited == false){\n depth +=1;\n for (i=0; i<nodeArray.length; i++){\n if (nodeArray[i].visited == true && nodeArray[i].distance == depth){\n if (nodeArray[i].id == exitNode){\n nodeArray[i].visited = true;\n }\n if (nodeArray[i].id == 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n }\n if (nodeArray[i].id > 0 && nodeArray[i].id < maxRow-1){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n }\n if (nodeArray[i].id == maxRow-1){\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n }\n if (nodeArray[i].id > 0 && nodeArray[i].id < (maxRow*maxRow-maxRow) && nodeArray[i].id %maxRow == 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n }\n }\n if (nodeArray[i].id > maxRow-1 && nodeArray[i].id < (maxRow*maxRow-1) && (nodeArray[i].id+1) %maxRow == 0){\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n }\n }\n if (nodeArray[i].id == maxRow*maxRow-maxRow){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n } \n }\n if (nodeArray[i].id > maxRow*maxRow-maxRow && nodeArray[i].id < maxRow*maxRow-1){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n }\n }\n if (nodeArray[i].id == maxRow*maxRow-1){\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n } \n }\n if (nodeArray[i].id >maxRow-1 && nodeArray[i].id <maxRow*maxRow-maxRow && nodeArray[i].id %maxRow != 0 && (nodeArray[i].id+1)%maxRow != 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n } \n }\n } \n }\n} \n return nodeArray;\n}", "function treasureIsland2(grid) {\n //create q, add all S's to q, set S's to visited\n let q = [];\n for (let i = 0; i < grid.length; i++) {\n for (let j = 0; j < grid[i].length; j++) {\n if (grid[i][j] === 'S') {\n q.push([i,j]);\n grid[i][j] = 'D';\n }\n }\n }\n \n let steps = 0;\n const dir = [[1,0],[-1,0],[0,1],[0,-1]];\n\n while (q.length) {\n let newQ = [];\n while (q.length) {\n let [i,j] = q.shift();\n //check each neighbor of this layer (bfs)\n for (let d of dir) {\n let x = i + d[0];\n let y = j + d[1];\n\n if (x < 0 || y < 0 || x >= grid.length || y >= grid[0].length || grid[x][y] === 'D') {\n continue;\n }\n //check if this neighbor is a target\n if (grid[x][y] === 'X') {\n return steps + 1;\n }\n grid[x][y] = 'D';\n newQ.push([x,y]);\n }\n }\n steps += 1;\n q = newQ;\n }\n return -1;\n}", "function computerAttack(player,computer){\n let row, column, cell, data\n\n //Gets random row and column value and checks if coordinate had already been checked\n do{\n row = getRandomGridValue()\n column = getRandomGridValue()\n data = `{x: ${row}, y: ${column}}`\n let battlegrid = document.getElementsByClassName('battlegrid')\n cell = battlegrid[0].querySelector(`[data-coord=\"${data}\"]`)\n } while(cell.className == 'hit' || cell.className == 'miss')\n\n if(hasShip(player.grid, row, column)){\n //if ship hit\n cell.className = 'hit'\n cell.innerText = 'X'\n computer.score++\n if(checkWinningPlayer(computer)){\n return\n }\n } else{\n //if ship NOT hit\n cell.className = 'miss'\n cell.innerText = '•'\n }\n}", "toDiggableGrid() {\n\n let grid = [];\n for (let y = 0; y < this.height; y++) {\n grid[y] = [];\n for (let x = 0; x < this.width; x++) {\n let walkable = 0;\n let tile = this.tiles[x][y];\n /*\n if(tile.isPlaced) {\n walkable = 0;\n }*/\n if (!tile.isPlaced || tile.isDoor) {\n walkable = 1;\n }\n grid[y][x] = walkable;\n }\n }\n //debug draw the collisionGrid on a canvas.\n /*\n let gridCanvas = document.createElement(\"canvas\");\n gridCanvas.width = this.width;\n gridCanvas.height = this.height;\n let gridCtx = gridCanvas.getContext('2d');\n for (let y = 0; y < this.height; y++) {\n for (let x = 0; x < this.width; x++) {\n gridCtx.fillStyle = grid[y][x] >0 ? 'black':'white';\n gridCtx.fillRect(x,y,1,1);\n }\n } document.body.appendChild(gridCanvas);\n */\n return grid;\n }", "function countSurroundingMines(cell) {\n var count = 0\n\n var surrounding = lib.getSurroundingCells(cell.row, cell.col)\n\n for (let i = 0; i < surrounding.length; i++) {\n var cell = surrounding[i]\n\n if (cell.isMine == true) {\n count++\n }\n }\n return count\n}", "function getSurroundingCells(cell) {\n\n// NW N NE\n// W + E\n// SW S SE\n\n var cells = {};\n var missingElement = document.createElement(\"div\");\n\n // West\n if (parseInt(cell.getAttribute('cell')) > 0) {\n cells.w = document.querySelector(`.cell[cell=\"${parseInt(cell.getAttribute('cell'))-1}\"][row=\"${cell.getAttribute('row')}\"]`);\n } else {\n cells.w = missingElement;\n }\n // East\n if (parseInt(cell.getAttribute('cell')) < Math.sqrt(game.gridSize)) {\n cells.e = document.querySelector(`.cell[cell=\"${parseInt(cell.getAttribute('cell'))+1}\"][row=\"${cell.getAttribute('row')}\"]`);\n } else {\n cells.e = missingElement;\n }\n\n // North\n if (parseInt(cell.getAttribute('row')) > 0) {\n cells.n = document.querySelector(`.cell[row=\"${parseInt(cell.getAttribute('row'))-1}\"][cell=\"${cell.getAttribute('cell')}\"]`);\n } else {\n cells.n = missingElement;\n }\n // South\n if (parseInt(cell.getAttribute('row')) < Math.sqrt(game.gridSize)) {\n cells.s = document.querySelector(`.cell[row=\"${parseInt(cell.getAttribute('row'))+1}\"][cell=\"${cell.getAttribute('cell')}\"]`);\n } else {\n cells.s = missingElement;\n }\n\n // North East\n if (parseInt(cell.getAttribute('row')) > 0 && parseInt(cell.getAttribute('cell')) < Math.sqrt(game.gridSize)) {\n cells.ne = document.querySelector(`.cell[row=\"${parseInt(cell.getAttribute('row'))-1}\"][cell=\"${parseInt(cell.getAttribute('cell'))+1}\"]`);\n } else {\n cells.ne = missingElement;\n }\n\n // North West\n if (parseInt(cell.getAttribute('row')) < Math.sqrt(game.gridSize) && parseInt(cell.getAttribute('cell')) < Math.sqrt(game.gridSize)) {\n cells.nw = document.querySelector(`.cell[row=\"${parseInt(cell.getAttribute('row'))-1}\"][cell=\"${parseInt(cell.getAttribute('cell'))-1}\"]`);\n } else {\n cells.nw = missingElement;\n }\n\n // South East\n if (parseInt(cell.getAttribute('row')) < Math.sqrt(game.gridSize) && parseInt(cell.getAttribute('cell')) < Math.sqrt(game.gridSize)) {\n cells.se = document.querySelector(`.cell[row=\"${parseInt(cell.getAttribute('row'))+1}\"][cell=\"${parseInt(cell.getAttribute('cell'))+1}\"]`);\n } else {\n cells.se = missingElement;\n }\n\n // South West\n if (parseInt(cell.getAttribute('row')) < Math.sqrt(game.gridSize) && parseInt(cell.getAttribute('cell')) > 0) {\n cells.sw = document.querySelector(`.cell[row=\"${parseInt(cell.getAttribute('row'))+1}\"][cell=\"${parseInt(cell.getAttribute('cell'))-1}\"]`);\n } else {\n cells.sw = missingElement;\n }\n\n return cells;\n}" ]
[ "0.62348676", "0.6098137", "0.60531044", "0.6020119", "0.6004894", "0.5953157", "0.59371924", "0.59065086", "0.5859303", "0.58442813", "0.5824677", "0.58131856", "0.5758301", "0.5729595", "0.57244885", "0.567412", "0.56552833", "0.56080884", "0.5606305", "0.5575332", "0.5553829", "0.55522233", "0.5544676", "0.5536062", "0.5525851", "0.55162156", "0.55095196", "0.54980373", "0.54873675", "0.5483601", "0.5481805", "0.5468771", "0.5458342", "0.5441929", "0.5419349", "0.54170007", "0.54051155", "0.53997374", "0.5387129", "0.5386881", "0.5377128", "0.5371327", "0.5368338", "0.53559786", "0.53535134", "0.53483284", "0.5343687", "0.53367466", "0.53357226", "0.5333781", "0.53256655", "0.5316409", "0.53131545", "0.5308169", "0.53048074", "0.53017026", "0.5301204", "0.5299998", "0.52972174", "0.52911603", "0.52904785", "0.52898294", "0.52870876", "0.5284473", "0.52842", "0.5280461", "0.527858", "0.5276959", "0.52711827", "0.526704", "0.5266707", "0.52645856", "0.5245278", "0.52448344", "0.5242898", "0.5237363", "0.5237076", "0.5234783", "0.52298665", "0.52292764", "0.5226089", "0.52245325", "0.5222028", "0.5221971", "0.52199495", "0.52194554", "0.521789", "0.5210734", "0.521045", "0.52046317", "0.520392", "0.520385", "0.5201273", "0.52001333", "0.5199546", "0.5198517", "0.5194478", "0.5194036", "0.51914746", "0.51898474" ]
0.5889154
8
Purpose: Starts searching through the grid. Starts by trying to find the largest ship by skipping to every nth blocks.
function startGame(){ var j = 5; // value by which to skip. while (j>0){ var max = 0; for(var m =0; m<ships.length; m++){ if (ships[m]>max){ max = ships[m];} } if (j>max){ j = max; } writeToConsole(ships); writeToConsole("Trying spacing by " + j); for (var i=0; i<=j; i++){ for(var x=0; x< Math.floor(game.board_size.width/j); x++){ for(var y=0; y< Math.floor(game.board_size.height/j); y++){ if (isHit(j*x + i,j*y + i)){ exploreNeighbors(j*x + i,j*y + i); } } } } j--; } raiseError('Unable to confirm Game Over'); endGame() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exploreNeighbors(x,y){\n\tfunction labelEmpty(x,y){\n\t\tif (x>=0 && x<game.board_size.width && y>=0 && y<game.board_size.height){\n\t\t\tdocument.getElementById(y+'_'+x).setAttribute('class','avoid');\n\t\t\tboard[x][y] = null;\t\t// Indicate that cell should never be examined\n\t\t}\n\t}\n\tfunction pursueShip(x,y, xp, yp){\n\t\t\n\t\tships.sort();\n\t\tvar maxSize = ships[ships.length -1];\n\t\tvar length = 0;\n\t\t\n\t\twhile (length<=maxSize && isHit(x + xp*length, y + yp*length)){\n\t\t\t// Label cells on either side as empty\n\t\t\tlabelEmpty(x + xp*length + yp,y + yp*length + xp);\n\t\t\tlabelEmpty(x + xp*length - yp,y + yp*length - xp);\n\t\t\t\n\t\t\tlength++;\n\t\t}\n\t\t\n\t\tlength = 1;\n\t\txp = -xp;\n\t\typ = -yp;\n\t\twhile (length<=maxSize && isHit(x + xp*length, y + yp*length)){\n\t\t\t// Label cells on either side as empty\n\t\t\tlabelEmpty(x + xp*length + yp,y + yp*length + xp);\n\t\t\tlabelEmpty(x + xp*length - yp,y + yp*length - xp);\n\t\t\t\n\t\t\tlength++;\n\t\t}\n\t}\n\t\n\t// Pick a direction\n\tif (isHit(x+1,y)){\n\t\tlabelEmpty(x,y+1);\n\t\tlabelEmpty(x,y-1);\n\t\tpursueShip(x,y,1,0); \n\t}\n\telse if (isHit(x-1,y)){\n\t\tlabelEmpty(x,y+1);\n\t\tlabelEmpty(x,y-1);\n\t\tpursueShip(x,y,-1,0);\n\t}\n\telse if (isHit(x,y+1)){\n\t\tlabelEmpty(x+1,y);\n\t\tlabelEmpty(x-1,y);\n\t\tpursueShip(x,y,0,1);\n\t}\n\telse if (isHit(x,y-1)){\n\t\tlabelEmpty(x+1,y);\n\t\tlabelEmpty(x-1,y);\n\t\tpursueShip(x,y,0,-1);\n\t}\n}", "function identifyNeighbours(x_max,y_max){\n\t \t\tvar traversalIndex = 0;\n\n\t \t\t//inner square\n\t \t\tfor (var i = 0; i < x_max*y_max; i++) {\n\t \t\t\ttraversalIndex = (i % y_max);\n\n\t \t\tif((traversalIndex != 0) && (traversalIndex != (y_max-1)) \n\t \t\t&& (i <= ((y_max)*(x_max-1)-1)) && (i >= y_max+1) ){\n\t \t\t\tspaces[i].adjacentNeighbours = spaces[(i-1)].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[i+1].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[i+y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[i-y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i-1)+y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i-1)-y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i+1)+y_max].holdsMine\n\t \t\t\t\t\t\t\t\t\t + spaces[(i+1)-y_max].holdsMine;\n\t \t\t\tspaces[i].neighbourIndexList.push( (i+1),(i-1),(i+y_max),(i-y_max),\n\t \t\t\t\t\t\t\t\t\t\t\t\t(i-1+y_max),(i-1-y_max),\n\t \t\t\t\t\t\t\t\t\t\t\t\t(i+1+y_max),(i+1-y_max));\n\t\t\t\t}\n\t\t\t// console.log(isNaN(spaces[i].holdsMine))\n\t\t\t}\n\n\t\t\t//four courners\n\t\t\tspaces[0].adjacentNeighbours = spaces[y_max].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[y_max+1].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[1].holdsMine;\n\n\t\t\tspaces[0].neighbourIndexList.push(y_max,(y_max+1),1);\n\n\t\t\tspaces[y_max-1].adjacentNeighbours = spaces[(y_max-1) - 1].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max-1) + y_max].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max-1) + y_max-1].holdsMine;\n\n\t\t\tspaces[(y_max-1)].neighbourIndexList.push((y_max-1-1), (y_max-1+y_max), (y_max-1+y_max-1));\n\n\n\t\t\tspaces[y_max*x_max-1].adjacentNeighbours = spaces[(y_max*x_max-1)-1].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max*x_max-1)-y_max].holdsMine\n\t\t\t\t\t\t\t\t\t\t\t\t + spaces[(y_max*x_max-1)-(y_max-1)].holdsMine;\n\n\t\t\tspaces[y_max*x_max-1].neighbourIndexList.push((y_max*x_max-1)-1, (y_max*x_max-1)-y_max, (y_max*x_max-1)-(y_max-1));\n\n\n\t\t\tspaces[(x_max *(y_max-1))].adjacentNeighbours = spaces[(x_max *(y_max-1))+ 1].holdsMine\n + spaces[(x_max *(y_max-1))-y_max].holdsMine\n + spaces[(x_max *(y_max-1))-(y_max)+1].holdsMine; \n\n spaces[(x_max *(y_max-1))].neighbourIndexList.push((x_max *(y_max-1))+ 1, (x_max *(y_max-1))-y_max,(x_max *(y_max-1))-(y_max)+1);\n\n\n for(var k = 1; k < y_max-1; k++){\n\n\t\t \t\t//left column\n\t\t \t\tspaces[k].adjacentNeighbours = spaces[k-1].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+1].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+y_max - 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t + spaces[k+y_max + 1].holdsMine;\n\n\t\t \t\tspaces[k].neighbourIndexList.push(k-1,k+1,k+y_max,k+y_max-1,k-y_max+1);\n\n\n\t\t \t\t//right column\n\t\t \t\tspaces[x_max *(y_max-1) + k].adjacentNeighbours = spaces[ (x_max *(y_max-1) + k) + 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t+ spaces[x_max *(y_max-1) + k - 1].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[x_max *(y_max-1) + k - y_max].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[x_max *(y_max-1) + k - y_max + 1].holdsMine\n\t\t\t\t\t\t\t\t\t + spaces[x_max *(y_max-1) + k - y_max - 1].holdsMine;\n\n\t\t\t\tspaces[x_max *(y_max-1) + k].neighbourIndexList.push((x_max *(y_max-1) + k) + 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - y_max,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - y_max + 1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t x_max *(y_max-1) + k - y_max - 1);\n\t\t \t\t\n\t\t \t\t//top row\n\t\t \t\tspaces[k*y_max].adjacentNeighbours = spaces[k*y_max + 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k+1)*y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k-1)*y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k+1)*y_max + 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t + spaces[(k-1)*y_max + 1].holdsMine;\n\n\t\t \t\tspaces[k*y_max].neighbourIndexList.push(k*y_max + 1,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k+1)*y_max,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k-1)*y_max,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k+1)*y_max + 1,\n\t\t \t\t\t\t\t\t\t\t\t\t\t\t(k-1)*y_max + 1);\n\n\t\t \t\t//bottom row\n\t\t \t\tspaces[(k+1)*(y_max)-1].adjacentNeighbours = spaces[(k+1)*(y_max)-1 - 1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t\t+ spaces[(k+1)*(y_max)-1 - y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t + spaces[(k+1)*(y_max)-1 + y_max].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t\t+ spaces[(k+1)*(y_max)-1 - y_max-1].holdsMine\n\t\t \t\t\t\t\t\t\t\t\t\t + spaces[(k+1)*(y_max)-1 +y_max-1].holdsMine;\n\n\n\t\t\t\tspaces[(k+1)*(y_max)-1].neighbourIndexList.push((k+1)*(y_max)-1 - 1,\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t\t (k+1)*(y_max)-1 - y_max,\n\t\t\t\t\t\t\t\t\t\t\t\t (k+1)*(y_max)-1 + y_max,\n\t\t\t\t\t\t\t\t\t\t\t\t (k+1)*(y_max)-1 - y_max-1,\n\t\t\t\t\t\t\t\t\t\t\t\t (k+1)*(y_max)-1 + y_max-1);\n\t \t\t}\n\t \t}", "function nextGeneration(){\n\n\t// Deletes unused chunks\n\tdeleteEmptyChunks();\n\n\t// Generates new chunks where needed\n\tgenerateNewChunks();\n\n\t// Qualify cells (Keep or Kill)\n\tfor (var i = chunks.length - 1; i >= 0; i--) {\n\t\tif (chunks[i].active == 1) {\n\n\t\t\tvar chunk = chunks[i];\n\t\t\tvar cells = chunks[i].cells;\n\n\t\t\t/*\n\t\t\t* Maybe change this so that we look on the edges first and then inside the chunk\n\t\t\t* \n\t\t\t*\n\t\t\t*\n\t\t\t*/\n\n\t\t\t// for all the cells in the chunk\n\t\t\tfor (var y = cells.length - 1; y >= 0; y--) {\n\t\t\t\tfor (var x = cells[y].length - 1; x >= 0; x--) {\n\n\t\t\t\t\tvar cell = cells[y][x];\n\t\t\t\t\tvar neighbors = 0;\n\t\t\t\t\tvar bounds = game.chunkSize-1;\n\n\t\t\t\t\t// Top and Top Right neighbors\n\t\t\t\t\tif (y != 0) {\n\t\t\t\t\t\t//top block\n\t\t\t\t\t\tif (chunk.cells[y-1][x].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// right block\n\t\t\t\t\t\tif (x != bounds) {\n\t\t\t\t\t\t\tif (chunk.cells[y-1][x+1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(x == bounds) {\t\n\t\t\t\t\t\t\tvar rightChunk = findChunk(chunks, {x: chunk.x+1, y: chunk.y});\n\n\t\t\t\t\t\t\tif (rightChunk != undefined && rightChunk.cells[y-1][0].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\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\telse if (y == 0) {\n\t\t\t\t\t\tvar topChunk = findChunk(chunks, {x: chunk.x, y: chunk.y-1});\n\n\t\t\t\t\t\t//top block\n\t\t\t\t\t\tif (topChunk != undefined && topChunk.cells[bounds][x].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t//top right block\n\t\t\t\t\t\tif (x != bounds) {\n\t\t\t\t\t\t\tif (topChunk != undefined && topChunk.cells[bounds][x+1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(topChunk != undefined && x == bounds) {\t\n\t\t\t\t\t\t\tvar topRightChunk = findChunk(chunks, {x: topChunk.x+1, y: topChunk.y});\n\n\t\t\t\t\t\t\tif (topRightChunk != undefined && topRightChunk.cells[bounds][0].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\n\t\t\t\t\t// Bottom and Bottom Left neighbors\n\t\t\t\t\tif (y != bounds && neighbors <4) {\n\t\t\t\t\t\t//bottom block\n\t\t\t\t\t\tif (chunk.cells[y+1][x].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// bottom Left block\n\t\t\t\t\t\tif (x != 0) {\n\t\t\t\t\t\t\tif (chunk.cells[y+1][x-1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(x == 0 && neighbors <4) {\t\n\t\t\t\t\t\t\tvar leftChunk = findChunk(chunks, {x: chunk.x-1, y: chunk.y});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (leftChunk != undefined && leftChunk.cells[y+1][bounds].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\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\telse if (y == bounds) {\n\t\t\t\t\t\tvar bottomChunk = findChunk(chunks, {x: chunk.x, y: chunk.y+1});\n\n\t\t\t\t\t\t//bottom block\n\t\t\t\t\t\tif (bottomChunk != undefined && bottomChunk.cells[0][x].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t//bottom left block\n\t\t\t\t\t\tif (x != 0) {\n\t\t\t\t\t\t\tif (bottomChunk != undefined && bottomChunk.cells[0][x-1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(bottomChunk != undefined && x == 0 && neighbors <4) {\t\n\t\t\t\t\t\t\tvar bottomLeftChunk = findChunk(chunks, {x: bottomChunk.x-1, y: bottomChunk.y});\n\n\t\t\t\t\t\t\tif (bottomLeftChunk != undefined && bottomLeftChunk.cells[0][bounds].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\n\t\t\t\t\t// Left and Left Top neighbors\n\t\t\t\t\tif (x != 0 && neighbors <4) {\n\t\t\t\t\t\t// Left block\n\t\t\t\t\t\tif (chunk.cells[y][x-1].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Left top block\n\t\t\t\t\t\tif (y != 0) {\n\t\t\t\t\t\t\tif (chunk.cells[y-1][x-1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(y == 0 && neighbors <4) {\t\n\t\t\t\t\t\t\tvar leftTopChunk = findChunk(chunks, {x: chunk.x, y: chunk.y-1});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (leftTopChunk != undefined && leftTopChunk.cells[bounds][x-1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\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\telse if (x == 0 && neighbors <4) {\n\t\t\t\t\t\tvar leftChunk = findChunk(chunks, {x: chunk.x-1, y: chunk.y});\n\n\t\t\t\t\t\t//left block\n\t\t\t\t\t\tif (leftChunk != undefined && leftChunk.cells[y][bounds].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t//left top block\n\t\t\t\t\t\tif (y != 0) {\n\t\t\t\t\t\t\tif (leftChunk != undefined && leftChunk.cells[y-1][bounds].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(y == 0 && neighbors <4) {\t\n\t\t\t\t\t\t\tvar leftTopChunk = findChunk(chunks, {x: chunk.x-1, y: chunk.y-1});\n\n\t\t\t\t\t\t\tif (leftTopChunk != undefined && leftTopChunk.cells[bounds][bounds].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\n\t\t\t\t\t// Right and Right Bottom neighbors\n\t\t\t\t\tif (x != bounds && neighbors <4) {\n\t\t\t\t\t\t// Right block\n\t\t\t\t\t\tif (chunk.cells[y][x+1].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t// Right Bottom block\n\t\t\t\t\t\tif (y != bounds) {\n\t\t\t\t\t\t\tif (chunk.cells[y+1][x+1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(y == bounds && neighbors <4) {\t\n\t\t\t\t\t\t\tvar rightBottomChunk = findChunk(chunks, {x: chunk.x, y: chunk.y+1});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (rightBottomChunk != undefined && rightBottomChunk.cells[0][x+1].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\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\telse if (x == bounds && neighbors <4) {\n\t\t\t\t\t\tvar rightChunk = findChunk(chunks, {x: chunk.x+1, y: chunk.y});\n\n\t\t\t\t\t\t//right block\n\t\t\t\t\t\tif (rightChunk != undefined && rightChunk.cells[y][0].a == 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\t//right bottom block\n\t\t\t\t\t\tif (y != bounds) {\n\t\t\t\t\t\t\tif (rightChunk != undefined && rightChunk.cells[y+1][0].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(y == bounds && neighbors <4) {\t\n\t\t\t\t\t\t\tvar rightBottomChunk = findChunk(chunks, {x: chunk.x+1, y: chunk.y+1});\n\n\t\t\t\t\t\t\tif (rightBottomChunk != undefined && rightBottomChunk.cells[0][0].a == 1) {\n\t\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\n\t\t\t\t\t// Decide if I kill or keep the cell\n\t\t\t\t\tif (neighbors <= 1 || neighbors >= 4){\n\t\t\t\t\t\tcell.k = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse if (cell.a == 1 && neighbors <= 3){\n\t\t\t\t\t\tcell.k = 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if(cell.a == 0 && neighbors == 3){\n\t\t\t\t\t\tcell.k = 1;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n\n\t// Kill all cells that didnt qualify\n\tkill();\n}", "findNeighbors(grid) {\r\n // console.log(`current cell position X:${this.positionX}, Y:${this.positionY}`);\r\n\r\n // items.neighbors = \r\n\r\n //left item position\r\n if (this.positionX - 1 > -1) {\r\n // console.log(`Left neighbor`);\r\n this.neighbors.push(grid.items[this.positionY][this.positionX - 1]);\r\n }\r\n //right item position\r\n if (this.positionX + 1 <= grid.width - 1) {\r\n // console.log(`Right neighbor`);\r\n this.neighbors.push(grid.items[this.positionY][this.positionX + 1]);\r\n }\r\n\r\n //top left item position\r\n if (this.positionX - 1 > -1 && this.positionY - 1 > -1) {\r\n // console.log('Top Left')\r\n this.neighbors.push(grid.items[this.positionY - 1][this.positionX - 1]);\r\n }\r\n //top right item position\r\n if (this.positionX + 1 <= grid.width - 1 && this.positionY - 1 > -1) {\r\n // console.log('Top Right')\r\n this.neighbors.push(grid.items[this.positionY - 1][this.positionX + 1]);\r\n }\r\n //top item position\r\n if (this.positionY - 1 > -1) {\r\n // console.log(`Top neighbor`);\r\n this.neighbors.push(grid.items[this.positionY - 1][this.positionX]);\r\n }\r\n\r\n //bottom left item position\r\n if (this.positionX - 1 > -1 && this.positionY + 1 <= grid.height - 1) {\r\n // console.log('Bottom Left');\r\n this.neighbors.push(grid.items[this.positionY + 1][this.positionX - 1]);\r\n }\r\n\r\n //bottom right item position\r\n if (this.positionX + 1 <= grid.width - 1 && this.positionY + 1 <= grid.height - 1) {\r\n // console.log('Bottom Right')\r\n this.neighbors.push(grid.items[this.positionY + 1][this.positionX + 1]);\r\n }\r\n //bottom item position\r\n if (this.positionY + 1 <= grid.height - 1) {\r\n // console.log(`Bottom neighbor`);\r\n this.neighbors.push(grid.items[this.positionY + 1][this.positionX]);\r\n }\r\n }", "function locate(element, ship, check) {\n for (var i = 0; i < Number(ship.className[6]); ++i) {\n if (Number(element.id[6]) + i === 10) {\n return \"block\";\n } \n var newElement = document.getElementById(\"ship_\" + element.id[4] + (Number(element.id[6] + i)));\n check = true;\n if (!shipIsInBoard(newElement, ship)) {\n check = false;\n break;\n }\n }\n return check;\n}", "getNeighbors(i, j) {\n\t\tlet neighbors = 0;\n // This section checks above the cell\n //checks up left\n if (i-1 >= 0 && j-1 >= 0 && this.grid[i-1][j-1] > 0){\n neighbors++;\n }\n //checks up\n if (i-1 >= 0 && this.grid[i-1][j] > 0){\n neighbors++;\n }\n //checks up right\n if (i-1 >= 0 && j+1 < this.cols && this.grid[i-1][j+1] > 0){\n neighbors++;\n }\n // This section checks the right and left neighbors\n //checks left\n if (j-1 >= 0 && this.grid[i][j-1] > 0){\n neighbors++;\n }\n //checks right\n if (j+1 < this.cols && this.grid[i][j+1] > 0){\n neighbors++;\n }\n //This section checks below the cell\n //checks down left\n if (i+1 < this.rows && j-1 >= 0 && this.grid[i+1][j-1] > 0){\n neighbors++;\n }\n //checks down\n if (i+1 < this.rows && this.grid[i+1][j] > 0){\n neighbors++;\n }\n //checks down right\n if (i+1 < this.rows && j+1 < this.cols && this.grid[i+1][j+1] > 0){\n neighbors++;\n }\n\t\treturn neighbors;\n\t}", "run() {\n // The list of discovered nodes that need to be evaluated.\n const openSet = [this.grid.startNode];\n\n // closed set contains nodes that have already been visited\n const closedSet = [];\n\n while (openSet.length > 0) {\n\n // current is node having the lowest fScore in openSet,\n // sort openSet so lowest f-score is at end of the array, then pop it off the end\n const current = openSet.sort((n1, n2) => n2.f - n1.f).pop();\n this.openSet = openSet;\n this.currentNode = current;\n\n if (current.equals(this.grid.goalNode)) {\n return current;\n }\n closedSet.push(current);\n\n for (const neighbor of this.grid.neighbors( current.row, current.col ) ) {\n // don't examine neighbors that are already in the closedSet\n if (closedSet.find(node => node.equals(neighbor))) {\n continue;\n }\n // tempGScore is the distance from start to the neighbor through current\n const tempGScore = current.g + current.weightToNode(neighbor);\n\n if (!this.grid.isObstacleNode(current.row, current.col)) {\n if (tempGScore < neighbor.g) {\n // this path to neighbor is the best so far, record it\n neighbor.cameFrom = current;\n neighbor.g = tempGScore;\n neighbor.f = neighbor.g;\n // if neighbor not in openSet, then add it\n if (!openSet.find(node => node.equals(neighbor))) {\n openSet.push(neighbor);\n }\n }\n }\n\n }\n }\n // goal never reached, return null\n return null;\n }", "function newGrid() {\n // Checks how many living neighboring cells each cell has\n // Iterate the grid\n for (let i = 0; i < dimension; i++) {\n for (let j = 0; j < dimension; j++) {\n // Count surrounding living cells\n let cellsCount = 0;\n // Check the three cells above the current one\n if (i !== 0) { // continue only if this is not the first/zero row\n if (j !== 0) // continue only if this is not the first/zero column\n cellsCount += grid[i - 1][j - 1];\n cellsCount += grid[i - 1][j];\n if (j !== (dimension - 1)) // continue only if this is not the last column\n cellsCount += grid[i - 1][j + 1];\n }\n // Check the cell on the left\n if (j !== 0) // continue only if this is not the first/zero column\n cellsCount += grid[i][j - 1];\n // Check the cell on the right \n if (j !== (dimension - 1)) // continue only if this is not the last column\n cellsCount += grid[i][j + 1];\n // Check the three cells below the current one\n if (i !== (dimension - 1)) {\n if (j !== 0) // continue only if this is not the first/zero column\n cellsCount += grid[i + 1][j - 1];\n cellsCount += grid[i + 1][j];\n if (j !== (dimension - 1)) // continue only if this is not the last column\n cellsCount += grid[i + 1][j + 1];\n }\n\n // Check if the currnet cell is dead\n if (grid[i][j] === 0) {\n // Become alive if three surrounding cells are alive, else die\n if (cellsCount === 3) {\n copiedGrid[i][j] = 1;\n } else {\n copiedGrid[i][j] = 0;\n }\n } \n // Current cell is alive\n else if (grid[i][j] === 1) {\n // stay alive with 2 or 3 living neighbours, else die\n if (cellsCount === 2 || cellsCount === 3) {\n copiedGrid[i][j] = 1;\n } else {\n copiedGrid[i][j] = 0;\n }\n }\n }\n }\n\n // Copy the temporary grid in real one\n for (let j = 0; j < dimension; j++) {\n for (let k = 0; k < dimension; k++) {\n grid[j][k] = copiedGrid[j][k];\n }\n }\n\n drawGrid();\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 buildGridLevel1() {\n\n cells.forEach((cell, index) => {\n\n //Building the walls-Each row is a line\n //Function only works for a width of 18, so if we have a higher level function we would have to update the rebuild the larger grid in the function before we build walls\n if ((index >= 0 && index < 18) ||\n (index === 18) || index === 26 || index === 27 || index === 35 ||\n index === 36 || (index >= 38 && index <= 42) || index === 44 || index === 45 || (index >= 47 && index <= 51) || index === 53 ||\n index === 54 || (index >= 56 && index <= 60) || index === 62 || index === 63 || (index >= 65 && index <= 69) || index === 71 || \n index === 72 || index === 89 ||\n index === 90 || (index >= 92 && index <= 105) || index === 107 ||\n index === 108 || index === 114 || index === 119 || index === 125 ||\n // (index >= 126 && index <= 130) || index === 132 || index === 134 || index === 135 || index === 137 || (index >= 139 && index <= 143) || took some walls out as ghosts are too stupid\n (index >= 126 && index <= 130) || index === 134 || index === 135 || (index >= 139 && index <= 143) ||\n index === 152 || index === 153 ||\n (index >= 162 && index <= 166) || index === 168 || index === 173 || (index >= 175 && index <= 179) ||\n (index >= 180 && index <= 184) || (index >= 186 && index <= 191) || (index >= 193 && index <= 197) ||\n index === 198 || index === 206 || index === 207 || index === 215 ||\n index === 216 || (index >= 218 && index <= 220) || index === 222 || index === 224 || index === 225 || index === 227 || (index >= 229 && index <= 231) || index === 233 ||\n index === 234 || (index >= 236 && index <= 238) || index === 240 || index === 245 || (index >= 247 && index <= 249) || index === 251 ||\n index === 252 || (index >= 258 && index <= 263) || index === 269 ||\n index === 270 || (index >= 272 && index <= 285) || index === 287 ||\n index === 288 || index === 305 ||\n (index >= 306 && index <= 323)\n ){\n cells[index].classList.add('wall')\n \n //Adding portals\n } else if (index === 144 || index === 161) {\n cells[index].classList.add('portal')\n } else if (index === 109 || index === 52 || index === 271 || index === 244) {\n cells[index].classList.add('specialfood')\n } else { //WALWAY CELLS\n cells[index].classList.add('walkway')\n walkway.push(cells[index])\n\n }\n }) \n\n pacman = ((width * (width - 1) - 2))\n cells[pacman].classList.add('pacman_left')\n\n points = 0\n lives = 3\n liveDIV.innerHTML = `LIVES LEFT : ${lives}`\n ghost1 = 115\n ghost2 = 169\n ghost3 = 118\n ghost4 = 172\n cells[ghost1].classList.add('ghost1')\n cells[ghost2].classList.add('ghost2')\n cells[ghost3].classList.add('ghost3')\n cells[ghost4].classList.add('ghost4')\n\n addFood()\n\n}", "assignNeighbours(){\n\n for (let i = 0; i < this.rows; i++) {\n for (let j = 0; j < this.cols; j++) {\n\n if(this.grid[i][j].isBomb){\n this.grid[i][j].surroundingBombs = -1;\n continue;\n }\n let neighbours = MineSweeper.getNeighbours((i == 0), (i == this.rows-1), (j == 0), (j == this.cols-1));\n\n let counter = 0;\n for(let neighbour of neighbours){\n let dr = neighbour[0];\n let dc = neighbour[1];\n if(this.grid[i+dr][j+dc].isBomb){\n counter++;\n }\n }\n this.grid[i][j].surroundingBombs = counter;\n }\n }\n }", "function treasureIsland(grid) {\n\tlet queue = [];\n\tlet directions = [\n\t\t[-1, 0],\n\t\t[1, 0],\n\t\t[0, 1],\n\t\t[0, -1]\n\t];\n\tlet count = 0;\n\tqueue.push([0, 0]);\n\twhile (queue.length !== 0) {\n\t\tcount++;\n\t\tlet size = queue.length;\n\t\tfor (let i = 0; i < size; i++) {\n\t\t\tlet [startR, startC] = queue.shift();\n\t\t\tfor (let [dr, dc] of directions) {\n\t\t\t\tlet r = startR + dr;\n\t\t\t\tlet c = startC + dc;\n\t\t\t\tif (r >= 0 && r < grid.length && c >= 0 && c < grid[0].length) {\n\t\t\t\t\tif (grid[r][c] === 'X') {\n\t\t\t\t\t\treturn count;\n\t\t\t\t\t}\n\t\t\t\t\tif (grid[r][c] === 'O') {\n\t\t\t\t\t\tgrid[r][c] = 'D'; //make sure not going there again\n\t\t\t\t\t\tqueue.push([r, c]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}", "function step()\r\n{\r\n for (var i = 0; i < this.rows; i++)\r\n {\r\n for (var j = 0; j < this.cols; j++)\r\n {\r\n\r\n var count = this.numNeighbours(i, j);\r\n var living = this.currentGeneration[i][j];\r\n\r\n if (living && count < 2 || living && count > 3)\r\n {\r\n this.nextGeneration[i][j] = false;\r\n }\r\n else if (living && count == 2 || living && count == 3 || !living && count == 3)\r\n {\r\n this.nextGeneration[i][j] = true;\r\n }\r\n }\r\n }\r\n this.currentGeneration = this.nextGeneration.slice();\r\n this.resetNextGeneration();\r\n}", "function moveAllToTop() {\n\tvar moved = false;\n\tfor (var c = 0; c < 4 ; c++ ) {\n\t\tvar s = 0;\n\t\tfor (var r = 0; r < 4 ; r++ ) {\n\t\t\tif (!isCellEmpty(r, c)) {\n\t\t\t\tif (r != s) {\n\t\t\t\t\tmoved = true;\n\t\t\t\t\tsetGridNumRC(s, c, grid[r][c]);\n\t\t\t\t\tsetEmptyCell(r, c);\n\t\t\t\t}\n\t\t\t\ts++;\n\t\t\t}\n\t\t}\n\t}\n\treturn moved;\n}", "function IslandExplorer(Current_x, Current_y){\n // out of bound, return\n if(Current_x < 0 || Current_y < 0 || Current_x >= GRID_ROW_SIZE || Current_y >= GRID_COL_SIZE){\n return\n }\n // explored or not part of an Island, return\n if(Grid[Current_x][Current_y].VisitedAt != -1 || Grid[Current_x][Current_y].State != \"Wall\"){\n return\n }\n // Set visit and explore all 4 neighbours\n Grid[Current_x][Current_y].VisitedAt = 0;\n IslandExplorer(Current_x-1,Current_y)\n IslandExplorer(Current_x+1,Current_y)\n IslandExplorer(Current_x,Current_y-1)\n IslandExplorer(Current_x,Current_y+1)\n return\n\n\n}", "function BestFirstFinder(grid, start, end, heuristics) {\n AStarFinder(grid, start, end, function (x, y) {\n return heuristics(x, y) * 1000000;\n });\n}", "function shipLocation () {\n console.log(ships);\n var countme = 0;\n for (var i = 0; i < 3; i++) {\n countme++;\n var direction = getRandom(2);\n if (direction === 0) {\n var rowStart = getRandom(8 - ships[i][0]);\n var columnStart = getRandom(7);\n for (var j = 0; j < ships[i][0]; j++){\n ships[i][j+1] = String(rowStart + j) + String(columnStart);\n } \n } else {\n var rowStart = getRandom(7);\n var columnStart = getRandom(8 - ships[i][0]);\n for (var j = 0; j < ships[i][0]; j++){\n ships[i][j+1] = String(rowStart) + String(columnStart + j);\n }\n }\n i = matrix(i);\n console.log(\"After the matrix: \" + i);\n if (countme > 10) {\n console.log(\"I had to break!!! \" + countme);\n break;\n }\n if (i === 2){\n for (var i = 0; i < 3; i++){\n ships[i].splice(0,1);\n }\n }\n }\n}", "function start() {\n flag1 = 0;\n flag2 = 0;\n flag3 = 0;\n type = -1;\n\n if (count == 1) {\n aStarSearch(source, dest, grid);\n aStarSearch(source, dest1, grid);\n } else aStarSearch(source, dest, grid);\n}", "function search_start_pos(value) {\n var N = height / $p.config.GRIDY; // target grid N\n\n var y = Infinity,\n y$ = value,\n count = 0;\n\n while (y > 0) {\n y = Math.floor(math.log(y$) * self.A + self.B);\n y$ *= self.$_mult;\n if (count++ > N * 3) return 0; // Prevents deadloops\n }\n\n return y$;\n }", "function generateAIGuess(){\n //target half sunk ships\n for (let i = 0; i<10; i++){\n for (let j=0; j<10; j++){\n if (myArray[i][j]===3){\n let orientation = guessShipOrientation(i,j)\n console.log(orientation)\n //if orientation cannot be assumed yet (only one data point) -> keep checking adjacent cells\n if (typeof guessShipOrientation(i,j) == \"undefined\"){\n let nextGuess = checkAdjacentCells(i,j)\n console.log(nextGuess)\n if (nextGuess != false) return nextGuess;\n }\n //if orientation is known keep checking in that direction until ship fully sunk\n else{\n let nextGuess = checkOrientation(orientation,i,j)\n console.log(nextGuess)\n if (nextGuess != false) return nextGuess;\n }\n } \n }\n }\n //random guess if no open leads\n for (let i=0; i<500; i++){\n let x= Math.floor(Math.random() * 10)\n let y= Math.floor(Math.random() * 10)\n if (myArray[x][y] === 0 || myArray[x][y] == 2){\n //dont return single empty cell surrounded by misses\n if (checkAdjacentCells(x,y) != false) return [x,y]\n } \n }\n \n //if no more posibble random locations, check beside existing ships\n for (let i = 0; i<10; i++){\n for (let j=0; j<10; j++){\n if (myArray[i][j]===3){\n let nextGuess = checkAdjacentCells(i,j)\n if (nextGuess != false) return nextGuess;\n }\n }\n }\n}", "function BFS(){\n clearGridSaveWall()\n resetVisit()\n //setting the startpoint to 0 to initiate the BFS\n Grid[StartPoint[0]][StartPoint[1]].VisitedAt = 0;\n var modifiedThisRound = true\n //the variable that indicates the current round for finding\n var roundIndicator = 0\n var found = false\n\n \n\n\n while(modifiedThisRound == true){\n if(roundIndicator >= (GRID_ROW_SIZE*GRID_COL_SIZE + 1)){\n break\n }\n roundIndicator += 1\n modifiedThisRound = false\n for (let i = 0; i < GRID_ROW_SIZE; i++) { \n if(found){\n break\n }\n for (let j = 0; j < GRID_COL_SIZE; j++) {\n if(Grid[i][j].VisitedAt != -1){\n continue;\n }\n if (Grid[i][j].State == \"Wall\") {\n continue;\n }\n if(i>0){\n if(Grid[i-1][j].VisitedAt == roundIndicator-1){\n modifiedThisRound = true\n Grid[i][j].VisitedAt = roundIndicator\n if(i == EndPoint[0] && j == EndPoint[1]){\n found = true\n break;\n }\n document.getElementById(Grid[i][j].id).innerHTML = \"<div id='explored\"+i+\"x\"+j+\"' class='explored'></div>\"\n document.getElementById(\"explored\"+i+\"x\"+j).style.animationDelay=roundIndicator/5+\"s\"\n \n }\n }\n if(i<GRID_ROW_SIZE-1){\n if(Grid[i+1][j].VisitedAt == roundIndicator-1){\n modifiedThisRound = true\n Grid[i][j].VisitedAt = roundIndicator\n if(i == EndPoint[0] && j == EndPoint[1]){\n found = true\n break;\n }\n document.getElementById(Grid[i][j].id).innerHTML = \"<div id='explored\"+i+\"x\"+j+\"' class='explored'></div>\"\n document.getElementById(\"explored\"+i+\"x\"+j).style.animationDelay=roundIndicator/5+\"s\"\n \n }\n }\n if(j>0){\n if(Grid[i][j-1].VisitedAt == roundIndicator-1){\n modifiedThisRound = true\n Grid[i][j].VisitedAt = roundIndicator\n \n if(i == EndPoint[0] && j == EndPoint[1]){\n found = true\n break;\n }\n document.getElementById(Grid[i][j].id).innerHTML = \"<div id='explored\"+i+\"x\"+j+\"' class='explored'></div>\"\n document.getElementById(\"explored\"+i+\"x\"+j).style.animationDelay=roundIndicator/5+\"s\"\n }\n }\n if(j<GRID_COL_SIZE-1){\n if(Grid[i][j+1].VisitedAt == roundIndicator-1){\n modifiedThisRound = true\n Grid[i][j].VisitedAt = roundIndicator\n if(i == EndPoint[0] && j == EndPoint[1]){\n found = true\n break;\n }\n document.getElementById(Grid[i][j].id).innerHTML = \"<div id='explored\"+i+\"x\"+j+\"' class='explored'></div>\"\n document.getElementById(\"explored\"+i+\"x\"+j).style.animationDelay=roundIndicator/5+\"s\"\n \n }\n }\n\n\n\n }\n }\n\n\n }\n /// end of the search, return path or not found\n\n if(!found){\n console.log(\"End of search, not found\")\n alert(\"No possible route found\")\n return\n }\n console.log(\"Found at round: \" + roundIndicator)\n\n\n var counter = 0\n var myInterval = setInterval(() => {\n if(counter < 1000*roundIndicator/5){\n counter+= 100\n }\n else{\n pathGatherer()\n clearInterval(myInterval)\n }\n }, 100);\n\n\n\n}", "function generation() {\n\t//An array such that numberArray[y][x] is the number of live neighbors gridArray[y][x] has.\n\tvar numberArray = [];\n\tvar neighbors;\n\tfor (var i = 0; i < height; i++) {\n\t\tnumberArray.push([]);\n\t\tfor (var j = 0; j < width; j++) {\n\t\t\tnumberArray[i][j] = 0;\n\t\t}\n\t}\n\tvar cells = getNeighbors(liveCells);\n\tfor (var p = 0; p < cells.length; p++) {\n\t\tneighbors = 0;\n\t\t// Possible x's and possible y's. 3 * 3 = 9, minus i,j, the cell itself, gives you its 8 possible neighbors.\n\t\tyPoss = [cells[p][0] - 1, cells[p][0], cells[p][0] + 1];\n\t\txPoss = [cells[p][1] - 1, cells[p][1], cells[p][1] + 1];\n\t\t// Iterate through xPoss and yPoss.\n\t\tfor (var y = 0; y < 3; y++) {\n\t\t\tfor (var x = 0; x < 3; x++) {\n\t\t\t\t// Make sure it's not (i,j), the cell itself.\n\t\t\t\tif (!(x === 1 && y === 1)) {\n\t\t\t\t\t// Surrounded in try catch so it doesn't throw a fit if it goes off the edge. This one doesn't wrap around the sides.\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (gridArray[yPoss[y]][xPoss[x]] === 1) {\n\t\t\t\t\t\t\tneighbors++;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (err) {}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Set numberArray spot that corresponds to gridArray spot to the amount of neighbors.\n\t\tnumberArray[cells[p][0]][cells[p][1]] = neighbors;\n\t\t// console.log(cells[p][1], cells[p][0], \"has \", neighbors, \"neighbors\");\n\t}\n\t\t// Look at every cell and see if it should be alive or dead.\n\t\tfor (var i = 0; i < numberArray.length; i++) {\n\t\t\tfor (var j = 0; j < numberArray[i].length; j++) {\n\t\t\t\tif (numberArray[i][j] === 3) {\n\t\t\t\t\tgridArray[i][j] = 1;\n\t\t\t\t\tif (liveCells.myIndexOf([i, j]) == -1) {\n\t\t\t\t\t\tliveCells.push([i, j]);\n\t\t\t\t\t}\n\t\t\t\t} else if (numberArray[i][j] < 2) {\n\t\t\t\t\tgridArray[i][j] = 0;\n\t\t\t\t\tif (liveCells.myIndexOf([i, j]) != -1) {\n\t\t\t\t\t\tliveCells.splice(liveCells.myIndexOf([i, j]), 1);\n\t\t\t\t\t}\n\t\t\t\t} else if (numberArray[i][j] > 3) {\n\t\t\t\t\tgridArray[i][j] = 0;\n\t\t\t\t\tif (liveCells.myIndexOf([j, i]) != -1) {\n\t\t\t\t\t\tliveCells.splice(liveCells.myIndexOf([i, j]), 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// We've set up gridArray to be the next generation, now we just need to show the user, which is what arrayToHtml() does.\n\t\tarrayToHtml();\n\t\tif ([].concat.apply([], gridArray).indexOf(1) === -1) {\n\t\t\t$(\"#pause\").mousedown()\n\t\t\t.mouseup();\n\t\t}\n\t}", "function bestComputerMove (grid, depth) {\n var sonTag;\n var weightMove;\n\n var bestMove = NB_ROW;\n var weightBestMove = -9999999;\n\n var lessWorstMove = NB_ROW;\n var weightLessWorstMove = -9999999;\n\n var sonGrid = createGrid();\n\n for(var row = 0; row <NB_ROW; row++){\n \n sonGrid = copyGrid(grid);\n if(canDropToken(sonGrid, row)){\n\n \t// Let's try this row\n sonGrid = dropToken(sonGrid, row, COMPUTER);\n sonTag = tag(sonGrid, PLAYER, depth);\n\n // Are we sure to win in this row ? \n if(sonTag === COMPUTER) {\n return row;\n }\n\n // Otherwise, lets compute the weight of this move\n weightMove = estimateGrid(sonGrid);\n\n // If nobody is sure to win, we keep the move with the higher weight\n if(sonTag === NOBODY){\n if(weightMove > weightBestMove){\n weightBestMove = weightMove;\n bestMove = row;\n } \n }\n\n // If human player is sure to win within \"depth\" move\n else {\n if(weightMove > weightLessWorstMove) {\n weightLessWorstMove = weightMove;\n lessWorstMove = row;\n }\n }\n\n }\n\n }\n\n // Return the best or less worth move.\n if(bestMove < NB_ROW){\n return bestMove;\n } else {\n return lessWorstMove;\n }\n}", "initGrid() {\n const columns = Math.floor((this.limits.right - this.limits.left) / this.options.gridStep) + 1;\n const rows = Math.floor((this.limits.bottom - this.limits.top) / this.options.gridStep) + 1;\n\n const grow = !this.grid || columns > this.grid.length || rows > this.grid[0].length;\n\n if (grow) {\n this.grid = new Array(columns);\n }\n\n for (let col = 0, x = this.limits.left; col < columns; col ++, x += this.options.gridStep) {\n if (grow) {\n this.grid[col] = new Array(rows);\n }\n\n for (let row = 0, y = this.limits.top; row < rows; row ++, y += this.options.gridStep) {\n // If the current grid node is inside an obstacle,\n // set the \"obstacle\" property of the node.\n const obstacle = this.obstacles.some(\n r => x >= r.left && x <= r.right &&\n y >= r.top && y <= r.bottom\n );\n\n this.grid[col][row] = {\n col, row, // The coordinates of this node in the grid array\n x, y, // The coordinates of this node in the exploration area\n obstacle, // Is there an obstacle at this node?\n\n // The following properties are updated by the pathfinding algorithm\n\n g: 0, // Cost from the start node to this node (g score)\n f: 0, // Estimated cost from the start node\n // to the goal node through this node (f score)\n parent: null, // The previous node in the current explored path\n open: false, // Does this node belong to the open set?\n closed: false, // Has this node already been processed?\n groupCount: 0, // The number of groups passing by this node\n groups: {} // A map of booleans indicating which groups pass by this node\n };\n }\n }\n }", "function nextGenerationGrid(cells) {\n const r = cells.length;\n const c = cells[0].length;\n\n const nextGeneration = cells.map(function(row, i) {\n return row.map(function(cell, j) {\n const n1 = (i == 0 || j == 0 ? 0 : cells[i-1][j-1]);\n const n2 = (i == 0 ? 0 : cells[i-1][j]);\n const n3 = (i == 0 || j == c-1 ? 0 : cells[i-1][j+1]);\n const n4 = (j == 0 ? 0 : cells[i][j-1]);\n const n5 = (j == c-1 ? 0 : cells[i][j+1]);\n const n6 = (i == r-1 || j == 0 ? 0 : cells[i+1][j-1]);\n const n7 = (i == r-1 ? 0 : cells[i+1][j]);\n const n8 = (i == r-1 || j == c-1 ? 0 : cells[i+1][j+1]);\n const n = n1 + n2 + n3 + n4 + n5 + n6 + n7 + n8;\n\n if (n == 3 || (n == 2 && cells[i][j] == 1)) {\n return 1; // alive\n }\n return 0; // dead\n });\n });\n\n return nextGeneration;\n}", "function GenerateTileNeighbours()\n{\n // loop through each tile on the map\n var currentX = 0;\n var currentY = 0;\n\n // since the highest x values can really only be gridheight/width -1, make these the highest tiles we check\n var maxX = (gridHeight - 1);\n var maxY = (gridHeight - 1);\n\n for(currentX = 0; currentX < gridWidth; currentX++)\n {\n for (currentY = 0; currentY < gridHeight; currentY++)\n {\n\n var CurrentTile = Tiles[currentX][currentY];\n // first, if this is a wall tile, we don't care, as we can't generate paths through here, so don't add it to the nodes\n if (!(CurrentTile.TileType == TilesNames.Wall))\n {\n // check each of the tiles neighbours, if it's a valid tile\n if (CurrentTile.x != 0)\n {\n // check the tile to the left of it\n if (IsValidTile(CurrentTile.x - 1, CurrentTile.y))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x - 1][CurrentTile.y]);\n }\n }\n \n if (CurrentTile.x != maxX)\n {\n // check the tile to the right of it\n if (IsValidTile(CurrentTile.x + 1, CurrentTile.y))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x + 1][ CurrentTile.y]);\n }\n }\n\n if (CurrentTile.y != 0)\n {\n // check the tile to the top of it\n if (IsValidTile(CurrentTile.x, CurrentTile.y - 1))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x][CurrentTile.y - 1]);\n }\n }\n\n if (CurrentTile.y != maxY)\n {\n // check the tile below it\n if (IsValidTile(CurrentTile.x, CurrentTile.y + 1))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x][CurrentTile.y + 1]);\n }\n }\n\n }\n }\n\n }\n \n}", "function check_block() {\n var moved = false;\n reset_counts();\n check_counts(\"X\");\n\n if (countdiag1 == 2 && !moved) {\n for (i = 0; i < 3; i++) {\n moved = take_space(i * 3 + i);\n }\n }\n if (countdiag2 == 2 && !moved) {\n for (i = 0; i < 3; i++) {\n moved = take_space(i * 2 + 2);\n }\n }\n if (countrow0 == 2) {\n for (i = 0; i < 3; i++) {\n moved = take_space(i);\n }\n }\n if (countrow1 == 2 && !moved) {\n for (i = 0; i < 3; i++) {\n moved = take_space(3 + i);\n }\n }\n if (countrow2 == 2 && !moved) {\n for (i = 0; i < 3; i++) {\n moved = take_space(6 + i);\n }\n }\n if (countcol0 == 2 && !moved) {\n for (i = 0; i < 3; i++) {\n moved = take_space(i * 3);\n }\n }\n if (countcol1 == 2 && !moved) {\n for (i = 0; i < 3; i++) {\n moved = take_space(i * 3 + 1);\n }\n }\n if (countcol2 == 2 && !moved) {\n for (i = 0; i < 3; i++) {\n moved = take_space(i * 3 + 2);\n }\n }\n return moved;\n}", "function nextGeneration() {\n let newGrid = new Array(rows);\n for (let i = 0; i < rows; i++) {\n newGrid[i] = new Array(cols);\n for (let j = 0; j < cols; j++) {\n let neighbors = countNeighbors(i, j);\n if (grid[i][j] === 1) {\n if (neighbors < 2 || neighbors > 3) {\n newGrid[i][j] = 0;\n } else {\n newGrid[i][j] = 1;\n }\n } else {\n if (neighbors === 3) {\n newGrid[i][j] = 1;\n } else {\n newGrid[i][j] = 0;\n }\n }\n }\n }\n grid = newGrid;\n}", "findShip(row, col) {\n const neighborCell = getNeighbourCells(row, col).find(([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.classList.contains('ship')\n );\n\n const isHorizontal = neighborCell?.[0] === row;\n const shipStart = Array.from({ length: Math.max(rows, cols) }, (_, index) =>\n isHorizontal ? [row, col - index] : [row - index, col]\n ).find(\n ([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.classList.contains('ship') !==\n true\n );\n const shipEnd = Array.from({ length: Math.max(rows, cols) }, (_, index) =>\n isHorizontal ? [row, col + index] : [row + index, col]\n ).find(\n ([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.classList.contains('ship') !==\n true\n );\n\n const horizontalIndex = isHorizontal ? 1 : 0;\n const ship = Array.from(\n { length: shipEnd[horizontalIndex] - shipStart[horizontalIndex] + 1 },\n (_, index) =>\n isHorizontal ? [row, shipStart[1] + index] : [shipStart[0] + index, col]\n );\n const trimmedShip = ship.slice(1, -1);\n\n const largestShip =\n this.fleet.ships.length -\n Array.from(this.fleet.ships)\n .reverse()\n .findIndex((ship) => !ship.disabled);\n\n let canAddBorder = trimmedShip.length === largestShip;\n if (typeof neighborCell === 'undefined')\n canAddBorder ||= getNeighbourCells(row, col).every(\n ([row, col]) =>\n this.opponentBoard.cells[row]?.[col]?.children[0].disabled !== false\n );\n else\n canAddBorder ||=\n this.opponentBoard.cells[shipStart[0]]?.[shipStart[1]]?.children[0]\n .disabled !== false &&\n this.opponentBoard.cells[shipEnd[0]]?.[shipEnd[1]]?.children[0]\n .disabled !== false;\n return ship;\n }", "function solve(){\n var grid = cGrid;\n var point = {\n row: 0,\n col: 0\n };\n stepCount = 0; //resetStep\n exitRow = grid.length-1;\n var minDistance = -1;\n\n //2. Walk through grid, loop each step\n do{\n let nextSteps = [];\n let step = {};\n\n for( var direct in directions){\n step = movable(point, grid, direct);\n if(step.canMove){\n step.direction = direct;\n nextSteps.push(step);\n }\n }\n \n //If no direction walkable, exit\n if(nextSteps.length == 0){\n noExit = true;\n break;\n }\n\n //3. sort distance and take the shortest direction\n nextSteps.sort((a, b) => (a.minDistance - b.minDistance));\n\n //mark current step and make the move\n point = markElement(point, grid, nextSteps);\n\n //5. test exit condition\n if (point.row == exitRow && point.col == exitCol){\n exitReached = true;\n grid[exitRow][exitCol] = colValues.PATH;\n document.getElementById(`${exitRow}:${exitCol}`).setAttribute(\"blockValue\", \"step\");\n stepCount ++;\n break;\n }\n } while(true);\n\n writeResults();\n}", "function killShipCells()\n{\n // Check which direction the player ship is to be facing and place it there.\n if (playerShipDev.dirSpaceship === \"right\") {\n // Load the pixels of spaceship to draw\n var value = \"playerRight.png\";\n var pixels = patternsDev[value];\n\n // OBTAIN THE LOCATION TO PLACE THE SHIP AT\n var xPosition = playerShipDev.xSpaceship;\n var yPosition = playerShipDev.ySpaceship;\n\n // GO THROUGH ALL THE PIXELS IN THE PATTERN AND PUT THEM IN THE GRID\n for (var i = 0; i < pixels.length; i += 2) {\n var col = xPosition + pixels[i];\n var row = yPosition + pixels[i + 1];\n var cell = getGridCellDev(updatePlayerGridDev, row, col);\n if(cell < TELEPORTER_BASE_VAL_DEV.charCodeAt(0) && cell !== KEY_CELL_DEV){\n setGridCellDev(renderPlayerGridDev, row, col, DEAD_CELL_DEV);\n setGridCellDev(updatePlayerGridDev, row, col, DEAD_CELL_DEV);\n }\n }\n } else if (playerShipDev.dirSpaceship === \"down\") {\n // Load the pixels of spaceship to draw\n var value = \"playerDown.png\";\n var pixels = patternsDev[value];\n\n // OBTAIN THE LOCATION TO PLACE THE SHIP AT\n var xPosition = playerShipDev.xSpaceship;\n var yPosition = playerShipDev.ySpaceship;\n\n // GO THROUGH ALL THE PIXELS IN THE PATTERN AND PUT THEM IN THE GRID\n for (var i = 0; i < pixels.length; i += 2) {\n var col = xPosition + pixels[i];\n var row = yPosition + pixels[i + 1];\n var cell = getGridCellDev(updatePlayerGridDev, row, col);\n if(cell < TELEPORTER_BASE_VAL_DEV.charCodeAt(0) && cell !== KEY_CELL_DEV){\n setGridCellDev(renderPlayerGridDev, row, col, DEAD_CELL_DEV);\n setGridCellDev(updatePlayerGridDev, row, col, DEAD_CELL_DEV);\n }\n }\n } else if (playerShipDev.dirSpaceship === \"left\") {\n // Load the pixels of spaceship to draw\n var value = \"playerLeft.png\";\n var pixels = patternsDev[value];\n\n // OBTAIN THE LOCATION TO PLACE THE SHIP AT\n var xPosition = playerShipDev.xSpaceship;\n var yPosition = playerShipDev.ySpaceship;\n\n // GO THROUGH ALL THE PIXELS IN THE PATTERN AND PUT THEM IN THE GRID\n for (var i = 0; i < pixels.length; i += 2) {\n var col = xPosition + pixels[i];\n var row = yPosition + pixels[i + 1];\n var cell = getGridCellDev(updatePlayerGridDev, row, col);\n if(cell < TELEPORTER_BASE_VAL_DEV.charCodeAt(0) && cell !== KEY_CELL_DEV){\n setGridCellDev(renderPlayerGridDev, row, col, DEAD_CELL_DEV);\n setGridCellDev(updatePlayerGridDev, row, col, DEAD_CELL_DEV);\n }\n }\n } else if (playerShipDev.dirSpaceship === \"up\") {\n // Load the pixels of spaceship to draw\n var value = \"playerUp.png\";\n var pixels = patternsDev[value];\n\n // OBTAIN THE LOCATION TO PLACE THE SHIP AT\n var xPosition = playerShipDev.xSpaceship;\n var yPosition = playerShipDev.ySpaceship;\n\n // GO THROUGH ALL THE PIXELS IN THE PATTERN AND PUT THEM IN THE GRID\n for (var i = 0; i < pixels.length; i += 2) {\n var col = xPosition + pixels[i];\n var row = yPosition + pixels[i + 1];\n var cell = getGridCellDev(updatePlayerGridDev, row, col);\n if(cell < TELEPORTER_BASE_VAL_DEV.charCodeAt(0) && cell !== KEY_CELL_DEV){\n setGridCellDev(renderPlayerGridDev, row, col, DEAD_CELL_DEV);\n setGridCellDev(updatePlayerGridDev, row, col, DEAD_CELL_DEV);\n }\n }\n }\n}", "generateNeighbours(grid) {\r\n //Right neighbour\r\n if (this.x < cols - 1) {\r\n this.neighbours.push(grid[this.x + 1][this.y]);\r\n }\r\n //Left neighbour\r\n if (this.x > 0) {\r\n this.neighbours.push(grid[this.x - 1][this.y]);\r\n }\r\n //Bottom neighbour\r\n if (this.y < rows - 1) {\r\n this.neighbours.push(grid[this.x][this.y + 1]);\r\n }\r\n //Top neighbour\r\n if (this.y > 0) {\r\n this.neighbours.push(grid[this.x][this.y - 1]);\r\n }\r\n }", "function _calculateGrid() {\n\tvar i = $game.VIEWPORT_WIDTH;\n\twhile(--i >= 0) {\n\t\tvar j = $game.VIEWPORT_HEIGHT;\n\t\twhile(--j >= 0) {\n\t\t\tvar dist = _distFromCharger({x:i,y:j});\n\t\t\t_grid[i][j].distance = dist;\n\t\t\t_grid[i][j].charger = -1;\n\t\t}\n\t}\n}", "function initLogicalMaze()\n {\n //This function is hard-coded for a fixed maze of length 23 across and down.\n // I will manually make rows 0-11. Rows 12-22 will be a mirror image of rows 0-10.\n\n // Note by default each square is already a GRID_BLANK due to initGrid()\n\n //row 0\n for(var i = 0; i < GRIDSIZE; i++)\n {\n GRID[i][0] = GRID_WALL;\n }\n\n //row 1\n GRID[0][1] = GRID_WALL;\n GRID[1][1] = GRID_PORTAL;\n GRID[4][1] = GRID_WALL;\n GRID[10][1] = GRID_WALL;\n GRID[12][1] = GRID_WALL;\n GRID[21][1] = GRID_PORTAL;\n GRID[22][1] = GRID_WALL;\n\n //row 2\n GRID[0][2] = GRID_WALL;\n GRID[2][2] = GRID_WALL;\n\n for(i = 6; i <= 22; i += 2)\n {\n GRID[i][2] = GRID_WALL;\n }\n\n //row 3\n GRID[0][3] = GRID_WALL;\n GRID[2][3] = GRID_WALL;\n GRID[3][3] = GRID_WALL;\n GRID[5][3] = GRID_WALL;\n GRID[6][3] = GRID_WALL;\n GRID[8][3] = GRID_WALL;\n GRID[9][3] = GRID_WALL;\n for(i = 10; i <= 22; i += 2)\n {\n GRID[i][3] = GRID_WALL;\n }\n\n //row 4\n GRID[0][4] = GRID_WALL;\n GRID[5][4] = GRID_WALL;\n GRID[8][4] = GRID_WALL;\n GRID[22][4] = GRID_WALL;\n\n //row 5\n GRID[0][5] = GRID_WALL;\n GRID[1][5] = GRID_WALL;\n GRID[3][5] = GRID_WALL;\n GRID[5][5] = GRID_WALL;\n GRID[7][5] = GRID_WALL;\n GRID[8][5] = GRID_WALL;\n for(i = 10; i <= 16; i++)\n {\n GRID[i][5] = GRID_WALL;\n }\n GRID[17][5] = GRID_HEALTH_PICKUP;\n GRID[18][5] = GRID_WALL;\n GRID[19][5] = GRID_WALL;\n GRID[20][5] = GRID_WALL;\n GRID[22][5] = GRID_WALL;\n\n //row 6\n GRID[0][6] = GRID_WALL;\n GRID[3][6] = GRID_WALL;\n GRID[5][6] = GRID_WALL;\n GRID[10][6] = GRID_WALL;\n GRID[14][6] = GRID_WALL;\n GRID[16][6] = GRID_WALL;\n GRID[17][6] = GRID_WALL;\n GRID[18][6] = GRID_WALL;\n GRID[22][6] = GRID_WALL;\n\n //row 7\n GRID[0][7] = GRID_WALL;\n GRID[2][7] = GRID_WALL;\n GRID[3][7] = GRID_WALL;\n GRID[7][7] = GRID_WALL;\n GRID[9][7] = GRID_WALL;\n GRID[10][7] = GRID_WALL;\n GRID[12][7] = GRID_WALL;\n GRID[14][7] = GRID_WALL;\n GRID[18][7] = GRID_WALL;\n GRID[19][7] = GRID_DAMAGE_PICKUP;\n GRID[20][7] = GRID_WALL;\n GRID[22][7] = GRID_WALL;\n\n //row 8\n GRID[0][8] = GRID_WALL;\n GRID[2][8] = GRID_DAMAGE_PICKUP;\n GRID[3][8] = GRID_WALL;\n GRID[4][8] = GRID_WALL;\n GRID[5][8] = GRID_WALL;\n GRID[7][8] = GRID_WALL;\n GRID[12][8] = GRID_WALL;\n GRID[14][8] = GRID_WALL;\n GRID[16][8] = GRID_WALL;\n GRID[18][8] = GRID_WALL;\n GRID[19][8] = GRID_WALL;\n GRID[20][8] = GRID_WALL;\n GRID[22][8] = GRID_WALL;\n\n //row 9\n GRID[0][9] = GRID_WALL;\n GRID[2][9] = GRID_WALL;\n GRID[4][9] = GRID_HEALTH_PICKUP;\n GRID[5][9] = GRID_WALL;\n for(i = 7; i <= 10; i++)\n {\n GRID[i][9] = GRID_WALL;\n }\n GRID[12][9] = GRID_WALL;\n GRID[16][9] = GRID_WALL;\n GRID[22][9] = GRID_WALL;\n\n //row 10\n GRID[0][10] = GRID_WALL;\n GRID[4][10] = GRID_WALL;\n GRID[8][10] = GRID_WALL;\n GRID[10][10] = GRID_WALL;\n GRID[12][10] = GRID_WALL;\n GRID[13][10] = GRID_WALL;\n GRID[15][10] = GRID_WALL;\n GRID[17][10] = GRID_WALL;\n GRID[18][10] = GRID_WALL;\n GRID[20][10] = GRID_WALL;\n GRID[21][10] = GRID_WALL;\n GRID[22][10] = GRID_WALL;\n\n //row 11. This is the middle row (it will not be mirrored, only 0-10 will be mirrored)\n for(var i = 0; i <= 3; i++)\n {\n GRID[i][11] = GRID_WALL;\n }\n GRID[4][11] = GRID_PORTAL;\n GRID[6][11] = GRID_WALL;\n GRID[22][11] = GRID_WALL;\n\n //mirror the remaining rows.\n var jOld = 10;\n for(var jNew = 12; jNew < GRIDSIZE; jNew++)\n {\n for(i = 0; i < GRIDSIZE; i++)\n {\n GRID[i][jNew] = GRID[i][jOld];\n }\n jOld--;\n }\n\n }", "function find_landing_square(column_dropped_on) {\n//For loop. If dropped in square 1, the loop id going to start at 36 and its\n//going to loop backwards, subtracting 7 each time. It's looping backwards.\n//We iterate backwards and minus 7 each time.\n\t\tfor (i = column_dropped_on + 35; i >= column_dropped_on; i -= 7) {\n\t\t\tvar dropped_square = $('#' + i); //this is document.getElementByID in jQuery. We are getting a hold of that div it was dropped on.\n\t\t\tvar dropped_square_num = dropped_square.attr('id'); //this is an object. It's returning the div. We are getting the number (the divs ID).\n\n\t\t\t//If the dropped_square square has the class of 'can_place'\n\t\t\t//(this will be true), we return the array back which includes the\n\t\t\t//distance from top to 6 (how far it has to go down), and the\n\t\t\t//dropped_square square number.\n\t\t\tif (dropped_square.hasClass('can_place')) {\n\t\t\t\tif (dropped_square_num > 35) {\n\t\t\t\t\treturn ['503px', dropped_square_num];\n\t\t\t\t} else if (dropped_square_num > 28) {\n\t\t\t\t\treturn ['419px', dropped_square_num];\n\t\t\t\t} else if (dropped_square_num > 21) {\n\t\t\t\t\treturn ['335px', dropped_square_num];\n\t\t\t\t} else if (dropped_square_num > 14) {\n\t\t\t\t\treturn ['251px', dropped_square_num];\n\t\t\t\t} else if (dropped_square_num > 7) {\n\t\t\t\t\treturn ['167px', dropped_square_num];\n\t\t\t\t} else {\n\t\t\t\t\treturn ['83px', dropped_square_num];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function tresureIsland2(grid) {\n\tif (grid == null || grid.length === 0) return false;\n\n\tlet queueStart = []; //all start points\n\tconst ROW = grid.length;\n\tconst directions = [\n\t\t[-1, 0],\n\t\t[1, 0],\n\t\t[0, 1],\n\t\t[0, -1]\n\t];\n\n\tlet min = 0;\n\n\t//fill queue with all starts\n\tgrid.forEach((row, r) => {\n\t\trow.forEach((col, c) => {\n\t\t\tif (grid[r][c] === 'S') {\n\t\t\t\tqueueStart.push([r, c]);\n\t\t\t}\n\t\t});\n\t});\n\n\twhile (queueStart.length) {\n\t\tmin++;\n\t\tlet len = queueStart.length;\n\t\tfor (let i = 0; i < len; i++) {\n\t\t\tlet [sr, sc] = queueStart.shift();\n\t\t\tfor (let [dr, dc] of directions) {\n\t\t\t\tlet r = sr + dr;\n\t\t\t\tlet c = sc + dc;\n\t\t\t\tif (r >= 0 && r < ROW && c >= 0 && c < grid[r].length) {\n\t\t\t\t\tif (grid[r][c] === 'X') {\n\t\t\t\t\t\treturn min;\n\t\t\t\t\t}\n\t\t\t\t\tif (grid[r][c] === 'O') {\n\t\t\t\t\t\tgrid[r][c] = 'D';\n\t\t\t\t\t\tqueueStart.push([r, c]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}", "function findReachableTiles(x, y, range, isMoving) {\n var q = [];\n var start = [x, y, 0];\n var marked = [];\n marked.push(x * mapWidth + y);\n q.push(start);\n\n // Breadth first search to find all possible destinations\n while (q.length > 0) {\n\n pair = q.splice(0, 1)[0];\n // console.log(pair[0] + \" \" + pair[1]);\n\n // Move range check\n if (pair[2] >= range) continue;\n\n // Enumerate all possible moves\n for (dx = -1; dx <= 1; dx++) {\n for (dy = -1; dy <= 1; dy++) {\n\n // Make sure only vertical or horizontal moves\n if (dx != 0 && dy != 0) continue;\n\n var nx = pair[0] + dx;\n var ny = pair[1] + dy;\n var d = pair[2] + 1;\n\n // Bounds check\n if (nx < 0 || nx >= mapHeight || ny < 0 || ny >= mapWidth) continue;\n\n // Terrain check\n if (selectedCharacter.skill_no != 6 && blockMaps[nx][ny] != 0 && isMoving) continue;\n\n // bounds and obstacle check here\n if ($.inArray(nx * mapWidth + ny, marked) === -1) {\n marked.push(nx * mapWidth + ny);\n q.push([nx, ny, d]);\n }\n \n }\n } \n \n }\n\n $.each(marked, function(i, coord) {\n var x = Math.floor(coord / mapWidth);\n var y = coord % mapWidth;\n marked[i] = [x, y];\n //console.log(marked[i]);\n });\n return marked;\n}", "function findNeighbours(r, c, t){\r\n\r\n // note that tile7 is also a valid tile to form a combination, since its the rainbow tile. thats why it pops up in adjacent checks like here below\r\n\r\n // right\r\n if(c + 1 < levelArray[r].length && (levelArray[r][c + 1]._animation.name == t || levelArray[r][c+1]._animation.name == 'tile7') && levelArray[r][c + 1].checked == false) { // if the given value c+1 is smaller than the length of the current r(ow), and on that c+1 position a tile is matching the given one\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);} // first add the original tile that was used for comparing to the array (irst check to see if it isnt in there already)\r\n if(!findIn2dArray([r, c + 1, t],resultArray)){resultArray.push([r, c + 1, t]);} // then add the newly found tile to it (first check to see if it isnt in there already)\r\n levelArray[r][c].checked = true; // without this, the routine would keep pingponging between 2 tiles, since they keep matching with each other\r\n findNeighbours(r, c + 1, t); // call the function from itself (recursion) to find new matching tiles and keep adding those to the array aswell\r\n }\r\n\r\n // left\r\n if(c - 1 >= 0 && (levelArray[r][c - 1]._animation.name == t || levelArray[r][c - 1]._animation.name == 'tile7') && levelArray[r][c - 1].checked == false) {\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);}\r\n if(!findIn2dArray([r, c - 1, t],resultArray)){resultArray.push([r, c - 1, t]);}\r\n levelArray[r][c].checked = true;\r\n findNeighbours(r, c - 1, t);\r\n }\r\n\r\n // above\r\n if(r - 1 >= 0 && (levelArray[r - 1][c]._animation.name == t || levelArray[r - 1][c]._animation.name == 'tile7') && levelArray[r - 1][c].checked == false) {\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);}\r\n if(!findIn2dArray([r - 1, c, t],resultArray)){resultArray.push([r - 1, c, t]);}\r\n levelArray[r][c].checked = true;\r\n findNeighbours(r - 1, c, t);\r\n }\r\n\r\n // below\r\n if(r + 1 < levelArray.length && (levelArray[r + 1][c]._animation.name == t || levelArray[r + 1][c]._animation.name == 'tile7') && levelArray[r + 1][c].checked == false) {\r\n if(!findIn2dArray([r, c, t],resultArray)){resultArray.push([r, c, t]);}\r\n if(!findIn2dArray([r + 1, c, t],resultArray)){resultArray.push([r + 1, c, t]);}\r\n levelArray[r][c].checked = true;\r\n findNeighbours(r + 1, c, t);\r\n }\r\n\r\n}", "function northeast(n) {\n var level = bottoms[n];\n var count = 0;\n\n for (var i = 1; ((n + i) <= 6) && ((level - i) >= 0); i++) {\n var square = document.getElementsByClassName(\"row\").item(level - i)\n .getElementsByClassName(\"bigSquare\").item(n + i);\n if (square.style.backgroundColor == color(currentTurn)) {\n count++;\n }\n else return count;\n }\n return count;\n }", "function find_leftmost_column(instance, squares_pos) {\r\n\tlet current_vertex = 0;\r\n\tlet initial_depth = 0;\r\n\tlet current_depth = 0;\r\n\tlet final_leftmost = false;\r\n\t\r\n\tlet leftmost_column = new Array();\r\n\twhile(!final_leftmost) /* cycle to find the leftmost column */ {\r\n\t\tleftmost_column = new Array();\r\n\t\tinitial_depth = current_depth;\r\n\r\n\t\twhile(true) /* cycle to fill te sequence */ {\r\n\t\t\tleftmost_column.push(current_vertex);\r\n\t\t\tlet neighbours = instance.get_neighbours(current_vertex);\r\n\r\n\t\t\tif(neighbours.length == 0) {\r\n\t\t\t\t// This can only happen if the FIRST vertex evaluated (usually 0)\r\n\t\t\t\t// is an isolated vertex. In that case we move onto the next one.\r\n\t\t\t\t++current_vertex;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tif(neighbours[neighbours.length-1] <= current_vertex + 1) {\r\n\t\t\t\t// If highest neighbour is lower or the next one\r\n\t\t\t\t// Then this is the last of the sequence\r\n\t\t\t\t// There is a problem: It's assumed that the next vertex (n+1) is\r\n\t\t\t\t// not below the current (n). If it were, it would be part of the\r\n\t\t\t\t// leftmost column as well.\r\n\t\t\t\tfinal_leftmost = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tcurrent_vertex = neighbours[neighbours.length-1];\r\n\t\t\t// new current_vertex is the highest neighbour of old current_vertex\r\n\r\n\t\t\t++current_depth;\r\n\t\t\tif(instance.get_neighbours(current_vertex).indexOf(current_vertex-1) != -1) {\r\n\t\t\t\t// If the vertex we were adding is connected to its immediate precedent\r\n\t\t\t\t// Then this is not the leftmost column.\r\n\t\t\t\t--current_vertex;\r\n\t\t\t\t// This is the lowest vertex on the new supposedly leftmost column\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tfor(let i = 0; i < leftmost_column.length; ++i) {\r\n\t\tsquares_pos[leftmost_column[i]].x = 0;\r\n\t\tsquares_pos[leftmost_column[i]].y = initial_depth + i;\r\n\t}\r\n\r\n\treturn leftmost_column;\r\n}", "determineDrawGrid() {\n\n\t\tfor(let i = 0; i < this.w; i++) { // x\n\t\t\tlet horizontal = false;\n\t\t\tif(i == 0 || i == (this.w - 1)) horizontal = true; // determine if voxel is on the left or right edge of the terrain\n\t\t\tfor(let j = 0; j < this.h; j++) {\n\t\t\t\tlet vertical = false;\n\t\t\t\tif(j == 0 || j == (this.h - 1)) vertical = true; // determine if voxel is on the upper or lower edge of the terrain\n\t\t\t\tfor(let k = 0; k < this.voxelGrid[i][j]; k++) {\n\t\t\t\t\tif(horizontal || vertical) { // if voxel is on an edge\n\t\t\t\t\t\tthis.drawGrid[i][j][k] = true; // draw it\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t// if voxel is not on an edge, check if the surrounding voxel stacks are taller\n\t\t\t\t\t// if yes, then don't draw it (because it's not visible anyway)\n\t\t\t\t\tif((this.voxelGrid[i-1][j] > k) &&\n\t\t\t\t\t (this.voxelGrid[i+1][j] > k) &&\n\t\t\t\t\t (this.voxelGrid[i][j-1] > k) &&\n\t\t\t\t\t (this.voxelGrid[i][j+1] > k)) {\n\t\t\t\t\t\tthis.drawGrid[i][j][k] = false;\n\t\t\t\t\t} else this.drawGrid[i][j][k] = true;\n\t\t\t\t}\n\n\t\t\t\t// always draw the top voxel of a stack\n\t\t\t\tthis.drawGrid[i][j][this.voxelGrid[i][j] - 1] = true;\n\t\t\t}\n\t\t}\n\t}", "mutateToBest() {\r\n const a = this.makeBoard();\r\n const takeAway = num => {\r\n let [i, j] = this.placing[num].place;\r\n const [di, dj] = this.placing[num].dir;\r\n for (let c of num) {\r\n a[i][j].splice(a[i][j].indexOf(c), 1);\r\n i += di;\r\n j += dj;\r\n }\r\n };\r\n const putTo = (num, place) => {\r\n let [i, j] = place.place;\r\n const [di, dj] = place.dir;\r\n for (let c of num) {\r\n if (a[i][j]===null) a[i][j] = [];\r\n a[i][j].push(c);\r\n i += di;\r\n j += dj;\r\n }\r\n };\r\n const countScore = (num, i0, j0, d) => {\r\n let s = 0;\r\n let i = i0;\r\n let j = j0;\r\n const [di, dj] = d;\r\n for (let c of num) {\r\n if (a[i][j]!==null && a[i][j].some(x=>x!==c)) s+= 1;\r\n i += di;\r\n j += dj;\r\n }\r\n return s;\r\n };\r\n const findBestPlace = num => {\r\n let numLen = num.length;\r\n let bestScore = Infinity;\r\n let bestPlace = null;\r\n for (let d of Grid.DIRS) {\r\n for (let i=d[0]<0?numLen-1:0,iEnd=d[0]>0?this.m-numLen:this.m; i<iEnd; i++) {\r\n for (let j=d[1]<0?numLen-1:0,jEnd=d[1]>0?this.n-numLen:this.n; j<jEnd; j++) {\r\n let score = countScore(num, i, j, d);\r\n if (score<bestScore) {\r\n bestScore = score;\r\n bestPlace = {place: [i,j], dir: d};\r\n }\r\n }\r\n }\r\n }\r\n return bestPlace;\r\n };\r\n for (let num of Object.keys(this.placing).sort(()=>Math.random()-0.5)) {\r\n takeAway(num);\r\n let p = findBestPlace(num);\r\n this.placing[num] = p;\r\n putTo(num, p);\r\n }\r\n }", "function finishPlacement(size, table, vertical){\n for (let i=0; i<size; i++) { // goes through for the length of the ship being placed\n let cell; // name for the current space on board that the board is trying to hilight\n if(vertical) { //if the ship will be placed vertically increment through the rows\n let tableRow = table.rows[row+i];\n if (tableRow === undefined) {\n // ship is over the edge; let the back end deal with it\n break;\n }\n cell = tableRow.cells[col];\n } else { //if the ship isn't vertical increment through the columns\n cell = table.rows[row].cells[col+i];\n }\n if (cell === undefined) {\n // ship is over the edge; let the back end deal with it\n break;\n }\n cell.classList.toggle(\"placed\"); // add class placed to cell so it will show up with color on the board!\n }\n}", "function findBestFly() {\n\tvar max = -1;\n\n\tfor (i = 0; i < popSize; i++) {\n\t\tif (fly[i].getFitness() > max) {\n\t\t\tmax = fly[i].getFitness();\n\t\t\tbestIndex = i;\n\t\t}\n\t}\n}", "function identifyValidTiles(nodeArray,exitNode){\n var depth = 0;\n index = exitNode;\n while(nodeArray[index].visited == false){\n depth +=1;\n for (i=0; i<nodeArray.length; i++){\n if (nodeArray[i].visited == true && nodeArray[i].distance == depth){\n if (nodeArray[i].id == exitNode){\n nodeArray[i].visited = true;\n }\n if (nodeArray[i].id == 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n }\n if (nodeArray[i].id > 0 && nodeArray[i].id < maxRow-1){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n }\n if (nodeArray[i].id == maxRow-1){\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n }\n if (nodeArray[i].id > 0 && nodeArray[i].id < (maxRow*maxRow-maxRow) && nodeArray[i].id %maxRow == 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id); \n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n }\n }\n if (nodeArray[i].id > maxRow-1 && nodeArray[i].id < (maxRow*maxRow-1) && (nodeArray[i].id+1) %maxRow == 0){\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n }\n }\n if (nodeArray[i].id == maxRow*maxRow-maxRow){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id); \n } \n }\n if (nodeArray[i].id > maxRow*maxRow-maxRow && nodeArray[i].id < maxRow*maxRow-1){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n }\n }\n if (nodeArray[i].id == maxRow*maxRow-1){\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id);\n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n } \n }\n if (nodeArray[i].id >maxRow-1 && nodeArray[i].id <maxRow*maxRow-maxRow && nodeArray[i].id %maxRow != 0 && (nodeArray[i].id+1)%maxRow != 0){\n if (nodeArray[i+1].isAWall == false && nodeArray[i+1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+1].id);\n }\n if (nodeArray[i+maxRow].isAWall == false && nodeArray[i+maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i+maxRow].id);\n }\n if (nodeArray[i-1].isAWall == false && nodeArray[i-1].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-1].id); \n }\n if (nodeArray[i-maxRow].isAWall == false && nodeArray[i-maxRow].visited == false){\n progressMaze(nodeArray,nodeArray[i].id,nodeArray[i-maxRow].id);\n } \n }\n } \n }\n} \n return nodeArray;\n}", "function readGrid(){\r\n for (let y = 0; y < rows; y++){\r\n for (let x = 0; x < cols; x++){\r\n if (grid[y][x].cellRef.textContent == 1) {\r\n if (countNeighbors(grid[y][x]) > 3){\r\n grid[y][x].alive = 0;\r\n } else if (countNeighbors(grid[y][x]) < 2){\r\n grid[y][x].alive = 0;\r\n } else if (countNeighbors(grid[y][x]) == 2 || countNeighbors(grid[y][x]) == 3){ \r\n grid[y][x].alive = 1;\r\n }\r\n } else if (countNeighbors(grid[y][x], grid) == 3){\r\n grid[y][x].alive = 1;\r\n }\r\n } \r\n }\r\n}", "function findStart(i, t) {\n if (cells.b[i]) return cells.v[i].find(v => vertices.c[v].some(c => c >= pointsN)); // map border cell\n return cells.v[i][cells.c[i].findIndex(c => cells.t[c] < t || !cells.t[c])];\n }", "step() {\n // !!!! IMPLEMENT ME !!!!\n const currentCells = this.cells[this.activeBuffer];\n const nextCells = this.cells[this.activeBuffer === 1 ? 0 : 1];\n\n for (let h = 0; h < this.height; h++) {\n for (let w = 0; w < this.width; w++) {\n const count = this.getLiveNeighborCount.call(this, h, w);\n\n if (currentCells[h][w]) {\n if (count < 2 || count > 3) {\n nextCells[h][w] = false;\n } else {\n nextCells[h][w] = true;\n }\n } else {\n if (count === 3) {\n nextCells[h][w] = true;\n } else {\n nextCells[h][w] = false;\n }\n }\n }\n }\n this.activeBuffer = this.activeBuffer === 1 ? 0 : 1;\n }", "function BestFirstFinderFast(grid, start, end, heuristics) {\n AStarFinderFast(grid, start, end, function (x, y) {\n return heuristics(x, y) * 1000000;\n });\n}", "function computerDeterminesOptimalMove(board, marker) {\n let square = null;\n for (let index = 0; index < WINNING_LINES.length; index++) {\n let line = WINNING_LINES[index];\n let markedSquares = line.filter(square => board[square] === marker);\n if (markedSquares.length === 2) {\n square = line.find(square => board[square] === INITIAL_MARKER);\n if (square !== undefined) return square;\n }\n }\n return square;\n}", "checkPossibleMove(delay = 0, newlyCreatedGrid = false) {\n\n console.log(`newlyCreatedGrid => ${newlyCreatedGrid}`);\n\n let possibleMoves = [];\n this.nextRoundDelay = delay;\n for (let row = 0; row < 8; row++) {\n for (let col = 0; col < 6; col++) {\n // check right\n if (col < 5) {\n let tempType = this.blocks[row][col].type;\n this.blocks[row][col].type = this.blocks[row][col + 1].type;\n this.blocks[row][col + 1].type = tempType;\n let matches = this.checkGridForMatches();\n if (matches.length > 0) {\n possibleMoves.push(\n {\n col: col,\n row: row,\n dir: \"right\",\n matches: matches.length,\n types: Array.from(new Set(matches.map(m => m.type)))\n }\n );\n }\n this.blocks[row][col + 1].type = this.blocks[row][col].type;\n this.blocks[row][col].type = tempType;\n }\n\n // //check down\n if (row < 7) {\n let tempType = this.blocks[row][col].type;\n this.blocks[row][col].type = this.blocks[row + 1][col].type;\n this.blocks[row + 1][col].type = tempType;\n let matches = this.checkGridForMatches();\n if (matches.length > 0) {\n possibleMoves.push(\n {\n col: col,\n row: row,\n dir: \"down\",\n matches: matches.length,\n types: Array.from(new Set(matches.map(m => m.type)))\n }\n );\n }\n this.blocks[row + 1][col].type = this.blocks[row][col].type;\n this.blocks[row][col].type = tempType;\n }\n }\n }\n\n // these 3 ifs aim remove potentioal opponent dummy moves like matching red/yellow cards and injuries\n if (possibleMoves.length !== 1) {\n if (possibleMoves.filter(ps => ps.types.includes(\"red_card\")).length === possibleMoves.length) {\n let randomIndex = Math.floor(Math.random() * possibleMoves.length) + 1;\n possibleMoves = possibleMoves.slice(randomIndex - 1, randomIndex);\n } else {\n possibleMoves = possibleMoves.filter(ps => !ps.types.includes(\"red_card\"));\n }\n }\n if (possibleMoves.length !== 1) {\n if (possibleMoves.filter(ps => ps.types.includes(\"red_cross\")).length === possibleMoves.length) {\n let randomIndex = Math.floor(Math.random() * possibleMoves.length) + 1;\n possibleMoves = possibleMoves.slice(randomIndex - 1, randomIndex);\n } else {\n possibleMoves = possibleMoves.filter(ps => !ps.types.includes(\"red_cross\"));\n }\n }\n if (possibleMoves.length !== 1) {\n if (possibleMoves.filter(ps => ps.types.includes(\"yellow_card\")).length === possibleMoves.length) {\n let randomIndex = Math.floor(Math.random() * possibleMoves.length) + 1;\n possibleMoves = possibleMoves.slice(randomIndex - 1, randomIndex);\n } else {\n possibleMoves = possibleMoves.filter(ps => !ps.types.includes(\"yellow_card\"));\n }\n }\n\n let bestMatches = possibleMoves.filter(f => f.matches === Math.max(...possibleMoves.map(m => m.matches)));\n this.hintMatch = possibleMoves[Math.floor(Math.random() * possibleMoves.length)];\n this.bestMatchAtRandom = bestMatches[Math.floor(Math.random() * bestMatches.length)];\n\n this.noMoves = possibleMoves.length === 0;\n console.log(`possible moves => ${JSON.stringify(possibleMoves)}`);\n if (!newlyCreatedGrid) {\n setTimeout(() => {\n this.checkGoalAttemps();\n }, 1.2);\n } else {\n setTimeout(() => {\n if (!this.app.playerTurn && this.app.level.currentRound === 0) {\n TweenMax.delayedCall(3 + this.nextRoundDelay, () => {\n this.proceedToNextRound();\n })\n }\n }, 1);\n }\n }", "function findPath(startPos, goalPos, pathNumber, ignoreTowerSpawns, ignoreTowers) {\n //copy mapGrid array to a temp array\n var grid = copyArray(gameLoop.returnMapOfPath(pathNumber));\n\n //Set Goal\n grid[goalPos.indexX][goalPos.indexY] = 'GOAL';\n\n // Each \"location\" will store its coordinates\n // and the shortest path required to arrive there\n var location = {\n distX: startPos.indexX,\n distY: startPos.indexY,\n path: [],\n block: 'START'\n };\n\n // Initialize the queue with the start location already inside\n var queue = [location];\n\n // Loop through the grid searching for the goal\n while (queue.length > 0) {\n // Take the first location off the queue\n var currentLocation = queue.shift();\n\n // Explore North\n var newLocation = exploreInDirection(currentLocation, 0, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n\n // Explore East\n var newLocation = exploreInDirection(currentLocation, 1, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n\n // Explore South\n var newLocation = exploreInDirection(currentLocation, 2, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n\n // Explore West\n var newLocation = exploreInDirection(currentLocation, 3, grid, ignoreTowerSpawns, ignoreTowers);\n if (newLocation.block === 'GOAL') {\n return newLocation.path;\n } else if (newLocation.block === 'Valid') {\n queue.push(newLocation);\n }\n }\n\n // No valid path found\n return false;\n\n}", "bestPlaceToStart(incomingClues) {\n\n // penalize clues that have more zeros\n function weightedClue(clue) {\n return clue ? clue : -10;\n }\n\n const sideLength = this.size;\n const lastCell = this.size * 4 - 1;\n\n const sideClues = [\n {\n direction: 'top',\n count:\n weightedClue(incomingClues[sideLength]) + weightedClue(incomingClues[sideLength + 1]) +\n weightedClue(incomingClues[lastCell - 1]) + weightedClue(incomingClues[lastCell])\n },\n {\n direction: 'bottom',\n count:\n weightedClue(incomingClues[sideLength * 2 - 2]) + weightedClue(incomingClues[sideLength * 2 - 1]) +\n weightedClue(incomingClues[sideLength * 3]) + weightedClue(incomingClues[sideLength * 3 + 1])\n },\n {\n direction: 'left',\n count:\n weightedClue(incomingClues[0]) + weightedClue(incomingClues[1]) +\n weightedClue(incomingClues[sideLength * 3 - 2]) + weightedClue(incomingClues[sideLength * 3 - 1])\n },\n {\n direction: 'right',\n count:\n weightedClue(incomingClues[sideLength - 2]) + weightedClue(incomingClues[sideLength - 1]) +\n weightedClue(incomingClues[sideLength * 2]) + weightedClue(incomingClues[sideLength * 2 + 1])\n }\n ];\n sideClues.sort((a, b) => b.count - a.count);\n const bestDirection = sideClues[0].direction;\n\n let clues;\n let c1;\n let c2;\n let c3;\n let c4;\n switch(bestDirection) {\n case 'top':\n clues = incomingClues;\n break;\n case 'bottom': // shift bottom to the first row\n c1 = incomingClues.slice(sideLength * 2, sideLength * 3).reverse();\n c2 = incomingClues.slice(sideLength, sideLength * 2).reverse();\n c3 = incomingClues.slice(0, sideLength).reverse();\n c4 = incomingClues.slice(sideLength * 3, sideLength * 4).reverse();\n clues = c1.concat(c2).concat(c3).concat(c4);\n break;\n case 'left': // shift left side to the first row\n c1 = incomingClues.slice(sideLength * 3, sideLength * 4);\n c2 = incomingClues.slice(0, sideLength * 3);\n clues = c1.concat(c2);\n break;\n case 'right': // shift right side to the first row\n c1 = incomingClues.slice(sideLength, sideLength * 4);\n c2 = incomingClues.slice(0, sideLength);\n clues = c1.concat(c2);\n break;\n }\n return { startAt: bestDirection, clues };\n }", "function valid_placement(x, y, piece, cell_num)\n{\n if(!cell_num)\n {\n cell_num = 1;\n }\n var hor_step = 0;\n var vert_step = 0;\n if(piece.orientation === \"vert\")\n {\n vert_step = 1;\n }\n else\n {\n hor_step = 1;\n }\n if(on_board(x, y) && PS.data(x, y) === 0)\n { //if empty coord on board\n if(cell_num < piece.hits.length)\n {\n return valid_placement(x + hor_step, y + vert_step, piece, cell_num + 1); //check the next bead in line\n }\n else return true; //last bead checked, all clear\n }\n else\n {\n PS.statusText(\"Fails at \" + x + \",\" + y);\n return false;//not a free space\n }\n}", "function nextGen() {\n if (!grid) return\n const nextGen = grid.map(arr => [...arr]);\n for (let col = 0; col < grid.length; col++) {\n for (let row = 0; row < grid[col].length; row++) {\n const cell = grid[col][row];\n let numNeighbours = 0;\n\n for (let i = -1; i < 2; i++) {\n for (let j = -1; j < 2; j++) {\n if (i === 0 && j === 0) {\n continue;\n }\n const x_cell = col + i;\n const y_cell = row + j;\n\n if (x_cell >= 0 && y_cell >= 0 && x_cell < cols && y_cell < rows) {\n const currentNeighbour = grid[col + i][row + j]\n numNeighbours += currentNeighbour\n }\n }\n }\n //rules\n if (cell === 1 && numNeighbours < 2) {\n nextGen[col][row] = 0\n } else if (cell === 1 && numNeighbours > 3) {\n nextGen[col][row] = 0\n } else if (cell === 0 && numNeighbours === 3) {\n nextGen[col][row] = 1\n }\n }\n }\n return nextGen\n }", "function get_slots(file, width, height, grid_coords, cb) {\n cp.exec(\n \"python \" + require('./config').app_dir + \"/server/find_grid.py \" + file + \" \" + width + \" \" + height + \" \" + grid_coords.x + \" \" + grid_coords.y + \" \" + grid_coords.w + \" \" + grid_coords.h,\n function (err, stdout, stderr) {\n if (err) {\n cb(err, null, null, null);\n return;\n }\n var grid = stdout.split(\"\\n\").map(function(row) {\n return row.split(\" \")\n .filter(function (str) {return str != \"\"})\n .map(function (str) { return + str });\n }).filter(function (arr) { return arr.length == width });\n \n if (grid.length != height) {\n cb(new Error(\"find_grid output doesn't match grid height\"), null, null, null);\n }\n\n // Build slots\n var slot_num = 1;\n var slots = [];\n var across_slot_nums = [];\n var down_slot_nums = [];\n for (var i = 0; i < grid.length; i++) {\n for (var j = 0; j < grid[i].length; j++) {\n var new_slot = false;\n\n // Is this the start of a new across?\n if (grid[i][j] == 1 && (j==0 || grid[i][j-1]==0) && (j != grid[i].length-1 && grid[i][j+1]==1)) {\n // Find slot length\n var crawl = j;\n while (crawl < grid[i].length && grid[i][crawl] == 1) crawl++;\n var length = crawl-j;\n slots.push({\n starty : i+1,\n startx : j+1,\n len : length,\n orientation : \"across\",\n position : slot_num\n });\n new_slot = true;\n across_slot_nums.push(slot_num);\n }\n\n // Is this the start of a new down?\n if (grid[i][j] == 1 && (i==0 || grid[i-1][j]==0) && (i != grid.length-1 && grid[i+1][j]==1)) {\n // Find slot length\n var crawl = i;\n while (crawl < grid.length && grid[crawl][j] == 1) crawl++;\n var length = crawl-i;\n slots.push({\n starty : i+1,\n startx : j+1,\n len : length,\n orientation : \"down\",\n position : slot_num\n });\n new_slot = true;\n down_slot_nums.push(slot_num);\n }\n\n if (new_slot) slot_num++;\n }\n }\n cb(null, slots, across_slot_nums, down_slot_nums);\n });\n}", "function generateGrids() {\n for (let indexX = 0; indexX < constants.GRID_X_COUNT; indexX++) {\n xJump = gap;\n for (let indexY = 0; indexY < constants.GRID_Y_COUNT; indexY++) {\n // Create a PIXI container and set image properties to it. Shall review it later.\n mainContainer[indexX][indexY] = new PIXI.Container();\n mainContainer[indexX][indexY].interactive = true;\n mainContainer[indexX][indexY].height = boxWidth;\n mainContainer[indexX][indexY].width = boxWidth;\n mainContainer[indexX][indexY].interactive = true;\n mainContainer[indexX][indexY].x = xPos + xJump;\n mainContainer[indexX][indexY].y = yPos + yJump;\n mainContainer[indexX][indexY].indexX = indexX;\n mainContainer[indexX][indexY].indexY = indexY;\n\n // Background Image with choice of loser / winner.\n grids[indexX][indexY] = PIXI.Sprite.fromImage(uniqueImageGenerator(indexX, indexY));\n grids[indexX][indexY].cacheAsBitmapboolean = true;\n grids[indexX][indexY].interactive = true;\n grids[indexX][indexY].indexX = indexX;\n grids[indexX][indexY].indexY = indexY;\n grids[indexX][indexY].height = boxWidth;\n grids[indexX][indexY].width = boxWidth;\n grids[indexX][indexY].position.set(0, 0);\n\n // Scratching area.\n gridScratches[indexX][indexY] = PIXI.Sprite.fromImage(constants.scratchImg);\n gridScratches[indexX][indexY].cacheAsBitmapboolean = true;\n gridScratches[indexX][indexY].interactive = true;\n gridScratches[indexX][indexY].indexX = indexX;\n gridScratches[indexX][indexY].indexY = indexY;\n gridScratches[indexX][indexY].height = boxWidth;\n gridScratches[indexX][indexY].width = boxWidth;\n gridScratches[indexX][indexY].position.set(0, 0);\n\n mainContainer[indexX][indexY].addChild(gridScratches[indexX][indexY]);\n mainContainer[indexX][indexY].addChild(grids[indexX][indexY]);\n stage.addChild(mainContainer[indexX][indexY]);\n\n // Srpite overlay for the scratching area.\n drawingMask[indexX][indexY] = new InverseDrawingMask(mainContainer[indexX][indexY]);\n alphaSprite[indexX][indexY] = new PIXI.ParticleContainer();\n particleViews[indexX][indexY] = new PIXI.particles.Emitter(alphaSprite[indexX][indexY],\n constants.particleImg, configParticle);\n grids[indexX][indexY].mask = drawingMask[indexX][indexY].getMaskSprite();\n particleViews[indexX][indexY].emit = false;\n mainContainer[indexX][indexY].addChild(alphaSprite[indexX][indexY]);\n\n // Comment the below lines to see only the Pixi graphic eraser.\n // alpha[indexX][indexY] = new PIXI.Graphics();\n // grids[indexX][indexY].mask = alpha[indexX][indexY];\n\n // let texture = new PIXI.Texture.fromCanvas(renderer.view);\n // let alpha = new PIXI.Sprite(texture);\n // gridScratches[indexX][indexY].mask = alpha;\n // alphaSprite[indexX][indexY] = new PIXI.ParticleContainer();\n // particleViews[indexX][indexY] = new PIXI.particles.Emitter(alphaSprite[indexX][indexY],\n // constants.particleImg, configParticle);\n\n // mainContainer[indexX][indexY].addChild(alphaSprite[indexX][indexY]);\n\n\n // Add mouse and touch events to the grid boxes\n mainContainer[indexX][indexY].on('mouseover', mouseover);\n mainContainer[indexX][indexY].on('mouseout', mouseout);\n mainContainer[indexX][indexY].on('touchstart', mouseover);\n mainContainer[indexX][indexY].on('touchend', mouseout);\n\n xJump += boxWidth + gap;\n }\n\n yJump += boxWidth + gap;\n }\n\n return grids;\n}", "_GenLvlGrid() {\n // get max x & y\n let blocks = this._blocks\n if (blocks.length == 0) return []\n if (blocks.length == 1) return [blocks[0]]\n let max_x = 0\n let max_y = 0\n for (let block of blocks) {\n if (block.x > max_x)\n max_x = block.x\n if (block.y > max_y)\n max_y = block.y\n }\n // lookup block at position\n let GetBlock = (x, y) => {\n for (let block of this._blocks) {\n if (block.x == x && block.y == y)\n return block\n }\n return null\n }\n // generate grid\n this._block_grid = []\n for (let x = 0; x <= max_x; x++) {\n let column = []\n for (let y = 0; y <= max_y; y++) {\n column.push(GetBlock(x, y))\n }\n this._block_grid.push(column)\n }\n\n if (process.env.NODE_ENV === 'development') this._LogGrid()\n }", "function gridMax(grid) {\n let max = -Infinity;\n for (const row of grid) {\n for (const num of row) {\n if (num > max) {\n max = num;\n }\n }\n }\n return max;\n}", "findGridLimits () {\n let residue = this.getResidueProxy()\n let atom = this.getAtomProxy()\n for (let iRes = 0; iRes < this.getResidueCount(); iRes += 1) {\n residue.iRes = iRes\n if (residue.ss === 'G') {\n atom.iAtom = residue.iAtom\n if (!(atom.elem in this.grid.isElem)) {\n this.grid.isElem[atom.elem] = true\n }\n if (this.grid.bMin === null) {\n this.grid.bMin = atom.bfactor\n this.grid.bMax = atom.bfactor\n } else {\n if (atom.bfactor > this.grid.bMax) {\n this.grid.bMax = atom.bfactor\n }\n if (atom.bfactor < this.grid.bMin) {\n this.grid.bMin = atom.bfactor\n }\n }\n }\n }\n\n if (this.grid.bMin === null) {\n this.grid.bMin = 0\n }\n if (this.grid.bMax === null) {\n this.grid.bMin = 0\n }\n this.grid.bCutoff = this.grid.bMin\n }", "function southwest(n) {\n var level = bottoms[n];\n var count = 0;\n\n for (var i = 1; ((n - i) >= 0) && ((level + i) <= 5); i++) {\n var square = document.getElementsByClassName(\"row\").item(level + i)\n .getElementsByClassName(\"bigSquare\").item(n - i);\n if (square.style.backgroundColor == color(currentTurn)) {\n count++;\n }\n else return count;\n }\n return count;\n }", "showNeighbours(){\n\n var currentLevel = levels[gameState.level]; // chosen difficulty level\n \n // iterate over all immediate neighbours\n for(var j = this.y - 1; j <= this.y + 1; j++){ // iterate over all cols\n for(var i = this.x - 1; i <= this.x + 1; i++){ // iterate over all rows\n \n if( i == this.x && j == this.y ) // cell whose neighbours to be checked\n continue;\n \n if( i < 0 || j < 0 || i >= currentLevel.numCols || j >= currentLevel.numRows ) // boundary condition\n continue;\n \n var idx = ((j * currentLevel.numCols) + i); // current neighbour cell idx \n if( grid[idx].currentState == 'hidden' ){\n\n grid[idx].currentState = 'visible'; // update current state\n if(grid[idx].numMines == 0)\n grid[idx].showNeighbours(); // recursive call\n\n }\n }\n }\n }", "step() {\n // !!!! IMPLEMENT ME !!!!\n let currentBuffer = this.cells[this.currentBufferIndex];\n let backBuffer = this.cells[this.currentBufferIndex === 0 ? 1 : 0];\n\n function countNeighbors(row, col) {\n let neighborCount = 0;\n\n for (let rowOffset = -1; rowOffset <= 1; rowOffset++) {\n let rowPos = row + rowOffset;\n\n if (rowPos < 0 || rowPos === this.height) {\n continue;\n }\n\n for (let colOffset = -1; colOffset <= 1; colOffset++) {\n let colPos = col + colOffset;\n\n if (colPos < 0 || colPos === this.width) {\n continue;\n }\n \n if (colOffset === 0 && rowOffset === 0) { // Current cell\n continue;\n }\n\n if (currentBuffer[rowPos][colPos] === 1) {\n neighborCount++;\n }\n }\n }\n return neighborCount;\n };\n\n for (let r = 0; r < this.height; r++) {\n for (let c = 0; c < this.width; c++) {\n let neighborCount = countNeighbors.call(this, r, c);\n\n if (currentBuffer[r][c] === 1) {\n if (neighborCount < 2 || neighborCount > 3) {\n backBuffer[r][c] = 0;\n } else {\n backBuffer[r][c] = 1;\n }\n } else {\n if (neighborCount === 3) {\n backBuffer[r][c] = 0;\n } else {\n backBuffer[r][c] = 1;\n }\n }\n }\n }\n\n this.currentBufferIndex = this.currentBufferIndex === 0 ? 1 : 0;\n }", "function runGenomes()\n{\n for(var i = 0; i < genomes.length; ++i)\n {\n // we found a duplicate entry and we updated the fitness for it and we can skip it and move on\n if(isDuplicateGenome(genomes[i], i))\n {\n continue;\n }\n\n // console.log(\"Genome: \" + i.toString());\n // the current tetris piece in use\n randomSeeded = new Random(1);\n game = new Game();\n game.drawBoard();\n game.drawBoarder();\n // creates the starting pieces for the game\n game.generateStartingPieces();\n // gets the first piece of the game\n game.getNextPiece();\n\n StartGame();\n var best = new BestFirstSearch(genomes[i].numGaps, genomes[i].maxHeight, genomes[i].std_height, genomes[i].scoreIncrease);\n genomes[i].fitness = best.startAI();\n // console.log(\"Genome fitness: \" + genomes[i].fitness);\n }\n}", "function PopulateRandomTunnels() {\n\tfor(i = 0; i < 7; i) { // keep going until you find a number of valid positions\n\t\trandomPosition = Dice(100) - 1; // pick a random location on the grid\n\t\tvalidPosition = 0; // track position validity\n\t\tif(Math.floor((randomPosition - 1) / 10) == Math.floor(randomPosition / 10) && // west is not off edge\n\t\tgridArr[randomPosition - 1].open > 0 && // west is open\n\t\tgridArr[randomPosition - 1].room != \"ST\") { // is not start\n\t\t\tvalidPosition += 1;\n\t\t}\n\t\tif(Math.floor((randomPosition + 1) / 10) == Math.floor(randomPosition / 10) && // east is not off edge\n\t\tgridArr[randomPosition + 1].open > 0 && // east is open\n\t\tgridArr[randomPosition + 1].room != \"ST\") { // is not start\n\t\t\tvalidPosition += 100;\n\t\t}\n\t\tif(randomPosition - 10 >= 0 && // north is not off edge\n\t\tgridArr[randomPosition - 10].open > 0 && // north is open\n\t\tgridArr[randomPosition - 10].room != \"ST\") {\n\t\t\tvalidPosition += 1000;\n\t\t}\n\t\tif(randomPosition + 10 <= 99 && // south is not off edge\n\t\tgridArr[randomPosition + 10].open > 0 && // south is open\n\t\tgridArr[randomPosition + 10].room != \"ST\") {// is not start\n\t\t\tvalidPosition += 10;\n\t\t}\n\t\tif(gridArr[randomPosition].open < 1 && // is not already open\n\t\tvalidPosition > 0) { // is a valid position (beside an open space)\n\t\t\tgridArr[randomPosition].open = 1;\n\t\t\tgridArr[randomPosition].room = \"R\";\n\t\t\ti ++;\n\t\t}\n\t}\n\t// update the SC\n}", "FindNeighbours()\n {\n var AllPlayers = ListMembers.GetAllMembers();\n\n for (var curPlyr = 0; curPlyr != AllPlayers.length; curPlyr++)\n {\n //first clear any current tag\n AllPlayers[curPlyr].Steering().UnTag();\n\n //work in distance squared to avoid sqrts\n var to = new Phaser.Point(AllPlayers[curPlyr].Pos().x - this.m_pPlayer.Pos().x,\n AllPlayers[curPlyr].Pos().y - this.m_pPlayer.Pos().y);\n\n if (to.getMagnitudeSq() < (this.m_dViewDistance * this.m_dViewDistance))\n {\n AllPlayers[curPlyr].Steering().Tag();\n }\n }//next\n }", "FindNeighbours()\n {\n var AllPlayers = ListMembers.GetAllMembers();\n\n for (var curPlyr = 0; curPlyr != AllPlayers.length; curPlyr++)\n {\n //first clear any current tag\n AllPlayers[curPlyr].Steering().UnTag();\n\n //work in distance squared to avoid sqrts\n var to = new Phaser.Point(AllPlayers[curPlyr].Pos().x - this.m_pPlayer.Pos().x,\n AllPlayers[curPlyr].Pos().y - this.m_pPlayer.Pos().y);\n\n if (to.getMagnitudeSq() < (this.m_dViewDistance * this.m_dViewDistance))\n {\n AllPlayers[curPlyr].Steering().Tag();\n }\n }//next\n }", "computeGrids(){\n // Fill in the first row\n for (let j = 1; j < this.jMax; j++) {\n this.grid[0][j] = this.grid[0][j-1] + this.gap_penalty;\n this.tracebackGrid[0][j] = [false, false, true];\n }\n\n // Fill in the first column\n for (let i = 1; i < this.iMax; i++) {\n this.grid[i][0] = this.grid[i-1][0] + this.gap_penalty;\n this.tracebackGrid[i][0] = [false, true, false];\n }\n\n // Fill the rest of the grid\n for(let i = 1; i < this.iMax; i++){\n for(let j = 1; j < this.jMax; j++){\n // Find the max score(s) among [`Diag`, `Up`, `Left`]\n let diag;\n if(this.sequence1[i-1] === this.sequence2[j-1])\n diag = this.grid[i-1][j-1] + this.match_score;\n else\n diag = this.grid[i-1][j-1] + this.mismatch_penalty;\n\n let up = this.grid[i-1][j] + this.gap_penalty;\n let left = this.grid[i][j-1] + this.gap_penalty;\n\n // If there exists multiple max values, capture them for multiple paths\n let maxOf = [diag,up,left];\n let indices = this.arrayAllMaxIndexes(maxOf);\n\n // Update Grids\n this.grid[i][j] = maxOf[indices[0]];\n this.tracebackGrid[i][j] = [indices.includes(0), indices.includes(1), indices.includes(2)];\n }\n }\n\n // Update alignment score\n this.score = this.grid[this.iMax-1][this.jMax-1];\n }", "function minimax(playerTile){\n console.log('minimax called');\n var Secondplayer=playerTile=='X'?'O':'X';\n var val=1000;\n var x,temp;\n for(var i=0;i<boardList.length;i++){\n if(boardList[i]!=\"X\"&&boardList[i]!=\"O\"){\n temp=boardList[i];\n boardList[i]=playerTile;\n var move=maxsearch(0,playerTile,Secondplayer); \n if(move<val){\n val=move;\n x=i;\n }\n boardList[i]=temp;\n }\n } \n \n return x;\n }", "mazeGeneration(grid){\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if((row+col)%2===0){\n const newGrid = getNewGridWithWallToggled(this.state.grid, row, col);\n this.setState({grid: newGrid, mouseIsPressed: false});\n }\n }\n }\n this.DFS(grid,START_NODE_ROW,START_NODE_COL);\n for (let row = 0; row < 23; row++) {\n for (let col = 0; col < 57; col++) {\n if((row+col)%2===1){\n grid[row][col].isVisited=false;\n }\n }\n }\n\n }", "function aStarSearch(source, dest, grid) {\n // If the destination cell is the same as source cell\n if (cell_destination(source.first, source.second, dest) === true) {\n return;\n }\n // Create a closed list implemented as a boolean 2D array and //initialise it to false\n\n closedList = [];\n for (var i = 0; i < 12; i++) {\n closedList[i] = [];\n for (var j = 0; j < 12; j++) {\n closedList[i][j] = false;\n }\n }\n // Declare a 2D array of structure to hold the details\n //of that cell\n C = [];\n var i, j;\n for (i = 0; i < 12; i++) {\n C[i] = [];\n for (j = 0; j < 12; j++) {\n C[i][j] = {\n f: FLT_MAX,\n g: FLT_MAX,\n h: FLT_MAX,\n parent_i: -1,\n parent_j: -1,\n };\n }\n }\n // Initialising the parameters of the starting node\n var i = source.first;\n var j = source.second;\n C[i][j].f = 0.0;\n C[i][j].g = 0.0;\n C[i][j].h = 0.0;\n C[i][j].parent_i = i;\n C[i][j].parent_j = j;\n\n openList = [];\n // Put the starting cell on the open list and set its\n // 'f' as 0\n openList.push({ first: 0.0, second: { first: i, second: j } });\n var foundDest = false;\n var gNew, hNew, fNew;\n while (openList.length != 0) {\n p = openList[0];\n // Remove this vertex from the open list Add this vertex to the //closed list\n openList.shift();\n if (!cell_valid(p.second.first, p.second.second)) continue;\n i = p.second.first;\n j = p.second.second;\n closedList[i][j] = true;\n //Generating all the 8 successor of this cell\n x = [0, 0, -1, -1, -1, 1, 1, 1];\n y = [1, -1, 0, 1, -1, 0, 1, -1];\n for (i_ind = 0; i_ind < 8; i_ind++) {\n if (cell_valid(i + x[i_ind], j + y[i_ind]) === true) {\n if (cell_destination(i + x[i_ind], j + y[i_ind], dest) === true) {\n C[i + x[i_ind]][j + y[i_ind]].parent_i = i;\n C[i + x[i_ind]][j + y[i_ind]].parent_j = j;\n console.log(\"The destination cell is found\\n\");\n tracePath(C, dest);\n foundDest = true;\n return;\n } else if (\n closedList[i + x[i_ind]][j + y[i_ind]] === false &&\n cell_unblocked(grid, i + x[i_ind], j + y[i_ind]) === true\n ) {\n gNew = C[i][j].g + 1.0;\n if (choice == 1) {\n hNew = euclidian_distance(i + x[i_ind], j + y[i_ind], dest);\n } else if (choice == 2) {\n hNew = manhattan_distance(i + x[i_ind], j + y[i_ind], dest);\n } else {\n hNew = euclidian_distance(i + x[i_ind], j + y[i_ind], dest);\n }\n fNew = gNew + w * hNew;\n if (\n C[i + x[i_ind]][j + y[i_ind]].f == FLT_MAX ||\n C[i + x[i_ind]][j + y[i_ind]].f > fNew\n ) {\n openList.push({\n first: fNew,\n second: { first: i + x[i_ind], second: j + y[i_ind] },\n });\n C[i + x[i_ind]][j + y[i_ind]].f = fNew;\n C[i + x[i_ind]][j + y[i_ind]].g = gNew;\n C[i + x[i_ind]][j + y[i_ind]].h = hNew;\n C[i + x[i_ind]][j + y[i_ind]].parent_i = i;\n C[i + x[i_ind]][j + y[i_ind]].parent_j = j;\n }\n }\n }\n }\n }\n if (foundDest === false) console.log(\"Destination not found\");\n\n return;\n}", "function getNeighbors(tile){\r\n var indexofTile=tile.index(); //get the index of the cell on the grid\r\n var neighbors=[]; \r\n checknextNeigbor(tile); //call the function to check if there is next neighbor and push it in the array \r\n checkpreviousNeigbor(tile); //call the function to check if there is previous neighbor and push it in the array \r\n //check if cell has up neighbor\r\n if(tile.parent().prev().children().eq(indexofTile).length) { \r\n var upTile=tile.parent().prev().children().eq(indexofTile);\r\n neighbors.push(upTile);\r\n checknextNeigbor(upTile);\r\n checkpreviousNeigbor(upTile);\r\n }\r\n //check if cell has down neighbor\r\n if(tile.parent().next().children().eq(indexofTile).length){\r\n var downTile=tile.parent().next().children().eq(indexofTile);\r\n neighbors.push(downTile);\r\n checknextNeigbor(downTile);\r\n checkpreviousNeigbor(downTile);\r\n \r\n }\r\n function checknextNeigbor(cell){ //the function to check if there is next neighbor and push it in the array \r\n if(cell.next().length){ //check if cell has next neighbor\r\n neighbors.push(cell.next()); \r\n }}\r\n function checkpreviousNeigbor(cell){ //the function to check if there is previous neighbor and push it in the array \r\n if(cell.prev().length){ //check if cell has next neighbor\r\n neighbors.push(cell.prev()); \r\n }}\r\n return neighbors; //return neighbors of certain cell\r\n}", "function southeast(n) {\n var level = bottoms[n];\n var count = 0;\n\n for (var i = 1; ((n + i) <= 6) && ((level + i) <= 5); i++) {\n var square = document.getElementsByClassName(\"row\").item(level + i)\n .getElementsByClassName(\"bigSquare\").item(n + i);\n if (square.style.backgroundColor == color(currentTurn)) {\n count++;\n }\n else return count;\n }\n return count;\n }", "findXCoordinate(xCoordinate) {\n /* find index of the columns number (absciss) : it loop on the freeGrid size, so, there is at most (size of the freeFrid) \n operations */\n let xCpt = 0;\n\n while (xCpt < this.freeGrid.length && xCoordinate !== this.freeGrid[xCpt][0]) {\n xCpt++;\n } \n\n if(xCpt === this.freeGrid.length) {\n return [];\n } else {\n return([xCpt]) ;\n }\n\n }", "gridNumberToPosition_(n) {\n return (n + 0.5) * this.SQUARE_SIZE;\n }", "function bestspot(){\r\n \treturn minimax(origBoard,aiplayer).index ;\r\n }", "function getClosestCells(_currPos, gridDiv, gridW, gridH)\n{\n var neighbors = [];\n var boxWidth = gridW / gridDiv;\n var boxHeight = gridH / gridDiv;\n var _startX = 0.0;\n var _startY = 0.0;\n var _endX = 0.0;\n var _endY = 0.0;\n\n //establish current grid cell boundaries of agent\n for(var i = 0; i < gridW; i += boxWidth)\n {\n if(_currPos.x >= i && _currPos.x <= i + boxWidth)\n {\n _startX = i;\n _endX = i + boxWidth;\n }\n }\n\n for(var j = 0; j < gridH; j += boxHeight)\n {\n if(_currPos.z >= j && _currPos.z <= j + boxHeight)\n {\n _startY = j;\n _endY = j + boxHeight;\n }\n }\n\n //boundary cases\n if(_startX == 0)\n {\n _startX += boxWidth;\n }\n if(_startX == 20)\n {\n _startX -= boxWidth;\n }\n\n if(_startY == 0)\n {\n _startY += boxHeight;\n }\n if(_startY == 20)\n {\n _startY -= boxHeight;\n }\n\n if(_endX == 20)\n {\n _endX -= boxWidth;\n }\n if(_endY == 20)\n {\n _endY -= boxHeight;\n }\n\n //either multiply the values in if cases by 2 or subtract and add boxWidth and boxHeight here\n neighbors.push({startX: _startX - boxWidth, startY: _startY - boxHeight, endX: _endX + boxWidth, endY: _endY + boxHeight});\n\n return neighbors;\n}", "function findNeighbouringBlocks(xpos, ypos){\n let neighbours = [];\n if (xpos > 0){\n neighbours.push([xpos - 1, ypos]);\n if (ypos > 0) {\n neighbours.push([xpos - 1, ypos - 1]);\n }\n if (ypos < levelMap[xpos].length - 1){\n neighbours.push([xpos - 1, ypos + 1]);\n }\n }\n if (xpos < levelMap.length - 1){\n neighbours.push([xpos + 1, ypos]);\n if (ypos > 0){\n neighbours.push([xpos + 1, ypos - 1]);\n }\n if (ypos < levelMap[xpos].length - 1){\n neighbours.push([xpos + 1, ypos + 1]);\n }\n }\n if (ypos > 0){\n neighbours.push([xpos, ypos - 1]);\n }\n if (ypos < levelMap[xpos].length - 1){\n neighbours.push([xpos, ypos + 1]);\n }\n return neighbours;\n }", "countNeighbours() {\n\t\tlet c = 0;\n\t\tfor(let x =- 1; x <= 1; x++) {\n\t\t\tfor(let y =- 1; y <= 1; y++) {\n\t\t\t\tlet neighbour = { x: this.x + x, y: this.y + y };\n\t\t\t\tif( this.world.isInside(neighbour.x, neighbour.y) &&\n\t\t\t\t (( neighbour.x !== this.x ) || ( neighbour.y !== this.y )) ) {\n\t\t\t\t\tif(this.world.grid[neighbour.y][neighbour.x].state) c += 1;\n\t\t\t\t\tif(c > 3) return c;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn c;\n\t}", "function treasureIsland2(grid) {\n //create q, add all S's to q, set S's to visited\n let q = [];\n for (let i = 0; i < grid.length; i++) {\n for (let j = 0; j < grid[i].length; j++) {\n if (grid[i][j] === 'S') {\n q.push([i,j]);\n grid[i][j] = 'D';\n }\n }\n }\n \n let steps = 0;\n const dir = [[1,0],[-1,0],[0,1],[0,-1]];\n\n while (q.length) {\n let newQ = [];\n while (q.length) {\n let [i,j] = q.shift();\n //check each neighbor of this layer (bfs)\n for (let d of dir) {\n let x = i + d[0];\n let y = j + d[1];\n\n if (x < 0 || y < 0 || x >= grid.length || y >= grid[0].length || grid[x][y] === 'D') {\n continue;\n }\n //check if this neighbor is a target\n if (grid[x][y] === 'X') {\n return steps + 1;\n }\n grid[x][y] = 'D';\n newQ.push([x,y]);\n }\n }\n steps += 1;\n q = newQ;\n }\n return -1;\n}", "function loop(item2){\n\n for(var t=0;t<allElementsList.length;t++){\n for(var u=0;u<allElementsList[t].length;u++){\n\n //when element that was clicked has a number\n if(allElementsList[t][u]===item2 && elementsAroundMines.has(item2) && !flagList.includes(item2)){\n document.getElementById('underDiv'+(allElementsList[t][u]).toString()).innerHTML=elementsAroundMines.get(allElementsList[t][u]);\n listOfNeighboursThatAreAroundMines.push(item2);\n\n if(allElementsList[t] && allElementsList[t][u]!==undefined && !uncoveredList.includes(allElementsList[t][u]) && !minesList.includes(allElementsList[t][u])){\n uncoveredList.push(allElementsList[t][u]);\n }\n }\n //if element has no number\n else if(allElementsList[t][u]===item2 && !flagList.includes(item2)){\n neighbourList.push(item2)\n\n gameStatements(t,u);\n gameStatements(t,u-1);\n gameStatements(t,u+1);\n gameStatements(t-1,u-1);\n gameStatements(t-1,u);\n gameStatements(t-1,u+1);\n gameStatements(t+1,u-1);\n gameStatements(t+1,u);\n gameStatements(t+1,u+1);\n\n }\n \n }\n } \n }", "function getGreedyMove(){\n var bestMove = game_table[0][0].colour;\n var bestScore = 0;\n for(var i = 0; i < 6; i++){\n var score = getNumNeighbours(colours[i]);\n if(score > bestScore){\n bestScore = score;\n bestMove = colours[i];\n }\n }\n return bestMove;\n}", "step() {\n /* If you put logic from CCA here it works as should */\n\n /* In the Game of Life, these rules examine each cell of the grid. \n For each cell, it counts that cell's eight neighbors\n (up, down, left, right, and diagonals), and then act on that result.\n\n If the cell is alive and has 2 or 3 neighbors, then it remains alive. Else it dies.\n If the cell is dead and has exactly 3 neighbors, then it comes to life. Else if remains dead. */\n\n let currentBuffer = this.cells[this.currentBufferIndex];\n let backBuffer = this.cells[this.currentBufferIndex === 0 ? 1 : 0];\n \n // see if we have a neighbor that can infect this cell and change its color\n function checkNeighbors(w, h) {\n let neighbors = 0;\n\n // Check West\n if (w) {\n if (currentBuffer[h][w - 1]) {\n neighbors++;\n }\n }\n // Check NW\n if (h && w) {\n if (currentBuffer[h - 1][w - 1])\n neighbors++;\n }\n // Check North\n if (h) {\n if (currentBuffer[h - 1][w]) {\n neighbors++;\n }\n }\n // Check NE\n if ((w < this.width - 1) && h) {\n if (currentBuffer[h - 1][w + 1]) {\n neighbors++;\n }\n }\n // Check East\n if (w < this.width - 1) {\n if (currentBuffer[h][w + 1]) {\n neighbors++;\n }\n }\n // Check SE\n if ((h < this.height - 1) && (w < this.width - 1)) {\n if (currentBuffer[h + 1][w + 1]) {\n neighbors++;\n }\n }\n // Check South\n if (h < this.height - 1) {\n if (currentBuffer[h + 1][w]) {\n neighbors++;\n }\n }\n // Check SW\n if ((h < this.height - 1) && w) {\n if (currentBuffer[h + 1][w - 1]) {\n neighbors++;\n }\n }\n\n return neighbors;\n } // end: checkNeightbors()\n\n for (let h = 0; h < this.height; h++) {\n for (let w = 0; w < this.width; w++) {\n let neighborCount = checkNeighbors.call(this, w, h);\n\n // is current cell alive?\n if (currentBuffer[h][w]) {\n if (neighborCount === 2 || neighborCount === 3) {\n backBuffer[h][w] = currentBuffer[h][w]; // cell stay alives\n }\n else { // else it dies\n backBuffer[h][w] = (currentBuffer[h][w] + 1) % MODULO;\n }\n }\n else { // current cell is dead\n if (neighborCount === 3) {\n backBuffer[h][w] = (currentBuffer[h][w] + 1) % MODULO; // bring cell to life\n }\n else { // else cell remains dead\n backBuffer[h][w] = currentBuffer[h][w];\n }\n }\n }\n }\n\n this.currentBufferIndex = this.currentBufferIndex === 0 ? 1 : 0;\n }", "function fillRemaining(solutionGrid, i, j) \n { \n let N = 9;\n let SRN = 3;\n // System.out.println(i+\" \"+j); \n if (j>=N && i<N-1) \n { \n i = i + 1; \n j = 0; \n } \n if (i>=N && j>=N) \n return true; \n\n if (i < SRN) \n { \n if (j < SRN) \n j = SRN; \n } \n else if (i < N-SRN) \n { \n if (j==parseInt(i/SRN)*SRN) \n j = j + SRN; \n } \n else\n { \n if (j == N-SRN) \n { \n i = i + 1; \n j = 0; \n if (i>=N) \n return true; \n } \n } \n\n for (let num = 1; num<=N; num++) \n { \n if (CheckIfSafe(solutionGrid, i, j, num)) \n { \n solutionGrid[i][j] = num; \n if (fillRemaining(solutionGrid, i, j+1)) \n return true; \n\n solutionGrid[i][j] = 0; \n } \n } \n return false; \n }", "static chooseDiscoverTile(gameState, gameMap, tiles) {\r\n\t\tlet generalCoords = gameMap.getCoordinatesFromTileIndex(gameState.ownGeneral);\r\n\r\n\t\tlet optimalTile = {\"index\": -1, \"edgeWeight\": -1};\r\n\r\n\t\tlet maxGeneralDistance = tiles[tiles.length -1].generalDistance;\r\n\t\r\n\t\t//first elements are the closest to the general\r\n\t\tfor(let i = tiles.length - 1; i >= 0; i--) {\r\n\t\t\tlet tile = tiles[i];\r\n\t\t\tlet edgeWeight = gameMap.getEdgeWeightForIndex(tile.index);\r\n\r\n\t\t\t//general distance is not at maximum anymore. ignore other tiles\r\n\t\t\tif(tile.generalDistance < maxGeneralDistance) {\r\n\t\t\t\treturn optimalTile.index;\r\n\t\t\t}\r\n\r\n\t\t\t//a tile with maximum generalDistance and \r\n\t\t\tif(edgeWeight > optimalTile.edgeWeight) {\r\n\t\t\t\toptimalTile.index = tile.index;\r\n\t\t\t\toptimalTile.edgeWeight = edgeWeight;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//loop stopped, but optimal tile was found(meaning it was only 1 step away from general)\r\n\t\tif(optimalTile.index != -1) {\r\n\t\t\treturn optimalTile.index;\r\n\t\t} else {\r\n\t\t\tconsole.log(\"No tile found. Something is going wrong here!\");\r\n\t\t}\r\n\t}", "function setUpEnemyBoard() {\r\n let boardIndex = [];\r\n for (i=0; i < 10; i++) {\r\n boardIndex.push([])\r\n for (j=0; j < 10; j++) {\r\n boardIndex[i][j] = j;\r\n }\r\n }\r\n for (let ship in enemyShipState) {\r\n let row = null;\r\n let col = null;\r\n let squareAvailable = false;\r\n\r\n //This will decide if a random place on the board to place a ship is available to be placed.\r\n while (squareAvailable === false) {\r\n row = Math.floor(Math.random() * 10);\r\n col = Math.floor(Math.random() * 10);\r\n enemyShipState[ship].orientation = Math.floor(Math.random() * 2) ? 'horizontal' : 'vertical';\r\n\r\n //squareAvailable will start off as true and then the code below will set it to false if it fails the checks.\r\n squareAvailable = true;\r\n\r\n //Basically the randomly chosen squares are free if the ship 1) does not go over an edge and 2) a ship is not already there.\r\n if (((enemyShipState[ship].orientation === 'horizontal') && (col + enemyShipState[ship].health.length - 1) > 9) ||\r\n ((enemyShipState[ship].orientation === 'vertical') && (row + enemyShipState[ship].health.length - 1) > 9)) {\r\n //if the ship goes over the edge, squareAvailable is false.\r\n squareAvailable = false;\r\n } else {\r\n //If a ship is on one of the neighboring squares, set the squareAvailable to false.\r\n loopEachShipSquare(enemyShipState, ship, (element) => {\r\n let shipType = findShipType(element);\r\n if (shipType) {\r\n squareAvailable = false;\r\n };\r\n }\r\n , row, col);\r\n }\r\n }\r\n //finally, add the ship to the board.\r\n addShip(enemyShipState, ship, row, col);\r\n }\r\n}", "findLargestGroup(row)\n {\n var count = 0;\n var largest = 0;\n for (let i = 1; i <= this.rowLength; i++) // each seat in the row\n {\n if (this.isSeatFree(row, i) === true)\n count++; // Seat is free, count up\n\n if (this.isSeatFree(row, i) === false || i == this.rowLength) //seat is not free or is the last seat\n {\n if (count > largest) // Found a large grouping\n largest = count; // Save it\n //reset count, and keep checking\n count = 0;\n }\n }\n return largest; // Largest free group of seats\n }", "function bustSingles(arr, done) { \n let countIn = 0;\n while (countIn < 6) {\n for (let y = 0; y < arr.length; y++) { // Moving between items and searching zeros.\n for (let x = 0; x < arr[y].length; x++) {\n if (arr[y][x] === 0) {\n let range = [1, 2, 3, 4, 5, 6, 7, 8, 9];\n for (let m = 0; m < arr[y].length; m++) { // Searching range items on x.\n for (let h = 0; h < range.length; h++) {\n if (range[h] === arr[y][m]) {\n range.splice(h, 1);\n }\n }\n }\n for (let m = 0; m < arr[x].length; m++) { // Searching range items on y.\n for (let h = 0; h < range.length; h++) {\n if (range[h] === arr[m][x]) {\n range.splice(h, 1);\n }\n }\n } \n if (x < 3 && y < 3) { // Searching range items on squares.\n for (let k = 0; k < 3; k++) {\n for (let m = 0; m < 3; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n } \n }\n if (x >= 3 && x < 6 && y < 3) {\n for (let k = 0 ; k < 3; k++) {\n for (let m = 3; m < 6; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n } \n }\n if (x >= 6 && y < 3) {\n for (let k = 0 ; k < 3; k++) {\n for (let m = 6; m < 9; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n }\n }\n if (x < 3 && y >= 3 && y < 6) {\n for (let k = 3; k < 6; k++) {\n for (let m = 0; m < 3; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n } \n }\n if (x >= 3 && x < 6 && y >= 3 && y < 6) {\n for (let k = 3; k < 6; k++) {\n for (let m = 3; m < 6; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n }\n }\n if (x >= 6 && y >= 3 && y < 6) {\n for (let k = 3; k < 6; k++) {\n for (let m = 6; m < 9; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n } \n }\n if (x < 3 && y >= 6) {\n for (let k = 6; k < 9; k++) {\n for (let m = 0; m < 3; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n } \n }\n if (x >=3 && x < 6 && y >= 6) {\n for (let k = 6; k < 9; k++) {\n for (let m = 3; m < 6; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n }\n }\n if (x >= 6 && y >= 6) {\n for (let k = 6; k < 9; k++) {\n for (let m = 6; m < 9; m++) {\n for (let h = 0; h < range.length; h++) {\n if(range[h] === arr[k][m]) {\n range.splice(h, 1);\n }\n }\n } \n } \n }\n if(countIn === 5) { // On last turn on the loop define the range.\n arr[y][x] = range;\n }\n if (range.length === 1) { // If range heave only one item this item its single.\n arr[y][x] = range[0];\n }\n } \n }\n }\n countIn++\n }\n if (done) { // Recursion if done true.\n return bustHiddenSingles(arr);\n }\n return arr;\n }", "function Pocket () {\n let pocket = [];\n for (let z = 0; z < iterAmt*2+1; z++) {\n let layer = []\n for (let y = 0; y < iterAmt*2+startGrid.length; y++) {\n let row = []\n row = Array(iterAmt*2 + startGrid[0].length).fill(0).map(()=>{return{active:false,nearby:0}})\n layer.push(row)\n }\n pocket.push(layer)\n }\n return pocket\n}", "function nextGen(grid){\n const nextGen = grid.map( arr => [...arr]);\n \n for(let col = 0; col < grid.length; col++){\n for(let row = 0; row < grid[col].length; row++){\n const cell= grid[col][row];\n let numNeighbour = 0;\n for(let i= -1; i < 2 ; i++){\n for(let j= -1 ; j < 2 ; j++){\n if(i === 0 && j===0){\n continue; \n }\n const x_cell = col+i;\n const y_cell = row+j;\n if(x_cell >=0 && y_cell >0 && x_cell<COLS && y_cell < ROWS){\n let currentNeighbour = grid[col+i][row+j];\n numNeighbour += currentNeighbour;\n \n\n }\n }\n \n }\n\n\n // rules of life\n if(cell === 1 && numNeighbour < 2){\n nextGen[col][row] = 0; \n }else if(cell === 1 && numNeighbour > 3){\n nextGen[col][row] = 0;\n }else if(cell === 0 && numNeighbour === 3){\n nextGen[col][row] = 1;\n }\n\n\n }\n }\n return nextGen;\n\n}", "async function solveMaze() {\n // add start point in the openlist\n // point object convention: [x, y, p_x, p_y, g, h, f]\n openlist = [[0, 0, -1, -1, 0, 0, 0]];\n // initialize closedlist\n closedlist = [];\n var tilesFreeze = JSON.parse(JSON.stringify(tiles));\n var pathFound = false;\n // current node\n var q = 0; \n // Search the maze until a path from start to finish has been found or there is nowhere left to search. \n while (openlist.length > 0) {\n // pop the element from the beginnnig of the list \n // which also has the minimum f parameter in the open list\n q = getNode(openlist);\n \n // if the current node is our destination node, we are finished\n if ((q[0] == tileColumnCount - 1) && (q[1] == tileRowCount - 1)) {\n pathFound = true;\n break;\n }\n // put the current node in the closed list and look at all of its neighbors\n closedlist.push(q);\n\n // for each neighbour of the current node (9 iterations)\n for (var i = q[0] - 1; i <= q[0] + 1; i++) {\n for (var j = q[1] - 1; j <= q[1] + 1; j++) {\n // skip the current tile itself when scanning\n if (i == q[0] && j == q[1]) {\n continue;\n }\n // check if the neighbour is valid (if the tile is empty or finish)\n if ((i >= 0 && i < tileColumnCount) && (j >= 0 && j < tileRowCount)) {\n if (tilesFreeze[i][j].state === 'e' || tilesFreeze[i][j].state === 'f') {\n\n // value of g() for current node will be 1 more than its parent \n var g = JSON.parse(JSON.stringify(q[4])) + 1; \n \n var addNode = true;\n // if neighbour is already in the CLOSED list and has a higher g()\n // value than the new g, then replace its parent with current node\n var idx = search(i, j, closedlist);\n if (idx != -1) {\n if (g < closedlist[idx][4]) {\n console.log('Updated in closed');\n closedlist[k][2] = JSON.parse(JSON.stringify(q[0]));\n closedlist[k][3] = JSON.parse(JSON.stringify(q[1]));\n closedlist[k][4] = g;\n }\n continue;\n }\n \n // if neighbour is already in the OPEN list and has a higher g()\n // value than the new g, then replace its parent with current node\n // and recalculate and update its f() value\n idx = search(i, j, openlist);\n if (idx != -1) {\n if (g < openlist[idx][4]) {\n openlist[idx][2] = JSON.parse(JSON.stringify(q[0]));\n openlist[idx][3] = JSON.parse(JSON.stringify(q[1]));\n openlist[idx][4] = g;\n openlist[idx][6] = g + openlist[idx][5];\n }\n continue;\n }\n // if neighbour is not already present in open or closed list, \n // then add it to the openlist\n if (idx == -1) {\n var h = heuristic(i, j);\n var f = g + h;\n var successor = [i, j, JSON.parse(JSON.stringify(q[0])), JSON.parse(JSON.stringify(q[1])), g, h, f];\n openlist.unshift(JSON.parse(JSON.stringify(successor)));\n }\n }\n }\n }\n }\n }\n\n // if path not found, output no solution\n if (!pathFound) {\n output.innerHTML = 'No Solution';\n }\n // else mark the solution path\n else {\n // removing the first point in closed list which is the start point\n closedlist.shift();\n // get the parent of last point into x and y\n var x = closedlist[closedlist.length - 1][0];\n var y = closedlist[closedlist.length - 1][1];\n for (var i = closedlist.length-1; i >= 0; i--) {\n node = JSON.parse(JSON.stringify(closedlist[i]))\n if (closedlist[i][0] == x && closedlist[i][1] == y) {\n // 1 at last index means this the solution path\n closedlist[i].push(1);\n // fetch its parent\n x = closedlist[i][2];\n y = closedlist[i][3];\n }\n else {\n // 0 means visited tile\n closedlist[i].push(0);\n }\n }\n \n // set states to tiles for coloring them\n for (var x = 0; x < closedlist.length; x++) {\n if (closedlist[x][7] == 1) {\n tiles[closedlist[x][0]][closedlist[x][1]].state = 'x';\n }\n else if (closedlist[x][7] == 0) {\n tiles[closedlist[x][0]][closedlist[x][1]].state = 'v';\n }\n // sleep for 100ms\n await new Promise(r => setTimeout(r, 100));\n }\n // recolor the start and finish point just in case\n tiles[0][0].state = 's';\n tiles[tileColumnCount - 1][tileRowCount - 1].state = 'f';\n\n output.innerHTML = 'Solved!';\n }\n}", "function checkPlacement() {\r\n for(index of shipArray) {\r\n if(boardObj.message[index].ship != \"none\") { //If there is already a ship here...\r\n shipArray = finalShipArray.slice();\r\n return false; //...don't move the ship here!\r\n }\r\n }\r\n return true; //If all cells at the indices of shipArray are empty, then return true\r\n}", "function bestStepForSpot(col, row){\r\n\tvar cur_pos = [col, row];\r\n\tvar j = 0;\r\n\tvar pos = [];\r\n\tvar max_s = 0;\r\n\tvar s_n = 0; \r\n\tvar d_pos = [];\r\n\tfor (j = 0; j<POSSIBLE_MOVING.length; j++){\r\n\t\tpos = [cur_pos[0] + POSSIBLE_MOVING[j][0], cur_pos[1] + POSSIBLE_MOVING[j][1]]; \r\n\t\tif (outOfRange(pos[0], pos[1])) continue;\r\n\t\tif (game_field[pos[1]][pos[0]] == EMPTY){\r\n\t\t\ts_n = getScoreAfterStep(cur_pos, pos);\r\n\t\t\tif (s_n > max_s){\r\n\t\t\t\tmax_s = s_n;\r\n\t\t\t\td_pos = [POSSIBLE_MOVING[j][0], POSSIBLE_MOVING[j][1]];\r\n\t\t\t}\r\n\t\t}\t\r\n\t}\r\n\treturn [d_pos, max_s];\r\n}", "function fillRandomPlaces(){\r\n\tvar fillArray = [];//Initialize a local array\r\n\tfor (var i = 0; i < size; i++) { \r\n\t\tfor (var j = 0; j < size; j++) { \r\n\t\t\tif(grid[i][j]==0){\r\n\t\t\t\tfillArray.push({x:i,y:j});//Storing all the blocks with zero\r\n\t\t\t}\r\n\t\t} \r\n\t\t\r\n\t}\r\n\tvar rand = Math.random();//Getting a random value < 1 && > 0\r\n\tvar total = fillArray.length;//Length of all zero containing blocks\r\n\tvar randIndex = Math.floor(rand * total);//Getting a random Index\r\n\tvar randomGrid= fillArray[randIndex];//Getting one random spot\r\n\tgrid[randomGrid.x][randomGrid.y] = rand > 0.2 ? 2 : 4; //With 80% chance of 2 fill 2 or 4 on that empty spot\r\n}", "function allShips(){\nshipcoordinates=[];\nfor (var i = 0; i < GRID.length; i++){\n for (var j = 0; j < GRID[0].length; j++){\n if (GRID[i][j] == \"v\"){\n shipcoordinates.push(indexToChar(j)+ (i+1));\n }\n \n }\n}\nreturn shipcoordinates;\n}", "function bfs (grid, startX, startY, endX, endY) {\n // matrix to track visited (maybe not needed?)\n // 0 -> unvisited\n // 1 -> visited\n const visited = Array(grid.length).fill(0).map(row => new Array(grid[0].length).fill(0));\n \n // empty queue\n let queue = [];\n \n // maybe have a list that keeps track of the visited nodes... append the current node that we are examining\n let visitedList = [];\n \n // mark source square as visited in matrix and list\n visited[startX][startY] = 1;\n visitedList.push(grid[startX][startY]);\n \n // enqueue source square\n queue.push(grid[startX][startY]);\n\n // variable to store length of longest?? path from source to destination\n let min = Number.MAX_SAFE_INTEGER;\n\n // while queue is not empty\n while (queue.length !== 0) {\n // dequeue front node \n let current = queue.shift();\n\n /*\n <Square \n col={squareIndex} \n row={rowIndex} \n key={squareIndex} \n start={start} \n end={end} \n wall={wall} \n distance=0\n onClick={(row, col) => this.handleClick(row, col)}>\n </Square>\n */\n \n // get node coordinates and distance (do we need distance?) \n let x = current.row;\n let y = current.col;\n let dist = current.distance;\n \n // if node is destination, update the distance tracking variable and return ??\n if (x === endX && y === endY) {\n min = dist;\n return visitedList;\n }\n\n // x and y possible movements\n const xMove = [-1, 0, 0, 1];\n const yMove = [0, -1, 1, 0];\n \n // check for the 4 possible movements from current cell\n for (let i = 0; i < 4; i++) {\n // check if movement is valid \n if (isValid(grid, visited, x + xMove[i], y + yMove[i])) {\n // mark the nodes as visited\n visited[x + xMove[i]][y + yMove[i]] = 1;\n\n let next = grid[x + xMove[i]][y + yMove[i]];\n \n \n // update distance \n next.distance++;\n // enqueue the node representing valid movement \n queue.push(next);\n\n visitedList.push(next);\n // updating the previous node\n next.previous = current;\n }\n }\n }\n // if path not found returns empty list\n return [];\n}", "function getTop(grid) {\n if (!grid) return 0;\n let total = 0;\n for (let x=0;x<5;x++) total += grid[0][x] || 0;\n return total;\n}", "function bestSquareTiles(x, y, n) {\n //prevent div/0\n if (n === 0 || x === 0 || y === 0)\n return 0;\n var px = Math.ceil(Math.sqrt((n * x) / y));\n var sx = undefined;\n var sy = undefined;\n if (Math.floor((px * y) / x) * px < n) {\n sx = y / Math.ceil((px * y) / x);\n }\n else {\n sx = x / px;\n }\n var py = Math.ceil(Math.sqrt((n * y) / x));\n if (Math.floor((py * x) / y) * py < n) {\n sy = x / Math.ceil((x * py) / y);\n }\n else {\n sy = y / py;\n }\n var ret = Math.max(sx, sy);\n // console.log(\"kkkkkkkkkkkkkk ret\" + ret);\n return ret;\n}", "liveNeighbors(x, y) {\n x = parseInt(x)\n y = parseInt(y)\n\n let liveNeighbors = 0;\n\n liveNeighbors += this.getCell((x + parseInt(this.width) - 1) % parseInt(this.width), (y + parseInt(this.height) + 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width)) % parseInt(this.width), (y + parseInt(this.height) + 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) + 1) % parseInt(this.width), (y + parseInt(this.height) + 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) + 1) % parseInt(this.width), (y + parseInt(this.height)) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) + 1) % parseInt(this.width), (y + parseInt(this.height) - 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width)) % parseInt(this.width), (y + parseInt(this.height) - 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) - 1) % parseInt(this.width), (y + parseInt(this.height) - 1) % parseInt(this.height))\n\n liveNeighbors += this.getCell((x + parseInt(this.width) - 1) % parseInt(this.width), (y + parseInt(this.height)) % parseInt(this.height))\n\n return liveNeighbors\n }", "UpdateGrid(){\r\n for (let i = 0; i < this.size; i++){\r\n for(let j = 0; j < this.size; j++){\r\n this.countAdjacent(i, j);\r\n }\r\n }\r\n }" ]
[ "0.64079535", "0.6218261", "0.60234225", "0.5909205", "0.57952476", "0.57545716", "0.57543164", "0.56899416", "0.56549096", "0.56442755", "0.5643415", "0.5632637", "0.5629312", "0.56184286", "0.56154126", "0.56080747", "0.56049144", "0.5600821", "0.5574246", "0.55595684", "0.5558247", "0.5551904", "0.5543298", "0.55426466", "0.55402005", "0.5519048", "0.5507473", "0.5504149", "0.54653144", "0.5462695", "0.5453071", "0.5450033", "0.54470855", "0.5444876", "0.5438778", "0.54336697", "0.5430609", "0.54295135", "0.54269016", "0.5421735", "0.54061943", "0.5403306", "0.5402871", "0.54021806", "0.5400011", "0.53996724", "0.5398035", "0.5397423", "0.5385216", "0.5378702", "0.53767145", "0.5373477", "0.5369396", "0.53612745", "0.53610706", "0.53605765", "0.5358613", "0.53514844", "0.5349063", "0.5348551", "0.5347827", "0.53476137", "0.53453946", "0.5344985", "0.5341007", "0.53338665", "0.53338665", "0.5331417", "0.53300333", "0.532942", "0.532814", "0.53278106", "0.53277856", "0.53267026", "0.532411", "0.5318269", "0.53143275", "0.5313701", "0.53057456", "0.53056914", "0.53036815", "0.5299565", "0.5297383", "0.5295087", "0.52912873", "0.5282311", "0.5278209", "0.52701443", "0.5266025", "0.5260298", "0.52542174", "0.52512854", "0.5248177", "0.5245626", "0.52381676", "0.52377594", "0.5234202", "0.5233949", "0.52327865", "0.5229699" ]
0.624206
1
to get no of days in kgp
function no_of_days() { var d = new Date(), minutes = d.getMinutes().toString().length == 1 ? '0'+d.getMinutes() : d.getMinutes(), hours = d.getHours().toString().length == 1 ? '0'+d.getHours() : d.getHours(), ampm = d.getHours() >= 12 ? 'pm' : 'am', months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'], days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; var date2 = new Date("07/24/2017");//mm/dd/yyyy var timeDiff = Math.abs(date2.getTime() - d.getTime()); var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); return diffDays; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateDays() {\n const secondsInADay = 86400;\n let seconds = this.calculateSeconds();\n this.daysCount = seconds / secondsInADay;\n this.daysCount = Math.floor(this.daysCount);\n\n return this.daysCount;\n }", "numberOfDays(){\n return ((this.endDate - this.startDate)/(1000*60*60*24));//converting to days from milliseconds\n }", "function numberOfDays(){\n\t\t\t\t\t\t\t\t\tvar milliseconds;\n\t\t\t\t\t\t\t\t\tmilliseconds = nextBirthday.getTime() - today.getTime();\n\t\t\t\t\t\t\t\t\tvar minutes = 1000 * 60;\n\t\t\t\t\t\t\t\t\tvar hours = minutes * 60;\n\t\t\t\t\t\t\t\t\tvar days = hours * 24;\n\t\t\t\t\t\t\t\t\tvar daysToReturn = milliseconds / days;\n\t\t\t\t\t\t\t\t\tdaysToReturn = Math.ceil(daysToReturn);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tif(daysToReturn == 365){\n\t\t\t\t\t\t\t\t\t\tdaysToReturn = 0;\n\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\tconsole.log(\"Days until next birthday: \" + daysToReturn);\n\t\t\t\t\t\t\t\t\treturn daysToReturn;\n\t\t\t\t\t}", "function beautifulDays(i, j, k) {\r\n var z=0;\r\n var count=0\r\n for(var t=i;t<=j;t++){\r\n z =Number(('' + t).split('').reverse().join(''));\r\n console.log(z)\r\n \r\n var diff=Math.abs(t-z);\r\n \r\n if((diff)%k==0){\r\n count++\r\n }\r\n }\r\n return count;\r\n }", "function beautifulDays(i, j, k) {\n // Write your code here\n let count = 0\n for (let c = i; c <= j; c++) {\n let numToSttring = String(c)\n let ReverseNum = Number(numToSttring.split(\"\").reverse().join(\"\"))\n\n let diference = Math.abs(c - ReverseNum) / k\n\n if (diference % 1 === 0) count++\n }\n\n return count\n}", "daysBooked(){\n let daysBookedOff = 0\n for(let booking of this._booking){\n daysBookedOff+=booking.numberOfDays();\n }\n return daysBookedOff;\n }", "function countSundays(){\n\treturn Math.floor((12/7)*100);\n}", "elapsed_days(){\n return this.ticks / TICKS_PER_DAY; \n }", "function kiekDienuIkiKaledu() {\n console.log(\"266\");\n // siandienos data\n let today = new Date();\n // kaledu data\n let christmas = new Date(\"2021-12-24\");\n console.log(\"today\", today.toDateString(), \"christmas\", christmas.toDateString());\n\n // skirtumo tarp datu\n let diffMs = christmas - today;\n console.log(\"diffMs\", diffMs);\n // paversti ta skirtuma dienom\n let msToDays = diffMs / 1000 / 3600 / 24;\n // gaunam kiek pilnu dienu\n let wholeDays = Math.floor(msToDays);\n\n // panaudojom pagalbine funkcija\n //let wholeDays = daysDiff(today, christmas);\n\n // atspausdinti\n console.log(\"iki kaledu liko\", wholeDays, \"dienu\");\n}", "function getDays() {\n\treturn [...Array(31).keys()].map((index) => index + 1);\n}", "function getNDAYS(i_g_in, i_g_fin, i_m_in, i_m_fin) {\n\n var giorni_mese_in;\n if (i_m_in === 0) giorni_mese_in = 31;\n if (i_m_in === 1) giorni_mese_in = 29;\n if (i_m_in === 2) giorni_mese_in = 31;\n if (i_m_in === 3) giorni_mese_in = 30;\n if (i_m_in === 4) giorni_mese_in = 31;\n if (i_m_in === 5) giorni_mese_in = 30;\n if (i_m_in === 6) giorni_mese_in = 31;\n if (i_m_in === 7) giorni_mese_in = 31;\n if (i_m_in === 8) giorni_mese_in = 30;\n if (i_m_in === 9) giorni_mese_in = 31;\n if (i_m_in === 10) giorni_mese_in = 30;\n if (i_m_in === 11) giorni_mese_in = 31;\n\n n_giorno_in = i_g_in;\n n_giorno_fin = i_g_fin;\n\n var giorni;\n\n if (i_m_in === i_m_fin) giorni = (i_g_fin - i_g_in) ; // giorni del mese corrente\n else if (i_m_in !== i_m_fin) giorni = (i_g_fin + 1) + (giorni_mese_in - i_g_in -1); //giorni del mese precedente\n n_days = giorni+1;\n n_mese_in = i_m_in;\n n_mese_fin = i_m_fin;\n\n return giorni+1;\n}", "static getNumOfSpecialDays(start, end) {\n // Find the start and end Jewish years\n const jewishStartYear = new JewishCalendar_1.JewishCalendar(start).getJewishYear();\n const jewishEndYear = new JewishCalendar_1.JewishCalendar(end).getJewishYear();\n // Value to return\n let specialDays = 0;\n // Instant of special dates\n const yomKippur = new JewishCalendar_1.JewishCalendar(jewishStartYear, 7, 10);\n const tishaBeav = new JewishCalendar_1.JewishCalendar(jewishStartYear, 5, 9);\n // Go over the years and find special dates\n for (let i = jewishStartYear; i <= jewishEndYear; i++) {\n yomKippur.setJewishYear(i);\n tishaBeav.setJewishYear(i);\n const interval = luxon_1.Interval.fromDateTimes(start, end);\n if (interval.contains(yomKippur.getDate()))\n specialDays++;\n if (interval.contains(tishaBeav.getDate()))\n specialDays++;\n }\n return specialDays;\n }", "getDays() {\n return new Date(this.y, this.m, 0).getDate()\n }", "function getNoOfDays(createdDate){\n\tstartDate = new Date(createdDate);\n\ttodaysDate = new Date();\n\tvar days = Math.floor((todaysDate - startDate) / (1000 * 60 * 60 * 24));\n\treturn days;\n}", "function getDatepriordays(days){\n\t var today= new Date(); \n\t\t//today.setDate(today.getDate()-1)\n\t\tvar dayOfTheWeek=today.getDay();\n\t\tvar calendarDays = days;\n\t\tvar deliveryDay = dayOfTheWeek + days;\n\t\tif (deliveryDay >= 6) {\n\t\t\tdays -= 6 - dayOfTheWeek; //deduct this-week days\n\t\t\t//calendarDays += 2; //count this coming weekend\n\t\t\t//alert(\"calendarDays1=====>\"+calendarDays);\n\t\t\t//deliveryWeeks = Math.floor(days / 5); how many whole weeks?\n\t\t\t//alert(\"deliveryWeeks=====>\"+deliveryWeeks);\n\t\t\t//calendarDays += deliveryWeeks * 2; two days per weekend per week\n\t\t\t}\n\t\ttoday.setTime(today.getTime() + calendarDays * 24 * 60 * 60 * 1000); \t\t\n\t\tvar theyear=today.getYear() \n\t\tvar themonth=today.getMonth()+1 \n\t\tvar theday=today.getDate() \t\t \n\t\treturn theyear + '.' + getStringFormat(themonth,2) + '.' + getStringFormat(theday,2);\n\t}", "function getDate_n_DaysFromGiven(given,n,objRet){\n\nlet othday= new Number(given.getDate())\nothday+=n\ngiven.setDate(othday);\n\ndate_n_DaysFromGiven= objRet ? (\n new Date(given.getTime())\n ):(\n given.toLocaleDateString(undefined,{\n weekday:\"long\",\n day:\"numeric\",\n month:\"numeric\",\n year:\"numeric\"\n })+\" \"\n );\n\ngiven.setDate(Number(given.getDate())-n);\n\nreturn date_n_DaysFromGiven;\n}", "function calcTotalDayAgain() {\n var eventCount = $this.find('.this-month .event-single').length;\n $this.find('.total-bar b').text(eventCount);\n $this.find('.events h3 span b').text($this.find('.events .event-single').length)\n }", "function totalDays() {\n //Adds up the total number of days in sentence from combination of years, months and days.\n var years, months, days;\n years = document.donatello_form.sentenceYears.value;\n months = document.donatello_form.sentenceMonths.value;\n days = document.donatello_form.sentenceDays.value;\n return Math.floor(years * daysPerYear) + Math.floor(months * daysPerMonth) + Number(days);\n}", "function GetDays(){\n var startdate = new Date(document.getElementById(\"start_date\").value);\n var enddate = new Date(document.getElementById(\"end_date\").value);\n return parseInt((enddate - startdate) / (24 * 3600 * 1000));\n }", "function howManyDays (anyDate){\n let currentDate = ((new Date()).getDate())\n let remainingDays = currentDate - anyDate\n return remainingDays / (1000*60*60*24)\n}", "function get_wn() {\r\n \tvar today = new Date();\r\n\tYear = takeYear(today);\r\n\tMonth = today.getMonth();\r\n\tDay = today.getDate();\r\n\tnow = Date.UTC(Year,Month,Day+1,0,0,0);\r\n\tvar Firstday = new Date();\r\n\tFirstday.setYear(Year);\r\n\tFirstday.setMonth(0);\r\n\tFirstday.setDate(1);\r\n\tthen = Date.UTC(Year,0,1,0,0,0);\r\n\tvar Compensation = Firstday.getDay();\r\n\tif (Compensation > 3) Compensation -= 4;\r\n\telse Compensation += 3;\r\n\tweek_num = Math.round((((now-then)/86400000)+Compensation)/7);\r\n\tday_num = Math.round(((now-then)/86400000)+Compensation);\r\n\tday_nos = Math.round((now-then)/86400000);\r\n}", "function getTotalDays(y, m){\r\n\t\t\treturn new Date(y, m, 0).getDate();\r\n\t\t}", "function days_in_b_year(yr,mo,da){\n if (mo <= 12){\n var days=0;\n for(mo ; mo<=12 ;mo++){\n var days = days + dayslist[mo];\n }\n var days = days - da\n return days\n }\n\n}", "get workingDays() {\n return this.detailedDailyWage.filter(day => day.wage!==0).length;\n }", "function getVerseOfTheDayPicture() {\n \n let today = new Date();\n let year = today.getFullYear();\n var janFirst = new Date(year, 0, 1, 1, 1, 1, 1);\n var days = daydiff(janFirst,today);\n\n var dailyVersePictureToGet = Math.ceil((((days / 23) - Math.floor((days / 23)))) * 23);\n \n console.log(dailyVersePictureToGet);\n \n return dailyVersePictureToGet;\n}", "function countShowingfreeDays(){\n return document.querySelectorAll(\".weekend-header\").length\n}", "function countRealWorkingTime(wantedProcentageAsInt, fullWorkDayNumber){\n let originalArray = []\n \n let wantedProcentageInDouble = wantedProcentageAsInt/100\n let currentWorkDayLength = Math.trunc(fullWorkDayMinutes*wantedProcentageInDouble)\n let allValues = document.querySelectorAll(\".header-balance-part\")\n //Counts total of days showing currently on kellokortti by counting the plus icons on right side of each day working time marking\n let howManyDaysIsShowing = document.querySelectorAll(\".float-right.glyphicon.glyphicon-plus-sign\").length\n //let workingDaysCount = howManyDaysIsShowing-countShowingfreeDays()\n originalArray = preProcessOriginalArray(allValues, originalArray) \n let combinedArray = createCombinedArray(originalArray)\n let minutesArray = transformArrayToMinutes(combinedArray, currentWorkDayLength, fullWorkDayNumber)\n let total = gainTotalBalance(minutesArray)\n return returnTotalHoursAndMinutesAsString(total)\n}", "function howManyDays(month) {\n switch (month) {\n case 2:\n return 28;\n case 4:\n case 6:\n case 9:\n case 11:\n return 30;\n }\n return 31;\n}", "createThirtyDays(e) {\n let dates = [];\n for (const [key,] of Object.entries(e)) {\n dates.push(key);\n }\n let sortedDates = dates.sort((a,b) => a.valueOf() - b.valueOf());\n let sortedThirty = sortedDates.slice(0,30);\n return sortedThirty;\n }", "function getDayCompletion(){\n return (Date.now() / 1000 / 60 / 60 / 24) % 1;\n}", "function deliveryDaysGet() {\n\tvar sum = 0;\n\t$('[data-subscription-binding=\"delivery_days\"] input[type=\"checkbox\"]:checked').each(function() {\n\t\tsum += +$(this).val();\n\t});\n\treturn sum;\n}", "function calc_days(a, b) {\r\n const utc1 = new Date(a);\r\n const utc2 = new Date(b);\r\n return Math.floor(utc2 - utc1) / (1000 * 60 * 60 * 24);\r\n}", "function getGEQIntervalInDays(eventGenerator) {\n return eventGenerator.intervalYear * 366 +\n eventGenerator.intervalMonth * 31 +\n eventGenerator.intervalDay;\n}", "function days(oldDate, actualDate) {\n try {\n var fechaini = new Date(oldDate);\n var fechafin = new Date(actualDate);\n var diasdif = fechafin.getTime() - fechaini.getTime();\n var contdias = Math.round(diasdif / (1000 * 60 * 60 * 24));\n return contdias;\n } catch (error) {\n console.log(error);\n }\n}", "function getTripLength(depDate, retDate) {\n const depDateSeconds = Date.parse(depDate);\n const retDateSeconds = Date.parse(retDate);\n const diff = Math.abs(depDateSeconds - retDateSeconds);\n const tripLength = Math.ceil(diff / (1000 * 3600 * 24));\n return tripLength;\n}", "function getDays(testDate) {\n \tvar myBirthday = testDate;\n \ttoday = new Date(2012, 8, 20);\n \tvar one_day = 1000 * 60 * 60 * 24;\n \tconsole.log(Math.ceil((today.getTime() - myBirthday.getTime()) / (one_day)) + \" days have gone by since \" + testDate)\n}", "function getRentDays(beginDate, returnDate)\n{\n var days = {} \n var beginDate = new Date(beginDate);\n var returnDate = new Date(returnDate);\n var tmp = returnDate - beginDate;\n tmp = Math.floor(tmp/1000); // Différence en secondes \n days.sec = tmp % 60; // nb entier\n\n tmp = Math.floor((tmp-days.sec)/60); // Différence en minutes\n days.min = tmp % 60; // nb entier\n\n tmp = Math.floor((tmp-days.min)/60); // Différence en heures\n days.hour = tmp % 24; // nb entier\n\n tmp = Math.floor((tmp-days.hour)/24); // Différence en jours\n days.day = tmp;\n return days.day;\n}", "getReqPerTime() {\n let sum_time = 0.0\n let dif = 0.0\n for (let d = 0; d < this.state.data.length; d++) {\n dif = new Date(this.state.data[d].dt_end_log).getTime() - new Date(this.state.data[d].dt_Start_Log).getTime()\n sum_time += dif / 1000\n }\n \n return (sum_time / this.state.data.length)\n }", "function totalDaysWorked(noOfDays,dailyWage)\n{\n if(dailyWage>0)\n {\n return noOfDays+=1;\n }\n return noOfDays;\n}", "function antiguedadGrado(fecha, fecha_retiro){ \n var arr = [];\n \n var fecha_r = fecha_retiro.split(\"-\");\n var ano_r = fecha_r[0];\n var mes_r = fecha_r[1];\n var dia_r = fecha_r[2];\n\n var list = fecha.split(\"-\");\n var ano = list[0];\n var mes = list[1];\n var dia = list[2];\n\n if (dia_r < dia){\n dia_dif = (dia_r+30) - dia; //27 -5\n mes_r--;\n }else{\n dia_dif = dia_r - dia; //27 -5\n }\n\n if (mes_r < mes){\n mes_dif = (mes_r + 12) - mes; //27 -5\n ano_r--;\n }else{\n mes_dif = mes_r - mes;\n }\n\n ano_dif = ano_r - ano;\n arr['e'] = ano_dif;\n\n if(mes_dif > 5) {\n arr['n'] = ano_dif + 1;\n }else{\n arr['n'] = ano_dif;\n }\n\n //console.log(arr);\n return arr;\n\n}", "daysRemaining(){\n for(let booking of this._booking){\n this.holidayAllowance-=booking.numberOfDays();\n }\n return this.holidayAllowance;\n }", "function getPelnas() {\nvar pajamos = 12500;\nvar islaidos = 18500;\nvar pelnas = pajamos - islaidos;\nreturn pelnas;\n}", "function evaporator(content, evap_per_day, threshold) {\n let remaining = 100;\n let days = 0;\n while (remaining > threshold) {\n days += 1;\n remaining -= remaining*evap_per_day/100;\n }\n return days;\n}", "function count(elem){\n var $e = $(elem);\n\tif($e.length==0){\n\t\treturn 0;\n\t};\n\n\t//CountDown\n var dateOfBeginning = new Date(),\n dateOfEnd = $e.closest('[data-end-date]').attr('data-end-date') || new Date((new Date()).getTime() + 3*30*24*3600*1000);\n\n countDown(dateOfBeginning, dateOfEnd); \n\n}", "daysBookedAndAutorized(){\n let num = 0;\n this._booking.filter(function(obj){\n if(obj.authorized == true){\n num+=obj.numberOfDays();\n }\n })\n return num;\n }", "function elapsedDays(dateText) {\r\n var ms2day = 1/(1000*60*60*24);\r\n var today = new Date();\r\n try {\r\n var startDate = new Date(Date.parse(dateText));\r\n if (today.getYear() == startDate.getYear()\r\n \t\t&& today.getMonth() == startDate.getMonth()\r\n \t\t&& today.getDate() == startDate.getDate()) {\r\n \treturn 0;\r\n \t} else {\r\n \treturn Math.round((today - startDate)*ms2day) - 1;\r\n }\r\n } catch (ex) {\r\n log(\"Error in elaspedDays: \" + ex);\r\n }\r\n}", "daysFromNow(d) {\n return Math.ceil((this.beginningOfDay(d).getTime() - this.beginningOfDay(new Date()).getTime()) / 86400000);\n }", "function calculate_hijri_days(hijri_array) {\n var total_h_days = 0;\n var h_year = hijri_array[1];\n var h_month = 0;\n var h_day = 0;\n for (var i = 2; i < 14; i++) {\n h_day = (g_date_diff + 1) - total_h_days;\n total_h_days = (hijri_array[i] == 1) ? total_h_days += 30 : total_h_days += 29;\n if (total_h_days > g_date_diff) {\n h_month = i - 1;\n break;\n }\n }\n return ([h_year, h_month, h_day, d_day_no]);\n}", "forAllDays() {\n if (this.breakDown() !== 'No Information to display') {\n let totalCost = this.breakDown().reduce((acc, item) => acc += item.totalCost, 0)\n return totalCost || 0;\n }\n }", "function howManyTimes(annualPassPrice, singlePassPrice) {\n let amountOfDays;\n\n /*This asigns to 'amountOfDays' the minnimun amount of days to take advantage of the annual pass*/\n amountOfDays = (Math.floor(annualPassPrice / singlePassPrice) + 1);\n\n /*This compares if the amount of days are lower than 365, or the price of the single pass is lower\n than the price of the annual pass, if don't, theres no advantage*/\n if (amountOfDays >= 365 || annualPassPrice <= singlePassPrice) {\n amountOfDays = 0;\n }\n\n return amountOfDays;\n}", "function DefWeekNum(dd)\n{\nnumd = 0;\nnumw = 0;\nfor (n=1; n<QueryMonth; n++)\n{\nnumd += MonthLength[n];\n}\nnumd = numd + dd - (9 - DefDateDay(QueryYear,1,1));\nnumw = Math.floor(numd / 7) + 1;\n\nif (DefDateDay(QueryYear,1,1) == 1) { numw++; }\nreturn numw;\n}", "function calculateLapsedDays() {\r\n var today = new Date();\r\n var yearBeginning = new Date(today.getFullYear(),00,01);\r\n var diffDays = parseInt((today - yearBeginning) / (1000 * 60 * 60 * 24), 10); \r\n document.getElementById(\"answer2\").innerHTML = \"Number of days passed since the beginning of the year is: \" + diffDays;\r\n}", "function ageInDays(timeStamp) {\n const nowTimeStamp = new Date().getTime();\n const daysNum = (nowTimeStamp - timeStamp)/(24*60*60*1000);\n return Math.round(daysNum);\n}", "dailyKm(km, year) {\n return dailyKm(km,year)\n }", "function findDaysInMonth () {\n\tdaysInMonth = months[month].days; // find number of days in month in the pseudo data base\n}", "gregorianToDay(gy, gm, gd) {\r\n let day = div((gy + div(gm - 8, 6) + 100100) * 1461, 4) + div(153 * mod(gm + 9, 12) + 2, 5) + gd - 34840408;\r\n day = day - div(div(gy + 100100 + div(gm - 8, 6), 100) * 3, 4) + 752;\r\n return day;\r\n }", "function diffDays(d1, d2)\n{\n let ndays;\n var tv1 = d1.valueOf(); // msec since 1970\n var tv2 = d2.valueOf();\n\n ndays = (tv2 - tv1) / 1000 / 86400;\n ndays = Math.round(ndays - 0.5);\n // return ndays;\n return 1;\n}", "function day_counter(){\n // get element\n let counter = document.getElementById(\"conteo\");\n // get last action's date\n let last_act = new Date(db_verguenza[db_verguenza.length-1].date);\n // calculate difference in days with now\n let today = new Date();\n let time_dif = Math.abs(last_act.getTime() - today.getTime());\n let days_dif = Math.floor( time_dif/(1000*60*60*24) );\n // overwrite the number\n counter.textContent = \" \" + days_dif + \" \";\n}", "function totalDaysWorked(numOfDays, dailyWage){\n if (dailyWage > 0) return numOfDays+1;\n return numOfDays;\n}", "function n_weeks(weekday, jd, nthweek)\n {\n var j = 7 * nthweek;\n\n if (nthweek > 0) {\n\t j += previous_weekday(weekday, jd);\n } else {\n\t j += next_weekday(weekday, jd);\n }\n return j;\n }", "function day_in_this_year(yr,mo,da){\n\n var spend=0;\n for(let i =1 ; i<mo ;i++){\n var spend = spend + dayslist[i];\n }\n\n var spend = spend + (da-1);\n return spend;\n}", "getDayNumerals(date) { return `${date.day}`; }", "function daysWorked(noOfDays, dailyWage) {\n if (dailyWage > 0) return noOfDays + 1;\n return noOfDays;\n}", "function dateNbDays(a0, a, p) {\n // Bankers use 360 day year, so the daily percent is set like this (360 * 100)\n let dailyRate = p / 36000\n let days = 0\n // Determine the number of days it will take to reach \"a\"\n while (a0 < a) {\n a0 = a0 * (1 + dailyRate)\n days++\n }\n // Set Date to January 1, 2016\n var targetDate = new Date(\"2016-01-01\")\n // Add the number of days need to set date\n targetDate.setDate(targetDate.getDate() + days)\n // String version of Year\n var y = targetDate.getFullYear(targetDate).toString();\n // String version of Month (Added 1 because month index at 0)\n var m = (targetDate.getMonth(targetDate) + 1).toString();\n // Add \"0\" in front of \"m\" if it is a single digit value\n m = m.length === 1 ? '0' + m: m\n // String version of Day\n var d = targetDate.getDate(targetDate).toString();\n // Add \"0\" in front of \"d\" if it is a single digit value\n d = d.length === 1 ? '0' + d: d\n // Add y, m, and d together with \"-\" in between them\n return y + \"-\" + m + \"-\" + d\n\n}", "function daysTill(e) {\n var eventE = new Date(e);\n var today = new Date();\n return dateDiffInDays(today, eventE);\n}", "function days_left(x, text){\n if (BD < date1){\n return Math.ceil((BD.valueOf() + 365 - date1.valueOf())/86400000)\n /*return BD + 365 - date1;*/\n }else{\n /*return BD - date1;*/\n return Math.ceil((BD.valueOf() - date1.valueOf())/86400000)\n };\n}", "function calcDays(start, end) {\n let date1 = new Date(start);\n let date2 = new Date(end);\n let Difference_In_Time = date2.getTime() - date1.getTime();\n let Difference_In_Days = Difference_In_Time / (1000 * 3600 * 24);\n return Difference_In_Days;\n}", "calculateDaysUsed(){\n\t \n\t /*Get today's date*/\n\t const todayDate = new Date();\n\n\t /*loop through each element/object in the cases array calculating the days between the last status change and the current day. This number is assign to the cases daysUsed attribute of cases object.*/\n\t cases.forEach(function(files, index){\n\t\t \t \n\t\t/*convert the startDate of files from a string into milliseconds*/ \n var currentCaseStartDate = Date.parse(files.startDate);\t\n\t\t\n\t \t/*Subtract today's date in milliseconds from startDate in milliseconds. Use the Math function to convert to its absolute value*/\n\t \tvar numberOfMilliseconds = Math.abs(todayDate.getTime() - currentCaseStartDate);\t\t\t \n\t \n\t /*Divide the numberOfMilliseconds varible by a algorithm of a day. Use the Math.ceil function to convert to the smallest number of a given number*/\n\t var daysUsed = Math.ceil(numberOfMilliseconds/(1000*3600*24));\n\t\t \n\t\t/*assign the number of days used since last status change to current case*/ \n\t \tcases[index].daysUsed = daysUsed;\n\t });\n }", "function dayDiff(first, second) {\n return (second-first)/(1000*60*60*24);\n }", "function amountOfDays(year, month) {\r\n return (new Date(year, month, 0).getDate());\r\n}", "function kabisats(year) {\n var kabcount = 0;\n for(var i=1900; i<year; i++) {\n if(iskabisat(i))\n kabcount++;\n }\n return kabcount;\n}", "function CalculateDaysDiff(day1, day2){\n \n var localOutput = day2 - day1;\n\n console.log(\"running days: \" + localOutput);\n return localOutput;\n }", "function get_clear_timestamp_frequency(length)\n{\n\tconsole.log(\"Length : \" + length);\n\tday1 = 1440 / 5;\n\tday2 = day1 * 2;\n\tday3 = day1 * 3;\n\n\tif (length <= day1)\n\t{\n\t\treturn 15;\n\t}\n\telse if (length <= day2)\n\t{\n\t\treturn 30;\n\t}\n\telse if (length <= day3)\n\t{\n\t\treturn 0;\n\t}\n\telse\n\t{\n\t\treturn 0;\n\t}\n}", "getDaysPerMonth(month, year) {\n year = year + Math.floor(month / 13);\n month = ((month - 1) % 12) + 1;\n let length = 29 + month % 2;\n if (month === 12 && isIslamicLeapYear(year)) {\n length++;\n }\n return length;\n }", "function z(a){return G.start.clone().add(a,\"days\")}", "function myDays(days){\n let horas = days * 24;\n let minutes = horas * 60;\n let seconds = minutes * 60;\n return seconds;\n // return days * 24 * 60 * 60;\n}", "function n_weeks(weekday, jd, nthweek) {\n var j = 7 * nthweek;\n if (nthweek > 0) {\n j += previous_weekday(weekday, jd);\n } else {\n j += next_weekday(weekday, jd);\n }\n return j;\n}", "function countDown(endtime) {\n let time = Date.parse(endtime) - Date.parse(new Date());\n let seconds = Math.floor((time / 1000) % 60);\n let minutes = Math.floor((time / 1000 / 60) % 60);\n let hours = Math.floor((time / (1000 * 60 * 60)) % 24);\n let days = Math.floor(time / (1000 * 60 * 60 * 24));\n\n return {\n total: time,\n days: days,\n hours: hours,\n minutes: minutes,\n seconds: seconds\n };\n }", "function get_date_diff(start,end)\n{\n\tvar date1 = start;\n\tvar dat = date1.replace(/-/g,'/');\n\tvar date1 = new Date(dat);\n\tvar date2 = new Date(end);\n\tvar timeDiff = date2.getTime() - date1.getTime();\n\tvar diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); \n\treturn diffDays;\n}", "function kelintadienis(date) {\n // pasiimti data\n let my_date = new Date(date);\n // patikrinti kelintadienis yra ta diena\n // getDay() - grazina skaiciu nuo 0 iki 6\n let daySk = my_date.getDay();\n console.log(\"daySk\", daySk);\n // paversi kelintadienis skaiciu i savaites dienos pavadinima\n let weekDay = dayToWeekDay(daySk);\n console.log(`jusu pasirinkta data: ${date} savaites diena: ${weekDay}`);\n}", "function getDaysPerMonth(monat,jahr){\n\tif (monat==2){// Februar\n\t\tif (jahr % 4){\n\t\t\treturn 28;\n\t\t}else{\n\t\t\treturn 29;\n\t\t}\n\t}else{\n\t\treturn MonatsTage[monat-1];\n\t}\n}//#", "earthAgeInDays(){\n var years = new Date();\n const EarthAge = years.getFullYear() - this.year;\n return EarthAge * 365;\n }", "function calculatedayOfweek(){\n year = document.getElementById(\"year\").value;\n var CC = parseInt(year.substring(0,2));\n var YY = parseInt(year.substring(2,4));\n month = parseInt(document.getElementById(\"month\").value);\n day = parseInt(document.getElementById(\"date\").value);\n //Zellar Algorithms\n d = ( ( (CC/4) -2*CC-1) + ( (5*YY/4) ) + ((26*(month+1)/10) ) + day)%7;\n console.log(d);\n return (Math.floor(d));\n}", "function dateDiff() {\n\n var start = $('#startDate').datepicker('getDate');\n var end = $('#endDate').datepicker('getDate');\n var days = (end - start)/1000/60/60/24;\n\n console.log(days);\n return days;\n}", "function B(a){return a.clone().stripTime().diff(G.start,\"days\")}", "function getkCal(nutrients) {\n let calories = nutrients.ENERC_KCAL.quantity;\n return calories;\n}", "function numOfDaysInMon(y,m) {\n return new Date(y,m,0).getDate();\n}", "function totalDaysWorked(numofDays, dailyWage) {\r\n if (dailyWage > 0) return numofDays + 1;\r\n return numofDays;\r\n}", "function displayK8sAge(created) {\n var now = moment__WEBPACK_IMPORTED_MODULE_0___default()(new Date());\n var end = moment__WEBPACK_IMPORTED_MODULE_0___default()(created);\n var duration = moment__WEBPACK_IMPORTED_MODULE_0___default.a.duration(now.diff(end));\n return duration.humanize();\n}", "function daysInThisMonth(m){\r\n\tvar daysInMonths = getDaysInMonths();\r\n\tvar daysInThisMonth = daysInMonths[schdlr.workingMonth]; //get this month's number of days.\r\n\treturn daysInThisMonth; //give it back\r\n}", "obliquityEcliptic() {\n let jd = this.julianDate(2010, 1, 0);\n let centuries = (jd - 2451545) / 36525;\n let daysElapsed = 46.815 * centuries + 0.0006 * Math.pow(centuries, 2) - 0.00181 * Math.pow(centuries, 3);\n return 23.439292 - daysElapsed / 3600;\n }", "function totalDaysWorked(numOfDays, dailyWage) {\n if (dailyWage > 0)\n return numOfDays+1;\n return numOfDays;\n}", "function NumberDay(idJour){\n if(idJour === 0) return 7;\n\n else return idJour;\n}", "function computeNoOfDays(startDate,endDate,compSwAddtl)\t{\n\tvar noOfDays = \"\";\n\tif (startDate == \"\" || endDate == \"\") {\n\t\treturn noOfDays;\n\t} else {\n\t\tvar addtl = 0;\n\t\tif (\"Y\" == compSwAddtl) {\n\t\t\taddtl = 1;\n\t\t} else if (\"M\" == compSwAddtl) {\n\t\t\taddtl = -1;\n\t\t}\n\t\tvar iDateArray = startDate.split(\"-\");\n\t\tvar iDate = new Date();\n\t\tvar date = parseInt(iDateArray[1], 10);\n\t\tvar month = parseInt(iDateArray[0], 10);\n\t\tvar year = parseInt(iDateArray[2], 10);\n\t\tiDate.setFullYear(year, month-1, date);\n\n\t\tvar eDateArray = endDate.split(\"-\");\n\t\tvar eDate = new Date();\n\t\tvar edate = parseInt(eDateArray[1], 10);\n\t\tvar emonth = parseInt(eDateArray[0], 10);\n\t\tvar eyear = parseInt(eDateArray[2], 10);\n\t\teDate.setFullYear(eyear, emonth-1, edate);\n\n\t\tvar oneDay = 1000*60*60*24;\n\t\tnoOfDays = Math.floor((parseInt(Math.floor(eDate.getTime() - iDate.getTime()))/oneDay)) + addtl;\n\t}\n\treturn (isNaN(noOfDays) ? \"\" : noOfDays);\n}", "function countdown(date){\n console.log(\"begin countdown\");\n let today = new Date();\n //console.log(today);\n let depDate = new Date(date);\n //console.log(depDate);\n let dif = depDate.getTime() - today.getTime();\n let days = dif/(1000 * 3600 * 24);\n days = Math.round(days);\n console.log(\"countdown returns \" + days);\n return days;\n}", "function JtoG($, _, n, y) { function a($, _) { return Math.floor($ / _) } for ($g_days_in_month = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31), $j_days_in_month = new Array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29), $jy = $ - 979, $jm = _ - 1, $jd = n - 1, $j_day_no = 365 * $jy + 8 * a($jy, 33) + a($jy % 33 + 3, 4), $i = 0; $i < $jm; ++$i)$j_day_no += $j_days_in_month[$i]; for ($j_day_no += $jd, $g_day_no = $j_day_no + 79, $gy = 1600 + 400 * a($g_day_no, 146097), $g_day_no %= 146097, $leap = !0, 36525 <= $g_day_no && ($g_day_no-- , $gy += 100 * a($g_day_no, 36524), $g_day_no %= 36524, 365 <= $g_day_no ? $g_day_no++ : $leap = !1), $gy += 4 * a($g_day_no, 1461), $g_day_no %= 1461, 366 <= $g_day_no && ($leap = !1, $g_day_no-- , $gy += a($g_day_no, 365), $g_day_no %= 365), $i = 0; $g_day_no >= $g_days_in_month[$i] + (1 == $i && $leap); $i++)$g_day_no -= $g_days_in_month[$i] + (1 == $i && $leap); return $gm = $i + 1, $gd = $g_day_no + 1, y && null != y ? $gy + \"/\" + $gm + \"/\" + $gd : { y: $gy, m: $gm, d: $gd } }", "function totalDaysWorked(numofDays, dailyWage) {\n if (dailyWage > 0) numofDays++;\n return numofDays;\n}", "function ms_days(year, month, day) {\n return JulianDay(year, month, day) - JulianDay(1899, 12, 30);\n}", "function getVerseOfTheDay() {\n \n let today = new Date();\n let year = today.getFullYear();\n var janFirst = new Date(year, 0, 1, 1, 1, 1, 1);\n var days = daydiff(janFirst,today);\n\n var dailyVerseToGet = Math.ceil((((days / text3.Verse.length) - Math.floor((days / text3.Verse.length)))) * text3.Verse.length);\n \n console.log(dailyVerseToGet);\n \n return text3.Verse[dailyVerseToGet];\n}", "function getTotal(days){\n var total = days * 40;\n if(days >= 3 && days < 7){\n total -= 20;\n }\n if(days >= 7){\n total -= 50;\n }\n\n return total;\n\n}" ]
[ "0.67897034", "0.65952903", "0.6536408", "0.6521484", "0.61982596", "0.61929715", "0.6138811", "0.60371274", "0.59765095", "0.59604055", "0.59576684", "0.5890101", "0.58603126", "0.58555025", "0.58413243", "0.58301485", "0.58148503", "0.5812444", "0.58109355", "0.5765538", "0.575764", "0.5757406", "0.5715933", "0.569224", "0.5688322", "0.56813455", "0.5662334", "0.56621504", "0.56499743", "0.5633641", "0.56256485", "0.56226987", "0.5607054", "0.5601406", "0.55983454", "0.5593138", "0.55917203", "0.55680335", "0.5560856", "0.55429447", "0.5542739", "0.5539411", "0.553803", "0.5537831", "0.553675", "0.55349725", "0.5523443", "0.55216426", "0.55154794", "0.5514056", "0.55127656", "0.55066526", "0.55046976", "0.5498845", "0.5488211", "0.5472096", "0.54672295", "0.5445727", "0.5445253", "0.5441745", "0.5434031", "0.54282695", "0.54227954", "0.54034394", "0.54033387", "0.5395944", "0.53953654", "0.53946435", "0.5389243", "0.5387592", "0.5382549", "0.5382243", "0.53816223", "0.5378509", "0.5373138", "0.53721863", "0.5365557", "0.5352891", "0.5347102", "0.53460556", "0.53364503", "0.5335783", "0.5323047", "0.53225213", "0.531802", "0.5315465", "0.5313662", "0.5312724", "0.5306021", "0.5304322", "0.528779", "0.5282687", "0.52820253", "0.52787936", "0.52750754", "0.5274414", "0.5273819", "0.526433", "0.5263941", "0.5256193" ]
0.6867405
0
Worked, remaining, or overtime hours.
function createBar(type, percent, label) { return $('<div />', { 'class': type, 'style': 'width: ' + percent + '%;', 'text': label }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extraTime(hoursWorked, contractTime) {\r\n extraHours = hoursWorked - contractTime;\r\n return extraHours;\r\n}", "function getIdealSleepHours() {\n const idealHours = 8 * 7;\n return idealHours;\n}", "function GetWorkingHrs(empCheck)\n{\n switch(empCheck)\n {\n case IS_PRESENT_FULL_TIME:\n return FULL_TIME_HOURS;\n break;\n case IS_PRESENT_PART_TIME:\n return PART_TIME_HOURS;\n break;\n default:\n return 0;\n break;\n }\n}", "function hoursWorkedOnDate(employeeRec, date) {\n let timeIn = employeeRec.timeInEvents.find(event => event.date === date);\n let timeOut = employeeRec.timeOutEvents.find(event => event.date === date);\n let hoursWorked = (timeOut.hour - timeIn.hour)/100;\n return hoursWorked;\n}", "function getWorkingHours(empCheck) {\n switch(empCheck){\n case IS_PART_TIME:\n return PART_TIME_HOURS;\n case IS_FULL_TIME:\n return FULL_TIME_HOURS;\n default:\n return 0;\n }\n}", "get satisfied() {\n return this.taken >= this.take && this.hours >= this.min_hours;\n }", "function getWorkingHours(empCheck) {\r\n\r\n switch (empCheck) {\r\n case 1:\r\n return parttimeHrs;\r\n break;\r\n case 2:\r\n return fulltimeHrs;\r\n break;\r\n default:\r\n return 0;\r\n }\r\n}", "function getWorkingHours(empCheck){\n switch (empCheck){\n case IS_PART_TIME:\n return PART_TIME_HOUR; \n case IS_FULL_TIME:\n return FULL_TIME_HOUR; \n default:\n return 0;\n }\n}", "function getActualSleepHours() {\n const totalSleep = getSleepHours(\"monday\") + getSleepHours(\"tuesday\") + getSleepHours(\"wednesday\") + getSleepHours(\"thursday\") + getSleepHours(\"friday\") + getSleepHours(\"saturday\") + getSleepHours(\"sunday\");\n return totalSleep;\n}", "function get_time_left() {\n return (escrow_amount / price_per_second) - time_spent;\n}", "isWorkingHours(time){\n let date = new Date(time);\n if(date.getHours() >= 6 && date.getHours() < 18){\n return true;\n }\n return false;\n }", "function GettingWorkingHours(empCheck)\n{\n switch(empCheck) {\n case IS_FULL_TIME:\n return FULL_TIME_HOURS;\n break;\n case IS_PART_TIME:\n return PART_TIME_HOURS;\n break;\n default:\n return 0; \n } \n}", "function getWorkingHours(empCheck){\n switch (empCheck){\n case IS_PART_TIME:\n return PART_TIME_HOURS;\n\n case IS_FULL_TIME:\n return FULL_TIME_HOURS;\n\n default:\n return 0;\n }\n} //UC3 Function created", "onChange(startTime, endTime, breakTime) {\n\t\tlet workHours = 0;\n\t\tif (endTime && startTime) {\n\t\t\tlet gap = 0;\n\t\t\tlet startDate = new Date(\"2019-07-09T\" + startTime + \"Z\");\n\t\t\tlet endDate = new Date(\"2019-07-09T\" + endTime + \"Z\");\n\t\t\tgap = endDate - startDate;\n\t\t\tworkHours = (gap / 1000 / 60 / 60).toFixed(2);\n\t\t}\n\t\tif (breakTime) {\n\t\t\tworkHours = (workHours - breakTime / 60).toFixed(2);\n\t\t}\n\t\treturn workHours;\n\t}", "get hours() {\r\n return this._hours;\r\n }", "calculateHoursWorked() {\n var shift_start;\n var shift_end;\n var total_time = 0;\n\n // Calculate for week 1.\n this.state.week_1_shifts.forEach((shift) => {\n shift_start = new Date(shift.fields['clock_in']).getTime();\n if (shift.fields['clock_out'] != null) {\n shift_end = new Date(shift.fields['clock_out']).getTime();\n } else {\n shift_end = new Date(this.state.current_time);\n }\n total_time += (shift_end - shift_start);\n });\n this.setState({ week_1_hours: total_time });\n total_time = 0;\n\n // Calculate for week 2.\n this.state.week_2_shifts.forEach((shift) => {\n shift_start = new Date(shift.fields['clock_in']).getTime();\n if (shift.fields['clock_out'] != null) {\n shift_end = new Date(shift.fields['clock_out']).getTime();\n } else {\n shift_end = new Date(this.state.current_time);\n }\n total_time += (shift_end - shift_start);\n });\n this.setState({ week_2_hours: total_time });\n }", "function overtimePay(workingHours) {\n\tvar hourlyPay = 12;\n\tvar hours = workingHours - 40;\n\tvar result = hourlyPay * hours;\n\treturn result;\n}", "function sleepings(hours){\n if (hours >= 8){\n return \"You got enough rest, good job!\";\n }else{\n return \"Get some extra rest tonight, sleepyhead!\"\n };\n}", "function calcAwaitingTime(arrMin, depMin, arrHours, depHours) {\n\n\n var awaiting;\n if (depHours > arrHours) {\n if (arrMin > depMin) {\n awaiting = 60 - (arrMin - depMin);\n }\n else {\n awaiting = 60 + (depMin - arrMin);\n\n }\n\n }\n else {\n\n awaiting = depMin - arrMin;\n\n }\n return awaiting;\n\n\n}", "function getActualSleepHours() {\n let result =\n getSleepHours('Monday') +\n getSleepHours('Tuesday') +\n getSleepHours('Wednesday') +\n getSleepHours('Thursday') +\n getSleepHours('Friday') +\n getSleepHours('Saturday') +\n getSleepHours('Sunday');\n return result;\n}", "isPartTime() {\n return this.workStatus > 0 && this.workStatus < 100;\n }", "function getRemaining() {\n\tvar millLeft = timeDone - (new Date).getTime();\n\n\tif (millLeft < 0) {\n\t\tmillLeft = 0;\n\t}\n\n\treturn {\n\t\t\"hours\": Math.floor(millLeft / 1000.0 / 60 / 60),\n\t\t\"minutes\": Math.floor(millLeft / 1000.0 / 60 % 60),\n\t\t\"seconds\": Math.floor(millLeft / 1000.0 % 60),\n\t\t\"milli\": Math.floor(millLeft % 1000.0)\n\t};\n}", "between(start, end){\n\n //Initialize our usage variable\n let total = 0;\n\n //Go through every hour between the times specified\n for(let i=start+1; i<=end; i++) {\n\n //If we have a record for this hour\n if(this.hours[i] !== undefined) {\n\n //Add the usage to our running total\n total += this.hours[i];\n }\n\n }\n\n //Return the total amount of power used during the specified time frame\n return total;\n }", "countHours (start, end) {\n const date1 = moment(start);\n const date2 = moment(end);\n return Math.abs(date1.diff(date2, 'hours'));\n }", "function get_working_time(price, pay) {\n var hours = Math.round(Math.floor(price * 2/ pay))/2;\n hour_text = (hours == 1) ? \"hour\" : \"hours\";\n\n return \"About \" + hours + \" \" + hour_text;\n}", "function inHoursOfOp(unixTime) {\n const localTime = local(unixTime);\n\n if (!weekendsEnabled && duringWeekend(unixTime)) {\n return false;\n }\n\n const afterHoursStart =\n localTime.hour() >= hoursOfOpStartArr[0] &&\n localTime.minute() >= hoursOfOpStartArr[1];\n\n const beforeHoursEnd =\n localTime.hour() < hoursOfOpEndArr[0] ||\n (localTime.hour() == hoursOfOpEndArr[0] &&\n localTime.minute() < hoursOfOpEndArr[1]);\n\n return afterHoursStart && beforeHoursEnd;\n }", "isFullTime() {\n return this.workStatus == 100;\n }", "function prototypeTimeLeft() {\n let weddingDate = new Date('2020/10/17');\n let today = new Date();\n let diff = weddingDate - today;\n let days = diff / 86400000;\n let hours = (days % 1) * 24;\n let minutes = (hours % 1) * 60;\n let seconds = (minutes % 1) * 60;\n\n changeDays(Math.floor(days));\n changeHours(Math.floor(hours));\n changeMinutes(Math.floor(minutes));\n changeSeconds(Math.floor(seconds));\n}", "function calculateSleepDebt() {\n const actualSleepHours = getActualSleepHours();\n const idealSleepHours = getIdealSleepHours();\n //perfect sleeping time\n if (actualSleepHours === idealSleepHours) {\n return 'perfect amount of sleep';\n // Sleeping more than you need\n } else if (actualSleepHours > idealSleepHours) {\n return (\n 'You get ' +\n (actualSleepHours - idealSleepHours) +\n ' h more sleep than you need'\n );\n }\n //sleeping less than you need\n else {\n return (\n 'You should try to sleep for ' +\n (idealSleepHours - actualSleepHours) +\n ' h more'\n );\n }\n}", "function past(hr, min, sec) {\n let hours = 3600000;\n let minutes = 60000;\n let seconds = 1000;\n let totalHours;\n let totalMinutes;\n let totalSeconds;\n\n if (hr <= 23){\n totalHours = hours * hr \n }if (min <= 59){\n totalMinutes = minutes * min \n }if (sec <= 59){\n totalSeconds = seconds * sec \n }\n return totalHours + totalMinutes + totalSeconds\n\n \n}", "function getHours(start_time, end_time){\n\t\tvar timeStart = new Date(start_time).getTime();\n\t\tvar timeEnd = new Date(end_time).getTime();\n\t\tvar hourDiff = timeEnd - timeStart; //in ms\n\t\tvar secDiff = hourDiff / 1000; //in s\n\t\tvar minDiff = hourDiff / 60 / 1000; //in minutes\n\t\tvar hDiff = hourDiff / 3600 / 1000; //in hours\n\t\tvar humanReadable = {};\n\t\thumanReadable.hours = Math.floor(hDiff);\n\t\thumanReadable.min = Math.floor(minDiff);\n\t\tvar minutes = (humanReadable.hours*60) + humanReadable.min;\n\t\tconsole.log(\"total time \"+minutes);\n\t\treturn minutes;\n\t\t//console.log(\"%## \"+minDiff);\n\t\t/* if(humanReadable.hours<1){\n\t\t\t\n\t\t\treturn (Math.ceil(parseFloat(\"0.\"+ humanReadable.min)));\n\t\t}\n\t\t \n\t\telse{\n\t\t\treturn humanReadable.hours;\n\t\t} */\n\t}", "get remainingTime() {\r\n return Math.ceil((this.maxTime - this.timeTicker) / 60);\r\n }", "function timeRemaining (holiday) {\n\t\tconst currentMilliseconds = currentTime.getTime();\n\t\tconst holidayMilliseconds = holiday.getTime();\n\t\tlet millisecondsRemaining = holidayMilliseconds - currentMilliseconds;\n\t\tlet daysRemaining = Math.round((((millisecondsRemaining / 1000) / 60) / 60) / 24);\n\t\tlet hoursRemaining = 23 - currentTime.getHours();\n\t\tlet minutesRemaining = 59 - currentTime.getMinutes();\n\t\tlet secondsRemaining = 59 - currentTime.getSeconds();\n\n\t\tif (daysRemaining < 0) {\n\t\t\tdaysRemaining = daysRemaining + 365;\n\t\t}\n\t\t\n\t\treturn `${daysRemaining} day(s) ${hoursRemaining} hour(s) ${minutesRemaining} minute(s) ${secondsRemaining} second(s) left`;\n\t}", "get hours() {\n return this.date.getHours();\n }", "getHours() {\r\n return this._hours;\r\n }", "function GetHours(empCheck)\n{\n switch(empCheck)\n {\n case IS_PART_TIME :\n return PART_TIME_HOURS;\n case IS_FULL_TIME:\n return FULL_TIME_HOURS;\n default :\n return 0;\n }\n}", "function remaining_time() {\n let delta_time = Date.parse(end_date) - Date.parse(new Date()), //get quantity of the milliseconds from now to the end date\n seconds = Math.floor((delta_time/1000) % 60), //get seconds\n minutes = Math.floor((delta_time/1000/60) % 60), //get minutes\n hours = Math.floor((delta_time/1000/60/60)); //get hours\n\n //the time object\n return {\n 'total': delta_time,\n 'hours': hours,\n 'minutes': minutes,\n 'seconds': seconds\n }\n }", "function hoursSleep(hoursJoe, hoursJane, hoursLila, hoursPepe, hoursGina) {\n if (hoursJoe > hoursJane && hoursJoe > hoursLila && hoursJoe > hoursPepe && hoursJoe > hoursGina)\n {\n console.log(`Joe slept today the most! ${hoursJoe} hours`);\n }\n else if (hoursJane > hoursJoe && hoursJane > hoursLila && hoursJane > hoursPepe && hoursJane > hoursGina)\n {\n console.log(`Jane slept today the most! ${hoursJane} hours`);\n }\n else if (hoursLila > hoursJoe && hoursLila > hoursJane && hoursLila > hoursPepe && hoursLila > hoursGina)\n {\n console.log(`Lila slept today the most! ${hoursLila} hours`);\n }\n else if (hoursPepe > hoursJoe && hoursPepe > hoursLila && hoursPepe > hoursJane && hoursPepe > hoursGina)\n {\n console.log(`Pepe slept today the most! ${hoursPepe} hours`);\n }\n else\n {\n console.log(`Gina slept today the most! ${hoursGina} hours`);\n }\n\n }", "getTournamentOverdueCnt() {\n var cnt = 0, i; \n var d = Date.now();\n if (this.tournament.paymentdeadline != \"0\") {\n for (i = 0; i < this.players.length; i++) {\n if (this.players[i].paymentstatus == \"open\" && d > (parseInt(this.players[i].datetime) + (24*60*60*1000 * parseInt(this.tournament.paymentdeadline)))) cnt++;\n }\n }\n return cnt; \n }", "function normalTimePay(hoursWorked, payPerHour) {\r\n result = hoursWorked * payPerHour;\r\n return result;\r\n}", "infectionByRequestedTime() {\n const factor = this.powerFactor();\n return this.currentlyInfected() * 2 ** factor;\n }", "getHours() {\n return this.duration() / 3600000 //MS in an Hour\n }", "function timecalc(hoursBack) {\r\n // Function to return current time for use to calculate the timeframe parameter for the parkingEvents query. \r\n // The function minus the number of hours back accuratly articulates to the api what \r\n // timeframe should be viewed.\r\n var date = new Date()\r\n return Date.UTC(date.getUTCFullYear(),date.getUTCMonth(), date.getUTCDate() , \r\n date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds())-(hoursBack*60*60*1000); \r\n }", "calculateTime() {\n // Number of ingredients\n const numberOfIngredients = this.ingredients.length;\n // Number of periods (1 period = 3 ingredients)\n const periods = Math.ceil(numberOfIngredients / 3);\n\n // Time needed to cook (1 period takes 15 minutes)\n this.time = periods * 15;\n }", "function detectTimeIssues(story) {\n var estimation = story.querySelector('.meta');\n var spentTime = story.querySelector('.everhour-stat');\n if (estimation !== null && spentTime !== null) {\n var pts = estimation.textContent;\n if (pts >= 0) {\n var time = spentTime.textContent.split(' ');\n var minutes = 0;\n var hours = 0;\n\n // If time has only 1 param, means that it has only minutes.\n // Otherwise - hours and minutes.\n if (time.length == 1) {\n minutes = parseInt(time[0]);\n }\n else {\n hours = parseInt(time[0]);\n minutes = parseInt(time[1]);\n }\n\n // Care only about huge overruns.\n var estimated = pts * 6 * 60 + 60;\n var current = hours * 60 + minutes;\n if (estimated < current) {\n if (story.querySelector('.time-overrun') === null) {\n story.insertAdjacentHTML('beforeend', '<span class=\"time-overrun\">overrun</span>');\n }\n }\n }\n }\n }", "function isOnTime(timeDue, curTime){\n var date = new Date(); // initializes a date variable\n var dueSplit = timeDue.split(\" \"); // splits the timeDue by the space, ex. \"7:30:00 AM\" becomes [7:30:00, AM]\n var dueSplitTwo = dueSplit[0].split(\":\") // splits the previous split by the colon, creating [7, 30, 00]\n var dueDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), dueSplitTwo[0], dueSplitTwo[1]) // Sets up a JS date object using the current date and the time previously split out\n dueSplit[1] == \"PM\" ? dueDate.setHours(dueDate.getHours() + 12) : dueDate = dueDate // if the job time was PM, it adds 12 hours to the date object. This is a ternary operator, basically an if statements. The dueDate = dueDate was just to fill out the right side of the colon, otherwise it didn't work\n var dueTime = Utilities.formatDate(dueDate, \"PST\", \"HH:mm\"); // Pulls out the hours/minutes from the time dueTime object\n var onTime = \"\" // initializes a variable to describe if job is on time or not\n curTime > dueTime ? onTime = \"No\" : onTime = \"Yes\"; // Checks if the current time is larger than the task due time. If so sets onTime to \"No\"\n return onTime;\n}", "function inLiveHours(){\n var now = new Date();\n var hour = now.getHours()\n return ((hour >= LIVE_SOD) && (hour < LIVE_EOD))\n}", "updateRemainingTime() {\n\n this.callsCounter++;\n //cada 25 llamadas, quito un segundo\n if (this.callsCounter % 25 == 0) {\n if (this.time.seconds == 0) {\n this.time.minutes -= 1;\n this.time.seconds = 60;\n }\n this.time.seconds -= 1;\n }\n //Se activa el hurryUp\n if (this.callsCounter == this.hurryUpStartTime) {\n this.hurryUpTime = true;\n }\n //Se llama al metodo cada 5 llamadas \n if (this.callsCounter >= this.hurryUpStartTime\n && this.callsCounter % 5 == 0) {\n this.hurryUp();\n }\n\n }", "daysRemaining(){\n for(let booking of this._booking){\n this.holidayAllowance-=booking.numberOfDays();\n }\n return this.holidayAllowance;\n }", "function trabalho(entrada, saida) {\n var horaInicio = entrada.split(\":\"); //Split starting hours\n var horaSaida = saida.split(\":\"); //Split finishing hours\n\n //Create 2 variables to set as the starting hour and ending\n hora1 = new Date();\n hora2 = new Date();\n\n //Filling the variables with data from the splited string\n hora1.setHours(horaInicio[0], horaInicio[1], horaInicio[2]); //Starting hour\n hora2.setHours(horaSaida[0], horaSaida[1], horaSaida[2]); //Ending hour\n\n ///Still working on this condition -------------- working hours only between 8:00:00 and 18:00:00\n if (hora1.getHours() < 8 || hora1.getHours() > 18 || hora2.getHours() > 18 || hora1.getHours() < 8 || hora1.getHours() > hora2.getHours()) {\n console.log(\"Erro\");\n } else {\n var difference = new Date(); //New variable this will be the hours difference or the hours worked\n\n //difference equals to ending hours - starting hours at the end we get the amout of time worked\n difference.setHours(hora2.getHours() - hora1.getHours(), hora2.getMinutes() - hora1.getMinutes(), hora2.getSeconds() - hora1.getSeconds());\n console.log(difference.getHours(), ':', difference.getMinutes(), ':', difference.getSeconds());\n }\n}", "_calcRemainingTime() {\n return this._remainingTestsCount;\n }", "function countRealWorkingTime(wantedProcentageAsInt, fullWorkDayNumber){\n let originalArray = []\n \n let wantedProcentageInDouble = wantedProcentageAsInt/100\n let currentWorkDayLength = Math.trunc(fullWorkDayMinutes*wantedProcentageInDouble)\n let allValues = document.querySelectorAll(\".header-balance-part\")\n //Counts total of days showing currently on kellokortti by counting the plus icons on right side of each day working time marking\n let howManyDaysIsShowing = document.querySelectorAll(\".float-right.glyphicon.glyphicon-plus-sign\").length\n //let workingDaysCount = howManyDaysIsShowing-countShowingfreeDays()\n originalArray = preProcessOriginalArray(allValues, originalArray) \n let combinedArray = createCombinedArray(originalArray)\n let minutesArray = transformArrayToMinutes(combinedArray, currentWorkDayLength, fullWorkDayNumber)\n let total = gainTotalBalance(minutesArray)\n return returnTotalHoursAndMinutesAsString(total)\n}", "timeRemaining(reqTimeStamp) {\n let endTime= reqTimeStamp + this.validationWindow;\n let now = parseInt(new Date().getTime()/1000);\n return (endTime - now)\n }", "function GetEmployeeWage(empCheck)\n{\n switch(empCheck)\n {\n case IS_FULL_TIME:\n return FULL_TIME_HOURS;\n break;\n case IS_PART_TIME:\n return PART_TIME_HOURS;\n default:\n return 0;\n }\n}", "get remainTime(){ \n let remainTime =''\n if (this.scheduler) {\n if (this.isPaused) {\n remainTime = 'pause';\n } else {\n let breakType = this.nextBreakType()\n if (breakType) {\n console.log(this.scheduler.timeLeft);\n remainTime = `${Utils.formatTillBreak(this.scheduler.timeLeft)}`\n }\n }\n }\n return remainTime\n }", "function importantNotify(){\n var date = new Date();\n var hours = date.getHours();\n var minutes = date.getMinutes();\n if(hours >= 14 && (minutes >= 0 || minutes <=30) && hours < 15){\n makeAlert(\"warning\",\"Lunch Time in Bank\",3500);\n }\n else if(hours == 15){\n makeAlert(\"warning\",\"Bank is about to close in \"+ (60 - minutes) +\" minutes\",3500);\n }\n else if(hours >= 16 || (hours >= 0 && hours <= 10)){\n makeAlert(\"danger\",\"Bank is closed now.\",3500);\n }\n}", "function isTradingHour(now){\n\t return now.getDay()!=0 && now.getDay()!=6 &&now.getDate() != 23 &&((now.getHours()>=8 && now.getHours()<14)||(now.getHours() == 7 && now.getMinutes()>29))\n }", "setUpHours() {\n this._.each(this.vendor.hours, (day) => {\n //handle no open or close times\n if(!day || !day.opening_time || !day.closing_time) {\n day.open = new Date();\n day.close = new Date();\n day.closed = true;\n return;\n }\n // create js time object from string\n let openPeriod = day && day.opening_time && day.opening_time.split(':')[1].slice(2, 4),\n closePeriod = day.closing_time.split(':')[1].slice(2, 4),\n openHour = (openPeriod.toLowerCase() === 'pm') ? Number(day.opening_time.split(':')[0]) + 12 : day.opening_time.split(':')[0],\n openMinutes = day.opening_time.split(':')[1].slice(0, 2),\n closeHour = (closePeriod.toLowerCase() === 'pm') ? Number(day.closing_time.split(':')[0]) + 12 : day.closing_time.split(':')[0],\n closeMinutes = day.closing_time.split(':')[1].slice(0, 2),\n open = new Date(),\n close = new Date();\n //set time\n open.setHours(openHour);\n close.setHours(closeHour);\n\n open.setMinutes(openMinutes);\n close.setMinutes(closeMinutes);\n //set open close times for ui\n day.open = open;\n day.close = close;\n\n }, this);\n return this.vendor.hours;\n }", "overTime(){\n\t\t//\n\t}", "function get_hours(date) {\r\n hours = date.getHours();\r\n return hours; \r\n}", "function Overtime(time) \n {\n\n var overtime=12*1.5*time;\n return overtime;\n }", "get hourBoxValue() {\r\n let hours = this.hourValue;\r\n if (!this.hour12Timer) {\r\n return hours;\r\n }\r\n else {\r\n if (hours === 0) {\r\n hours = 12;\r\n this.isPM = false;\r\n }\r\n else if (hours > 0 && hours < 12) {\r\n this.isPM = false;\r\n }\r\n else if (hours === 12) {\r\n this.isPM = true;\r\n }\r\n else if (hours > 12 && hours < 24) {\r\n hours = hours - 12;\r\n this.isPM = true;\r\n }\r\n return hours;\r\n }\r\n }", "function compareHour() {\n //update color code to display the calendar hours to match currentTime\n var updateHour = moment().hours();\n $(\".time-block > textarea\").each(function() {\n var hour = parseInt($(this).attr(\"id\").split(\"-\")[1]);\n //set background color if past hour\n if (hour < updateHour) {\n $(this).addClass(\"past\");\n //set background color if present hour\n } else if (hour === updateHour) {\n $(this)\n .addClass(\"present\");\n //set background color if future hour\n } else if (hour > updateHour) {\n $(this)\n .addClass(\"future\");\n }\n });\n }", "function getRemainingTime() {\n return new Date().getTime() - startTimeMS;\n}", "function setHours() {\n if (hourNow >=11) {\n hour = hourNow - 12\n }\n else {\n hour = hourNow;\n }\n if (minNow > 30) {\n\t\thour++;\n }\n return arrHours[hour];\n}", "function getScopeHours ( ) {\n var hours = parseInt( scope.hours, 10 );\n var valid = ( scope.showMeridian ) ? (hours > 0 && hours < 13) : (hours >= 0 && hours < 24);\n if ( !valid ) {\n return;\n }\n\n if ( scope.showMeridian ) {\n if ( hours === 12 ) {\n hours = 0;\n }\n if ( scope.meridian === meridians[1] ) {\n hours = hours + 12;\n }\n }\n return hours;\n }", "function overTime(time) {\n var hour = time;\n if (hour > 40) {\n var extraHour = hour - 40;\n var extraPay = extraHour * 12;\n document.write(\"The over time pay of \" + extraHour + \" will be \" + extraPay)\n }\n}", "get workingDays() {\n return this.detailedDailyWage.filter(day => day.wage!==0).length;\n }", "function calculate_total_worked_time()\n{\n var totalh = 0;\n var totalm = 0;\n $('.StTotalTime').each(function () {\n\n if (($(this).val())) {\n var h = parseInt(($(this).val()).split(':')[0]);\n var m = parseInt(($(this).val()).split(':')[1]);\n totalh += h;\n totalm += m;\n }\n });\n //alert('Total Hour is '+totalh+'Total Minutes is '+totalm);\n totalh += Math.floor(totalm / 60);\n totalm = totalm % 60;\n\n totalh = totalh < 10 ? '0' + totalh : totalh;\n totalm = totalm < 10 ? '0' + totalm : totalm;\n\n $('#hours_total').text(totalh + ':' + totalm);\n $('button.disabled').removeAttr('disabled').removeClass('disabled');\n}", "function uhOh () {\n\t\tif (counter == 0) {\n\t\t\t$(\"#seconds\").html(\"<p>Time is Officially Up!</p>\");\n\t\t\tincomplete++;\n\t\t\t$(\".results\").html(\"<div>Correct: \" + right + \" Incorrect: \" + wrong + \" Incomplete: \" + incomplete + \"</div>\");\n\t\t\tclearTimeout(timeOut);\n\t\t} else {\n\t\t\tcounter--;\n\t\t\t$(\"#seconds\").html(\"<p>Time Remaining: \" + counter + \" seconds</p>\");\n\t\t}\n\t}", "function minutesToHours(timeLeft) {\n return {\n hours: Math.round(timeLeft / 60),\n minutes: timeLeft % 60\n };\n}", "function calTime (hour) {\n\n if (hour == now.hours()) {\n //code goes in here to add css to color code the page to present\n return \"present\"\n } else if (hour < now.hours()) {\n //code goes in here to add css to color code the page to past\n return \"past\"\n } else {\n //code goes in here to add css to color code the page to future\n return \"future\"\n }\n\n}", "function calculateHealthPlan() {\n var actualCalories = getTotalCalories();\n var idealCalories = getIdealCalories();\n if (actualCalories < idealCalories) {\n return 'Time for seconds!';\n }\n if (actualCalories > idealCalories) {\n return 'You\\'re fat. Get to the gym.';\n }\n else {\n return 'You know your body. Calories right on the money';\n }\n}", "function getRemainingTime() {\n // get current date and time\n const today = new Date().getTime();\n // console.log(today);\n\n // future time - current time\n const t = futureTime - today;\n\n // value in minisecond\n // console.log(t);\n // 1s = 1000ms\n // 1m = 60s\n // 1hr = 60minutes\n // 1 day = 24 hours\n\n // minisecond in 1 day...24(24hours in a day)*60(60 minutes in an hour)*60(60 seconds in 1 minute)*(1000ms in 1s)\n const oneDay = 24 * 60 * 60 * 1000;\n // console.log(oneDay);\n // value of how many minisecond in 1 hour\n const oneHour = 60 * 60 * 1000;\n // value of how many minisecond in 1 minute\n const oneMinute = 60 * 1000;\n // console.log(oneMinute);\n\n // calculate the value\n let days = t / oneDay;\n // console.log(days);\n\n days = Math.floor(days);\n // console.log(days);\n\n let hours = Math.floor((t % oneDay) / oneHour);\n // console.log(hours);\n\n let minutes = Math.floor((t % oneHour) / oneMinute);\n // console.log(minutes);\n let seconds = Math.floor((t % oneMinute) / 1000);\n // console.log(seconds);\n\n // set values array\n const values = [days, hours, minutes, seconds];\n // console.log(values);\n\n // if the value of hour is less than 10 then add 0\n function format(item) {\n if (item < 10) {\n return (item = `0${item}`);\n }\n return item;\n }\n\n items.forEach(function (item, index) {\n item.innerHTML = format(values[index]);\n });\n // when the time expired or countdown finishes, currentTiem bigger than future time\n if (t < 0) {\n clearInterval(countdown);\n deadline.innerHTML = `<h4 class=\"expired\">Time up</h4>`;\n }\n}", "setFinalTime() {\n /*\n if user selected the UNTIL functionality, use arithmetic to transform option into seconds.\n */\n if (this.state.until) {\n console.log('hello');\n var secondsRequested = 0;\n var hours;\n\n if (this.state.hourList[this.state.selectedItem1] == '12') {\n hours = 0;\n } else {\n hours =\n Number.parseInt(this.state.hourList[this.state.selectedItem1], 10) *\n 3600;\n }\n\n var minutes =\n Number.parseInt(this.state.minuteList[this.state.selectedItem2], 10) *\n 60;\n var am_or_pm = this.state.morningOrNight[this.state.selectedItem3];\n\n if (am_or_pm == 'PM') {\n secondsRequested += 12 * 3600; //this accounts for the first 12 hours of the day\n }\n\n //adds on requested hours and minutes\n secondsRequested += hours + minutes;\n\n /* if user requests time within the next day, do additional arithmetic */\n if (secondsRequested - this.getCurrentTime() < 0) {\n return secondsRequested + (24 * 3600 - this.getCurrentTime());\n } else {\n return secondsRequested - this.getCurrentTime();\n }\n } else {\n //end conditions for until option\n\n // if user selects the \"FOR\" option, return (hours * 3600) + (minutes * 60) to get second count.\n return (\n Number.parseInt(this.state.forMinutes[this.state.selectedItem2], 10) *\n 60 +\n Number.parseInt(this.state.forHours[this.state.selectedItem1], 10) *\n 3600\n );\n }\n }", "function evaluateTime() {\n $(\".time-block\").each (function() {\n hourField = Number($(this).attr(\"data-time\"));\n currentHour = Number(moment().format(\"k\"));\n if (hourField < currentHour) {\n $(this).addClass(\"past\");\n } else if (hourField > currentHour) {\n $(this).removeClass(\"present\");\n $(this).addClass(\"future\");\n } else {\n $(this).removeClass(\"past\");\n $(this).addClass(\"present\");\n }\n });\n }", "hourEnd(s) {\n return s.dateTimeEnd.getHours();\n }", "findHours(startDate, endDate){\n let duration = Moment.duration(startDate.diff(Moment(endDate)));\n return Math.round(duration.asHours());\n }", "function consumedPastHour() {\n let currentTime = new Date();\n let hourago = new Date(currentTime.getTime() - (60 * 60 * 1000));\n let consumedKWH = 0;\n //Get the consumption readings from the past hour on phase 1\n request('http://raspberrypi.local:1080/api/chart/1/energy_neg/from/' + hourago.toISOString() + '/to/' + currentTime.toISOString(), (error, response, body) => {\n let resultJson = JSON.parse(body);\n let values = resultJson[0].values;\n //Accumulate the total amount fed during the past hour\n values.forEach((measurment) => {\n consumedKWH += measurment.value;\n });\n\n //Unlock the account for 15000 milliseconds\n Web3Service.unlockAccount(meterAccount, \"1234\", 15000);\n //Execute the consume smart contract\n SmartGridContract.consume(consumedKWH, meterAccount);\n });\n}", "function TotalHours(flag)\n{\n\tvar timeObject;\n\tvar Sum = 0.00;\n\tvar Hours = 0;\n\tOver24Flag = false;\n\n\tif(TimeCard.StartDate == TimeCard.EndDate)\n\t{\n\t\tNumRec = emssObjInstance.emssObj.teDailyLines;\n\t}\n\telse\n\t{\n\t\tNumRec = getDteDifference(TimeCard.StartDate, TimeCard.EndDate) + 1;\n\t}\n\n\tfor (var i=1; i<=NumRec; i++)\n\t{\n\t\tif (typeof(eval(\"self.TABLE.document.TimeEntry.HOURS_\" + i)) == \"undefined\")\n\t\t{\n\t\t\tHours = 0;\n\t\t\tfor (var j=1; j<TimeCard.Form.length; j++)\n\t\t\t{\n\t\t\t\ttimeObject = self.TABLE.document.TimeEntry[TimeCard.Form[j].FormField +'_'+ i];\n\t\t\t\tif (timeObject && timeObject.value != \"\" && typeof(timeObject.value)!=\"undefined\")\n\t\t\t\t{\n\t\t\t\t\tif (__View == \"Exception\" && !isNaN(timeObject.value))\n\t\t\t\t\t{\n\t\t\t\t\t\tHours += parseFloat(timeObject.value);\n\t\t\t\t\t}\n\t\t\t\t\telse if (TimeCard.Form[j].FormField == \"HOURS\" && !isNaN(timeObject.value))\n\t\t\t\t\t{\n\t\t\t\t\t\tHours += parseFloat(timeObject.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tHours = roundToDecimal(Hours,2);\n\t\t\tif (Hours != \"\")\n\t\t\t{\n\t\t\t\tSum += parseFloat(Hours);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tHours = 0;\n\t\t\ttimeObject = eval(\"self.TABLE.document.TimeEntry.HOURS_\" + i);\n\t\t\tif (timeObject && timeObject.value != \"\" && !isNaN(parseFloat(timeObject.value)))\n\t\t\t{\n\t\t\t\tHours = parseFloat(timeObject.value);\n\t\t\t\tHours = roundToDecimal(Hours,2);\n\t\t\t\tif (Hours != \"\")\n\t\t\t\t{\n\t\t\t\t\tSum += parseFloat(Hours);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (TimeCard.StartDate != TimeCard.EndDate && emssObjInstance.emssObj.tePeriod24HourEdit && Hours > 24)\n\t\t{\n\t\t\tOver24Flag = true;\n\t\t}\n\t}\n\n\tSum = roundToDecimal(Sum,2);\n\t\n\tself.TABLE.document.getElementById(\"TotalHoursSpan\").innerHTML = Sum;\n\n\tif (TimeCard.StartDate == TimeCard.EndDate && emssObjInstance.emssObj.teDaily24HourEdit && Sum > 24)\n\t{\n\t\tOver24Flag = true;\n\t}\n\t\n\t// PTs 102449, 105365: always return the total number of hours so that the 24-hour edit can\n\t// be enforced. This number is used by the Check24HourEdit function to produce the alert.\n\treturn Sum;\n}", "function TotalHours(flag)\n{\n\tvar timeObject;\n\tvar Sum = 0.00;\n\tvar Hours = 0;\n\tOver24Flag = false;\n\n\tif(TimeCard.StartDate == TimeCard.EndDate)\n\t{\n\t\tNumRec = emssObjInstance.emssObj.teDailyLines;\n\t}\n\telse\n\t{\n\t\tNumRec = getDteDifference(TimeCard.StartDate, TimeCard.EndDate) + 1;\n\t}\n\n\tfor (var i=1; i<=NumRec; i++)\n\t{\n\t\tif (typeof(eval(\"self.TABLE.document.TimeEntry.HOURS_\" + i)) == \"undefined\")\n\t\t{\n\t\t\tHours = 0;\n\t\t\tfor (var j=1; j<TimeCard.Form.length; j++)\n\t\t\t{\n\t\t\t\ttimeObject = self.TABLE.document.TimeEntry[TimeCard.Form[j].FormField +'_'+ i];\n\t\t\t\tif (timeObject && timeObject.value != \"\" && typeof(timeObject.value)!=\"undefined\")\n\t\t\t\t{\n\t\t\t\t\tif (__View == \"Exception\" && !isNaN(timeObject.value))\n\t\t\t\t\t{\n\t\t\t\t\t\tHours += parseFloat(timeObject.value);\n\t\t\t\t\t}\n\t\t\t\t\telse if (TimeCard.Form[j].FormField == \"HOURS\" && !isNaN(timeObject.value))\n\t\t\t\t\t{\n\t\t\t\t\t\tHours += parseFloat(timeObject.value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tHours = roundToDecimal(Hours,2);\n\t\t\tif (Hours != \"\")\n\t\t\t{\n\t\t\t\tSum += parseFloat(Hours);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tHours = 0;\n\t\t\ttimeObject = eval(\"self.TABLE.document.TimeEntry.HOURS_\" + i);\n\t\t\tif (timeObject && timeObject.value != \"\" && !isNaN(parseFloat(timeObject.value)))\n\t\t\t{\n\t\t\t\tHours = parseFloat(timeObject.value);\n\t\t\t\tHours = roundToDecimal(Hours,2);\n\t\t\t\tif (Hours != \"\")\n\t\t\t\t{\n\t\t\t\t\tSum += parseFloat(Hours);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (TimeCard.StartDate != TimeCard.EndDate && emssObjInstance.emssObj.tePeriod24HourEdit && Hours > 24)\n\t\t{\n\t\t\tOver24Flag = true;\n\t\t}\n\t}\n\n\tSum = roundToDecimal(Sum,2);\n\t\n\tself.TABLE.document.getElementById(\"TotalHoursSpan\").innerHTML = Sum;\n\n\tif (TimeCard.StartDate == TimeCard.EndDate && emssObjInstance.emssObj.teDaily24HourEdit && Sum > 24)\n\t{\n\t\tOver24Flag = true;\n\t}\n\t\n\t// PTs 102449, 105365: always return the total number of hours so that the 24-hour edit can\n\t// be enforced. This number is used by the Check24HourEdit function to produce the alert.\n\treturn Sum;\n}", "function wagesEarnedOnDate(employeeRec, date) {\n let hoursWorked = hoursWorkedOnDate(employeeRec, date);\n let payOwed = hoursWorked * employeeRec.payPerHour;\n return payOwed;\n}", "setCoolDown(timeNotAvailable, timeMoving) {\n this.hoursUnavailable =\n parseFloat(timeNotAvailable) + parseFloat(timeMoving);\n this.hoursUnavailable = this.hoursUnavailable * 60; // hours in minutes\n this.hoursUnavailable = this.hoursUnavailable * 30; // minutes in seconds\n }", "_getRemainingTime()\r\n {\r\n // Get time remaining in seconds.\r\n let timeRemaining = this._getRemainingDistance() / this._getAverageSpeed();\r\n if (timeRemaining === Infinity){\r\n timeRemaining = NaN\r\n }\r\n return timeRemaining\r\n }", "function getLaborTotalForWeek(regular_hours, overtime_hours, total_hours, hourly_wage){\n\n var regular_labor_total = 0;\n var overtime_labor_total = 0;\n var overtime_daily_hours = 0;\n var labor_total = 0;\n\n _.each(regular_hours, function(o){\n regular_labor_total += o.hourly_wage * o.hours;\n });\n\n _.each(overtime_hours, function(o){\n overtime_labor_total += o.hourly_wage * o.hours;\n overtime_daily_hours += o.hours;\n });\n\n if(window.OvertimeSettings.enabled && window.OvertimeSettings.weekly_hours && total_hours > window.OvertimeSettings.weekly_hours){\n var total_extra_hours = total_hours - window.OvertimeSettings.weekly_hours;\n\n if(overtime_daily_hours > total_extra_hours){\n labor_total = regular_labor_total + overtime_labor_total;\n } else {\n var total_extra_labor = total_extra_hours * (hourly_wage * window.OvertimeSettings.weekly_times);\n labor_total = regular_labor_total - (total_extra_hours * hourly_wage) + total_extra_labor;\n }\n } else {\n labor_total = regular_labor_total + overtime_labor_total;\n }\n\n return labor_total;\n}", "get nonworkingHours() {\n\t\treturn this.nativeElement ? this.nativeElement.nonworkingHours : undefined;\n\t}", "function pastPresFut() {\n if (moment().hour() > hours[i].timeValue) {\n return \"past\";\n } else if (moment().hour() == hours[i].timeValue) {\n return \"present\";\n } else {\n return \"future\";\n }\n }", "function getConsumableHours(time) { // Receive a number and a string as a parameter\n\n\t\t\t\t\tif(time.includes(\"days\") || time.includes(\"day\")) { // First, filter days, weeks, months or years\n\t\t\t\t\t\t\n\t\t\t\t\t\tconsumables = time.match(/\\d/g); // Extract the number from the string\n\t\t\t\t\t\tconst days = consumables * 24;\n\t\t\t\t\t\treturn days;\n\n\t\t\t\t\t} else if(time.includes(\"weeks\") || time.includes(\"week\")) { \n\t\t\t\t\t\t\n\t\t\t\t\t\tconsumables = time.match(/\\d/g);\n\t\t\t\t\t\tconst weeks = consumables * 24;\n\t\t\t\t\t\treturn weeks;\n\n\t\t\t\t\t} else if(time.includes(\"months\") || time.includes(\"month\")) { \n\t\t\t\t\t\t\n\t\t\t\t\t\tconsumables = time.match(/\\d/g); \n\t\t\t\t\t\tconst months = consumables * 24;\n\t\t\t\t\t\treturn months;\n\t\t\t\t\t\n\t\t\t\t\t} else if(time.includes(\"years\") || time.includes(\"year\")) { \n\t\t\t\t\t\t\n\t\t\t\t\t\tconsumables = time.match(/\\d/g); \n\t\t\t\t\t\tconst years = consumables * 24;\n\t\t\t\t\t\treturn years;\n\t\t\t\t\t\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\tconsole.log(\"Incorrect value\");\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t}", "function getHours(type) {\n\tswitch(type){\n\t\tcase 'Weekly':\n\t\tcase 'Bi-Weekly':\n\t\tcase 'Yearly':\n\t\t\treturn 40;\n\t\tcase 'Semi-Monthly':\n\t\tcase 'Monthly':\n\t\t\treturn (40*13/12); //13 week months in 12 months based on 52 weeks/year\n\t}\n}", "function checkTime() {\n //use momentjs to grab current hour\n var currentHour = moment().hours();\n //compare currentHour against blockHour\n // if else?\n //need to grab hours for the time block\n // loop through timeblock hours class of time-block??\n\n $(\".time-block\").each(function () {\n var blockHour = parseInt($(this).attr(\"id\").split(\"-\")[1]);\n\n if (blockHour > currentHour) {\n $(this).addClass(\"past\");\n } else if (blockHour === currentHour) {\n $(this).addClass(\"present\");\n } else {\n $(this).addClass(\"future\");\n }\n });\n }", "function computeHours() {\n if (saldoAdp == undefined) {\n saldoAdp = 0;\n }\n saldoAdp = saldoAdpToMinutes(saldoAdpBruto);\n var saldoAtual = totalMinutos - toMinutes(totalHorasMes + ':00') + saldoAdp + toMinutes(horasAbonadas);\n\n var comp = document.getElementById('saldoHoras');\n var stringHoras = toHours(saldoAtual);\n\n comp.innerHTML = stringHoras;\n //comp.innerHTML = toMinutes(totalHorasMes + ':00');\n\n if (stringHoras.includes('-')) {\n comp.style.color = 'red';\n } else {\n comp.style.color = '#0F0';\n }\n}", "setTakenHours(state, takenHours) {\n state.takenHours = takenHours;\n }", "clockMinutes() {\n return this.state.work === true ? this.state.roundMinutes : this.state.breakMinutes;\n }", "work() {\n console.log(this.firstName + \" is working really hard, for 1 hour.\");\n if (this.timesheet <= 0) {\n console.log(this.firstName + \" has already worked for the day.\");\n } else {\n console.log(this.firstName)\n }\n this.timesheet = this.timesheet -1;\n //other notation can be used:\n //this.timesheet--;\n\n console.log(this); // use this in the parameter to represent the ogjects we are working in\n }", "function diffTopOfHour(a,b) {\n return a.minutes(0).diff(b.minutes(0),\"hours\");\n }", "function get_work_hours(employeeTypeList, type) {\n\n employeeTypeList.forEach(function(item) {\n if (item['id'] === type){\n work_begin_time = parseInt(item['work_begin'].substring(0,2));\n work_end_time = parseInt(item['work_end'].substring(0,2));\n\n if (work_end_time===0){work_end_time = 24};\n }\n });\n\n //開始工作時間、結束工作時間、工作時數\n return {'begin':work_begin_time, 'end':work_end_time, 'hours':work_end_time-work_begin_time};\n}", "function overtimePay(hour) {\n if (hour > 40) {\n var overtimeHour = hour - 40;\n var pay = overtimeHour * 12;\n alert(\"Your \" + overtimeHour + \" hour overtime pay is: \" + pay + \" Rs.\");\n }\n else {\n alert(\"You have not worked overtime\");\n }\n}", "function hotelCost(hotelStayTime) {\n var rent = 0;\n if (hotelStayTime <= 10) {\n rent = hotelStayTime * 100;\n }\n else if (hotelStayTime <= 20) {\n var firstTenDay = 10 * 100;\n var remainingDay = hotelStayTime - 10;\n var secondTenDay = remainingDay * 80;\n rent = firstTenDay + secondTenDay;\n }\n else {\n var firstTenDay = 10 * 100;\n var secondTenDay = 10 * 80;\n var remainingDay = hotelStayTime - 20;\n var thirdAllDay = remainingDay * 50;\n rent = firstTenDay + secondTenDay + thirdAllDay;\n }\n return rent;\n}", "function getRemainingTime() {\n return v.viewState.remainingTime;\n }", "calcTime() {\n const numIng = this.ingredients.length;\n const periods = Math.ceil(numIng / 3);\n this.time = periods * 15;\n }", "function updateEligibleOT()\n {\n var compTimeUsed = getComptimeUsed();\n var ct = ($scope.compTimeMax - $scope.timecard.bankedComp + compTimeUsed);\n var maxCompTimeHours = $scope.formatNumber(ct / 1.5);\n var maxcth = parseFloat(maxCompTimeHours);\n if (maxcth * 1.5 > ct)\n {\n maxCompTimeHours = $scope.formatNumber((ct - .25) / 1.5);\n }\n var week1OT = getBoth($scope.timecard.calculatedTimeList_Week1);\n var week2OT = getBoth($scope.timecard.calculatedTimeList_Week2);\n var totalEligibleHours = Math.min(week1OT + week2OT, maxCompTimeHours);\n console.log(week1OT, week2OT, totalEligibleHours, ct, maxCompTimeHours);\n $scope.week1OT = Math.min(week1OT, totalEligibleHours);\n $scope.week2OT = Math.min(week2OT, totalEligibleHours - $scope.week1OT);\n $scope.week1CompTimeEarned = getComptime($scope.timecard.calculatedTimeList_Week1);\n $scope.week2CompTimeEarned = getComptime($scope.timecard.calculatedTimeList_Week2);\n }" ]
[ "0.70213896", "0.6638103", "0.6562684", "0.6483491", "0.6468157", "0.64645904", "0.6411628", "0.6377517", "0.63768315", "0.63726354", "0.637182", "0.63563544", "0.63518", "0.625741", "0.6243014", "0.62320876", "0.6206406", "0.6155559", "0.61286294", "0.6114841", "0.6088599", "0.6057677", "0.6052885", "0.60473263", "0.60242236", "0.6017803", "0.6004494", "0.60039985", "0.59998274", "0.5991849", "0.5973449", "0.59649026", "0.59524447", "0.5885792", "0.5873638", "0.58714813", "0.5849847", "0.58447224", "0.58096904", "0.58071876", "0.580565", "0.57912904", "0.57755786", "0.5732577", "0.5728267", "0.57245225", "0.5716908", "0.57165676", "0.57164603", "0.57080835", "0.56942445", "0.56929696", "0.5680121", "0.5639417", "0.5634482", "0.5626196", "0.5614562", "0.5614205", "0.56107074", "0.56048244", "0.560348", "0.56031215", "0.55974615", "0.55959964", "0.5595599", "0.5590284", "0.558652", "0.55856466", "0.55743283", "0.5570478", "0.55552894", "0.55449635", "0.5538401", "0.55358064", "0.5535162", "0.5534111", "0.55330855", "0.55190915", "0.55189085", "0.55056894", "0.55056894", "0.55000824", "0.5490887", "0.5484877", "0.5483455", "0.54825306", "0.5476914", "0.547404", "0.54654443", "0.5462387", "0.5459216", "0.5457045", "0.54558825", "0.54512084", "0.54497665", "0.5449598", "0.54466623", "0.5442814", "0.54401803", "0.5438163", "0.5437445" ]
0.0
-1
Chose a position inside the array Random number 0, 1 or 2 (random position in array) Random Number between 0 and 2 Random Number
function computerplay() { var Computer = Math.floor(Math.random()*optionsarray.length); return optionsarray[Computer]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomIndexOf(arr) {\n if(arr.length < 1) return -1;\n return Math.floor(Math.random() * arr.length);\n}", "function randomnum() {\n //Sets var randArray to a random index of 0-3; relates to arrays: lower, upper, number, special\n var randArray = Math.floor((Math.random() * array.length));\n //Sets var random to the index of selected var randArray from 0 - max length of the randArray\n var random = Math.floor((Math.random() * array[randArray].length));\n //returns the value in var randArray with an index of var random\n return array[randArray][random];\n}", "function randomLocation(array) {\n let choice = Math.floor(Math.random() * array.length);\n return array[choice];\n}", "function randomSelect(array) {\n return array[getRandomInt(0, array.length)];\n}", "function chooseRandomIndex(array) {\n return Math.floor(Math.random() * array.length);\n}", "function randomSelection (array) {\n var randomNumber = Math.floor(Math.random() * array.length);\n return array[randomNumber];\n }", "function genPosRan(){\n let arrayOriginal = [0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7];\n arrayOriginal.sort(function() { return Math.random() - 0.5 });\n return(arrayOriginal)\n}", "function getRandomIndex(array){\n return Math.floor(Math.random() * array.length);\n}", "function getRandomIndex(array) {\n return Math.floor(Math.random() * array.length);\n }", "function getRandomIndex(array) {\n return Math.floor(Math.random() * array.length);\n }", "function selectRandomIndex(arr) {\n const index = Math.floor(Math.random() * arr.length);\n return index;\n }", "function getRandomIndex (arr) {\n return Math.round(Math.random() * (arr.length - 1));\n}", "function ranArrInd(arrayLength) {\n imgInd = [];\n imgInd.push(Math.floor(Math.random() * arrayLength));\n var num2 = (Math.floor(Math.random() * arrayLength));\n while (num2 === imgInd[0]) {\n num2 = (Math.floor(Math.random() * arrayLength));\n }\n imgInd.push(num2);\n var num3 = (Math.floor(Math.random() * arrayLength));\n while (num3 === imgInd[0] || num3 === imgInd[1]) {\n num3 = (Math.floor(Math.random() * arrayLength));\n }\n imgInd.push(num3);\n}", "function getRandomIndex(array) {\n return Math.floor(Math.random() * array.length);\n}", "function getRandomIndex(array) {\n return Math.floor(Math.random() * array.length);\n}", "function getRandomIndex(array) {\n return Math.floor(Math.random() * array.length);\n}", "function randomSelect(array) {\n var randomI = Math.floor(Math.random() * array.length);\n var randomE = array[randomI];\n return randomE;\n}", "function rndIndx(arr) {\n return Math.floor(Math.random() * arr.length);\n}", "function Randomize(arr) {\n var IndexArray = Math.floor(Math.random() * arr.length);\n var Elment = arr[IndexArray];\n return Elment;\n}", "static select(array, position) {\n console.log(array, position);\n if (position < 0 || position > array.length) {\n throw new Error(\"Wrong position number of this array, Must in 1..length(array)\");\n }\n //random divide index\n let divide = Math.floor(Math.random() * array.length);\n //find less than\n let less = array.filter(x => x < array[divide]);\n //console.log(\"[LESS]\", less);\n //find equls\n let equal = array.filter(x => x == array[divide]);\n //console.log(\"[EQUAL]\", equal);\n if (less.length > position) {\n return this.select(less, position);\n }\n else if (less.length + equal.length > position) {\n return array[divide];\n }\n else {\n let greater = array.filter(x => x > array[divide]);\n //console.log(\"[GREATER]\", greater);\n return this.select(equal.concat(greater), position - less.length);\n }\n }", "function randomPos(bound) {\n return Math.random() * bound;\n}", "function chooseRandomFrom(array){\n return array[Math.floor(Math.random() * array.length)];\n}", "function choose(array) {\n\t\treturn array[getRandomInt(array.length)];\n\t}", "function randomNumber(array) {\n //picks a random index in the list of users choice\n var listRandom = Math.floor(Math.random() * array.length);\n //stores the value that correstponds to the index picked above in randomVar variable\n var randomVar = array[listRandom];\n //stores randomVar in global memory\n return randomVar;\n}", "function returnRandomIndex(array){\n let length = array.length\n let randomNumber = rand()\n let randomIndex\n\n // find the index corresponding to the random number\n for(i=1; i<=length; i++){\n if(randomNumber <= (i/length)){\n randomIndex = i-1\n break\n }\n }\n\n return randomIndex\n\n /*\n Explanation\n the array's length defines fractions between 0 and 1\n the random number falls into one of the intervals between the fractions\n since the intervals correspond to the fractions, they correspond to the indices in the array\n the interval the rand falls into is found, it's corresponding index is returned\n\n Example\n length = 3; rand = 0.4\n\n i=1\n i/length = 1/3\n --> rand > 1/3\n\n i=2\n i/length = 2/3 = 0.6666\n --> rand < 2/3\n ==> return \"second position of Array has been chosen\"\n */\n}", "function randomPos() {\n var randomFourNumbers = [];\n // algorithm to create random array of element containing four exclusive numbers.\n while (randomFourNumbers.length < 4) {\n var tempNum = Math.round(Math.random() * 3);\n // if tempNum is not inside the randomFourNumbers array then push it inside randomFourNumbers[]\n if (!(randomFourNumbers.includes(tempNum))) {\n randomFourNumbers.push(tempNum);\n };\n };\n return randomFourNumbers;\n}", "function pickNum(){\n num_arr= [1,2,3,4,5,6,7,8,9];\n ans_arr= []; // this array will have 4 random number from the list.\n for(var i=0; i< 4; i+=1){\n var sele = num_arr.splice(Math.floor(Math.random()*(9 - i)),1)[0];\n ans_arr.push(sele);\n }\n}", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }", "choice(arr){\n const randomIdx = Math.floor(Math.random() * arr.length)\n return arr[randomIdx]\n}", "function randPick(arr)\n{\n return arr[Math.floor(Math.random() * arr.length)]; \n}", "function randomPick(array){\n let choice = Math.floor(Math.random()*array.length);\n return array[choice]\n}", "function randMoveCal(arr, boxes) {\r\n let openPos = [];\r\n for (let i = 0; i < arr.length; i++) {\r\n if (!(boxes[arr[i]].classList.contains(\"locked\"))) {\r\n openPos.push(arr[i]);\r\n }\r\n }\r\n let placeChoosen = Math.floor(Math.random() * openPos.length);\r\n return openPos[placeChoosen];\r\n}", "static ArrayRandomIndex(p_Array) {\n return Math.floor(Math.random() * p_Array.length);\n }", "function randomValue(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }", "function choice(arr) {\n return arr[(Math.random() * 100 * (arr.length) | 0) % arr.length];\n}", "function randomPosition() {\n\tvar rnd = Math.round(Math.random()*ps.length);\n\treturn ps[rnd];\n}", "function randomIndex(n) {\n return Math.floor(Math.random() * parseInt(n));\n }", "function pick(arr){\r\n randompick=Math.floor(Math.random() * arr.length);\r\n return arr[randompick];\r\n}", "function random_choice(array){\n var l = array.length;\n var r = Math.floor(Math.random()*l);\n return array[r];\n}", "function randomPick(array){\n\tlet choice = Math.floor(Math.random() * array.length);\n\treturn array[choice];\n}", "function random(arr){\n return arr[randBetween(0, arr.length - 1)]\n }", "pickTile(arr) {\n\t\tlet ran = this.getRandomIndex(arr);\n\t\treturn arr[ran];\n\t}", "function randomElement(array) {\n return array[randomInteger(array.length)];\n}", "function randomElement(array) {\n return array[randomInteger(array.length)];\n}", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)]\n}", "function randomPickedColorIndex()\r\n{\r\n\treturn Math.floor(Math.random()*arr.length);\r\n}", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function pick(array = []) {\n\t\tvar rand = Math.random();\n\t\treturn array[Math.round(map(rand, 0, 1, 0, array.length - 1))];\n\t} //why haven't I done this already", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function findRandomElement(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function randomValueFromArray(array){\n\treturn array[Math.floor(Math.random()*array.length)];\n\n}", "function choice(arr){\n return arr[Math.floor(Math.random() * arr.length)];\n }", "function cShipPos() {\n\t\tvar arr =[];\n\t\twhile(arr.length < 3){\n var randomnumber = Math.floor(Math.random()*9);\n if(arr.indexOf(randomnumber) > -1) continue;\n arr[arr.length] = randomnumber;\n \tarr.forEach(function(num){\n \t\tcArr[num] = true\n \t})\n\t\t}}", "function pickRandom(arry) {\n return arry.splice(Math.floor(Math.random() * arry.length), 1)[0];\n}", "function random_choice(arr){\n let idx = Math.floor(Math.random() * arr.length);\n return arr[idx];\n}", "shuffleArray(array) {\n let index = Math.round(Math.random() * (3)); // get a ramdonly index number beetwen 0 and 3\n let temp = array[index]; // save the value in the position index of the array in the new variable temp\n array[index] = array[0];// save the value of the correct answer in the position 0, to the position \"index\" of the array\n array[0] = temp;// save the value in temp to the position 0 of the array \n return array; // return the array with the correct answer in a new random place\n }", "function randomItem(array) {\n return array[Math.floor(Math.random() * array.length)];\n }", "function randomPosition() {\n var random = Math.floor(Math.random() * 10);\n return random;\n}", "function randomValue(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }", "function randomValue(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }", "function randomValue(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }", "function randomValue(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n }", "static randomPosition(count) {\n\t\treturn [random(-width, width), random(-height, height), random(width)].slice(0, count === undefined ? 3 : count);\n\t}", "random(max,min, arr){\n let num = Math.round(Math.random()*(min-max)+max);\n return arr[num];\n}", "function getRandomNumber(array) {\n return array[Math.random() * array.length | 0];\n}", "function selectRandomFromArray(array) {\n let randomNum = Math.floor(Math.random() * array.length);\n return array[randomNum];\n}", "function randomFromArray(arr){\n\treturn arr[randomInteger(0,arr.length)];\n}", "function rndElement(array) {\n return array[rndInt(array.length - 1)];\n}", "function randomPosition() {\n var randomIndex = randomRange(0, gridPositions.length);\n var randomPosition = gridPositions.splice(randomIndex, 1)[0];\n\n return randomPosition;\n}", "function rchoice(array) {\n return array[Math.floor(array.length * Math.random())];\n}", "function createPokeIndex(startNum) {\n //Create an array consists of 1 to 50:\n var arr = [];\n for (var j = startNum; j < startNum + 50; j++) {\n arr.push(j);\n }\n // Double the array created above:\n var newArr = arr.concat(arr);\n\n //Shuffle the array values:\n for (var i = newArr.length - 1; i > 0; i--) {\n var j = Math.floor(Math.random() * i);\n var temp = newArr[i];\n newArr[i] = newArr[j];\n newArr[j] = temp;\n }\n return newArr;\n}", "function getpos(){\n var min = 0;\n var max = choices.length;\n var pos = Math.floor(Math.random() * (max-min))+min;\n var boardpos = choices[pos]\n choices.splice(pos,1);\n return boardpos;\n\n}", "getRandomPosition(limits) {\n return [limits[0]*Math.random()-limits[0]/2,\n limits[1]*Math.random()-limits[1]/2,\n limits[2]*Math.random()-limits[2]/2];\n }", "function randomValueFromArray(array){\n return array[Math.floor(Math.random()*array.length)];\n}", "function index (max){\n return Math.floor(Math.random() * max)\n }", "function randomSelection() {\n\treturn [Math.floor(Math.random() * Array.length)];\n}", "function randomValueFromArray(array){\n const random = Math.floor(Math.random()*array.length);\n return array[random];\n }", "function getRandNum(array){\n return Math.floor(Math.random() * array.length);\n }", "static getRandom (arr) { return arr[ Math.floor( Math.random() * arr.length ) ] }", "function randomPass(arr) {\n var random = Math.floor(Math.random() * arr.length);\n var randomOutput = arr[random];\n return randomOutput;\n}", "function randomPick(array) {\n let choice = Math.floor(Math.random() * array.length);\n return array[choice];\n}", "function randomPick(array) {\n let choice = Math.floor(Math.random() * array.length);\n return array[choice];\n}", "function random_generate() {\r\n let ran_num = Math.floor(Math.random() * sq.length);\r\n if (sq.ran_num % 2)\r\n }", "function getpos(){\n var min = 0;\n var max = choices.length;\n var pos = Math.floor(Math.random() * (max-min))+min;\n var boardpos = choices[pos]\n choices.splice(pos,1);\n return boardpos;\n\n }", "function pickFromArray(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function pickFromArray(arr) {\n return arr[Math.floor(Math.random() * arr.length)];\n}", "function R(array) {\n return array[Math.floor(Math.random() * (array.length))];\n }", "function chooseRandom(arr) {\n return arr[Math.floor((Math.random() * arr.length))];\n}", "function randomValueFromArray(array){\n\treturn array[Math.floor(Math.random()*array.length)];\n}", "function randomOpinion (array) {\n return array[Math.floor(Math.random() * array.length)];\n}", "function randomChoice(arr){\n let index = Math.floor(Math.random() * arr.length);\n return arr[index];\n}", "function randomElement(array) {\n\t\treturn array[Math.floor(Math.random() * array.length)];\n\t}", "function random(array) {\n let randomIndex = Math.floor(Math.random() * array.length);\n return array[randomIndex];\n}", "function randomNum(array){\n\tarray.push(Math.floor(Math.random()*100)+1);\n}", "function randomElement(array) {\n return array[Math.floor((Math.random() * array.length -1) +1)];\n}", "function random_nums() {\n\t\t\tvar max = all_coords.length + 1;\n\t\t\treturn Math.floor(Math.random() * max) \n\t\t}", "function randItem(selectedArray) {\n return selectedArray[Math.floor(Math.random()*selectedArray.length)];\n}", "function randArrayElement(array) {\n return array[Math.floor(Math.random() * array.length)];\n}" ]
[ "0.69577104", "0.68993795", "0.67307764", "0.66999847", "0.66443944", "0.66405565", "0.66326576", "0.6601008", "0.6575666", "0.6575666", "0.6573093", "0.65671355", "0.6547054", "0.6526048", "0.6526048", "0.6526048", "0.6514073", "0.6484289", "0.64811325", "0.647296", "0.64651483", "0.6456914", "0.6449805", "0.64397615", "0.64122367", "0.6389073", "0.6372666", "0.63314897", "0.63143975", "0.6303903", "0.6297509", "0.6295878", "0.6282952", "0.62827605", "0.62717825", "0.6270968", "0.6249269", "0.6244228", "0.6239863", "0.62295634", "0.6228354", "0.6216284", "0.62144", "0.62144", "0.6210879", "0.6210119", "0.620977", "0.620977", "0.620977", "0.620977", "0.62044424", "0.6200938", "0.6200938", "0.61897266", "0.6188946", "0.6187763", "0.6185794", "0.6184252", "0.61813575", "0.61793095", "0.61750895", "0.61715996", "0.61715996", "0.61715996", "0.61715996", "0.61707187", "0.61522484", "0.6147248", "0.61459595", "0.61443126", "0.6143532", "0.61422855", "0.6139753", "0.6134009", "0.6132379", "0.6129653", "0.6126243", "0.61231226", "0.612163", "0.61202914", "0.6114777", "0.6111787", "0.611152", "0.61095566", "0.61095566", "0.6101928", "0.60924846", "0.6090607", "0.6090607", "0.6089815", "0.60888726", "0.60888344", "0.60822076", "0.60811126", "0.60803133", "0.6071913", "0.6071812", "0.60640424", "0.6060362", "0.6055198", "0.60545295" ]
0.0
-1
GET METHOD DATA TABLE OF CONTENTS 1. GET ALL DATA 2. GET CUSTOM ROW 3. GET STASTIC DATA
function doGet(request) { var ssID = SpreadsheetApp.openById(SHEETS_ID); var tableName = request.parameter.tableName; var sheet = ssID.getSheetByName(tableName); var action = request.parameter.action; switch (action) { case "read": return get_data(sheet, tableName); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getData(table) {\n return this.content.data[table];\n }", "function get_data() {}", "function dataFunc(data) {\n console.log(data.getData());\n console.log(data.getColumns());\n }", "function getDataFromPage () {\n return Array.from(document.querySelectorAll(\"table#tabla_expediente[data-role=table]\")).reduce((acc, item) => {\n return acc.concat(getDataFromTable(item));\n }, []);\n }", "function getStructuredData () {\n let data = [];\n data.push((getCareerName()) ? getCareerName() : \"\");\n document.querySelectorAll(\"table#tabla_expediente[data-role=table]\").forEach((item) => {\n data.push({\n title: getTitleFromTable(item),\n data: getDataFromTable(item),\n });\n });\n if (data.length > 1)\n return data;\n }", "function getDataFromTable(table){\n const dataTable = [];\n const cols = getData('columns');\n const rows = Array.from(table.rows).slice(1);\n \n rows.forEach(rowData => {\n let dataRow = {};\n \n for (let col in cols) {\n let data = rowData.cells;\n switch(cols[col]){\n case 'total':\n let total = parseFloat(data[col].innerHTML.slice(1));\n dataRow[cols[col]] = total;\n break;\n case 'order': \n let value = parseInt(data[col].childNodes[0].innerHTML.slice(1));\n dataRow[cols[col]] = value;\n dataRow['order_link'] = data[col].childNodes[0].href;\n break; \n case 'status':\n dataRow[cols[col]] = data[col].childNodes[0].innerHTML;\n break;\n default:\n dataRow[cols[col]] = data[col].innerHTML;\n break;\n }\n }\n dataTable.push(dataRow);\n })\n \n /*for (let i=1; i < rows.length; i++){\n var row_data = {};\n for (let col in cols) {\n let data = rows[i].cells;\n if (cols[col] === 'order'){\n let value = parseInt(data[col].childNodes[0].innerHTML.slice(1));\n row_data[cols[col]] = value;\n row_data['order_link'] = data[col].childNodes[0].href;\n } else if (cols[col] === 'total'){\n let value = parseFloat(data[col].innerHTML.slice(1));\n row_data[cols[col]] = value;\n } else if (cols[col] === 'status'){\n row_data[cols[col]] = data[col].childNodes[0].innerHTML;\n }\n else {\n row_data[cols[col]] = data[col].innerHTML;\n }\n \n }\n data.push(row_data);\n }*/\n return dataTable;\n}", "function getSeanceColumnAndRows( next ) {\n $.get(\"/api/seance/names\", function( data ) {\n processSeanceColumnAndRows( data )\n next()\n })\n }", "_getThead(data, columnHeader) {\n let root = this;\n if (\n data !== undefined &&\n data !== null &&\n data.length > 0 &&\n columnHeader\n ) {\n return data.slice(0, 1);\n }\n return [];\n }", "function eDataDataTable(){\r\n\ttdType='3';\r\n\tvar url = 'productId.testobjectdata.attachments.list?productId='+productId+'&jtStartIndex=0&jtPageSize=10000';\r\n\tvar jsonObj = \t{\r\n\t\t\t\t\t\t\"Title\":\"EData\",\r\n\t\t\t\t\t\t\"url\":url,\r\n\t\t\t\t\t\t\"jtStartIndex\":0,\r\n\t\t\t\t\t\t\"jtPageSize\":1000,\r\n\t\t\t\t\t\t\"componentUsageTitile\":\"Test Data Plan\"\r\n\t\t\t\t\t};\r\n\tassignEDataDataTableValues(jsonObj);\r\n}", "function readQueryRowData(data){\n\treturn '<td>'+data.id+'</td><td>'+data.url+'</td><td>'+data.status+'</td>';\n}", "function getDataFromTable() {\n var parameterName = $.request.parameters.get('insert_parameter_here'); // Get the parameters from HTTP GET\n var conn = $.db.getConnection(); // SQL Connection\n var pstmt; // Prepare statement\n var rs; // SQL Query results\n var query; // SQL Query statement\n var output = { // Output object\n results: [] // Result array\n };\n var record = {}; // Record object\n try {\n // # might remove hard-coded schema name, and table name\n query = 'SELECT attribute_id, attribute_name, attribute_country FROM \\\"schema_name\\\".\\\"table_name\\\" WHERE attribute_name = ?';\n pstmt = conn.prepareStatement(query);\n pstmt.setString(1, parameterName);\n rs = pstmt.executeQuery(); // Execute query; Get items from SAP HANA\n\n // Push fetched data to Result array\n while (rs.next()) {\n record = {};\n record.parameterID = rs.getString(1);\n record.parameterName = rs.getString(2);\n record.parameterCountry = rs.getString(3);\n output.results.push(record);\n }\n\n conn.commit(); // Prevent deadlock by allowing a cocurrent SQL query to wait until this statement is fully executed\n rs.close(); // Close statements & connections\n pstmt.close();\n conn.close();\n } catch (e) {\n // Catch error if parameters are incorrect\n $.response.status = $.net.http.INTERNAL_SERVER_ERROR;\n $.response.setBody(e.message);\n return;\n }\n // Output respond into JSON body\n var body = JSON.stringify(output);\n $.response.contentType = 'application/json';\n $.response.setBody(body);\n $.response.status = $.net.http.OK;\n}", "function select_all_data(req, res, next) {\n 'use strict';\n\tvar __FUNCTION__ = \"select_all_data\";\n\tvar rows = [];\n\tvar rows2 = [];\n\tvar query;\n\tvar crud_info = {};\n\tdebug_2(\".1.views.m4.js\",__FUNCTION__,238,\"req:\"+JSON.stringify ( req.params ));\n\tvar table_name = req.params.table_name;\n\tvar valid_table = check_table_name ( table_name );\n\tvar fmt = \t( req.params.fmt ) ? req.params.fmt : \"raw\";\t\t\n\tvar stmt_saved = \"\";\n\tvar stmt_saved_no_limit = \"\";\n\n\tif ( valid_table.error ) {\n\t\treturn next(valid_table.error);\n\t}\n\tvar v = validate_data( 'select', table_name, req.params );\n\tif ( ! v.ok ) {\n \treturn next(new restify.MissingParameterError(\"Missing or invalid data;\"+v.msg));\t\t\n\t}\n \n\t// Xyzzy - query/where \n\tvar tp = find_table ( table_name, model );\n\tif ( model.tables[tp].predef && typeof model.tables[tp].select === \"undefined\" ) {\n \treturn next(new restify.MissingParameterError(\"select is not valid on this predefined table query;\"));\t\t\n\t} else if ( model.tables[tp].predef ) {\n// xyzzy - need to handle paging (limit)/(offset) at this point\n// xyzzy - what about count?\n// xyzzy - what about orderby\n\t\tcrud_info = gen_crud_info ( crud_info, 'predef', table_name, req.params, __FUNCTION__, __FILE__, 261 );\n\t\tquery = dn.runQuery ( stmt_saved = ts0( crud_info.select_stmt, crud_info ) );\n\t} else {\n\t\tcrud_info = gen_crud_info ( crud_info, 'select', table_name, req.params, __FUNCTION__, __FILE__, 264 );\n\t\tif ( crud_info.error ) {\n\t\t\treturn next(crud_info.error);\n\t\t}\n\t\tstmt_saved_no_limit = ts0( 'select %{log_comment%} %{select_projected_cols%} from %{table_name%} %{where_clause%} ', crud_info );\n\t\tquery = dn.runQuery ( stmt_saved = ts0( 'select %{log_comment%} %{select_projected_cols%} from %{table_name%} %{where_clause%} %{order_by_clause%} %{limit%} %{offset%} ', crud_info ) );\n\t}\n\tif ( $debug$.showQuery ) {\n\t\tconsole.log ( \"Query is:\\nFile: \"+ \".1.views.m4.js\" +\" Function:\"+ __FUNCTION__ + \" Line: \"+ 272 + \" \" + stmt_saved + \"\\n\\n\" );\n\t}\n\tquery.on('error',function(err) {\n\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,275,\"got on error <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\" );\n\t\tsend_result ( res, next, null, { \"status\":\"error\", \"msg\":\"invalid query\", \"raw\": JSON.stringify(err), \"query\":stmt_saved } );\n\t});\n\tquery.on('row', function(row) { //fired once for each row returned\n\t\t// Xyzzy - Send back after N rows\n\t\t// Xyzzy - Cache rest of data for X amount of time?\n\t\trows.push(row);\n\t});\n\tquery.on('end', function(result) {\n\t\t// fired once and only once, after the last row has been returned and after all 'row' events are emitted\n\t\t// in this example, the 'rows' array now contains an ordered set of all the rows which we received from postgres\n\t\t// debug_2(\".1.views.m4.js\",__FUNCTION__,286,result.rowCount + ' rows were received');\nconsole.log ( \"query.on.end: 275, fmt=\"+fmt+\" rows=\"+JSON.stringify ( rows ) );\n\t\tif ( fmt === \"raw\" ) {\nconsole.log ( \"query.on.end: Sending result - all done.\" );\n\t\t\tsend_result ( res, next, null, rows );\n\t\t} else {\t\t// if ( fmt === \"paged\" )\n\t\t\nconsole.log ( \"query.on.end: 280, fmt=\"+fmt );\n\t\t\tvar count_query = ( model.tables[tp].count_query ) ? model.tables[tp].count_query : \" select count(1) as cnt from ( %{query%} ) as t0 \";\n\t\t\tcount_query = ts0 ( count_query, { \"query\":stmt_saved_no_limit } );\n\t\t\tif ( $debug$.showQuery ) {\n\t\t\t\tconsole.log ( \"Count Query is:\\nFile: \"+ \".1.views.m4.js\" +\" Function:\"+ __FUNCTION__ + \" Line: \"+ 297 + \" \" + count_query + \"\\n\\n\" );\n\t\t\t}\n\nconsole.log ( \"query.on.end: 287, count_query=\"+count_query );\n\t\t\tvar query2 = dn.runQuery ( count_query );\n\t\t\tquery2.on('error',function(err) {\n\t\t\t\tdebug_2(\".1.views.m4.js\",__FUNCTION__,303,\"got on error on count <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\" );\n\t\t\t\tsend_result ( res, next, null, { \"status\":\"error\", \"msg\":\"invalid query2\", \"raw\": JSON.stringify(err), \"query\":count_query } );\n\t\t\t});\n\t\t\tquery2.on('row', function(row) { //fired once for each row returned\n\t\t\t\t// Xyzzy - Send back after N rows\n\t\t\t\t// Xyzzy - Cache rest of data for X amount of time?\n\t\t\t\trows2.push(row);\n\t\t\t});\n\t\t\tquery2.on('end', function(result) {\n\t\t\t\t//fired once and only once, after the last row has been returned and after all 'row' events are emitted\n\t\t\t\t//in this example, the 'rows' array now contains an ordered set of all the rows which we received from postgres\n\t\t\t\t// debug_2(\".1.views.m4.js\",__FUNCTION__,314,result.rowCount + ' rows were received');\n\t\t\t\tsend_result ( res, next, null, { \"total\":rows2[0].cnt, \"count\":rows.length, \"data\":rows } );\n\t\t\t});\nconsole.log ( \"query.on.end: 304\" );\n\t\t\t\n\t\t}\n\t});\n}", "function getTableData(table) {\n const dataArray = [],\n tipoArray = [],\n cantArray = [];\n\n table.rows({\n search: \"applied\"\n }).every(function() {\n const data = this.data();\n tipoArray.push(data[0]);\n cantArray.push(data[1]);\n });\n\n dataArray.push(tipoArray, cantArray);\n\n return dataArray;\n}", "rowData() {\n const data = this.mapResponseData();\n let rows = [];\n if (data) {\n for (const property in data) {\n rows = rows.concat(data[property]);\n }\n return rows;\n }\n return null;\n }", "function getData(){\n return runSOQL('SELECT+name+from+Account');\n}", "function viewDataAll(table) {\n console.log(\"view data all...\");\n db.transaction(function(transaction) {\n transaction.executeSql('SELECT * FROM '+table, [], function (tx, results) {\n var resLen = results.rows.length;\n console.log(\"table results=\"+JSON.stringify(results));\n for (i = 0; i < resLen; i++){\n console.log(\"id=\"+results.rows.item(i).id+\"-title=\"+results.rows.item(i).title+\"-desc=\"+results.rows.item(i).desc);\n $(\"#data-output\").append(\"<p>id=\"+results.rows.item(i).id+\" - title=\"+results.rows.item(i).title+\" - desc=\"+results.rows.item(i).desc)\n }\n }, null);\n });\n }", "function grabTableData() {\n var cache1 = CacheService.getDocumentCache();\n var dataForChart = (cache1.get('mtData'));\n Logger.log('return:' + JSON.parse(dataForChart));\n return dataForChart;\n}", "function getDataFromTable (table) {\n let cols = getMedataFromTable(table);\n return Array.from(table.querySelectorAll(\"tbody tr\")).map((row) => {\n return getDataFromRow(row, cols);\n }).filter((item) => {\n return item.grade >= 5.0 || item.grade === RECOGNITION;\n });\n }", "function getTableDataFromRemote() {\n\n var remote_url = base.options.dataSource;\n if(remote_url == null) {\n return false;\n }\n remote_url += '?';\n remote_url = remote_url + base.options.remoteParamsIn.pageNumber + '=' + curPageNumber + '&';\n remote_url = remote_url + base.options.remoteParamsIn.pagingLimit + '=' + curPageLimit + '&';\n remote_url = remote_url + base.options.remoteParamsIn.order + '=' + curOrder + '&';\n remote_url = remote_url + base.options.remoteParamsIn.orderBy + '=' + curOrderby;\n debug(remote_url);\n\n if(base.options.remoteParamsIn.getMethod == 'get') {\n $.get(remote_url,null,function(respond, status) {\n debug('response from remote server');\n var respondJson = $.parseJSON(respond);\n totalCount = parseInt(respondJson.total_count);\n curCount = parseInt(respondJson.get_count);\n curDatas = respondJson.contacts;\n renderTable();\n });\n }\n\n if(base.options.remoteParamsIn.getMethod == 'post') {\n $.post(remote_url,null,function(respond, status) {\n debug('response from remote server');\n var respondJson = $.parseJSON(respond);\n totalCount = parseInt(respondJson.total_count);\n curCount = parseInt(respondJson.get_count);\n curDatas = respondJson.contacts;\n renderTable();\n });\n }\n }", "function fetchData(type) {\n \n // Constant time interval for the incremental fetch case\n // in milliseconds\n var FETCH_TIME_INTERVAL = 2000000;\n \n var startRow;\n var stopRow;\n \n // if we perform an incremental fetch\n if(type == \"incFetch\"){\n var records = dataTable.getRecordSet().getRecords();\n startRow = parseInt(records[records.length-1].getData().id) + 1;\n stopRow = startRow + FETCH_TIME_INTERVAL;\n }\n // if we perform a filtering action \n else if (type == \"filter\"){\n startRow = Dom.get(\"startRowTextBox\").value\n stopRow = Dom.get(\"stopRowTextBox\").value\n \n // Zero-padding of the startRow and stopRow if the number of digits is\n // less than the one of the timestamp\n // TODO: find a more generic way of doing it. This one\n // assumes that timestamps are represented on 13 digits\n var l = startRow.length;\n if (l != 0){\n for(i = 0 ; i < 13-l ; i = i+1){\n startRow = \"0\" + startRow;\n }\n }\n Dom.get(\"startRowTextBox\").value = startRow;\n \n var l = stopRow.length;\n if (l != 0){\n for(i = 0 ; i < 13-l ; i = i+1){\n stopRow = \"0\" + stopRow;\n }\n }\n Dom.get(\"stopRowTextBox\").value = stopRow;\n }\n \n var responseSuccess = function(o) {\n // Get the JSON data from the server and parse it\n var data = JSON.parse(o.responseText);\n \n if (data.errors.length != 0){\n displayDisplayErrors(data.errors);\n }\n else{\n // If no rows are retrieved, we update the table anyway for\n // filtering actions.\n if (data.result.rows.length != 0 || type == \"filter\"){\n \n // Add the new columns to the table\n var columnNames = data.result.colNames;\n for(i = 0; i < columnNames.length ; i = i + 1){\n if(dataTable.getColumn(columnNames[i]) == null){\n dataTable.insertColumn({ key: columnNames[i], field: \"['columns']['\"+ columnNames[i] +\"']\", label: colNames[i].substr(3)+\"<input type='checkbox' style='margin-left: 5px; vertical-align: middle;'/>\"});\n dataTable.getDataSource().responseSchema.fields.push({ key: \"['columns']['\"+ columnNames[i] +\"']\" });\n }\n }\n \n // Populate the table depending on whether we are filtering or fetching\n rowsData['result'] = data.result.rows\n if(type == \"incFetch\"){\n dataTable.getDataSource().sendRequest(null,\n {success: dataTable.onDataReturnAppendRows},\n dataTable);\n }\n else if(type == \"filter\"){\n dataTable.getDataSource().sendRequest(null,\n {success: dataTable.onDataReturnInitializeTable},\n dataTable);\n // If succeeded filtering the data, we reactivate the fetching\n keepFetching = true;\n }\n \n }\n else{\n // If nothing is back, we reached the end of the table\n keepFetching = false;\n }\n }\n };\n \n var responseFailure = function(o) {\n keepFetching = false;\n displayDisplayErrors([\"Connection Manager Error: \" + o.statusText]);\n };\n \n var callback = {\n success:responseSuccess,\n failure:responseFailure,\n argument:[]\n };\n\n if(stopRow != \"\" && startRow != \"\"){\n // Perform the asynchronous request\n var transaction = YAHOO.util.Connect.asyncRequest('POST', '/updateTable/', callback, \"sensorName=\"+ sensorName +\"&startRow=\"+ startRow +\"&stopRow=\"+ stopRow +\"&precision=\"+ precision + \"&xhr=1\");\n }\n \n\n}", "function getAllData() {\n fetch(\"/items\", {\n headers: { 'Content-Type': 'application/json' },\n method: \"GET\",\n })\n .then(res => {\n if(res.ok) return res.json();\n })\n .then(res => {\n data = res;\n createTable(res);\n })\n .catch(error => console.error(error.message));\n }", "function getTableDataFromJSON() {\n\n }", "function getAllTheData() {\n var render = function (tx, rs) {\n // rs contains our SQLite recordset, at this point you can do anything with it\n // in this case we'll just loop through it and output the results to the console\n for (var i = 0; i < rs.rows.length; i++) {\n /* alert(JSON.stringify(rs.rows.item(i)));*/\n }\n }\n\n app.selectAllRecords(render);\n}", "function getAllTheData() {\n var render = function (tx, rs) {\n // rs contains our SQLite recordset, at this point you can do anything with it\n // in this case we'll just loop through it and output the results to the console\n for (var i = 0; i < rs.rows.length; i++) {\n /* alert(JSON.stringify(rs.rows.item(i)));*/\n }\n }\n\n app.selectAllRecords(render);\n}", "function getTextData(address) {\n var finalTable;\n $.get(address, {format: \"text\"}, function (data) {\n document.getElementById(\"result-region\").innerHTML = \"\";\n finalTable = buildTables();\n var rawdata = data.split(/\\n+/);\n var dataArray = new Array();\n for (var i = 0; i < rawdata.length; i++) {\n if (rawdata[i].length > 1) {\n dataArray.push(rawdata[i].split(\"#||#\"));\n }\n }\n for (var i = 0; i < dataArray.length; i++) {\n finalTable += \" <tr>\";\n var row = dataArray[i];\n for (var j = 0; j < row.length; j++) {\n finalTable += \"<td>\" + row[j] + \"</td>\";\n }\n finalTable += \"</tr>\";\n }\n finalTable += '</table>';\n $(\"#result-region\").append(finalTable);\n });\n}", "getData() {\r\n return this.table;\r\n }", "function cjAjaxGetTable(handler, queryKey, args, pageSize, pageNumber) {\n return this.data(handler, queryKey, args, pageSize, pageNumber, \"jsontable\", \"data\")\n}", "function getFunc() {\n // console.log(\"Get function\");\n fetch(mainURL + \"all\")\n .then(res => res.json())\n .then(data => {\n // console.log(\"data\", data);\n if (data != isNullOrUndefined || TABLEDIV != isNullOrUndefined) {\n tables.list2Table(data.all, \"#tableDiv\") //list2Table comes from tables.js\n }\n\n linking(); // add delete/edit links to table \n })\n}", "GetData() {}", "function getAllData(dataService, dataSet) {\n\n}", "_getTbody(data, columnHeader, footer) {\n if (data !== undefined && data !== null && data.length > 0) {\n let ch = columnHeader ? 1 : 0,\n tbody;\n if (footer) {\n tbody = data.slice(ch, data.length - 1);\n this.__tfoot = data.slice(data.length - 1);\n } else {\n tbody = data.slice(ch, data.length);\n this.__tfoot = [];\n }\n return tbody;\n }\n return [];\n }", "function getRowData(tr=false, format=\"JSON\") {\n if(tr) {\n \n if(format === \"JSON\") {\n var obj = [];\n \n\n tds = $(tr).find(\"td\");\n tds.each(function() {\n var data = $(this).text();\n obj.push(data)\n });\n\n return obj;\n }\n }\n}", "function loadData() {\n loadTable();\n}", "getData() {\n return this.rows;\n }", "function getDataFromTable() {\n\n /**\n * Given a class name for a variable it reads all of its values.\n * In other words, it reads all column values. Returns this as an\n * array.\n */\n function readVariable(name) {\n\n // Iterate through all values.\n var values = []\n $(name).each(function() {\n\n // Get the floating point value from the cell. If it is not a float\n // then take it as 0.\n var val = parseFloat($(this).val());\n if (isNaN(val)) {\n val = 0;\n }\n values.push(val);\n })\n\n return values;\n\n } \n\n // Read all variables defined in VAR_NAMES and store them in data.\n for (var i = 0; i < VAR_NAMES.length; i++) {\n data[i] = readVariable(VAR_NAMES[i]);\n }\n\n // Reset to redraw everything.\n reset();\n}", "function defaultGetRowData(dataBlob, sectionID, rowID) {\n return dataBlob[sectionID][rowID];\n}", "function defaultGetRowData(dataBlob, sectionID, rowID) {\n return dataBlob[sectionID][rowID];\n}", "getData(active){\n\t\treturn this.rowManager.getData(active);\n\t}", "function extractHospitalDataFn(selector) {\n let hospitalTable = document.getElementById(selector);\n let row = hospitalTable.querySelectorAll(\"tr\");\n let details = [];\n\n for (let i = 0; i < row.length; i++) {\n if (i % 2 == 0 && i != row.length - 1) {\n\n let hname = row[i].cells[0].textContent;\n let vacantSeat = row[i].cells[3].getElementsByTagName(\"a\")[0].textContent;\n let timestamp = row[i].cells[1].textContent;\n let vacantSeatNumber = parseInt(vacantSeat);\n if (vacantSeatNumber > 0) {\n\n details.push({ hname, vacantSeatNumber,timestamp });\n //hospital.push({ hname, vacantSeat, timestamp });\n }\n }\n }\n\n\n //console.table(details);\n return details;\n //return hospital;\n }", "function accessesingData2() {\n\n}", "function accessesingData2() {\n\n}", "function UltraGrid_GetData()\n{\n\t//create an array for the result\n\tvar result = [];\n\t//return it\n\treturn result;\n}", "function accessesingData1() {\n\n}", "function accessesingData1() {\n\n}", "getAll(table, expand) {\n return fetch(`${remoteURL}/${table}/?_expand=${expand}`).then(result => result.json())\n }", "getData(){}", "function retriveData() {\r\n jqueryNoConflict.getJSON(dataSource, renderLocationScreen);\r\n }", "function getTblData(MethodName, params) {\r\n var u=(location.protocol+'//'+window.location.host+'/api?method=');\r\n debugger;\r\n if (MethodName === undefined) {\r\n u+='getcategories';\r\n $.ajax({\r\n type: \"GET\",\r\n url: u,\r\n contentType: \"application/json; charset=utf-8\",\r\n headers: { \"X-Method\": MethodName, \"x-id\":params},\r\n data: JSON.stringify(params),\r\n success: function (data) {\r\n data_Set = data;\r\n HideLoad();\r\n tblCategories();\r\n }, statusCode: {\r\n 400: function () { $('.modal-body').html(status_400); },\r\n 404: function () { $('.modal-body').html(status_404); },\r\n 500: function () { $('.modal-body').html(status_500); }\r\n }, error: function (xhr, status, error) {\r\n\r\n }\r\n });\r\n // fetch(opts.url)\r\n // .then((res) => {\r\n // if (res.ok) {\r\n // return res.json();\r\n // }\r\n // })\r\n // .then((rows) => {\r\n // data_Set = rows;\r\n // HideLoad();\r\n // tblCategories();\r\n // for (let row of rows) {\r\n // console.log(row);\r\n // }\r\n // })\r\n // .catch(console.log);\r\n } else {\r\n // fetch(opts.url)\r\n // .then((res) => {\r\n // if (res.ok) {\r\n // return res.json();\r\n // }\r\n // })\r\n // .then((rows) => {\r\n // data_SetProd = data;\r\n // HideLoad();\r\n // tblProducts();\r\n\r\n // for (let row of rows) {\r\n // console.log(row);\r\n // }\r\n // })\r\n // .catch(console.log);\r\n u+=MethodName;\r\n $.ajax({\r\n type: \"GET\",\r\n url: u,\r\n contentType: \"application/json; charset=utf-8\",\r\n headers: { \"X-Method\": MethodName, \"x-id\":params},\r\n data: JSON.stringify(params),\r\n success: function (data) {\r\n data_SetProd = data;\r\n HideLoad();\r\n tblProducts();\r\n }, statusCode: {\r\n 400: function () { $('.modal-body').html(status_400); },\r\n 404: function () { $('.modal-body').html(status_404); },\r\n 500: function () { $('.modal-body').html(status_500); }\r\n }, error: function (xhr, status, error) { }\r\n });\r\n }\r\n return data_Set;\r\n }", "get data() {\n\t\treturn this._tableData;\n\t}", "function getCustomerDetailsTable() {\n var result;\n result = {\n table: {\n widths: [70, '*', 70, '*'],\n body: [\n [{\n text: 'CUSTOMER DETAILS',\n style: 'tableHeader',\n colSpan: 4,\n border: [false, false, false, true]\n }, {}, {}, {}],\n [{\n text: 'Name',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('0'),\n style: 'tableText',\n colSpan: 3,\n border: [true, true, false, true]\n }, {}, {}],\n [{\n text: 'Telephone',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('1'),\n style: 'tableText'\n }, {\n text: 'Booking No',\n style: 'tableBoldTextAlignLeft'\n }, {\n text: getIt('2'),\n style: 'tableText',\n border: [true, true, false, true]\n }],\n [{\n text: 'Advice Required',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('3'),\n style: 'tableText'\n }, {\n text: 'Service Scope',\n style: 'tableBoldTextAlignLeft'\n }, {\n text: getIt('4'),\n style: 'tableText',\n border: [true, true, false, true]\n }]\n ]\n }\n };\n return result;\n}", "function GetDataRows() {\n let rows = \"\";\n packingList.forEach(row => {\n rows = rows\n + \"<tr>\"\n + \"<td>\" + row.part_number + \"</td>\"\n + \"<td>(\" + row.qty + \"x) \" + row.description + \"</td>\"\n + \"<td align='right'>\" + (row.weight * row.qty).toFixed(2) + \"</td>\"\n + \"<td align='right'>$\" + (row.price * row.qty).toFixed(2) + \"</td>\"\n + \"</tr>\";\n });\n\n return rows;\n }", "function analyseTable(tableID){\n var data = [];\n var table = document.getElementById(tableID);\n var rows = table.children;\n for (var i =1; i<rows.length;i++){\n var columns = rows[i].children;\n var subjectName = columns[0].innerText;\n var subjectLinks = columns[1];\n var subjectLinksArray = [];\n for (var j =0;j<subjectLinks.children.length;j++){\n if (subjectLinks.children[j].className == \"downloadable\"){\n subjectLinksArray.push(subjectLinks.children[j].href);\n }\n }\n data.push({\n key: subjectName,\n value: subjectLinksArray\n });\n }\n return data;\n}", "function getChemicalTable(res, mysql, context, complete){\r\n mysql.pool.query(\"SELECT chemical_id, name, chemical_formula, molecular_weight FROM chemical ORDER BY chemical_id ASC LIMIT 20;\", function(error, results, fields){\r\n //mysql.pool.query(\"SELECT chemical.chemical_id, chemical.name, chemical.chemical_formula, chemical.molecular_weight, container.container_barcode, container.concentration_uM, container.amount_uL, container_in_rack.rack_barcode, container_in_rack.rack_location FROM chemical INNER JOIN chemical_in_container ON chemical.chemical_id = chemical_in_container.chemical_id LEFT JOIN container ON container.container_barcode = chemical_in_container.container_barcode LEFT JOIN container_in_rack ON container.container_barcode = container_in_rack.container_barcode ORDER BY chemical.chemical_id ASC LIMIT 20;\", function(error, results, fields){\r\n if(error){\r\n res.write(JSON.stringify(error));\r\n res.end();\r\n }\r\n context.chemical = results;\r\n complete();\r\n });\r\n }", "function get_data(){\r\n\t\tvar xhr = new XMLHttpRequest();\r\n\t\txhr.open('GET', 'http://localhost:5001/list', true);\r\n\t\txhr.send(null);\r\n\r\n\t\txhr.onreadystatechange = function() {\r\n\t\t\tif (xhr.readyState == 4 && xhr.status == 200) {\r\n\t\t\t\tmakeTable(xhr.responseText);\r\n\t\t\t\t$(\".table > tbody > tr\").attr(\"style\", \"cursor: pointer\");\r\n\t\t\t\t$(\".table > tbody > tr\").click(function() {\r\n\t\t\t\t\tvar hash = $(this).find('td:first').text();\r\n\t\t\t\t\tmake_details_window(hash);\r\n\t\t\t\t});\t\t\t\r\n\t\t\t}\r\n\t\t\telse if (xhr.status != 200) {\t\r\n\t\t\t\tdocument.write(\"GET request for JSON data failed!\");\r\n\t\t\t\tdocument.close();\r\n\t\t\t}\r\n\t\t};\r\n\t}", "allData() {\n const sql = 'SELECT * FROM office';\n return this.db.many(sql);\n }", "function selectRows(data) {\n \t\n }", "function getTableDataFromHtml() {\n\n }", "function loadDataMaster() {\r\n var heads = [],\r\n Records = [],\r\n data = {// it will contain data for jtable.\r\n Result: \"OK\",\r\n Version: \"1\",\r\n TotalRecordCount: \"\",\r\n Records: []\r\n };\r\n try {\r\n\r\n var detailedSearchId = getDetailSearchId();\r\n\r\n var searchInfo = nlapiLoadSearch(null, detailedSearchId);\r\n var mainSearch = nlapiLoadSearch(null, WotpUtilityCommon.SavedSearches.MainWorkOrderSearch);\r\n\r\n var fils = getFiltersForSearch(mainSearch);\r\n heads = nlapiSearchRecord(mainSearch.type, null, fils, mainSearch.columns);\r\n if (!!heads && heads.length > 0) {\r\n heads.forEach(function (searchResult) {\r\n var eachRecord = {}; // used for single record traversing\r\n searchResult.rawValues.forEach(function (rec) {\r\n if (rec.text) {\r\n eachRecord[rec.name] = {text: rec.text, value: rec.value};\r\n } else {\r\n eachRecord[rec.name] = (!!rec.value) ? rec.value : rec.text;\r\n }\r\n });\r\n Records.push(eachRecord);\r\n });\r\n data.TotalRecordCount = heads.length;\r\n data.Records = Records;\r\n }\r\n } catch (e) {\r\n //Show error for now\r\n !!console && console.log(\"Warning: \" + e.name + \", \" + e.message);\r\n }\r\n $('#searchResultContainer').jtable('loadClient', data);\r\n}", "function loadDataDetail(filter) {\r\n var heads = [],\r\n searchFilter = null,\r\n Records = [],\r\n data = {// it will contain data for jtable.\r\n Result: \"OK\",\r\n Version: \"1\",\r\n TotalRecordCount: \"\",\r\n Records: []\r\n };\r\n try {\r\n\r\n if (!!filter) {\r\n searchFilter = new nlobjSearchFilter('custbody_currentoperation', null, 'anyof', [filter]);\r\n }\r\n heads = getRecords(getDetailSearchId(), searchFilter, null);\r\n if (heads.length > 0) {\r\n heads.forEach(function (searchResult) {\r\n var eachRecord = {}; // used for single record traversing\r\n searchResult.rawValues.forEach(function (rec) {\r\n if (rec.text) {\r\n eachRecord[rec.name] = rec.text;\r\n } else {\r\n eachRecord[rec.name] = (!!rec.value) ? rec.value : rec.text;\r\n }\r\n });\r\n\r\n if (searchResult.id) {\r\n eachRecord.id = searchResult.id;\r\n }\r\n\r\n Records.push(eachRecord);\r\n });\r\n data.TotalRecordCount = heads.length;\r\n data.Records = Records;\r\n }\r\n } catch (e) {\r\n //Show error for now\r\n !!console && console.log(\"Warning: \" + e.name + \", \" + e.message);\r\n }\r\n $('#searchResultContainerDetail').jtable('loadClient', data);\r\n}", "function retrieveAllAccountData() {\n\tvar cellName = sessionStorage.selectedcell;\n\tvar totalRecordCount = retrieveAccountRecordCount();\n\tvar baseUrl = getClientStore().baseURL;\n\tvar accessor = objCommon.initializeAccessor(baseUrl, cellName);\n\tvar objAccountMgr = createAccountManager();\n\tvar uri = objAccountMgr.getUrl();\n\turi = uri + \"?$orderby=__updated desc &$top=\"\n\t\t\t+ totalRecordCount;\n\tvar restAdapter = _pc.RestAdapterFactory.create(accessor);\n\tvar response = restAdapter.get(uri, \"application/json\");\n\tvar json = response.bodyAsJson().d.results;\n\treturn json;\n}", "function getAll() {\n\t\treturn send({\n\t\t\turl: URL,\n\t\t\ttype: 'GET'\n\t\t})\n\t\t.then(toHTML)\n\t\t.then(getTable)\n\t\t.then(getTableRows)\n\t\t.then(extractAllScriptInformation)\n\t\t.then(reconstruct);\n\t}", "function getDistanceData() {\n return ddb.get({\n TableName: 'distance_data',\n Key: {region: 'Minnesota'}, //grabs the object from the first table\n }).promise();\n}", "function retreiveAllData() {\n\n // -------------------------------------------------------------JavaScript - Arrays Ex. 1s||\n let data = [];\n // -------------------------------------------------------------JavaScript - Loop Ex. 1||\n // -------------------------------------------------------------JavaScript - Arrays (Associate) Ex. 3||\n for (entry in sessionUser.journal) {\n\n // -------------------------------------------------------------JSON - Parse Ex. 1||\n let obj = JSON.parse(sessionUser.journal[entry])\n\n data.push(obj);\n\n }\n return data;\n}", "function retrieveKpccData(data){\n var dataSource = 'http://www.scpr.org/api/content/?types=segmentsORnewsORentries&query=mahony&limit=20';\n jqueryNoConflict.getJSON(dataSource, renderKpccTemplate);\n}", "getData(numRecords = undefined) {\n return !numRecords ? this.data : this.data.slice(0, numRecords);\n }", "function getRowsData_(sheet) {\n var headersRange = sheet.getRange(1, 1, sheet.getFrozenRows(), sheet.getMaxColumns());\n var headers = headersRange.getValues()[0];\n var dataRange = sheet.getRange(sheet.getFrozenRows() + 1, 1, sheet.getMaxRows(), sheet.getMaxColumns());\n var objects = getObjects_(dataRange.getValues(), normalizeHeaders_(headers));\n return objects;\n}", "function doRead(req, currentTable) \n{\n var data = {};\n data.records = _readData(currentTable);\n return response().json(data);\n\n}", "function _get_client_contacts_list(db){\n try{ \n var rows = db.execute('SELECT * FROM my_client_contact WHERE status_code=1 and client_id in ('+\n 'select a.client_id from my_'+_type+' as a where a.id=?) and '+\n 'id in (select b.client_contact_id from my_'+_type+'_client_contact as b where b.'+_type+'_id=? and b.status_code=1)',_selected_job_id,_selected_job_id);\n var b = 0;\n if(rows.getRowCount() > 0){\n while(rows.isValidRow()){\n var row = Ti.UI.createTableViewRow({\n filter_class:'client_contact',\n className:'client_contact_list_data_row_'+b,\n hasChild:true,\n source:_source,\n job_id:_selected_job_id,\n client_id:rows.fieldByName('client_id'),\n contact_id:rows.fieldByName('id'),\n title:rows.fieldByName('first_name')+' '+rows.fieldByName('last_name'),\n mobile:rows.fieldByName('phone_mobile'),\n email:rows.fieldByName('email')\n }); \n if(b === 0){\n row.header = 'Client Contacts';\n }\n self.data.push(row);\n rows.next();\n b++;\n }\n }\n rows.close();\n }catch(err){\n self.process_simple_error_message(err,window_source+' - _get_client_contacts_list');\n return;\n } \n }", "function getSubcategDataTableData(categID) {\n let req = \"%7B%22inputParams%22%3A%7B%22tableInputParams%22%3A%7B%22hideTableBottomOptions%22%3Atrue%2C%22sortColumn%22%3A%22UEBA_REPORT_NAME%22%2C%22hideTopDivider%22%3Atrue%2C%22rangeList%22%3A%5B%7B%22value%22%3A25%7D%2C%7B%22value%22%3A50%7D%2C%7B%22value%22%3A75%7D%2C%7B%22value%22%3A100%7D%5D%2C%22showSearchMethod%22%3A%22searchAction%22%2C%22showSearch%22%3Atrue%2C%22sortOrder%22%3A%22ASC%22%2C%22startValue%22%3A1%2C%22rangeValue%22%3A100%2C%22totalCount%22%3A7%2C%22searchData%22%3A%7B%7D%2C%22selectedCategID%22%3A2%7D%2C%22selectedCategID%22%3A%22\" + categID + \"%22%7D%7D\";\n let GetSubcategDataTableData = getRequestObject(\"GET\", \"../../CustomReportSettings.do?methodToCall=getSubcategDataTableData&req=\" + req);\n GetSubcategDataTableData.onreadystatechange = function () {\n if (this.readyState === 4 && this.status === 200) {\n responseData = JSON.parse(this.responseText);\n tableDataListArray = responseData.tableDataList;\n getSubCategDataFromReport();\n }\n }\n}", "function getData() {\n var queryParams = {\n propertySelection: \"179,7,10888003,8,\" + $scope.cfg.fieldIdToDisplay,//, // ids of fields to fetch\n queryExpression: \"'7' != 3\" //Status is not rejected\n //queryExpression: \"'8' != developer\" //Status is not rejected\n };\n\n var foo = rxRecordInstanceDataPageResource.withName($scope.cfg.recordDefinitionName);\n foo.get(100, 0, queryParams).then(\n function (allRecords) {\n $scope.myData = allRecords.data;\n }\n );\n }", "function getData(param, $leftTable, $rightTable, callback) {\n\n jQuery.post(\"/adcaslte/svc/DownLinkByNMSStats-selectCellTrafficStats\",param,function(result,stat){\n\n $(\"input[name=checkAll]\").attr(\"checked\",false); //전체선택된거 원위치\n\n if(result.error || result.rows.length===0){\n callback(result);\n return;\n }\n\n //각항목 배열\n var propertiesArray = {};\n //for 문으로 튜닝한다\n for(idx=0;idx<result.rows.length;idx++) {\n\n var row = result.rows[idx];\n\n //각 항목별 배열만들기\n propertiesArray = getPropertiesArray(row,propertiesArray);\n\n var $tr = $(\"<tr name='\" + row.ROWIDX + \"'>\"\n +\"<td style='height:13px;width:100px;text-align:center;font-size:11px; display:none;' group='title01'>\"+isUndifined(row.TITLE01,\"-\") + \"</td>\"\n +\"<td style='width:100px;text-align:center;font-size:11px; display:none;' group='title02'>\"+isUndifined(row.TITLE02,\"-\") + \"</td>\"\n +\"<td style='width:100px;text-align:center;font-size:11px; display:none;' group='title03'>\"+\"<div style='text-align:center;margin:0px;padding:0px;height:15px;width:95%;overflow-x:hidden;overflow-y:hidden;'>\"\n + isUndifined(row.TITLE03,\"-\") + \"</div>\" +\"</td>\"\n\n\n\n +\"<td style='width:70px;text-align:center;font-size:11px;'>\"+isUndifined(row.FREQ_KIND,\"-\")+\"</td>\"\n +\"<td style='width:30px;text-align:center;font-size:11px;'>\"\n + (function(_idx, _row){\n if ($rightTable.parent().attr(\"id\").match(/After/g)) {\n return \"&nbsp;\";\n } else {\n return \"<input onclick='checkedGraph(this)' type='checkbox' style='margin: 0px;' name='\"+_row.ROWIDX+\"'>\";\n }\n })(idx, row)\n +\"</td>\"\n +\"</tr>\")\n .data(\"row\",row)\n .appendTo($leftTable);\n\n $tr.children(\"td[group^=title]\").each(function(index,childTd){\n if($(\"#title01\").is(\":visible\") && $(childTd).is(\"[group=title01]\")) {\n $(childTd).show();\n }\n if($(\"#title02\").is(\":visible\") && $(childTd).is(\"[group=title02]\")) {\n $(childTd).show();\n }\n if($(\"#title03\").is(\":visible\") && $(childTd).is(\"[group=title03]\")) {\n $(childTd).show();\n }\n });\n\n $(\"<tr name='\" + row.ROWIDX + \"'>\"\n +\"<td style='text-align: right;font-size:11px;'>\"\n +(function(value,sign,critical) {\n if(Number(value) && critical != null && eval(value+sign+critical)) {\n return \"<span style='color:red'>\"+value+\"</span>\";\n } else {\n return value;\n }\n })(formatNumber(row.THROUGHPUT),'<',result.adminCriticalValues && result.adminCriticalValues.DL_RRU_VAL1)\n +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.CQI_AVERAGE )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.CQI0_RATE )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.RI_RATE )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"\n +(function(value,sign,critical) {\n if(Number(value) && critical != null && eval(value+sign+critical)) {\n return \"<span style='color:red'>\"+value+\"</span>\";\n } else {\n return value;\n }\n })(formatNumber(row.DL_PRB_RATE),'>',result.adminCriticalValues && result.adminCriticalValues.PRB_USG_VAL1)\n +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.MCS_AVERAGE )+\"</td>\" /*SS*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.MIMO_RATE )+\"</td>\" /*LG*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.DL_THROUGHPUT)+\"</td>\" /*LG*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.LICENSE_FAIL )+\"</td>\" /*LG*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.MIMO_RATE )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.MCS_AVERAGE )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.PUCCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.R2_PUCCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.PUSCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.R2_PUSCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.PDCP_DL_MB )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.PRB_USG_RATE)+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.DRB_USG_RATE)+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.CON_TIME )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.TRY_CCNT )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.CON_RATE )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.CDC_RATE )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.DL_FA_USG_RATE )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.VOICE_DL_MB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.VOICE_DL_PRB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.VOICE_TRY_CCNT ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.VOICE_TIME ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.IMAGE_DL_MB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.IMAGE_DL_PRB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.IMAGE_TRY_CCNT ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(row.IMAGE_TIME ) +\"</td>\"\n// +\"<td style='text-align: right;font-size:11px;'>\"+ isUndifined(row.CHNL_TYPE,\"-\") +\"</td>\"\n// +\"<td style='text-align: right;font-size:11px;'>\"+ formatNumber(row.CHNL_COUNT).replace(\".0\",\"\") +\"</td>\"\n\n +\"</tr>\")\n .appendTo($rightTable);\n\n }\n\n //각항목 배열 통계\n var statsArray = getStatsArray(propertiesArray);\n\n for(var i=0; i < 4; i++) {\n var title = \"\";\n if(i === 0) {\n title = '전체평균';\n } else if(i === 1) {\n title = '최대값';\n } else if(i === 2) {\n title = '최소값';\n } else if(i === 3) {\n title = '표준편차';\n }\n var $tr = $(\"<tr>\"\n +\"<td group='title01' style='width:100px;display:none;'></td>\"\n +\"<td group='title02' style='width:100px;display:none;'></td>\"\n +\"<td group='title03' style='width:100px;display:none;'></td>\"\n +\"<td style='text-align:center; width:70px;font-size:12px;'>\"+title+\"</td>\"\n +\"<td style='width:60px;'></td></tr>\")\n .appendTo($leftTable);\n $tr.children(\"td[group^=title]\").each(function(index,childTd){\n if($(\"#title01\").is(\":visible\") && $(childTd).is(\"[group=title01]\")) {\n $(childTd).show();\n }\n if($(\"#title02\").is(\":visible\") && $(childTd).is(\"[group=title02]\")) {\n $(childTd).show();\n }\n if($(\"#title03\").is(\":visible\") && $(childTd).is(\"[group=title03]\")) {\n $(childTd).show();\n }\n });\n\n $(\"<tr>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].THROUGHPUT )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].CQI_AVERAGE )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].CQI0_RATE )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].RI_RATE )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].DL_PRB_RATE )+\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].MCS_AVERAGE )+\"</td>\" /*SS*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].MIMO_RATE )+\"</td>\" /*LG*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].DL_THROUGHPUT)+\"</td>\" /*LG*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].LICENSE_FAIL )+\"</td>\" /*LG*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].MIMO_RATE )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].MCS_AVERAGE )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].PUCCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].R2_PUCCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].PUSCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].R2_PUSCH_AVG )+\"</td>\" /*NSN*/\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].PDCP_DL_MB )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].PRB_USG_RATE)+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].DRB_USG_RATE)+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].CON_TIME )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].TRY_CCNT )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].CON_RATE )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].CDC_RATE )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].DL_FA_USG_RATE )+ \"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].VOICE_DL_MB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].VOICE_DL_PRB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].VOICE_TRY_CC ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].VOICE_TIME ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].IMAGE_DL_MB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].IMAGE_DL_PRB ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].IMAGE_TRY_CC ) +\"</td>\"\n +\"<td style='text-align: right;font-size:11px;'>\"+formatNumber(statsArray[i].IMAGE_TIME ) +\"</td>\"\n// +\"<td style='text-align: right;font-size:11px;'>\"+ \"-\" +\"</td>\"\n// +\"<td style='text-align: right;font-size:11px;'>\"+ formatNumber(statsArray[i].CHNL_COUNT ) +\"</td>\"\n +\"</tr>\")\n .appendTo($rightTable);\n }\n\n callback(result);\n\n },\"json\");\n\n}", "function getData(id) {\n // the operations\n}", "function getHtml(urlCol, data) {\n var skip = 0;\n var options = {\n \"method\" : \"GET\",\n \"muteHttpExceptions\" : true\n };\n \n for (var i = 2; i <= data; i++) {\n \n var url = urlCol[i-2];\n //var response = UrlFetchApp.fetch(url, options);\n //var content = response.getContentText();\n getData(url, i, skip);\n \n }\n}", "getAllDataJQ() {\n\t\tthis.service.all(this.creaTabella)\n\t}", "function getAllChannelDataTS(){\n getDataField1();\n getDataField2();\n getDataField3();\n getDataField4();\n getDataField5();\n getDataField6();\n getDataField7();\n getDataField8();\n }", "function getData() {\n\t\t\tvar deferred = $.Deferred();\n\t\t\t// get RPC results\n\t\t\tRactiveRPC.tab2dataAsync({\n\t\t\t\tonsuccess: function(results) {\n\t\t\t\t\tdeferred.resolve(results);\n\t\t\t\t},\n\t\t\t\tonerror: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\tontimeout: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\ttimeout: 2000,\n\t\t\t\tparams: [1,2]\n\t\t\t});\t\n\t\t\t\n\t\t\treturn deferred.promise();\n\t\t}", "queriedData() {\n let result = this.tableData;\n if (this.searchedData.length > 0) {\n result = this.searchedData;\n } else {\n if (this.searchQuery) {\n result = [];\n }\n }\n return result.slice(this.from, this.to);\n }", "function getCustomerDetailsTable() {\n var result;\n result = {\n table: {\n widths: [61, '*', 51, '*'],\n body: [\n [{\n text: 'CUSTOMER DETAILS',\n style: 'tableHeader',\n colSpan: 4,\n border: [false, false, false, true]\n }, {}, {}, {}],\n [{\n text: 'Name',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('0'),\n style: 'tableText',\n colSpan: 3,\n border: [true, true, false, true]\n }, {}, {}],\n [{\n text: 'Telephone No',\n style: 'tableBoldTextAlignLeft',\n border: [false, true, true, true]\n }, {\n text: getIt('1'),\n style: 'tableText'\n }, {\n text: 'Booking No',\n style: 'tableBoldTextAlignLeft'\n }, {\n text: getIt('8'),\n style: 'tableText',\n border: [true, true, false, true]\n }]\n ]\n }\n };\n return result;\n}", "function tablePersons() {\n\tvar pdata = [];\n\tif (trjs.data.persons) {\n\t\tfor (var i=0 ; i < trjs.data.persons.length; i++) {\n\t\t\tpdata.push({\n\t\t\t// 'Code': trjs.data.persons[i][\"code\"],\n\t\t\t'ID': trjs.data.persons[i][\"id\"],\n\t\t\t'Name': trjs.data.persons[i][\"name\"],\n\t\t\t'Age': trjs.data.persons[i][\"age\"],\n\t\t\t'Role': trjs.data.persons[i][\"role\"],\n\t\t\t'Sex': trjs.data.persons[i][\"sex\"],\n\t\t\t'Lang': trjs.data.persons[i][\"xml_lang\"],\n\t\t\t'Group': trjs.data.persons[i][\"group\"],\n\t\t\t'SES': trjs.data.persons[i][\"ses\"],\n\t\t\t'Educ': trjs.data.persons[i][\"educ\"],\n\t\t\t'Source': trjs.data.persons[i][\"source\"],\n\t\t\t'Info': trjs.data.persons[i][\"custom\"]\n\t\t\t});\n\t\t}\n\t\tif (pdata.length === 0) {\n\t\t\tpdata.push({\n\t\t\t\t// 'Code': \"xxx\",\n\t\t\t\t'ID': \"x\",\n\t\t\t\t'Name': \"---\",\n\t\t\t\t'Age': \"\",\n\t\t\t\t'Role': \"\",\n\t\t\t\t'Sex': \"\",\n\t\t\t\t'Lang': \"\",\n\t\t\t\t'Group': \"\",\n\t\t\t\t'SES': \"\",\n\t\t\t\t'Educ': \"\",\n\t\t\t\t'Source': \"\",\n\t\t\t\t'Info': \"\",\n\t\t\t});\n\t\t}\n\t} else {\n\t\tpdata.push({\n\t\t\t// 'Code': \"xxx\",\n\t\t\t'ID': \"x\",\n\t\t\t'Name': \"---\",\n\t\t\t'Age': \"\",\n\t\t\t'Role': \"\",\n\t\t\t'Sex': \"\",\n\t\t\t'Lang': \"\",\n\t\t\t'Group': \"\",\n\t\t\t'SES': \"\",\n\t\t\t'Educ': \"\",\n\t\t\t'Source': \"\",\n\t\t\t'Info': \"\",\n\t\t});\n\t}\n\treturn pdata;\n}", "function printTable(data){\r\nfor(i=0; i<data.rows.length; i++){\r\n let rowData = \"\";\r\n for(j=0; j<data.rows.item(i).cells.length; j++){\r\n rowData += data.rows.item(i).cells.item(j).innerHTML + \" \";\r\n }\r\n rowData = rowData.slice(0,-1);\r\n console.log(rowData);\r\n}\r\n}", "function tableDataExtract(tableSelector){\n var cols = [],\n rows = [];\n \n $(tableSelector).each(function(){\n var tbl = $(this);\n \n tbl.find('th').each(function(){\n var col = $(this), txt = $.trim(col.text());\n cols.push({\n heading: txt,\n fit: parseInt(col.css('width')) / parseInt(col.parent().css('width')),\n dataItem: txt.replace(/[^\\w]+/g,'_').toLowerCase()\n })\n });\n \n tbl.children('tbody').children('tr').each(function(){\n var rw = $(this),\n obj = {};\n \n for(var i = 0; i < cols.length; i++){\n try{\n obj[cols[i].dataItem] = JSON.parse($.trim(rw.children('td:eq(' + i +')').text()));\n }catch(e){\n obj[cols[i].dataItem] = $.trim(rw.children('td:eq(' + i +')').text());\n } \n }\n rows.push(obj);\n });\n });\n\n return {data:rows, columns:cols};\n}", "function get_student_data(){\n var txt = '';\n var row_header = '<tr>' +\n '<th class=\"none-borderLeft\">ID</th>' +\n '<th>Firstname</th>' +\n '<th>Lastname</th>' +\n '<th width=\"100\">Gender</th>' +\n '<th>Contact</th>' +\n '<th>Status</th>' +\n '<th width=\"100\">Action</th>' +\n '</tr>';\n $('#table_data').html((row_header));\n $.ajax({\n url: 'action/get_student.php',\n type: 'POST',\n data: {id:menuId,startNum:numStart,endNum:numEnd},\n cache: false,\n dataType: \"json\",\n success: function (data) {\n if (data.length == 0){\n alert('No Data');\n }else {\n for (i = 0; i<data.length; i++){\n var row_data = '<tr>' +\n '<td>'+data[i].id+'</td>' +\n '<td style=\"text-align: left\">'+data[i].firstname+'</td>' +\n '<td style=\"text-align: left\">'+data[i].lastname+'</td>' +\n '<td>'+data[i].gender+'</td>' +\n '<td>'+data[i].contact+'</td>' +\n '<td>'+data[i].status+'</td>' +\n '<td>'+button_edit+'</td>' +\n '</tr>';\n txt += row_data;\n }\n }\n $('#table_data').html(row_header+txt);\n }\n });\n }", "function eachrow()\r\r\n{\r\r\n/*\tvar ids=$(\"#list2\").getDataIDs();\r\r\n\t$.each(ids,function(key,val){\r\r\n\tvar ret = jQuery(\"#list2\").getRowData(val);\r\r\n\t\t\r\r\n\t});\t\r\r\n\t*/\r\r\n\r\r\n}", "getTable() {\n const endpoint = \"http://localhost:7777\";\n const rpc = new Rpc.JsonRpc(endpoint);\n rpc.get_table_rows({\n \"json\": true,\n \"code\": \"trackeos\", // contract who owns the table\n \"scope\": \"trackeos\", // scope of the table\n \"table\": \"procedures\", // name of the table as specified by the contract abi\n \"limit\": 100,\n }).then(result => console.log(result));\n }", "function dataTable(data) {\n // keys variable holds ennumberable properties of the first object within data as an array \n var keys = Object.keys(data[0]);\n //headers = keys array is mapped with function that takes name arg\n var headers = keys.map(function(name) {\n // return underlined cell with argument textcell function with name arg\n return new UnderlinedCell(new TextCell(name));\n });\n var body = data.map(function(row) {\n return keys.map(function(name) {\n return new TextCell(String(row[name]));\n });\n });\n return [headers].concat(body);\n}", "function extractHospitalDataFn(selector) {\n let hospitalTable = document.getElementById(selector);\n let row = hospitalTable.querySelectorAll(\"tr\");\n\n\n let phoneArr = [];\n\n for (let i = 0; i < row.length; i++) {\n if (i % 2 != 0) {\n let phoneNumberArr = row[i].querySelectorAll(\".card.shadow.m-1.mb-2 ul a\");\n let phoneNumberStr = \"\";\n let vacantSeat = row[i - 1].cells[3].getElementsByTagName(\"a\")[0].textContent;\n let vacantSeatNumber = parseInt(vacantSeat);\n if (vacantSeatNumber > 0) {\n for (let idx = 0; idx < phoneNumberArr.length; idx++) {\n phoneNumberStr += phoneNumberArr[idx].textContent;\n }\n //let numberPhone = parseInt(vacantSeatNumber);\n phoneArr.push({ phoneNumberStr});\n //hospital.push({ phoneNumberStr });\n }\n\n }\n }\n //console.table(details);\n //console.table(phoneArr);\n return phoneArr;\n //return hospital;\n }", "async function getData() {\n //carrega a tabela do arquivo csv\n const response = await fetch('docs/data.csv');\n //nome,inicio,fim\n const data = await response.text();\n //debug\n //console.log(data);\n\n //pega cada linha da tabela até onde acaba (enter), pode ser\n //'\\n' ou '\\r', vai depender da tabela, checar antes\n //como tá gerando os csv\n //.slice \"corta\" o cabeçalho do array (row[0]), pq\n //coloquei pra começar no 1\n table = data.split('\\r').slice(1);\n\n //debug\n //console.log(table);\n console.log('csv carregado')\n dataCollection()\n \n}", "function IntObject_GetData()\n{\n\t//default result: null\n\tvar datas = null;\n\t//has HTML get Data?\n\tif (this.HTML && this.HTML.GetData)\n\t{\n\t\t//call it\n\t\tdatas = this.HTML.GetData();\n\t}\n\t//no data? Can happen when the treegrid hasnt scrolled a few objects into view yet\n\tif (datas == null)\n\t{\n\t\t//switch on the class\n\t\tswitch (this.DataObject.Class)\n\t\t{\n\t\t\tcase __NEMESIS_CLASS_CHECK_BOX:\n\t\t\tcase __NEMESIS_CLASS_RADIO_BUTTON:\n\t\t\t\tdatas = new Array(this.Properties[__NEMESIS_PROPERTY_CHECKED]);\n\t\t\t\tbreak;\n\t\t\tcase __NEMESIS_CLASS_EDIT:\n\t\t\t\tdatas = new Array(Get_String(this.Properties[__NEMESIS_PROPERTY_CAPTION], \"\").replace(/\\r\\n/g, \"\\n\").replace(/\\n/g, \"\\r\\n\"));\n\t\t\t\tbreak;\n\t\t\tcase __NEMESIS_CLASS_COMBO_BOX:\n\t\t\t\tdatas = new Array(Get_String(this.Properties[__NEMESIS_PROPERTY_CAPTION], \"\"));\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t//valid data?\n\tif (datas != null)\n\t{\n\t\t//loop through it\n\t\tfor (var i = 0, c = datas.length; i < c; i++)\n\t\t{\n\t\t\t//translate this\n\t\t\tdatas[i] = __VARS_MANAGER.TranslateString(datas[i], this.DataObject.Id);\n\t\t}\n\t}\n\t//return it\n\treturn datas;\n}", "readAllData(params, division_db, token) {\n const self = this;\n const deferred = Q.defer();\n // const sql = ` use [${division_db}]; select dbo.employee.*,dbo.employee.StatusDate as HireDate,dbo.employee.InactiveDate as TermDate, dbo.employee.className as Country,dbo.classification.Description as Class,\n // paychexID as paychexID,MiddleInit as MiddleInitial,independentContractor as IndependentContractor,doNotRehire as DoNotRehire,str_Gender as Gender,str_reason as Reason\n // from dbo.employee\n // LEFT JOIN dbo.classification ON dbo.employee.ClassificationID=dbo.classification.ClassificationID `;\n // const sql = ` use [${division_db}]; select dbo.employee.* from dbo.employee`;\n const sql = ` use [${division_db}]; select dbo.employee.* from dbo.employee`;\n\n self.db\n .request()\n .query(sql)\n .then(result => {\n deferred.resolve(result.recordset);\n })\n .catch(err => {\n console.trace(err); // todo : will do to logger later\n deferred.reject(err);\n });\n return deferred.promise;\n }", "function getTableData(dayPredData){\n var estadoCieloData = new Array();\n var cotaNieveProvData = new Array();\n var probPrecData = new Array();\n var rachaMaxData = new Array();\n var tableColumns = new Array();\n for(var i = 0; i < dayPredData.probPrecipitacion.length; i++){\n if(dayPredData.estadoCielo[i].periodo == \"00-24\" || dayPredData.cotaNieveProv[i].periodo == \"00-24\" || dayPredData.probPrecipitacion[i].periodo == \"00-24\" || dayPredData.rachaMax[i].periodo == \"00-24\"){\n continue;\n }\n tableColumns.push(dayPredData.estadoCielo[i].periodo + \"h\");\n pushDataToArray(estadoCieloData, dayPredData.estadoCielo[i].descripcion);\n pushDataToArray(cotaNieveProvData, dayPredData.cotaNieveProv[i].value);\n pushDataToArray(rachaMaxData, dayPredData.rachaMax[i].value);\n pushDataToArray(probPrecData, dayPredData.probPrecipitacion[i].value);\n }\n return [tableColumns, estadoCieloData, cotaNieveProvData, rachaMaxData, probPrecData];\n }", "function requestTableData() {\n var sortParams = o.scope.sortParams,\n pp = fs.isO(o.scope.payloadParams),\n payloadParams = pp || {},\n p = angular.extend({}, sortParams, payloadParams, o.query);\n\n if (wss.isConnected()) {\n if (fs.debugOn('table')) {\n $log.debug('Table data REQUEST:', req, p);\n }\n wss.sendEvent(req, p);\n ls.start();\n }\n }", "function GetAllDefectiveDamaged() {\n try {\n \n var data = {};\n var ds = {};\n ds = GetDataFromServer(\"DefectiveorDamaged/GetAllDefectiveDamaged/\", data);\n \n if (ds != '') {\n ds = JSON.parse(ds);\n }\n if (ds.Result == \"OK\") {\n \n return ds.Records;\n }\n if (ds.Result == \"ERROR\") {\n alert(ds.Message);\n }\n }\n catch (e) {\n notyAlert('error', e.message);\n }\n}", "async function getAllData(page = 1) {\n const offset = helper.getOffset(page, config.listPerPage);\n const rows = await db.query(\n `SELECT * FROM data`,\n [offset, config.listPerPage]\n );\n const data = helper.emptyOrRows(rows);\n const meta = { page };\n\n return {\n data,\n meta\n }\n}", "function dbGetCustTable(table, dataSet, renderFuncs){\n\tif(selectTableObj[table] === undefined){\n\t\tthrow \"GzFox websql : \"+table+\" undefined\";\n\t}\n\tif(dataSet === undefined){\n\t\tthrow \"GzFox websql : \"+dataSet+\" undefined\";\n\t}\n\tif(renderFuncs === undefined){\n\t\tthrow \"GzFox websql : \"+renderFuncs+\" undefined\";\n\t}\n\thtml5.webdb.queries(selectTableObj[table], dataSet, renderFuncs);\n}", "async function getData() {\n var res = await get_all_reports();\n await SetEventReports(res.data.data);\n $(\"#eventReportTable\").dataTable();\n }", "function getData(page) {\n $('table tbody').empty()\n $.ajax({\n 'url': 'http://localhost:8080/H2HBABBA1625/dummyServlet',\n 'type': 'GET',\n 'data': { page: page },\n 'datatype': 'json'\n }).then(data => {\n data = JSON.parse(data)\n var tr = $('table tbody')\n data.map(item => {\n markup = `<tr id=\"trow\">\n \t\t\t\t<td class='row-value'><input type=\"checkbox\" name=\"checkbox\" id=\"mark\"\n onclick=\"makeAvailable(this)\"></td>\n \t\t\t\t\t\t<td hidden>${item.key}</td>\n \t\t\t\t\t\t<td class=\"row-value\">${item.name_customer}</td>\n \t\t\t\t\t\t<td class=\"row-value\">${item.cust_number}</td>\n \t\t\t\t\t\t<td class=\"row-value\">${item.invoice_id}</td>\n \t\t\t\t\t\t<td class=\"row-value\">${item.total_open_amount}</td>\n \t\t\t\t\t\t<td class=\"row-value\">${item.clear_date}</td>\n \t\t\t\t\t\t<td class=\"row-value\">${item.due_in_date}</td>\n \t\t\t\t\t\t<td class=\"row-value\">${item.note}</td>\n \t\t\t\t\t</tr>`\n tr.append(markup)\n })\n })\n}", "function getTableData(){\r\n\tlet cells = document.querySelectorAll('#emailTable td');\t\r\n\tlet data = [];\r\n\r\n\tcells.forEach(function(cell){\r\n\t\tdata.push(cell.innerHTML);\r\n\t})\r\n\r\n\treturn data;\r\n}", "function getDataTable(sample_id) {\n var url_meta = \"/metadata/\" + sample_id;\n\n Plotly.d3.select(\"tbody\").html(\"\");\n\n Plotly.d3.json(url_meta, function (error, initDataMeta) {\n Plotly.d3.select(\"tbody\").selectAll(\"tr\")\n .data(initDataMeta)\n .enter()\n .append(\"tr\")\n .html(function (d) {\n return `<td>${Object.keys(d)}</td><td>${d[Object.keys(d)]}</td>`\n })\n });\n\n\n}", "function di_qds_get_all_ind_block_data()\n{\n\tvar RetVal = '';\n\n\ttry\n\t{\t\t\n\t\tRetVal = di_qds_get_all_ind_block_text();\n\t}\n\tcatch(err){}\n\t\n\treturn RetVal;\n}", "async function selectAllData() {\n let sql = 'SELECT sn,label FROM enterprise_info';\n console.log(sql);\n let dataList = await query(sql);\n return dataList;\n}", "getAll() {\n return this.getDataFromServer(this.path);\n }" ]
[ "0.6732181", "0.6566939", "0.65340036", "0.6367356", "0.62488455", "0.62386715", "0.62085646", "0.6062533", "0.6038704", "0.6027271", "0.6015181", "0.6009554", "0.5979166", "0.5966316", "0.5948171", "0.5924445", "0.58910364", "0.5887343", "0.58678", "0.58669263", "0.5854592", "0.58483034", "0.5834261", "0.5834261", "0.58301055", "0.582093", "0.58150995", "0.58100843", "0.57911277", "0.5772337", "0.57651764", "0.5765164", "0.5759175", "0.5758854", "0.57532847", "0.5725821", "0.5725821", "0.572321", "0.5707644", "0.5687581", "0.5687581", "0.5680591", "0.56731623", "0.56731623", "0.56691206", "0.56616575", "0.56521034", "0.5639931", "0.5634493", "0.56153953", "0.56063384", "0.5600985", "0.55888224", "0.558496", "0.55834866", "0.5578997", "0.55782783", "0.5577957", "0.5577177", "0.555995", "0.555463", "0.5552167", "0.5544897", "0.55437005", "0.55256194", "0.5523956", "0.5511748", "0.5493319", "0.5492091", "0.5488949", "0.54775834", "0.5465888", "0.54570436", "0.54510003", "0.5442975", "0.5441867", "0.5438191", "0.5431384", "0.54274625", "0.5423771", "0.5421808", "0.5415185", "0.5409074", "0.5396616", "0.5380082", "0.53679764", "0.53616774", "0.53611445", "0.5349086", "0.53468764", "0.53441846", "0.53440046", "0.5343284", "0.5338702", "0.5338622", "0.5335559", "0.53288823", "0.53221023", "0.53217334", "0.5308289", "0.5306716" ]
0.0
-1
POST METHOD DATA THIS FUNCTION WILL BE HANDLE ALL FUNCTION WITH POST METHOD REQUEST Table of Contents 1. INSERT DATA 2. UPDATE DATE
function doPost(e) { var ssID = SpreadsheetApp.openById(SHEETS_ID); var tableName = e.parameter.tableName; var action = e.parameter.action; var sheet = ssID.getSheetByName(tableName); switch (action) { case "insert": return insert_data(e, sheet, "BELUM"); break; case "update": return update_data(e, sheet); break; case "qr_code": return scan_qr(e, sheet); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handlePost() {\n\tvar bodyStr = $.request.body ? $.request.body.asString() : undefined;\n\tif ( bodyStr === undefined ){\n\t\t $.response.status = $.net.http.INTERNAL_SERVER_ERROR;\n\t\t return {\"myResult\":\"Missing BODY\"};\n\t}\n\t\n\tvar conn = $.db.getConnection();\n\tvar data = $.request.body.asString();\n\tvar dataParsed= JSON.parse(data);\n\t\n\tvar tableName = dataParsed.tableName;\n\tvar entryNum = dataParsed.tableData.length;\n\tvar tableData = dataParsed.tableData;\n\t\n\n\t//judge for different TABLE\n\tswitch(tableName){\n\t\n\t\tcase 'CMTBL':\n\t\t\tvar userInfo = dataParsed.userInfo;\n\t\t\t\n\t\t\t\n\t\t\tvar loopIndex = 0;\n\t\t\tvar j = 0;\n\t\t\tvar respCode = true;\n\t\t\t//var insertStmt = conn.prepareStatement( 'INSERT INTO \"SMART_OPERATION\".\"CMTBL\" VALUES(?,?,?,?,?,?,?,0,?)' ); \n\t\t\t\n\t\t\tvar insertStmt = conn.prepareStatement( 'UPSERT \"SMART_OPERATION\".\"CMTBL\" VALUES(?,?,?,?,?,?,?,NULL,?) WHERE CUSTOMER_ID = ? AND SYSTEM_ID = ? AND SYSTEM_CLT = ? AND DATE_Y = ? AND DATE_M = ? AND TABLE_NAME = ?' );\n\t\t\tvar upsertStmt = conn.prepareStatement( 'upsert \"SMART_OPERATION\".\"SMOPS_MASTER\" values(?,?,?,?,?,\\'B\\',\\'TBL\\',null,\\'X\\') where customer_id = ? and sysid = ? and sysclt = ? and factor_name = ? and factor_category = \\'B\\' and factor_type = \\'TBL\\'' );\n\t\t\t\n\t\t\tinsertStmt.setBatchSize(100);\n\t\t\tupsertStmt.setBatchSize(100);\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\tfor(var i = 0; i < entryNum; i ++){\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tvar tableName = tableData[i].column_0;\n\t\t\t\t\tvar taanaYear = parseInt(tableData[i].column_1);\n\t\t\t\t\tvar taanaMonth = parseInt(tableData[i].column_2);\n\t\t\t\t\tvar tableEntries = parseInt(tableData[i].column_3);\n\t\t\t\t\tvar tableEntriesTotal = parseInt((tableData[i].column_4 === \"\") ? \"0\" : tableData[i].column_4);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tinsertStmt.setString(1,userInfo.customerId); //customer id -input\n\t\t\t\t\tinsertStmt.setString(2,userInfo.sysId); //sys id -input\n\t\t\t\t\tinsertStmt.setString(3,userInfo.sysClt); //sys client -input\n\t\t\t\t\tinsertStmt.setInteger(4,taanaYear);\t//year -input\n\t\t\t\t\tinsertStmt.setInteger(5,taanaMonth);\t//month -input\n\t\t\t\t\tinsertStmt.setString(6,tableName);\t//task type -input\n\t\t\t\t\tinsertStmt.setInteger(7,tableEntries); //report name -input\n\t\t\t\t\tinsertStmt.setInteger(8,tableEntriesTotal); //db total -input\n\t\t\t\t\tinsertStmt.setString(9,userInfo.customerId);\n\t\t\t\t\tinsertStmt.setString(10,userInfo.sysId);\n\t\t\t\t\tinsertStmt.setString(11,userInfo.sysClt);\n\t\t\t\t\tinsertStmt.setInteger(12,taanaYear);\n\t\t\t\t\tinsertStmt.setInteger(13,taanaMonth);\n\t\t\t\t\tinsertStmt.setString(14,tableName);\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tupsertStmt.setString(1,userInfo.customerId);\n\t\t\t\t\tupsertStmt.setString(2,tableName);\n\t\t\t\t\tupsertStmt.setString(3,tableName);\n\t\t\t\t\tupsertStmt.setString(4,userInfo.sysId);\n\t\t\t\t\tupsertStmt.setString(5,userInfo.sysClt);\n\t\t\t\t\tupsertStmt.setString(6,userInfo.customerId);\n\t\t\t\t\tupsertStmt.setString(7,userInfo.sysId);\n\t\t\t\t\tupsertStmt.setString(8,userInfo.sysClt);\n\t\t\t\t\tupsertStmt.setString(9,tableName);\n\t\t\t\t\t\n\t\n\t\t\t\t\t\n\t\t\t\t\tinsertStmt.addBatch(); \n\t\t\t\t\tupsertStmt.addBatch();\n\t\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tvar respArr = insertStmt.executeBatch();\n\t\t\t\n\t\t\tvar respArrU = upsertStmt.executeBatch();\n\t\t\tinsertStmt.close();\n\t\t\tupsertStmt.close();\n\t\t\t\n\t\t\tfor(var i = 0; i < entryNum; i++){\n\t\t\t\tif(respArr[i] < 0){\n\t\t\t\t\trespCode = false;\n\t\t\t\t\t$.response.status = $.net.http.OK;\n\t\t\t\t return {\n\t\t\t\t \t\"RespondCode\": respCode\n\t\t\t\t };\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\trespCode = true;\n\t\t\n\t\tbreak;\n\t\n\t\tcase 'KMHDR':\n\t\t\tvar insertStmt = conn.prepareStatement( 'INSERT INTO \"SMART_OPERATION\".\"KMHDR\" VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)' ); \n\t\t\tinsertStmt.setBatchSize(entryNum);\n\t\t\t\n\t\t\tfor(var i = 0; i < entryNum; i ++){\n\t\t\t\t\n\t\t\t\tinsertStmt.setInteger(1,parseInt(tableData[i].column_0)); \n\t\t\t\tinsertStmt.setInteger(2,parseInt(tableData[i].column_1)); \n\t\t\t\tinsertStmt.setString(3,tableData[i].column_2);\n\t\t\t\tinsertStmt.setString(4,tableData[i].column_3);\n\t\t\t\tinsertStmt.setString(5,tableData[i].column_4);\n\t\t\t\tinsertStmt.setInteger(6,parseInt((tableData[i].column_5 == \"\") ? \"0\" : tableData[i].column_5));\n\t\t\t\tinsertStmt.setString(7,tableData[i].column_6);\n\t\t\t\tinsertStmt.setString(8,tableData[i].column_7);\n\t\t\t\tinsertStmt.setDate(9,tableData[i].column_8); \n\t\t\t\tinsertStmt.setString(10,tableData[i].column_9);\n\t\t\t\tinsertStmt.setDate(11,tableData[i].column_10);\n\t\t\t\tinsertStmt.setString(12,tableData[i].column_11);\n\t\t\t\tinsertStmt.setString(13,tableData[i].column_12);\n\t\t\t\t\n\t\t\t\tinsertStmt.addBatch(); \n\t\t\t}\n\t\t\t\n\t\t\tvar respArr = insertStmt.executeBatch();\n\t\t\tinsertStmt.close();\n\t\t\tvar respCode = true;\n\t\t\tfor(var i = 0; i < entryNum; i++){\n\t\t\t\t\n\t\t\t\tif(respArr[i] < 0){\n\t\t\t\t\trespCode = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\n\t\tcase 'KMBSC':\n\t\t\tvar insertStmt = conn.prepareStatement( 'INSERT INTO \"SMART_OPERATION\".\"KMBSC\" VALUES(?,?,?,?,?,?)' ); \n\t\t\tinsertStmt.setBatchSize(entryNum);\n\t\t\t\n\t\t\tfor(var i = 0; i < entryNum; i ++){\n\t\t\t\t\n\t\t\t\tinsertStmt.setInteger(1,parseInt(tableData[i].column_0)); \n\t\t\t\tinsertStmt.setInteger(2,parseInt(tableData[i].column_1)); \n\t\t\t\tinsertStmt.setString(3,tableData[i].column_2);\n\t\t\t\tinsertStmt.setString(4,tableData[i].column_3);\n\t\t\t\tinsertStmt.setString(5,tableData[i].column_4);\n\t\t\t\tinsertStmt.setDouble(6,parseFloat(tableData[i].column_5));\n\t\t\t\t\n\t\t\t\tinsertStmt.addBatch(); \n\t\t\t}\n\t\t\t\n\t\t\tvar respArr = insertStmt.executeBatch();\n\t\t\tinsertStmt.close();\n\t\t\tvar respCode = true;\n\t\t\tfor(var i = 0; i < entryNum; i++){\n\t\t\t\t\n\t\t\t\tif(respArr[i] < 0){\n\t\t\t\t\trespCode = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\n\t\tcase 'KMDVM':\n\t\t\tvar insertStmt = conn.prepareStatement( 'INSERT INTO \"SMART_OPERATION\".\"KMDVM\" VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)' ); \n\t\t\tinsertStmt.setBatchSize(entryNum);\n\t\t\t\n\t\t\tfor(var i = 0; i < entryNum; i ++){\n\t\t\t\t\n\t\t\t\tinsertStmt.setInteger(1,parseInt(tableData[i].column_0)); \n\t\t\t\tinsertStmt.setDouble(2,parseFloat((tableData[i].column_1 == \"\") ? \"0\" : tableData[i].column_1)); \n\t\t\t\tinsertStmt.setString(3,tableData[i].column_2);\n\t\t\t\tinsertStmt.setString(4,tableData[i].column_3);\n\t\t\t\tinsertStmt.setString(5,tableData[i].column_4);\n\t\t\t\tinsertStmt.setString(6,tableData[i].column_5);\n\t\t\t\tinsertStmt.setInteger(7,parseInt((tableData[i].column_6 == \"\") ? \"0\" : tableData[i].column_6));\n\t\t\t\tinsertStmt.setDouble(8,parseFloat((tableData[i].column_7 == \"\") ? \"0\" : tableData[i].column_7));\n\t\t\t\tinsertStmt.setDouble(9,parseFloat((tableData[i].column_8 == \"\") ? \"0\" : tableData[i].column_8)); \n\t\t\t\tinsertStmt.setDouble(10,parseFloat((tableData[i].column_9 == \"\") ? \"0\" : tableData[i].column_9));\n\t\t\t\tinsertStmt.setDouble(11,parseFloat((tableData[i].column_10 == \"\") ? \"0\" : tableData[i].column_10));\n\t\t\t\tinsertStmt.setString(12,tableData[i].column_11);\n\t\t\t\tinsertStmt.setString(13,tableData[i].column_12);\n\t\t\t\t\n\t\t\t\tinsertStmt.addBatch(); \n\t\t\t}\n\t\t\t\n\t\t\tvar respArr = insertStmt.executeBatch();\n\t\t\tinsertStmt.close();\n\t\t\tvar respCode = true;\n\t\t\tfor(var i = 0; i < entryNum; i++){\n\t\t\t\t\n\t\t\t\tif(respArr[i] < 0){\n\t\t\t\t\trespCode = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\n\t\t\t\n\t\tcase 'CMWLH':\n\t\t\t\n\t\t\tvar userInfo = dataParsed.userInfo;\n\t\t\t\n\t\t\tvar insertStmt = conn.prepareStatement( 'INSERT INTO \"SMART_OPERATION\".\"CMWLH\" VALUES(?,?,?,?,?,?,?,?,?,?,?,?)' ); \n\t\t\tinsertStmt.setBatchSize(entryNum);\n\t\t\t\n\t\t\tfor(var i = 0; i < entryNum; i ++){\n\t\t\t\t\n\t\t\t\tvar stepNum = parseInt((tableData[i].column_1 == \"\") ? \"0\" : tableData[i].column_1);\n\t\t\t\tvar cpuAvg = parseFloat((tableData[i].column_4 == \"\") ? \"0\" : tableData[i].column_4);\n\t\t\t\tvar dbAvg = parseFloat((tableData[i].column_5 == \"\") ? \"0\" : tableData[i].column_5);\n\t\t\t\t\n\t\t\t\tvar cpuTotal = parseFloat((stepNum * cpuAvg / 3600000).toFixed(1));\n\t\t\t\tvar dbTotal = parseFloat((stepNum * dbAvg / 3600000).toFixed(1));\n\t\t\t\tvar respTotal = parseFloat((cpuTotal + dbTotal).toFixed(1));\n\t\t\t\t\n\t\t\t\tinsertStmt.setString(1,userInfo.customerId); //customer id -input\n\t\t\t\tinsertStmt.setString(2,userInfo.sysId); //sys id -input\n\t\t\t\tinsertStmt.setString(3,userInfo.sysClt); //sys client -input\n\t\t\t\tinsertStmt.setInteger(4,parseInt(userInfo.dateYear));\t//year -input\n\t\t\t\tinsertStmt.setInteger(5,parseInt(userInfo.dateMonth));\t//month -input\n\t\t\t\tinsertStmt.setString(6,tableData[i].column_0);\t//task type -input\n\t\t\t\tinsertStmt.setInteger(7,stepNum); //step num -input\n\t\t\t\tinsertStmt.setDouble(8,cpuAvg); //cpu avg -input\n\t\t\t\tinsertStmt.setDouble(9,dbAvg); //db avg -input\n\t\t\t\tinsertStmt.setDouble(10,cpuTotal); //cpu total - cal\n\t\t\t\tinsertStmt.setDouble(11,dbTotal); //db total -cal\n\t\t\t\tinsertStmt.setDouble(12,respTotal); //cpu + db\n\n\t\t\t\t\n\t\t\t\tinsertStmt.addBatch(); \n\t\t\t}\n\t\t\t\n\t\t\tvar respArr = insertStmt.executeBatch();\n\t\t\tinsertStmt.close();\n\t\t\tvar respCode = true;\n\t\t\tfor(var i = 0; i < entryNum; i++){\n\t\t\t\t\n\t\t\t\tif(respArr[i] < 0){\n\t\t\t\t\trespCode = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tbreak;\n\t\t\t\n\t\t\t\n\t\tcase 'CMWLP':\n\t\t\t\n\t\t\tvar userInfo = dataParsed.userInfo;\n\t\t\tvar taskType = dataParsed.taskType;\n\t\t\t\n\t\t\t\n\t\t\tif(parseInt(userInfo.dateMonth) == 1){\n\t\t\t\tvar lastMonthNode = 12;\n\t\t\t\tvar lastYearNode = parseInt(userInfo.dateYear) - 1;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tvar lastYearNode = parseInt(userInfo.dateYear);\n\t\t\t\tvar lastMonthNode = parseInt(userInfo.dateMonth) - 1;\n\t\t\t}\n\t\t\t\n\t\t\tvar lastBaseNumber = 0.0;\n\t\t\tvar trendValue = 0.0;\n\t\t\t\n\t\t\tswitch(taskType){\n\t\t\t\n\t\t\tcase \"DIALOG\":\n\t\t\t\tvar factorType = \"DIA\";\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"BACKGROUND\":\n\t\t\t\tvar factorType = \"BTC\";\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase \"RFC\":\n\t\t\t\tvar factorType = \"RFC\";\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tdefault:\n\t\t\t\tvar factorType = \"OTH\";\n\t\t\t\tbreak;\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tvar loopIndex = 0;\n\t\t\tvar j = 0;\n\t\t\tvar respCode = true;\n\t\t\t\n\t\t\t\n\t\t\tvar insertStmt = conn.prepareStatement( 'INSERT INTO \"SMART_OPERATION\".\"CMWLP\" VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)' ); \n\t\t\tvar upsertStmt = conn.prepareStatement( 'upsert \"SMART_OPERATION\".\"SMOPS_MASTER\" values(?,?,?,?,?,\\'S\\',?,?,\\'X\\') where customer_id = ? and sysid = ? and sysclt = ? and factor_name = ? and factor_category = \\'S\\' and factor_type = ?' );\n\t\t\t\n\t\t\tinsertStmt.setBatchSize(100);\n\t\t\tupsertStmt.setBatchSize(100);\n\t\t\t\n\t\t\tif(taskType == \"BACKGROUND\"){\n\t\t\t\n\t\t\t\tfor(var i = 0; i < entryNum; i ++){\n\t\t\t\t\t\n\t\t\t\t\tvar cpuTotal_s = parseFloat((tableData[i].column_7 == \"\") ? \"0\" : tableData[i].column_7);\n\t\t\t\t\tvar dbTotal_s = parseFloat((tableData[i].column_9 == \"\") ? \"0\" : tableData[i].column_9);\n\t\t\t\t\t\n\t\t\t\t\tvar cpuTotal = parseFloat((cpuTotal_s / 3600).toFixed(1));\n\t\t\t\t\tvar dbTotal = parseFloat((dbTotal_s / 3600).toFixed(1));\n\t\t\t\t\t\n\t\t\t\t\tvar respTotal = cpuTotal + dbTotal;\n\t\t\t\t\t\n\t\t\t\t\tvar procStep = parseInt((tableData[i].column_2 == \"\") ? \"0\" : tableData[i].column_2);\n\t\t\t\t\tvar respAvg_ms = parseFloat((tableData[i].column_4 == \"\") ? \"0\" : tableData[i].column_4);\n\t\t\t\t\tvar respTotalSecond = parseFloat((tableData[i].column_3 == \"\") ? \"0\" : tableData[i].column_3);\n\t\t\t\t\t\n\t\t\t\t\tvar respAvg = parseFloat((respAvg_ms / 1000).toFixed(1));\n\t\t\t\t\t\n\t\t\t\t\tinsertStmt.setString(1,userInfo.customerId); //customer id -input\n\t\t\t\t\tinsertStmt.setString(2,userInfo.sysId); //sys id -input\n\t\t\t\t\tinsertStmt.setString(3,userInfo.sysClt); //sys client -input\n\t\t\t\t\tinsertStmt.setInteger(4,parseInt(userInfo.dateYear));\t//year -input\n\t\t\t\t\tinsertStmt.setInteger(5,parseInt(userInfo.dateMonth));\t//month -input\n\t\t\t\t\tinsertStmt.setString(6,taskType);\t//task type -input\n\t\t\t\t\tinsertStmt.setString(7,tableData[i].column_0); //report name -input\n\t\t\t\t\tinsertStmt.setDouble(8,cpuTotal); //cpu total -input\n\t\t\t\t\tinsertStmt.setDouble(9,dbTotal); //db total -input\n\t\t\t\t\tinsertStmt.setDouble(10,respTotal); //cpu + db -cal\n\t\t\t\t\t//for avg resp and steps\n\t\t\t\t\tinsertStmt.setInteger(11,procStep);//step\n\t\t\t\t\tinsertStmt.setDouble(12,respAvg);//response time avg\n\t\t\t\t\tinsertStmt.setDouble(13,respTotalSecond);//total resp time by second\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t///// update TREND start\n\t\t\t\t\tvar verifyDataExistStmt = conn.prepareStatement( 'SELECT COUNT (*) FROM \"SMART_OPERATION\".\"CMWLP\" WHERE CUSTOMER_ID = ? AND SYSTEM_ID = ? AND SYSTEM_CLT = ? AND TASK_TYPE = ? AND REPORT_NAME = ? AND DATE_Y = ? AND DATE_M = ?' ); \n\t\t\t\t\t\n\t\t\t\t\tverifyDataExistStmt.setString(1,userInfo.customerId);\n\t\t\t\t\tverifyDataExistStmt.setString(2,userInfo.sysId);\n\t\t\t\t\tverifyDataExistStmt.setString(3,userInfo.sysClt);\n\t\t\t\t\tverifyDataExistStmt.setString(4,taskType);\n\t\t\t\t\tverifyDataExistStmt.setString(5,tableData[i].column_0);\n\t\t\t\t\tverifyDataExistStmt.setInteger(6,lastYearNode);\n\t\t\t\t\tverifyDataExistStmt.setInteger(7,lastMonthNode);\n\t\t\t\t\t\n\t\t\t\t\tverifyDataExistStmt.executeQuery();\n\t\t\t\t\tvar getCount = [];\n\t\t\t\t\tvar\tverifyResult = verifyDataExistStmt.getResultSet();\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\twhile(verifyResult.next())\n\t\t\t\t\t{\n\t\t\t\t\t\tgetCount.push({\n\t\t\t\t\t\t\t\"result\":verifyResult.getString(1)\n\t\t\t\t\t\t});\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar countNumber = parseInt(getCount[0].result);\n\t\t\t\t\t\n\t\t\t\t\tif(countNumber == 0){\n\t\t\t\t\t\tlastBaseNumber = 0.0;\n\t\t\t\t\t\ttrendValue = 9999.99;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar selectLastBaseStmt = conn.prepareStatement( 'SELECT SUM (RESP_TOTAL) FROM \"SMART_OPERATION\".\"CMWLP\" WHERE CUSTOMER_ID = ? AND SYSTEM_ID = ? AND SYSTEM_CLT = ? AND TASK_TYPE = ? AND REPORT_NAME = ? AND DATE_Y = ? AND DATE_M = ? GROUP BY DATE_Y, DATE_M' ); \n\t\t\t\t\t\t\n\t\t\t\t\t\tselectLastBaseStmt.setString(1,userInfo.customerId);\n\t\t\t\t\t\tselectLastBaseStmt.setString(2,userInfo.sysId);\n\t\t\t\t\t\tselectLastBaseStmt.setString(3,userInfo.sysClt);\n\t\t\t\t\t\tselectLastBaseStmt.setString(4,taskType);\n\t\t\t\t\t\tselectLastBaseStmt.setString(5,tableData[i].column_0);\n\t\t\t\t\t\tselectLastBaseStmt.setInteger(6,lastYearNode);\n\t\t\t\t\t\tselectLastBaseStmt.setInteger(7,lastMonthNode);\n\t\t\t\t\t\t\n\t\t\t\t\t\tselectLastBaseStmt.executeQuery();\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar\tlastBaseResult = selectLastBaseStmt.getResultSet();\n\t\t\t\t\t\tvar getLastBase = [];\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile(lastBaseResult.next())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgetLastBase.push({\n\t\t\t\t\t\t\t\t\"result\":lastBaseResult.getString(1)\n\t\t\t\t\t\t\t});\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tlastBaseNumber = parseFloat(getLastBase[0].result);\n\t\t\t\t\t\t\n\t\t\t\t\t\tlastBaseResult.close();\n\t\t\t\t\t\tselectLastBaseStmt.close();\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(lastBaseNumber == 0.0 ){\n\t\t\t\t\t\t\ttrendValue = 9999.99;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\ttrendValue = ((respTotalSecond - lastBaseNumber) / lastBaseNumber) * 100;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tverifyResult.close();\n\t\t\t\t\tverifyDataExistStmt.close();\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t///// update TREND end\n\t\t\t\t\t\n\t\t\t\t\tupsertStmt.setString(1,userInfo.customerId);\n\t\t\t\t\tupsertStmt.setString(2,tableData[i].column_0);\n\t\t\t\t\tupsertStmt.setString(3,tableData[i].column_0);\n\t\t\t\t\tupsertStmt.setString(4,userInfo.sysId);\n\t\t\t\t\tupsertStmt.setString(5,userInfo.sysClt);\n\t\t\t\t\tupsertStmt.setString(6,factorType);\n\t\t\t\t\tupsertStmt.setDouble(7,trendValue);\n\t\t\t\t\tupsertStmt.setString(8,userInfo.customerId);\n\t\t\t\t\tupsertStmt.setString(9,userInfo.sysId);\n\t\t\t\t\tupsertStmt.setString(10,userInfo.sysClt);\n\t\t\t\t\tupsertStmt.setString(11,tableData[i].column_0);\n\t\t\t\t\tupsertStmt.setString(12,factorType);\n\t\t\t\t\t\n\t\n\t\t\t\t\t\n\t\t\t\t\tinsertStmt.addBatch(); \n\t\t\t\t\tupsertStmt.addBatch();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(taskType == \"DIALOG\" || taskType == \"RFC\"){\n\t\t\t\t\n\t\t\t\tfor(var i = 0; i < entryNum; i ++){\n\t\t\t\t\t\n\t\t\t\t\tvar cpuTotal_s = parseFloat((tableData[i].column_6 == \"\") ? \"0\" : tableData[i].column_6);\n\t\t\t\t\tvar dbTotal_s = parseFloat((tableData[i].column_8 == \"\") ? \"0\" : tableData[i].column_8);\n\t\t\t\t\t\n\t\t\t\t\tvar cpuTotal = parseFloat((cpuTotal_s / 3600).toFixed(1));\n\t\t\t\t\tvar dbTotal = parseFloat((dbTotal_s / 3600).toFixed(1));\n\t\t\t\t\t\n\t\t\t\t\tvar respTotal = cpuTotal + dbTotal;\n\t\t\t\t\t\n\t\t\t\t\tvar procStep = parseInt((tableData[i].column_1 == \"\") ? \"0\" : tableData[i].column_1);\n\t\t\t\t\tvar respAvg_ms = parseFloat((tableData[i].column_3 == \"\") ? \"0\" : tableData[i].column_3);\n\t\t\t\t\tvar respTotalSecond = parseFloat((tableData[i].column_2 == \"\") ? \"0\" : tableData[i].column_2);\n\t\t\t\t\t\n\t\t\t\t\tvar respAvg = parseFloat((respAvg_ms / 1000).toFixed(1));\n\t\t\t\t\t\n\t\t\t\t\tinsertStmt.setString(1,userInfo.customerId); //customer id -input\n\t\t\t\t\tinsertStmt.setString(2,userInfo.sysId); //sys id -input\n\t\t\t\t\tinsertStmt.setString(3,userInfo.sysClt); //sys client -input\n\t\t\t\t\tinsertStmt.setInteger(4,parseInt(userInfo.dateYear));\t//year -input\n\t\t\t\t\tinsertStmt.setInteger(5,parseInt(userInfo.dateMonth));\t//month -input\n\t\t\t\t\tinsertStmt.setString(6,taskType);\t//task type -input\n\t\t\t\t\tinsertStmt.setString(7,tableData[i].column_0); //report name -input\n\t\t\t\t\tinsertStmt.setDouble(8,cpuTotal); //cpu total -input\n\t\t\t\t\tinsertStmt.setDouble(9,dbTotal); //db total -input\n\t\t\t\t\tinsertStmt.setDouble(10,respTotal); //cpu + db -cal\n\t\t\t\t\t//for avg resp and steps\n\t\t\t\t\tinsertStmt.setInteger(11,procStep);//step\n\t\t\t\t\tinsertStmt.setDouble(12,respAvg);//response time avg\n\t\t\t\t\tinsertStmt.setDouble(13,respTotalSecond);//total resp time by second\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t///// update TREND start\n\t\t\t\t\tvar verifyDataExistStmt = conn.prepareStatement( 'SELECT COUNT (*) FROM \"SMART_OPERATION\".\"CMWLP\" WHERE CUSTOMER_ID = ? AND SYSTEM_ID = ? AND SYSTEM_CLT = ? AND TASK_TYPE = ? AND REPORT_NAME = ? AND DATE_Y = ? AND DATE_M = ?' ); \n\t\t\t\t\t\n\t\t\t\t\tverifyDataExistStmt.setString(1,userInfo.customerId);\n\t\t\t\t\tverifyDataExistStmt.setString(2,userInfo.sysId);\n\t\t\t\t\tverifyDataExistStmt.setString(3,userInfo.sysClt);\n\t\t\t\t\tverifyDataExistStmt.setString(4,taskType);\n\t\t\t\t\tverifyDataExistStmt.setString(5,tableData[i].column_0);\n\t\t\t\t\tverifyDataExistStmt.setInteger(6,lastYearNode);\n\t\t\t\t\tverifyDataExistStmt.setInteger(7,lastMonthNode);\n\t\t\t\t\t\n\t\t\t\t\tverifyDataExistStmt.executeQuery();\n\t\t\t\t\tvar getCount = [];\n\t\t\t\t\tvar\tverifyResult = verifyDataExistStmt.getResultSet();\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\twhile(verifyResult.next())\n\t\t\t\t\t{\n\t\t\t\t\t\tgetCount.push({\n\t\t\t\t\t\t\t\"result\":verifyResult.getString(1)\n\t\t\t\t\t\t});\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar countNumber = parseInt(getCount[0].result);\n\t\t\t\t\t\n\t\t\t\t\tif(countNumber == 0){\n\t\t\t\t\t\tlastBaseNumber = 0.0;\n\t\t\t\t\t\ttrendValue = 9999.99;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tvar selectLastBaseStmt = conn.prepareStatement( 'SELECT SUM (RESP_TOTAL) FROM \"SMART_OPERATION\".\"CMWLP\" WHERE CUSTOMER_ID = ? AND SYSTEM_ID = ? AND SYSTEM_CLT = ? AND TASK_TYPE = ? AND REPORT_NAME = ? AND DATE_Y = ? AND DATE_M = ? GROUP BY DATE_Y, DATE_M' ); \n\t\t\t\t\t\t\n\t\t\t\t\t\tselectLastBaseStmt.setString(1,userInfo.customerId);\n\t\t\t\t\t\tselectLastBaseStmt.setString(2,userInfo.sysId);\n\t\t\t\t\t\tselectLastBaseStmt.setString(3,userInfo.sysClt);\n\t\t\t\t\t\tselectLastBaseStmt.setString(4,taskType);\n\t\t\t\t\t\tselectLastBaseStmt.setString(5,tableData[i].column_0);\n\t\t\t\t\t\tselectLastBaseStmt.setInteger(6,lastYearNode);\n\t\t\t\t\t\tselectLastBaseStmt.setInteger(7,lastMonthNode);\n\t\t\t\t\t\t\n\t\t\t\t\t\tselectLastBaseStmt.executeQuery();\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar\tlastBaseResult = selectLastBaseStmt.getResultSet();\n\t\t\t\t\t\tvar getLastBase = [];\n\t\t\t\t\t\t\n\t\t\t\t\t\twhile(lastBaseResult.next())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgetLastBase.push({\n\t\t\t\t\t\t\t\t\"result\":lastBaseResult.getString(1)\n\t\t\t\t\t\t\t});\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tlastBaseNumber = parseFloat(getLastBase[0].result);\n\t\t\t\t\t\t\n\t\t\t\t\t\tlastBaseResult.close();\n\t\t\t\t\t\tselectLastBaseStmt.close();\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(lastBaseNumber == 0.0 ){\n\t\t\t\t\t\t\ttrendValue = 9999.99;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\ttrendValue = ((respTotalSecond - lastBaseNumber) / lastBaseNumber) * 100;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tverifyResult.close();\n\t\t\t\t\tverifyDataExistStmt.close();\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t///// update TREND end\n\t\t\t\t\t\n\t\t\t\t\tupsertStmt.setString(1,userInfo.customerId);\n\t\t\t\t\tupsertStmt.setString(2,tableData[i].column_0);\n\t\t\t\t\tupsertStmt.setString(3,tableData[i].column_0);\n\t\t\t\t\tupsertStmt.setString(4,userInfo.sysId);\n\t\t\t\t\tupsertStmt.setString(5,userInfo.sysClt);\n\t\t\t\t\tupsertStmt.setString(6,factorType);\n\t\t\t\t\tupsertStmt.setDouble(7,trendValue);\n\t\t\t\t\tupsertStmt.setString(8,userInfo.customerId);\n\t\t\t\t\tupsertStmt.setString(9,userInfo.sysId);\n\t\t\t\t\tupsertStmt.setString(10,userInfo.sysClt);\n\t\t\t\t\tupsertStmt.setString(11,tableData[i].column_0);\n\t\t\t\t\tupsertStmt.setString(12,factorType);\n\t\n\t\t\t\t\t\n\t\t\t\t\tinsertStmt.addBatch(); \n\t\t\t\t\tupsertStmt.addBatch();\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tvar respArr = insertStmt.executeBatch();\n\t\t\tvar respArrU = upsertStmt.executeBatch();\n\t\t\tinsertStmt.close();\n\t\t\tupsertStmt.close();\n\t\t\t\n\t\t\tfor(var i = 0; i < entryNum; i++){\n\t\t\t\tif(respArr[i] < 0){\n\t\t\t\t\trespCode = false;\n\t\t\t\t\t$.response.status = $.net.http.OK;\n\t\t\t\t return {\n\t\t\t\t \t\"RespondCode\": respCode\n\t\t\t\t };\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\trespCode = true;\n\t\t\t\n\t\t\t\n\t\t\tbreak;\n\t}\t\n\t\n\t \n conn.commit(); \n conn.close(); \n \n \n \n\t// Extract body insert data to DB and return results in JSON/other format\n\t$.response.status = $.net.http.OK;\n return {\n \t\"RespondCode\": respCode\n };\n}", "function POST(){\n \n}", "function postRESTlet(datain) {\n\n}", "function postRequest() {\n // TODO\n}", "function postCreate(data){\n $.post(location, data).done(function(_data){\n clearForm();\n updateTableCrate(_data);\n });\n }", "async function postData(temp,content){\n await fetch('/saveData', {\n method : 'POST',\n credentials: 'same-origin',\n headers: {\n 'Content-Type': 'application/json',\n }, \n body: JSON.stringify({\n date: newDate,\n temp,\n content \n })\n })\n}", "function doPost(e) {\r\n // data e kita verifikasi\r\n var update = tg.doPost(e);\r\n\r\n // jika data valid proses pesan\r\n if (update) {\r\n prosesPesan(update);\r\n }\r\n}", "function performAction(){\n const city = document.getElementById('city').value;\n //const country = document.getElementById('country').value;\n Client.clearOutput();\n postData('http://localhost:8000/addLocation', { city: city /*, country: country*/ })\n .then(\n function (Data) {\n ddateIndex = Client.calcCountDown(); //forcaset date index \n return postData('http://localhost:8000/addWeather', { lng: Data.lng, lat: Data.lat, index: ddateIndex })\n })\n .then( function () {\n return postData('http://localhost:8000/addPic', { city: city })\n \n })\n .then( res => {\n updateUI();\n })\n}", "async function dataposted(url,temp, feelings){ /* Function to POST data */\n let fetchedData = await fetch(url, {\n method: 'POST', \n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n },\n // Body data type must match \"Content-Type\" header\n \n body: JSON.stringify({\n date:newDate,\n temp:temp,\n feelings:feelings\n })\n })\n}", "function senGuiData()\n{\n\tvar datasend={\n\t\tevent:\"guidata\"\n\t}\n\tqueryDataGet(\"php/api_process.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(res);\n\t});\n\tqueryDataPost(\"php/api_process_post.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(\"Post:\"+res);\n\t});\n}", "function post() {\n $.post(\"http://localhost:3000/db\",{\n date: sendInfo.date,\n activities: JSON.stringify(sendInfo.activities), \n survey: JSON.stringify(surveyArray)}, \n function(data){\n if(data==='done')\n {\n alert(\"login success\");\n } else {\n console.log(data);\n }\n }).done(function (data) {\n console.log(\"$.post Data Loaded\", data);\n getData()\n });\n }", "function postService(url, sqlQuery, data){ \napp.post(url, function(request, response, next){\n try{\n var reqObj=request.body;\n request.getConnection(function(error, conn){\n if(error) {\n console.log(\"SQL connection error:\", error);\n return next(error);\n }\n else\n {\n var insertSql=sqlQuery;\n var insertValues={};\n for(var i=0; i<data.length; i++){\n insertValues[data[i]]=reqObj[data[i]]; \n }\n \n var query = conn.query(insertSql, insertValues, function(error, result){\n if(error){\n console.log(\"SQL error\", error);\n return next(error);\n } \n console.log(result);\n var name_id = result.insertId;\n response.json({\"name\": name_id});\n \n });\n }\n });\n }\n catch (ex){\n console.log(\"Internal Error:\"+ex);\n return next(ex);\n }\n \n \n});\n}", "postData() {\n throw new Error('Not implemented');\n }", "function insertData(req, res) {\n\tlet sqlquery = \"INSERT INTO benchmark(create_time, commit_hash, branch_name, os, cpu, mem, note) VALUES(?, ?, ?, ?, ?, ?, ?)\";\n\tlet new_datetime = new Date(); \n\t\n\t// validate body\n\tif(req.body.commit_hash==undefined || req.body.branch_name==undefined || req.body.os==undefined || req.body.cpu==undefined || req.body.mem==undefined) {\n\t\tconsole.log(\"Invalid query.\");\n\t\tres.send(\"Invalid query.\");\n\t\tres.status(400);\n\t}\n\telse {\n\t\tlet values = [new_datetime, req.body.commit_hash, req.body.branch_name, req.body.os, req.body.cpu, req.body.mem, req.body.note];\n\n\t\t// insert data\n\t\tconnection.query(sqlquery, values, function(err, result) {\n\t\t\tif (err) {\n\t\t\t\tthrow err;\n\t\t\t\tres.send(\"Could not insert data.\");\n\t\t\t\tres.status(503);\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// console.log(\"Inserted: \", values);\n\t\t\t\tres.send(\"Inserted data.\");\n\t\t\t\tres.status(201);\n\t\t\t}\n\t\t});\n\t}\n}", "articleStep1Post () {\n\t\t\tif (this.allKewords.length < 6) this.swalfire('error','6 keywords are required.');\n\t\t\telse {\n\t\t\t\tif (this.manu_script_id) {\n\t\t\t\t\tthis.$axios.patch('api/manuScriptContrlr/'+this.manu_script_id,this.aStep1Data).then(res => {\n\t\t\t\t\t\tthis.swalfire('success','Form data is saved successfully.');\n\t\t\t\t\t\t/*UPDATING KEYWORDS AND FILES ARRAY*/\n\t\t\t\t\t\tthis.uploadKywrds(this.manu_script_id);\n\t\t\t\t\t\tthis.getAllAddFiles(this.manu_script_id);\n\t\t\t\t\t\tthis.getAllMyFiles(this.manu_script_id);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.$axios.post('api/manuScriptContrlr',this.aStep1Data).then(res => {\n\t\t\t\t\t\tthis.manu_script_id = res.data;\n\t\t\t\t\t\tthis.swalfire('success','Form data is saved successfully.');\n\t\t\t\t\t\t/*UPDATING KEYWORDS AND FILES ARRAY*/\n\t\t\t\t\t\tthis.uploadKywrds(res.data);\n\t\t\t\t\t\tthis.getAllAddFiles(res.data);\n\t\t\t\t\t\tthis.getAllMyFiles(res.data);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function insertData(event) {\t\n\tvar json = {\n\t\t\"authent\": {\n\t\t\t\"username\": \"feferi\",\n\t\t\t\"password\": \"0413\"\n\t\t},\n\t\t\n\t\t\"requests\": [\n\t\t\t{\n\t\t\t\t\"type\": \"add\",\n\t\t\t\t\"records\": [\n\t\t\t\t\t{\n\t\t\t\t\t\t\"product\": Number(document.getElementById(\"product\").value),\n\t\t\t\t\t\t\"quantity\": Number(document.getElementById(\"quantity\").value),\n\t\t\t\t\t\t\"dateTime\": getDateAndTime()\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\t\n\t// UPDATED CALL SIGNATURE (return false event value)\n\treturn sendAPIRequest(json,event,displaySalesRecords);\n}", "postData(id, value, timestamp) {\n return new Promise((resolve, reject) => {\n const url = this.url + '/' + id;\n const body = value + ' ' + timestamp;\n\n request.post(url, {body}, (err, res) => {\n if (err) return reject(err);\n return resolve(res);\n });\n });\n }", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.GET) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"GET is not supported, perform a POST to add Logging Entries\"\n\t\t\t}));\n\t\t} else {\n\t\t\t//Perform Table Entry to be created in Logging Table\n\t\t\ttry {\n\t\t\t\tif (gvMethod === \"UPDATE\" || gvMethod === 'update' || gvMethod === \"Update\") {\n\t\t\t\t\tvar lsJournal = _getOriginalGuid();\n\t\t\t\t\t// \t_updateLogEntry(lsJournal.MESSAGE_GUID);\n\t\t\t\t\tif (lsJournal.MESSAGE_GUID) {\n\t\t\t\t\t\t_deleteLogEntry(lsJournal.MESSAGE_GUID);\n\t\t\t\t\t\t_createLogEntryUpdate(lsJournal.MESSAGE_GUID);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t_createLogEntry();\n\t\t\t\t}\n\t\t\t} catch (errorObj) {\n\t\t\t\tgvTableUpdate = \"Error during table insert:\" + errorObj.message;\n\t\t\t}\n\t\t\t//Delete all entries older than 90 days\n\t\t\ttry {\n\t\t\t\t//Logging Table\n\t\t\t\t// _deleteHistoricEntries();\n\t\t\t\t//Header Table\n\t\t\t\t// _deleteHistoricEntriesContentTables(gvHeaderTable);\n\t\t\t\t//Item Table\n\t\t\t\t// _deleteHistoricEntriesContentTables(gvItemTable);\n\t\t\t\t//Currency Table\n\t\t\t\t// _deleteHistoricEntriesContentTables(gvCurrencyTable);\n\t\t\t} catch (errorObj) {\n\t\t\t\tgvTableUpdate += \"Error during deletion of historic entries:\" + errorObj.message;\n\t\t\t}\n\t\t\t//Save Payload Fields\n\t\t\ttry {\n\t\t\t\t// _savePayloadFields();\n\t\t\t} catch (errorObj) {\n\t\t\t\tgvTableUpdate += \"Error saving Payload level entries:\" + errorObj.message;\n\t\t\t}\n\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tTableUpdateStatus: gvTableUpdate\n\t\t\t}));\n\t\t}\n\t}", "async create_post(req,res){\n\t\ttry{\n\t\t\tconst required = {\n\t\t\t\tsecurity_key:req.headers.security_key,\n\t\t\t\tauthorization_key:req.headers.authorization_key,\n\t\t\t\tdata:req.body,\n\t\t\t\tcheckexist:2\n\t\t\t}\t\n\t\t\tconst non_required= {}\n\t\t\tlet requestdata = await App.vaildObject(required,non_required);\n\t\t\tlet total_price=0;\n\t\t\tfor(let price in requestdata.data.product_details){\n\t\t\t\tif(requestdata.data.product_details[price].amount){\n\t\t\t\t\ttotal_price+=requestdata.data.product_details[price].amount;\n\t\t\t\t}else{\n\t\t\t\t\tlet message=\"Amount filed is missing product_details at position \"+JSON.stringify(requestdata.data.product_details[price]);\n\t\t\t\t\tthrow {code:400,message};\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet complete_data={\n\t\t\t\taddresses:requestdata.data.address,\n\t\t\t\tproduct_details:requestdata.data.product_details,\n\t\t\t\tuser_id:requestdata.users.id,\n\t\t\t\tamount:total_price\n\t\t\t};\n\t\t\tlet last_insert_id= await DB.save('create_posts',complete_data);\n\t\t\tcomplete_data.id=last_insert_id; \n\t\t\tcomplete_data.status=0; \n\t\t\tres.status(200).json({\n\t\t\t\t'success':true,\n\t\t\t\t'message':\"Create Post\",\n\t\t\t\t'code':200,\n\t\t\t\t'body':complete_data\n\t\t\t});\n\t\t}catch(err){\n\t\t\t$this.error(res,err);\n\t\t}\n\t}", "function addPostData(req,res) {\n console.log('In-> addPostData()'); // DEBUG\n //console.log('Adding: ', req,body);\n projectData.location = req.body.location;\n projectData.start_date = req.body.start_date;\n projectData.end_date = req.body.end_date;\n projectData.pixabay_url = req.body.pixabay_url;\n projectData.weather = req.body.weather;\n res.send(projectData);\n}", "function updatePayload(iParam) {\n var deferred = Q.defer(),\n fName = \"/updatetbldata\";\n Http.post(fName, iParam).success(function (response) {\n deferred.resolve(response);\n }).error(function (error) {\n deferred.reject(error);\n });\n return deferred.promise;\n }", "function addWeatherDatafunc(req, res){\r\n const newEntry={\r\n temp: req.body.datatemp,//defined on postData line 15\r\n date: req.body.date,//defined on postData line 15\r\n feelings: req.body.feelings,//defined on postData line 15\r\n cloud: req.body.cloud,//defined on postData line 15\r\n feelslike: req.body.feelslike,//defined on postData line 15\r\n \r\n }\r\n console.log(newEntry);\r\n projectData=newEntry; // if we stored data into an aarray we would use the push these data that we got from the api to our array\r\n}", "function createData(newData){\n request.post(\"https://mgcsolutions.net/api/timeline/create\",newData)\n .then(async data => {\n const test1 = data;\n console.log(\"Create Response : \" +test1); \n })\n .catch(err => console.log(err));\n }", "function sendata(action,user_id)\n{\n\tvar obj;\n\t\n\tif(action==\"in\") var meth =\"insert\";\n\telse var meth =\"update\";\n\tvar param =\"user_id=\"+user_id;\n\t\n\t\t\tif (window.XMLHttpRequest)\n\t\t\t{// code for IE7+, Firefox, Chrome, Opera, Safari\n\t\t obj=new XMLHttpRequest();\n\t\t\t//alert(param);\n\t\t }\n\t\t else\n\t\t {// code for IE6, IE5\n\t\t obj=new ActiveXObject(\"Microsoft.XMLHTTP\");\n\t\t }\n\t\t \n\t\t obj.onreadystatechange=function()\n\t\t {\n\t\t\t //alert(param);\n\t\t if (obj.readyState==4 )\n\t\t\t {\n\t\t\t\t alert(obj.responseText);\n // alert(obj.responseText);\n\t\t\t }\n\t\t\telse if (obj.readyState ==3) alert(\"server on work\");\n\t\t\t//else if (obj.readyState < 4) alert(\"loading\");\n\t\t\n\t\t\t // else alert(\"some error occured\");\n\t\t }\n\t\t\tobj.open(\"POST\",\"/index.php/timer/woo\",true);\n\t\t\tobj.setRequestHeader(\"Content-type\",\"application/x-www-form-urlencoded\");\n\t\t\tobj.send(param);\n\t\t \n\t\t \n}", "function achieved_target_data_save() {\n var date = $('#date').val();\n var productid = $('#product_id').val();\n var primary = $('#primary').val();\n var redistribution = $('#redistribution').val();\n\n\n\n\n $.post('view.php', {save_target_achieved: 'data', date: date, productid: productid, primary: primary, redistribution: redistribution}, function (data) {\n if (data.msgType === 1) {\n alertify.success(data.msg, 2000);\n } else {\n alertify.error(data.msg, 2000);\n }\n achived_target_data_table();\n achieved_clear_target();\n }, \"json\");\n\n\n}", "postForm(req, res) {\n\n if (req.body._id == '')\n insertRecord(req, res);\n else\n updateRecord(req, res);\n\n\n }", "function performAction() {\n\n //Select actual value of html input to include in post\n const zipCode = document.getElementById('zip').value;\n // const feelings = document.getElementById('feelings').value;\n\n const url = `${baseURL}${zipCode}&appid=${apiKey}&units=metric`;\n\n if (zipCode===\"\") {\n alert(\"Please enter the zip code\");\n }\n else {\n //call getData function\n getData(url) \n .then(function (userData) {\n //Add data to post request\n //call function & pass it POST route url & data to save in app\n postData('/add', {\n date: newDate, \n temp: userData.main.temp, \n // content: feelings\n })\n })\n .then(function (newData) {\n //call function to update browser content\n updateUI(newData)\n })\n } \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}", "static update (data, callback = f => f) {\n return createRequest({\n url: this.HOST + this.URL,\n data,\n method: 'POST',\n responseType: 'json',\n callback (e, response) {\n if (e === null && response) {\n callback(e, response);\n } else {\n console.error(e);\n };\n }\n });\n }", "function postData(donnee, valeur){\n\tvar querystring = require('querystring');\n\tvar http = require('http');\n\n // Build the post string from an object\n var post_data = querystring.stringify({\n 'action': 'datalizer_setData',\n 'donnee' : donnee,\n 'valeur' : valeur\n });\n\n // An object of options to indicate where to post to\n var post_options = {\n host: 'localhost',\n port: '80',\n path: '/wp-admin/admin-ajax.php',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Content-Length': post_data.length\n }\n };\n\n // Set up the request\n var post_req = http.request(post_options, function(res) {\n res.setEncoding('utf8');\n res.on('data', function (chunk) {\n //console.log('Response: ' + chunk);\n });\n });\n post_req.on('error', function(e) {\n console.log('problem with request: ' + e.message);\n });\n\n // post the data\n post_req.write(post_data);\n post_req.end();\n\n}", "function Generatedata(){\n const zibvalue= zip.value\n const feelingsvalue=feelings.value\n\n gitWeatherApi(ApiUrl,zibvalue,ApiKey).then((res)=>{\n console.log(res);\n // make destructing object to filter data\n const{main:{temp},name:city,weather:[{description}]}=res\n const obsend={\n newdate,\n temp:Math.round(temp),\n city,\n description,\n feelingsvalue\n };\n postData(urlserver + '/add',obsend)\n fetchDataInUi()\n })\n}", "sendData(requestMethod, postURL, dataToSubmit) {\n let request = new XMLHttpRequest();\n\n request.open(requestMethod, postURL, true);\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n request.send(dataToSubmit);\n }", "sendData(requestMethod, postURL, dataToSubmit) {\n let request = new XMLHttpRequest();\n\n request.open(requestMethod, postURL, true);\n request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n request.send(dataToSubmit);\n }", "function postData() {\n \"use strict\";\n\n var response = [{name:'GOLDUD'},{name:'AUDUSD'},{name:'EURUSD'},{name:'GBPUSD'},{name:'NZDUSD'},{name:'USDCAD'},{name:'USDCHF'},{name:'USDJPY'},{name:'EURJPY'},{name:'GBPJPY'}];\n getDataRoot(response);\n }", "static insert(request, response) {\r\n \r\n //recupera do body os campos que serao atualizados na tabela\r\n const conditions = [\r\n {\r\n field: 'name',\r\n value: request.body.name\r\n },\r\n {\r\n field: 'email',\r\n value: request.body.email\r\n },\r\n {\r\n field: 'password',\r\n value: request.body.password\r\n },\r\n {\r\n field: 'countrycode',\r\n value: request.body.countrycode\r\n },\r\n {\r\n field: 'areacode',\r\n value: request.body.areacode\r\n },\r\n {\r\n field: 'telephone',\r\n value: request.body.telephone\r\n },\r\n {\r\n field: 'zipcode',\r\n value: request.body.zipcode\r\n },\r\n ];\r\n\r\n //chama rotina para inclusao dos dados\r\n clientsModel.insert(conditions) \r\n .then( _ => {\r\n response.sendStatus(200);\r\n console.log('Client has been inserted'); \r\n })\r\n .catch(err => {\r\n response.sendStatus(500);\r\n console.log('Error inserting client', err);\r\n });\r\n \r\n }", "function performAction(){\r\n //const zipCode= document.getElementById('zip').value;\r\n const feel = document.getElementById('feel').value;\r\n const api_url = url+zipCode.value+apiKey;\r\n\r\n //add the full date\r\n const date = new Date();\r\n const full_date = `${date.getFullYear()}/${date.getMonth()}/${date.getDate()}`;\r\n\r\n // call function getWeatherDemo\r\n getWeatherDemo(api_url)\r\n .then(function(data){\r\n \r\n postData('/postWeather', {city:data.name ,country:data.sys.country , date:full_date , icon:data.weather[0].icon,\r\n temp:data.main.temp, minTemp:data.main.temp_min , maxTemp:data.main.temp_max, description:data.weather[0].description,\r\n feeling:feel});\r\n\r\n })\r\n .then(getData)\r\n}", "async function postData(url, feelings){\n\nconst dataS={\n date: newDate,\n temp: temperature,\n userRes: feelings\n}\n\nconst options = {\n method: \"POST\",\n credentials: \"same-origin\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(dataS)\n }\n\nawait fetch(url, options);\n\n}", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.GET) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"GET is not supported, perform a POST to add Entries\"\n\t\t\t}));\n\t\t} else {\n\t\t\t//Perform Table Entry to be created in Table\n\t\t\ttry {\n\t\t\t\tif (gvGuid) {\n\t\t\t\t\t_createEntries();\n\t\t\t\t}\n\t\t\t} catch (errorObj) {\n\t\t\t\tgvTableUpdate = \"Error during table insert:\" + errorObj.message;\n\t\t\t}\n\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tTableUpdateStatus: gvTableUpdate\n\t\t\t}));\n\t\t}\n\t}", "function setIndiceSauvegarde(Noindice) {\r\n\tdatedebut\t= document.getElementById(\"Datedebut\").value+' '+document.getElementById(\"Heuredebut\").value;\r\n\tdatefin\t\t= document.getElementById(\"Datefin\").value+' '+document.getElementById(\"Heurefin\").value;\r\n\tlibelle\t\t= document.getElementById(\"Libelle\").value;\r\n\tcommentaire\t= document.getElementById(\"Commentaire\").value;\r\n\tvar arguments = \"noindice=\" + Noindice + \"&datedebut=\" + datedebut + \"&datefin=\" + datefin + \"&libelle=\" + libelle + \"&commentaire=\" + commentaire;\r\n\trequest(\"POST\", \"admin.php?methode=INDICE_sauvegarde\", true, setData, arguments );\r\n}", "submit(data) {\n const { description, seller, item, itemName } = data;\n Reports.insert({ description, seller, item, itemName }, this.insertCallback);\n }", "async function onPost(req, res) {\n\n sheet = doc.sheetsByIndex[4]\n\n // the rest of the Info\n courseSheet = doc.sheetsByIndex[5]\n const crows = await courseSheet.getRows();\n let courseRows = crows.filter(crows => crows.課程名稱 == req.body.課程名稱);\n //console.log(courseRows[0]);\n\n studentSheet = doc.sheetsByIndex[3]\n const srows = await studentSheet.getRows();\n let studentRows = srows.filter(srows => srows.學員證字號 == req.body.學員證字號);\n //console.log(studentRows[0]);\n\n req.body.中心id = `${courseRows[0].中心ID}`;\n req.body.課程id = `${courseRows[0].課程ID}`;\n req.body.課程類型 = `${courseRows[0].課程類型}`;\n req.body.課程主題 = `${courseRows[0].課程主題}`;\n req.body.課程日期 = moment().format('MMMM Do YYYY');\n req.body.簽到時間 = moment().format('HH:mm:ss');\n\n if (studentRows[0]) {\n req.body.身分證字號 = `${studentRows[0].身分證字號}`;\n }\n\n //console.log(req.body);\n\n await sheet.addRow({\n 姓名: `${req.body.姓名}`,\n 學員證字號: `${req.body.學員證字號}`,\n 樂齡學習中心名稱: `${req.body.樂齡學習中心名稱}`,\n 課程名稱: `${req.body.課程名稱}`,\n 拓點村里: `${req.body.拓點村里}`,\n 中心ID: `${req.body.中心id}`,\n 課程ID: `${req.body.課程id}`,\n 課程類型: `${req.body.課程類型}`,\n 課程主題: `${req.body.課程主題}`,\n 課程日期: `${req.body.課程日期}`,\n 簽到時間: `${req.body.簽到時間}`,\n });\n res.json({\n response: 'success'\n });\n}", "function post_action(obj){\r\n$.ajax({\r\n type:\"post\",\r\n url:\"https://5ef88b09ae8ccb0016fd725b.mockapi.io/data_to_do\",\r\n data:obj\r\n})\r\n}", "function post_request(){\r\n var request_date = $(\"#request_date_request\").val();\r\n var employee_id = $(\"#employee_id_request\").val();\r\n var shift = $(\"#shift_request\").val();\r\n var weight = $(\"#weight_request\").val();\r\n\r\n axios.post(apiPath + '/requests', {\r\n employee_id: employee_id,\r\n shift: shift,\r\n weight: weight,\r\n day: request_date,\r\n })\r\n .then(function (response) {\r\n console.log(response);\r\n document.getElementById(\"add_request_form\").reset();\r\n M.toast({html: \"The request has been added\"});\r\n table.ajax.reload();\r\n })\r\n .catch(function (error) {\r\n M.toast({html: \"Error, request Failed\", classes: 'rounded red'});\r\n console.log(error);\r\n });\r\n\r\n // Close modal when done\r\n M.Modal.getInstance(document.getElementById('add_request_modal')).close();\r\n }", "function setDataReqFromInModify(data){\n\t\n\t$('#requestNo').val(data.requestNo);\n\t$('#requestStatus').val(data.status);\n\t$('#lastUpdate').val(setDate(data.created));\n\tif(data.formType == \"IN\"){\n\t\t$('#receipt').prop(\"checked\",true);\n\t\t$('#issue').prop(\"checked\",false);\n\t}else{\n\t\t$('#receipt').prop(\"checked\",false);\n\t\t$('#issue').prop(\"checked\",true);\n\t}\n\tsetCompanyAll(\"companyCode\",\"\",data.companyCode);\n\tsetBank(\"bankCode\",\"\",data.bankCode);\n\t\t\tsetDocType(\"docType\",\"\",data.docType);\n\t\t\t$('#docTypeName').val(data.docTypeName);\n\t\t\t$('#requestorName').text(data.requestorName);\n\t\t\t$('#bgNo').val(data.bgNo);\n\t\t\t$('#amendNo').text(data.amendNo);\n\t\t\t\n\t\t\tif(data.amendType == \"DECREASE\" || data.amendType == undefined){\n\t\t\t\t$('#amendment').prop(\"checked\",true);\n\t\t\t}else{\n\t\t\t\t$('#amentEdit').prop(\"checked\",true);\n\t\t\t}\n\t\t\t\n\t\t\t$('#amountTbody').empty();\n\t\t\tfor(var i=0 ; i<data.amounts.length ; i++){\n\t\t\t\taddAmount(0,data.amounts[i].amount,data.amounts[i].currencyCode);\n\t\t\t\t$('#amontTr1').remove();\n\t\t\t}\n\t\t\t\n\t\t\t$('#openEnd').val(data.openEnd);\n\t\t\tif(data.openEnd == \"CLOSE\"){\n\t\t\t\t$('#formExpiredDate').show();\n\t\t\t}\n\t\t\t\n\t\t\t$('#effectiveDate').val(setDate(data.effectiveDate));\n\t\t\tif(data.expiredDate == \"\" || data.expiredDate == undefined){\n\t\t\t\t$('#expiredDate').val(null);\n\t\t\t}else{\n\t\t\t\t$('#expiredDate').val(setDate(data.expiredDate));\n\t\t\t}\n\t\t\t$('#periodYear').val(data.periodYear);\n\t\t\t$('#periodMonth').val(data.periodMonth);\n\t\t\t$('#periodDay').val(data.periodDay);\n\t\t\t$('#issueDate').val(setDate(data.issueDate));\n\t\t\t\n\t\t\tif(data.vendorType.toUpperCase() == \"VENDOR\"){\n\t\t\t\t$('#vender').prop(\"checked\",true);\n\t\t\t}else{\n\t\t\t\t$('#customer').prop(\"checked\",true);\n\t\t\t}\n\t\t\t$.when(ajaxTaskDocType).done(function() {\n\t\t\t\tgetSearchName(data.vendorCode);\n\t\t\t\t$.when(ajaxTaskSearchName).done(function() {\n\t\t\t\t\tsetDataVenCus();\n\t\t\t\t});\n\t\t\t});\n\t\t\t$('#ownerId').val(data.ownerId);\n\t\t\t$('#owner').val(data.owner);\n\t\t\t$('#ownerLastName').val(data.ownerLastName);\n\t\t\t$('#ownerContactInfo').val(data.ownerContactInfo);\n\t\t\t\n\t\t\t$('#poSoNo').val(data.poSoNo);\n\t\t\t$('#buyerName').val(data.buyerName);\n\t\t\t$('#buyerEmployeeID').val(data.buyerEmployeeID);\n\t\t\t$('#contractNo').val(data.contractNo);\n\t\t\t\n\t\t\t$('#conAmountTbody').empty();\n\t\t\tfor(var i=0 ; i<data.contractAmounts.length ; i++){\n\t\t\t\taddConAmount(0,data.contractAmounts[i].contractAmount,data.contractAmounts[i].contractCurrencyCode,data.contractAmounts[i].percentOfGuarantee);\n\t\t\t\t$('#conAmontTr1').remove();\n\t\t\t}\n\t\t\t\n\t\t\t$('#projectJob').val(data.projectJob);\n\t\t\t$('#expectedDueDate').val(setDate(data.expectedDueDate));\n\t\t\t\n\t\t\t\n\t\t\tvar reqType = [];\n \t\tif(loadFirst == 0){\n \t\t\tvar selected = sessionStorage.getItem('requestTypeSession');\n \t\t\tif(selected == \"null\"){\n \t\t\t\tsetRequestTypeModify(data.status,data.requestType);\n \t\t\t}else{\n \t\t\t\tsetRequestTypeModify(data.status,selected);\n \t\t\t}\n \t\t\tloadFirst++;\n \t\t}else{\n \t\t\tvar selected = sessionStorage.getItem('requestTypeSession');\n \t\t\tsetRequestTypeModify(data.status,selected);\n \t\t}\n \t\tsessionStorage.setItem('requestTypeSession', null);\n \t\t$.when(ajaxTaskRequestTypeModify).done(function() {\n \t\t\tstatusEvent = data.status;\n \t\t\tvar readOnly = data.readOnly;\n \t\tif(readOnly == \"N\" || readOnly == undefined){\n \t\t\tif(data.status.toUpperCase() == \"NEW\" || data.status.toUpperCase() == \"RETURN\"){\n \t\t\t\t\n \t \t\t\t\tdisabledAll();\n \t \t\t\t\t$('#requestType').prop(\"disabled\",true);\n \t\t\t\t\t\t$('#remarkHistory').show();\n \t\t\t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\n \t\t\t}else if(data.status.toUpperCase() == \"DRAFT\" && data.requestType.toUpperCase() == \"CREATE\"){\n\t \t\t\t\t$('#requestType').prop(\"disabled\",true);\n\t\t\t\t\t\t\t$('#remarkHistory').hide();\n\t\t\t\t\t\t\tif(buttonEventSubmit == true){\n \t\t\t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#buttonModify').show();\n \t\t\t\t\t}\n \t\t\t}else if(data.status.toUpperCase() == \"REJECT\"){\n \t\t\t\tdisabledAll();\n \t\t\t\t$('#remarkHistory').show();\n \t\t\t}else{\n \t\t\t\tvar type = $('#requestType').val();\n \t\t\t\tif(type == \"DECREASE\"){\n \t\t\t\t\tdisabledAll();\n \t\t\t\t\tif(data.status.toUpperCase() == \"VALID\"){\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",false);\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",true);\n \t\t\t\t\t}\n \t\t\t\t\t// $('#remarkHistory').toggle();\n \t\t\t\t\t$('#fileBrowsBox').show();\n \t\t\t\t\t$('.btnRemoveFile').show();\n \t\t\t\t\t$('#remarkCreate').show();\n \t\t\t\t\t$('#buttonCreate').hide();\n \t\t\t\t\t//$('#issueDate').prop(\"disabled\",false);\n \t\t\t\t\t//$('#effectiveDate').prop(\"disabled\",false);\n \t\t\t\t\t//$('#expiredDate').prop(\"disabled\",false);\n \t\t\t\t\t//$('#formEffectiveDate .border-left-0').show();\n \t\t\t\t\t//$('#formExpiredDate .border-left-0').show();\n \t\t\t\t\t//$('#formIssueDate .border-left-0').show();\n \t\t\t\t\t$('#amountTbody .btnEvent').show();\n \t\t\t\t\t$('#amountTbody input').prop(\"disabled\",false);\n \t\t\t\t\t$('#amountTbody select').prop(\"disabled\",false);\n \t\t\t\t\t$('#remarkHistory').hide();\n \t\t\t\t\t$('.amountCurreny').prop(\"disabled\",true);\n \t\t\t\t\t$('.botSellingRate').prop(\"disabled\",true);\n \t\t\t\t\t$('.btnEvent').hide();\n \t\t\t\t\tif(buttonEventSubmit == true){\n \t\t\t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#buttonModify').show();\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t}else if(type == \"EXTEND\"){\n \t\t\t\t\tdisabledAll();\n \t\t\t\t\tif(data.status.toUpperCase() == \"VALID\"){\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",false);\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",true);\n \t\t\t\t\t}\n \t\t\t\t\t$('#fileBrowsBox').show();\n \t\t\t\t\t$('.btnRemoveFile').show();\n \t\t\t\t\t$('#remarkCreate').show();\n \t\t\t\t\t// $('#buttonCreate').hide();\n \t\t\t\t\t$('#issueDate').prop(\"disabled\",false);\n \t\t\t\t\t$('#effectiveDate').prop(\"disabled\",false);\n \t\t\t\t\t$('#expiredDate').prop(\"disabled\",false);\n \t\t\t\t\t$('#formEffectiveDate .border-left-0').show();\n \t\t\t\t\t$('#formExpiredDate .border-left-0').show();\n \t\t\t\t\t$('#formIssueDate .border-left-0').show();\n \t\t\t\t\t$('#remarkHistory').hide();\n \t\t\t\t\tif(buttonEventSubmit == true){\n \t\t\t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#buttonModify').show();\n \t\t\t\t\t}\n \t\t\t\t}else if(type == \"INCREASE\"){\n \t\t\t\t\tdisabledAll();\n \t\t\t\t\t$('#buttonCreate').hide();\n \t\t\t\t\t$('.amountCurreny').prop(\"disabled\",true);\n \t\t\t\t\t$('.btnEvent').hide();\n \t\t\t\t\t$('#amountTbody .btnEvent').hide();\n \t\t\t\t\t$('#amountTbody select').prop(\"disabled\",true);\n \t\t\t\t\tif(data.status.toUpperCase() == \"VALID\"){\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",false);\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",true);\n \t\t\t\t\t}\n \t\t\t\t\t$('#remarkHistory').hide();\n \t\t\t\t\t\t$('#fileBrowsBox').show();\n \t\t\t\t\t$('.btnRemoveFile').show();\n \t\t\t\t\t$('#remarkCreate').show();\n \t\t\t\t\tif(buttonEventSubmit == true){\n \t\t\t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\t\t\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#buttonModify').show();\n \t\t\t\t\t\t$('#formEffectiveDate .border-left-0').show();\n \t\t\t\t\t$('#formExpiredDate .border-left-0').show();\n \t\t\t\t\t$('#formIssueDate .border-left-0').show();\n \t\t\t\t\t$('#issueDate').prop(\"disabled\",false);\n \t\t\t\t\t$('#effectiveDate').prop(\"disabled\",false);\n \t\t\t\t\t$('#expiredDate').prop(\"disabled\",false);\n \t\t\t\t\t$('#amountTbody input').prop(\"disabled\",false);\n \t\t\t\t\t$('.botSellingRate').prop(\"disabled\",true);\n \t\t\t\t\t\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t}else if(type == \"RETURN\"){\n \t\t\t\t\tdisabledAll();\n \t\t\t\t\t$('#returnContactInfo').show();\n \t\t\t\t\tif(data.status.toUpperCase() == \"VALID\"){\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",false);\n \t\t\t\t\t\t$('#returnContactInfo input').prop(\"disabled\",false);\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#requestType').prop(\"disabled\",true);\n \t\t\t\t\t}\n \t\t\t\t\t$('#remarkHistory').hide();\n \t\t\t\t\t$('#fileBrowsBox').show();\n \t\t\t\t\t$('.btnRemoveFile').show();\n \t\t\t\t\t$('#remarkCreate').show();\n \t\t\t\t\tif(buttonEventSubmit == true){\n \t\t\t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#buttonModify').show();\n \t\t\t\t\t}\n \t\t\t\t\t\n \t\t\t\t}else{\n \t\t\t\t\tdisabledAll();\n \t\t\t\t\t$('.btnEvent').hide();\n \t\t\t\t\t\tif(buttonEventSubmit == true){\n \t\t\t\t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\t\t$('#fileBrowsBox').show();\n \t\t\t\t\t$('.btnRemoveFile').show();\n \t\t\t\t\t$('#remarkCreate').show();\n \t\t\t\t\t}else{\n \t\t\t\t\t\t$('#buttonModify').show();\n \t\t\t\t\t\t$('#remarkHistory').show();\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\t\n \t\t\t\tif(data.status.toUpperCase() == \"COMPLETE\"){\n \t\t\t\t\tdisabledAll();\n \t\t\t\t\tif(type == \"RETURN\"){\n \t\t\t\t\t\t$('#returnContactInfo').show();\n \t\t\t\t\t}\n \t\t\t\t\t$('#remarkHistory').show();\n \t\t\t\t\t$('#buttonModify').hide();\n// $('#fileBrowsBox').hide();\n// $('.btnRemoveFile').hide();\n// $('#remarkCreate').hide();\n \t\t\t\t\t\n \t\t\t\t}else if(data.status.toUpperCase() == \"WAITING_SUBMIT\"){\n \t\t\t\t\tdisabledAll();\n \t\t\t\t\t$('#fileBrowsBox').show();\n \t\t\t\t\t$('.btnRemoveFile').show();\n \t\t\t\t\t$('#remarkCreate').show();\n \t\t\t\t}\n \t\t\t\t\n \t\t\t}\n\n \t\t}else{\n \t\t\tdisabledAll();\n \t\t\t$('#remarkHistory').show();\n \t\t}\n \t\t\tif (data.status.toUpperCase() == \"WAITING_ACCEPT\"){\n \t\t\t\tdisabledAll();\n \t\t\t\t$('#fileBrowsBox').show();\n\t\t\t\t\t$('.btnRemoveFile').show();\n\t\t\t\t\t$('#remarkCreate').show();\n \t\t\t\t$('#buttonModify').hide();\n \t\t\t\t\n \t\t\t}\n \t\t\t\n \t\t\t$('#spinner').hide();\n \t\t});\n \t\t\n}", "function record_data(e) {\n var lock = LockService.getDocumentLock();\n lock.waitLock(30000); // hold off up to 30 sec to avoid concurrent writing\n\n try {\n Logger.log(JSON.stringify(e)); // log the POST data in case we need to debug it\n\n // select the 'responses' sheet by default\n var doc = SpreadsheetApp.getActiveSpreadsheet();\n var sheetName = e.parameters.formGoogleSheetName || \"responses\";\n var sheet = doc.getSheetByName(sheetName);\n\n var oldHeader = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];\n var newHeader = oldHeader.slice();\n var fieldsFromForm = getDataColumns(e.parameters);\n var row = [new Date()]; // first element in the row should always be a timestamp\n\n // loop through the header columns\n for (var i = 1; i < oldHeader.length; i++) { // start at 1 to avoid Timestamp column\n var field = oldHeader[i];\n var output = getFieldFromData(field, e.parameters);\n row.push(output);\n\n // mark as stored by removing from form fields\n var formIndex = fieldsFromForm.indexOf(field);\n if (formIndex > -1) {\n fieldsFromForm.splice(formIndex, 1);\n }\n }\n\n // set any new fields in our form\n for (var i = 0; i < fieldsFromForm.length; i++) {\n var field = fieldsFromForm[i];\n var output = getFieldFromData(field, e.parameters);\n row.push(output);\n newHeader.push(field);\n }\n\n // more efficient to set values as [][] array than individually\n var nextRow = sheet.getLastRow() + 1; // get next row\n sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);\n\n // update header row with any new data\n if (newHeader.length > oldHeader.length) {\n sheet.getRange(1, 1, 1, newHeader.length).setValues([newHeader]);\n }\n }\n catch(error) {\n Logger.log(error);\n }\n finally {\n lock.releaseLock();\n return;\n }\n\n}", "function createPostData(){\n let nameField = document.querySelector('#name');\n let phoneField = document.querySelector('#phoneNum');\n let emailField = document.querySelector('#email');\n \n let userPostData = {\n name : nameField.value,\n phone : phoneField.value,\n email : emailField.value\n }\n axios.post(base_url, userPostData)\n .then(res =>{\n let tbody = document.querySelector('tbody');\n createTdElement(res.data, tbody);\n nameField.value = '';\n phoneField.value = '';\n emailField.value = '';\n })\n}", "function submitTableRow(data) {\n $.post(\"/api/timesheets\", data)\n .then(getLastEntries);\n }", "function storeData(postBody) { \n // console.log(postBody);\n var xhr = new XMLHttpRequest();\n xhr.open('POST', POST_URL);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.onreadystatechange = function() {console.log(xhr.statusText);}\n xhr.send(JSON.stringify(postBody));\n} // storeData", "postData ( data, fnOnSuccess, fnOnFailure ) {\n\t\tconst url = \"https://l94wc2001h.execute-api.ap-southeast-2.amazonaws.com/prod/fake-auth\";\n\t\treturn this.$http.post( url , data)\n\t\t\t.success((response, status) =>{\n\t\t\t\tfnOnSuccess( response, status )\n\t\t\t})\n\t\t\t.error((response, status) =>{\n\t\t\t\tfnOnFailure( response, status )\n\t\t\t})\n\t}", "async function insertData(req, res) {\n var versionId = await pool.query(\"select id from version where number='\" + req.body.data.version + \"' and formularId='\" + req.body.data.formular + \"'\");\n\n // update data for existing version. First delete last data and then insert new data\n if (versionId.rows.length != 0) {\n await pool.query(\"delete from data where versionId='\" + versionId.rows[0].id + \"'\");\n await pool.query(\"delete from version where id='\" + versionId.rows[0].id + \"'\");\n }\n\n // insert into version and data tables for existing and non existing version\n await pool.query(\"INSERT INTO version(number, formularId) VALUES('\" + req.body.data.version + \"','\" + parseInt(req.body.data.formular) + \"')\")\n var version = await pool.query(\"select id from version where number='\" + req.body.data.version + \"' and formularId='\" + req.body.data.formular + \"'\")\n for (var i = 0; i < req.body.data.data.length; i++) {\n var data = req.body.data.data[i];\n await pool.query(\"INSERT INTO data(input, versionId, elementId) VALUES('\" + data.data + \"','\" + version.rows[0].id + \"', '\" + data.id + \"')\");\n }\n}", "static insert(request, response) {\r\n \r\n //recupera do body os campos que serao atualizados na tabela\r\n const conditions = [\r\n {\r\n field: 'title',\r\n value: request.body.title\r\n },\r\n {\r\n field: 'descr',\r\n value: request.body.descr\r\n },\r\n {\r\n field: 'photo',\r\n value: request.body.photo\r\n },\r\n {\r\n field: 'category',\r\n value: request.body.category\r\n },\r\n {\r\n field: 'Owner_ID',\r\n value: request.body.Owner_ID\r\n },\r\n ];\r\n\r\n //chama rotina para inclusao dos dados\r\n itemsModel.insert(conditions) \r\n .then( _ => {\r\n response.sendStatus(200);\r\n console.log('Item has been inserted'); \r\n })\r\n .catch(err => {\r\n response.sendStatus(500);\r\n console.log('Error inserting Item', err);\r\n });\r\n \r\n }", "function postData(postUrl, fdata, dType) {\r\n console.log('in postData: ' + postUrl);\r\n var dFlg, data;\r\n\r\n // turn on spinner\r\n uiLoading(true);\r\n\r\n // process post\r\n $.post(postUrl, fdata, function(res) {\r\n dFlg = (res == undefined) ? false : true; // set flag\r\n\r\n // load data based on display type\r\n switch (dType) {\r\n case 'login':\r\n processLogin(res, dFlg);\r\n\tbreak;\r\n case 'pixi':\r\n processPixiData(res);\r\n\tbreak;\r\n case 'post':\r\n resetPost(dFlg);\r\n\tbreak;\r\n case 'inv':\r\n\tgoToUrl('../html/invoices.html');\r\n\tbreak;\r\n case 'comment':\r\n showCommentPage(res);\r\n\tbreak;\r\n case 'bank':\r\n invFormType == 'new' ? loadInvForm(data, true) : loadBankPage(res, dFlg); \r\n\tbreak;\r\n case 'reply':\r\n loadPosts(res, dFlg);\r\n\tbreak;\r\n case 'card':\r\n loadTxnPage(res, dFlg, 'invoice');\r\n\tbreak;\r\n default:\r\n return res;\r\n\tbreak;\r\n }\r\n },\"json\").fail(function (a, b, c) {\r\n \tuiLoading(false);\r\n PGproxy.navigator.notification.alert(a.responseText, function() {}, 'Post Data', 'Done');\r\n console.log(a.responseText + ' | ' + b + ' | ' + c);\r\n });\r\n}", "function postAdvancement() {\n var inst = $('#advancement').mobiscroll('getInst');\n var values = inst.getValues('advancement');\n if (values.length == 0 && preExistAdvance == false) {\n finalUpdate();\n return;\n }\n // send values to server\n var arrayLength = values.length;\n var formData = '';\n for (var i = 0; i < arrayLength; i++) {\n if (formData != '') {\n formData += \"&\";\n }\n formData += 'Advancement=' + escape(values[i]);\n }\n\n $.ajax({\n type: \"POST\",\n url: '/mobile/dashboard/calendar/editevent.asp?' + iEventID + '&Action=UpdateAdvancementLI',\n data: formData,\n success: function () {\n finalUpdate();\n }\n });\n\n //window.console &&console.log(formData);\n\n}", "function saveAbsenceExcuse() {\nactiveDataSet = studentList.find( arr => arr.absenceId == activeElement ); \nexcusein = document.getElementById(\"excusein\").value;\ncomment = document.getElementById(\"excusecomment\").value;\n//date = excusein.split('.');\nexcuseindate = formatDateDash(excusein);//date[2] + '-' + date[1] + '-' +date [0];\t\n//console.log(\"send to ?type=excuse&console&aid=\" + activeDataSet['absenceId'] + \"&date=\" + excuseindate + \"&comment=\" + comment);\n\n$.post(\"\", {\n\t\t\t\t'type': 'excuse',\n\t\t\t\t'console': '',\n\t\t\t\t'aid': activeDataSet['absenceId'],\n\t\t\t\t'date': excuseindate,\n\t\t\t\t'comment': comment\n }, function (data,status) {\n\t\t\t\thandleServerResponse(data, status);\n\t\t\t});\t\n}", "function handlePost() {\n\tvar bodyStr = $.request.body ? $.request.body.asString() : undefined;\n\tif ( bodyStr === undefined ){\n\t\t $.response.status = $.net.http.INTERNAL_SERVER_ERROR;\n\t\t return {\"myResult\":\"Missing BODY\"};\n\t}\n\t// Extract body insert data to DB and return results in JSON/other format\n\t$.response.status = $.net.http.CREATED;\n return {\"myResult\":\"POST success\"};\n}", "function generate(event) {\n event.preventDefault();\n\n const zipCode = document.getElementById('zip').value;\n const feeling = document.getElementById('feelings').value;\n\n // ensure that all data available\n if (!zipCode || !feeling) {\n alert(\"Please, Full all required data!\");\n return;\n }\n\n getDataFromAPI(zipCode)\n .then((response) => {\n \n if (response.list.length == 0) {\n alert(\"Can't find any data!\");\n return;\n }\n\n const temp = response.list[0].main.temp;\n\n // Create a new date instance dynamically with JS\n let d = new Date();\n let date = `${d.getDate()}/${d.getMonth()+1}/${d.getFullYear()}`;\n \n const newData = {temp, date, feeling};\n \n postData(`http://localhost:5000/addData`, newData)\n .then(() => {\n changeUI();\n });\n });\n}", "function submitEntry() {\n const zip = document.getElementById(\"zip\").value;\n const countryCode = document.getElementById(\"countryCode\").value;\n const feelings = document.getElementById(\"feelings\").value;\n const d = Date.now();\n const currentDate = new Date(d).toDateString();\n\n //get weather data from api\n getWeather(zip,countryCode)\n //then construct data object and send post request\n .then((weatherData) => {\n const data = {\n temp: weatherData.temp,\n icon: weatherData.icon,\n date: currentDate,\n content: feelings\n };\n postData(\"/addEntry\", data);\n })\n //then get latest entry\n .then(() => {\n const response = getData(\"/getLatest\");\n return response;\n })\n //then change document according to data\n .then((data) => {\n //check that data array on server side is not empty\n if (data !== null){\n document.getElementById(\"date\").innerHTML = data.date;\n document.getElementById(\"temp\").innerHTML = `${data.temp}°C`;\n document.getElementById(\"content\").innerHTML = data.feelings;\n const icon = document.getElementById(\"icon\");\n icon.src = `http://openweathermap.org/img/wn/${data.icon}@2x.png`;\n document.getElementById(\"entryHolder\").style.display = \"flex\";\n }\n });\n}", "async function createAndModify(type, dataForm) {\n const { giaoVien, diemTichLuy, tinchi_tichluy, diaDiem, maSinhVien, tenDiaDiem, diaChi } = dataForm;\n let dataRequest = {\n giao_vien_huong_dan: '',\n dia_diem_thuc_tap: '',\n diem_tbtl: '',\n so_tctl: '',\n dot_thuc_tap: recordId,\n sinh_vien: '',\n };\n if (diaDiem === '####') {\n const ddtt = {\n ten_dia_diem: tenDiaDiem,\n dia_chi: diaChi,\n };\n const apiResponse = await createDiaDiemThucTap(ddtt);\n if (apiResponse) {\n dataRequest.giao_vien_huong_dan = giaoVien;\n dataRequest.dia_diem_thuc_tap = apiResponse._id;\n dataRequest.diem_tbtl = diemTichLuy;\n dataRequest.so_tctl = tinchi_tichluy;\n dataRequest.dot_thuc_tap = dot_thuc_tap;\n dataRequest.sinh_vien = maSinhVien;\n }\n } else {\n dataRequest.giao_vien_huong_dan = giaoVien;\n dataRequest.dia_diem_thuc_tap = diaDiem;\n dataRequest.diem_tbtl = diemTichLuy;\n dataRequest.so_tctl = tinchi_tichluy;\n dataRequest.sinh_vien = maSinhVien;\n }\n if (type === CONSTANTS.CREATE) {\n if (myInfo.role === ROLE.SINH_VIEN) {\n const sinhVien = await getAllSinhVien(1, 0, { ma_sinh_vien: maSinhVien ? maSinhVien : myInfo.username });\n dataRequest.sinh_vien = sinhVien.docs[0]._id;\n }\n const apiResponse = await createDKTT(dataRequest);\n if (apiResponse) {\n getData();\n handleShowModal(false);\n toast(CONSTANTS.SUCCESS, 'Thêm mới đăng kí thành công');\n }\n }\n\n if (type === CONSTANTS.UPDATE) {\n dataRequest._id = state.userSelected._id;\n const apiResponse = await updateDKTT(dataRequest);\n if (apiResponse) {\n const docs = dkthuctap.docs.map(doc => {\n if (doc._id === apiResponse._id) {\n doc = apiResponse;\n }\n return doc;\n });\n setDkthuctap(Object.assign({}, dkthuctap, { docs }));\n handleShowModal(false);\n toast(CONSTANTS.SUCCESS, 'Chỉnh sửa thông tin đăng kí thành công');\n }\n }\n }", "function postData(url, data, method) {\n method = method || \"post\";\n var form = document.createElement(\"form\");\n form.setAttribute(\"method\", method);\n form.setAttribute(\"action\", url);\n for (var key in data) {\n if (data.hasOwnProperty(key)) {\n var hiddenField = document.createElement(\"input\");\n hiddenField.setAttribute(\"type\", \"hidden\");\n hiddenField.setAttribute(\"name\", key);\n hiddenField.setAttribute(\"value\", data[key]);\n form.appendChild(hiddenField);\n }\n }\n document.body.appendChild(form);\n form.submit();\n }", "function sendDataToServer(dataString) {\n var orig_data=dataString.split('+');\n var dataName=orig_data[0];\n var dataAge=orig_data[1];\n var dataCountry=orig_data[2];\n var dataGender=orig_data[3];\n var dataQ1=orig_data[4];\n var dataQ2=orig_data[5];\n\n var data = {\n\tcommit: \"Create Datum\",\n\tdatum: {\n\t name: dataName,\n\t age: dataAge,\n\t country: dataCountry,\n gender: dataGender,\n q1: dataQ1,\n q2: dataQ2\n\t}\n }\n $.ajax({\n\ttype: \"POST\",\n\turl: \"/data\",\n\tdata: data,\n\tdataType: \"json\"\n });\n}", "function addData(req, res) {\n const newData = {date, temperature, content } = req.body;\n Object.assign(projectData, newData);\n console.log(`New data recieved on Server Endpoint from Client on port ${port}`, newData);\n}", "function writeData(req, res){\n try {\n let input = req.body //Capture the query in the request\n\n DataPoint.remove({});\n\n if (!req.body.meetdata) req.body.meetdata = generateMockData();\n\n //Turned the next limit off for testing purposes TODO: turn it on again to reasonable limit\n //if (req.headers['content-length'] > 100 || req.url.length > 5000) {throw 'Request too large to process'};\n if (!input.meetsysteemId) {throw 'No device id provided'}\n if (!input.status) {throw 'No status provided in message'}\n if (isNaN(Number(input.status))) {throw 'Provided status is not a number'}\n if (!input.meetdata) {throw 'No data provided in message'}\n\n const dataPoints = input.meetdata.split(';').map(dp => {\n const dateString = dp.substr(0, 6);\n const date = moment(dateString, \"DDMMYY\").format();\n\n return {\n deviceId: input.meetsysteemId,\n date: new Date(date),\n status: input.status,\n metrics: dp\n }\n })\n\n DataPoint.insertMany(dataPoints, function(error, docs) {\n if (error) {\n console.error('Insert into db failed', err);\n }\n else {\n res.status(200)\n res.send(docs.length + \" docs succesfully inserted into db\")\n }\n });\n }\n catch(e){\n console.log(\"Client didn't provde the right arguments for the request\", e)\n res.status(406)\n res.send(e)\n }\n}", "function Post() {}", "function saveNewEntry() {\n\n// get information from the inputs and make date\n var role = document.getElementById('role').value;\n var champion = document.getElementById('champion').value;\n var wl = document.getElementById('wl').checked ? true : false;\n var notes = document.getElementById('notes').value;\n var d = new Date();\n var datestring = (d.getMonth()+1) + \"/\" + d.getDate();\n\n \n // save(post) information to DB\n fetch('/save', {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n }, \n body: JSON.stringify({\n date: datestring,\n role,\n champion,\n wl,\n notes\n })\n })\n // append information\n .then(getDataAndRenderLogEntries())\n .catch(function(err) { console.log(err) });\n \n}", "function handlePost() {\n\tvar bodyStr = $.request.body ? $.request.body.asString() : undefined;\n\tif (bodyStr === undefined) {\n\t\t$.response.status = $.net.http.INTERNAL_SERVER_ERROR;\n\t\treturn {\"myResult\": \"Missing BODY\"};\n\t}\n\t// Extract body insert data to DB and return results in JSON/other format\n\t$.response.status = $.net.http.CREATED;\n\treturn {\"myResult\": \"POST success\"};\n}", "function sendData(postData){\n var clientServerOptions = {\n body: JSON.stringify(postData),\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n }\n }\n // on response from server, log response\n let response = request('POST', 'http://localhost:8983/solr/gettingstarted/update/json/docs?commit=true&overwrite=true', clientServerOptions);\n if (response.statusCode !== 200) {\n throw(response.body)\n } else {\n //console.log('sent')\n }\n}", "function postData(accessToken, context, event, headers) {\n // * May Require Update: \"sheetId\" should reflect the name used to store the sheetId\n const appendBody = {\n access_token: accessToken,\n spreadsheetId: context[sheetIdKeyName],\n range: [\"A1\"],\n resource: getEventResourceValues(headers, event), // Run a function to pair the event data to the right database field\n valueInputOption: \"RAW\",\n insertDataOption: \"INSERT_ROWS\"\n };\n return new Promise((resolve, reject) => {\n sheets.spreadsheets.values.append(appendBody)\n .then((result) => {\n resolve(result);\n })\n .catch(() => {\n getWaitTime(3500)\n .then(() => {\n return sheets.spreadsheets.values.append(appendBody);\n })\n .then((result) => {\n resolve(result);\n })\n .catch((error) => {\n reject(error);\n });\n })\n })\n}", "function setRequestedData(sql, post, callback) {\n \n connection.query(sql, post, function (err, result) {\n if (err) {\n callback(err);\n }\n \n callback(null, result);\n });\n \n}", "function postGet() {\n key++\n retrieveData(baseUrl + apiKey)\n .then(weather => {\n\n postData('/add', {\n key: key,\n temperature: weather.main.temp,\n desc: weather.weather[0].description,\n date: newDate,\n day: day,\n userResponse: feelings,\n })\n })\n .then(\n () => {\n updateUI()\n }\n )\n}", "function Post () {\n}", "post(requestBody) {\n let options = {\n method: 'POST',\n url: this.url + this.table,\n qs: {\n JSONv2: '',\n sysparm_query: this.query,\n displayvariables: 'true',\n displayvalues: 'true',\n sysparm_action: 'update'\n },\n body: requestBody\n };\n\n return new Promise((resolve, reject) => {\n request(options, (error, response, body) => {\n if(error) {\n return reject(error);\n }\n\n if(response.statusCode !== 200) {\n return reject(Error(`Unexpected response status ${response.statusCode}`));\n }\n\n resolve(body);\n });\n });\n }", "function updateData() {\n\t/*\n\t* TODO: Fetch data\n\t*/\n}", "function event_data_save() {\n var teritoryID = $('#teritoryID').val();\n var start_date = $('#start_date').val();\n var end_date = $('#end_date').val();\n $.post('view.php', {save_event: 'data', teritoryID: teritoryID, start_date: start_date, end_date: end_date}, function (data) {\n if (data.msgType === 1) {\n alertify.success(data.msg, 2000);\n } else {\n alertify.error(data.msg, 2000);\n }\n event_data_table();\n clear_event();\n }, \"json\");\n}", "function preparePostData(type, data) {\n\n // Sends new data to the database via ajax request\n\n if (type === \"user-personal-details\") {\n let newFormData = prepareNewProfileData(data);\n let profileURL = \"../update_profile_data/\";\n let profileID = $('#profile-id').text(); // the ID of the profile that needs to be updated\n postToDatabase(profileURL, newFormData, profileID);\n }\n else if (type === \"user-position-prefs\") {\n let newPref = data;\n let profileURL = \"../update_position_pref/\";\n let profileID = $('#profile-id').text(); // the ID of the profile that needs to be updated\n postToDatabase(profileURL, newPref, profileID);\n }\n else if (type === \"attribute-rating\") {\n let ratingData = data;\n let profileURL = \"../../rate_player/\";\n let playerRated = $('#profile-id').text(); // the ID of the player being rated\n postToDatabase(profileURL, ratingData, playerRated);\n }\n else if (type == \"update-match-availability-status\") {\n let availabilityData = data;\n let matchesURL = \"../../update_availability_status/\";\n let customRoute = availabilityData[\"matchID\"] + \"/\" + availabilityData[\"availTablePk\"];\n postToDatabase(matchesURL, availabilityData, customRoute);\n } else if (type == \"save-team\"){\n let teamData = data[\"team\"];\n let stringData = stringify(teamData);\n let savedTeam = {};\n savedTeam[\"saved_team\"] = stringData;\n let saveTeamURL = \"../../match/save_a_generated_team/\";\n let customRoute = data[\"group\"] + \"/\" + data[\"match\"];\n \n postToDatabase(saveTeamURL, savedTeam, customRoute); \n } else if (type === \"submit-performance-ratings\"){\n let performanceRatings;\n let customRoute;\n \n if(data.length === 0){\n customRoute = 0;\n performanceRatings = \"No data\";\n } else {\n performanceRatings = data;\n customRoute = performanceRatings[0][\"matchid\"]; \n }\n \n let ratingsURL = \"../add_ratings_to_db/\";\n let stringData = stringify(performanceRatings);\n let ratingsData = {};\n ratingsData[\"ratings\"] = stringData;\n $(\".please-wait\").removeClass(\"start-off-screen\");\n $(\".please-wait\").addClass('slide-in-from-right');\n postToDatabase(ratingsURL, ratingsData, customRoute); \n } else if (type === \"email-availability-reminder\"){\n let matchid = data;\n let emailUrl = \"../../email_availability_reminder/\";\n postToDatabase(emailUrl, \"n/a\", matchid)\n }\n}", "function updateData(iParam) {\n var deferred = Q.defer(),\n fName = \"/updateData\";\n Http.post(fName, iParam).success(function (response) {\n deferred.resolve(response);\n }).error(function (error) {\n deferred.reject(error);\n });\n return deferred.promise;\n }", "handleSubmit(val) {\n val.id = uuid()\n val.timestamp = Date.now()\n \n //API.createPost(val).then((res) => console.log(res))\n alert('post entered succesfully')\n window.location.href = \"/\"\n }", "function submitForm(action, item_value, date_value){\n var data=\"action=\"+action+\"&value=\"+item_value+\"&date=\"+date_value;\n var xhttp = createInstance();\n xhttp.onreadystatechange = function()\n { \n if(xhttp.readyState == 4)\n {\n if(xhttp.status == 200)\n {\n document.querySelector(\"body\").innerHTML =\"\";\n document.querySelector(\"body\").innerHTML = xhttp.responseText;\n $('.table').sortable();\n get_dates();\n select_all();\n } \n else \n {\n document.ajax.dyn.value=\"Error: returned status code \" + xhttp.status + \" \" + xhttp.statusText;\n } \n } \n }; \n xhttp.open(\"POST\", \"index.php\", true);\n xhttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n xhttp.send(data);\n }", "function doAction(e){\n //get new zip code and feelings for every click\n zipCode = document.getElementById(\"zip\").value;\n feelings = document.getElementById(\"feelings\").value;\n weather(baseUrl,zipCode,api)\n .then(function(data){\n console.log(data);\n postData('/add',{date:newDate,temp:data.main.temp,content:feelings})\n update();\n });\n}", "postIngestData() {}", "function insertRow() {\n let mydata = {\n \"commit_hash\": commit_hash.value,\n \"branch_name\": branch_name.value,\n \"os\": os.value,\n \"cpu\": cpu.value,\n \"mem\": mem.value,\n \"note\": note.value\n };\n let url = \"/data\";\n\n // checking if browser does CORS\n let xhr = createCORSRequest('POST', url);\n if (!xhr) { throw new Error('CORS not supported'); }\n xhr.setRequestHeader('Content-type', 'application/json');\n\n xhr.onload = function() {\n let responseStr = xhr.responseText;\n let status = xhr.status;\n console.log(responseStr,status);\n\n if(status == 400) { // failure\n // document.getElementById(\"errormessage\").textContent = \"Invalid username or password\";\n }\n else if(status == 200) { \n // clear fields\n commit_hash.value = \"\";\n branch_name.selectedIndex = 0;\n os.selectedIndex = 0;\n cpu.value = \"\";\n mem.value = \"\";\n note.value = \"\";\n\n // reload table\n mytable.draw();\n }\n else {\n console.log(\"should not happen\");\n }\n };\n\n xhr.onerror = function() { alert('Error occured.'); };\n\n xhr.send(JSON.stringify(mydata));\n}", "async saveData() {\n let data = this.state.rowData;\n let projectID = this.props.match.params.projectID;\n\n let updatedRows = this.updatedRows;\n\n // index is the index of a row that has been updated\n\n let processData = async function (pair) {\n let index = pair[\"rowIndex\"];\n let key = pair[\"colIndex\"];\n let netID = data[index][\"netid\"];\n let hours = data[index][key];\n let newData = {\n \"ProjectID\": projectID,\n \"NetID\": netID,\n \"Dates\": key,\n \"HoursPerWeek\": hours\n };\n let response = await fetch('../api/updateSchedule', {\n method: \"PUT\",\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(newData)\n });\n }\n updatedRows.forEach(processData);\n this.updatedRows.clear();\n }", "function takeAction (){\n \n// object variable to carry data: zip code ,feeling ,and date\n let data={\nZIPcode : zipCode.value,\ncontent : feeling.value,\ndate: newDate\n };\n \n console.log('the data object after clicking the button',data); \n//check if the user forget to input the zipcode\nif (data.ZIPcode===\"\"){\n alert('Please Enter the zip code')\n }else{\n //chaining promises\n getTemp(data.ZIPcode).then(dataOfAPI =>{\n data.temp=dataOfAPI.main.temp; \n postData('/addData',data)} ).then (() => updateUI() );\n \n }\n}", "function main() {\n\n\t\t//Check the Method\n\t\tif ($.request.method === $.net.http.POST) {\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tresult: \"POST is not supported, perform a GET to update the status from HCI\"\n\t\t\t}));\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t//Get all the Entries that are applicable for update\n\t\t\t\tvar oDBRecords = getAllDBEntries();\n\t\t\t\t//Read the Status from Cloud Integration\n\t\t\t\tvar oHCIRecords = retrieveRecordsFromHCI(oDBRecords.valueSet);\n\t\t\t\t//Execute the updates\n\t\t\t\tvar oUpdateResults = mapUpdates(oHCIRecords.retrievedValues, oDBRecords.valueMap);\n\t\t\t\t//Write to the trace\n\t\t\t\t$.trace.info(JSON.stringify({\n\t\t\t\t\ttotalDBRecords: oDBRecords.valueSet.length,\n\t\t\t\t\ttotalHCIRecordsRetrieved: oHCIRecords.retrievedValues.length,\n\t\t\t\t\ttotalHCIFailedRetrievals: oHCIRecords.failedRetrievals.length,\n\t\t\t\t\tHCIFailedRetrievalDetails: oHCIRecords.failedRetrievals,\n\t\t\t\t\tupdatesRequested: oUpdateResults.iUpdatesRequested,\n\t\t\t\t\tupdatesProcessed: oUpdateResults.iUpdatesProcessed\n\t\t\t\t}));\n\t\t\t} catch (err) {\n\t\t\t\t$.trace.error(JSON.stringify({\n\t\t\t\t\tmessage: err.message\n\t\t\t\t}));\n\t\t\t}\n\n\t\t\t$.response.status = 200;\n\t\t\t$.response.setBody(JSON.stringify({\n\t\t\t\tmessage: \"API Called\",\n\t\t\t\tTableUpdateStatus: gvTableUpdate\n\t\t\t}));\n\t\t}\n\t}", "function handleSubmit(e) {\n e.preventDefault()\n if (validateForm()) {\n setLoading(true)\n\n createAPIEndpoint(ENDPIONTS.POSTEMPLOYEES20).createPrison( customers.EmployeeFormID, \"0\" ,values)\n .then(res => {\n setLoading(false)\n notify()\n SetCustomers(res.data.data)\n resetFormControls();\n \n })\n .then(res => {\n handlehistory( action.ADD , 'بيانات أولاد الاعمام ' , \" اضافه بيانات أولاد الاعمام \")\n })\n .catch(function (response) {\n //handle error\n notifyErr()\n setLoading(false)\n // notify()\n console.log(response);\n }); \n \n } \n console.log(values);\n }", "function sendData() {\n let dataSend = {\n 'Fname': fname, 'Lname': lname, 'Gender': gender, 'Address': addr,\n 'BirthDate': birthdate, 'Ssn': ssn, 'Tel': tel, 'JobType': jobtype,\n 'Nationality': nation\n }\n let url = 'http://localhost:5000/employee/update/' + id\n console.log(dataSend);\n axios.post(url, dataSend)\n .then((response) => {\n console.log(response);\n if (response.data.name == \"error\") {\n console.log(response.data);\n alert(\"failed\")\n return\n }\n alert(\"success\")\n props.history.push('/employee');\n });\n }", "submitNewEndPointForm(data){\n console.info(\"submitNewEndPointForm\",data);\n\n //get backendTypeName from ID\n let backendTypeName;\n let arr = this.props.backEndDetection.tableData.filter(function(val) { \n return val.id == data.backendTypeId;\n });\n if(arr.length !=0)\n backendTypeName = arr[0].type.href;\n \n //get fqm and desc if not custom by parsing data.fqm\n if(data.customFQMToggle != true && data.fqm != undefined)\n {\n var parsedObj = Object.assign({},JSON.parse(data.fqm));\n data.fqm = parsedObj.fqm;\n data.desc = parsedObj.desc;\n }\n //calling action for updating \n this.props.addNewBackendPoint(data,this.props.params.profileId,this.makeRunTimeChange);\n this.handleCloseNewendPoint();\n \n}", "function saveNewData(user, restaurants) {\n // Check to see how often this is clicked\n if (typeof ens_specialEvent != \"undefined\"){\n ens_specialEvent(\"Top 100 Restaurants 2018\",\"Button Click\",\"Save To List\");\n }\n \n var newSavedData = {\n \"edbId\":user,\n \"restaurants\":restaurants\n };\n $.ajax({\n method: \"POST\",\n data: JSON.stringify(newSavedData),\n contentType: \"application/json\",\n error: function(msg) { \n // console.log(\"Failed to save data\"); \n },\n url: \"https://hcyqzeoa9b.execute-api.us-west-1.amazonaws.com/v1/top100/2018/checklist\"\n });\n}", "function postToServer(key){\n\tlocalforage.getItem('logs')\n\t.then((logs)=>{\n\t\tlet log = logs[key];\n\t\tlog = formatVolunteers(log);\n\t\tconsole.log(log);\n\t\t$.ajax({\n\t\t\ttype : 'POST',\n\t\t\tcontentType: \"application/json; charset=utf-8\",\n\t\t\turl : \"sample\",\n\t\t\tdataType: 'json',\n\t\t\tdata : JSON.stringify(log),\n\t\t\tsuccess : (response)=>{\n\t\t\t\tconsole.log(response);\n\t\t\t\tlog.submitted = true;\n\t\t\t\talert(\"Upload Success!\");\n\t\t\t\tlocalforage.setItem('logs',logs)\n\t\t\t\t.then(()=>window.location.reload(false));\n\t\t\t},\n\t\t\terror : (response)=>{\n\t\t\t\tconsole.log(response);\n\t\t\t\talert('Upload Failed!');\n\t\t\t\twindow.location.reload(false);\n\t\t\t\t$('.uploadModal').fadeOut(300);\n\n\t\t\t}\n\t\t});\n\n\t})\n}", "function getSITablePost(PSCIP,PSCPort,PSCProtocol,PSCUser,PSCPassword,SITableName,filter){\n\tif (PSCProtocol == \"http\"){\n\t\tvar httpsClient = new HttpClient();\n\t\thttpsClient.getHostConfiguration().setHost(PSCIP, 80, \"http\");\n\t}else{\n\t\tvar httpsClient = CustomEasySSLSocketFactory.getIgnoreSSLClient(PSCIP,PSCPort);\n\t}\n\thttpsClient.getParams().setCookiePolicy(\"default\");\n\tif(SITableName.indexOf(\"Si\")!=0){\n\t\tSITableName = \"Si\" + SITableName;\n\t}\n\tvar tableURL = \"/RequestCenter/nsapi/serviceitem/\" + SITableName;\n\tvar httpMethod = new PostMethod(tableURL);\n var filterJson = new HashMap();\n filterJson.put(\"filterString\",filter);\n var dataPayload = String(JSON.javaToJsonString(filterJson, filterJson.getClass()));\n\tdataPayload = dataPayload.replace(/'/g, '\"');\n\trequestEntity = new StringRequestEntity(dataPayload,\"application/json\",\"UTF-8\");\n httpMethod.setRequestEntity(requestEntity);\n\thttpMethod.addRequestHeader(\"username\", PSCUser);\n\thttpMethod.addRequestHeader(\"password\", PSCPassword);\n\thttpMethod.addRequestHeader(\"Content-type\", \"application/json\");\n httpsClient.executeMethod(httpMethod);\n\tvar statuscode = httpMethod.getStatusCode();\n\tif (statuscode != 200)\n\t{\n\t\tlogger.addError(\"Unable to get the table data with name \" + SITableName + \". HTTP response code: \" + statuscode);\n\t\tlogger.addError(\"Response = \"+httpMethod.getResponseBodyAsString());\n\t \thttpMethod.releaseConnection();\n\t // Set this task as failed.\n\t\tctxt.setFailed(\"Request failed.\");\n\t\tctxt.exit()\n\t} else {\n\t\t//logger.addInfo(\"Table \" + SITableName + \" retrieved successfully.\");\n\t\tvar responseBody = String(httpMethod.getResponseBodyAsString());\n httpMethod.releaseConnection();\n\t\t//logger.addInfo(responseBody)\n\t\treturn responseBody;\n\n\t}\n}", "insertPublishList(data){\nreturn this.post(Config.API_URL + Constant.PUBLISH_INSERTPUBLISHLIST, data);\n}", "function CallbackData(data,page, handler,method){\n\tvar methodTxt = 'POST';\n\tif(CallbackData.arguments[3]) methodTxt = CallbackData.arguments[3];\n\tvar request = createRequest();\n\tif(request)\n\t{\n\t\t// prepare request\n\t\trequest.open(methodTxt, page, true);\n\t\trequest.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\n\t\t// when the request is answered, relayResponse() will be called\n\t\trequest.onreadystatechange = function(){ relayResponse(request, handler); }\n\n\t\t// fire off the request\n\t\trequest.send(data);\n\t}\n\telse\n\t{\n\t\t// request object wasn't instantiated\n\t\thandler(false, 'Unable to create request object.');\n\t}\n}", "function submitPost(){\n const title = document.querySelector('#title').value;\n const body = document.querySelector('#body').value;\n const id = document.querySelector('#id').value;\n\n const data = {\n title, // em ES6, esta linha equivale a title:title\n body // em ES6, esta linha equivale a body:body\n }\n\n // verifica que campos do form nao estao vazios\n if (title === '' || body === '') {\n ui.showAlert('Please fill in all fields', 'alert alert-danger');\n } else {\n\n // condicional verifica se eh um estado de ADD ou EDIT, pois o campo oculto de ID vem vazio por padrao, e eh limpo ao cancelar o estado de edicao\n if (id === '') {\n // cria post\n http.post('http://localhost:3000/posts', data)\n .then(data => {\n // confirma envio do post\n ui.showAlert('Post added', 'alert alert-success');\n // limpa campos do formulario\n ui.clearFields();\n \n // retorna na interface todos os posts, inclusive o que acabamos de adicionar\n getPosts();\n })\n .catch(err => console.log(err));\n } else {\n // edita post\n http.put(`http://localhost:3000/posts/${id}`, data)\n .then(data => {\n // confirma edicao do post\n ui.showAlert('Post updated', 'alert alert-success');\n // retorna estado para ADD\n ui.changeFormState('add');\n \n // retorna na interface todos os posts, inclusive o que acabamos de editar\n getPosts();\n })\n .catch(err => console.log(err));\n \n }\n }\n}", "function performAction(e) { //1 CLICK EVENT FUNCT\n const newZip = document.getElementById('zip').value;\n const feelings = document.getElementById('feelings').value;\n console.log(newZip);\n console.log(feelings);\n getWeather(baseURL, newZip, key) //2 CALL WEB API AND GET DATA\n .then(function(data) {\n console.log(\"HERE\" + data);\n //ADD data to POST request\n postData('http://localhost:3000/projectDataEndpoint', {date:d, temperature:data.main.temp, content:feelings}) //3 SAVE DATA TO OBJECT IN LOCAL SERVER\n updateUi(); //4 UPDATE VIEW\n })\n}", "function saveDayInfo(){\n var selectedDate = document.getElementById(\"myDate\").value;\n if(selectedDate == \"\"){\n alert(\"Select a Date\");\n return;\n }\n var dateObject = new Date(selectedDate);\n var dateForPost = (\"0\" + dateObject.getDate()).slice(-2)+\"/\"+(\"0\" + (dateObject.getMonth()+1)).slice(-2)+\"/\"+dateObject.getFullYear();\n shData = {};\n shData.date = dateForPost;\n shData.activity = document.getElementById(\"activity-select\").value;\n shData.workplace = document.getElementById(\"employer-select\").value\n shData.hours = document.getElementById(\"hours-select\").value;\n shData.employeeId = sessionStorage.getItem(\"loginUserDetails\");\n shData = JSON.stringify(shData);\n ajaxData(\"POST\", baseurl +\"/submitHours\", callbackSubmitHours, shData);\n }", "function sentData (params){\n // let url=''; // url to php script\n // let local // true = localhost; false = public (ciot.uni-ruse.bg)\n // // check for localhost by href\n // let currHref = (window.location.href).split('//')[1].split('/')[0];\n // if(currHref === 'localhost') local = true;\n // else local = false;\n // if(local){\n // params.dbServerName = 'localhost';\n // url = 'php/logToDB.php';\n // }else{\n // params.dbServerName = '172.20.138.121';\n // url = 'https://ciot.uni-ruse.bg/ndks/logToDB.php';\n // }\n\n let host = getHost();\n let url = host.url;\n params.dbServerName = host.dbServerName;\n\n const form = document.createElement('form');\n for (const key in params) {\n if (params.hasOwnProperty(key)) {\n const hiddenField = document.createElement('input');\n hiddenField.type = 'hidden';\n hiddenField.name = key;\n hiddenField.value = params[key];\n form.appendChild(hiddenField);\n }\n }\n $.ajax({\n url: url+'logToDB.php',\n type:'post',\n data:$(form).serialize(),\n success:function(response){\n console.log('Data are sent!');\n console.log('Ajax response: ',response);\n }\n });\n}", "function returndata(submitdeadline,submitcontext) {\r\n console.log(ss);\r\n console.log(studentid);\r\n var pp = { \"lesson_id\" : lessonid[ss], \"student_id\" : studentid , \"deadline\" : submitdeadline , \"context\" : submitcontext };\r\n console.log(pp);\r\n $.ajax({\r\n url: api_edit_personal_plan,\r\n type: \"POST\",\r\n data: JSON.stringify(pp),\r\n dataType: \"json\",\r\n contentType: \"application/json; charset=utf-8\",\r\n \r\n success: function(data){\r\n if(data.message == \"資料不得為空\")\r\n {\r\n window.alert(\"資料不得為空喔~~\");\r\n }\r\n else\r\n {\r\n alert(\"send success!\");\r\n console.log(data);\r\n getSavedData();\r\n }\r\n //console.log(data);\r\n \r\n },\r\n \r\n error: function(){\r\n alert(\"send error!!!\");\r\n }\r\n });\r\n }", "function postdata(url, data) {\n return httpService(url, data, 'POST');\n }", "function editData(event) {\n\tvar saleid = document.getElementById(\"saleid\").value;\n\tvar product = document.getElementById(\"editproduct\").value;\n\tvar quantity = document.getElementById(\"editquantity\").value;\n\tvar datetime = document.getElementById(\"editdatetime\").value;\n\tvar json =\n\t{\n\t\"authent\": {\n\t\t\t\"username\": \"feferi\",\n\t\t\t\"password\": \"0413\"\n\t\t},\n\t\t\n\t\t\"requests\": [\n\t\t\t{\n\t\t\t\t\"type\": \"edit\",\n\t\t\t\t\"updateTo\": {\n\t\t\t\t},\n\t\t\t\t\"filter\": {\n\t\t\t\t\t\"type\": \"column\",\n\t\t\t\t\t\"name\": \"id\",\n\t\t\t\t\t\"value\": saleid\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t};\n\t\n\tif(saleid && saleid.match(/^\\d*$/))\n\t{\n\t\tif(product != \"\")\n\t\t{\n\t\t\tjson.requests[0].updateTo.product = Number(product);\n\t\t}\n\t\t\n\t\tif(quantity != \"\")\n\t\t{\n\t\t\tjson.requests[0].updateTo.quantity = Number(quantity);\n\t\t}\n\t\t\n\t\tif(datetime != \"\")\n\t\t{\n\t\t\tjson.requests[0].updateTo.dateTime = getDateAndTime();\n\t\t}\n\t\t\t\t\t\t\n\t\treturn sendAPIRequest(json, event, displaySalesRecords);\n\t}\n\telse\n\t{\n\t\talert(\"Please enter a numerical value for sale id\");\n\t}\n\t\n}", "async function saveData(allData) {\n let save = await fetch(serverUrl+ \"postData\", {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(allData),\n });\n save.json().then(data => { setEntryContent();}); \n}", "save(data){\nreturn this.post(Config.API_URL + Constant.REFFERAL_SAVE, data);\n}" ]
[ "0.67267084", "0.6569569", "0.65450704", "0.6374348", "0.63169354", "0.62919647", "0.6223695", "0.61838585", "0.61772543", "0.61515725", "0.6113738", "0.6101393", "0.6076545", "0.606265", "0.60592556", "0.6054877", "0.59549695", "0.5947963", "0.59464735", "0.5941304", "0.5939538", "0.5933581", "0.5924143", "0.5899249", "0.5897681", "0.5866836", "0.58540905", "0.5833118", "0.5826307", "0.5820123", "0.581025", "0.5805733", "0.5805733", "0.5796481", "0.5789018", "0.5785078", "0.57772905", "0.5773485", "0.5770206", "0.57626396", "0.5761831", "0.57511765", "0.57437825", "0.5736595", "0.57273704", "0.57273304", "0.57233214", "0.571476", "0.57142437", "0.57086235", "0.5707514", "0.57012594", "0.56997836", "0.56813", "0.5680649", "0.56760144", "0.56668824", "0.5666127", "0.56638235", "0.5661409", "0.5658258", "0.56557584", "0.56542194", "0.5648639", "0.5645267", "0.5640796", "0.5640428", "0.56389534", "0.56360114", "0.5635281", "0.5633937", "0.5633396", "0.5628356", "0.5626127", "0.56255025", "0.562537", "0.5623294", "0.5622142", "0.5615941", "0.56026006", "0.56006205", "0.559716", "0.5591848", "0.559156", "0.55895495", "0.55874944", "0.5587333", "0.55850774", "0.55840003", "0.55801123", "0.55750954", "0.5573405", "0.557338", "0.55703396", "0.55697554", "0.55692315", "0.55688566", "0.5567836", "0.5564964", "0.5564497" ]
0.62282884
6
`scope` is just an element within which JS should search for the elements below This way you can have multiple sliders on one page, independent of each other
constructor(scope, options = {}) { this.el = { // The child elements of the `container` element become "slides" container: scope.querySelector('[data-slider-container]'), // Can have any number of `triggers`, located anywhere within the scope // Attribute value should be "left" or "right" directionTriggers: Array.from(scope.querySelectorAll('[data-slider-direction]')), }; this.options = { ...options, stepMS: 10, stepDistance: 20, }; this.state = { interval: null, }; const handleClick = event => { // Prevent multiple scrolls e.g. if someone clicks the buttons rapidly clearInterval(this.state.interval); const containerCurrentOffset = this.el.container.scrollLeft; const containerWidth = this.el.container.getBoundingClientRect().width; const directionIntended = event.target.dataset.sliderDirection; // Get the place/position of the slide that is currently most visible const currentPlace = Math.round(containerCurrentOffset / containerWidth); let targetPlace; if (directionIntended === 'left') { targetPlace = currentPlace - 1; } else if (directionIntended === 'right') { targetPlace = currentPlace + 1; } // Go to the first slide if clicking "right" on the last slide, and vice-versa const numberOfSlides = this.el.container.children.length; if (targetPlace >= numberOfSlides) { targetPlace = 0; } else if (targetPlace < 0) { targetPlace = numberOfSlides - 1; } const directionMultiplier = (targetPlace <= currentPlace ? -1 : 1); const targetOffset = (targetPlace * containerWidth); const step = () => { this.el.container.scrollLeft += (directionMultiplier * this.options.stepDistance); // If it scrolled past the target offset, then go to the target offset and stop const remainingOffset = (targetOffset - this.el.container.scrollLeft); if ((directionMultiplier * remainingOffset) <= 0) { this.el.container.scrollLeft = targetOffset; clearInterval(this.state.interval); } }; this.state.interval = setInterval(step, this.options.stepMS); }; for (let trigger, i = 0; trigger = this.el.directionTriggers[i]; i++) { trigger.addEventListener('click', handleClick); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "find_slider()\n\t{\n\t\tif (this.slider) return this.slider; // slider already set\n\n\t\tlet q = `[${this.attr}=\"${this.name ? this.name : ''}\"]`;\n\t\tlet sliders = document.querySelectorAll(q);\n\t\tfor (let slider of sliders)\n\t\t{\n\t\t\tif (!slider.hasAttribute(this.attr + \"-set\")) return slider;\n\t\t}\n\t\treturn null;\n\t}", "_findSelectors() {\n this._container = document.querySelector(this._settings.targetSelector);\n this._items = Array.from(\n document.querySelectorAll(`.${this._container.firstElementChild.className}`)\n );\n this._relatedSliders = this._settings.relatedSlidersSelectors\n .map(selector => document.querySelector(selector));\n this._leftControl = document.querySelector(this._settings.leftSelector);\n this._rightControl = document.querySelector(this._settings.rightSelector);\n }", "function thicknessExperiment(scope){\n\t/** Setting the slider value to the label variable */\t\n\tthickness = scope.thickness_num = scope.thicknessNum;\n}", "function CustomJsSlider() {\n \"use strict\";\n return {\n restrict: 'E',\n scope: {\n rangeInterval: '=rangeInterval',\n minRange: '=minRange',\n maxRange: '=maxRange',\n rangeIncrementFlag: '=rangeIncrementFlag'\n },\n template: '<div class=\"jsSliderHandlerTrack\">'\n + '<div class=\"jsSliderHandlerFill\">'\n + '<span class=\"jsSliderHandler\">'\n + '<span class=\"handlerCenterPoint\"></span>'\n + '</span>'\n + '</div>'\n + '</div>',\n link: function (scope, element, attr, ctrl) {\n //SLIDER SETUP\n //define directive variables\n var rangeInterval, minRange, maxRange,\n handler, handlerPointer, handlerWidth, handlerLeftPos,\n handlerTrack, handlerTrackWidth,\n handlerFill,\n startX,\n clickedHandlerByMouseFlag,\n rangeIncrementFlag;\n\n //get directive DOM elements\n handler = element.find('span')[0];\n handlerPointer = element.find('span')[1];\n handlerTrack = element.find('div')[0];\n handlerFill = element.find('div')[1];\n\n //positioning the handler vertically on the track\n handler.style.top = (handlerTrack.offsetHeight / 2) - (handler.offsetHeight / 2) + 'px';\n //positioning the pointer in the center of the handler\n handlerPointer.style.left = (handler.clientWidth / 2) - (handlerPointer.clientWidth / 2) + 'px';\n handlerPointer.style.top = (handler.clientWidth / 2) - (handlerPointer.clientWidth / 2) + 'px';\n\n //set default properties for some variables\n handlerWidth = handler.offsetWidth;\n //END SLIDER SETUP\n\n //SLIDER FORMULA\n /**\n * Formula structure for setting handler position according to range interval and vice versa\n * Analytic Geometry, Equation of a line /Dreapta in plan/)\n * Formula: (y - y1)/(y2-y1) = (x-x1)/(x2-x1) where:\n * y = maximum credit range, y1 = minimum credit range, y2 = given range intervals\n * x = track width, x1 = track starting point, x2 = given handler position on the track\n * Variables values to be found (necunoscutele din ecuatie):\n * x2 = handler position relative to the given range interval (y2)\n * y2 = range interval relative to the given handler position (x2)\n * @method sliderFormula\n * @param {Object} obj -An object containing the unknowns (x2, y2)\n * @returns {Object} {x: number, x1: number, x2: number, y: number, y1: number, y2: number}\n */\n function sliderFormula(obj) {\n handlerTrackWidth = handlerTrack.clientWidth - handlerWidth;\n\n var formulaObj = {\n x: handlerTrackWidth,\n x1: 0,\n x2: obj.x2,\n y: maxRange,\n y1: minRange,\n y2: obj.y2\n };\n\n return formulaObj;\n }\n\n /**\n * Calculate handler position according to range interval. Using slider formula.\n * @method calculateHandlerPosition\n * @returns {Number} -The handler position according to range interval\n */\n function calculateHandlerPosition() {\n var F, eq1, eq2, eq3;\n F = sliderFormula({x2: '', y2: rangeInterval});\n\n eq1 = (F.y - F.y1);\n eq2 = (F.y2 - F.y1);\n eq3 = (F.x - F.x1);\n F.x2 = (eq2 * eq3) / eq1 + F.x1;\n\n return F.x2;\n }\n\n /**\n * Calculate range interval according to handler position. Using the same slider formula.\n * @method calculateRangeInterval\n * @param {Number} x2 -Handler position on the track\n * @returns {Number} - The range interval according to handler position on the track\n */\n function calculateRangeInterval(x2) {\n var F, eq1, eq2, eq3;\n F = sliderFormula({x2: x2, y2: ''});\n\n eq1 = (F.y - F.y1);\n eq2 = (F.x - F.x1);\n eq3 = (F.x2 - F.x1);\n F.y2 = ((eq1 * eq3) / eq2) + F.y1;\n\n return F.y2;\n }\n //END SLIDER FORMULA\n\n //SLIDER METHODS\n /**\n * When the user writes in input fields, the value can be bigger or smaller than the given range. It all depends on the user ideas to test the limits of the validation.\n * The input fields take care of their own value validation but the slider handler should not be permitted to be positioned above or below x - x1 range\n * @method filterHandlerPosition\n * @param {Number} handlerLeftPos -Left position of the handler\n * @returns {*}\n */\n function filterHandlerPosition(handlerLeftPos) {\n return (handlerLeftPos > handlerTrackWidth) ? handlerTrackWidth : (handlerLeftPos < 0) ? 0 : handlerLeftPos;\n }\n\n /**\n * Positioning handler on the track\n * @method setHandlerPosition\n */\n function setHandlerPosition() {\n var x2 = filterHandlerPosition(calculateHandlerPosition());\n handler.style.left = x2 + 'px';\n //the handler fill will be placed under the handler button\n handlerFill.style.width = x2 + (handler.offsetWidth / 2) + 'px';\n }\n\n /**\n * Pass range interval value to the scope\n * @method updateScopeInterval\n * @param {Number} leftPos\n */\n function updateScopeRangeInterval(leftPos) {\n var rangeInterval, rangeLength, rangeIncrement;\n //add value to scope\n if (!rangeIncrementFlag) {\n scope.rangeInterval = parseInt(calculateRangeInterval(leftPos), 10);\n scope.$apply();\n } else {\n rangeInterval = parseInt(calculateRangeInterval(leftPos), 10);\n rangeLength = maxRange.toString().length;\n rangeIncrement = (rangeLength <= 2) ? 1 : Math.pow(10, rangeLength - 1) / Math.pow(10, 1);\n\n if (rangeInterval - (rangeInterval % rangeIncrement) <= minRange) {\n scope.rangeInterval = minRange;\n } else if (rangeInterval >= maxRange) {\n scope.rangeInterval = maxRange;\n } else {\n scope.rangeInterval = rangeInterval - (rangeInterval % rangeIncrement);\n }\n\n scope.$apply();\n }\n }\n\n function onPointerOrMouseMove(e){\n var distance, leftPos;\n if (clickedHandlerByMouseFlag) {\n distance = parseInt(e.clientX, 10) - startX;\n leftPos = filterHandlerPosition(handlerLeftPos + distance);\n// handler.style.left = leftPos + 'px';\n //the handler fill will be placed under the handler button\n// handlerFill.style.width = leftPos + (handler.offsetWidth / 2) + 'px';\n updateScopeRangeInterval(leftPos);\n }\n }\n\n function onPointerOrMouseDown(e){\n clickedHandlerByMouseFlag = true;\n //get left position of the handler\n handlerLeftPos = parseInt(handler.style.left, 10);\n //get X coordinates of touch point\n startX = parseInt(e.clientX, 10);\n }\n\n function mouseUp() {\n document.onmousemove = false;\n clickedHandlerByMouseFlag = false;\n }\n\n //SLIDER CONTROL EVENTS\n /**\n * Fired when clicking on the handler track to position the handler at the click location.\n * e.offsetX = click location on the track. Firefox has no implementation for offsetX.\n * e.layerX = click location on the track but for Firefox. Deprecated in Chrome.\n * @event click\n */\n handlerTrack.addEventListener('click', function (e) {\n var offsetX, distance;\n offsetX = e.offsetX || e.layerX;\n distance = filterHandlerPosition(offsetX - (handler.offsetWidth / 2));\n updateScopeRangeInterval(distance);\n e.stopPropagation();\n //TODO: in Firefox, clicking forward will place the handler after the clicking location\n });\n\n //TOUCH CONTROL OVER THE HANDLER\n /**\n * Fired when clicking on the handler.\n * This event was added to cancel bubbling up of the click event on its parent container (handler track)\n * @event click\n */\n handler.addEventListener('click', function (e) {\n e.stopPropagation();\n });\n\n /**\n * Getting left position of the handler and X coordinates of the touch point\n * @event touchstart\n */\n handler.addEventListener('touchstart', function (e) {\n var touchObj;\n //first touch point\n touchObj = e.changedTouches[0];\n //get left position of the handler\n handlerLeftPos = parseInt(handler.style.left, 10);\n //get X coordinates of touch point\n startX = parseInt(touchObj.clientX, 10);\n //prevent default click behavior\n e.preventDefault();\n e.stopPropagation();\n }, false);\n\n /**\n * Moving the handler on the track.\n * @event touchmove\n */\n handler.addEventListener('touchmove', function (e) {\n var touchObj, distance, leftPos;\n //first touch point for this event\n touchObj = e.changedTouches[0];\n //calculate distance traveled by touch point\n distance = parseInt(touchObj.clientX, 10) - startX;\n //calculate next handler position\n leftPos = filterHandlerPosition(handlerLeftPos + distance);\n\n updateScopeRangeInterval(leftPos);\n\n //prevent default click behavior\n e.preventDefault();\n e.stopPropagation();\n }, false);\n\n /**\n * Getting left position of the handler and X coordinates of touch point.\n * Windows touch down event. It will be deprecated on IE 11, being replaced with pointerdown\n * @event MSPointerDown\n */\n handler.addEventListener('MSPointerDown', onPointerOrMouseDown);\n\n //MOVING THE HANDLER USING WINDOWS MOBILE DEVICES\n /**\n * In order to move the handler successfully, an -ms-touch-action rule with a value of none must be added on\n * targeted element, otherwise an unexpected event (MSPointerCancel) will be triggered when moving finger too fast.\n * It will act like a swiping event over the element.\n * That's because MSPointerCancel will be dispatched when either (1) the system has determined\n * that a pointer is unlikely to continue to produce events (for example, due to a hardware event),\n * or (2) after having fired the MSPointerDown event, the pointer is subsequently used to manipulate the page viewport (for example, panning or zooming).\n */\n $(handler).css('-ms-touch-action', 'none');\n\n /**\n * Windows touch move event. It will be deprecated on IE 11, being replaced with pointermove\n * @event MSPointerMove\n */\n handler.addEventListener('MSPointerMove', onPointerOrMouseMove);\n\n //MOVING THE HANDLER USING MOUSE\n /**\n * @event mousedown\n */\n handler.addEventListener('mousedown', onPointerOrMouseDown);\n\n /**\n * Moving the handler by mouse.\n * This event was added on the document element because trying to drag an object with the mouse will result in a faulty operation\n * as the cursor will jump outside of the dragged element if moved quickly. The event will stop firing when this happens\n * until the mouse moves back over the dragged element. Adding the event on the document fixes this problem.\n * @event mousemove\n */\n document.addEventListener('mousemove', onPointerOrMouseMove);\n\n /**\n * Removing document event handlers and reset dragging flag so that mouse drag process can start again\n * @event mouseup\n */\n document.addEventListener('mouseup', mouseUp);\n\n //REPOSITION HANDLER AFTER RESIZING WINDOW\n /**\n * Resetting handler position on window resizing\n * @event resize\n */\n $(window).resize(setHandlerPosition);\n //END SLIDER CONTROL EVENTS\n\n //unbind events\n scope.$on('$destroy', function () {\n $(document).unbind('mouseup', mouseUp);\n $(window).unbind('resize', setHandlerPosition);\n });\n\n //ANGULAR\n scope.$watch('rangeInterval + minRange + maxRange', function () {\n rangeInterval = scope.rangeInterval;\n minRange = scope.minRange;\n maxRange = scope.maxRange;\n rangeIncrementFlag = scope.rangeIncrementFlag;\n setHandlerPosition();\n });\n //END ANGULAR\n }\n };\n}", "function velocitySliderChange(scope) {\n bullet_moving_velocity = scope.velocity + 28;\n calculation(scope); /** Value calculation function */\n scope.erase_disable = true; /** Disable the erase button */\n}", "function initialisationOfVariables(scope) {\n\tdocument.getElementById(\"site-sidenav\").style.display=\"block\";\n\ttab_label=\"conjugate\";\n\tselectedIndex=1;\n\tborder_style_black=\"1px solid black\";\n\tborder_style_red=\"1px solid red\";\t\n\trandum_selected_img = 12;\n\tgetChild();\n}", "findControls() {\n\t\tthis.hiderElement = this.container.querySelector(this.hiderElementSelector);\n\t\tthis.showerElement = this.container.querySelector(this.showerElementSelector);\n\t}", "_updateEls() {\n let numSliders = this.o.numSliders;\n\n // add SVG elements representing sliders to match current number of sliders\n for (let i = this.state.sliderVals.length; i < numSliders; ++i) {\n this.state.sliderVals.push(this.o.minVal);\n this._addSvgSlider();\n }\n\n // remove SVG elements representing sliders to match current number of sliders\n for (let i = this.state.sliderVals.length; i > numSliders; --i) {\n this.state.sliderVals.pop();\n this._removeSvgSlider();\n }\n }", "function currentExperiment(scope){\n\t/** Setting the slider value to the label variable */\n\tscope.current_num = current;\n\t/** Equation is used to rotate the needle */\n\tgetChild(\"needle\").rotation = current * 10;\n\t/** Equation is used to rotate the white arc based on the current */\n\trotation = current*30;\n\tgetChild(\"white_rotate\").rotation = rotation;\n\tcalculation(scope);\n\thall_effect_stage.update();\n}", "function readVariableFromHTMLSlider(el,theInteractiveGraph) {\n var n = HTMLControlNameToNumber($(el).attr('id'));\n var oldval = (theInteractiveGraph.variables[n]).val();\n var accepted=(theInteractiveGraph.variables[n]).val($(el).val());\n \n if (oldval != (theInteractiveGraph.variables[n]).val() ) {\n \n for (var i = 0; i < theInteractiveGraph.variables[n].propagateFunctions.length; i++) { \n \n theInteractiveGraph.variables[n].propagateFunctions[i]();\n \n };\n\n theInteractiveGraph.propagateVariableChange(); \n \n }\n}", "function createSliderView() {\n console.log('createSliderView');\n var i = 0;\n for (group_name in link_group) {\n $(\"#slider-pane\").append('<div id=\"' + group_name + '\"/>');\n if (i != 0) {\n $(\"#\" + group_name).hide();\n }\n else {\n current_group = group_name;\n i++;\n }\n }\n joint_names.get(function(value) {\n names = value.names;\n for (group_name in link_group) {\n for (var i = 0;i < names.length;i++) {\n if (link_group[group_name].indexOf(names[i]) != -1) {\n child = $('<label>', {for: names[i], text: names[i], class: \"col-form-label-sm\", id: names[i]});\n child3 = $('<span>', {class: \"float-right\", text:\"0\", id: names[i]});\n child2 = $('<input>', {type: \"range\", name: names[i], class: \"form-control form-control-sm\", id: names[i], value: 0, max: eval(\"value.\" + names[i] + \".max\"), min: eval(\"value.\" + names[i] + \".min\"), step: 0.000001, oninput: \"callback()\", onchange: \"callback()\"});\n $(\"#\" + group_name).append(child);\n $(\"#\" + group_name).append(child3);\n $(\"#\" + group_name).append(child2);\n }\n }\n }\n //$.getScript(\"js/jquery-mobile/jquery.mobile-1.3.2.min.js\");\n var msg = new ROSLIB.Message({\n data: current_group\n });\n start_initial_interactive_pub.publish(msg);\n goal_initial_interactive_pub.publish(msg);\n });\n}", "function getSlider(element) {\n return element.parentNode.getElementsByClassName(\"slider\")[0];\n}", "addSliders() {\n this.sliders = this.config.map(function createSlider(obj) {\n var slider = document.createElement('input'),\n valueElement = document.createElement('span');\n slider.type = 'range';\n slider.min = 0;\n slider.value = 0;\n slider.setAttribute('data-axis', obj.gS);\n slider.setAttribute('data-vpart', obj.vPart);\n slider.setAttribute('data-size', obj.size);\n valueElement.textContent = obj.vPart + ': 0';\n extensionElements.mouseSlidersWrapper.appendChild(slider);\n extensionElements.mouseSlidersWrapper.appendChild(valueElement);\n slider.addEventListener(\n 'input',\n this.onSliderChange.bind(this)\n );\n slider.addEventListener('blur', this.onSliderBlur);\n return slider;\n }, this);\n }", "addSliders() {\n this.sliders = this.config.map(function createSlider(obj) {\n var slider = document.createElement('input'),\n valueElement = document.createElement('span');\n slider.type = 'range';\n slider.min = 0;\n slider.value = 0;\n slider.setAttribute('data-axis', obj.gS);\n slider.setAttribute('data-vpart', obj.vPart);\n slider.setAttribute('data-size', obj.size);\n valueElement.textContent = obj.vPart + ': 0';\n extensionElements.mouseSlidersWrapper.appendChild(slider);\n extensionElements.mouseSlidersWrapper.appendChild(valueElement);\n slider.addEventListener('input', this.onSliderChange.bind(this));\n slider.addEventListener('blur', this.onSliderBlur);\n return slider;\n }, this);\n }", "function populateSlideBars() {\n for (var i = 1; i < 10; i++) {\n $( \"#spotlight\" + i).append(\"<input class='mdl-slider \" +\n \"mdl-js-slider is-upgraded' type='range' id='s\" + i + \n \"' min='0' max='100' value='0' \" + \n \"oninput='adjustLightIntensity(\" + i + \", this.value)' \" +\n \"onchange='adjustLightIntensity(\" + i + \", this.value)'>\");\n }\n}", "function settySlider(variable){\n var slidervars = document.getElementById('slider');\n slidervars.value = variable;\n}", "_initAttributesActions() {\n [\"next\", \"previous\"].forEach((action) => {\n __querySelectorLive(`[s-slider-${action}]:not(s-slider#${this.id} s-slider [s-slider-${action}])`, ($elm) => {\n $elm.addEventListener(\"pointerup\", (e) => {\n e.preventDefault();\n this[action](true);\n });\n }, {\n scopes: false,\n rootNode: this\n });\n });\n __querySelectorLive(`[s-slider-goto]:not(s-slider#${this.id} .s-slider [s-slider-goto])`, ($elm) => {\n $elm.addEventListener(\"pointerup\", (e) => {\n var _a;\n const slideIdx = (_a = parseInt($elm.getAttribute(\"s-slider-goto\"))) !== null && _a !== void 0 ? _a : 0;\n this.goTo(slideIdx, true);\n });\n }, {\n scopes: false,\n rootNode: this\n });\n }", "function addSliders(div) {\n \n var sweetnessSliderContainer = $(\"<div class='row-fluid'><div class='span2 leftSliderLabel'>sweet</div><div class='span8'></div><div class='span2'>sour</div></div>\");\n sweetnessSliderContainer.find('.span8').append($(\"<div id='sweetnessSlider'></div>\"));\n div.append(sweetnessSliderContainer);\n \n var smoothnessSliderContainer = $(\"<div class='row-fluid'><div class='span2 leftSliderLabel'>smooth</div><div class='span8'></div><div class='span2'>chunky</div></div>\");\n smoothnessSliderContainer.find('.span8').append($(\"<div id='smoothnessSlider'></div>\"));\n div.append(smoothnessSliderContainer);\n \n var tropicalitySliderContainer = $(\"<div class='row-fluid'><div class='span2 leftSliderLabel'>tropical</div><div class='span8'></div><div class='span2'>conventional</div></div>\");\n tropicalitySliderContainer.find('.span8').append($(\"<div id='tropicalitySlider'></div>\"));\n div.append(tropicalitySliderContainer);\n \n var hungerSliderContainer = $(\"<div class='row-fluid'><div class='span2 leftSliderLabel'>peckish</div><div class='span8'></div><div class='span2'>ravenous</div></div>\");\n hungerSliderContainer.find('.span8').append($(\"<div id='hungerSlider'></div>\"));\n div.append(hungerSliderContainer);\n \n }", "function setReflectanceParameter(){\n\tvar rp = document.getElementById(\"reflectance-slider\").value;\n}", "function hallcurrentExperiment(scope){\n\t/** Setting the slider value to the label variable */\t\n\thallcurrent = scope.hallcurrent_num = scope.hallcurrentNum;\n\tcalculation(scope);\n}", "function doSlide(x){scope.$evalAsync(function(){setModelValue(percentToValue(positionToPercent(x)));});}", "function init_sliders(){\n // START MAIN SLIDER\n slidr_level_1 = slidr.create('slidr-level-1', {\n after: function(e) { console.log('in: ' + e.in.slidr); },\n before: function(e) { console.log('out: ' + e.out.slidr); },\n breadcrumbs: false,\n controls: 'none',\n direction: 'horizontal',\n fade: false,\n keyboard: true,\n overflow: true,\n pause: false,\n theme: '#222',\n timing: { 'cube': '0.5s ease-in' },\n touch: true,\n transition: 'linear'\n }).start();\n\n // START HOME CAROUSEL SLIDER\n slidr_carousel = slidr.create('slidr-carousel', {\n after: function(e) { console.log('in: ' + e.in.slidr); },\n before: function(e) { console.log('out: ' + e.out.slidr); },\n breadcrumbs: false,\n controls: 'none',\n direction: 'horizontal',\n fade: false,\n keyboard: true,\n overflow: true,\n pause: false,\n theme: '#222',\n timing: { 'cube': '1s ease-in' },\n touch: true,\n transition: 'fade',\n }).start(); \n\n slidr_carousel.auto(10000); \n slidr_carousel.add('h', looping_slides_count);\n // carousel_slide_count[i - 1] = (i.toString());\n\n // carousel_slide_count.push('1');\n}", "function slides(){\n return $slider.find($slide);\n }", "function updateIncidenceSlider(valA, valB){\n $('.incidents-slider').slider(\"values\", 0, valA)\n $(\".incidents-rate-slider.lower-handle\").text(valA)\n $('.incidents-slider').slider(\"values\", 1, valB)\n $(\".incidents-rate-slider.upper-handle\").text(valB)\n}", "_createSliderStructure() {\n this._viewLimiter = this._createViewLimiter();\n this._itemsHolder = this._createItemsHolder();\n }", "function bindRangeSlider(){\n Array.from(document.getElementsByClassName('rangeSlider')).map((v) => {\n\n // Reference the track (thumb).\n const track = v.getElementsByClassName('rangeSliderTrack')[0]\n\n // Set the initial slider value.\n const value = v.getAttribute('value')\n const sliderMeta = calculateRangeSliderMeta(v)\n\n updateRangedSlider(v, value, ((value-sliderMeta.min)/sliderMeta.step)*sliderMeta.inc)\n\n // The magic happens when we click on the track.\n track.onmousedown = (e) => {\n\n // Stop moving the track on mouse up.\n document.onmouseup = (e) => {\n document.onmousemove = null\n document.onmouseup = null\n }\n\n // Move slider according to the mouse position.\n document.onmousemove = (e) => {\n\n // Distance from the beginning of the bar in pixels.\n const diff = e.pageX - v.offsetLeft - track.offsetWidth/2\n \n // Don't move the track off the bar.\n if(diff >= 0 && diff <= v.offsetWidth-track.offsetWidth/2){\n\n // Convert the difference to a percentage.\n const perc = (diff/v.offsetWidth)*100\n // Calculate the percentage of the closest notch.\n const notch = Number(perc/sliderMeta.inc).toFixed(0)*sliderMeta.inc\n\n // If we're close to that notch, stick to it.\n if(Math.abs(perc-notch) < sliderMeta.inc/2){\n updateRangedSlider(v, sliderMeta.min+(sliderMeta.step*(notch/sliderMeta.inc)), notch)\n }\n }\n }\n }\n }) \n}", "interpolateInOrder(node) {\n\t\tconst powerViews = node ? node.getElementsByClassName('power-view') : document.getElementsByClassName('power-view');\n\t\t// Interpolate using view controller scope\n\t\tlet index = powerViews.length - 1;\n\t\twhile (index >= 0) {\n\t\t\tconst view = powerViews[index];\n\t\t\tif (this.$powerUi.controllers[view.id] && this.$powerUi.controllers[view.id].instance) {\n\t\t\t\tconst scope = this.$powerUi.controllers[view.id].instance;\n\t\t\t\tview.innerHTML = this.replaceInterpolation(view.innerHTML, scope);\n\t\t\t}\n\t\t\tindex = index - 1;\n\t\t}\n\t}", "function changeWell1Fn(scope) {\n\tscope.proteins_disable = true; /** Disables the marker proteins checkbox group */\n scope.voltage_disable = false; /** Enables the voltage slider */\n scene1_container.getChildByName(\"blue_sample_small1\").visible = true;\n}", "function SliderController(scope, element, attr, $$rAF, $timeout, $window, $materialEffects, $aria) {\n\n this.init = function init(ngModelCtrl) {\n var thumb = angular.element(element[0].querySelector('.slider-thumb'));\n var thumbContainer = thumb.parent();\n var trackContainer = angular.element(element[0].querySelector('.slider-track-container'));\n var activeTrack = angular.element(element[0].querySelector('.slider-track-fill'));\n var tickContainer = angular.element(element[0].querySelector('.slider-track-ticks'));\n\n // Default values, overridable by attrs\n attr.min ? attr.$observe('min', updateMin) : updateMin(0);\n attr.max ? attr.$observe('max', updateMax) : updateMax(100);\n attr.step ? attr.$observe('step', updateStep) : updateStep(1);\n\n // We have to manually stop the $watch on ngDisabled because it exists\n // on the parent scope, and won't be automatically destroyed when\n // the component is destroyed.\n var stopDisabledWatch = angular.noop;\n if (attr.ngDisabled) {\n stopDisabledWatch = scope.$parent.$watch(attr.ngDisabled, updateAriaDisabled);\n } else {\n updateAriaDisabled(!!attr.disabled);\n }\n\n $aria.expect(element, 'aria-label');\n element.attr('tabIndex', 0);\n element.attr('role', Constant.ARIA.ROLE.SLIDER);\n element.on('keydown', keydownListener);\n\n var hammertime = new Hammer(element[0], {\n recognizers: [\n [Hammer.Pan, { direction: Hammer.DIRECTION_HORIZONTAL }]\n ]\n });\n hammertime.on('hammer.input', onInput);\n hammertime.on('panstart', onPanStart);\n hammertime.on('pan', onPan);\n\n // On resize, recalculate the slider's dimensions and re-render\n var updateAll = $$rAF.debounce(function() {\n refreshSliderDimensions();\n ngModelRender();\n redrawTicks();\n });\n updateAll();\n angular.element($window).on('resize', updateAll);\n\n scope.$on('$destroy', function() {\n angular.element($window).off('resize', updateAll);\n hammertime.destroy();\n stopDisabledWatch();\n });\n\n ngModelCtrl.$render = ngModelRender;\n ngModelCtrl.$viewChangeListeners.push(ngModelRender);\n ngModelCtrl.$formatters.push(minMaxValidator);\n ngModelCtrl.$formatters.push(stepValidator);\n\n /**\n * Attributes\n */\n var min;\n var max;\n var step;\n function updateMin(value) {\n min = parseFloat(value);\n element.attr('aria-valuemin', value);\n }\n function updateMax(value) {\n max = parseFloat(value);\n element.attr('aria-valuemax', value);\n }\n function updateStep(value) {\n step = parseFloat(value);\n redrawTicks();\n }\n function updateAriaDisabled(isDisabled) {\n element.attr('aria-disabled', !!isDisabled);\n }\n\n // Draw the ticks with canvas.\n // The alternative to drawing ticks with canvas is to draw one element for each tick,\n // which could quickly become a performance bottleneck.\n var tickCanvas, tickCtx;\n function redrawTicks() {\n if (!angular.isDefined(attr.discrete)) return;\n\n var numSteps = Math.floor( (max - min) / step );\n if (!tickCanvas) {\n tickCanvas = angular.element('<canvas style=\"position:absolute;\">');\n tickCtx = tickCanvas[0].getContext('2d');\n tickCtx.fillStyle = 'black';\n tickContainer.append(tickCanvas);\n }\n var dimensions = getSliderDimensions();\n tickCanvas[0].width = dimensions.width;\n tickCanvas[0].height = dimensions.height;\n\n var distance;\n for (var i = 0; i <= numSteps; i++) {\n distance = Math.floor(dimensions.width * (i / numSteps));\n tickCtx.fillRect(distance - 1, 0, 2, dimensions.height);\n }\n }\n\n\n /**\n * Refreshing Dimensions\n */\n var sliderDimensions = {};\n var debouncedRefreshDimensions = Util.debounce(refreshSliderDimensions, 5000);\n refreshSliderDimensions();\n function refreshSliderDimensions() {\n sliderDimensions = trackContainer[0].getBoundingClientRect();\n }\n function getSliderDimensions() {\n debouncedRefreshDimensions();\n return sliderDimensions;\n }\n\n /**\n * left/right arrow listener\n */\n function keydownListener(ev) {\n var changeAmount;\n if (ev.which === Constant.KEY_CODE.LEFT_ARROW) {\n changeAmount = -step;\n } else if (ev.which === Constant.KEY_CODE.RIGHT_ARROW) {\n changeAmount = step;\n }\n if (changeAmount) {\n if (ev.metaKey || ev.ctrlKey || ev.altKey) {\n changeAmount *= 4;\n }\n ev.preventDefault();\n ev.stopPropagation();\n scope.$evalAsync(function() {\n setModelValue(ngModelCtrl.$viewValue + changeAmount);\n });\n }\n }\n\n /**\n * ngModel setters and validators\n */\n function setModelValue(value) {\n ngModelCtrl.$setViewValue( minMaxValidator(stepValidator(value)) );\n }\n function ngModelRender() {\n var percent = (ngModelCtrl.$viewValue - min) / (max - min);\n scope.modelValue = ngModelCtrl.$viewValue;\n element.attr('aria-valuenow', ngModelCtrl.$viewValue);\n setSliderPercent(percent);\n }\n\n function minMaxValidator(value) {\n if (angular.isNumber(value)) {\n return Math.max(min, Math.min(max, value));\n }\n }\n function stepValidator(value) {\n if (angular.isNumber(value)) {\n return Math.round(value / step) * step;\n }\n }\n\n /**\n * @param percent 0-1\n */\n function setSliderPercent(percent) {\n activeTrack.css('width', (percent * 100) + '%');\n thumbContainer.css(\n $materialEffects.TRANSFORM,\n 'translate3d(' + getSliderDimensions().width * percent + 'px,0,0)'\n );\n element.toggleClass('slider-min', percent === 0);\n }\n\n\n /**\n * Slide listeners\n */\n var isSliding = false;\n function onInput(ev) {\n if (!isSliding && ev.eventType === Hammer.INPUT_START &&\n !element[0].hasAttribute('disabled')) {\n\n isSliding = true;\n element.addClass('active');\n element[0].focus();\n refreshSliderDimensions();\n doSlide(ev.center.x);\n\n } else if (isSliding && ev.eventType === Hammer.INPUT_END) {\n isSliding = false;\n element.removeClass('panning active');\n }\n }\n function onPanStart() {\n if (!isSliding) return;\n element.addClass('panning');\n }\n function onPan(ev) {\n if (!isSliding) return;\n doSlide(ev.center.x);\n ev.preventDefault();\n }\n\n /**\n * Expose for testing\n */\n this._onInput = onInput;\n this._onPanStart = onPanStart;\n this._onPan = onPan;\n\n function doSlide(x) {\n var percent = (x - sliderDimensions.left) / (sliderDimensions.width);\n scope.$evalAsync(function() { setModelValue(min + percent * (max - min)); });\n }\n\n };\n}", "function setUpRangeSlider(variable,min,max,defaultValue,step,sliderID,mode){\n eval(`window.${variable} = ${defaultValue};`);\n $('#'+sliderID + '-update').html(defaultValue);\n $(\"#\"+sliderID).slider({\n min: min,\n max:max,\n step: step,\n value: defaultValue,\n slide: function(e,ui){\n eval(`window.${variable} = ${ui.value};`);\n $('#'+sliderID + '-update').empty();\n $('#'+sliderID + '-update').html(ui.value);\n }\n })\n}", "function updateAll(){refreshSliderDimensions();ngModelRender();}", "function SliderControls(slider){\r\n this.initialize(slider);\r\n}", "function setControls(){\n \n $( \".pointer\" ).click(function() {\n var point = $(this).attr('data-sl');\n count = point;\n initSlider(slides);\n console.log(\"clicked point:\"+point);\n });\n\n }", "function gatherElements(){elements={main:$element[0],scrollContainer:$element[0].querySelector('.md-virtual-repeat-container'),scroller:$element[0].querySelector('.md-virtual-repeat-scroller'),ul:$element.find('ul')[0],input:$element.find('input')[0],wrap:$element.find('md-autocomplete-wrap')[0],root:document.body};elements.li=elements.ul.getElementsByTagName('li');elements.snap=getSnapTarget();elements.$=getAngularElements(elements);inputModelCtrl=elements.$.input.controller('ngModel');}", "function changeWell4Fn(scope) {\n\tscope.proteins_disable = true; /** Disables the marker proteins checkbox group */\n scope.voltage_disable = false; /** Enables the voltage slider */\n scene1_container.getChildByName(\"blue_sample_small4\").visible = true;\n}", "function changeWell2Fn(scope) {\n\tscope.proteins_disable = true; /** Disables the marker proteins checkbox group */\n scope.voltage_disable = false; /** Enables the voltage slider */\n scene1_container.getChildByName(\"blue_sample_small2\").visible = true;\n}", "function setBindings() {\n if(AngularSlider.inputtypes.range) {\n // we're using range inputs\n\n /**\n * Bind the events necessary for a range input\n * @param {object} elem\n * @param {object} ptr\n * @param {string} rf\n */\n function bindSlider(elem, ptr, rf) {\n\n // make sure the element has all the methods and properties we'll need\n elem = angularize(elem);\n\n /**\n * Start event\n * @param {event} ev\n */\n function start(ev) {\n onStart(ev, ptr, rf);\n }\n\n /**\n * End event\n * @param {event} ev\n */\n function end(ev) {\n onMove(ev);\n onEnd();\n }\n\n // bind events to the range input\n\t\t\t\t\t\t\t\t\t\t\t$swipe.bind(elem, {\n\t\t\t\t\t\t\t\t\t\t\t\tstart : start,\n\t\t\t\t\t\t\t\t\t\t\t\tmove : onMove,\n\t\t\t\t\t\t\t\t\t\t\t\tend : end,\n\t\t\t\t\t\t\t\t\t\t\t\tcancel: onEnd\n\t\t\t\t\t\t\t\t\t\t\t});\n }\n\n // bind the events to the low value range input\n bindSlider(refs.minInput, refs.minPtr, refLow);\n\n if(isDualKnob) {\n // bind the events to the high value range input\n bindSlider(refs.maxInput, refs.maxPtr, refHigh);\n // bind the events to the selection bar range input\n bindSlider(refs.selInput, refs.selBar, refSel);\n }\n } else {\n // we're using normal DOM elements\n\n /**\n * Start event\n * @param {object} elem\n * @param {string} rf\n * @param {object} [ptr]\n */\n function bindSwipeStart(elem, rf, ptr) {\n\n // make sure the element has all the methods and properties we'll need\n elem = angularize(elem);\n\n // if no pointer reference is supplied, reference the element given\n if(angular.isUndefined(ptr)) {\n ptr = elem;\n } else {\n ptr = angularize(ptr);\n }\n\n // bind the swipe start event to the element\n $swipe.bind(elem, {\n start: function(ev) {\n onStart(ev, ptr, rf);\n }\n });\n }\n\n /**\n * Move event\n * @param {object} elem\n */\n function bindSwipe(elem) {\n\n // make sure the element has all the methods and properties we'll need\n elem = angularize(elem);\n\n // bind the swipe move, end, and cancel events\n $swipe.bind(elem, {\n move : onMove,\n end : function(ev) {\n onMove(ev);\n onEnd();\n },\n cancel: onEnd\n });\n }\n\n // bind the common events to the various common elements\n bindSwipe($document);\n bindSwipeStart(refs.minPtr, refLow);\n bindSwipeStart(refs.lowBub, refLow);\n bindSwipeStart(refs.flrBub, refLow, refs.minPtr);\n if(isDualKnob) {\n // bind the dual knob specific events to the dual knob specific elements\n bindSwipeStart(refs.maxPtr, refHigh);\n bindSwipeStart(refs.highBub, refHigh);\n bindSwipeStart(refs.ceilBub, refHigh, refs.maxPtr);\n bindSwipeStart(refs.selBar, refSel);\n bindSwipeStart(refs.selBub, refSel, refs.selBar);\n bindSwipeStart(refs.unSelBarLow, refLow, refs.minPtr);\n bindSwipeStart(refs.unSelBarHigh, refHigh, refs.maxPtr);\n } else {\n // bind the single knob specific events to the single knob specific elements\n bindSwipeStart(refs.ceilBub, refLow, refs.minPtr);\n bindSwipeStart(refs.fullBar, refLow, refs.minPtr);\n }\n }\n }", "function slidersValue() {\n document.querySelector(\"#redValue\").innerHTML =\n document.querySelector(\"#rangeRed\").value;\n document.querySelector(\"#greenValue\").innerHTML =\n document.querySelector(\"#rangeGreen\").value;\n document.querySelector(\"#blueValue\").innerHTML =\n document.querySelector(\"#rangeBlue\").value;\n}", "function setFilterScope(scope) {\n $('[data-scope].current').removeClass('current');\n $('[data-scope=\"' + scope + '\"]').addClass('current');\n renderTOC();\n }", "function watchAttributes(){attr.$observe('value',function(value){var percentValue=clamp(value);element.attr('aria-valuenow',percentValue);if(mode()!=MODE_QUERY)animateIndicator(bar2,percentValue);});attr.$observe('mdBufferValue',function(value){animateIndicator(bar1,clamp(value));});attr.$observe('disabled',function(value){if(value===true||value===false){isDisabled=!!value;}else{isDisabled=angular.isDefined(value);}element.toggleClass(DISABLED_CLASS,isDisabled);container.toggleClass(lastMode,!isDisabled);});attr.$observe('mdMode',function(mode){if(lastMode)container.removeClass(lastMode);switch(mode){case MODE_QUERY:case MODE_BUFFER:case MODE_DETERMINATE:case MODE_INDETERMINATE:container.addClass(lastMode=\"md-mode-\"+mode);break;default:container.addClass(lastMode=\"md-mode-\"+MODE_INDETERMINATE);break;}});}", "function myLocalShirts() {\n\tvar shirts = \"Blouse\";\n\tdocument.querySelector(\".scope-local\").innerHTML = shirts;\n}", "function setSummaryPercentSliders(targetContainer, percentSliders) {\n var percentSlidersDisplay = $(\".\" + percentSliders).clone();\n percentSlidersDisplay.css(\"z-index\", \"0\");\n $(\"#\" + targetContainer).append(percentSlidersDisplay);\n $(\".\" + percentSliders.replace(\"Display\", \"\")).each(function () {\n var slider = $(\"#\" + this.id).clone();\n $(\"#\" + targetContainer).append(slider);\n slider.addClass(\"disabled\");\n\n // Hide slider assumptions button\n // var assumptionsButton = $(\"#\"+this.id+\" .assumptionsButton\");\n // assumptionsButton.css(\"display\", \"none\");\n });\n}", "_createSliders() {\n\t\tthis.sliders = {};\n\t\tfor ( let slider of this.controlOptions.control.sliders ) {\n\t\t\tlet sliderControl;\n\n\t\t\tslider.uiSettings = this.getSliderConfig( slider );\n\n\t\t\tsliderControl = new Slider( $.extend( true, {}, slider ) );\n\n\t\t\tsliderControl.render();\n\n\t\t\tthis.$sliderGroup.append( sliderControl.$control );\n\t\t\tsliderControl.$input.after(\n\t\t\t\t'<a class=\"link\" href=\"#\" title=\"Link all sliders\">' + linkSvg + '</a>'\n\t\t\t);\n\n\t\t\tthis.sliders[slider.name] = sliderControl;\n\n\t\t\tthis._bindSliderChange( sliderControl );\n\t\t}\n\t}", "function setupSlider() {\n rSlider = createSlider(0, 255, 0);\n rSlider.position(width - 340, 50);\n rSlider.style(\"width\", \"255px\");\n\n gSlider = createSlider(0, 255, 0);\n gSlider.position(width - 340, 50 + 30);\n gSlider.style(\"width\", \"255px\");\n\n bSlider = createSlider(0, 255, 0);\n bSlider.position(width - 340, 50 + 60);\n bSlider.style(\"width\", \"255px\");\n\n sizeSlider = createSlider(1, 80, 4);\n sizeSlider.position(width - 340, 500);\n sizeSlider.style(\"width\", \"255px\");\n}", "function init() {\n initVisualization();\n \n addSimulationControls(play, pause, step, stop_movement);\n \n addParamControls(\"#sliders\", params, update_params); \n}", "function init() {\n setMortalitySlider()\n setIncidentsSlider()\n setDeathPercentageSlider()\n setYearSlider()\n}", "function createSliders() {\n rMin = createSlider(.1, 10, 1, 1);\n rMin.position(20, height + 40);\n createP('Radius Min').position(20, height);\n\n rMax = createSlider(1, 20, 6, 1);\n rMax.position(20, height + 100);\n createP('Radius Max').position(20, height+60);\n\n checkInMin = createSlider(10, 10000, 100, 1);\n checkInMin.position(20, height + 160);\n createP('Check In Min').position(20, height+120);\n\n checkInMax = createSlider(100, 500000, 100000, 1);\n checkInMax.position(180, height + 40);\n createP('Check In Max').position(180, height);\n\n}", "Init() {\n\t\tthis.leftTrack = this.node.querySelectorAll('.spectrum-Slider-track')[0]\n\t\tthis.rightTrack= this.node.querySelectorAll('.spectrum-Slider-track')[1]\n\t\tthis.handle = this.node.querySelector('.spectrum-Slider-handle')\n\t\tthis.valueOut = this.node.querySelector('.spectrum-Slider-value')\n\t\tthis.loaderNode = this.node.querySelector('.component-loader')\n\t\t\n\t\t\n\t\tlet position = this.ValueToPosition(this.settings.current)\n\t\tthis.valueOut.innerText = this.settings.current.toFixed(this.settings.floatPrecision)\n\t\tthis.MoveSlider(position)\n\t}", "find_slides()\n\t{\n\t\treturn this.slide_sel ?\n\t\t\tthis.slider.querySelectorAll(this.slide_sel) : \n\t\t\tthis.slider.children;\n\t}", "function displaySliders() {\n\n\n\n sliders = document.getElementsByClassName('sliders')[0];\n advanced_button = document.getElementsByClassName('advanced')[0];\n reset = document.getElementsByClassName('reset_default')[0];\n save_effect = document.getElementsByClassName('save_effect')[0];\n\n sliders.classList.toggle('show_sliders');\n advanced_button.classList.toggle('show_advanced');\n reset.classList.toggle('show_save');\n save_effect.classList.toggle('show_save');\n\n\n}", "function update_slider() {\n\t$(\"#visitsGraph_slider\").slider(\"values\", 0, 0);\n\t$(\"#visitsGraph_slider\").slider(\"option\", \"max\", clicksGraph_cols.length - 1);\n\t$(\"#visitsGraph_slider\").slider(\"values\", 1, clicksGraph_cols.length - 1);\n\t$(\"#visitsGraph_slider_text\").text(\"Graph range: \" + clicksGraph_cols[$(\"#visitsGraph_slider\").slider(\"values\", 0)].label + \" - \" + clicksGraph_cols[$(\"#visitsGraph_slider\").slider(\"values\", 1)].label);\n}", "function updateSliders() {\n select('#length').html(lengthSlider.value());\n select('#temperature').html(tempSlider.value());\n}", "function updateSliders() {\n lengthLabel.html(\"Length: \" + lengthSlider.value());\n tempLabel.html(\"Temperature: \" + tempSlider.value());\n}", "function updateSliders() {\n select('#length').html(lengthSlider.value());\n select('#temperature').html(tempSlider.value());\n}", "_createTrackListeners() {\n var _this = this,\n interactionRects = Px.d3.selectAll(Polymer.dom(this.$$('#sliderSVG')).querySelectorAll('.sliderTrack'));\n\n interactionRects.on('click', function() {\n // need access to callback this, so pass it in\n _this._trackOnClick(this);\n });\n }", "function initSliders() {\r\n\t$(\".slider\").slider({ value: 50 });\r\n\t$(\".slider\").slider('disable');\r\n}", "function slidersInit() {\n /** Tape slider */\n var $tapeSlider = $('.tape-slider-js');\n if ($tapeSlider.length) {\n $tapeSlider.each(function () {\n var $thisSlider = $(this),\n $thisPag = $('.swiper-pagination', $thisSlider),\n promoSliderJs;\n\n promoSliderJs = new Swiper($thisSlider, {\n init: false,\n\n // Optional parameters\n loop: true,\n spaceBetween: 22,\n slidesPerView: 3,\n watchSlidesVisibility: true,\n autoplay: {\n delay: 3000,\n disableOnInteraction: true\n },\n pagination: {\n el: $thisPag,\n type: 'bullets',\n clickable: true\n },\n breakpoints: {\n 1199: {\n slidesPerView: 2\n },\n 991: {\n slidesPerView: 'auto',\n centeredSlides: true\n }\n }\n });\n\n promoSliderJs.on('init', function() {\n $(promoSliderJs.el).closest($thisSlider).addClass('is-loaded');\n });\n\n promoSliderJs.init();\n });\n }\n\n /** Reviews slider */\n var $opinionsSlider = $('.opinions-slider-js');\n if ($opinionsSlider.length) {\n $opinionsSlider.each(function () {\n var $thisSlider = $(this),\n $thisPag = $('.swiper-pagination', $thisSlider),\n promoSliderJs;\n\n promoSliderJs = new Swiper($thisSlider, {\n init: false,\n loop: true,\n speed: 500,\n autoplay: {\n delay: 5000,\n disableOnInteraction: true\n },\n parallax: true,\n pagination: {\n el: $thisPag,\n type: 'bullets',\n clickable: true\n },\n breakpoints: {\n 991: {\n parallax: false,\n spaceBetween: 30\n }\n }\n });\n\n promoSliderJs.on('init', function() {\n $(promoSliderJs.el).closest($thisSlider).addClass('is-loaded');\n });\n\n promoSliderJs.init();\n });\n }\n\n /** Manual steps slider */\n var $manualStepsSlider = $('.manual-steps-slider-js');\n if ($manualStepsSlider.length) {\n $manualStepsSlider.each(function () {\n var $thisSlider = $(this),\n $thisPag = $('.swiper-pagination', $thisSlider);\n\n new Swiper($thisSlider, {\n simulateTouch: false,\n pagination: {\n el: $thisPag,\n type: 'bullets',\n clickable: true\n },\n breakpoints: {\n 991: {\n followFinger: true,\n simulateTouch: true\n }\n }\n });\n });\n }\n\n /**Yield slider*/\n var $yieldGroup = $('.yield-group-js');\n if($yieldGroup.length){\n $yieldGroup.each(function () {\n var $curSlider = $(this),\n $cards = $curSlider.find('.yield-cards-slider-js'),\n $thumbs = $curSlider.find('.yield-thumbs-slider-js'),\n $cardsPagination = $curSlider.find('.swiper-pagination'),\n cardsSlider, thumbsSlider;\n\n thumbsSlider = new Swiper ($thumbs, {\n loop: true,\n centeredSlides: true,\n direction: 'vertical',\n slidesPerView: 'auto',\n spaceBetween: 22,\n slideToClickedSlide: true,\n loopedSlides: 5,\n watchSlidesVisibility: true,\n watchSlidesProgress: true,\n allowTouchMove: false\n });\n\n cardsSlider = new Swiper ($cards, {\n init: false,\n effect: 'coverflow',\n coverflowEffect: {\n rotate: -5,\n stretch: 0,\n depth: 150,\n modifier: 1,\n slideShadows : false,\n },\n centeredSlides: true,\n slideToClickedSlide: true,\n loop: true,\n loopedSlides: 5,\n spaceBetween: 20,\n allowTouchMove: false,\n preloadImages: false,\n parallax: true,\n pagination: {\n el: $cardsPagination,\n type: 'bullets',\n clickable: true\n },\n breakpoints: {\n 991: {\n slidesPerView: 'auto',\n allowTouchMove: true\n }\n }\n });\n\n cardsSlider.on('init', function() {\n $curSlider.addClass('is-loaded');\n });\n\n cardsSlider.init();\n\n thumbsSlider.on('slideChange', function () {\n var activeIndex = thumbsSlider.activeIndex;\n cardsSlider.slideTo(activeIndex);\n });\n\n cardsSlider.on('slideChange', function () {\n var activeIndex = cardsSlider.activeIndex;\n thumbsSlider.slideTo(activeIndex);\n });\n });\n }\n\n /**App visual slider*/\n var $appVisualSlider = $('.app-visual__slider-js');\n if($appVisualSlider.length){\n $appVisualSlider.each(function () {\n var $curSlider = $(this),\n curSliderJs;\n\n curSliderJs = new Swiper ($curSlider, {\n init: false,\n effect: 'coverflow',\n coverflowEffect: {\n rotate: 0,\n stretch: 0,\n depth: 0,\n modifier: 0,\n slideShadows : false,\n },\n slidesPerView: 'auto',\n centeredSlides: true,\n slideToClickedSlide: true,\n loop: true,\n loopedSlides: 20,\n spaceBetween: 20,\n parallax: true,\n breakpoints: {\n 767: {\n coverflowEffect: {\n stretch: -35,\n depth: 150,\n modifier: 1\n },\n }\n }\n });\n\n curSliderJs.on('init', function() {\n $curSlider.addClass('is-loaded');\n });\n\n curSliderJs.init();\n });\n }\n}", "static get scopes() {\n\t\treturn Array.from(document.querySelectorAll('.ng-scope, .ng-isolate-scope')).reduce((scopes, elm) => {\n\t\t\tconst scope = Util.getScope(elm);\n\t\t\tlet name = _.camelCase(elm.tagName);\n\t\t\t// Account for multiple components\n\t\t\tif (name in scopes) {\n\t\t\t\tname += `-${scope.$id}`;\n\t\t\t}\n\t\t\tscopes[name] = scope;\n\t\t\treturn scopes;\n\t\t}, {});\n\t}", "'find_selection_scope'() {\n\t\t//console.log('find_selection_scope');\n\n\t\tvar res = this.selection_scope;\n\t\tif (res) return res;\n\n\t\t// look at the ancestor...\n\n\t\t//var parent = this.get('parent');\n\t\t//console.log('parent ' + tof(parent));\n\n\n\t\tif (this.parent) return this.parent.find_selection_scope();\n\n\t}", "getElements(){\n const thisWidget = this; \n \n thisWidget.dom.input = thisWidget.dom.wrapper.querySelector(select.widgets.amount.input);\n thisWidget.dom.linkDecrease = thisWidget.dom.wrapper.querySelector(select.widgets.amount.linkDecrease);\n thisWidget.dom.linkIncrease = thisWidget.dom.wrapper.querySelector(select.widgets.amount.linkIncrease);\n }", "function reloadSlider(slider){\n slider.reloadSlider();\n}", "function look_ruby_block_hw_slider() {\r\n var block_hw_slider = $('.ruby-slider-hw');\r\n if (block_hw_slider.length > 0) {\r\n block_hw_slider.each(function() {\r\n\r\n var block_hw_slider_el = $(this);\r\n var block_hw_slider_nav_el = $(this).next('.ruby-slider-hw-nav');\r\n\r\n block_hw_slider_el.on('init', function() {\r\n block_hw_slider_el.imagesLoaded(function() {\r\n block_hw_slider_el.prev('.slider-loading').fadeOut(200, function() {\r\n $(this).remove();\r\n block_hw_slider_el.removeClass('slider-init');\r\n });\r\n });\r\n });\r\n\r\n block_hw_slider_nav_el.on('init', function() {\r\n block_hw_slider_nav_el.imagesLoaded(function() {\r\n block_hw_slider_nav_el.removeClass('slider-init');\r\n });\r\n });\r\n\r\n\r\n block_hw_slider_el.slick({\r\n dots: true,\r\n infinite: true,\r\n autoplay: look_ruby.auto_play,\r\n autoplaySpeed: look_ruby.auto_play_speed,\r\n speed: look_ruby.play_speed,\r\n adaptiveHeight: false,\r\n arrows: true,\r\n asNavFor: block_hw_slider_nav_el,\r\n prevArrow: look_ruby.prev_arrow,\r\n nextArrow: look_ruby.next_arrow\r\n });\r\n\r\n block_hw_slider_nav_el.slick({\r\n slidesToShow: 4,\r\n slidesToScroll: 1,\r\n arrows: false,\r\n dots: false,\r\n asNavFor: block_hw_slider_el,\r\n centerMode: false,\r\n focusOnSelect: true\r\n });\r\n });\r\n }\r\n }", "function wishlist_slider(){\n jQuery('#wishlist-slider .es-carousel').iosSlider({\n\tresponsiveSlideWidth: true,\n\tsnapToChildren: true,\n\tdesktopClickDrag: true,\n\tinfiniteSlider: false,\n\tnavNextSelector: '#wishlist-slider .next',\n\tnavPrevSelector: '#wishlist-slider .prev'\n });\n}", "function checkSlider(el){\n if( $(el).attr('id') == 'next-resource' ||\n $(el).attr('id') == 'prev-resource' ||\n $(el).parent().hasClass('pages-resource-nav')\n ){\n return $('#scrollLine');\n }\n return $('#scrollLine2');\n }", "function dimensions() {\n\n // make sure the watchables are all valid\n angular.forEach(watchables, function(watchable) {\n \n // parse them to floats\n scope[watchable] = parseFloat(scope[watchable]);\n\n if(watchable == refLow || watchable == refHigh) {\n // this is the low or high value so bring them back in line with the steps\n scope[watchable] = roundToStep(scope[watchable], scope.precision, scope[stepWidth], scope.floor, scope.ceiling);\n } else if(watchable == 'buffer') {\n if(!scope.buffer || isNaN(scope.buffer) || scope.buffer < 0) {\n // the buffer is not valid, so set to 0\n scope.buffer = 0;\n } else {\n // this is the buffer so make sure it aligns with the steps\n scope.buffer = stepBuffer(scope[stepWidth], scope.buffer);\n }\n } else if(watchable == 'precision') {\n // make sure the precision is valid\n if(!scope.precision || isNaN(scope.precision)) {\n scope.precision = 0;\n } else {\n scope.precision = parseInt(scope.precision);\n }\n } else if(watchable == stepWidth) {\n // make sure the step is valid\n if(!scope[stepWidth] || isNaN(scope[stepWidth])) {\n scope[stepWidth] = 1 / Math.pow(10, scope.precision);\n } else {\n scope[stepWidth] = parseFloat(scope[stepWidth].toFixed(scope.precision));\n }\n } else if(watchable == 'stickiness') {\n // make sure the stickiness is valid\n if(isNaN(scope.stickiness)) {\n scope.stickiness = KNOB_STICKINESS;\n } else if(scope.stickiness < 1) {\n scope.stickiness = 1;\n }\n }\n \n // save the decoded values\n scope.decodedValues[watchable] = scope.decodeRef(watchable);\n\n });\n\n if(isDualKnob) {\n // if this is a dual knob slider\n\n // make sure the low value is actually lower than the high value\n if(scope[refHigh] < scope[refLow]) {\n var temp = scope[refHigh];\n scope[refHigh] = scope[refLow];\n scope[refLow] = temp;\n }\n\n // get the difference between the knobs, but make sure it's rounded to a step\n var diff = roundToStep(scope[refHigh] - scope[refLow], scope.precision, scope[stepWidth]);\n\n if(scope.buffer > 0 && diff < scope.buffer) {\n // we need a buffer but the difference is smaller than the required buffer\n\n // so find the middle\n var avg = scope.encode((scope.decodedValues[refLow] + scope.decodedValues[refHigh]) / 2);\n\n // and set the knobs so they straddle the middle with the required amount of buffer\n scope[refLow] = roundToStep(avg - (scope.buffer / 2), scope.precision, scope[stepWidth], scope.floor, scope.ceiling);\n scope[refHigh] = scope[refLow] + scope.buffer;\n\n if(scope[refHigh] > scope.ceiling) {\n // the high value is out of range\n\n // so set the high value to the maximum\n scope[refHigh] = scope.ceiling;\n // but keep the buffer correct\n scope[refLow] = scope.ceiling - scope.buffer;\n }\n }\n }\n\n // save the various dimensions we'll need\n barWidth = width(refs.fullBar);\n pointerHalfWidth = halfWidth(refs.minPtr);\n\n minOffset = offsetLeft(refs.fullBar);\n maxOffset = minOffset + barWidth - width(refs.minPtr);\n offsetRange = maxOffset - minOffset;\n\n minValue = scope.floor;\n minValueDecoded = scope.decodedValues.floor;\n maxValue = scope.ceiling;\n maxValueDecoded = scope.decodedValues.ceiling;\n valueRange = maxValue - minValue;\n valueRangeDecoded = maxValueDecoded - minValueDecoded;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tstepRange = roundTo(valueRangeDecoded, scope.decodedValues[stepWidth]);\n }", "function drawSliders() {\n\n noUiSlider.create(nodeSlider, {\n start: [ 8 ],\n connect: 'lower',\n tooltips: [ true ],\n range: {\n 'min': [ 0 ],\n 'max': [ 16 ]\n }\n });\n\n noUiSlider.create(edgeSlider, {\n start: [ 1 ],\n connect: 'lower',\n tooltips: [ true ],\n range: {\n 'min': [ 0 ],\n 'max': [ 4 ]\n }\n });\n\n noUiSlider.create(tensionSlider, {\n start: [ 0.7 ],\n connect: 'lower',\n tooltips: [ true ],\n range: {\n 'min': [ 0 ],\n 'max': [ 1 ]\n }\n });\n\n noUiSlider.create(weightSlider, { \n start: [ 0, MAXWEIGHT ],\n connect: true,\n tooltips: [ true, true ],\n range: {\n 'min': [ 0 ],\n '20%': [ MAXWEIGHT*0.0016 ],\n '40%': [ MAXWEIGHT*0.008 ],\n '60%': [ MAXWEIGHT*0.04 ],\n '80%': [ MAXWEIGHT*0.2 ],\n 'max': [ MAXWEIGHT ]\n }\n });\n\n noUiSlider.create(inSlider, {\n start: [ MAXIN ],\n connect: 'lower',\n tooltips: [ toInt ],\n step: 1,\n range: {\n 'min': [ 0 ],\n '20%': [ MAXIN*0.0016 ],\n '40%': [ MAXIN*0.008 ],\n '60%': [ MAXIN*0.04 ],\n '80%': [ MAXIN*0.2 ],\n 'max': [ MAXIN ]\n }\n });\n\n noUiSlider.create(outSlider, {\n start: [ MAXOUT ],\n connect: 'lower',\n tooltips: [ toInt ],\n step: 1,\n range: {\n 'min': [ 0 ],\n '20%': [ MAXOUT*0.0016 ],\n '40%': [ MAXOUT*0.008 ],\n '60%': [ MAXOUT*0.04 ],\n '80%': [ MAXOUT*0.2 ],\n 'max': [ MAXOUT ]\n }\n });\n\n isDrawn = true;\n updateSliders();\n}", "getclassname() {\n return \"Slider\";\n }", "on() {\n activeEffectScope = this;\n }", "function updateSliders() {\n select('#length').html(lengthSlider.value())\n select('#temperature').html(tempSlider.value())\n }", "function onSliderChange() {\n sw = slider.value;\n}", "function sliders() {\n\tif ($('.js-slider-list').length) {\n\t\tvar slideShowCfg = {\n\t\t\tdots: false,\n\t\t\tinfinite: true,\n\t\t\tspeed: 1300,\n\t\t\tappendArrows: $('.js-slider-arrows'),\n\t\t\tslidesToShow: 1,\n\t\t\tprevArrow: '<span class=\"sl_arw slick-arrow__prev\"><i class=\"fa fa-angle-left\" aria-hidden=\"true\"></i></span>',\n\t\t\tnextArrow: '<span class=\"sl_arw slick-arrow__next\"><i class=\"fa fa-angle-right\" aria-hidden=\"true\"></i></span>'\n\t\t}\n\t\t$('.js-slider-list').on('init reInit afterChange', function (event, slick, currentSlide, nextSlide) {\n\t\t\t//currentSlide is undefined on init -- set it to 0 in this case (currentSlide is 0 based)\n\t\t\tvar i = (currentSlide ? currentSlide : 0) + 1;\n\t\t\t$('.js-slider-info .slider__counter-all').text(slick.slideCount);\n\t\t\t$('.js-slider-info .slider__counter-current').text(i);\n\t\t});\n\t\t$('.js-slider-list').slick(slideShowCfg);\n\t}\n}", "function init() {\n\n parents = document.getElementsByClassName('slideshow-container');\n\n for (j = 0; j < parents.length; j++) {\n var slides = parents[j].getElementsByClassName(\"mySlides\");\n var dots = parents[j].getElementsByClassName(\"dot\");\n slides[0].classList.add('active-slide');\n dots[0].classList.add('active');\n }\n}", "reGenerateSlider(){ //mostly the same as the constructor\n let bar = document.getElementById(this.barId)\n let progress = document.getElementById(this.progressId)\n let rect = progress.getBoundingClientRect()\n let barRect = bar.getBoundingClientRect()\n\n let slider = document.getElementById(this.sliderId)\n this.sliderX = rect.right-this.sliderRadius\n slider.style.left = this.sliderX+'px'\n this.sliderY = (rect.top+rect.bottom)/2 - this.sliderRadius\n slider.style.top = this.sliderY+'px'\n\n this.maxSliderX = barRect.right - this.sliderRadius\n this.minSliderX = barRect.left - this.sliderRadius\n }", "function changeWell3Fn(scope) {\n\tscope.proteins_disable = true; /** Disables the marker proteins checkbox group */\n scope.voltage_disable = false; /** Enables the voltage slider */\n scene1_container.getChildByName(\"blue_sample_small3\").visible = true;\n}", "customRange() {\n\t\t$(\".range-wrap\").each(function () {\n\t\t\tlet _this = $(this);\n\t\t\tvar $d3 = _this.find(\".slider-js\");\n\n\t\t\tvar slider = $d3.ionRangeSlider({\n\t\t\t\tskin: \"round\",\n\t\t\t\ttype: \"double\",\n\t\t\t\tgrid: false,\n\t\t\t\tgrid_snap: false,\n\t\t\t\thide_min_max: true,\n\t\t\t\thide_from_to: true,\n\t\t\t\tonStart: function (data) {\n\t\t\t\t\t_this.find('.minus').val(data.from);\n\t\t\t\t\t_this.find('.plus').val(data.to);\n\t\t\t\t},\n\t\t\t\tonChange: function (data) {\n\t\t\t\t\t_this.find('.minus').val(data.from);\n\t\t\t\t\t_this.find('.plus').val(data.to);\n\t\t\t\t},\n\t\t\t\tonFinish: function (data) {\n\t\t\t\t\t_this.find('.minus').val(data.from);\n\t\t\t\t\t_this.find('.plus').val(data.to);\n\t\t\t\t},\n\t\t\t\tonUpdate: function (data) {\n\t\t\t\t\t_this.find('.minus').val(data.from);\n\t\t\t\t\t_this.find('.plus').val(data.to);\n\t\t\t\t}\n\t\t\t});\n\t\t\tvar $d3_instance = slider.data(\"ionRangeSlider\");\n\t\t\t$(this).on('change input cut copy paste', '.minus', function () {\n\t\t\t\tvar th = $(this);\n\t\t\t\tvar data = th.val();\n\t\t\t\tvar min = +data;\n\t\t\t\t// th.val(data + ' т')\n\t\t\t\tconsole.log(1);\n\t\t\t\t$d3_instance.update({\n\t\t\t\t\tfrom: min,\n\t\t\t\t})\n\t\t\t});\n\n\t\t\t$(this).on('change input cut copy paste', '.plus', function () {\n\t\t\t\tvar th = $(this);\n\t\t\t\tvar data = th.val();\n\t\t\t\tvar max = +data;\n\n\t\t\t\t//max => new val of max inp\n\t\t\t\t//min => value of the min inp\n\n\t\t\t\tlet min = Number(document.querySelector('.range-result.range-result--minus.minus').value);\n\t\t\t\tif (min >= max) {\n\t\t\t\t\tmin = 0;\n\t\t\t\t\t$d3_instance.update({\n\t\t\t\t\t\tfrom: min,\n\t\t\t\t\t\tto: max,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$d3_instance.update({\n\t\t\t\t\t\tto: max,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t\t// $d3.on(\"change\", function () {\n\t\t\t// \tvar $inp = $(this);\n\t\t\t// \tvar from = $inp.prop(\"value\"); // reading input value\n\t\t\t// \tvar from2 = $inp.data(\"from\"); // reading input data-from attribute\n\n\t\t\t// \t_this.find('range-result--minus').val(from); // FROM value\n\t\t\t// \t_this.find('range-result--plus').val(from); // FROM value\n\t\t\t// });\n\n\n\t\t})\n\t}", "function addNewServing(){\n var y = document.getElementsByClassName(\"default\");\n var x = y.length;\n x++;\n $(\"#servings\").append(\"<div class = \\\"slider\\\"><input type=\\\"range\\\" min=\\\"0.5\\\" max=\\\"1.5\\\" value=\\\"1\\\" id=\\\"myRange\" + x + \"\\\" step = \\\"0.1\\\" oninput=\\\"showVal(this.value,\" + x + \")\\\"><p>Serving \" + x + \": <span class = \\\"default\\\" id=\\\"demo\" + x + \"\\\"></span></p></div>\");\n servingFact += 1;\n showVal(1, x);\n}", "function addSliders(){\r\n\tvar sliderString = '';\r\n\tvar amountString = '';\r\n\tvar counter = 0;\r\n\r\n\tfor (i=0;i<inputs.length;i++)\r\n\t{\r\n\t\tsliderString = '#slider'+counter;\r\n\t\tamountString = \"#amount\"+counter;\r\n\t\tvar inputType = $(inputmetadata[i]).attr(\"vartype\");\r\n\r\n\t\tif (inputType==\"RANGE\" || inputType==\"FUZZY_DISCRETE\"){\r\n\t\t\tvar l_min = getInputMin(i);\r\n\t\t\tvar l_max = getInputMax(i);\r\n\t\t\tvar l_def = getInputDefault(i);\r\n\r\n\t\t\tif (l_def < l_min || isNaN(l_def)) {\r\n\t\t\t\tl_def = l_min;\r\n\t\t\t} else if (l_def > l_max) {\r\n\t\t\t\tl_def = l_max;\r\n\t\t\t}\r\n\r\n\t\t\t$(sliderString).slider({\r\n\t\t\t\trange: \"min\",\r\n\t\t\t\tvalue:((l_def-l_min)/(l_max-l_min))*1000,\r\n\t\t\t\tmin:0,\r\n\t\t\t\tmax:1000,\r\n\t\t\t\tslide: labelUpdate(i,l_min,l_max)\r\n\t\t\t});\r\n\t\t\tvar currDataType = getInputDatatype(i);\r\n\t\t\t$(amountString).val(pickValue($(sliderString).slider(\"value\"),l_min,l_max));\r\n\t\t} else {\r\n\t\t\tvar valArray = getInputCategories(getInputCategories(i));\r\n\r\n\t\t\t$(sliderString).addClass('drop-down');\r\n\r\n\t\t\t$(sliderString).append(\"<select id='input-drop\"+counter+\"'></select>\");\r\n\t\t\t// add the select tag\r\n\t\t\tfor (j=0;j<valArray.length;j++){\r\n\t\t\t\t$('#input-drop'+counter).append(\"<option value='\"+valArray[j]+\"'>\"+valArray[j]+\"</option>\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tcounter += 1;\r\n\t}\r\n}", "function updateRangeInputValue() {\n \"use strict\";\n var id = this.id;\n var val = this.value;\n\n // Update Number Input with it's respective Sliders Range Input value\n var inputNumber = document.getElementsByClassName(id);\n inputNumber[0].value = val;\n renderView();\n}", "function slidersInit() {\n\t/*years slider*/\n\tvar $slidersYears = $('.years-slider-js');\n\tif ($slidersYears.length) {\n\t\t$slidersYears.each(function () {\n\t\t\tvar $thisSlider = $(this);\n\t\t\tvar $wrap = $thisSlider.parent();\n\t\t\tvar $thisBtnNext = $('.swiper-button-next', $wrap);\n\t\t\tvar $thisBtnPrev = $('.swiper-button-prev', $wrap);\n\n\t\t\tnew Swiper($thisSlider, {\n\t\t\t\tloop: false,\n\t\t\t\tslidesPerView: 'auto',\n\t\t\t\twatchSlidesVisibility: true,\n\t\t\t\tkeyboardControl: false,\n\t\t\t\tslideToClickedSlide: true,\n\n\t\t\t\tnextButton: $thisBtnNext,\n\t\t\t\tprevButton: $thisBtnPrev\n\t\t\t});\n\t\t});\n\t}\n\n\t/*gallery*/\n\tvar $gallery = $('.gallery');\n\tif ($gallery.length) {\n\t\t$gallery.each(function () {\n\t\t\tvar $thisGallery = $(this);\n\t\t\tvar $images = $('.gallery-js', $thisGallery);\n\t\t\tvar $titles = $('.gallery-captions-js', $thisGallery);\n\t\t\tvar $thisBtnNext = $('.swiper-button-next', $thisGallery);\n\t\t\tvar $thisBtnPrev = $('.swiper-button-prev', $thisGallery);\n\t\t\tvar $thisPagination = $('.swiper-pagination', $thisGallery);\n\n\t\t\tvar galleryTop = new Swiper($images, {\n\t\t\t\tloop: true,\n\t\t\t\t// grabCursor: true,\n\t\t\t\tkeyboardControl: false,\n\n\t\t\t\tnextButton: $thisBtnNext,\n\t\t\t\tprevButton: $thisBtnPrev,\n\t\t\t\tpagination: $thisPagination,\n\t\t\t\tpaginationType: 'fraction'\n\t\t\t});\n\n\t\t\tvar galleryThumbs = new Swiper($titles, {\n\t\t\t\t// Optional parameters\n\t\t\t\tloop: true,\n\t\t\t\teffect: 'fade',\n\t\t\t\tfade: {\n\t\t\t\t\tcrossFade: true\n\t\t\t\t}\n\n\t\t\t\t// Navigation arrows\n\t\t\t\t// nextButton: $thisBtnNext,\n\t\t\t\t// prevButton: $thisBtnPrev\n\t\t\t});\n\n\t\t\tgalleryTop.params.control = galleryThumbs;\n\t\t\tgalleryThumbs.params.control = galleryTop;\n\t\t});\n\t}\n\n\t/*quotes slider*/\n\tvar $slidersQuotes = $('.slider-quoter-js');\n\tif ($slidersQuotes.length) {\n\t\t$slidersQuotes.each(function () {\n\t\t\tvar $thisSlider = $(this);\n\t\t\tvar $wrap = $thisSlider.parent();\n\t\t\tvar $thisBtnNext = $('.swiper-button-next', $wrap);\n\t\t\tvar $thisBtnPrev = $('.swiper-button-prev', $wrap);\n\t\t\tvar $thisPagination = $('.swiper-pagination', $wrap);\n\n\t\t\tnew Swiper($thisSlider, {\n\t\t\t\tloop: true,\n\t\t\t\tkeyboardControl: false,\n\n\t\t\t\tnextButton: $thisBtnNext,\n\t\t\t\tprevButton: $thisBtnPrev,\n\t\t\t\tpagination: $thisPagination,\n\t\t\t\tpaginationType: 'fraction'\n\t\t\t});\n\t\t});\n\t}\n\n}", "removeActiveSlider(){\n for(var oneKindBlock = 0; oneKindBlock < this.kindSliders.length; oneKindBlock++){\n this.kindSliders[oneKindBlock].classList.remove(\"active\");\n }\n }", "function slider_setup(s_name, sample, index) {\n var s = document.getElementById(s_name);\n var s_out = document.getElementById(s_name+\"_out\");\n var s_out2 = document.getElementById(\"ex4_\"+s_name);\n var s_out3 = document.getElementById(\"ex5_\"+s_name);\n s.value = sample[index];\n s_out.innerHTML = s.value;\n s.paired_out = s_out;\n s.paired_out2 = s_out2;\n s.paired_out3 = s_out3;\n s.oninput = function() {\n sample[index] = Number(this.value);\n this.paired_out.innerHTML = this.value;\n this.paired_out2.innerHTML = this.value;\n this.paired_out3.innerHTML = this.value;\n update(treeData[0]);\n \tex4_reset();\n \tex5_reset();\n ex6_reset();\n }\n}", "function go() {\n jme.variables.DOMcontentsubvars(element.contentDocument.rootElement,scope);\n }", "function controller($scope, $element, $timeout) {\n\t\t\n\t\t$scope.currentSelection = paletteSelection.selectedOption.optionType; // Load default selection\n\n\t\t$scope.linkOptions = loadLinkOptions();\n\t\t$scope.nodeOptions = loadNodeOptions();\n\n\t\t$scope.selectPaletteOption = function(selectedOption, isNode) {\n\t\t\t//Notifies the editor graph that an option has been selected\n\t\t\tpaletteSelection.makeSelection(selectedOption.optionType, isNode)\n\t\t\t// $scope.currentSelection = paletteSelection.selectedOption.optionType;\n\t\t\t$scope.currentSelection = selectedOption.label;\n\t\t}\n\t}", "function loadSummarySliders() {\n var ssc = document.createElement(\"div\");\n ssc.setAttribute(\"id\", \"summarySlidersContainer\");\n $(\"#summaryContainer\").append(ssc);\n\n // Duplicate electricity sliders\n createSummarySliderDiv(\"summarySlidersContainer\", \"summaryElectricitySliders\", \"<h3 style='margin-top:4%;'><strong>Electricity in 2050</strong></h3>\");\n var electricitySlidersList = [\"relativePowerPerCapitaSliderPanel\"];\n setSummarySliders(\"summaryElectricitySliders\", electricitySlidersList, \"color-electricity\");\n $(\"#summaryElectricitySliders\").append(\"<p>Sources of electricity:</p>\");\n setSummaryPercentSliders(\"summaryElectricitySliders\", \"electricityPercentsDisplay\");\n electricitySlidersList = [\"coalEfficiencySliderPanel\"];\n setSummarySliders(\"summaryElectricitySliders\", electricitySlidersList, \"color-electricity\");\n\n // Duplicate transportation sliders\n createSummarySliderDiv(\"summarySlidersContainer\", \"summaryTransportationSliders\", \"<h3><strong>Vehicle Efficiency and Use in 2050</strong></h3>\");\n var transportationSlidersList = [\"vehicleDistanceTravelledSliderPanel\", \"vehicleOccupancySliderPanel\", \"gasVehicleFuelEfficiencySliderPanel\"];\n setSummarySliders(\"summaryTransportationSliders\", transportationSlidersList, \"color-transportation\");\n $(\"#summaryTransportationSliders\").append(\"<p>Sources of Vehicle Fuel:</p>\");\n setSummaryPercentSliders(\"summaryTransportationSliders\", \"vehicleUsePercentsDisplay\");\n $(\"#summaryTransportationSliders\").append(\"<p>Aviation</p>\");\n transportationSlidersList = [\"kilometersFlownSliderPanel\", \"planeFuelEfficiencySliderPanel\"];\n setSummarySliders(\"summaryTransportationSliders\", transportationSlidersList, \"color-transportation\");\n\n // Duplicate land use sliders\n createSummarySliderDiv(\"summarySlidersContainer\", \"summaryLandUseSliders\", \"<h3><strong>Food, Agriculture, and Land Use in 2050</strong></h3>\");\n var landUseSlidersList = [\"forestProtectionSliderPanel\", \"reforestationRateSliderPanel\", \"peatlandProtectionSliderPanel\", \"peatlandRestorationSliderPanel\", \"conservationTillageSliderPanel\", \"agricultureSliderPanel\"];\n setSummarySliders(\"summaryLandUseSliders\", landUseSlidersList, \"color-landuse\");\n\n // Duplicate materials sliders\n createSummarySliderDiv(\"summaryLandUseSliders\", \"summaryMaterialsSliders\", \"<h3 style='margin-top:4%;'><strong>Materials in 2050</strong></h3>\");\n var materialsSlidersList = [\"cementCompositionSliderPanel\", \"HFCsSliderPanel\"];\n setSummarySliders(\"summaryMaterialsSliders\", materialsSlidersList, \"color-materials\");\n $(\"#summaryMaterialsSliders\").append(\"<p>Shipping:</p>\");\n materialsSlidersList = [\"shippingPerCapitaSliderPanel\", \"roadShippingSliderPanel\", \"railShippingSliderPanel\", \"seaShippingSliderPanel\", \"skyShippingSliderPanel\"];\n setSummarySliders(\"summaryMaterialsSliders\", materialsSlidersList, \"color-materials\");\n\n // Duplicate buildings sliders\n createSummarySliderDiv(\"summarySlidersContainer\", \"summaryBuildingsSliders\", \"<h3><strong>Buildings in 2050</strong></h3>\");\n var buildingsSlidersList = [\"buildingFloorAreaSliderPanel\", \"buildingConstructionCarbonSliderPanel\", \"buildingLifetimeSliderPanel\", \"LEDLightPercentSliderPanel\", \"lowFlowWaterPercentSliderPanel\", \"cleanCookstovesSliderPanel\"];\n setSummarySliders(\"summaryBuildingsSliders\", buildingsSlidersList, \"color-buildings\");\n $(\"#summaryBuildingsSliders\").append(\"<p>Sources of Heating Energy:</p>\");\n setSummaryPercentSliders(\"summaryBuildingsSliders\", \"heatingPercentsDisplay\");\n\n // Duplicate common sliders\n createSummarySliderDiv(\"summaryContainer\", \"summaryCommonSliders\", \"<h3 style='grid-column: 1 / span 2;'><strong>Common Sliders</strong></h3>\");\n var commonSliderList = [\"population_ElectricitySliderPanel\", \"CCS_ElectricitySliderPanel\"];\n setSummarySliders(\"summaryCommonSliders\", commonSliderList);\n}", "function updateSliders() {\n\n\n $('.rgb-label').trigger('colorpickersliders.updateColor', pb.template().keyDoc.labelColor);\n $('.rgb-value').trigger('colorpickersliders.updateColor', pb.template().keyDoc.foregroundColor);\n $('.rgb-background').trigger('colorpickersliders.updateColor', pb.template().keyDoc.backgroundColor);\n\n }", "_removeTrackListeners() {\n var interactionRects = Px.d3.selectAll(Polymer.dom(this.$$('#sliderSVG')).querySelectorAll('.sliderTrack'));\n\n interactionRects.on('click', null);\n }", "function fun1() {\n var rad = document.getElementsByName('slider');\n\n if (rad[0].checked) {\n firstSlider();\n } else if (rad[1].checked) {\n secondSlider();\n } else {\n thirdSlider();\n }\n}", "function assignID(name) {\n document.getElementsByClassName(\"slider-container\")[0].id = name;\n}", "function initSliders() {\n\t\tvar $sliderList = $(sliderSelector);\n\t\tvar i = $sliderList.length;\n\t\tvar $slider;\n\t\tvar carousel;\n\n\t\twhile (i--) {\n\t\t\t$slider = $($sliderList[i]);\n\n\t\t\tif ($slider.data('loaded') !== 'true') {\n\t\t\t\tcarousel = new Carousel($slider);\n\t\t\t\tcarousel.init();\n\t\t\t}\n\t\t}\n\t}", "on() {\n activeEffectScope = this;\n }", "function createRuntimeSlider(){\n const range = getRuntimeRange()\n // console.log(range)\n // create a range slider for the filter\n // modified from: https://materializecss.com/range.html\n const slider = document.getElementById('runtimeSlider');\n noUiSlider.create(slider, {\n start: [range.low, range.high],\n connect: true,\n step: 1,\n orientation: 'horizontal', // 'horizontal' or 'vertical'\n range: {\n 'min': range.low,\n 'max': range.high\n },\n // show only one decimal place\n format: {\n 'to': function (d){ return String(Math.round(d * 10) / 10) },\n 'from': function (d){ return Number(d)}\n }\n });\n // on sliding, should call filteredByRating\n runtimeSliderPointer = slider.noUiSlider\n slider.noUiSlider.on(\"change\", ([min, max]) => filteredByRuntime(min, max))\n}", "_spawn() {\n const parentElement = document.querySelector(this.parentSelector);\n parentElement.appendChild(this.sliderElement);\n this.ready = true;\n }", "execute(){\n console.log(this.toString());\n let slider = document.createElement('div');\n slider.className = 'fw-slider';\n slider.id = 'fw-slider-id';\n slider.setAttribute(\"data-direction\",true);\n slider.setAttribute(\"data-slides\",this.slidesToShow);\n slider.setAttribute(\"data-slides-to-scroll\",this.slidesToScroll);\n\n // create slides\n for(let i = 0;i<this.slidesToShow;i++){\n var slide = this.makeSlide(this.slides[i],i);\n slider.append(slide);\n }\n\n // pin controls\n let pinControls = document.createElement('div');\n pinControls.className = 'fw-pin-controls';\n let arrowControls = document.createElement('div');\n arrowControls.className = 'fw-arrow-controls';\n let container = document.createElement('div');\n container.className = 'fw-pin-container';\n container.style.width = (6.66 * this.slidesToShow) + '%';\n\n for(let i=0;i<this.slidesToShow;i++){\n var pin = document.createElement('div');\n pin.className = 'fw-pin';\n pin.setAttribute(\"data-pin\",i);\n pin.style.background = 'none';\n if(i == 0){\n pin.style.background = '#ccc';\n }\n container.append(pin);\n }\n \n // arrow control\n let arrowLeft = document.createElement('div');\n arrowLeft.className = 'fw-left-control';\n arrowLeft.setAttribute('data-control','left');\n let arrowRight = document.createElement('div');\n arrowRight.className = 'fw-right-control';\n arrowRight.setAttribute('data-control','right');\n\n\n pinControls.append(container);\n arrowControls.append(arrowLeft);\n arrowControls.append(arrowRight);\n slider.append(arrowControls);\n slider.append(pinControls);\n\n this.sliderElement.append(slider);\n console.log(slider);\n this.controlsListner();\n\n }", "initSliders() {\n this.logger.debug('Starting owl-slider');\n\n // HP has two carousel that need to be synced\n const $slider = $('#owlCarouselDiploma');\n\n $slider.owlCarousel({\n autoPlay: true,\n stopOnHover: false,\n navigation: true,\n navigationText: ['<i class=\"fa fa-angle-left\"></i>', '<i class=\"fa fa-angle-right\"></i>'],\n paginationSpeed: 1000,\n goToFirstSpeed: 2000,\n singleItem: true,\n autoHeight: false\n // transitionStyle: 'fade'\n });\n }", "function activateSlider(element) {\n //console.log(element);\n let checkboxEle = document.getElementById(element + \"ID\");\n let sliderEle = document.getElementById(element + \"SliderID\");\n let searchbox = document.getElementById(\"controlbox\");\n let panelHeaderTitle = document.getElementById(\"panel-header-title\");\n if( checkboxEle.checked == true ) {\n sliderEle.parentElement.parentElement.parentElement.style.display = \"block\";\n } else {\n sliderEle.parentElement.parentElement.parentElement.style.display = \"none\";\n }\n\n}", "function updateThoughtSlider(sliderDom){\n var sliderItemActiveIndex = $(sliderDom).find('.owl-item.active').index();\n var sliderNavItem = $('#' + $(sliderDom).attr('id') + '-nav').children('.btn-slider:eq(' + sliderItemActiveIndex + ')');\n $(sliderNavItem)\n .addClass('active')\n .siblings().removeClass('active');\n\n // Repopulate People List if Sliding to People Page\n if($(sliderNavItem).attr('id') == 'btn-people-page'){\n $('body').attr('data-page', 'page-people');\n //$('#page-people').animate({scrollTop: '0px'}, 0);\n getStream();\n timeElapseStop();\n }\n\n if($(sliderNavItem).attr('id') == 'btn-public-page'){\n $('body').attr('data-page', 'page-public');\n timeElapseStart('page-public');\n }\n }", "_animateCSS() {\n console.debug('Animate CSS');\n let container = this.shadowRoot.getElementById('container');\n let slides = container.querySelector(\".slider__slides\");\n slides.style.transform = \"translateX(-\" + 100 * this.position + \"%)\";\n // console.debug('Animate CSS: slider__slides: ', slides);\n // console.debug('Animate CSS: slides.style.transform: ', slides.style.transform);\n // console.debug('Animate CSS: indSel.style.left: ', indSel.style.left);\n // console.debug('Animate CSS: indSel.style.right: ', indSel.style.right);\n }", "function invokeRangeSlider(){\n var minRange=0;\n var maxRange=document.getElementById('videoLength').value;\n $('#rangeSliderG').show();\n}", "function actionSliders(arr) {\n \"use strict\";\n\n //planet distance\n arr[0].noUiSlider.on('slide', function( values, handle) {\n var newvalue = values[handle];\n document.getElementById('orbdis').value = newvalue;\n });\n //planets size\n arr[1].noUiSlider.on('slide', function( values, handle) {\n var newvalue = values[handle];\n newvalue /= 5;\n newvalue = newvalue.toFixed(2);\n document.getElementById('plansize').value = newvalue;\n });\n //planet speed\n arr[2].noUiSlider.on('slide', function( values, handle) {\n var newvalue = values[handle];\n newvalue /= 20;\n newvalue = newvalue.toFixed(1);\n document.getElementById('spchange').value = newvalue;\n });\n\n}", "function suiRangeInputs() {\n const ranges = document.querySelectorAll('div.sui-slider');\n for (let range of ranges) {\n noUiSlider.create(range, {\n start: [range.dataset.sliderMin],\n connect: [true, false],\n tooltips: true,\n // direction: 'rtl',\n format: {\n to: value => Math.round(value),\n from: value => value\n },\n pips: {\n mode: 'positions',\n values: [0, 100],\n density: 25\n },\n range: { 'min': [Number(range.dataset.sliderMin)], 'max': [Number(range.dataset.sliderMax)] }\n });\n }\n}" ]
[ "0.5758135", "0.57480884", "0.5726139", "0.5655312", "0.54517543", "0.5424122", "0.5412569", "0.5405932", "0.5397236", "0.53809375", "0.5343786", "0.52980506", "0.5271649", "0.527095", "0.5255136", "0.52101815", "0.5193393", "0.51630175", "0.51552707", "0.5151086", "0.51482654", "0.51460975", "0.5130222", "0.512657", "0.5104351", "0.5095417", "0.50932425", "0.50629365", "0.5043483", "0.5031517", "0.5001308", "0.49980962", "0.499678", "0.49936393", "0.4989929", "0.49895662", "0.49817938", "0.4977135", "0.49695376", "0.4966977", "0.49618647", "0.49576336", "0.49562123", "0.49417117", "0.49398568", "0.49351433", "0.49238047", "0.4922563", "0.4913295", "0.49090442", "0.49018648", "0.48994395", "0.48987952", "0.4898017", "0.4897889", "0.48887703", "0.48878223", "0.48865277", "0.48838466", "0.48807937", "0.4877098", "0.48678416", "0.4862764", "0.48551634", "0.4854222", "0.48503146", "0.48498917", "0.48464876", "0.48358867", "0.4832422", "0.48291337", "0.4822906", "0.48223484", "0.48160538", "0.4803175", "0.48028627", "0.48006275", "0.47999987", "0.47911772", "0.47870463", "0.47835627", "0.4781412", "0.47794268", "0.47764063", "0.47744364", "0.47714376", "0.47713694", "0.4771236", "0.4770705", "0.47691923", "0.4767251", "0.4764714", "0.47599906", "0.47559026", "0.4755516", "0.47548187", "0.47546446", "0.47458717", "0.47395954", "0.4734305" ]
0.5603838
4
This is a ConformanceMessaging resource
static get __resourceType() { return 'ConformanceMessaging'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function messagingApi()\n{\n\n}", "sendMessageService(boatId) { \n publish(this.messageContext, BoatMC, {recordId:boatId});\n }", "get communication () {\n\t\treturn this._communication;\n\t}", "get communication() {\n\t\treturn this.__communication;\n\t}", "onWorkerMsg(msg){\n\n if (msg.replyTo!=null){\n\n if (messageBuffer[msg.replyTo]!=undefined){\n\n //Store the reply in the buffer.\n messageBuffer[msg.replyTo].reply = msg;\n\n //Send the response to the client.\n messageBuffer[msg.replyTo].client.json({response:msg.payload});\n\n }\n\n }\n\n }", "constructor(ctxPtr) {\n this.name = 'RatchetMessage';\n\n if (typeof ctxPtr === 'undefined') {\n this.ctxPtr = Module._vscr_ratchet_message_new();\n } else {\n this.ctxPtr = ctxPtr;\n }\n }", "BroadcastMessage() {}", "BroadcastMessage() {}", "BroadcastMessage() {}", "BroadcastMessage() {}", "respondToMessages() { }", "static get __resourceType() {\n\t\treturn 'MessageHeader';\n\t}", "constructor() { \n \n BandwidthCallbackMessage.initialize(this);\n }", "function Conversation() {}", "async initializeServiceWorkerMessaging() {\r\n return _isWorker() ? this.initializeReceiver() : this.initializeSender();\r\n }", "async initializeServiceWorkerMessaging() {\r\n return _isWorker() ? this.initializeReceiver() : this.initializeSender();\r\n }", "function Component_MessageBehavior() {\n\n /**\n * Reference to temporary game settings.\n * @property settings\n * @type Object\n * @protected\n */\n this.tempSettings = GameManager.tempSettings;\n\n /**\n * Indicates if the message is currently waiting.\n * @property isWaiting\n * @type boolean\n * @readOnly\n */\n this.isWaiting = false;\n\n /**\n * Indicates if the message is currently running.\n * @property isRunning\n * @type boolean\n * @readOnly\n */\n this.isRunning = false;\n\n /**\n * Indicates if a voice is currently playing together with the message.\n * @property isVoicePlaying\n * @type boolean\n * @readOnly\n */\n this.isVoicePlaying = false;\n\n /**\n * Current message caret/cursor position.\n * @property caretPosition\n * @type gs.Point\n * @readOnly\n */\n this.caretPosition = new gs.Point(0, 0);\n\n /**\n * Current raw message text.\n * @property message\n * @type string\n * @readOnly\n */\n this.message = \"\";\n\n /**\n * All currently displayed raw messages.\n * @property messages\n * @type string[]\n * @readOnly\n */\n this.messages = [];\n\n /**\n * Voice associated with the current message.\n * @property voice\n * @type gs.AudioBufferReference\n */\n this.voice = null;\n\n /**\n * Indicates if current message is partial. DEPRECATED. Please do not use.\n * @property partial\n * @deprecated\n * @type boolean\n * @readOnly\n */\n this.partial = false;\n\n /**\n * Indicates if the message is currently waiting in live-preview.\n * @property waitingPreview\n * @type boolean\n * @readOnly\n */\n this.waitingPreview = false;\n\n /**\n * Indicates if the auto-message is enabled.\n * @property autoMessageEnabled\n * @type boolean\n * @readOnly\n */\n this.autoMessageEnabled = false;\n this.onMessageFinish = (function(_this) {\n return function(sender) {\n _this.object.events.emit(\"finish\", _this);\n if (_this.object.settings.autoErase || _this.object.settings.paragraphSpacing > 0) {\n return _this.message = \"\";\n }\n };\n })(this);\n this.onMessageWaiting = (function(_this) {\n return function(sender) {\n if (!_this.object.textRenderer.isBatched() || !_this.object.textRenderer.isBatchInProgress()) {\n _this.object.textRenderer.waitAtEnd = !_this.partial;\n return _this.object.events.emit(\"waiting\", _this);\n }\n };\n })(this);\n }", "function GetProto() {\r\n return `\r\n // See README.txt for information and build instructions.\r\n\r\n package CanOpenBridge;\r\n\r\n //option java_package = \"com.burkert.cop\";\r\n //option java_outer_classname = \"CanOpenBridge\";\r\n\r\n // put an optional field here for every new classtype\r\n message MessageWrapper {\r\n optional SDO SDO = 1;\r\n optional PDO PDO = 2;\r\n optional Event Event = 3;\r\n optional AddNode AddNode = 4;\r\n optional RemoveNode RemoveNode = 5;\r\n optional Commands Commands = 6;\r\n optional SYNC SYNC = 7;\r\n optional SdoProgress SdoProgress = 8;\r\n optional Request Request = 9;\r\n optional RequestProgress RequestProgress = 10;\r\n optional RawData RawData = 11;\r\n optional CanMeasure CanMeasure = 12;\r\n }\r\n\r\n message SDO {\r\n required int32 nodeId = 1;\r\n required int32 index = 2;\r\n required int32 subIndex = 3;\r\n enum Control {\r\n READ = 0;\r\n WRITE = 1;\r\n\t RESPONSE = 2;\r\n\t ABORT = 3;\r\n\t READ_BLOCK = 4;\r\n\t WRITE_BLOCK = 5;\r\n }\r\n required Control control = 4;\r\n optional bytes data = 5;\r\n optional int32 totalBlockLen = 6;\r\n optional uint64 timestamp = 7;\r\n }\r\n\r\n message PDO {\r\n required int32 nodeId = 6;\r\n required int32 pdoNumber = 7;\r\n required bytes data = 8;\r\n required uint64 timestamp = 9;\r\n }\r\n\r\n message Event {\r\n required int32 nodeId = 10;\r\n required bytes data = 11;\r\n required uint64 timestamp = 12;\r\n enum EventType {\r\n EMERGENCY = 0;\r\n BDO = 1;\t\r\n SERVERINFO = 2;\r\n\t SERVERERROR = 3;\r\n\t NMT = 4;\r\n }\r\n required EventType eventType = 16;\r\n }\r\n\r\n message AddNode {\r\n required int32 nodeId = 13;\r\n optional int32 deviceStatus = 14;\r\n }\r\n\r\n message RemoveNode {\r\n required int32 nodeId = 14;\r\n }\r\n\r\n message Commands {\r\n enum Command {\r\n SHUTDOWN = 0;\r\n RESTART_SOCKET = 1;\r\n }\r\n required Command command = 15;\r\n }\r\n\r\n message SYNC {\r\n required uint32 flags = 17;\r\n }\r\n\r\n message SdoProgress {\r\n required int32 nodeId = 1;\r\n required int32 index = 2;\r\n required int32 subIndex = 3;\r\n required int32 value = 4;\r\n }\r\n\r\n message Request {\r\n\t enum RequestType {\r\n\t\t Complete = 0;\r\n\t\t SearchCANopenDevices = 1;\r\n\t\t GetLSS_Slave = 2;\r\n\t\t CnfLSS_Slave = 3;\r\n\t\t CanRawData = 4;\r\n\t\t CanMeasure = 5;\r\n\t }\r\n\t required RequestType requestType = 1;\r\n\t optional int32 nodeID = 2;\r\n\t optional int32 baudrate = 3;\r\n\t optional int32 result = 4;\r\n\t optional int32 vendorID = 5;\r\n\t optional int32 productCode = 6;\r\n\t optional int32 revisionNumber = 7;\r\n\t optional int32 serialNumber = 8;\r\n\t optional int32 rawDataActive = 9;\r\n\t optional int32 canMeasureActive = 10;\r\n }\r\n\r\n message RequestProgress {\r\n\t required int32 value = 1;\r\n }\r\n message RawData {\r\n required uint32 cobId = 1;\r\n required bytes data = 2;\r\n required uint64 timeStamp = 3;\r\n required bool direction = 4; \r\n }\r\n\r\n message CanMeasure{\r\n required int32 errorFlags = 1;\r\n required int32 canHRise = 2;\r\n required int32 canHFall = 3;\r\n required int32 canLRise = 4;\r\n required int32 canLFall = 5;\r\n }\r\n\t\t`;\r\n}", "constructor(config = {}) {\n this.runtime = Runtime.make();\n this.handleBusMessages();\n this.devMode = config.devMode || devMode.mode;\n this.debug = this.devMode\n ? debugFn\n : () => {\n /* no op */\n };\n\n this.ERROR_COMM_CHANNEL_NOT_INIT = 'Comm channel not initialized, not sending message.';\n\n this.messageQueue = [];\n\n // maintain a mapping of job IDs and dispatch information\n this._jobMapping = {};\n }", "function MessagingService(konyRef) {\r\n\r\n\tvar homeUrl = konyRef.messagingsvc.url;\r\n\tvar KSID;\r\n\tvar appId = konyRef.messagingsvc.appId;\r\n\tvar logger = new konyLogger();\r\n\tvar networkProvider = new konyNetworkProvider();\r\n\tvar dsKey = homeUrl + \":KMS:AppId\";\r\n\r\n\tthis.getUrl = function() {\r\n\t\treturn homeUrl;\r\n\t};\r\n\r\n\tthis.setKSID = function(ksid) {\r\n\t\tkonyRef.getDataStore().setItem(dsKey, ksid);\r\n\t\tKSID = ksid;\r\n\t};\r\n\r\n\tthis.getKSID = function() {\r\n\t\tif (!KSID) {\r\n\t\t\tKSID = konyRef.getDataStore().getItem(dsKey);\r\n\t\t}\r\n\t\treturn KSID;\r\n\t};\r\n\r\n\tthis.setKmsAppId = function(id) {\r\n\t\tappId = id;\r\n\t};\r\n\r\n\tthis.getKmsAppId = function() {\r\n\t\treturn appId;\r\n\t};\r\n\t/**\r\n\t * register success callback method.\r\n\t * @callback registerSuccessCallback\r\n\t * @param {json} response - register response\r\n\t */\r\n\r\n\t/**\r\n\t * Register service failure callback method.\r\n\t * @callback registerFailureCallback\r\n\t * @param {json} error - Error information\r\n\t */\r\n\t/**\r\n\t * register to messaging service\r\n\t * @param {string} osType - Type of the operating system\r\n\t * @param {string} deviceId - Device Id\r\n\t * @param {string} pnsToken - Token value\r\n\t * @param {registerSuccessCallback} successCallback - Callback method on success\r\n\t * @param {registerFailureCallback} failureCallback - Callback method on failure\r\n\t */\r\n\tthis.register = function(osType, deviceId, pnsToken, email, successCallback, failureCallback) {\r\n\t\tif (typeof(pnsToken) === 'undefined' || pnsToken === null) {\r\n\t\t\tthrow new Exception(Errors.MESSAGING_FAILURE, \"Invalid pnsToken/sId. Please check your messaging provider\");\r\n\t\t}\r\n\t\tif (typeof(osType) === 'undefined' || osType === null) {\r\n\t\t\tthrow new Exception(Errors.MESSAGING_FAILURE, \"Invalid osType.\");\r\n\t\t}\r\n\t\tif (typeof(deviceId) === 'undefined' || deviceId === null) {\r\n\t\t\tthrow new Exception(Errors.MESSAGING_FAILURE, \"Invalid deviceId.\");\r\n\t\t}\r\n\t\tif (typeof(email) === 'undefined' || email === null) {\r\n\t\t\tthrow new Exception(Errors.MESSAGING_FAILURE, \"Invalid email.\");\r\n\t\t}\r\n\t\tvar uri = homeUrl + \"/subscribers\";\r\n\t\tjsonParam = {\r\n\t\t\t\"subscriptionService\": {\r\n\t\t\t\t\"subscribe\": {\r\n\t\t\t\t\t\"sid\": pnsToken,\r\n\t\t\t\t\t\"appId\": this.getKmsAppId(),\r\n\t\t\t\t\t\"ufid\": email,\r\n\t\t\t\t\t\"osType\": osType,\r\n\t\t\t\t\t\"deviceId\": deviceId\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar headers = {\r\n\t\t\t\"Content-Type\": \"application/json\"\r\n\t\t};\r\n var payload = {\r\n\t\t\tpostdata : JSON.stringify(jsonParam)\r\n\t\t}\r\n\t\tlogger.log(JSON.stringify(jsonParam));\r\n\t\tnetworkProvider.post(uri,\r\n\t\t\tpayload,\r\n\t\t\theaders,\r\n\t\t\tfunction(data) {\r\n\t\t\t\tKSID = data.id;\r\n\t\t\t\tkonyRef.getDataStore().setItem(dsKey, KSID);\r\n\t\t\t\tlogger.log(\"Device registered to KMS with KSID:\" + KSID);\r\n\t\t\t\tkony.sdk.verifyAndCallClosure(successCallback, data);\r\n\t\t\t},\r\n\t\t\tfunction(data, status, error) {\r\n\r\n\t\t\t\tlogger.log(\"ERROR: Failed to subscribe device for KMS\");\r\n\t\t\t\tvar errorObj = {};\r\n\t\t\t\terrorObj.data = data;\r\n\t\t\t\terrorObj.status = status;\r\n\t\t\t\terrorObj.error = error;\r\n\t\t\t\tkony.sdk.verifyAndCallClosure(failureCallback, errorObj);\r\n\t\t\t});\r\n\t};\r\n\t/**\r\n\t * unregister success callback method.\r\n\t * @callback unregisterSuccessCallback\r\n\t */\r\n\r\n\t/**\r\n\t * unregister service failure callback method.\r\n\t * @callback unregisterFailureCallback\r\n\t */\r\n\t/**\r\n\t * unregister to messaging service\r\n\t * @param {unregisterSuccessCallback} successCallback - Callback method on success\r\n\t * @param {unregisterFailureCallback} failureCallback - Callback method on failure\r\n\t */\r\n\tthis.unregister = function(successCallback, failureCallback) {\r\n\t\tvar uri = homeUrl + \"/subscribers/\" + this.getKSID();\r\n\t\tlogger.log(\"unsubscribe uri:\" + uri);\r\n\t\tkonyRef.getDataStore().removeItem(dsKey);\r\n\t\tvar headers = {\r\n\t\t\t\"Content-Type\": \"application/json\",\r\n\t\t\t\"X-HTTP-Method-Override\": \"DELETE\"\r\n\t\t};\r\n\t\tnetworkProvider.post(uri, null, headers, successCallback, failureCallback);\r\n\t};\r\n\t/**\r\n\t * Fetch all messages success callback method.\r\n\t * @callback fetchAllMessagesSuccessCallback\r\n\t * @param {json} response - Fetch all messages response\r\n\t */\r\n\r\n\t/**\r\n\t * Fetch all messages service failure callback method.\r\n\t * @callback fetchAllMessagesFailureCallback\r\n\t * @param {json} error - Error information\r\n\t */\r\n\t/**\r\n\t * Fetch all messages\r\n\t * @param {fetchAllMessagesSuccessCallback} successCallback - Callback method on success\r\n\t * @param {fetchAllMessagesFailureCallback} failureCallback - Callback method on failure\r\n\t */\r\n\tthis.fetchAllMessages = function(startIndex, pageSize, successCallback, failureCallback) {\r\n\t\tvar uri = homeUrl + \"/messages/fetch\";\r\n\t\tvar headers = {\r\n\t\t\t\"Content-Type\": \"application/json\"\r\n\t\t};\r\n\t\tvar data = {\r\n\t\t\t\"ksid\": this.getKSID(),\r\n\t\t\t\"startElement\": startIndex,\r\n\t\t\t\"elementsPerPage\": pageSize\r\n\t\t};\r\n var payload = {\r\n\t\t\tpostdata : JSON.stringify(data)\r\n\t\t}\r\n\t\tnetworkProvider.post(uri, payload, headers, successCallback, failureCallback);\r\n\t};\r\n\t/**\r\n\t * Update location service success callback method.\r\n\t * @callback updateLocationSuccessCallback\r\n\t * @param {json} response - Update location response\r\n\t */\r\n\r\n\t/**\r\n\t * Update location service failure callback method.\r\n\t * @callback updateLocationFailureCallback\r\n\t * @param {json} error - Error information\r\n\t */\r\n\t/**\r\n\t * Update the location\r\n\t * @param {string} latitude - Latitude value\r\n\t * @param {string} longitude - Longitude value\r\n\t * @param {string} locationName - Location name\r\n\t * @param {updateLocationSuccessCallback} successCallback - Callback method on success\r\n\t * @param {updateLocationFailureCallback} failureCallback - Callback method on failure\r\n\t */\r\n\tthis.updateGeoLocation = function(latitude, longitude, locationName, successCallback, failureCallback) {\r\n\t\tif (typeof(latitude) === 'undefined' || latitude === null) {\r\n\t\t\tthrow new Exception(MESSAGING_FAILURE, \"invalid latitude paramter value\");\r\n\t\t}\r\n\t\tif (typeof(longitude) === 'undefined' || longitude === null) {\r\n\t\t\tthrow new Exception(MESSAGING_FAILURE, \"invalid longitude paramter value\");\r\n\t\t}\r\n\t\tif (typeof(locationName) === 'undefined' || locationName === null) {\r\n\t\t\tthrow new Exception(MESSAGING_FAILURE, \"invalid locationName paramter value\");\r\n\t\t}\r\n\t\tvar headers = {\r\n\t\t\t\"Content-Type\": \"application/json\"\r\n\t\t};\r\n\t\tvar uri = homeUrl + \"/location\";\r\n\t\tvar data = {\r\n\t\t\t\"ksid\": this.getKSID(),\r\n\t\t\t\"latitude\": latitude,\r\n\t\t\t\"locname\": locationName,\r\n\t\t\t\"longitude\": longitude\r\n\t\t};\r\n\t\tvar payload = {\r\n\t\t\tpostdata : JSON.stringify(data)\r\n\t\t}\r\n\t\tlogger.log(\"updateLocation payload: \" + JSON.stringify(payload));\r\n\t\tnetworkProvider.post(uri, payload, headers, successCallback, failureCallback);\r\n\t};\r\n\t/**\r\n\t * Mark meesage as read service success callback method.\r\n\t * @callback markReadSuccessCallback\r\n\t * @param {json} response - Mark meesage as read service response\r\n\t */\r\n\t/**\r\n\t * Mark meesage as read service failure callback method.\r\n\t * @callback markReadFailureCallback\r\n\t * @param {json} error - Error information\r\n\t */\r\n\t/**\r\n\t * Mark the message as read for a given message id\r\n\t * @param {string} messageId - Message id\r\n\t * @param {markReadSuccessCallback} successCallback - Callback method on success\r\n\t * @param {markReadFailureCallback} failureCallback - Callback method on failure\r\n\t */\r\n\tthis.markMessageRead = function(fetchId, successCallback, failureCallback) {\r\n\t\tif (typeof(fetchId) === 'undefined' || fetchId === null) {\r\n\t\t\tthrow new Exception(MESSAGING_FAILURE, \"invalid fetchId paramter value\");\r\n\t\t}\r\n\t\tvar headers = {\r\n\t\t\t\"Content-Type\": \"application/json\"\r\n\t\t};\r\n\t\tvar uri = homeUrl + \"/messages/open/\" + fetchId;\r\n\t\tnetworkProvider.get(uri, null, headers, successCallback, failureCallback);\r\n\r\n\t};\r\n\t/**\r\n\t * Message content service success callback method.\r\n\t * @callback messageContentSuccessCallback\r\n\t * @param {json} response - Message content service response\r\n\t */\r\n\t/**\r\n\t * Message content service failure callback method.\r\n\t * @callback messageContentFailureCallback\r\n\t * @param {json} error - Error information\r\n\t */\r\n\t/**\r\n\t * Fetches the message conetent for a given message id\r\n\t * @param {string} messageId - Message id\r\n\t * @param {messageContentSuccessCallback} successCallback - Callback method on success\r\n\t * @param {messageContentFailureCallback} failureCallback - Callback method on failure\r\n\t */\r\n\tthis.fetchMessageContent = function(fetchId, successCallback, failureCallback) {\r\n\t\tif (typeof(fetchId) === 'undefined' || fetchId === null) {\r\n\t\t\tthrow new Exception(MESSAGING_FAILURE, \"invalid fetchId paramter value\");\r\n\t\t}\r\n\t\tvar headers = {\r\n\t\t\t\"Content-Type\": \"application/json\"\r\n\t\t};\r\n\t\tvar uri = homeUrl + \"/messages/content/\" + fetchId;\r\n\t\tnetworkProvider.get(uri, null, headers, successCallback, failureCallback);\r\n\t};\r\n}", "constructor(params = {})\n\t{\n\t\tthis.ready = true;\n\n\t\tthis.offline = false;\n\n\t\tthis.host = this.getHost();\n\n\t\tthis.inited = false;\n\n\t\tthis.restClient = BX.rest;\n\n\t\tthis.customData = [];\n\n\t\tthis.localize = {...BX.message};\n\n\t\tthis.subscribers = {};\n\t\tthis.dateFormat = null;\n\n\t\tthis.messagesQueue = [];\n\n\t\tthis.configRequestXhr = null;\n\n\t\tthis.windowFocused = true;\n\n\t\tthis.rootNode = document.getElementById('messenger-root');\n\n\t\tthis.template = null;\n\n\t\tthis.timer = new Timer();\n\n\t\twindow.addEventListener('orientationchange', () => {\n\t\t\tif (!this.store)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.store.commit('application/set', {\n\t\t\t\tdevice : {\n\t\t\t\t\torientation : Utils.device.getOrientation()\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (\n\t\t\t\tthis.store.state.application.device.type === DeviceType.mobile\n\t\t\t\t&& this.store.state.application.device.orientation === DeviceOrientation.horizontal\n\t\t\t)\n\t\t\t{\n\t\t\t\tdocument.activeElement.blur();\n\t\t\t}\n\t\t});\n\n\t\t// todo change to dynamic storage (LocalStorage web, PageParams for mobile)\n\t\tlet serverVariables = LocalStorage.get(this.getSiteId(), 0, 'serverVariables', false);\n\t\tif (serverVariables)\n\t\t{\n\t\t\tthis.addLocalize(serverVariables);\n\t\t}\n\n\t\t//alert('Pause: open console for debug');\n\n\t\tBX.componentParameters.init()\n\t\t\t.then(result => this.initMobileSettings(result))\n\t\t\t.then(result => this.initStorage(result))\n\t\t\t.then(result => this.initComponent(result))\n\t\t\t.then(result => this.requestData(result))\n\t\t\t.then(result => this.initEnvironment(result))\n\t\t\t.then(result => this.initMobileEnvironment(result))\n\t\t\t.then(result => this.initPullClient(result))\n\t\t;\n\t}", "function checkConversationPossibility(){\n var obj = {};\n obj = getMessageObj();\n // console.log(\"obj >>\", obj);\n obj[\"job_id\"] = jobId;\n obj[\"name\"] = userName;\n obj[\"resume_id\"] = resumeId;\n obj[\"user_id\"] = user_id;\n obj[\"user_type\"] = user_type;\n obj[\"cid\"] = candidateId;\n obj[\"sll\"] = sll;\n obj[\"all_vars\"] = all_vars;\n socket.emit(\"checkIsConversationPossible\", obj);\n }", "onMessageStart() { }", "static get is() { return 'lingo-live-write-message'; }", "broadcast () {\n throw new this.context.errors.PreconditionError('Cannot broadcast: the MODBUS protocol does not support realtime');\n }", "function onSendMessage(data){\n\t//TODO \n}", "sendMessage(content_message)\n {\n\n let recipient = this.props.participants.get(this.props.currentUser);\n let sender = this.props.participants.get(recipient)\n\n let message = {\n content : content_message,\n recipient : recipient,\n sender: sender,\n fkConversation : this.props.conversation,\n date:Date.now()\n }\n this.client.send('/EZChat/'+message.fkConversation.id+'/private',{},JSON.stringify(message))\n }", "static get type() { return 'mq'; }", "function Sms() {\n\n}", "constructor() { \n \n Message.initialize(this);\n }", "constructor(message, destinataireID) {\n this.message = message;\n this.destinataireID = destinataireID;\n this.GCM = new gcm.Message();\n }", "constructor(message, data){\n this.message = message;\n this.data = data;\n }", "function Sms() {\n\n }", "sendToWorker(res,command){\n\n //Get the object that select the worker.\n let manage = new Manager(config.workers.planifier,workerIds);\n\n //Get the process id.\n let pId = manage.planify();\n\n //Create message to send a worker.\n let msg = messeger.toWorker(pId,command.type,command.payload); \n\n //Add the msg to the buffer.\n messageBuffer[msg.id] = {\n origin : msg,\n reply : null,\n client : res\n };\n\n //Send message to the cluster.\n this.cluster.workers[pId].send(msg);\n\n return msg;\n\n }", "_broadcastMessage(message){\n //Publish messages to peer\n this._wire.extended('ut_live_chat', {...message,\n middleman : true\n })\n }", "onMessageReceive() {}", "static get properties() {\n return {\n message: { type: String },\n };\n }", "sendMessageService(boatId) { \n // explicitly pass boatId to the parameter recordId\n publish(this.messageContext, BOATMC, {recordId:boatId})\n }", "subscribeMC() {\n if(this.subscription) { return; }\n this.subscription=subscribe(this.messageContext,BOATMC,(message)=>{ this.boatId = message.recordId },{scope:APPLICATION_SCOPE});\n }", "receiveMessage() {\n\n index = this.currentChat;\n\n const cpuMessage = {\n message: 'ok',\n status: 'received',\n date: dayjs().format('DD/MM/YYYY HH:mm:ss'),\n }\n\n this.contacts[this.currentChat].messages.push(cpuMessage);\n }", "function VideoChannel(name, room, myStream) {\n var _this = this;\n this.room = room;\n this.myStream = myStream != null ? myStream : null;\n this.attach = function(obj) {\n return VideoChannel.prototype.attach.apply(_this, arguments);\n };\n this.subscribeRemote = function(vid) {\n return VideoChannel.prototype.subscribeRemote.apply(_this, arguments);\n };\n this.subscribeLocal = function(vid) {\n return VideoChannel.prototype.subscribeLocal.apply(_this, arguments);\n };\n this.stream2src = function(stream) {\n return VideoChannel.prototype.stream2src.apply(_this, arguments);\n };\n this.onmessage = function(event) {\n return VideoChannel.prototype.onmessage.apply(_this, arguments);\n };\n this.onGetICE = function(event) {\n return VideoChannel.prototype.onGetICE.apply(_this, arguments);\n };\n this.onCreateICE = function(event) {\n return VideoChannel.prototype.onCreateICE.apply(_this, arguments);\n };\n this.onGetRemoteStream = function(e) {\n return VideoChannel.prototype.onGetRemoteStream.apply(_this, arguments);\n };\n this.onGetAnswer = function(event) {\n return VideoChannel.prototype.onGetAnswer.apply(_this, arguments);\n };\n this.onCreateAnswer = function(desc) {\n return VideoChannel.prototype.onCreateAnswer.apply(_this, arguments);\n };\n this.onGetOffer = function(event) {\n return VideoChannel.prototype.onGetOffer.apply(_this, arguments);\n };\n this.onCreateOffer = function(desc) {\n return VideoChannel.prototype.onCreateOffer.apply(_this, arguments);\n };\n this.call = function() {\n return VideoChannel.prototype.call.apply(_this, arguments);\n };\n this.onWebCamSuccess = function(stream) {\n return VideoChannel.prototype.onWebCamSuccess.apply(_this, arguments);\n };\n this.makePeer = function(servers) {\n if (servers == null) {\n servers = null;\n }\n return VideoChannel.prototype.makePeer.apply(_this, arguments);\n };\n this.startPeer = function(servers) {\n if (servers == null) {\n servers = null;\n }\n return VideoChannel.prototype.startPeer.apply(_this, arguments);\n };\n this.askWebcam = function() {\n return VideoChannel.prototype.askWebcam.apply(_this, arguments);\n };\n VideoChannel.__super__.constructor.call(this, name);\n this.startPeer();\n }", "sendGenericMessage( recipientId ) {\n var messageData = {\n recipient: {\n id: recipientId\n },\n message: {\n attachment: {\n type: \"template\",\n payload: {\n template_type: \"generic\",\n elements: [ {\n title: \"rift\",\n subtitle: \"Next-generation virtual reality\",\n item_url: \"https://www.oculus.com/en-us/rift/\",\n image_url: envVars.SERVER_URL + \"/assets/rift.png\",\n buttons: [ {\n type: \"web_url\",\n url: \"https://www.oculus.com/en-us/rift/\",\n title: \"Open Web URL\"\n }, {\n type: \"postback\",\n title: \"Call Postback\",\n payload: \"Payload for first bubble\",\n } ],\n }, {\n title: \"touch\",\n subtitle: \"Your Hands, Now in VR\",\n item_url: \"https://www.oculus.com/en-us/touch/\",\n image_url: envVars.SERVER_URL + \"/assets/touch.png\",\n buttons: [ {\n type: \"web_url\",\n url: \"https://www.oculus.com/en-us/touch/\",\n title: \"Open Web URL\"\n }, {\n type: \"postback\",\n title: \"Call Postback\",\n payload: \"Payload for second bubble\",\n } ]\n } ]\n }\n }\n }\n };\n\n this.callSendAPI( messageData );\n }", "function BandwidthMessage() {\n _classCallCheck(this, BandwidthMessage);\n\n BandwidthMessage.initialize(this);\n }", "function onExistingParticipants(message) {\n // Standard constraints\n var constraints = {\n audio: true,\n video: {\n frameRate: {\n min: 1, ideal: 15, max: 30\n },\n width: {\n min: 32, ideal: 50, max: 320\n },\n height: {\n min: 32, ideal: 50, max: 320\n }\n }\n };\n\n // Temasys constraints\n /*var constraints = {\n audio: true,\n video: {\n mandatory: {\n minWidth: 32,\n maxWidth: 320,\n minHeight: 32,\n maxHeight: 320,\n maxFrameRate: 30,\n minFrameRate: 1\n }\n }\n };*/\n\n console.log(sessionId + \" register in room \" + message.roomName);\n\n // create video for current user to send to server\n var localParticipant = new Participant(sessionId);\n participants[sessionId] = localParticipant;\n localVideo = document.getElementById(\"local_video\");\n var video = localVideo;\n\n // bind function so that calling 'this' in that function will receive the current instance\n var options = {\n localVideo: video,\n mediaConstraints: constraints,\n onicecandidate: localParticipant.onIceCandidate.bind(localParticipant)\n };\n\n\n localParticipant.rtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendonly(options, function (error) {\n if (error) {\n return console.error(error);\n }\n\n // Set localVideo to new object if on IE/Safari\n localVideo = document.getElementById(\"local_video\");\n\n // initial main video to local first\n localVideoCurrentId = sessionId;\n localVideo.src = localParticipant.rtcPeer.localVideo.src;\n localVideo.muted = true;\n\n console.log(\"local participant id : \" + sessionId);\n this.generateOffer(localParticipant.offerToReceiveVideo.bind(localParticipant));\n });\n\n // get access to video from all the participants\n console.log(message.data);\n for (var i in message.data) {\n receiveVideoFrom(message.data[i]);\n }\n}", "static get properties() {\n return {\n isSelfAdmin: {\n type: Boolean,\n readOnly: false,\n notify: true\n },\n participants: {\n type: Array,\n readOnly: false,\n notify: true\n },\n subject: {\n type: String,\n readOnly: false,\n notify: true\n },\n chatImage: {\n type: String,\n readOnly: false,\n notify: true\n },\n adminKeyImage: {\n type: String,\n readOnly: false,\n notify: true,\n value: m_basePath + \"img/admin_key.png\"\n },\n pendingParticipantImage: {\n type: String,\n readOnly: false,\n notify: true,\n value: m_basePath + \"img/pending_participant.png\"\n },\n expanderImage: {\n type: String,\n readOnly: false,\n notify: true,\n value : m_basePath + \"img/menu_token.png\"\n },\n videoCallImage: {\n type: String,\n readOnly: false,\n notify: true,\n value : m_basePath + \"img/video_call.png\"\n },\n voiceCallImage: {\n type: String,\n readOnly: false,\n notify: true,\n value : m_basePath + \"img/voice_call.png\"\n },\n optionsMenuImage: {\n type: String,\n readOnly: false,\n notify: true,\n value : m_basePath + \"img/options_menu.png\"\n },\n isHasAudio: {\n type: Boolean,\n readOnly: false,\n notify: true,\n value: false\n },\n isHasVideo: {\n type: Boolean,\n readOnly: false,\n notify: true,\n value: false\n },\n isMediaEnabled: {\n type: Boolean,\n readOnly: false,\n notify: true,\n value: true\n },\n isOneToOne: {\n type: Boolean,\n readOnly: false,\n notify: true\n },\n noSubjectPlaceHolder: {\n type: String,\n readOnly: false,\n notify: true,\n value : \"\"\n }\n };\n }", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "on_message(message) {\r\n }", "constructor(info) {\n super();\n\n _defineProperty(this, \"_peerConnectionId\", void 0);\n\n _defineProperty(this, \"_reactTag\", void 0);\n\n _defineProperty(this, \"_id\", void 0);\n\n _defineProperty(this, \"_label\", void 0);\n\n _defineProperty(this, \"_maxPacketLifeTime\", void 0);\n\n _defineProperty(this, \"_maxRetransmits\", void 0);\n\n _defineProperty(this, \"_negotiated\", void 0);\n\n _defineProperty(this, \"_ordered\", void 0);\n\n _defineProperty(this, \"_protocol\", void 0);\n\n _defineProperty(this, \"_readyState\", void 0);\n\n _defineProperty(this, \"_subscriptions\", []);\n\n _defineProperty(this, \"binaryType\", 'arraybuffer');\n\n _defineProperty(this, \"bufferedAmount\", 0);\n\n _defineProperty(this, \"bufferedAmountLowThreshold\", 0);\n\n this._peerConnectionId = info.peerConnectionId;\n this._reactTag = info.reactTag;\n this._label = info.label;\n this._id = info.id === -1 ? null : info.id; // null until negotiated.\n\n this._ordered = Boolean(info.ordered);\n this._maxPacketLifeTime = info.maxPacketLifeTime;\n this._maxRetransmits = info.maxRetransmits;\n this._protocol = info.protocol || '';\n this._negotiated = Boolean(info.negotiated);\n this._readyState = info.readyState;\n\n this._registerEvents();\n }", "function ProtocolMessage(messageType, responseReceiverId, message)\r\n{\r\n /**\r\n * Type of the message. This parameter is not used in Eneter for Javascript. \r\n */\r\n this.MessageType = messageType;\r\n \r\n /**\r\n * Client id. This parameter is not used in Eneter for Javascript.\r\n */\r\n this.ResponseReceiverId = responseReceiverId;\r\n \r\n /**\r\n * Decoded message data.\r\n */\r\n this.Message = message;\r\n}", "postMessage(message) {\n return apiClient.post(`https://ourgp.herokuapp.com/api/messages/`, {\n beneficiaryName: message.beneficiaryName, \n recipientName: message.recipientName, \n recipientEmail: message.recipientEmail, \n callsToAction: message.callsToAction, \n videoURL: message.videoUrl\n })\n }", "createMessage(is_singlechat, thread_id, person, content) {\n return this.#fetchAdvanced(this.#createMessageURL(is_singlechat, thread_id, person, content), {\n method: 'POST',\n }).then((responseJSON) => {\n let responseMessageBO = MessageBO.fromJSON(responseJSON);\n return new Promise(function (resolve) {\n resolve(responseMessageBO);\n })\n })\n }", "function requestMessage() {\n asbService.receiveQueueMessage((queureName + '-recieve'), handleMessage);\n}", "function requestMessage() {\n asbService.receiveQueueMessage((queureName + '-recieve'), handleMessage);\n}", "subscribeMC() {\n // local boatId must receive the recordId from the message\n if (!this.subscription) {\n this.subscription = subscribe(\n this.messageContext,\n BOATMC,\n (message) => {this.boatId = message.recordId},\n { scope: APPLICATION_SCOPE }\n );\n }\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 }", "sendMessage(){\n\n let subscriptions = App.cable.subscriptions.subscriptions\n let index;\n for (let i = 0; i < subscriptions.length; i++){\n let identifier = JSON.parse(subscriptions[i].identifier)\n if (identifier.channel === \"ChatChannel\"){\n index = i\n break\n }\n }\n\n let message = {\n channel_dms_id: this.props.searchDmId,\n content: this.state.content,\n sender_id: this.state.creatorId,\n created: true\n }\n \n App.cable.subscriptions.subscriptions[index].speak({ message: message})\n this.setState({\n content: \"\"\n })\n this.props.history.push(`/client/${this.props.searchDmId}`)\n }", "constructor(message) {\n super(message.from).then(that => {\n console.info('Starting response to', that.peerId);\n that.constructor.instances[that.peerId] = that; // Keep track for existingInstance.\n that.trackHandler = event => that.channel && that.channel.send(event.track.kind);\n that.peer.addEventListener('track', that.trackHandler);\n that.peer.ondatachannel = event => {\n console.log('Got data channel for', that.peerId);\n const channel = event.channel;\n that.initDataChannel(channel);\n channel.onmessage = event => {\n const message = event.data,\n key = message.slice(0, 4);\n console.log('Got', key, 'from', that.peerId);\n switch (key) {\n case 'ping':\n // Server should not send other people's data, but the peer can.\n channel.send(browserData.ip);\n break;\n case 'data':\n channel.send(message);\n break;\n default:\n console.error('Unrecognized data', message, 'from', that.peerId);\n }\n };\n };\n that[message.type](message.data); // And now act on whatever triggered our creation (e.g., offer).\n return that;\n });\n }", "_generateMessageObj (data) {\n let id = data.id || moment().format('x');\n let from = data.from || '';\n let to = data.to || '';\n let type = data.type || 'chat'; // chat, error, normal, groupchat, or headline\n let body = data.body || '';\n let time = data.time || moment().valueOf();\n let unixTimeMs = ( data.hasOwnProperty('unixTimeMs') ? data.unixTimeMs : moment().valueOf() );\n let name = Strophe.getNodeFromJid(from);\n //\n return {\n id: id,\n from: from,\n name : name,\n to: to,\n type: type,\n body: body,\n time: time,\n unixTimeMs: unixTimeMs,\n };\n }", "function socketio_notify_messageListener(s){\n\t\t//alert(JSON.stringify(s));\n\t\t\t//prep data\n\t\tif(typeof s=='string') s=JSON.parse(s);\n\t\t\t\t//child page refer to multi choice quiz inside an iframe\n\t\t\tif(inIframe() && window && window.parent) window.parent.postMessage({type:'vcn-notifier',data:s},'*');\t//if file this inside frame\n\t\t\telse if(typeof vcn_add_notification=='function'){\t\t//for current site but nerver meet\n\t\t\t\tvcn_create_notifier_ui();\n\t\t\t\tvar item=vcn_create_notification_item(s);\n\t\t\t\tvcn_add_notification(item);\n\t\t\t\tplaySound();\t//play sound\n\t\t\t}\n\t}", "constructor(\n /**\n * browser runtime slot\n */\n pubsub,\n /**\n * components contained in the existing component server.\n */\n context,\n /**\n * port range of the component server.\n */\n portRange,\n /**\n * env dev server.\n */\n devServer) {\n this.pubsub = pubsub;\n this.context = context;\n this.portRange = portRange;\n this.devServer = devServer;\n (0, _defineProperty2().default)(this, \"errors\", void 0);\n (0, _defineProperty2().default)(this, \"hostname\", void 0);\n (0, _defineProperty2().default)(this, \"_port\", void 0);\n (0, _defineProperty2().default)(this, \"createComponentsServerStartedEvent\", (componentsServer, context, hostname, port) => {\n return new (_events().ComponentsServerStartedEvent)(Date.now(), componentsServer, context, hostname, port);\n });\n }", "addMessageChannelEventListener() {\n\t\tself.addEventListener('message', event => {\n\t\t\tif (!this.clientId.isApproved() && event.ports[0]) {\n\t\t\t\t//console.log('@serviceworker !!!ready');\n\t\t\t\tthis.clientId.approved = this.clientId.recent;\n\t\t\t\t// save messageChannel\n\t\t\t\tthis.messageChannel = event.ports[0];\n\t\t\t\tthis.doIntercept.push(event.data); // location.origin\n\t\t\t\tthis.messageChannel.postMessage('!!!ready');\n\t\t\t} else if (event.data && Array.isArray(event.data[0])) {\n\t\t\t\t// execute resolving function\n\t\t\t\t//console.log('@serviceworker got response:', event.data);\n\t\t\t\tconst resolveFuncs = this.resolveMap.get(event.data[0][1]); // key\n\t\t\t\tif (resolveFuncs) {\n\t\t\t\t\tevent.data[1] && Array.isArray(event.data[1]) ? resolveFuncs[0](event.data[1]) : resolveFuncs[1]();\n\t\t\t\t\tthis.resolveMap.delete(event.data[0][1]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function MessageSendingToInDesign() {\r\n\t\r\n\t/**\r\n\t The context in which this snippet can run.\r\n\t @type String\r\n\t*/\r\n\tthis.requiredContext = \"\\tInDesign CS4 must be running.\";\r\n\t$.level = 1; // Debugging level\t\r\n}", "sendVideoMessage( recipientId ) {\n var messageData = {\n recipient: {\n id: recipientId\n },\n message: {\n attachment: {\n type: \"video\",\n payload: {\n url: envVars.SERVER_URL + \"/assets/allofus480.mov\"\n }\n }\n }\n };\n\n this.callSendAPI( messageData );\n }", "function Object_Message() {\n Object_Message.__super__.constructor.apply(this, arguments);\n this.visible = false;\n\n /**\n * The font used for the message text.\n * @property font\n * @type gs.Font\n */\n this.font = new Font(\"Verdana\", Math.round(9 / 240 * Graphics.height));\n this.font.border = false;\n this.font.borderColor = new Color(0, 0, 0);\n\n /**\n * Message specific settings such as auto-erase, wait-at-end, etc.\n * @property settings\n * @type ui.MessageSettings\n */\n this.settings = new ui.MessageSettings();\n\n /**\n * All message paragraphs \n * @property messages\n * @type Object[]\n */\n this.messages = [];\n\n /**\n * The text-renderer used to render the message text.\n * @property textRenderer\n * @type gs.Component_MessageTextRenderer\n */\n this.textRenderer = new gs.Component_MessageTextRenderer();\n\n /**\n * The UI object's animator-component to execute different kind of animations like move, rotate, etc. on it.\n * @property animator\n * @type gs.Component_Animator\n */\n this.animator = new gs.Animator();\n\n /**\n * The UI object's source rectangle on screen.\n * @property srcRect\n * @type gs.Rect\n */\n this.srcRect = new Rect(0, 0, 1, 1);\n this.message = new vn.Component_MessageBehavior();\n\n /**\n * The UI object's component to add message-specific behavior.\n * @property behavior\n * @type vn.Component_MessageBehavior\n */\n this.behavior = this.message;\n this.addComponent(this.animator);\n this.addComponent(this.textRenderer);\n this.addComponent(this.message);\n }", "getWebSocketConnection() {\n throw new Error(\n 'The Message Bus is not currently supported in browser environments'\n );\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0x9f120418;\n this.SUBCLASS_OF_ID = 0x4b5445a9;\n\n this.viewMessages = args.viewMessages || null;\n this.sendMessages = args.sendMessages || null;\n this.sendMedia = args.sendMedia || null;\n this.sendStickers = args.sendStickers || null;\n this.sendGifs = args.sendGifs || null;\n this.sendGames = args.sendGames || null;\n this.sendInline = args.sendInline || null;\n this.embedLinks = args.embedLinks || null;\n this.sendPolls = args.sendPolls || null;\n this.changeInfo = args.changeInfo || null;\n this.inviteUsers = args.inviteUsers || null;\n this.pinMessages = args.pinMessages || null;\n this.untilDate = args.untilDate;\n }", "function InvalidCommunication () {\n DropzoneError.call(this, 'the computed chat messages was invalid')\n}", "static newAndTakeCContext(ctxPtr) {\n // assert(typeof ctxPtr === 'number');\n return new RatchetMessage(ctxPtr);\n }", "function registerMessaging(instance) {\n var messagingName = 'messaging';\n var factoryMethod = function (app) {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n return new __WEBPACK_IMPORTED_MODULE_1__src_controllers_sw_controller__[\"a\" /* default */](app);\n }\n // Assume we are in the window context.\n return new __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */](app);\n };\n var namespaceExports = {\n // no-inline\n Messaging: __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */]\n };\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\n}", "function registerMessaging(instance) {\n var messagingName = 'messaging';\n var factoryMethod = function (app) {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n return new __WEBPACK_IMPORTED_MODULE_1__src_controllers_sw_controller__[\"a\" /* default */](app);\n }\n // Assume we are in the window context.\n return new __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */](app);\n };\n var namespaceExports = {\n // no-inline\n Messaging: __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */]\n };\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\n}", "function registerMessaging(instance) {\n var messagingName = 'messaging';\n var factoryMethod = function (app) {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n return new __WEBPACK_IMPORTED_MODULE_1__src_controllers_sw_controller__[\"a\" /* default */](app);\n }\n // Assume we are in the window context.\n return new __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */](app);\n };\n var namespaceExports = {\n // no-inline\n Messaging: __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */]\n };\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\n}", "function registerMessaging(instance) {\n var messagingName = 'messaging';\n var factoryMethod = function (app) {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n return new __WEBPACK_IMPORTED_MODULE_1__src_controllers_sw_controller__[\"a\" /* default */](app);\n }\n // Assume we are in the window context.\n return new __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */](app);\n };\n var namespaceExports = {\n // no-inline\n Messaging: __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */]\n };\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\n}", "function registerMessaging(instance) {\n var messagingName = 'messaging';\n var factoryMethod = function (app) {\n if (self && 'ServiceWorkerGlobalScope' in self) {\n return new __WEBPACK_IMPORTED_MODULE_1__src_controllers_sw_controller__[\"a\" /* default */](app);\n }\n // Assume we are in the window context.\n return new __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */](app);\n };\n var namespaceExports = {\n // no-inline\n Messaging: __WEBPACK_IMPORTED_MODULE_0__src_controllers_window_controller__[\"a\" /* default */]\n };\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\n}", "function onMessageRecieved(who, msgType, content) {\n\n switch(msgType) {\n case \"telepointer_info\":\n updateTelepointer(content);\n break;\n case \"inform_my_details_to_all_other_clients\":\n addNewClientToAllOccupantsDetails(content);\n updateOnlineStatusOfClients(all_occupants_details);\n\n //update the audio call button label\n updateAudioCallerBtnLabels(all_occupants_details);\n break;\n case \"disconnected\":\n alert(\"Disconnected : \" + content);\n break;\n case \"chat_room_msg\":\n addToChatRoomConversation(content);\n break;\n case \"P2P_MSG\":\n onP2pMsgReceived(content);\n break;\n case \"floor_owner_changed\":\n onFloorOwnerChanged(content);\n break;\n case \"new_floor_request\":\n onNewFloorRequest(content);\n break;\n case \"release_floor\":\n onFloorRelease(content.newFloorOwner);\n break;\n case \"remote_module_addition\":\n onRemoteModuleAddition(content);\n break;\n case \"moduleSettingsChanged\":\n onModuleSettingsChanged(content);\n break;\n case \"remote_draw\":\n remoteAddClick(content);\n break;\n case \"workflow_obj_new_link_drawn\":\n addNewLinkToWorkflowObject(content);\n break;\n case \"workflow_obj_selection_moved\":\n workflowObjSelectionMoved(content);\n break;\n case \"workflow_obj_selection_node_delete\":\n workflowObjRemoveNode(content);\n break;\n case \"workflow_obj_selection_link_delete\":\n workflowObjRemoveLink(content);\n break;\n }\n}", "get message() { return this._message; }", "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}", "connect() {\n throw new Error(\n 'The Message Bus is not currently supported in browser environments'\n );\n }", "handleBusMessages() {\n const bus = this.runtime.bus();\n\n Object.values(REQUESTS).forEach((msgType) => {\n bus.on(msgType, (msgData) => {\n this.sendCommMessage(msgType, msgData);\n });\n });\n }", "static get properties(){return{/**\n * Commands to listen for and take action on\n */commands:{name:\"commands\",type:\"Object\",value:{},observer:\"_commandsChanged\"},/**\n * The name that HAL 9000 should respond to.\n */respondsTo:{name:\"respondsTo\",type:\"String\",value:\"(hal)\",observer:\"_respondsToChanged\"},/**\n * Debug mode for annyang\n */debug:{name:\"debug\",type:\"Boolean\",value:!1,observer:\"_debugChanged\"},/**\n * Start automatically\n */auto:{name:\"auto\",type:\"Boolean\",reflectToAttribute:!0,observer:\"_autoChanged\"},/**\n * Status of listening\n */enabled:{name:\"enabled\",type:\"Boolean\",reflectToAttribute:!0,observer:\"_enabledChanged\"},/**\n * Pitch of speech\n */pitch:{name:\"pitch\",type:\"Number\",reflectToAttribute:!0,value:.9},/**\n * Rate of speech\n */rate:{name:\"rate\",type:\"Number\",reflectToAttribute:!0,value:.9},/**\n * Language of the speaker\n */language:{name:\"language\",type:\"String\",reflectToAttribute:!0,value:\"en-US\"}}}", "sendMessage(obj, to, cb) {\n this.options.body = {\n to: to || \"/topics/global\",\n data: obj\n };\n\n debug(\"Sending GCM request with body:\", this.options.body);\n request(this.options, (error, response, body) => {\n if (error) {\n debug(error);\n return cb(error);\n }\n\n debug(\"GCM request finished with response:\", body);\n // body example:\n // { multicast_id: 6984045616502393000,\n // success: 1,\n // failure: 0,\n // canonical_ids: 0,\n // results: [ { message_id: '0:1467402692743936%7f6d17daf9fd7ecd' } ] }\n\n cb(null);\n });\n }", "initServerSideClient() {\n this._serverSideClient = this._bayeux.getClient();\n this._serverSideClient.subscribe('/chat', (message) => {\n try {\n const msg = JSON.parse(message);\n if (msg) {\n this.events.emit('message', msg);\n }\n else {\n throw new Error('Message bad format');\n }\n }\n catch (e) {\n logger_1.logger.info(`Receive bad message : ${message}`);\n }\n });\n }", "function NotificationController( $log, $q, $scope) {\n var self = this;\n self.message = 'Hello from Web!';\n self.receivedMessages = [];\n\n $log.log(\"INIT\");\n var message = new proton.Message();\n var messenger = new proton.Messenger();\n\n self.send = function () {\n\n $log.log(\"SEND\");\n\n var address = \"amqp://192.168.88.33:5673/amq.fanout\";\n var subject = \"TRANSCRIPT\";\n var body = self.message;\n\n message.setAddress(address);\n message.setSubject(subject);\n message.setContentType(\"text/plain\")\n message.body = body;\n\n messenger.put(message);\n messenger.send();\n\n }\n\n function receive() {\n messenger.setIncomingWindow(1024);\n\n messenger.on('error', function(error) {console.log(error);});\n messenger.on('work', pumpData);\n messenger.recv(); // Receive as many messages as messenger can buffer.\n messenger.start();\n\n messenger.subscribe(\"amqp://192.168.88.33:5673/amq.fanout\");\n }\n\n function pumpData() {\n while (messenger.incoming()) {\n var t = messenger.get(message);\n\n $log.log(\"Address: \" + message.getAddress());\n $log.log(\"Subject: \" + message.getSubject());\n $log.log(\"Id: \" + message.getID());\n\n // body is the body as a native JavaScript Object, useful for most real cases.\n //console.log(\"Content: \" + message.body);\n\n // data is the body as a proton.Data Object, used in this case because\n // format() returns exactly the same representation as recv.c\n $log.log(\"Content: \" + message.data.format());\n self.receivedMessages.push({ id: self.receivedMessages.length, message: message.body});\n $scope.$apply();\n\n messenger.accept(t);\n }\n };\n\n receive();\n\n }", "broadCastMessage(message){\n this.socket.send(message);\n }", "function MessagingResponse() {\n this.response = builder.create('Response').dec('1.0', 'UTF-8');\n}", "function registerMessaging(instance) {\r\n var messagingName = 'messaging';\r\n var factoryMethod = function (app) {\r\n if (!isSupported()) {\r\n throw errorFactory.create(ERROR_CODES.UNSUPPORTED_BROWSER);\r\n }\r\n if (self && 'ServiceWorkerGlobalScope' in self) {\r\n // Running in ServiceWorker context\r\n return new SwController(app);\r\n }\r\n else {\r\n // Assume we are in the window context.\r\n return new WindowController(app);\r\n }\r\n };\r\n var namespaceExports = {\r\n isSupported: isSupported\r\n };\r\n instance.INTERNAL.registerService(messagingName, factoryMethod, namespaceExports);\r\n}", "constructor() { \n \n QuotedMessageMessage.initialize(this);\n }", "constructor(id, name, send_signal, wrtc) {\n super()\n\n this.id = id\n this.name = name\n this.self = (send_signal == undefined)\n this.send_signal = send_signal\n this.queue = []\n\n this.on('connect', () => {\n if (this.connected()) {\n while (this.queue.length > 0) {\n this.send(this.queue.shift())\n }\n }\n })\n\n // we're in electron/browser\n if (typeof window != 'undefined') {\n this.wrtc = {\n RTCPeerConnection: RTCPeerConnection,\n RTCIceCandidate: RTCIceCandidate,\n RTCSessionDescription: RTCSessionDescription\n }\n }\n // byowebrtc <- this is for node and could undoubtedly be better handled\n else if (wrtc) {\n this.wrtc = wrtc\n }\n else {\n console.log(\"wrtc\", wrtc)\n throw new Error(\"wrtc needs to be set in headless mode\")\n }\n \n this.WebRTCConfig = {\n 'iceServers': [\n {url:'stun:stun.l.google.com:19302'},\n {url:'stun:stun1.l.google.com:19302'},\n {url:'stun:stun2.l.google.com:19302'},\n {url:'stun:stun3.l.google.com:19302'},\n {url:'stun:stun4.l.google.com:19302'}\n ]\n }\n\n // I'm not sure this should be here, but we call it literally\n // every time we instantiate a Peer(), so let's leave it here for now\n if(!this.self) this.initializePeerConnection()\n }", "constructor({ proxy, messageBuffer, messageBufferFillPercentage, communicator } = {}) {\n super();\n\n const me = this;\n\n me.proxy = proxy;\n me.messageBuffer = messageBuffer;\n me.messageBufferFillPercentage = messageBufferFillPercentage;\n me.communicator = communicator;\n }", "onMessage() {}", "onMessage() {}", "SendMessage() {}", "SendMessage() {}", "SendMessage() {}", "SendMessage() {}", "function _subscribe() {\n\n _comapiSDK.on(\"conversationMessageEvent\", function (event) {\n console.log(\"got a conversationMessageEvent\", event);\n if (event.name === \"conversationMessage.sent\") {\n $rootScope.$broadcast(\"conversationMessage.sent\", event.payload);\n }\n });\n\n _comapiSDK.on(\"participantAdded\", function (event) {\n console.log(\"got a participantAdded\", event);\n $rootScope.$broadcast(\"participantAdded\", event);\n });\n\n _comapiSDK.on(\"participantRemoved\", function (event) {\n console.log(\"got a participantRemoved\", event);\n $rootScope.$broadcast(\"participantRemoved\", event);\n });\n\n _comapiSDK.on(\"conversationDeleted\", function (event) {\n console.log(\"got a conversationDeleted\", event);\n $rootScope.$broadcast(\"conversationDeleted\", event);\n });\n\n }", "function onconnect(msg) { // called when a new SharedWorker is created.\r\tvar promoteToken = currentSession().promoteWith(\"Internal\"); //temporarily make this session Internal level.\r\t // In a SharedWorker, we get the communication port in evt.ports[0]\r var thePort = msg.ports[0];\r \r thePort.onmessage = function(messageEvt)\r {\r\t\t// The message is in the \"data\" member of the argument\r\t var message = messageEvt.data;\r\t \t// The caller is supposed to have set a \"what\" property, to tell us what\r\t \t// he wants us to do. We dispatch the message and act accordingly.\r\t \t// Notice that the caller can set more properties in messageEvt.\r\t \t\r\t \tswitch(message.what) \r\t {\r\t\t\tcase 'requestPTOSendMail':\r\t\t\ttry \r {\r \tvar requestorID = message.requestorID,\r \t\ttheRequestor = ds.User(requestorID);\r \t\r \tif (theRequestor.myManager) {\r \t\tvar requestID = message.requestID,\r \t\tmyManager = theRequestor.myManager,\r \t\tmyManagerEmail = myManager.email,\r \t\tapprovePassword = message.approvePassword,\r approveID = message.approveID,\r\t\t \tusername = 'wakandaptodemo', // enter a valid account here\r\t\t \tpassword = '01Wakanda01', // enter a valid password here\r\t\t \taddress = 'smtp.gmail.com',\r\t\t \tport = 465, // SSL port\r\t\t \tmail = require('waf-mail/mail'),\r\t\t \trecip = new Array(myManagerEmail), //recip = \"drobbins@4d.com\",\r\t\t \tres = null,\r\t\t \tmessageBody = \"\",\r\t\t \tmailMessage = new mail.Mail(),\r\t\t \t\r\t\t \t//192.241.155.204\r\t\t \t\r//\t\t \tptoApprovalURL = \"http://127.0.0.1:8081/ptoApproval/\" + requestID + \"/\" + approvePassword + \"/\" + approveID + \"/approve\";\r//\t\t \tptoRejectURL = \"http://127.0.0.1:8081/ptoApproval/\" + requestID + \"/\" + approvePassword + \"/\" + approveID + \"/reject\";\r\r\t\t \tptoApprovalURL = \"http://192.241.155.204:8081/ptoApproval/\" + requestID + \"/\" + approvePassword + \"/\" + approveID + \"/approve\";\r\t\t \tptoRejectURL = \"http://192.241.155.204:8081/ptoApproval/\" + requestID + \"/\" + approvePassword + \"/\" + approveID + \"/reject\";\r\t\t \t\r\t\t\t\t\t//ptoApprovalURL = \"http://\" + httpServer.ipAddress + \":\" + httpServer.port + \"/ptoApproval/\" + requestID + \"/\" + approvePassword + \"/\" + approveID + \"/approve\";\r\t\t \t//ptoRejectURL = \"http://\" + httpServer.ipAddress + \":\" + httpServer.port + \"/ptoApproval/\" + requestID + \"/\" + approvePassword + \"/\" + approveID + \"/reject\";\r\r\t\t \r\t\t\t //message body start\r\t messageBody = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\t\r\t messageBody += '<html xmlns=\"http://www.w3.org/1999/xhtml\">';\r\t messageBody += '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>';\r\t messageBody += '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />';\r\t messageBody += '<title>PTO Request</title>';\r\t messageBody += '<style type=\"text/css\">';\r\t messageBody += 'a {';\r\t messageBody += 'text-decoration: none;';\r\t messageBody += 'font-weight: bold;';\r\t messageBody += 'color: #6699CC;';\r\t messageBody += '}';\r\t \r\t messageBody += '#wrapDiv {';\r\t messageBody += 'width: 100%;';\r\t messageBody += 'background-color:#FFFFFF;';\r\t messageBody += 'border:1px solid #DFDFDF;';\r\t messageBody += 'padding: 3px;';\r\t messageBody += 'color: #202020;';\r\t messageBody += 'font-size: 14px;';\r\t messageBody += '}';\r\r\t messageBody += '#bannerDiv {';\r\t messageBody += 'background-color:#B0C4DE;';\r\t messageBody += 'color: #FFFFFF;';\r\t messageBody += 'padding: 5px 12px;';\r\t messageBody += 'font-size:22px;';\r\t messageBody += '}';\r\t \r\t messageBody += '#messageDiv {';\r\t messageBody += 'padding: 10px';\r\t messageBody += '}';\r\t messageBody += '</style>';\r\t messageBody += '<head>';\r\t messageBody += '</head>';\r\t \r\t \r\t messageBody += '<body>';\r\t messageBody += '<div id=\"wrapDiv\">';\r\t \r\t messageBody += '<div id=\"bannerDiv\">';\r\t messageBody += '<p>4D US - Paid Time Off Request</p>';\r\t messageBody += '</div>';\r\t \r\t messageBody += '<div id=\"messageDiv\">';\r\t messageBody += '<p>';\r\t messageBody += myManager.fullName + \",\" ;\r\t messageBody += '</p>';\r\t messageBody += '<p>';\r\t messageBody += '<strong>';\r\t messageBody += theRequestor.fullName;\r\t messageBody += '</strong>';\r\t messageBody += \" has requested \" + message.hours + \" hours \" + message.comp + \" on \";\r\t messageBody += PTO.moment(message.dateString).format('dddd') + \" \" + message.dateString + \".\";\r\t //messageBody += '</br>(request id: ' + requestID + ')<br/>';\r\t messageBody += '</p>';\r\t \r\t \r\t messageBody += '<p>';\r\t messageBody += '<a href=\"' + ptoRejectURL + '\">Reject PTO</a>';\r\t messageBody += '</p>';\r\t \r\t messageBody += '<p>';\r\t messageBody += '<a href=\"' + ptoApprovalURL + '\">Approve PTO</a>';\r\t messageBody += '</p>';\r\t \r\t \r\t \r\t messageBody += '<p>';\r\t messageBody += '(request id: ' + requestID + ')';\r\t messageBody += '</p>';\r\t \r\t \r\t messageBody += '</div>'; //messageDiv\r\t \r\t messageBody += '</div>';//wrapDiv\r\t messageBody += '</body>';\r\t messageBody += '</html>';\r\t //message body end\r\t \r\t\t\t mailMessage.setBodyType(\"text/html\");\r\t\t\t mailMessage.from= username + '@gmail.com';\r\t\t\t mailMessage.to=recip;\r\t\t\t mailMessage.subject = \"PTO Request from \" + theRequestor.fullName + \".\";\r\t\t\t mailMessage.setBodyTypeToHTML();\r\t\t\t mailMessage.setBody(messageBody); \r\t\t\t res = mailMessage.send(address, port , true, username, password);\r\t\t\t \t} //end - if (theRequestor.myManager).\r\t\t\t} \r\t\t\t\r\t\t\tcatch (err)\r { \r\t new ds.Log({\r\t createDate: new Date(), \r\t kind: \"throw error\",\r\t errorMsg: err.message,\r\t dataClassName: \"Email Daemon\",\r\t userName: \"Email Daemon\"\r\t }).save();\r }\r\t break;\r\t \r\t \r\t \r\t \r\t \r\t \r\t \r\t \tcase 'statusPTOSendMail':\r\t \ttry \r {\r \t/*\r\t \t\tnew ds.Log({\r\t createDate: new Date(), \r\t kind: \"status no error\",\r\t dataClassName: \"Status Email Daemon\",\r\t userName: \"Status Email Daemon\"\r\t }).save();\r\t */\r\t \r\t var requestStatus = message.requestStatus,\r\t \t\t\trequestID = message.requestID,\r\t \t\t\trequestorID = message.requestorID;\r\t \t\t\t\r \t\t\t\r\t \r \t\t\tvar theRequestor = ds.User(requestorID);\r \t\t\t\r \t\t\tvar theRequestorEmail = theRequestor.email,\r \t\t\tusername = 'wakandaptodemo', // enter a valid account here\r\t \tpassword = '01Wakanda01', // enter a valid password here\r\t \taddress = 'smtp.gmail.com',\r\t \tport = 465, // SSL port\r\t \tmail = require('waf-mail/mail'),\r\t \trecip = new Array(theRequestorEmail),\r\t \tres = null,\r\t \tmessageBody = \"\";\r\t \t\r\t \tvar mailMessage = new mail.Mail();\r\t \t\r\t \tmessageBody = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\t\r messageBody += '<html xmlns=\"http://www.w3.org/1999/xhtml\">';\r messageBody += '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>';\r messageBody += '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />';\r messageBody += '<title>PTO Request</title>';\r messageBody += '<style type=\"text/css\">';\r messageBody += 'a {';\r messageBody += 'text-decoration: none;';\r messageBody += 'font-weight: bold;';\r messageBody += 'color: #6699CC;';\r messageBody += '}';\r \r messageBody += '#wrapDiv {';\r messageBody += 'width: 100%;';\r messageBody += 'background-color:#FFFFFF;';\r messageBody += 'border:1px solid #DFDFDF;';\r messageBody += 'padding: 3px;';\r messageBody += 'color: #202020;';\r messageBody += 'font-size: 14px;';\r messageBody += '}';\r\r messageBody += '#bannerDiv {';\r messageBody += 'background-color:#B0C4DE;';\r messageBody += 'color: #FFFFFF;';\r messageBody += 'padding: 5px 12px;';\r messageBody += 'font-size:22px;';\r messageBody += '}';\r \r messageBody += '#messageDiv {';\r messageBody += 'padding: 10px';\r messageBody += '}';\r messageBody += '</style>';\r messageBody += '<head>';\r messageBody += '</head>';\r \r \r messageBody += '<body>';\r messageBody += '<div id=\"wrapDiv\">';\r \r messageBody += '<div id=\"bannerDiv\">';\r messageBody += '<p>4D US - Paid Time Off Request</p>';\r messageBody += '</div>';\r \r messageBody += '<div id=\"messageDiv\">';\r messageBody += '<p>';\r messageBody += theRequestor.fullName + \",\" ;\r messageBody += '</p>';\r messageBody += '<p>';\r messageBody += \" Your request for \" + message.hours + \" hours \" + message.comp + \" on \";\r messageBody += PTO.moment(message.dateString).format('dddd') + \" \" + message.dateString + \" has been \" + requestStatus + \".\";\r messageBody += '</br>(request id: ' + requestID + ')<br/>';\r messageBody += '</p>';\r \r messageBody += '</div>'; //messageDiv\r \r messageBody += '</div>';//wrapDiv\r messageBody += '</body>';\r messageBody += '</html>';\r //message body end\r \r mailMessage.setBodyType(\"text/html\");\r\t\t mailMessage.from= username + '@gmail.com';\r\t\t mailMessage.to=recip;\r\t\t mailMessage.subject = \"Your PTO Request for \" + message.dateString + \" has been \" + requestStatus + \".\";\r\t\t mailMessage.setBodyTypeToHTML();\r\t\t mailMessage.setBody(messageBody); \r\t\t res = mailMessage.send(address, port , true, username, password);\t\r \t\t\t\r\t \t} \r\t \t\r\t \t\r\t \tcatch (e)\r { \r\t new ds.Log({\r\t createDate: new Date(), \r\t kind: \"status throw error\",\r\t errorMsg: e.message,\r\t dataClassName: \"Status Email Daemon\",\r\t userName: \"Status Email Daemon\"\r\t }).save();\r }\r\t \t\r\t /*\r\t \ttry\r\t \t{\r\t \t\tvar requestStatus = message.requestStatus,\r\t \t\t\trequestID = message.requestID,\r\t \t\t\trequestorID = message.requestorID;\r\t \t\t\t\r \t\t\t\r\t \r \t\t\tvar theRequestor = ds.User(requestorID);\r \t\t\t\r \t\t\tnew ds.Log({\r\t createDate: new Date(), \r\t kind: \"throw error 200\",\r\t errorMsg: err.message,\r\t dataClassName: \"Email Daemon\",\r\t userName: \"Email Daemon\",\r\t dataClassName: requestID\r\t }).save();\r \t\t\t\r \t\t\tvar theRequestorEmail = theRequestor.email,\r \t\t\tusername = 'wakandaptodemo', // enter a valid account here\r\t \tpassword = '01Wakanda01', // enter a valid password here\r\t \taddress = 'smtp.gmail.com',\r\t \tport = 465, // SSL port\r\t \tmail = require('waf-mail/mail'),\r\t \trecip = new Array(theRequestorEmail),\r\t \tres = null,\r\t \tmessageBody = \"\";\r\t \t\r\t \t\r\t \tnew ds.Log({\r\t createDate: new Date(), \r\t kind: \"throw error 300\",\r\t errorMsg: err.message,\r\t dataClassName: \"Email Daemon\",\r\t userName: \"Email Daemon\",\r\t dataClassName: requestID\r\t }).save();\r\t \t\r\t \tvar mailMessage = new mail.Mail();\r\t \t\r\t \tnew ds.Log({\r\t createDate: new Date(), \r\t kind: \"throw error 400\",\r\t errorMsg: err.message,\r\t dataClassName: \"Email Daemon\",\r\t userName: \"Email Daemon\",\r\t dataClassName: requestID\r\t }).save();\r \t\t\t\r \t\t\t//message body start\r messageBody = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\t\r messageBody += '<html xmlns=\"http://www.w3.org/1999/xhtml\">';\r messageBody += '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>';\r messageBody += '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />';\r messageBody += '<title>PTO Request</title>';\r messageBody += '<style type=\"text/css\">';\r messageBody += 'a {';\r messageBody += 'text-decoration: none;';\r messageBody += 'font-weight: bold;';\r messageBody += 'color: #6699CC;';\r messageBody += '}';\r \r messageBody += '#wrapDiv {';\r messageBody += 'width: 100%;';\r messageBody += 'background-color:#FFFFFF;';\r messageBody += 'border:1px solid #DFDFDF;';\r messageBody += 'padding: 3px;';\r messageBody += 'color: #202020;';\r messageBody += 'font-size: 14px;';\r messageBody += '}';\r\r messageBody += '#bannerDiv {';\r messageBody += 'background-color:#B0C4DE;';\r messageBody += 'color: #FFFFFF;';\r messageBody += 'padding: 5px 12px;';\r messageBody += 'font-size:22px;';\r messageBody += '}';\r \r messageBody += '#messageDiv {';\r messageBody += 'padding: 10px';\r messageBody += '}';\r messageBody += '</style>';\r messageBody += '<head>';\r messageBody += '</head>';\r \r \r messageBody += '<body>';\r messageBody += '<div id=\"wrapDiv\">';\r \r messageBody += '<div id=\"bannerDiv\">';\r messageBody += '<p>4D US - Paid Time Off Request</p>';\r messageBody += '</div>';\r \r messageBody += '<div id=\"messageDiv\">';\r messageBody += '<p>';\r messageBody += theRequestor.fullName + \",\" ;\r messageBody += '</p>';\r messageBody += '<p>';\r messageBody += \" Your request for \" + message.hours + \" hours \" + message.comp + \" on \";\r messageBody += PTO.moment(message.dateString).format('dddd') + \" \" + message.dateString + \" has been \" + requestStatus + \".\";\r messageBody += '</br>(request id: ' + requestID + ')<br/>';\r messageBody += '</p>';\r \r messageBody += '</div>'; //messageDiv\r \r messageBody += '</div>';//wrapDiv\r messageBody += '</body>';\r messageBody += '</html>';\r //message body end\r \r mailMessage.setBodyType(\"text/html\");\r\t\t mailMessage.from= username + '@gmail.com';\r\t\t mailMessage.to=recip;\r\t\t mailMessage.subject = \"Your PTO Request for \" + message.dateString + \" has been \" + requestStatus + \".\";\r\t\t mailMessage.setBodyTypeToHTML();\r\t\t mailMessage.setBody(messageBody); \r\t\t res = mailMessage.send(address, port , true, username, password);\t\r\t \t}\r\t \t\r\t \tcatch (err)\r { \r\t new ds.Log({\r\t createDate: new Date(), \r\t kind: \"throw error\",\r\t errorMsg: err.message,\r\t dataClassName: \"Email Daemon Status\",\r\t userName: \"Email Daemon Status\"\r\t }).save();\r }\r */\r\t break;\r\t \r\t \r\t \r\t\t} //end - switch(message.what). \r } //end - thePort.onmessage = function(messageEvt). \r \r\tcurrentSession().unPromote(promoteToken); //put the session back to normal. \r} //end - function onconnect(msg).", "getMessages() { return this._messages; }", "getMessages() { return this._messages; }", "constructor(msg, options={}) {\n this._msg = msg;\n this._options = options;\n Object.freeze(this);\n }" ]
[ "0.61389846", "0.55454636", "0.5482138", "0.54554975", "0.54206866", "0.5387298", "0.53735256", "0.53735256", "0.53735256", "0.53735256", "0.53557914", "0.53556335", "0.5337448", "0.53085494", "0.53010654", "0.53010654", "0.52676386", "0.52588576", "0.5256887", "0.5248511", "0.5232467", "0.52274233", "0.5223724", "0.51965725", "0.5173698", "0.51640946", "0.5154463", "0.5138014", "0.5132041", "0.51304626", "0.5130109", "0.5129703", "0.5114249", "0.510015", "0.5087166", "0.50822943", "0.50718784", "0.5069918", "0.5053251", "0.5048826", "0.50424767", "0.5032142", "0.5025522", "0.50255114", "0.50093424", "0.5004932", "0.5004932", "0.5004932", "0.50045997", "0.50017476", "0.49947464", "0.4991694", "0.49861577", "0.49861577", "0.4985132", "0.49827385", "0.496624", "0.4960608", "0.49577883", "0.4957552", "0.49481547", "0.4945895", "0.49430403", "0.49354756", "0.49350265", "0.4926627", "0.4925414", "0.49232826", "0.49215308", "0.49156743", "0.49156743", "0.49156743", "0.49156743", "0.49156743", "0.49123353", "0.49004647", "0.4898906", "0.48966122", "0.4896092", "0.48905542", "0.4885047", "0.48836014", "0.48754022", "0.48737577", "0.48731646", "0.4872593", "0.48711658", "0.48693419", "0.4858846", "0.485819", "0.485819", "0.4855818", "0.4855818", "0.4855818", "0.4855818", "0.48504904", "0.4849109", "0.48463276", "0.48463276", "0.48426747" ]
0.7466156
0
An endpoint (network accessible address) to which messages and/or replies are to be sent.
get endpoint() { return this.__endpoint; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get endpoint () {\n\t\treturn this._endpoint;\n\t}", "address() {\n const address = this.server.address();\n const endpoint = typeof address !== \"string\"\n ? (address.address === \"::\" ? \"localhost\" : address.address) + \":\" + address.port\n : address;\n return `${this.protocol}://${endpoint}`;\n }", "get endpoint() {\n return this.getStringAttribute('endpoint');\n }", "get endpoint() {\n return this.getStringAttribute('endpoint');\n }", "get endpoint() {\n return this.getStringAttribute('endpoint');\n }", "function replyToSpec() {\n return wrap('reply-to', addressList());\n }", "function replyToSpec() {\n return wrap('reply-to', addressList());\n }", "function replyToSpec() {\n return wrap('reply-to', addressList());\n }", "function replyToSpec() {\n return wrap('reply-to', addressList());\n }", "endpoint() {\n //\n }", "function EndpointImpl() {\n\t\tvar endpointImpl = this;\n\t\tvar config = {};\n\t\tvar cometd = null; // current cometd instance\n\t\tvar connected = false;\n\t\tvar connectCalled = false; // for automatic connect on first use\n\n\t\t// FeedImpl attachment points\n\t\tthis.onStateChange = null;\n\t\tthis.onData = null;\n\n\t\t// ----- private endpointImpl methods -----\n\n\t\tfunction debug(msg) {\n\t\t\tif (config.logLevel === \"debug\" && console && console.log)\n\t\t\t\tconsole.log(msg);\n\t\t}\n\n\t\tfunction info(msg) {\n\t\t\tif (console && console.info)\n\t\t\t\tconsole.info(msg);\n\t\t}\n\n\t\tfunction warn(msg) {\n\t\t\tif (console && console.warn)\n\t\t\t\tconsole.warn(msg);\n\t\t}\n\n\t\tfunction convertToAbsoluteURL(url) {\n\t\t\tif (/^https?:\\/\\//i.test(url))\n\t\t\t\treturn url;\n\t\t\tif (/^\\/\\//.test(url))\n\t\t\t\treturn location.protocol + url;\n\t\t\tif (/^\\//.test(url))\n\t\t\t\treturn location.protocol + \"//\" + location.host + url;\n\t\t\treturn location.protocol + \"//\" + location.host + location.pathname + url;\n\t\t}\n\n\t\tfunction updateConnectedState(newConnected) {\n\t\t\tvar wasConnected = connected;\n\t\t\tif (wasConnected !== newConnected) {\n\t\t\t\tinfo(wasConnected ? \"Connection lost\" : \"Connection established\");\n\t\t\t\tconnected = newConnected;\n\t\t\t\tendpointImpl.onStateChange({ connected: newConnected });\n\t\t\t}\n\t\t}\n\n\t\t// Function that manages the connection status with the Bayeux server\n\t\tfunction onMetaConnect(message) {\n\t\t\tif (cometd === null || cometd.isDisconnected()) {\n\t\t\t\tupdateConnectedState(false);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tupdateConnectedState(message.successful === true);\n\t\t}\n\n\t\tfunction onMetaUnsuccessful() {\n\t\t\tupdateConnectedState(false)\n\t\t}\n\n\t\tfunction onServiceState(message) {\n\t\t\tdebug(\"Received state \" + JSON.stringify(message));\n\t\t\tendpointImpl.onStateChange(message.data);\n\t\t}\n\n\t\tfunction onServiceData(message) {\n\t\t\tdebug(\"Received data \" + JSON.stringify(message));\n\t\t\tendpointImpl.onData(message.data, false);\n\t\t}\n\n\t\tfunction onServiceTimeSeriesData(message) {\n\t\t\tdebug(\"Received time series data \" + JSON.stringify(message));\n\t\t\tendpointImpl.onData(message.data, true);\n\t\t}\n\n\t\tfunction connect(url) {\n\t\t\tconnectCalled = true;\n\t\t\tif (!org.CometD) {\n\t\t\t\twarn(\"No CometD, working without connection\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (config.url === undefined && dx.contextPath !== undefined)\n\t\t\t\tconfig.url = dx.contextPath + \"/cometd\"; // default webservice path\n\t\t\tif (typeof url === \"string\") {\n\t\t\t\tconfig.url = url;\n\t\t\t} else if (typeof url === \"object\") {\n\t\t\t\tconfig = extend(config, url);\n\t\t\t}\n\t\t\tconfig.url = convertToAbsoluteURL(config.url);\n\t\t\tinfo(\"Connecting with url: \" + config.url);\n\t\t\tif (cometd === null) {\n\t\t\t\tcometd = new org.CometD();\n\t\t\t\tcometd.addListener(\"/meta/connect\", onMetaConnect);\n\t\t\t\tcometd.addListener(\"/meta/unsuccessful\", onMetaUnsuccessful);\n\t\t\t\tcometd.addListener(\"/service/state\", onServiceState);\n\t\t\t\tcometd.addListener(\"/service/data\", onServiceData);\n\t\t\t\tcometd.addListener(\"/service/timeSeriesData\", onServiceTimeSeriesData);\n\t\t\t}\n\t\t\tcometd.configure(config);\n\t\t\tcometd.handshake();\n\t\t}\n\n\t\t// ----- public endpointImpl methods -----\n\n\t\tthis.logLevel = function (level) {\n\t\t\tconfig.logLevel = level;\n\t\t};\n\n\t\tthis.isConnected = function () {\n\t\t\treturn connected;\n\t\t};\n\n\t\tthis.connect = connect;\n\n\t\tthis.disconnect = function () {\n\t\t\tif (cometd !== null) {\n\t\t\t\tinfo(\"Disconnecting\");\n\t\t\t\tcometd.disconnect(true);\n\t\t\t\tcometd = null;\n\t\t\t\tconnected = false;\n\t\t\t}\n\t\t};\n\n\t\tthis.publish = function (service, message) {\n\t\t\tdebug(\"Publishing to \" + service + \": \" + JSON.stringify(message));\n\t\t\tcometd.publish(\"/service/\" + service, message);\n\t\t};\n\n\t\tthis.connectIfNeeded = function () {\n\t\t\tif (!connectCalled)\n\t\t\t\tconnect();\n\t\t};\n\t}", "function deriveEndpoint(edge, index, ep, conn) {\n return options.deriveEndpoint ? options.deriveEndpoint(edge, index, ep, conn) : options.endpoint ? options.endpoint : ep.type;\n }", "get primaryEndpointAddress() {\n return this.getStringAttribute('primary_endpoint_address');\n }", "getPeerAddr() {\n\t\tvar addr = null;\n\t\tif(this._ep) {\n\t\t\taddr = this._ep._endpoint.addr;\n\t\t}\n\n\t\treturn addr;\n\t}", "function setupEndpoint() {\n if (host.val().indexOf('/') != -1) {\n var hostArr = host.val().split('/');\n\n path = \"http://\" + hostArr[0] + \":\" + port.val();\n hostArr.shift(); // remove host\n\n if (hostArr.length > 0) { // anything left?\n path += \"/\" + hostArr.join('/');\n }\n } else {\n path = \"http://\" + host.val() + \":\" + port.val();\n }\n endpoint = path;\n }", "function createConnection () {\n connection = App.models.endpoint({\n id: options.connectTo,\n client: client,\n onMessage: renderReply\n });\n }", "get readerEndpointAddress() {\n return this.getStringAttribute('reader_endpoint_address');\n }", "registerDeviceEndpoint() {\n this.SNS = new AWS.SNS();\n return this.SNS.createPlatformEndpoint({\n Token: this.deviceId,\n PlatformApplicationArn: this.applicationArn\n }, (err, data) => {\n if (err) {\n console.log('error registering device', err);\n return;\n }\n\n const params = {\n Protocol: 'application',\n TopicArn: this.topicArn,\n Endpoint: data.EndpointArn\n };\n\n this.subscribeToTopic(params);\n });\n }", "addEndpoint(options = {}) {\n const state = this[kInternalState];\n if (this.destroyed)\n throw new ERR_INVALID_STATE('QuicSocket is already destroyed');\n if (state.state !== kSocketUnbound)\n throw new ERR_INVALID_STATE('QuicSocket is already being bound');\n\n options = {\n lookup: state.lookup,\n ...options\n };\n\n const endpoint = new QuicEndpoint(this, options);\n state.endpoints.add(endpoint);\n return endpoint;\n }", "function configureEndpoint() {\n\tif(!o().isEndpoint()) {\n\t\to().config({\n\t\t\tendpoint:'http://services.odata.org/V4/%28S%28wptr35qf3bz4kb5oatn432ul%29%29/TripPinServiceRW/',\n\t\t\tversion:4,\n\t\t\tstrictMode:true\n\t\t});\n\t}\n}", "get configurationEndpointAddress() {\n return this.getStringAttribute('configuration_endpoint_address');\n }", "function _getEndpointUri(endpoint) {\n return _endpoint.gebo + _endpoint[endpoint];\n }", "function endpoint(path, method) {\n function Endpoint(path, method) {\n this.path = path;\n this.method = method;\n }\n allEndpoints.push( new Endpoint(path, method) );\n}", "function sendOneToOneNegotiation(type, endpoint, sdp){\n var jsonSend = { protocol: \"one-to-one\", room: room, from: client, endpoint: endpoint, action: type, data: sdp};\n ws.send(JSON.stringify(jsonSend));\n }", "_attachEndpoint(func, endpoint) {\n\t\t// Validate method and path\n\t\t/* istanbul ignore next */\n\t\tif (!endpoint.method || !endpoint.path) {\n\t\t\treturn this.log(\n\t\t\t\t`Endpoint ${endpoint.type} for function ${func.name} has no method or path`\n\t\t\t)\n\t\t}\n\t\t// Add HTTP endpoint to Express\n\t\tthis.app[endpoint.method.toLowerCase()](\n\t\t\tendpoint.path,\n\t\t\t(request, response) => {\n\t\t\t\tthis.log(`${endpoint}`)\n\t\t\t\t// Execute Lambda with corresponding event, forward response to Express\n\t\t\t\tlet lambdaEvent = endpoint.getLambdaEvent(request)\n\t\t\t\tthis._executeLambdaHandler(func, lambdaEvent)\n\t\t\t\t\t.then(result => {\n\t\t\t\t\t\tthis.log(' ➡ Success')\n\t\t\t\t\t\tif (process.env.SLS_DEBUG) console.info(result)\n\t\t\t\t\t\tendpoint.handleLambdaSuccess(response, result)\n\t\t\t\t\t})\n\t\t\t\t\t.catch(error => {\n\t\t\t\t\t\tthis.log(` ➡ Failure: ${error.message}`)\n\t\t\t\t\t\tif (process.env.SLS_DEBUG) console.error(error.stack)\n\t\t\t\t\t\tendpoint.handleLambdaFailure(response, error)\n\t\t\t\t\t})\n\t\t\t}\n\t\t)\n\t}", "function address(node) {\n return node.broadcast_address + ':' + node.tcp_port;\n}", "addPayloadEndpoint(opts) {\n if (this.event.payload.endpoints === undefined) this.event.payload.endpoints = [];\n\n this.event.payload.endpoints.push(this.createPayloadEndpoint(opts));\n }", "get URI() {\n\t\treturn 'exchange://' + this.username + '@' + this.hostname + this.name;\n\t}", "function printEndpoint(method, name, payload, params){\n console.log(\"\\n========== ========== ==========\");\n console.log(method + \" \" + name);\n console.log(\"PAYLOAD: \", payload);\n console.log(\"PARAMS: \", params);\n console.log(\"========== ========== ==========\");\n}", "function showEndpoint(response){\n}", "listen() {\n let others = this._context._services.get(this.name, this.type).filter(entry => {\n return entry.address == this.address;\n });\n if (others.length) {\n for (let node of others) {\n this.socket.connect(node.address);\n }\n }\n this.socket.bind(this.node.host + ':' + this.port);\n }", "registerEndpoint(fn, options)\n {\n if (!fn) throw new Error('Must include a function to register endpoint');\n\n options.modelName = this.modelName;\n const endpoint = buildEndpoint(this, options, fn);\n if (!options.private) this.publicEndpoints.push(endpoint);\n this[options.name] = fn;\n }", "function r(e){return e.socket?e.socket.remoteAddress:e.connection.remoteAddress}", "set endpoint(endpoint) {\n\t\tif (Array.isArray(endpoint)) {\n\t\t\tthis._endpoint = endpoint.map((i) => new Reference(i));\n\t\t} else {\n\t\t\tthis._endpoint = [new Reference(endpoint)];\n\t\t}\n\t}", "function sendOffer(){\n\tconsole.log('offer sent')\n\tconsole.log(peerID);\n\tsignalServer.send(JSON.stringify({\"sessionDescriptionProtocol\": peerConnection[currentPeer].localDescription, \"peerID\": peerID, \"senderID\": senderID, \"sendTo\": currentPeer}));\n}", "get addr() { return this._addr; }", "makeEndpoint(schema) {\n return (options) => {\n const ep = new endpoint_1.Endpoint(options);\n ep.applySchema(ep, schema, schema, ep);\n return ep;\n };\n }", "get listenerAddress() {\n return this._listenerAddress;\n }", "function getEndpoint(chainId) {\n return linkIsDetached(chainId) ? null : [nodeData.xx[chainId], nodeData.yy[chainId]];\n }", "setListener(endpoint, callback) {\n this.socket.on(endpoint, callback);\n }", "get baseEndpoint() {\n return this._baseEndpoint;\n }", "constructor(endpoint, options) {\n super(endpoint, options);\n this.communicationIdentity = new CommunicationIdentity$1(this);\n }", "sendOnPort(portNum) {\n this._sendingPort = portNum;\n }", "sendMessage(msg, address) {\n let message = Buffer.from(msg);\n this.socket.send(message, this._sendingPort, address);\n }", "function start_listening() {\n\n\t// Endpoint to send one way messages to the team. If a message is important it will appear on a user's feed\n\tthis.server.get('api/messages/send/team', (req, res) => {\n\n\t\tvar address = addresses[decodeURIComponent(req.params.id)];\n\t\tvar type = (typeof req.params.type === 'string') ? req.params.type : 'text';\n\t\tvar isImportant = (typeof req.params.isImportant === 'string' && req.params.isImportant === 'true') ? true : false;\n\n\t\tif (!address) {\n\t\t\tres.send('Sorry cannot find your bot, please re-add the app');\n\t\t\tres.end();\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.log(`Sending Message to team: isImportant=${isImportant}`);\n\n\t\ttry {\n\n\t\t\tvar quote = faker.fake(\"{{lorem.sentence}}\");\n\t\t\tvar msg = new builder.Message().address(address);\n\t\t\tif (isImportant) msg.channelData = { notification: { alert: 'true' } };\n\n\t\t\tif (type === 'text') msg.text(quote);\n\t\t\tif (type === 'hero') msg.addAttachment(utils.createHeroCard(builder));\n\t\t\tif (type === 'thumb') msg.addAttachment(utils.createThumbnailCard(builder));\n\n\t\t\tif (type === 'text') res.send('Look on MS Teams, just sent: ' + quote);\n\t\t\tif (type === 'hero') res.send('Look on MS Teams, just sent a Hero card');\n\t\t\tif (type === 'thumb') res.send('Look on MS Teams, just sent a Thumbnail card');\n\n\t\t\tbot.send(msg, function (err) {\n\t\t\t\t// Return success/failure\n\t\t\t\tres.status(err ? 500 : 200);\n\t\t\t\tres.end();\n\t\t\t});\n\t\t} catch (e) { }\n\t});\n\n\t// Endpoint to send one way messages to individual users\n\tthis.server.get('api/messages/send/user', (req, res) => {\n\n\t\tvar guid = decodeURIComponent(req.params.id);\n\t\tvar address = addresses[guid];\n\t\tvar user = decodeURIComponent(req.params.user);\n\t\tvar type = (typeof req.params.type === 'string') ? req.params.type : 'text';\n\t\tvar isImportant = (typeof req.params.isImportant === 'string' && req.params.isImportant === 'true') ? true : false;\n\n\t\tif (!address) {\n\t\t\tres.send('Sorry cannot find your bot, please re-add the app');\n\t\t\tres.end();\n\t\t\treturn;\n\t\t}\n\n\t\tif (!user) {\n\t\t\tres.send('Sorry cannot find your user, please re-add the app');\n\t\t\tres.end();\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\n\t\t\tstartConversation(user, guid, function (data) {\n\t\t\t\tvar newConversationId = data.id;\n\t\t\t\taddress.conversation.id = newConversationId;\n\t\t\t\tsendMessageToUser(address, type, res, isImportant);\n\t\t\t});\n\t\t} catch (e) { }\n\t});\n\n\tthis.server.post('api/messages', c.listen()); // bind our one way bot to /api/messages\n\n\t// When a bot is added or removed we get an event here. Event type we are looking for is teamMember added\n\tbot.on('conversationUpdate', (msg) => {\n\n\t\tconsole.log('Notify got message');\n\n\t\tif (!rest_endpoint) rest_endpoint = msg.address.serviceUrl; // This is the base URL where we will send REST API request\t\t\n\t\tif (!msg.eventType === 'teamMemberAdded') return;\n\n\t\tconsole.log('Sample app was added to the team');\n\t\tconsole.log(JSON.stringify(msg, null, 1));\n\n\t\tif (!Array.isArray(msg.membersAdded) || msg.membersAdded.length < 1) return;\n\n\t\tvar members = msg.membersAdded;\n\n\t\t// We are keeping track of unique addresses so we can send messages to multiple users and channels at the same time\n\t\t// Clean up so we don't blow up memory (I know, I know, but still)\n\t\tif (addresses.length > 100) {\n\t\t\taddresses = {};\n\t\t\ttenant_id = {};\n\t\t\taccess_token = {};\n\t\t}\n\n\t\tvar botmessage = new builder.Message()\n\t\t\t.address(msg.address)\n\t\t\t.text('Hello, I am a sample app. I am looking for the team members and will shortly send you a message');\n\n\t\tbot.send(botmessage, function (err) { });\n\n\t\t// Loop through all members that were just added to the team\n\t\tfor (var i = 0; i < members.length; i++) {\n\n\t\t\t// See if the member added was our bot\n\t\t\tif (members[i].id.includes('8aefbb70-ff9e-409f-acea-986b61e51cd3') || members[i].id.includes('150d0c56-1423-4e6d-80d3-afce6cc8bace')) {\n\n\t\t\t\tvar guid = uuid.v4();\n\t\t\t\ttenant_id[guid] = msg.sourceEvent.tenant.id; // Extracting tenant ID as we will need it to create new conversations\n\n\t\t\t\t// Find all members currently in the team so we can send them a welcome message\n\t\t\t\tgetMembers(msg, guid).then((ret) => {\n\n\t\t\t\t\tvar msg = ret.msg;\n\t\t\t\t\tvar members = ret.members;\n\n\t\t\t\t\tconsole.log('got members');\n\n\t\t\t\t\t// Prepare a message to the channel about the addition of this app. Write convenience URLs so \n\t\t\t\t\t// we can easily send messages to the channel and individually to any user\t\t\t\t\t\n\t\t\t\t\tvar text = `##Just added the Sample App!! \\n Send message to: `\n\t\t\t\t\ttext += `[Text](${host}/api/messages/send/team?id=${encodeURIComponent(guid)}) [Important](${host}api/messages/send/team?id=${encodeURIComponent(guid)}&isImportant=true)`;\n\t\t\t\t\ttext += ` | [Hero Card](${host}/api/messages/send/team?type=hero&id=${encodeURIComponent(guid)}) [Important](${host}api/messages/send/team?type=hero&id=${encodeURIComponent(guid)}&isImportant=true)`;\n\t\t\t\t\ttext += ` | [Thumbnail Card](${host}/api/messages/send/team?type=thumb&id=${encodeURIComponent(guid)}) [Important](${host}api/messages/send/team?type=thumb&id=${encodeURIComponent(guid)}&isImportant=true)`;\n\t\t\t\t\taddresses[guid] = msg.address;\n\n\t\t\t\t\tfunction getEndpoint(type, guid, user, isImportant) {\n\t\t\t\t\t\treturn `${host}/api/messages/send/user?type=${encodeURIComponent(type)}&id=${encodeURIComponent(guid)}&user=${encodeURIComponent(user)}&isImportant=${encodeURIComponent(isImportant)}`;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Loop through and prepare convenience URLs for each user\n\t\t\t\t\ttext += '\\n\\n';\n\t\t\t\t\tfor (var i = 0; i < members.length; i++) {\n\t\t\t\t\t\tvar user = members[i].id;\n\t\t\t\t\t\tvar name = members[i].givenName || null;\n\t\t\t\t\t\tguid = uuid.v4();\n\n\t\t\t\t\t\tvar nameString = (name) ? name : `user number ${i + 1}`;\n\t\t\t\t\t\ttext += `Send message to ${nameString}: `\n\t\t\t\t\t\ttext += `[Text](${getEndpoint('text', guid, user, false)}), `;\n\t\t\t\t\t\ttext += `[Text alert](${getEndpoint('text', guid, user, true)}), `;\n\t\t\t\t\t\ttext += `[Hero](${getEndpoint('hero', guid, user, false)}), ` \n\t\t\t\t\t\ttext += `[Hero Alert](${getEndpoint('hero', guid, user, true)}), `;\n\t\t\t\t\t\ttext += `[Thumb](${getEndpoint('thumb', guid, user, false)}), `\n\t\t\t\t\t\ttext += `[Thumb Alert](${getEndpoint('thumb', guid, user, true)})`;\n\t\t\t\t\t\ttext += '\\n\\n';\n\n\t\t\t\t\t\taddresses[guid] = JSON.parse(JSON.stringify(msg.address)); // Make sure we mae a copy of an address to add to our addresses array\n\t\t\t\t\t\ttenant_id[guid] = msg.sourceEvent.tenant.id; // Extracting tenant ID as we will need it to create new conversations\n\t\t\t\t\t}\n\n\t\t\t\t\t// Go ahead and send the message\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar botmessage = new builder.Message()\n\t\t\t\t\t\t\t.address(msg.address)\n\t\t\t\t\t\t\t.textFormat(builder.TextFormat.markdown)\n\t\t\t\t\t\t\t.text(text);\n\n\t\t\t\t\t\tbot.send(botmessage, function (err) {\n\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.log(`Cannot send message: ${e}`);\n\t\t\t\t\t}\n\n\t\t\t\t}, (err) => {\n\n\t\t\t\t});\n\n\t\t\t}\n\t\t}\n\t});\n}", "getEndpointUrl() {\n let path = super.getEndpointUrl();\n if (!path.startsWith('/')) {\n path = '/' + path;\n }\n const protocol = getWebsocketProtocol();\n const host = window.location.hostname;\n const port = window.location.port;\n return `${protocol}//${host}:${port}${path}`;\n }", "function _getIngestEndpoint(dsn) {\n\t return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n\t}", "sending () {\n }", "function Address(options) {\n Client.call(this, options)\n}", "send(jsonMsg, next) {\n let errorHappened = false;\n let nafter = _.after(this._endpoints.length, () => {\n w.silly(`Sent message to all endpoints, errors: ${errorHappened}`);\n });\n\n this._endpoints.forEach(ep => {\n ep.send({\n path: '/data',\n data: jsonMsg,\n next: err => {\n if (!!err) {\n w.silly(\"Failure sending: %s {%s}\", err.error, ep.toString());\n // still register that it happened though, for record keeping. :D\n errorHappened = true;\n }\n\n nafter();\n }\n });\n });\n\n if (_.isFunction(next)) {\n next();\n }\n }", "sendCustomerRequest(){\n // request will be sent to the customer that requested the ride\n var request= {\n taxiNumber: this.state.taxiNumber,\n id: this.socket.id,\n phoneNumber: this.state.phoneNumber,\n }\n this.socket.emit('customer request', request);\n }", "function _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n }", "function sendOfferToCallee() {\n sendToServer({\n type: 'offer',\n offer: caller_peer_connect.localDescription\n });\n // console.log('reciveCallerOffer();');\n // console.log(JSON.stringify(caller_peer_connect.localDescription));\n // reciveCallerOffer(caller_peer_connect.localDescription);\n}", "get endpoints() {\n return this.getListAttribute('endpoints');\n }", "send(message) {\n if (port) {\n port.postMessage(message);\n }\n }", "function XMPPRouter() {\n var connections = {};\n\n this.route = function(id) {\n return function(message, index) {\n Log.debug(\"Routing : \" + sys.inspect(index, 4) + \";;\" + sys.inspect(message, 4).unlines());\n var downstream = connections[id];\n downstream.process(message)(Log.info, Log.error);\n }\n }\n\n // Add this socket to the global registry\n this.register = function(id, conn) { \n connections[id] = conn\n }\n\n // Remove this socket from the global registry\n this.unregister = function(id) {\n delete connections[id];\n }\n}", "sendOffer(offer) {\n loglevel_1.default.debug('sending offer', offer);\n this.sendRequest({\n offer: toProtoSessionDescription(offer),\n });\n }", "constructor(endpoint, options) {\n super(endpoint, options);\n this.communicationIdentity = new operations.CommunicationIdentity(this);\n }", "sendSignInLinkEmail (voter_email_address){\n Dispatcher.loadEndpoint(\"voterEmailAddressSave\", {\n text_for_email_address: voter_email_address,\n send_link_to_sign_in: true,\n make_primary_email: true\n });\n }", "function getEndPoint() {\n let random = Math.floor(Math.random() * httpEndPoints.length);\n return httpEndPoints[random];\n }", "function broadcast(req, res, addedSocketAddress){\n globalView.forEach(element => {\n if(element != process.env.SOCKET_ADDRESS && element != addedSocketAddress)\n {\n let forward_address = element\n let {url, options} = makeRequestObject(forward_address, req)\n fetch(url, options)\n .then(f_res => f_res.json().then(json_f_res => console.log(json_f_res)))\n .catch(error => console.log(error))\n }\n })\n}", "_onListening() {\n /* Called after socket.bind */\n let address = this.socket.address()\n log.info(`server listening ${address.address}:${address.port}`)\n }", "function _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}", "function _getIngestEndpoint(dsn) {\n return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;\n}", "function spConnect() {\n\n // use 'PushManager' to request a new PushServer URL endpoint for 'Mail' notifications:\n endpointRequest = navigator.push.register();\n // the DOMRequest returns 'successfully':\n endpointRequest.onsuccess = function( event ) {\n // extract the endpoint object from the event:\n endpoint = event.target.result;\n\n // if it is the first registration, need to register\n // the 'pushEndpoint' with the UnifiedPush server.\n if ( endpoint.pushEndpoint ) {\n // assemble the metadata for registration with the UnifiedPush server\n var metadata = {\n deviceToken: mailEndpoint.channelID,\n simplePushEndpoint: mailEndpoint.pushEndpoint\n };\n\n var settings = {\n success: function() {\n //success handler\n alert('Success')\n },\n error: function() {\n //error handler\n }\n };\n\n settings.metadata = metadata;\n\n // register with the server\n UPClient.registerWithPushServer(settings);\n } else {\n console.log(\"'Endpoint' was already registered!\");\n }\n };\n // set the notification handler:\n navigator.setMessageHandler( \"push\", function( message ) {\n if ( message.channelID === mailEndpoint.channelID ) {\n // let's react on the endpoint\n }\n });\n }", "_navigateNext() {\n this._navigate(this.next.id, 'endpoint');\n }", "servePing() {\n if (this.uibRouter === undefined) throw new Error('this.uibRouter is undefined')\n\n this.uibRouter.get('/ping', (req, res) => {\n res.status(204).end()\n })\n this.routers.user.push( { name: 'Ping', path: `${this.uib.httpRoot}/uibuilder/ping`, desc: 'Ping/keep-alive endpoint, returns 201', type: 'Endpoint' } )\n }", "function WSCommunicationChannel(address){\n this._logger = new Logger(\"WSCommunicationChannel\");\n if(address === null){\n throw new Error(\"address cannot be null it needs to be in URI format\");\n }\n this._address = address;\n this._init();\n}", "function port_linkage_send( message, transferables ) {\n\t//console.log( \"Sending: \", message );\n\tthis.port.postMessage( message, transferables );\n}", "[kEndpointBound](endpoint) {\n const state = this[kInternalState];\n if (state.state === kSocketBound)\n return;\n state.state = kSocketBound;\n\n // The ready event indicates that the QuicSocket is ready to be\n // used to either listen or connect. No QuicServerSession should\n // exist before this event, and all QuicClientSession will remain\n // in Initial states until ready is invoked.\n process.nextTick(() => {\n try {\n this.emit('ready');\n } catch (error) {\n this.destroy(error);\n }\n });\n }", "onWorkerMsg(msg){\n\n if (msg.replyTo!=null){\n\n if (messageBuffer[msg.replyTo]!=undefined){\n\n //Store the reply in the buffer.\n messageBuffer[msg.replyTo].reply = msg;\n\n //Send the response to the client.\n messageBuffer[msg.replyTo].client.json({response:msg.payload});\n\n }\n\n }\n\n }", "uri() {\n let query = this.query || {};\n const schema = this.opts.secure ? \"wss\" : \"ws\";\n let port = \"\";\n // avoid port if default for schema\n if (this.opts.port &&\n ((\"wss\" === schema && Number(this.opts.port) !== 443) ||\n (\"ws\" === schema && Number(this.opts.port) !== 80))) {\n port = \":\" + this.opts.port;\n }\n // append timestamp to URI\n if (this.opts.timestampRequests) {\n query[this.opts.timestampParam] = (0, yeast_1.default)();\n }\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n const encodedQuery = parseqs_1.default.encode(query);\n const ipv6 = this.opts.hostname.indexOf(\":\") !== -1;\n return (schema +\n \"://\" +\n (ipv6 ? \"[\" + this.opts.hostname + \"]\" : this.opts.hostname) +\n port +\n this.opts.path +\n (encodedQuery.length ? \"?\" + encodedQuery : \"\"));\n }", "function ServerTransport() {\n EventEmitter.call(this)\n}", "function address() {\n return wrap('address', or(mailbox, group)());\n }", "function address() {\n return wrap('address', or(mailbox, group)());\n }", "function address() {\n return wrap('address', or(mailbox, group)());\n }", "function address() {\n return wrap('address', or(mailbox, group)());\n }", "sendMessage(msg){\n this.socket.emit(\"client\", msg);\n }", "function FrontAnswer(){\n let peer = InitPeer(\"notInit\");\n peer.on('signal', (data)=>{\n socket.emit('Answer',data);\n });\n\n peer.signal(offer);\n }", "_addOneToAddress() {\n this._transportParameters.targetAddress = intToAddress(addressToInt(this._transportParameters.targetAddress) + 1);\n this._debug(`New address for DFU target: ${this._transportParameters.targetAddress}`);\n return this._transportParameters.targetAddress;\n }", "uri() {\n let query = this.query || {};\n const schema = this.opts.secure ? \"wss\" : \"ws\";\n let port = \"\";\n // avoid port if default for schema\n if (this.opts.port &&\n ((\"wss\" === schema && Number(this.opts.port) !== 443) ||\n (\"ws\" === schema && Number(this.opts.port) !== 80))) {\n port = \":\" + this.opts.port;\n }\n // append timestamp to URI\n if (this.opts.timestampRequests) {\n query[this.opts.timestampParam] = yeast();\n }\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n const encodedQuery = encode(query);\n const ipv6 = this.opts.hostname.indexOf(\":\") !== -1;\n return (schema +\n \"://\" +\n (ipv6 ? \"[\" + this.opts.hostname + \"]\" : this.opts.hostname) +\n port +\n this.opts.path +\n (encodedQuery.length ? \"?\" + encodedQuery : \"\"));\n }", "function polo_route_advertise(message){\n\n}", "send(targetNest, message) {\n targetNest.receive(this.nestName, message);\n console.log(\"Message sent\");\n }", "broadCastMessage(message){\n this.socket.send(message);\n }", "get readerEndpoint() {\n return this.getStringAttribute('reader_endpoint');\n }", "replyTo(address, name) {\n this.nodeMailerMessage.replyTo = this.getAddress(address, name);\n return this;\n }", "get address() {\n\t\treturn this.__address;\n\t}", "send() {}", "send() {}", "send() {}", "send() {}", "send() {}", "send() {}", "uri() {\n let query = this.query || {};\n const schema = this.opts.secure ? \"wss\" : \"ws\";\n let port = \"\";\n\n // avoid port if default for schema\n if (\n this.opts.port &&\n ((\"wss\" === schema && Number(this.opts.port) !== 443) ||\n (\"ws\" === schema && Number(this.opts.port) !== 80))\n ) {\n port = \":\" + this.opts.port;\n }\n\n // append timestamp to URI\n if (this.opts.timestampRequests) {\n query[this.opts.timestampParam] = yeast();\n }\n\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // prepend ? to query\n if (query.length) {\n query = \"?\" + query;\n }\n\n const ipv6 = this.opts.hostname.indexOf(\":\") !== -1;\n return (\n schema +\n \"://\" +\n (ipv6 ? \"[\" + this.opts.hostname + \"]\" : this.opts.hostname) +\n port +\n this.opts.path +\n query\n );\n }", "uri() {\n let query = this.query || {};\n const schema = this.opts.secure ? \"wss\" : \"ws\";\n let port = \"\";\n\n // avoid port if default for schema\n if (\n this.opts.port &&\n ((\"wss\" === schema && Number(this.opts.port) !== 443) ||\n (\"ws\" === schema && Number(this.opts.port) !== 80))\n ) {\n port = \":\" + this.opts.port;\n }\n\n // append timestamp to URI\n if (this.opts.timestampRequests) {\n query[this.opts.timestampParam] = yeast();\n }\n\n // communicate binary support capabilities\n if (!this.supportsBinary) {\n query.b64 = 1;\n }\n\n query = parseqs.encode(query);\n\n // prepend ? to query\n if (query.length) {\n query = \"?\" + query;\n }\n\n const ipv6 = this.opts.hostname.indexOf(\":\") !== -1;\n return (\n schema +\n \"://\" +\n (ipv6 ? \"[\" + this.opts.hostname + \"]\" : this.opts.hostname) +\n port +\n this.opts.path +\n query\n );\n }", "sendPing() {\n this.broadcast('wc:ping');\n }", "function createAndSendAnswer() {\n peerConn.createAnswer(\n (answer) => {\n peerConn.setLocalDescription(\n answer,\n () => { wsConn.send(JSON.stringify({ sdp: answer })); },\n console.error\n );\n },\n console.error\n );\n}", "static Address /*::<message>*/(signal/*:Signal<message>*/)/*:type.Address<message>*/{\n if (signal.address == null) {\n signal.address = signal.receive.bind(signal)\n // TODO: Submit a bug for flow as return here and else clause is\n // redundunt.\n return signal.address\n } else {\n return signal.address\n }\n }", "function getEndpoint(start, end, max) {\n return (end<start+max && end>start) ? end : start+max;\n}", "function forward (offer) {\n if (offer.answer) {\n peerTable[offer.srcId].socket\n .emit('we-handshake', offer)\n return\n }\n peerTable[offer.dstId].socket\n .emit('we-handshake', offer)\n}" ]
[ "0.60655105", "0.58461183", "0.58366686", "0.58366686", "0.58366686", "0.58349746", "0.58349746", "0.58349746", "0.58349746", "0.5667294", "0.55351883", "0.54919016", "0.5422372", "0.54212075", "0.5405083", "0.53320336", "0.52002597", "0.51635903", "0.5131667", "0.5127271", "0.51250964", "0.5094514", "0.50697136", "0.5043066", "0.50188136", "0.5002228", "0.49946365", "0.4986997", "0.49869192", "0.49824664", "0.4977448", "0.49748456", "0.49725434", "0.49715343", "0.49664646", "0.4960273", "0.49497128", "0.49138322", "0.48895338", "0.4886927", "0.48845243", "0.48806778", "0.48777118", "0.4875241", "0.48678592", "0.48437855", "0.4843317", "0.4836973", "0.48330495", "0.48257884", "0.48160172", "0.48114562", "0.48043385", "0.4802068", "0.47964185", "0.4795651", "0.47948176", "0.4789262", "0.4788872", "0.47826928", "0.47660354", "0.4759009", "0.4753265", "0.4753265", "0.4712589", "0.4705203", "0.47043368", "0.46923578", "0.46911606", "0.46860543", "0.4679878", "0.46774802", "0.46726066", "0.4670114", "0.4670114", "0.4670114", "0.4670114", "0.46498805", "0.4640444", "0.46341002", "0.4632736", "0.4614203", "0.4612882", "0.45995963", "0.45991", "0.45990014", "0.45889983", "0.4575775", "0.4575775", "0.4575775", "0.4575775", "0.4575775", "0.4575775", "0.45651442", "0.45651442", "0.45583037", "0.45477343", "0.45476356", "0.4546443", "0.45440552" ]
0.6017733
1
Length if the receiver\'s reliable messaging cache in minutes (if a receiver) or how long the cache length on the receiver should be (if a sender).
get reliableCache() { return this.__reliableCache; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "serializeLen() {\n precondition.ensureNotNull('this.ctxPtr', this.ctxPtr);\n\n let proxyResult;\n proxyResult = Module._vscr_ratchet_message_serialize_len(this.ctxPtr);\n return proxyResult;\n }", "function msgSizeTimer(msgContent) {\n let awrageCharactersPerMinute = 1150; // http://typefastnow.com/average-typing-speed\n let typingTime = Math.floor((JSON.stringify(msgContent).length * 1000) / (awrageCharactersPerMinute/60)); \n typingTime /= 2;\n return typingTime\n }", "getRemainingLength() {\n return this.remainingLength;\n }", "get length() {\n return this.peerDistances.length;\n }", "get length() {\n return derLength(this.payloadLen);\n }", "haveLength () {\n\t if (this.opcode < 0x08 && this.maxPayloadExceeded(this.payloadLength)) {\n\t return;\n\t }\n\n\t if (this.masked) this.state = GET_MASK;\n\t else this.state = GET_DATA;\n\t }", "haveLength () {\n\t if (this._opcode < 0x08 && this.maxPayloadExceeded(this._payloadLength)) {\n\t return;\n\t }\n\n\t if (this._masked) this._state = GET_MASK;\n\t else this._state = GET_DATA;\n\t }", "function calculateExpire() {\n var expiresIn = Math.round((((messageObject.expiresOn-new Date(Date.now())) % 86400000) % 3600000) / 60000); // minutes\n console.log(expiresIn);\n return expiresIn\n}", "haveLength () {\n if (this._opcode < 0x08 && this.maxPayloadExceeded(this._payloadLength)) {\n return;\n }\n\n if (this._masked) this._state = GET_MASK;\n else this._state = GET_DATA;\n }", "haveLength () {\n if (this._opcode < 0x08 && this.maxPayloadExceeded(this._payloadLength)) {\n return;\n }\n\n if (this._masked) this._state = GET_MASK;\n else this._state = GET_DATA;\n }", "haveLength () {\n if (this.opcode < 0x08 && this.maxPayloadExceeded(this.payloadLength)) {\n return;\n }\n\n if (this.masked) this.state = GET_MASK;\n else this.state = GET_DATA;\n }", "get length() {}", "get length() {}", "function getLength(string1){\n return string1.getLength;\n}", "getPayloadLength64 () {\n const buf = this.consume(8);\n if (buf === null) return;\n\n const num = buf.readUInt32BE(0, true);\n\n //\n // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned\n // if payload length is greater than this number.\n //\n if (num > Math.pow(2, 53 - 32) - 1) {\n this.error(\n new RangeError(\n 'Unsupported WebSocket frame: payload length > 2^53 - 1'\n ),\n 1009\n );\n return;\n }\n\n this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4, true);\n this.haveLength();\n }", "function calculate_payload_size( channel, message ) {\n return encodeURIComponent(\n channel + JSON.stringify(message)\n ).length + 100;\n}", "fastAutobuyersTimerLength() {\n return player.autobuyersTimerLength;\n }", "function calcLengthLength (length) {\n\t if (length >= 0 && length < 128) return 1\n\t else if (length >= 128 && length < 16384) return 2\n\t else if (length >= 16384 && length < 2097152) return 3\n\t else if (length >= 2097152 && length < 268435456) return 4\n\t else return 0\n\t}", "function getLength() {\n\t\t\treturn data.length;\n\t\t}", "getLength() {\n return this.currently.getLength();\n }", "function countBytes(heartbeatsCache) {\r\n // base64 has a restricted set of characters, all of which should be 1 byte.\r\n return (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.base64urlEncodeWithoutPadding)(\r\n // heartbeatsCache wrapper properties\r\n JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length;\r\n}", "getPayloadLength64 () {\n\t if (!this.hasBufferedBytes(8)) return;\n\n\t const buf = this.readBuffer(8);\n\t const num = buf.readUInt32BE(0, true);\n\n\t //\n\t // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned\n\t // if payload length is greater than this number.\n\t //\n\t if (num > Math.pow(2, 53 - 32) - 1) {\n\t this.error(new Error('max payload size exceeded'), 1009);\n\t return;\n\t }\n\n\t this._payloadLength = (num * Math.pow(2, 32)) + buf.readUInt32BE(4, true);\n\t this.haveLength();\n\t }", "getPayloadLength64 () {\n\t if (!this.hasBufferedBytes(8)) return;\n\n\t const buf = this.readBuffer(8);\n\t const num = buf.readUInt32BE(0, true);\n\n\t //\n\t // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned\n\t // if payload length is greater than this number.\n\t //\n\t if (num > Math.pow(2, 53 - 32) - 1) {\n\t this.error(new Error('max payload size exceeded'), 1009);\n\t return;\n\t }\n\n\t this.payloadLength = (num * Math.pow(2, 32)) + buf.readUInt32BE(4, true);\n\t this.haveLength();\n\t }", "readLength() {\n const shortLength = this.readUInt8();\n if (shortLength !== constants.TNS_LONG_LENGTH_INDICATOR) {\n return shortLength;\n }\n return this.readUInt32BE();\n }", "get length() {\n var _a, _b;\n\n return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;\n }", "get length() { return this.to - this.from; }", "hasLength(length, comparator = Workflo.Comparator.equalTo) {\n const actualLength = this.getLength();\n this._node.__setLastDiff({\n actual: actualLength.toString(),\n timeout: this._node.getTimeout(),\n });\n return util_2.compare(actualLength, length, comparator);\n }", "get length() {\n\t\treturn this.getLength();\n\t}", "getUsedLength() {\n return this.usedLength;\n }", "function calculateMaxLength(provider, prefix) {\n // Get config and store path\n const config = getAPIConfig(provider);\n if (!config) {\n return 0;\n }\n // Calculate\n let result;\n if (!config.maxURL) {\n result = 0;\n }\n else {\n let maxHostLength = 0;\n config.resources.forEach((item) => {\n const host = item;\n maxHostLength = Math.max(maxHostLength, host.length);\n });\n // Get available length\n result =\n config.maxURL -\n maxHostLength -\n config.path.length -\n endPoint\n .replace('{provider}', provider)\n .replace('{prefix}', prefix)\n .replace('{icons}', '').length;\n }\n // Cache stuff and return result\n const cacheKey = provider + ':' + prefix;\n pathCache[cacheKey] = config.path;\n maxLengthCache[cacheKey] = result;\n return result;\n }", "getLength(callback) {\n const cb = (err, length) => {\n if (err || !Number.isNaN(length)) {\n callback(err, length);\n }\n else {\n callback(null, null);\n }\n };\n super.getLength(cb);\n }", "function calculateMaxLength(provider, prefix) {\n // Get config and store path\n const config = getAPIConfig(provider);\n if (!config) {\n return 0;\n }\n // Calculate\n let result;\n if (!config.maxURL) {\n result = 0;\n }\n else {\n let maxHostLength = 0;\n config.resources.forEach((item) => {\n const host = item;\n maxHostLength = Math.max(maxHostLength, host.length);\n });\n // Make sure global is set\n getGlobal();\n // Extra width: prefix (3) + counter (4) - '{cb}' (4)\n const extraLength = 3;\n // Get available length\n result =\n config.maxURL -\n maxHostLength -\n config.path.length -\n endPoint\n .replace('{provider}', provider)\n .replace('{prefix}', prefix)\n .replace('{icons}', '').length -\n extraLength;\n }\n // Cache stuff and return result\n const cacheKey = provider + ':' + prefix;\n pathCache[cacheKey] = config.path;\n maxLengthCache[cacheKey] = result;\n return result;\n }", "function calcLengthLength(length) {\n if (length >= 0 && length < 128) {\n return 1\n } else if (length >= 128 && length < 16384) {\n return 2\n } else if (length >= 16384 && length < 2097152) {\n return 3\n } else if (length >= 2097152 && length < 268435456) {\n return 4\n } else {\n return 0\n }\n}", "function calcLengthLength(length) {\n if (length >= 0 && length < 128) {\n return 1\n } else if (length >= 128 && length < 16384) {\n return 2\n } else if (length >= 16384 && length < 2097152) {\n return 3\n } else if (length >= 2097152 && length < 268435456) {\n return 4\n } else {\n return 0\n }\n}", "get Length()\n {\n return this._length;\n }", "getPayloadLength64 () {\n if (!this.hasBufferedBytes(8)) return;\n\n const buf = this.readBuffer(8);\n const num = buf.readUInt32BE(0, true);\n\n //\n // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned\n // if payload length is greater than this number.\n //\n if (num > Math.pow(2, 53 - 32) - 1) {\n this.error(new Error('max payload size exceeded'), 1009);\n return;\n }\n\n this._payloadLength = (num * Math.pow(2, 32)) + buf.readUInt32BE(4, true);\n this.haveLength();\n }", "getPayloadLength64 () {\n if (!this.hasBufferedBytes(8)) return;\n\n const buf = this.readBuffer(8);\n const num = buf.readUInt32BE(0, true);\n\n //\n // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned\n // if payload length is greater than this number.\n //\n if (num > Math.pow(2, 53 - 32) - 1) {\n this.error(new Error('max payload size exceeded'), 1009);\n return;\n }\n\n this.payloadLength = (num * Math.pow(2, 32)) + buf.readUInt32BE(4, true);\n this.haveLength();\n }", "function calcLengthLength (length) {\n if (length >= 0 && length < 128) return 1\n else if (length >= 128 && length < 16384) return 2\n else if (length >= 16384 && length < 2097152) return 3\n else if (length >= 2097152 && length < 268435456) return 4\n else return 0\n}", "function calcLengthLength (length) {\n if (length >= 0 && length < 128) return 1\n else if (length >= 128 && length < 16384) return 2\n else if (length >= 16384 && length < 2097152) return 3\n else if (length >= 2097152 && length < 268435456) return 4\n else return 0\n}", "calWidth () {\n let len = 0\n this.queue.forEach(message => {\n len += message.content.length * config.default_font_size\n })\n return len\n }", "get_accountNumber_len() {\n\t\treturn (this.accountNumber.getAttribute('maxlength')).then(function(returnValue) {\n\t\t\treturn returnValue;\n\t\t});\n\t}", "maxAge() {\n if (!this.storable() || this._rescc['no-cache']) {\n return 0;\n }\n\n // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default\n // so this implementation requires explicit opt-in via public header\n if (\n this._isShared &&\n (this._resHeaders['set-cookie'] &&\n !this._rescc.public &&\n !this._rescc.immutable)\n ) {\n return 0;\n }\n\n if (this._resHeaders.vary === '*') {\n return 0;\n }\n\n if (this._isShared) {\n if (this._rescc['proxy-revalidate']) {\n return 0;\n }\n // if a response includes the s-maxage directive, a shared cache recipient MUST ignore the Expires field.\n if (this._rescc['s-maxage']) {\n return toNumberOrZero(this._rescc['s-maxage']);\n }\n }\n\n // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field.\n if (this._rescc['max-age']) {\n return toNumberOrZero(this._rescc['max-age']);\n }\n\n const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;\n\n const serverDate = this.date();\n if (this._resHeaders.expires) {\n const expires = Date.parse(this._resHeaders.expires);\n // A cache recipient MUST interpret invalid date formats, especially the value \"0\", as representing a time in the past (i.e., \"already expired\").\n if (Number.isNaN(expires) || expires < serverDate) {\n return 0;\n }\n return Math.max(defaultMinTtl, (expires - serverDate) / 1000);\n }\n\n if (this._resHeaders['last-modified']) {\n const lastModified = Date.parse(this._resHeaders['last-modified']);\n if (isFinite(lastModified) && serverDate > lastModified) {\n return Math.max(\n defaultMinTtl,\n ((serverDate - lastModified) / 1000) * this._cacheHeuristic\n );\n }\n }\n\n return defaultMinTtl;\n }", "maxAge() {\n if (!this.storable() || this._rescc['no-cache']) {\n return 0;\n }\n\n // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default\n // so this implementation requires explicit opt-in via public header\n if (\n this._isShared &&\n (this._resHeaders['set-cookie'] &&\n !this._rescc.public &&\n !this._rescc.immutable)\n ) {\n return 0;\n }\n\n if (this._resHeaders.vary === '*') {\n return 0;\n }\n\n if (this._isShared) {\n if (this._rescc['proxy-revalidate']) {\n return 0;\n }\n // if a response includes the s-maxage directive, a shared cache recipient MUST ignore the Expires field.\n if (this._rescc['s-maxage']) {\n return toNumberOrZero(this._rescc['s-maxage']);\n }\n }\n\n // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field.\n if (this._rescc['max-age']) {\n return toNumberOrZero(this._rescc['max-age']);\n }\n\n const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;\n\n const serverDate = this.date();\n if (this._resHeaders.expires) {\n const expires = Date.parse(this._resHeaders.expires);\n // A cache recipient MUST interpret invalid date formats, especially the value \"0\", as representing a time in the past (i.e., \"already expired\").\n if (Number.isNaN(expires) || expires < serverDate) {\n return 0;\n }\n return Math.max(defaultMinTtl, (expires - serverDate) / 1000);\n }\n\n if (this._resHeaders['last-modified']) {\n const lastModified = Date.parse(this._resHeaders['last-modified']);\n if (isFinite(lastModified) && serverDate > lastModified) {\n return Math.max(\n defaultMinTtl,\n ((serverDate - lastModified) / 1000) * this._cacheHeuristic\n );\n }\n }\n\n return defaultMinTtl;\n }", "hasLength(length, { timeout = this._node.getTimeout(), comparator = Workflo.Comparator.equalTo, interval = this._node.getInterval(), reverse, } = {}) {\n const notStr = (reverse) ? 'not ' : '';\n return this._node.__waitUntil(() => {\n if (reverse) {\n return !this._node.currently.hasLength(length, comparator);\n }\n else {\n return this._node.currently.hasLength(length, comparator);\n }\n }, () => `: Length never ${notStr}became${util_2.comparatorStr(comparator)} ${length}`, timeout, interval);\n }", "function check_len(_indefinite_length, _length)\n {\n if(_indefinite_length == true)\n return 1;\n\n return _length;\n }", "function calcLength () {\n return buffers.reduce(function (a, b) {\n return a + b.length\n }, 0)\n }", "function calcLength () {\n return buffers.reduce(function (a, b) {\n return a + b.length\n }, 0)\n }", "function calcLength () {\n return buffers.reduce(function (a, b) {\n return a + b.length\n }, 0)\n }", "function calcLength () {\n return buffers.reduce(function (a, b) {\n return a + b.length\n }, 0)\n }", "function calcLength() {\n return buffers.reduce(function (a, b) {\n return a + b.length;\n }, 0);\n }", "maxAge() {\n if (!this.storable() || this._rescc['no-cache']) {\n return 0;\n }\n\n // Shared responses with cookies are cacheable according to the RFC, but IMHO it'd be unwise to do so by default\n // so this implementation requires explicit opt-in via public header\n if (\n this._isShared &&\n (this._resHeaders['set-cookie'] &&\n !this._rescc.public &&\n !this._rescc.immutable)\n ) {\n return 0;\n }\n\n if (this._resHeaders.vary === '*') {\n return 0;\n }\n\n if (this._isShared) {\n if (this._rescc['proxy-revalidate']) {\n return 0;\n }\n // if a response includes the s-maxage directive, a shared cache recipient MUST ignore the Expires field.\n if (this._rescc['s-maxage']) {\n return parseInt(this._rescc['s-maxage'], 10);\n }\n }\n\n // If a response includes a Cache-Control field with the max-age directive, a recipient MUST ignore the Expires field.\n if (this._rescc['max-age']) {\n return parseInt(this._rescc['max-age'], 10);\n }\n\n const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;\n\n const serverDate = this._serverDate();\n if (this._resHeaders.expires) {\n const expires = Date.parse(this._resHeaders.expires);\n // A cache recipient MUST interpret invalid date formats, especially the value \"0\", as representing a time in the past (i.e., \"already expired\").\n if (Number.isNaN(expires) || expires < serverDate) {\n return 0;\n }\n return Math.max(defaultMinTtl, (expires - serverDate) / 1000);\n }\n\n if (this._resHeaders['last-modified']) {\n const lastModified = Date.parse(this._resHeaders['last-modified']);\n if (isFinite(lastModified) && serverDate > lastModified) {\n return Math.max(\n defaultMinTtl,\n ((serverDate - lastModified) / 1000) * this._cacheHeuristic\n );\n }\n }\n\n return defaultMinTtl;\n }", "get length() { return this._length; }", "get length() { return this._length; }", "function hasLength (data, length) {\n return assigned(data) && data.length === length;\n }", "get length() {\n return _classPrivateFieldGet(this, _queue).length + _classPrivateFieldGet(this, _pending);\n }", "getDataLength() {\n return this._dataLength;\n }", "function length( subject ) {\n return subject.length;\n}", "function length( subject ) {\n return subject.length;\n}", "length() {\n const queueLen = this.queue.length;\n debug(`\\nLOG: There are total ${queueLen} data in the queue`);\n return queueLen;\n }", "function mqcaLen(s, nameCount) {\n log.traceEntry('mqcaLen', \"attr:%d\", s);\n var rc = -1;\n switch (s) {\n case MQC.MQCA_TRIGGER_DATA:\n rc = MQC.MQ_TRIGGER_DATA_LENGTH;\n break;\n case MQC.MQCA_Q_MGR_NAME:\n case MQC.MQCA_REMOTE_Q_MGR_NAME:\n case MQC.MQCA_PARENT:\n rc = MQC.MQ_Q_MGR_NAME_LENGTH;\n break;\n\n case MQC.MQCA_DEAD_LETTER_Q_NAME:\n case MQC.MQCA_BASE_Q_NAME:\n case MQC.MQCA_BACKOUT_REQ_Q_NAME:\n case MQC.MQCA_COMMAND_INPUT_Q_NAME:\n case MQC.MQCA_INITIATION_Q_NAME:\n case MQC.MQCA_DEF_XMIT_Q_NAME:\n case MQC.MQCA_Q_NAME:\n case MQC.MQCA_REMOTE_Q_NAME:\n case MQC.MQCA_XMIT_Q_NAME:\n rc = MQC.MQ_Q_NAME_LENGTH;\n break;\n\n case MQC.MQCA_ALTERATION_DATE:\n case MQC.MQCA_CREATION_DATE:\n rc = MQC.MQ_DATE_LENGTH;\n break;\n case MQC.MQCA_ALTERATION_TIME:\n case MQC.MQCA_CREATION_TIME:\n rc = MQC.MQ_TIME_LENGTH;\n break;\n case MQC.MQCA_APPL_ID:\n rc = MQC.MQ_APPL_IDENTITY_DATA_LENGTH;\n break;\n case MQC.MQCA_CERT_LABEL:\n case MQC.MQCA_QSG_CERT_LABEL:\n rc = MQC.MQ_CERT_LABEL_LENGTH;\n break;\n case MQC.MQCA_CF_STRUC_NAME:\n rc = MQC.MQ_CF_STRUC_NAME_LENGTH;\n break;\n case MQC.MQCA_CHANNEL_AUTO_DEF_EXIT:\n case MQC.MQCA_CLUSTER_WORKLOAD_EXIT:\n rc = MQC.MQ_EXIT_NAME_LENGTH;\n break;\n case MQC.MQCA_CHINIT_SERVICE_PARM:\n rc = MQC.MQ_CHINIT_SERVICE_PARM_LENGTH;\n break;\n case MQC.MQCA_CLUSTER_NAME:\n case MQC.MQCA_REPOSITORY_NAME:\n rc = MQC.MQ_CLUSTER_NAME_LENGTH;\n break;\n case MQC.MQCA_CLUS_CHL_NAME:\n rc = MQC.MQ_OBJECT_NAME_LENGTH;\n break;\n case MQC.MQCA_CLUSTER_WORKLOAD_DATA:\n rc = MQC.MQ_EXIT_DATA_LENGTH;\n break;\n case MQC.MQCA_COMM_INFO_NAME:\n rc = MQC.MQ_OBJECT_NAME_LENGTH;\n break;\n case MQC.MQCA_CONN_AUTH:\n rc = MQC.MQ_AUTH_INFO_NAME_LENGTH;\n break;\n case MQC.MQCA_CUSTOM:\n rc = MQC.MQ_CUSTOM_LENGTH;\n break;\n case MQC.MQCA_DNS_GROUP:\n rc = MQC.MQ_DNS_GROUP_NAME_LENGTH;\n break;\n case MQC.MQCA_ENV_DATA:\n rc = MQC.MQ_PROCESS_ENV_DATA_LENGTH;\n break;\n case MQC.MQCA_IGQ_USER_ID:\n rc = MQC.MQ_USER_ID_LENGTH;\n break;\n case MQC.MQCA_INITIAL_KEY:\n rc = MQC.MQ_INITIAL_KEY_LENGTH;\n break;\n case MQC.MQCA_INSTALLATION_DESC:\n rc = MQC.MQ_INSTALLATION_DESC_LENGTH;\n break;\n case MQC.MQCA_INSTALLATION_NAME:\n rc = MQC.MQ_INSTALLATION_NAME_LENGTH;\n break;\n case MQC.MQCA_INSTALLATION_PATH:\n rc = MQC.MQ_INSTALLATION_PATH_LENGTH;\n break;\n case MQC.MQCA_LU62_ARM_SUFFIX:\n rc = MQC.MQ_ARM_SUFFIX_LENGTH;\n break;\n case MQC.MQCA_LU_GROUP_NAME:\n case MQC.MQCA_LU_NAME:\n rc = MQC.MQ_LU_NAME_LENGTH;\n break;\n case MQC.MQCA_NAMELIST_DESC:\n rc = MQC.MQ_NAMELIST_DESC_LENGTH;\n break;\n case MQC.MQCA_NAMELIST_NAME:\n case MQC.MQCA_CLUSTER_NAMELIST:\n case MQC.MQCA_REPOSITORY_NAMELIST:\n case MQC.MQCA_SSL_CRL_NAMELIST:\n rc = MQC.MQ_NAMELIST_NAME_LENGTH;\n break;\n /*\n This is a variable length, based on the value of the\n corresponding MQIA_NAME_COUNT attribute. We have to assume\n that the input array has that attribute ahead of the MQCA_NAMES\n attribute so we get the count first.\n */\n case MQC.MQCA_NAMES:\n if (nameCount > 0) {\n rc = MQC.MQ_Q_NAME_LENGTH * nameCount;\n }\n break;\n case MQC.MQCA_PROCESS_DESC:\n rc = MQC.MQ_PROCESS_DESC_LENGTH;\n break;\n case MQC.MQCA_PROCESS_NAME:\n rc = MQC.MQ_PROCESS_NAME_LENGTH;\n break;\n case MQC.MQCA_Q_DESC:\n rc = MQC.MQ_Q_DESC_LENGTH;\n break;\n case MQC.MQCA_Q_MGR_DESC:\n rc = MQC.MQ_Q_MGR_DESC_LENGTH;\n break;\n case MQC.MQCA_Q_MGR_IDENTIFIER:\n rc = MQC.MQ_Q_MGR_IDENTIFIER_LENGTH;\n break;\n case MQC.MQCA_QSG_NAME:\n rc = MQC.MQ_QSG_NAME_LENGTH;\n break;\n case MQC.MQCA_SSL_CRYPTO_HARDWARE:\n rc = MQC.SSL_CRYPRO_HARDWARE_LENGTH;\n break;\n case MQC.MQCA_SSL_KEY_REPOSITORY:\n rc = MQC.MQ_SSL_KEY_REPOSITORY_LENGTH;\n break;\n case MQC.MQCA_SSL_KEY_REPO_PASSWORD:\n rc = MQC.MQ_SSL_ENCRYP_KEY_REPO_PWD_LEN;\n break;\n case MQC.MQCA_STORAGE_CLASS:\n rc = MQC.MQ_STORAGE_CLASS_LENGTH;\n break;\n case MQC.MQCA_STREAM_QUEUE_NAME:\n rc = MQC.MQ_Q_NAME_LENGTH;\n break;\n case MQC.MQCA_TCP_NAME:\n rc = MQC.MQ_TCP_NAME_LENGTH;\n break;\n case MQC.MQCA_USER_DATA:\n rc = MQC.MQ_PROCESS_USER_DATA_LENGTH;\n break;\n case MQC.MQCA_VERSION:\n rc = MQC.MQ_VERSION_LENGTH;\n break;\n\n default:\n rc = -1;\n break;\n }\n log.traceExit('mqcaLen', \"len:%d\", rc);\n return rc;\n}", "get size() {\n if (this._available && this._available.length > 0) {\n return this._available.length;\n }\n if (this._pending && this._pending.length > 0) {\n return -this._pending.length;\n }\n return 0;\n }", "function YCellular_get_message()\n {\n var res; // string;\n if (this._cacheExpiration <= YAPI.GetTickCount()) {\n if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) {\n return Y_MESSAGE_INVALID;\n }\n }\n res = this._message;\n return res;\n }", "getDataLength() {\n return this._dataLength;\n }", "getDataLength() {\n return this._dataLength;\n }", "function mqttPacketLength(length) {\n var encLength = '';\n do {\n var encByte = length & 127;\n length = length >> 7;\n // if there are more data to encode, set the top bit of this byte\n if ( length > 0 ) {\n encByte += 128;\n }\n encLength += fromCharCode(encByte);\n } while ( length > 0 )\n return encLength;\n}", "function maximumTraceOrDebugBodyLength(localStorage) {\n var value = localStorage[\"camelMaximumTraceOrDebugBodyLength\"];\n if (angular.isString(value)) {\n value = parseInt(value);\n }\n if (!value) {\n value = Camel.defaultCamelMaximumTraceOrDebugBodyLength;\n }\n return value;\n }", "get length() {\n return this.queue.length;\n }", "function getLength(awesome) { //stringLength == true or false\n return awesome.length //stringLength === true or false\n\n}", "verifyLength(value, len) {\n if (value.length >= len) {\n\n return true;\n }\n return false;\n }", "function derLength(payloadLength) {\n var x;\n if (payloadLength > 127) {\n x = payloadLength;\n while (x) {\n x >>= 8;\n ++payloadLength;\n }\n }\n return payloadLength + 2;\n}", "get getBodyLength(){\n\t\treturn this.body.length;\n\t}", "get length() {\n return this._length;\n }", "function getDataLength(options) {\r\n options.success(serverData.length);\r\n }", "getLength() {\n return 128 * (1 << this.getByte(4));\n }", "get length() {\n Binder.active && Binder.recordEvent(this, 'change');\n return this.base.length;\n }", "readBytesWithLength() {\n const numBytes = this.readUInt8();\n if (numBytes === 0 || numBytes === constants.TNS_NULL_LENGTH_INDICATOR)\n return null;\n return this._readBytesWithLength(numBytes);\n }", "function calculateTotalValue(length) {\r\n var minutes = Math.floor(length / 60),\r\n seconds_int = length - minutes * 60,\r\n seconds_str = seconds_int.toString(),\r\n seconds = seconds_str.substr(0, 2),\r\n time = minutes + ':' + seconds\r\n\r\n return time;\r\n}", "getLength() {\n return this.length;\n }", "getLength() {\n return this.length;\n }", "get length() {\n return this.size;\n }", "function YCellular_get_dataReceived()\n {\n var res; // int;\n if (this._cacheExpiration <= YAPI.GetTickCount()) {\n if (this.load(YAPI.defaultCacheValidity) != YAPI_SUCCESS) {\n return Y_DATARECEIVED_INVALID;\n }\n }\n res = this._dataReceived;\n return res;\n }", "getLength() {\n return this.length;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "verifyLength(value, length) {\n if (value.length >= length) {\n return true;\n }\n return false;\n }", "function toRem(length) {\r\n return (parseInt(length) / rem());\r\n }", "function toRem(length) {\r\n return (parseInt(length) / rem());\r\n }", "get length() {\n return this.buf.length;\n }", "get length() {\n return this.content && this.content.length !== undefined ? this.content.length : 0;\n }", "if(iRequestStart >= oCache.oCacheData.length){\r\n \tbNeedServer=true;\r\n }", "hasLength(length, { timeout = this._node.getTimeout(), comparator = Workflo.Comparator.equalTo, interval = this._node.getInterval(), reverse, } = {}) {\n return this._node.__eventually(() => this._node.wait.hasLength(length, { timeout, comparator, interval, reverse }));\n }", "length() {\n return this.notes.length;\n }", "static verifyLength(value, length) {\n return value.length >= length;\n\n }", "get bytesReceived() {return this._bytesIn;}", "set length(value) {}", "set length(value) {}" ]
[ "0.5973503", "0.57531095", "0.5705053", "0.56768143", "0.56340206", "0.56297034", "0.5623181", "0.56189734", "0.552696", "0.552696", "0.55250967", "0.5461184", "0.5461184", "0.5460237", "0.5415672", "0.540852", "0.5378659", "0.53432685", "0.53349996", "0.5307373", "0.5306705", "0.5285084", "0.5274223", "0.52730125", "0.52620965", "0.5256113", "0.52506495", "0.52475417", "0.52436733", "0.52395165", "0.52362525", "0.5233369", "0.5226523", "0.5226523", "0.5215788", "0.51974547", "0.5195912", "0.5191432", "0.5191432", "0.5182112", "0.516318", "0.5157721", "0.5157721", "0.5149492", "0.5146291", "0.51449966", "0.51449966", "0.51449966", "0.51449966", "0.51406443", "0.5139268", "0.5101633", "0.5101633", "0.5096541", "0.5096153", "0.5095618", "0.50860655", "0.50860655", "0.5078353", "0.5053808", "0.5053441", "0.50465894", "0.5031804", "0.5031804", "0.50069326", "0.5003601", "0.4999239", "0.49749824", "0.4968508", "0.4966447", "0.49628335", "0.4950292", "0.4941784", "0.49364674", "0.49350393", "0.49226397", "0.49181965", "0.48983005", "0.48983005", "0.48911515", "0.48855597", "0.48831052", "0.48819402", "0.48819402", "0.48819402", "0.48819402", "0.48819402", "0.48819402", "0.48819402", "0.48819402", "0.48795265", "0.48795265", "0.48789638", "0.4855468", "0.48533577", "0.48409826", "0.48401457", "0.48381162", "0.48374176", "0.48359546", "0.48359546" ]
0.0
-1
Documentation about the system\'s messaging capabilities for this endpoint not otherwise documented by the conformance statement. For example, process for becoming an authorized messaging exchange partner.
get documentation() { return this.__documentation; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get __resourceType() {\n\t\treturn 'ConformanceMessaging';\n\t}", "function messagingApi()\n{\n\n}", "respondToMessages() { }", "function dmMessage(msg) {\r\n if (msg.content.startsWith(\"settings\")) {\r\n const list = [\"My current settings:\"];\r\n list.push(\"**showJoinMessages**: show join and leave messages.\");\r\n list.push(\"**guestRole**: the role to add new members to.\");\r\n list.push(\"**prefix**: set the prefix.\");\r\n list.push(\"**xp**: turn xp on or off.\");\r\n return msg.reply(list.join(\"\\n\"));\r\n }\r\n return ask(msg);\r\n}", "function interpretMessage(watsonResponse) {\n logExpression(\"In interpretMessage, watsonResponse is: \", 2);\n logExpression(watsonResponse, 2);\n let intents = watsonResponse.intents;\n let entities = watsonResponse.entities;\n let cmd = {};\n if (intents[0].intent == \"Offer\" && intents[0].confidence > 0.2) {\n let extractedOffer = extractOfferFromEntities(entities);\n cmd = {\n quantity: extractedOffer.quantity\n };\n if(extractedOffer.price) {\n cmd.price = extractedOffer.price;\n if(watsonResponse.input.role == \"buyer\") {\n cmd.type = \"BuyOffer\";\n }\n else if (watsonResponse.input.role == \"seller\") {\n cmd.type = \"SellOffer\";\n }\n }\n else {\n if(watsonResponse.input.role == \"buyer\") {\n cmd.type = \"BuyRequest\";\n }\n else if (watsonResponse.input.role == \"seller\") {\n cmd.type = \"SellRequest\";\n }\n }\n }\n else if (intents[0].intent == \"AcceptOffer\" && intents[0].confidence > 0.2) {\n cmd = {\n type: \"AcceptOffer\"\n };\n }\n else if (intents[0].intent == \"RejectOffer\" && intents[0].confidence > 0.2) {\n cmd = {\n type: \"RejectOffer\"\n };\n }\n else if (intents[0].intent == \"Information\" && intents[0].confidence > 0.2) {\n cmd = {\n type: \"Information\"\n };\n }\n else {\n cmd = {\n type: \"NotUnderstood\"\n };\n }\n if(cmd) {\n cmd.metadata = JSON.parse(JSON.stringify(watsonResponse.input));\n if(!cmd.metadata.addressee || cmd.metadata.addressee.length == 0) {\n cmd.metadata.addressee = extractAddressee(entities); // Expect the addressee to be provided, but extract it if necessary\n }\n cmd.metadata.timeStamp = new Date();\n }\n logExpression(\"Returning from interpretMessage with cmd: \", 2);\n logExpression(cmd, 2);\n return cmd;\n}", "respondTo(commandArguments, roomname, originalMessage, messageOptions) {\n return \"Sample command works!\";\n }", "function respondToMessage(messageEvent) {\n if(messageEvent.name === \"didFindRelLink\") {\n receiveNativeShortlinkAvailability(messageEvent.message);\n }\n if(messageEvent.name === \"foundFlickrLink\") {\n receiveFlickrShortlink(messageEvent.message);\n }\n if(messageEvent.name === \"toolbarReady\") {\n confirmedInjectedToolbarReady();\n }\n}", "function requestPermission(message) {\n Notification.requestPermission().then(app.ports.receivePermission.send)\n}", "static enableExtensions() {\n const enableExtensionsParams = Buffer.allocUnsafe(9);\n const subType = 0x15; // 21 - Enable Extensions\n const reserved = 0;\n enableExtensionsParams.writeUInt32BE(vendorId, 0);\n enableExtensionsParams.writeUInt8(subType, 4);\n enableExtensionsParams.writeUInt32BE(reserved, 5);\n return this.makeMessage(messagesType_1.MessagesType.CUSTOM_MESSAGE, 1, enableExtensionsParams);\n }", "sendExperiences () {\n console.log('deprecated')\n }", "async requestPermission() {\n console.log('Requesting permission...');\n // TODO: Blackout the entire screen and show a message saying why we need the permissions.\n // e.g. \"If you would like to receive notifications on this device, grant permission above.\"\n try {\n await this.messaging.requestPermission();\n console.log('Notification permission granted.');\n this.saveToken();\n } catch(err) {\n console.error('Unable to get permission to notify.', err);\n }\n }", "requestPermission() {\n console.log('Requesting permission...');\n // [START request_permission]\n return this.messaging.requestPermission().then(() => {\n console.log('Notification permission granted.');\n // TODO(developer): Retrieve an Instance ID token for use with FCM.\n // [START_EXCLUDE]\n // In many cases once an app has been granted notification permission, it\n // should update its UI reflecting this.\n this.getToken();\n // [END_EXCLUDE]\n }).catch(function(err) {\n console.log('Unable to get permission to notify.', err);\n this.notifyTokenStatusListeners({success: false, alreadySent: false}, new Error(\"Permission denied\"));\n });\n // [END request_permission]\n }", "handleBusMessages() {\n const bus = this.runtime.bus();\n\n Object.values(REQUESTS).forEach((msgType) => {\n bus.on(msgType, (msgData) => {\n this.sendCommMessage(msgType, msgData);\n });\n });\n }", "connect() {\n throw new Error(\n 'The Message Bus is not currently supported in browser environments'\n );\n }", "function messaging( message, callback ) {\n chrome.runtime.sendMessage( message, callback );\n }", "function helpCommand(arg, messageReceived) {\n let helpContent = '```List of commands:\\n\\n';\n const commands = new Help.Helps();\n\n for (var prop in commands.listOfResponses){\n \n let commandDescription = `!${prop} - ${commands.listOfResponses[prop].description}\\n`;\n //console.log('success2');\n console.log(commandDescription);\n helpContent += commandDescription;\n console.log(helpContent);\n };\n helpContent += '```'\n messageReceived.channel.send(helpContent);\n}", "function help() {\r\n common.displayHelp('tsu-amqp');\r\n }", "message(msg) {\n const sessionPath = this.sessionClient.sessionPath(projectId, sessionId);\n const request = {\n session: sessionPath,\n queryInput: {\n text: {\n text: msg,\n languageCode: languageCode,\n },\n },\n };\n\n const processMessage = (resolve, reject) => {\n this.sessionClient\n .detectIntent(request)\n .then(responses => {\n if (responses.length === 0 || !responses[0].queryResult) {\n reject(new Error('incorrect Dialog Flow answer'));\n } else {\n resolve(responses[0].queryResult);\n }\n })\n .catch(err => {\n console.error('ERROR:', err);\n reject(err);\n });\n }\n return new Promise(processMessage);\n }", "function MessageSendingToInDesign() {\r\n\t\r\n\t/**\r\n\t The context in which this snippet can run.\r\n\t @type String\r\n\t*/\r\n\tthis.requiredContext = \"\\tInDesign CS4 must be running.\";\r\n\t$.level = 1; // Debugging level\t\r\n}", "get communication () {\n\t\treturn this._communication;\n\t}", "respond (message)\n {\n throw new Error('Not implemented');\n }", "function Component_MessageBehavior() {\n\n /**\n * Reference to temporary game settings.\n * @property settings\n * @type Object\n * @protected\n */\n this.tempSettings = GameManager.tempSettings;\n\n /**\n * Indicates if the message is currently waiting.\n * @property isWaiting\n * @type boolean\n * @readOnly\n */\n this.isWaiting = false;\n\n /**\n * Indicates if the message is currently running.\n * @property isRunning\n * @type boolean\n * @readOnly\n */\n this.isRunning = false;\n\n /**\n * Indicates if a voice is currently playing together with the message.\n * @property isVoicePlaying\n * @type boolean\n * @readOnly\n */\n this.isVoicePlaying = false;\n\n /**\n * Current message caret/cursor position.\n * @property caretPosition\n * @type gs.Point\n * @readOnly\n */\n this.caretPosition = new gs.Point(0, 0);\n\n /**\n * Current raw message text.\n * @property message\n * @type string\n * @readOnly\n */\n this.message = \"\";\n\n /**\n * All currently displayed raw messages.\n * @property messages\n * @type string[]\n * @readOnly\n */\n this.messages = [];\n\n /**\n * Voice associated with the current message.\n * @property voice\n * @type gs.AudioBufferReference\n */\n this.voice = null;\n\n /**\n * Indicates if current message is partial. DEPRECATED. Please do not use.\n * @property partial\n * @deprecated\n * @type boolean\n * @readOnly\n */\n this.partial = false;\n\n /**\n * Indicates if the message is currently waiting in live-preview.\n * @property waitingPreview\n * @type boolean\n * @readOnly\n */\n this.waitingPreview = false;\n\n /**\n * Indicates if the auto-message is enabled.\n * @property autoMessageEnabled\n * @type boolean\n * @readOnly\n */\n this.autoMessageEnabled = false;\n this.onMessageFinish = (function(_this) {\n return function(sender) {\n _this.object.events.emit(\"finish\", _this);\n if (_this.object.settings.autoErase || _this.object.settings.paragraphSpacing > 0) {\n return _this.message = \"\";\n }\n };\n })(this);\n this.onMessageWaiting = (function(_this) {\n return function(sender) {\n if (!_this.object.textRenderer.isBatched() || !_this.object.textRenderer.isBatchInProgress()) {\n _this.object.textRenderer.waitAtEnd = !_this.partial;\n return _this.object.events.emit(\"waiting\", _this);\n }\n };\n })(this);\n }", "getSupportedTextChannels(){\n return [\n \"dm\", // pv\n \"group\", // pv em grupo\n \"text\", // canal de texto numa guild\n ]\n }", "async say(message) {\n // window.APP.hubChannel.sendMessage(message)\n }", "broadcast () {\n throw new this.context.errors.PreconditionError('Cannot broadcast: the MODBUS protocol does not support realtime');\n }", "get communication() {\n\t\treturn this.__communication;\n\t}", "async requestPermission() {\n try {\n await firebase.messaging().requestPermission();\n } catch (error) {}\n }", "processSimpleMessageAccessories (e) {\n\t\t\tif (e.instance.props.message.content) {\n\t\t\t\tlet message = new BDFDB.DiscordObjects.Message(e.instance.props.message);\n\t\t\t\tfor (let word of e.instance.props.message.content.split(/\\n|\\s|\\r|\\t|\\0/g)) if (word.indexOf(\"https://\") > -1 || word.indexOf(\"http://\") > -1) {\n\t\t\t\t\tword = word.indexOf(\"<\") == 0 && word.indexOf(\">\") == word.length-1 ? word.slice(1,-1) : word;\n\t\t\t\t\tif (!this.isEmbedded(message.embeds, word)) this.injectEmbed(e.instance, message.embeds, word);\n\t\t\t\t}\n\t\t\t\te.instance.props.message = message;\n\t\t\t}\n\t\t}", "function SnpSendArray() {\n\t/**\n\t The context in which this snippet can run.\n\t @type String\n\t*/\n\tthis.requiredContext = \"\\tExecute against Bridge main engine.\\nAdobe Bridge CC 2018 and Adobe Photoshop CC 2018 must be running\";\n\n}", "function onSendMessage(data){\n\t//TODO \n}", "getSupportedTextChannels() {\n return [\n \"dm\", // pv\n \"group\", // pv em grupo\n \"text\", // canal de texto numa guild\n ]\n }", "getSupportedTextChannels() {\n return [\n \"dm\", // pv\n \"group\", // pv em grupo\n \"text\", // canal de texto numa guild\n ]\n }", "getSupportedTextChannels() {\n return [\n \"dm\", // pv\n \"group\", // pv em grupo\n \"text\", // canal de texto numa guild\n ]\n }", "getSupportedTextChannels() {\n return [\n \"dm\", // pv\n \"group\", // pv em grupo\n \"text\", // canal de texto numa guild\n ]\n }", "getSupportedTextChannels() {\n return [\n \"dm\", // pv\n \"group\", // pv em grupo\n \"text\", // canal de texto numa guild\n ]\n }", "async grantUserMessagingPermissions () {\n\t\tconst granterOptions = {\n\t\t\tdata: this.data,\n\t\t\tbroadcaster: this.api.services.broadcaster,\n\t\t\tteam: this.model,\n\t\t\tmembers: [this.user],\n\t\t\trequest: this.request\n\t\t};\n\t\ttry {\n\t\t\tawait new TeamSubscriptionGranter(granterOptions).grantToMembers();\n\t\t}\n\t\tcatch (error) {\n\t\t\tthrow this.errorHandler.error('teamMessagingGrant', { reason: error });\n\t\t}\n\t}", "sendResponseMessage() {\n throw new Error('Sending this version of Response Message is no longer supported');\n }", "function Sms() {\n\n}", "function help(target, context) {\r\n const commands = Object.keys(knownCommands);\r\n\r\n let commandList = \"\";\r\n commands.forEach(command => {\r\n commandList += ` !${command}`;\r\n });\r\n\r\n const message = `We support the following commands: ${commandList}`;\r\n sendMessage(target, context, message);\r\n}", "function systemMessage(msg) {\n}", "getViewportMessageManager() {\n return this.getViewportBrowser().messageManager;\n }", "function noop() {\n console.warn('Hermes messaging is not supported.');\n }", "function requestNotificationsPermissions() {\n // TODO 11: Request permissions to send notifications.\n}", "listMessages(context, params) {\n return this.$axios\n .get(`/sms?${querystring.stringify(params)}`)\n .then(({ data }) => data)\n .catch(this.$catch);\n }", "function sendMessage(){}", "function showPresenceExamples(msg) {\n showPresenceConsole(msg);\n\n document.querySelector('.presence').classList.remove('two');\n document.querySelector('.presence strong').textContent = msg.occupancy;\n document.querySelector('.presence span').textContent = 'player';\n\n if (msg.occupancy > 1) {\n document.querySelector('.presence span').textContent = 'players';\n document.querySelector('.presence').classList.add('two');\n }\n }", "sendHelpMessage(message) {\n if(this.overrideHelpCallback) {\n Logger.debug(\"Control:sendHelpMessage() Using override help callback\");\n this.overrideHelpCallback(message);\n return;\n }\n let helpText = this.catchHelpText;\n for(let field in this.acceptedHelpTexts) {\n helpText += \"\\n • \\'\" + field + \"\\' - \" + this.acceptedHelpTexts[field];\n }\n let sendMessageData = new SendMessageData();\n sendMessageData.setHubotMessage(message);\n sendMessageData.setMessage(helpText);\n if(Object.keys(this.acceptedButtonLabels).length > 0) {\n let style = this.helpQuestionStyle || \"horizontal\";\n sendMessageData.setRequestOptions(false, style);\n for(let key in this.acceptedButtonLabels) {\n let buttonStyle = this.acceptedButtonStyles[key];\n sendMessageData.addQuestionButtonWithName(key, this.acceptedButtonLabels[key], buttonStyle);\n }\n sendMessageData.addRequestUserId(ChatTools.getUserId(message.user));\n }\n this.sendRequestMessage(sendMessageData);\n }", "function requestPermission() {\n self._messaging.requestPermission()\n .then(function () {\n config.FCM.onPermissionGranted();\n fetchToken();\n })\n .catch(function (error) {\n config.FCM.onPermissionDenied(error)\n });\n }", "function help(user, userID, channelID, args, evt) {\n message = 'Available commands:' +\n '\\r\\n`p!ping`: Checks to see if the bot is running' +\n '\\r\\n`p!sub add <pokemon>`: Add a subscription for the specified <pokemon>. You will receive a confirmation DM.' +\n '\\r\\n`p!sub remove <pokemon>`: Removes a subscription for the specified <pokemon>. You will receive a confirmation DM.' +\n '\\r\\n`p!sub list`: Sends a DM with a list of all pokemon you are subscribed to.' +\n '\\r\\n`p!spawn <pokemon>`: Sends a DM to all people subscribed to the specified <pokemon> indicating that one has spawned. If sent as a comment on an image, the uploaded image will also be included in the DM.' +\n '\\r\\n`p!stats`: Sends a DM with some general usage statistics for the bot.'\n\n bot.sendMessage({ to: channelID, message: message });\n}", "function respond(message) {\n var twiml = new MessagingResponse();\n twiml.message(message);\n res.type('text/xml');\n res.send(twiml.toString());\n }", "function listenMessagesFromTopicIframe() {\n window.addEventListener('message', receiveMessage, false);\n}", "function requestMessage() {\n asbService.receiveQueueMessage((queureName + '-recieve'), handleMessage);\n}", "function requestMessage() {\n asbService.receiveQueueMessage((queureName + '-recieve'), handleMessage);\n}", "helpMessage() {\n return \"*!who-knows <skill-name>*\\n\" +\n \"Gibt eine Liste von Kollegen zurück, die den angegebenen Skill beherrschen.\\n\" +\n \"Die Liste wird durch die API von HBT Power bereitgestellt, die Suche ist (noch) case sensitive.\\n\" +\n \" Alias: !wer-weiß, !häää?, !who-knows, wat?\";\n }", "docs() {\n const listOfDetails = [];\n const helpDoc = this.command.docLink || getDocLink(this.command.id);\n if (!helpDoc) {\n return '';\n }\n const hyperLink = urlUtil.convertToHyperlink('MORE INFO', helpDoc);\n // if the terminal doesn't support hyperlink, mention complete url under More Info\n if (hyperLink.isSupported) {\n listOfDetails.push(chalk.bold(hyperLink.url));\n } else {\n listOfDetails.push(chalk.bold('MORE INFO'));\n listOfDetails.push(indent(helpDoc, 2));\n }\n return listOfDetails.join('\\n');\n }", "function sendMessage(msg) {\n self.clients.matchAll().then(res => {\n if (!res.length) {\n debug('SHIM SW Error: no clients are currently controlled.');\n } else {\n debug('SHIM SW Sending...');\n res[0].postMessage(msg);\n }\n });\n }", "async function demo (message: IMessage) {\n console.log(message)\n if (!message.msg) return\n if (/tell everyone/i.test(message.msg)) {\n const match = message.msg.match(/tell everyone (.*)/i)\n if (!match || !match[1]) return\n const sayWhat = `@${message.u!.username} says \"${match[1]}\"`\n const usernames = await api.users.allNames()\n for (let username of usernames) {\n if (username !== botUser.username) {\n const toWhere = await driver.getDirectMessageRoomId(username)\n await driver.sendToRoomId(sayWhat, toWhere) // DM ID hax\n await delay(200) // delay to prevent rate-limit error\n }\n }\n } else if (/who\\'?s online/i.test(message.msg)) {\n const names = await api.users.onlineNames()\n const niceNames = names.join(', ').replace(/, ([^,]*)$/, ' and $1')\n await driver.sendToRoomId(niceNames + ' are online', message.rid!)\n }\n }", "SendMessage() {}", "SendMessage() {}", "SendMessage() {}", "SendMessage() {}", "function notifyHabitica(msg) {\n var data = {\n message: msg,\n toUserId: Vars.UserData.Credentials.uid\n };\n callAPI(\"POST\", 'members/send-private-message', JSON.stringify(data));\n}", "sendHelpIntent() {\n let helpIntent = HelpIntent;\n if (this.sessionAttributes) {\n helpIntent.session.attributes = this.sessionAttributes;\n }\n let self = this;\n return this._sendIntent(helpIntent);\n }", "function ProtocolMessage(messageType, responseReceiverId, message)\r\n{\r\n /**\r\n * Type of the message. This parameter is not used in Eneter for Javascript. \r\n */\r\n this.MessageType = messageType;\r\n \r\n /**\r\n * Client id. This parameter is not used in Eneter for Javascript.\r\n */\r\n this.ResponseReceiverId = responseReceiverId;\r\n \r\n /**\r\n * Decoded message data.\r\n */\r\n this.Message = message;\r\n}", "function respondUnsupported(bot, message) {\n bot.reply(message, {\n type: \"typing\"\n });\n\n bot.reply(message, bot.i18n.__({phrase:'connect_command_respond_unsupported', locale:message.haystack_locale}));\n }", "function receivedMessage(event) {\n var senderID = event.sender.id;\n var recipientID = event.recipient.id;\n var timeOfMessage = event.timestamp;\n var message = event.message;\n\n console.log(\"Received message for user %d and page %d at %d with message:\",\n senderID, recipientID, timeOfMessage);\n\n console.log(\"THIS IS THE MESSAGE WE WANT:\", JSON.stringify(message));\n\n var isEcho = message.is_echo;\n var messageId = message.mid;\n var appId = message.app_id;\n var metadata = message.metadata;\n\n // You may get a text or attachment but not both\n var messageText = message.text;\n var messageAttachments = message.attachments;\n var quickReply = message.quick_reply;\n\n if (isEcho) {\n // Just logging message echoes to console\n console.log(\"Received echo for message %s and app %d with metadata %s\",\n messageId, appId, metadata);\n return;\n } else if (quickReply) {\n var quickReplyPayload = quickReply.payload;\n console.log(\"Quick reply for message %s with payload %s\",\n messageId, quickReplyPayload);\n\n console.log(quickReply);\n console.log(\"quickreply.payload\", quickReplyPayload);\n\n if (quickReply.payload === 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_MAJOR'){\n sendTextMessage(senderID, \"What major are you interested in pursuing?\");\n return;\n }\n if (quickReply.payload === 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_LOCATION'){\n sendTextMessage(senderID, \"Where in the US would you like to study?\", function() {\n locationQuickReply(senderID);\n });\n return;\n }\n if (quickReply.payload === 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_PRICE'){\n sendTextMessage(senderID, \"What is your price range for college tuition per year? (min-max )\");\n return;\n }\n if (quickReply.payload === '0' || '1' || '2' || '3' || '4' || '5' || '6' || '7' || '8' || '9'){\n sendTextMessage(senderID, \"Got it!\", function() {\n majorQuickReply(senderID);\n });\n object.location = quickReply.payload;\n return;\n }\n // receivedPostback(event);\n\n sendTextMessage(senderID, \"quickReply tapped\");\n return;\n }\n\n if (messageText) {\n // var masterList= [];\n // masterList.push(messageText);\n\n // If we receive a text message, check to see if it matches any special\n // keywords and send back the corresponding example. Otherwise, just echo\n // the text we received.\n switch (messageText) {\n case 'image':\n sendImageMessage(senderID);\n break;\n\n case 'boston college, purdue university, indiana university':\n sendTextMessage(senderID, 'Nice! Now, tell me a little bit more about yourself.', function() {\n interestsQuickReply(senderID);\n });\n object.colleges = messageText;\n var schoolList = object.colleges.split(',');\n var item1 = schoolList[0].split(' ').join('%20');\n var item2 = schoolList[1].split(' ').join('%20');\n var item3 = schoolList[2].split(' ').join('%20');\n var completeUrl1 = schoolURL + 'school.name=' +item1 +'&_fields=id,school.name,school.city,school.state,school.school_url,school.price_calculator_url,school.zip' + api_url\n var completeUrl2 = schoolURL + 'school.name=' +item2 +'&_fields=id,school.name,school.city,school.state,school.school_url,school.price_calculator_url,school.zip' + api_url\n var completeUrl3 = schoolURL + 'school.name=' +item3 +'&_fields=id,school.name,school.city,school.state,school.school_url,school.price_calculator_url,school.zip' + api_url\n\n axios.get(completeUrl1)\n .then(function(response) {\n console.log(\"assinging\");\n object.school1 = response.data.results[0];\n })\n .catch(function(error) {\n console.log(\"error\",error);\n })\n axios.get(completeUrl2)\n .then(function(response) {\n object.school2 = response.data.results[0];\n })\n .catch(function(error) {\n console.log(\"error\",error);\n })\n axios.get(completeUrl3)\n .then(function(response) {\n object.school3 = response.data.results[0];\n })\n .catch(function(error) {\n console.log(\"error\",error);\n })\n break;\n\n case 'gif':\n sendGifMessage(senderID);\n break;\n\n case 'audio':\n sendAudioMessage(senderID);\n break;\n\n case 'video':\n sendVideoMessage(senderID);\n break;\n\n case 'file':\n sendFileMessage(senderID);\n break;\n\n case 'axios':\n dbQuery(senderID, object);\n break;\n\n case 'button':\n sendRegionButton1(senderID);\n break;\n\n case 'generic':\n sendGenericMessage(senderID);\n break;\n\n case 'receipt':\n sendReceiptMessage(senderID);\n break;\n\n case 'quick reply':\n interestsQuickReply(senderID);\n break;\n\n case 'read receipt':\n sendReadReceipt(senderID);\n break;\n\n case 'typing on':\n sendTypingOn(senderID);\n break;\n\n case 'typing off':\n sendTypingOff(senderID);\n break;\n\n case 'account linking':\n sendAccountLinking(senderID);\n break;\n\n case '$10,000-$70,000':\n sendTextMessage(senderID, \"Noted!\", function() {\n pricesQuickReply(senderID)\n });\n\n object.price = messageText;\n var priceSplit = object.price.split('-');\n object.minPrice = priceSplit[0].split(',').join('').split('$').join('');\n object.maxPrice = priceSplit[1].split(',').join('').split('$').join('');\n break;\n\n case 'computer':\n sendTextMessage(senderID, \"Awesome! Just a few more questions. What are your SAT or ACT scores (specify range +/- 225)?\");\n object.major = messageText;\n object.majorSplit = object.major.split(' ').join('%20');\n break;\n\n case '1100-1550':\n sendTextMessage(senderID, 'Last thing. Considering the major you told me, what is the ideal range for your projected salary (min-max)?');\n object.SAT = messageText;\n var satSplit = object.SAT.split('-');\n object.satMin = satSplit[0];\n object.satMax = satSplit[1];\n break;\n\n case '$30,000-$80,000':\n sendTextMessage(senderID, 'Got it! I will generate a list of schools that match your interests, including the three you had mentioned earlier:', function() {\n // sendCollegeList(senderID);\n object.salary = messageText;\n var salarySplit = object.salary.split('-');\n object.salaryMin = salarySplit[0].split(',').join('').split('$').join('');\n object.salaryMax = salarySplit[1].split(',').join('').split('$').join('');\n dbQuery(senderID, object);\n });\n break;\n\n default:\n sendTextMessage(senderID, messageText);\n }\n } else if (messageAttachments) {\n sendTextMessage(senderID, \"Message with attachment received\");\n }\n}", "function commandHelp(msg) {\n return msg.channel.sendMessage(HELP_MESSAGE);\n}", "sendMessage (msg, suggestions = []) {\n const requestBody = {\n recipient: { id: this.networkScopedId },\n message: { text: msg }\n }\n\n if (suggestions.length) {\n requestBody.message.quick_replies = suggestions\n .map(str => ({ content_type: 'text', title: str, payload: str }))\n }\n\n // Send the HTTP request to the Messenger Platform\n return axios({\n method: 'POST',\n url: 'https://graph.facebook.com/v2.6/me/messages',\n params: { access_token: process.env.FB_PAGE_ACCESS_TOKEN },\n data: requestBody\n })\n .then(() => { console.log('Message sent' + (msg ? ': ' + msg : '')) })\n .catch(err => {\n if (err && err.isAxiosError) {\n console.error('Unable to send message: ' + msg + ' as got error ' + err, err.response && err.response.data)\n } else {\n console.error('Unable to send message: ' + msg + ' as got error ' + err)\n }\n })\n }", "function Sms() {\n\n }", "handleSendMessage() {\n this.props.sendMessageAction({\n \"userId\": this.state.to,\n \"fromNumber\": this.props.profile.mobile,\n \"text\": this.state.text,\n \"read\": false,\n \"sentDate\": new Date().getTime()\n });\n }", "function help() {\n var helpmsg =\n '!ouste : déconnecte le bot\\n' +\n '!twss : ajoute la dernière phrase dans la liste des TWSS\\n' +\n '!nwss : ajoute la dernière phrase dans la liste des Non-TWSS\\n' +\n '!chut : désactive le bot\\n' +\n '!parle : réactive le bot\\n' +\n '!eval : évalue la commande suivante\\n' +\n '!dbg : met le bot en debug-mode, permettant de logger toute son activité\\n' +\n '!undbg : quitte le debug-mode\\n' +\n '!help : affiche ce message d\\'aide';\n client.say(channel, helpmsg);\n bot.log('message d\\'aide envoyé');\n}", "function polo_route_advertise(message){\n\n}", "async checkPermission() {\n const enabled = await firebase.messaging().hasPermission();\n if (enabled) {\n this.getToken();\n }\n else {\n this.requestPermission();\n }\n }", "handleMessage(message){\n console.log(COMPONENT +' handleMessage()', message);\n if(message.TYPE === 'OrderItems' ){\n this.handleAddProduct(message.Array);\n }else if(message.TYPE === 'Confirmation'){\n this.disabled = true;\n\n /* Refresh record data. */\n refreshApex(this.getRecordResponse);\n }\n }", "function BOT_onIntent() {\r\n\tif(!BOT_theReqAction) return(BOT_reqSay(false,\"WARNING\",\"NEEDACTION\"));\r\n\tvar ta = [BOT_theReqTopic,BOT_theReqAction]; \r\n\tBOT_del(BOT_theUserTopicId,\"intention\",\"VAL\",ta);\r\n\tBOT_add(BOT_theUserTopicId,\"intention\",\"VAL\",ta);\r\n\tBOT_reqSay(true,\"NONE\",\"TAKEINTENTION\",BOT_theReqAction);\r\n}", "sendDescription() {\n this.props.socket.send(this.pc.localDescription);\n }", "broadcast(msg){\n Logger.debug(`Broadcasting to all connections. Topics: ${JSON.stringify(this.topics.toArray())}. Connections: ${JSON.stringify(this.connections.toArray())}`, { cat: \"session\" })\n for (let connId of this.connections){\n console.log(`Sending message to browser connection id: ${connId}`)\n this.connectionManager.sendMessage(connId, msg)\n }\n }", "sendSystemMessage(message) {\r\n var messages = [];\r\n messages.push(message);\r\n\r\n var packet = {\r\n \"type\": \"SYSTEM\",\r\n \"position\": this.messages.length,\r\n \"messages\": messages,\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 respondToMessages(message) {\n console.log(\"New message: \" + JSON.stringify(message));\n\n}", "static get properties(){return{/**\n * Commands to listen for and take action on\n */commands:{name:\"commands\",type:\"Object\",value:{},observer:\"_commandsChanged\"},/**\n * The name that HAL 9000 should respond to.\n */respondsTo:{name:\"respondsTo\",type:\"String\",value:\"(hal)\",observer:\"_respondsToChanged\"},/**\n * Debug mode for annyang\n */debug:{name:\"debug\",type:\"Boolean\",value:!1,observer:\"_debugChanged\"},/**\n * Start automatically\n */auto:{name:\"auto\",type:\"Boolean\",reflectToAttribute:!0,observer:\"_autoChanged\"},/**\n * Status of listening\n */enabled:{name:\"enabled\",type:\"Boolean\",reflectToAttribute:!0,observer:\"_enabledChanged\"},/**\n * Pitch of speech\n */pitch:{name:\"pitch\",type:\"Number\",reflectToAttribute:!0,value:.9},/**\n * Rate of speech\n */rate:{name:\"rate\",type:\"Number\",reflectToAttribute:!0,value:.9},/**\n * Language of the speaker\n */language:{name:\"language\",type:\"String\",reflectToAttribute:!0,value:\"en-US\"}}}", "listenToMessages() {\n navigator.serviceWorker.addEventListener('message', (event) => {\n if (event.data === 'reloadThePageForMAJ') this.showMsg(this._config.msgWhenUpdate);\n if (event.data === 'NotifyUserReqSaved') this.showMsg(this._config.msgSync);\n if (event.data === 'isVisible') event.ports[0].postMessage(this.getVisibilityState());\n });\n }", "_broadcastMessage(message){\n //Publish messages to peer\n this._wire.extended('ut_live_chat', {...message,\n middleman : true\n })\n }", "function sendAddonMessage (msg) {\n browser.runtime.sendMessage(\n\t{source: \"sidebar:\"+myWindowId,\n\t content: msg\n\t}\n ).then(handleMsgResponse, handleMsgError);\n}", "_onMidiMessage(e) {\n // Create Message object from MIDI data\n const message = new Message(e.data);\n /**\n * Event emitted when any MIDI message is received on an `Input`.\n *\n * @event Input#midimessage\n *\n * @type {object}\n *\n * @property {Input} port The `Input` that triggered the event.\n * @property {Input} target The object that dispatched the event.\n * @property {Message} message A [`Message`](Message) object containing information about the\n * incoming MIDI message.\n * @property {number} timestamp The moment (DOMHighResTimeStamp) when the event occurred (in\n * milliseconds since the navigation start of the document).\n * @property {string} type `midimessage`\n *\n * @since 2.1\n */\n\n const event = {\n port: this,\n target: this,\n message: message,\n timestamp: e.timeStamp,\n type: \"midimessage\",\n data: message.data,\n // @deprecated (will be removed in v4)\n rawData: message.data,\n // @deprecated (will be removed in v4)\n statusByte: message.data[0],\n // @deprecated (will be removed in v4)\n dataBytes: message.dataBytes // @deprecated (will be removed in v4)\n\n };\n this.emit(\"midimessage\", event); // Messages are forwarded to InputChannel if they are channel messages or parsed locally for\n // system messages.\n\n if (message.isSystemMessage) {\n // system messages\n this._parseEvent(event);\n } else if (message.isChannelMessage) {\n // channel messages\n this.channels[message.channel]._processMidiMessageEvent(event);\n } // Forward message if forwarders have been defined\n\n\n this._forwarders.forEach(forwarder => forwarder.forward(message));\n }", "function initializeMessageListeners() {\n chrome.extension.onMessage.addListener(\n function(request, sender, sendResponse) {\n if (request.type === 'getGlobalCounts') {\n sendResponse(globalCounts);\n } else if (request.type === 'getVisitForTab') {\n sendResponse(getVisitForTab(request.tab));\n } else if (request.type === 'getEscapeBlockingEnabled') {\n sendResponse(_escapeBlockingEnabled);\n } else if (request.type === 'setEscapeBlockingEnabled') {\n _escapeBlockingEnabled = request.escapeBlockingEnabled;\n console.log(`escape blocking enabled? ${_escapeBlockingEnabled}`);\n } else if (request.type === 'setAnachronismBlockingEnabled') {\n _anachronismBlockingEnabled = request.anachronismBlockingEnabled;\n _anachronismRange = request.anachronismRange;\n \n }\n }\n );\n}", "function help() {\n res.send(\n {\n \"response_type\": \"ephemeral\",\n \"text\": \"Type `/support` for status accross all filters. Add a case link `https://help.disqus.com/agent/case/347519` or an email `archon@gmail.com` to get specific.\",\n }\n )\n }", "function getSchema() { return messageSchema; }", "sendMessage(content_message)\n {\n\n let recipient = this.props.participants.get(this.props.currentUser);\n let sender = this.props.participants.get(recipient)\n\n let message = {\n content : content_message,\n recipient : recipient,\n sender: sender,\n fkConversation : this.props.conversation,\n date:Date.now()\n }\n this.client.send('/EZChat/'+message.fkConversation.id+'/private',{},JSON.stringify(message))\n }", "sendQuickReply( recipientId ) {\n var messageData = {\n recipient: {\n id: recipientId\n },\n message: {\n text: \"What's your favorite movie genre?\",\n metadata: \"DEVELOPER_DEFINED_METADATA\",\n quick_replies: [ {\n \"content_type\": \"text\",\n \"title\": \"Action\",\n \"payload\": \"DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_ACTION\"\n }, {\n \"content_type\": \"text\",\n \"title\": \"Comedy\",\n \"payload\": \"DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_COMEDY\"\n }, {\n \"content_type\": \"text\",\n \"title\": \"Drama\",\n \"payload\": \"DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_DRAMA\"\n } ]\n }\n };\n\n this.callSendAPI( messageData );\n }", "supportsSubscriptions() {\n return false;\n }", "_emitCommandsd() {\n const commands = [];\n\n for (const [cmd, { description }] of this.commands) {\n commands.push({ cmd, description });\n }\n\n process.send({ type: 'commands', commands });\n }", "postMessage(message) {\n return apiClient.post(`https://ourgp.herokuapp.com/api/messages/`, {\n beneficiaryName: message.beneficiaryName, \n recipientName: message.recipientName, \n recipientEmail: message.recipientEmail, \n callsToAction: message.callsToAction, \n videoURL: message.videoUrl\n })\n }", "getWebSocketConnection() {\n throw new Error(\n 'The Message Bus is not currently supported in browser environments'\n );\n }", "async checkPermission() {\n const enabled = await firebase.messaging().hasPermission();\n if (enabled) {\n this.getToken();\n } else {\n this.requestPermission();\n }\n}", "function sendSms(numberPhone, message, flashSms = false) {\n const oAuthHeaders = { Authorization: `Bearer ${access_token}` };\n\n fetch('https://api.nvoip.com.br/v2/sms', {\n method: 'POST',\n headers: { ...defaultHeaders, ...oAuthHeaders },\n body: JSON.stringify({\n numberPhone,\n message,\n flashSms,\n }),\n })\n .then((res) => res.json())\n .then((data) => console.log(data))\n .catch((error) => console.log(error));\n}", "messages() {\n const messages = super.messages();\n messages[ACTIVE].push({\n level: INFO,\n code: \"hermit.scanning\",\n text: \"Scan Hermit QR code now.\",\n });\n return messages;\n }", "isSIPCallingSupported() {\n if (this.moderator) {\n return this.moderator.isSipGatewayEnabled();\n }\n\n return false;\n }", "async requestPermission() {\n try {\n await firebase.messaging().requestPermission();\n // User has authorised\n this.getToken();\n } catch (error) {\n // User has rejected permissions\n console.log('quyền bị hủy');\n }\n }", "requirements({ msg, suffix }) {\n\t\treturn true;\n\t}", "function speak(message) {\n var msg = new SpeechSynthesisUtterance(message);\n var voices = window.speechSynthesis.getVoices();\n console.log(voices);\n msg.voice = voices[Al.voice];\n// msg.voice = voices[0];\n \n Al.isTalking = true;\n window.speechSynthesis.speak(msg);\n DelayisTalkingFalse(1);\n \n console.log(`${message}`);\n// console.log(`click on screen to activate responses`);\n}", "function MessageSettings() {\n\n /**\n * The domain the object belongs to.\n * @property domain\n * @type string\n */\n this.domain = \"com.degica.vnm.default\";\n\n /**\n * Indicates if the message should wait for user-action to continue.\n * @property waitAtEnd\n * @type boolean\n * @default true\n */\n this.waitAtEnd = true;\n\n /**\n * Indicates if the message should automatically erase it's content \n * before displaying the next message.\n * @property autoErase\n * @type boolean\n * @default true\n */\n this.autoErase = true;\n\n /**\n * Indicates if the message should be added to the backlog.\n * @property backlog\n * @type boolean\n * @default true\n */\n this.backlog = true;\n\n /**\n * Spacing between text lines in pixels.\n * @property lineSpacing\n * @type number\n * @default 0\n */\n this.lineSpacing = 0;\n\n /**\n * Left and right padding of a text line in pixels.\n * @property linePadding\n * @type number\n * @default 6\n */\n this.linePadding = 6;\n\n /**\n * Spacing between text paragraphs in pixels. A paragraph is a single\n * message added if the <b>autoErase</b> property is off.\n * @property paragraphSpacing\n * @type number\n * @default 0\n */\n this.paragraphSpacing = 0;\n\n /**\n * Indicates if the defined text-color of the currently speaking character should\n * be used as message text color. That is useful for NVL style messages.\n * @property useCharacterColor\n * @type boolean\n * @default false\n */\n this.useCharacterColor = false;\n }" ]
[ "0.5572481", "0.55370605", "0.52530557", "0.51645625", "0.49713972", "0.49469256", "0.48669818", "0.48559156", "0.48536", "0.4850188", "0.48455974", "0.48206833", "0.47483343", "0.47294652", "0.47022295", "0.4699534", "0.46933493", "0.46722656", "0.46611872", "0.46597084", "0.4658896", "0.4625629", "0.4623009", "0.46174964", "0.4604197", "0.4601718", "0.45860192", "0.4579125", "0.4574408", "0.457434", "0.45670965", "0.45670965", "0.45670965", "0.45670965", "0.45670965", "0.45642233", "0.45632768", "0.4560237", "0.4549663", "0.45492157", "0.45391855", "0.4533303", "0.4527515", "0.45269915", "0.45007095", "0.44972435", "0.44945246", "0.44932652", "0.44906232", "0.44877157", "0.44850215", "0.44711986", "0.44711986", "0.44664323", "0.44640473", "0.4457552", "0.44566324", "0.4455524", "0.4455524", "0.4455524", "0.4455524", "0.445543", "0.44542038", "0.44525847", "0.44514516", "0.44504553", "0.44482368", "0.44448522", "0.4444189", "0.4443465", "0.4439262", "0.4438979", "0.44342834", "0.44315422", "0.44280714", "0.4427688", "0.44243366", "0.4403211", "0.43938142", "0.43928847", "0.4387392", "0.43704873", "0.43683788", "0.43660712", "0.43646276", "0.43617672", "0.43616745", "0.4359093", "0.43568388", "0.43467426", "0.43441442", "0.4340968", "0.43407595", "0.43378374", "0.43372023", "0.43360946", "0.43345252", "0.43301493", "0.43297005", "0.43247056", "0.43240905" ]
0.0
-1
A description of the solution\'s support for an event at this endpoint.
get event() { return this.__event; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function help() {\n res.send(\n {\n \"response_type\": \"ephemeral\",\n \"text\": \"Type `/support` for status accross all filters. Add a case link `https://help.disqus.com/agent/case/347519` or an email `archon@gmail.com` to get specific.\",\n }\n )\n }", "function EventInfo() { }", "function EventInfo() { }", "showDetailedInfo(event) {\n return null;\n }", "helpInfo () {\n\t\tlet me = this;\n\n\t\treturn [\n\t\t\t$('<h3>').append(\n\t\t\t\tt('Adicionar um novo equipamento à aventura')\n\t\t\t),\n\t\t\tEquipament.helpTypeMeaning()\n\t\t];\n\t}", "function getEventDescription(event) {\r\n if (event.message) {\r\n return event.message;\r\n }\r\n if (event.exception && event.exception.values && event.exception.values[0]) {\r\n var exception = event.exception.values[0];\r\n if (exception.type && exception.value) {\r\n return exception.type + \": \" + exception.value;\r\n }\r\n return exception.type || exception.value || event.event_id || '<unknown>';\r\n }\r\n return event.event_id || '<unknown>';\r\n}", "function getEventDescription(event) {\n if (event.message) {\n return event.message;\n }\n else if (event.exception && event.exception.values && event.exception.values[0]) {\n var exception = event.exception.values[0];\n if (exception.type && exception.value) {\n return exception.type + \": \" + exception.value;\n }\n else {\n return exception.type || exception.value || event.event_id || '<unknown>';\n }\n }\n else {\n return event.event_id || '<unknown>';\n }\n}", "function getEventDescription(event) {\n if (event.message) {\n return event.message;\n }\n if (event.exception && event.exception.values && event.exception.values[0]) {\n var exception = event.exception.values[0];\n if (exception.type && exception.value) {\n return exception.type + \": \" + exception.value;\n }\n return exception.type || exception.value || event.event_id || '<unknown>';\n }\n return event.event_id || '<unknown>';\n}", "function getEventDescription(event) {\n if (event.message) {\n return event.message;\n }\n if (event.exception && event.exception.values && event.exception.values[0]) {\n var exception = event.exception.values[0];\n if (exception.type && exception.value) {\n return exception.type + \": \" + exception.value;\n }\n return exception.type || exception.value || event.event_id || '<unknown>';\n }\n return event.event_id || '<unknown>';\n}", "function getEventDescription(event) {\n if (event.message) {\n return event.message;\n }\n if (event.exception && event.exception.values && event.exception.values[0]) {\n var exception = event.exception.values[0];\n if (exception.type && exception.value) {\n return exception.type + \": \" + exception.value;\n }\n return exception.type || exception.value || event.event_id || '<unknown>';\n }\n return event.event_id || '<unknown>';\n}", "function getEventDescription(event) {\n const { message, event_id: eventId } = event;\n if (message) {\n return message;\n }\n\n const firstException = getFirstException(event);\n if (firstException) {\n if (firstException.type && firstException.value) {\n return `${firstException.type}: ${firstException.value}`;\n }\n return firstException.type || firstException.value || eventId || '<unknown>';\n }\n return eventId || '<unknown>';\n }", "function getEventDescription(event) {\n\t const { message, event_id: eventId } = event;\n\t if (message) {\n\t return message;\n\t }\n\n\t const firstException = getFirstException(event);\n\t if (firstException) {\n\t if (firstException.type && firstException.value) {\n\t return `${firstException.type}: ${firstException.value}`;\n\t }\n\t return firstException.type || firstException.value || eventId || '<unknown>';\n\t }\n\t return eventId || '<unknown>';\n\t}", "displayEvent(e) {\n if (e[\"event_type\"] == \"api_call\") {\n let params = e[\"params\"].map(x => x[\"variable_name\"]).join(\", \")\n if (e[\"variables\"] && e[\"variables\"].length > 0) {\n let short_name_variables = e[\"variables\"].flatMap(x => {\n if (\"full_name\" in x) {\n return x[\"full_name\"]\n } else {\n // TODO are there any cases where 'full_name' would be nested\n // somewhere other than inside a 'value' list?\n return x['value'].map(y => y[\"full_name\"])\n }\n }).filter(x => x!= undefined)\n .map(x => x.split(\"_\")[0])\n .reduce((unique, item) =>\n unique.includes(item) ? unique : [...unique, item], [])\n .join(\", \")\n return `API_CALL -> [${short_name_variables}]: ${e[\"endpoint\"]}(${params})`\n } else {\n return `API_CALL: ${e[\"endpoint\"]}(${params})`\n }\n } else if (e[\"event_type\"] == \"agent_utterance\") {\n return `TMPL: ${e[\"template\"]} [${e[\"params\"].join(\", \")}] `\n } else if (e[\"event_type\"] == \"wait_for_user\") {\n return \"REMOVE_ACTION\"\n } else if (e[\"event_type\"] == \"user_utterance\") {\n return `USER_UTTERANCE`\n } else {\n return \"UNKNOWN EVENT CHECK CONSOLE F12\"\n }\n }", "function getEventDescription(event) {\n const { message, event_id: eventId } = event;\n if (message) {\n return message;\n }\n\n const firstException = getFirstException(event);\n if (firstException) {\n if (firstException.type && firstException.value) {\n return `${firstException.type}: ${firstException.value}`;\n }\n return firstException.type || firstException.value || eventId || '<unknown>';\n }\n return eventId || '<unknown>';\n}", "get help() {\n\t\tlet response = \"\"\n\t\tif (this._description) { \n\t\t\tresponse = this._description; \n\t\t}\n\n\t\tresponse += \" - Usage: \" + this.format;\n\t\tresponse += \" - Ex: \" + this.example;\n\n\t\treturn response;\n\t}", "function showQuestionDetailsEvent(paragraphName, questionID) {\n if (!featureEnabled) return;\n logger().logQuestionRequest(simpaticoEservice, paragraphName, questionID);\n }", "supports(eventName) {\n return true;\n }", "function help(event, response, model) {\n let speech;\n let reprompt;\n\n const helpCount = model.getAttr(\"helpCtr\");\n if (helpCount > 2) {\n speech = speaker.get(\"Help3\");\n }\n else if (helpCount === 2) {\n speech = speaker.get(\"Help2\");\n }\n else {\n speech = speaker.get(\"Help\");\n }\n\n reprompt = speaker.get(\"WhatToDo\");\n\n response.speak(speech)\n .listen(speaker.get(\"WhatToDo\"))\n .send();\n}", "helpMessage() {\n return \"*!who-knows <skill-name>*\\n\" +\n \"Gibt eine Liste von Kollegen zurück, die den angegebenen Skill beherrschen.\\n\" +\n \"Die Liste wird durch die API von HBT Power bereitgestellt, die Suche ist (noch) case sensitive.\\n\" +\n \" Alias: !wer-weiß, !häää?, !who-knows, wat?\";\n }", "onDescriptionInfo(changes, cb) {\n cb(unsupportedInfo);\n }", "getEventInformation() {\n let eventInformation = this.props.eventObj.name + ' is organizing ' + this.props.eventObj.purpose + '. Please cast your available Dates!!';\n return eventInformation;\n }", "get supportingInformation() {\n\t\treturn this.__supportingInformation;\n\t}", "supports(eventName) {\n return true;\n }", "supports(eventName) {\n return true;\n }", "supports(eventName) {\n return true;\n }", "supports(eventName) {\n return true;\n }", "supports(eventName) {\n return true;\n }", "get supportingInfo () {\n\t\treturn this._supportingInfo;\n\t}", "function buildEventDescription(data) {\n var title = data.title ? data.title : ' ';\n var description = data.description ? data.description : ' ';\n var speaker = data.speaker ? data.speaker : ' ';\n var room_color = data.room_color ? data.room_color : ' ';\n var desc = `\n Topic: ${title}\\\\n\n Description: ${description}\\\\n\n Speaker: ${speaker}\\\\n\n Room: ${room_color}\\\\n\n `\n return desc;\n}", "static describe () {\n\t\treturn {\n\t\t\ttag: 'invite-info',\n\t\t\tsummary: 'Get the info associated with an invite code',\n\t\t\taccess: 'No standard access rules',\n\t\t\tdescription: 'Use this API fetch the team ID and email associated with an invite code that was generated when a user was invited to a team, and sent in the invite email',\n\t\t\tinput: {\n\t\t\t\tsummary: 'Specify the invite code as a request query parameter',\n\t\t\t\tlooksLike: {\n\t\t\t\t\t'code*': '<Invite code sent in the invite email>'\n\t\t\t\t}\n\t\t\t},\n\t\t\treturns: {\n\t\t\t\tsummary: 'Returns an object containing the email of the invited user, and the ID and name of the team they were invited to',\n\t\t\t\tlooksLike: {\n\t\t\t\t\temail: '<Email of the invited user>',\n\t\t\t\t\tteamId: '<ID of the team the user was invited to>',\n\t\t\t\t\tteamName: '<Name of the team the user was invited to>'\n\t\t\t\t}\n\t\t\t},\n\t\t\terrors: [\n\t\t\t\t'parameterRequired',\n\t\t\t\t'tokenInvalid',\n\t\t\t\t'tokenExpired',\n\t\t\t\t'notFound'\n\t\t\t]\n\t\t};\n\t}", "describe() {\n return \"You've walked into the \" + this._name + \", \" + this._description;\n }", "getDescription() {\n let description = super.getDescription();\n\n if(this.hasMajor()){\n description += `Their major is ${this.major}.`;\n }\n\n return description;\n }", "getDescription() {\n let desc = super.getDescription();\n\n if (this.hasMajor()) {\n desc += ` Their mayor is ${this.major}`;\n }\n\n return desc;\n }", "function help(){\n var fieldId = $(this).prev('input').attr('id');\n var format = getActiveOptionOn(fieldId);\n $.notify(helpFor(format));\n }", "get engineDescription() {\n return this.getStringAttribute('engine_description');\n }", "function speachifyResponse(data){\n var events = data._embedded.events;\n var dyn_text = [];\n \n events.forEach(function(item) {\n var name = getEventName(item.id);\n if(!name) {\n name = item.description;\n }\n var date_str = dateToString(new Date(item.datetime), item.duration);\n \n dyn_text.push(name + \" on \" + date_str); \n });\n\n return dyn_text.join(\" , and, a \");\n}", "get descripion() {\n return this._descripion\n }", "function test_notification_banner_service_event_should_be_shown_in_notification_bell() {}", "getEventTopic(eventFragment) {\n if (typeof (eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__[/* getStatic */ \"e\"])(this.constructor, \"getEventTopic\")(eventFragment);\n }", "function pickHelp(context) {\n var helpMessage = \"\";\n helpMessage = \"<p>Click on UI elements to find out more about them.<br>Click <b>?</b> to hide this pane.<br>Go <a href='changelog.html' >here</a> to see the list of changes and coming features.</p>\";\n return helpMessage;\n }", "function help(event, response, model) {\n let speech;\n let reprompt;\n\n let activeQuestion = model.getActiveQuestion();\n if (activeQuestion) {\n speech = speaker.getQuestionSpeech(activeQuestion, 'help');\n reprompt = speaker.getQuestionSpeech(activeQuestion, 'reprompt');\n \n // ensure the help counter is reset -- it's n/a for question help \n // messages (see defaultActions's help action for details)\n model.clearAttr(\"helpCtr\");\n }\n else {\n // shouldn't reach this point\n speech = speaker.get(\"Help\");\n }\n\n response.speak(speech);\n if (reprompt) {\n response.listen(reprompt);\n }\n response.send();\n}", "sendExperiences () {\n console.log('deprecated')\n }", "function dltTechspecEvent()\r\n{\r\n\tvar url = \"delete\";\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n\r\n\tsectionName = objAjax.getDivSectionId();\r\n\t//alert(\"sectionName \" + sectionName);\r\n\tif(objAjax && objHTMLData)\r\n\t{\r\n\t if(!isValidRecord(true))\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t bShowMsg = true;\r\n\t objAjax.setActionURL(\"techspecevents.do\");\r\n\t objAjax.setActionMethod(url);\r\n\t objAjax.setProcessHandler(_showWorkArea);\r\n\t objAjax.sendRequest();\r\n\t if(objAjax.isProcessComplete())\r\n {\r\n objHTMLData.resetChangeFields();\r\n }\r\n\t}\r\n}", "getEventTopic(eventFragment) {\n if (typeof (eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__ethersproject_properties__[\"e\" /* getStatic */])(this.constructor, \"getEventTopic\")(eventFragment);\n }", "getEventTopic(eventFragment) {\n if (typeof (eventFragment) === \"string\") {\n eventFragment = this.getEvent(eventFragment);\n }\n return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__ethersproject_properties__[\"e\" /* getStatic */])(this.constructor, \"getEventTopic\")(eventFragment);\n }", "function hasAPLSupport(event) {\n if (\n hasIn(event, [\n \"context\",\n \"System\",\n \"device\",\n \"supportedInterfaces\",\n \"Alexa.Presentation.APL\"\n ])\n ) return true;\n else return false;\n}", "function printDesc(event, desc, callback) {\n desc = \"Description: \"+event['description']+\"<br>\"+\n \"Start: \"+moment(event['start']).format(\"LL h:mm A\")+\"<br>\"+\n \"End: \"+moment(event['end']).format(\"LL h:mm A\")+\"<br>\"+\n \"Tags: \";\n getTagNames(event, desc, callback);\n }", "helpText(){\n\n if(this.getStep() === 0 ){\n return ` -== HELP ==-\n The first line is 1 integer, consisting of the number of the number of lines of source code (N).\n The second line is 1 integer, constiting of the number of queries (Q).\n The next N lines consiste of HRML source code, consisting of either an opening tag with zero or more attributes or a closing tag. \n Then the next Q lines contains the queries. \n Each line is a string that references an attribute in the HRML source code.`;\n\n }else if(this.getStep() === 1){\n return 'START';\n }\n }", "function Event(name) {\n // Public properties, assigned to the instance ('this')\n this.name = name;\n /*this.datetime = datetime;\n this.description = description;\n this.location = location;\n this.invited = invited;\n this.messages = messages;\n this.attendenceStatus = attendenceStatus;*/\n }", "function onHelpButtonClick() {\n\t\t\talert(\"帮助:\\n\\n\" +\n\t\t\t\t\"##用得开心就好!##\\n\\n\" +\n\t\t\t\t\"\", \"SPRenderQueueTools\"\n\t\t\t);\n\t\t}", "function dltTechspecEventDetail()\r\n{\r\n\tvar url = \"delete\";\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n\r\n\tsectionName = objAjax.getDivSectionId();\r\n\t//alert(\"sectionName \" + sectionName);\r\n\tif(objAjax && objHTMLData)\r\n\t{\r\n\t bShowMsg = true;\r\n\t objAjax.setActionURL(\"techspecevents.do\");\r\n\t objAjax.setActionMethod(url);\r\n\t objAjax.setProcessHandler(_showWorkArea);\r\n\t \t\r\n\t objHTMLData.performSaveChanges(_showSaveContainerWorkArea, objAjax);\r\n if(objAjax.isProcessComplete())\r\n {\r\n objHTMLData.resetChangeFields();\r\n }\r\n\t}\r\n}", "static about() {\n return \"a vehicle is a means of transportion.\"\n }", "function trackIntercomEvent(eventName, metadata){\n //console.log(eventName);\n //console.log(metadata);\n Intercom('trackEvent', eventName, metadata);\n}", "get htmlDescription(){\n var desc = \"\";\n if(Object.keys(this.inventory).length == 0){\n return '<p>! Gather Resources !</p>';\n }\n else{\n for(var key in this.inventory){\n var value = this.inventory[key];\n desc += \"<p class='resource'>\" + key + \": \" + value + \"</p>\";\n }\n return desc;\n }\n }", "function Event_ToString()\n{\n\t//initialise debug string\n\tvar strDebug = \"Event Debug String:\";\n\tstrDebug += \"\\nObject's id->\" + (this.InterpreterObject ? this.InterpreterObject.DataObject.Id : \"invalid\");\n\tstrDebug += \"\\nEvent Type->\" + (this.Event ? this.Event : \"invalid\");\n\tstrDebug += \"\\nDatas ->\" + (this.Datas ? this.Datas.toString() : \"invalid\");\n\t//no extra data?\n\tif (!this.InterpreterObjectEx)\n\t{\n\t\t//indicate this as a single event\n\t\tstrDebug += \"\\nNo extra event data\";\n\t}\n\telse\n\t{\n\t\t//add extra event data\n\t\tstrDebug += \"\\nObjectEx's id->\" + (this.InterpreterObjectEx ? this.InterpreterObjectEx.DataObject.Id : \"invalid\");\n\t\tstrDebug += \"\\nEventEx Type->\" + (this.EventEx ? this.EventEx : \"invalid\");\n\t\tstrDebug += \"\\nDatasEx ->\" + (this.DatasEx ? this.DatasEx.toString() : \"invalid\");\n\t}\n\t//return it\n\treturn strDebug;\n}", "function addStackInfoHelp(stack) {\n const parent = document.querySelector('#stackinfoexample');\n if (parent === null) {\n wwt.itrace('no #stackinfo found');\n return;\n }\n\n // Need version values for the SAMP button to appear, but doesn't\n // really matter what it is.\n const versionTable = {stkevt3: 20, sensity: 22};\n addStackInfoContents(parent, stack, versionTable, false);\n }", "function eventReporter(e) {\n if (e.type !== \"keypress\") e.preventDefault();\n var display = ''; // Text to display in event box.\n display += (\"<li>Event type: <code>\" + e.type + \"</code></li>\");\n var target_box = ($(e.target).attr('id') ? $(e.target).attr('id') : $(e.target).parent().attr('id'));\n display += (\"<li>Target box: <code>\" + target_box + \"</code></li>\");\n $(\"#event-box-content\").html(display);\n}", "getNormalResponse() {\n return \"Not implemented\";\n }", "static get EVENT() {\n // Get the original event to call\n return overtakenAdaptEvent = overtakenAdaptEvent || function(name, description, event) {\n console.log( 'AdaptEvent: ', {\n name,\n description,\n event,\n } );\n };\n }", "get description() {\n return this._data.description;\n }", "function getDescription(){\n\t\tvar str = \"Select Tool\";\n\n\t\treturn str;\n\t}", "get SUPPORT_RESPONSE_TYPE() {\n 'use strict';\n\n var value = testResponseType();\n Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });\n return value;\n }", "get SUPPORT_RESPONSE_TYPE() {\n 'use strict';\n\n var value = testResponseType();\n Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });\n return value;\n }", "get SUPPORT_RESPONSE_TYPE() {\n 'use strict';\n\n var value = testResponseType();\n Object.defineProperty(FEATURES, 'SUPPORT_RESPONSE_TYPE', { value: value });\n return value;\n }", "get description() { return this._description; }", "featureClickEventHandler(event) {\r\n this.featureEventResponse(event);\r\n }", "get description() {\n\t\treturn this.__description;\n\t}", "get description() {\n\t\treturn this.__description;\n\t}", "get description() {\n\t\treturn this.__description;\n\t}", "get description() {\n\t\treturn this.__description;\n\t}", "get description() {\n\t\treturn this.__description;\n\t}", "function getHotSpotDesc() {\n //Single quote attribute is not supported in mutation view Backbone template.\n //HTML entity is not supported in patient view.\n //Another solution is to use unquoted attribute value which has been\n //supported since HTML2.0\n return \"<b>Recurrent Hotspot</b><br/>\" +\n \"This mutated amino acid was identified as a recurrent hotspot \" +\n \"(statistically significant) in a population-scale cohort of \" +\n \"tumor samples of various cancer types using methodology based in \" +\n \"part on <a href=\\\"http://www.ncbi.nlm.nih.gov/pubmed/26619011\\\" target=\\\"_blank\\\">\" +\n \"Chang et al., Nat Biotechnol, 2016</a>.<br/><br/>\" +\n \"Explore all mutations at \" +\n \"<a href=\\\"http://cancerhotspots.org/\\\" target=\\\"_blank\\\">http://cancerhotspots.org/</a>.\";\n }", "function handleQuickReplyResponse(event) {\n var senderID = event.sender.id;\n var pageID = event.recipient.id;\n var message = event.message;\n var quickReplyPayload = message.quick_reply.payload;\n \n console.log(\"[handleQuickReplyResponse] Handling quick reply response (%s) from sender (%d) to page (%d) with message (%s)\", \n quickReplyPayload, senderID, pageID, JSON.stringify(message));\n \n // use branched conversation with one interaction per feature (each of which contains a variable number of content pieces)\n respondToHelpRequestWithTemplates(senderID, quickReplyPayload);\n \n}", "get eventMessage() {\n var _a;\n return (_a = this._eventData.event_data.message) !== null && _a !== void 0 ? _a : '';\n }", "featureEXAMPLE(config,data) {\n if(data.additional && data.additional.exampleQuery) { //the query key in the config set to \"exampleQuery\"\n return { value: `${data.additional.exampleQuery[0].apps} apps reporting`, tooltip: `There could be even more detail here`}\n }\n }", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "get description () {\n\t\treturn this._description;\n\t}", "docs() {\n const listOfDetails = [];\n const helpDoc = this.command.docLink || getDocLink(this.command.id);\n if (!helpDoc) {\n return '';\n }\n const hyperLink = urlUtil.convertToHyperlink('MORE INFO', helpDoc);\n // if the terminal doesn't support hyperlink, mention complete url under More Info\n if (hyperLink.isSupported) {\n listOfDetails.push(chalk.bold(hyperLink.url));\n } else {\n listOfDetails.push(chalk.bold('MORE INFO'));\n listOfDetails.push(indent(helpDoc, 2));\n }\n return listOfDetails.join('\\n');\n }", "function paragraphEvent(paragraphName) {\n if (!featureEnabled) return;\n // trick for WAE\n if ($('#'+paragraphName).hasClass('wae-disabled')) return;\n if (document.getElementById(paragraphName + \"_questions\") === null) {\n logger().logContentRequest(simpaticoEservice, paragraphName);\n qaeCORE.getInstance().getQuestions(simpaticoEservice, paragraphName, drawQuestionsBox);\n } else {\n hideQuestionsBox(paragraphName);\n }\n }", "function eventDisplay() {\r\n\tdocument.getElementById(\"eventTitle\").innerHTML = eventInfo['title'];\r\n\tdocument.getElementById(\"eventDesc\").innerHTML = eventInfo['description'];\r\n\tlet RSVPslotLim = eventInfo['RSVPslotLim']\r\n\tif ( RSVPslotLim === null) {\r\n\t\tRSVPslotLim = 'Unlimited';\r\n\t}\r\n\tdocument.getElementById(\"RSVPslotLim\").innerHTML = 'Your remaining RSVPs for Event: ' + RSVPremaining;\r\n}", "function createNewQuestionEvent(paragraphName) {\n if (!featureEnabled) return;\n logger().logNewQuestionRequest(simpaticoEservice, paragraphName);\n }", "responsibilities() {\n return 'application development';\n }", "function showMeTheDescription(target) {\n if (target.equipment) return socket.emit('generalMessage', {playerDescription: target.description, name: target.username, equipment: target.equipment});\n socket.emit('generalMessage', {feedback: target.description});\n }", "helpInformation() {\n let desc = [];\n\n if (this._description) {\n desc = [this._description, ''];\n const {\n argsDescription\n } = this;\n\n if (argsDescription && this._args.length) {\n const width = this.padWidth();\n desc.push('Arguments:');\n desc.push('');\n\n this._args.forEach(({\n name\n }) => {\n desc.push(` ${pad(name, width)} ${argsDescription[name]}`);\n });\n\n desc.push('');\n }\n }\n\n let cmdName = this._name;\n\n if (this._alias) {\n cmdName = `${cmdName}|${this._alias}`;\n }\n\n const usage = [`Usage: ${cmdName} ${this.getUsage()}`, ''];\n let cmds = [];\n const commandHelp = this.commandHelp();\n if (commandHelp) cmds = [commandHelp];\n const options = ['Options:', `${this.optionHelp().replace(/^/gm, ' ')}`, ''];\n return usage.concat(desc).concat(options).concat(cmds).join('\\n');\n }", "handleTechChange(e) {\n console.log(\"tech name change:\" + e.target.value);\n }", "get HAMMER_EVENTS() {\n return \"tap press pressup panmove panstart panend swipe swipeleft swiperight\";\n }", "static describe (module) {\n\t\tconst description = GetRequest.describe(module);\n\t\tdescription.description = 'Returns the code error; also returns the referencing post, if any';\n\t\tdescription.access = 'User must be a member of the stream that owns the code error';\n\t\tdescription.returns.summary = 'A code error object, along with any referencing post',\n\t\tObject.assign(description.returns.looksLike, {\n\t\t\tcodeError: '<the fetched @@#code error object#codeError@@>',\n\t\t\tpost: '<the @@#post object#post@@ that references this code error, if any>'\n\t\t});\n\t\treturn description;\n\t}", "function event_type_of_edge(e) {\n if (e === null) return '';\n let str = e[2]['event_str'];\n if (!(typeof str === 'string' || str instanceof String)) {\n str = str[0];\n }\n return '<p>' + e[2]['event_id'] + ': ' + str + '</p>'\n}", "static describe (module) {\n\t\tconst description = PutRequest.describe(module);\n\t\tdescription.access = 'Current user must be admin of the company (under the hood, this means an admin on the \"everyone\" team for the company).';\n\t\tdescription.input = {\n\t\t\tsummary: description.input,\n\t\t\tlooksLike: {\n\t\t\t\t'name': '<Updated name of the company>',\n\t\t\t\t'domainJoining': '<Updated array of domains allowed for domain-based joining',\n\t\t\t\t'codeHostJoining': '<Updated array of code hosts allowed for code host-based joining'\n\t\t\t}\n\t\t};\n\t\tdescription.publishes = {\n\t\t\tsummary: 'Publishes the updated attributes of the company object to the team channel for the \"everyone\" team',\n\t\t\tlooksLike: {\n\t\t\t\tcompany: '<@@#company object#company@@>',\n\t\t\t}\n\t\t};\n\t\treturn description;\n\t}", "function playbackOperationUnsupported(event, response, model) {\n const speech = speaker.get(\"UnsupportedOperation\");\n response.speak(speech)\n .send();\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 }" ]
[ "0.59807265", "0.58813286", "0.58813286", "0.58709836", "0.5836992", "0.5833863", "0.5803397", "0.57737386", "0.57737386", "0.57737386", "0.5642711", "0.5619927", "0.56033987", "0.55560714", "0.55032957", "0.550193", "0.54894936", "0.5484305", "0.54589105", "0.545577", "0.53616536", "0.53455704", "0.52811486", "0.52811486", "0.52811486", "0.52811486", "0.52811486", "0.52475315", "0.5191284", "0.5183195", "0.5154798", "0.51407516", "0.50784373", "0.50251836", "0.5021416", "0.5008252", "0.50070226", "0.49987617", "0.4992764", "0.49828872", "0.49808773", "0.4968272", "0.49680927", "0.4944147", "0.4944147", "0.49381322", "0.49355975", "0.49136406", "0.49132845", "0.49068972", "0.48773974", "0.48657176", "0.48489746", "0.4843201", "0.484027", "0.4832992", "0.4829401", "0.48283887", "0.48234257", "0.48176903", "0.48096156", "0.4797151", "0.4797151", "0.4797151", "0.47946188", "0.4790102", "0.4789157", "0.4789157", "0.4789157", "0.4789157", "0.4789157", "0.47883192", "0.47839093", "0.47756344", "0.4768587", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47677815", "0.47656846", "0.47644812", "0.47518572", "0.47482836", "0.4747864", "0.47296095", "0.47293994", "0.47207317", "0.47195154", "0.47130883", "0.47076863", "0.4704614", "0.47023356", "0.46997184" ]
0.0
-1
Process the markdown source in a doc. The properties that should be processed are configurable, but always include "author", "classdesc", "description", "exceptions", "params", "properties", "returns", and "see". Handled properties can be bare strings, objects, or arrays of objects.
function process(doclet) { tags.forEach((tag) => { if (!doclet[tag]) { return; } if (typeof doclet[tag] === "string" && shouldProcessString(tag, doclet[tag]) ) { doclet[tag] = renderer.render(doclet[tag]) .replace(/\s+$/, "") .replace(/&#39;/g, "'"); } else if (Array.isArray(doclet[tag])) { doclet[tag].forEach((value, index, original) => { if (typeof value === "object") { process(value); return; } const inner = {}; inner[tag] = value; process(inner); original[index] = inner[tag]; }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get properties(){return{source:{name:\"source\",type:\"String\"},hasSource:{name:\"hasSource\",type:\"Boolean\",computed:\"_calculateHasSource(source)\"},markdown:{name:\"markdown\",type:\"String\"}}}", "function process(data) {\n // Translate markdown to html\n return markedAsync(data.content, markedOptions)\n .then(function(html){\n data.html = html;\n if (data.summary) {\n data.summary = data.summary.substr(0, MAX_SUMMARY_LENGTH);\n } else {\n // Cut out the summary\n var cleaned = html.replace(/<[^>]*>/g, '')\n // Treat the Chinese char as double\n , count = MAX_SUMMARY_LENGTH\n , index = -1;\n while (count > 0) {\n if (cleaned.charCodeAt(index += 1) > 0x4dff) {\n count -= 2;\n } else {\n count -= 1;\n }\n }\n data.summary = cleaned.substr(0, index);\n }\n });\n}", "function buildParsed(lines, pos) {\n // EXAMPLE DOC\n /**/// Public: does_something\n /**///\n /**/// Args\n /**/// arg1 - the_arg_value\n /**/// arg2 - the_arg_value\n /**///\n /**/// Returns\n /**/// return - the_return_value\n /**///\n /**/// Notes\n /**/// note - note_multi_line_requires\n /**/// a_set_of_doc_markers\n var docList = []\n , currentDoc = null\n , argMark = false\n , returnMark = false\n , noteMark = false\n for (i=0;i<pos.length;i++) {\n var line = lines[pos[i]]\n //handle initial line\n if ( line.indexOf('Public') > 0\n || line.indexOf('Private') > 0) {\n // if the object exists, we are at a new object so push the current\n if (currentDoc)\n docList.push(currentDoc)\n // start a new object\n var priv = (line.indexOf('Public') > 0) ? 'Public' : 'Private'\n , split = line.split(':')\n , name = split[1].trim()\n currentDoc = new section(priv, name)\n } else if (line.indexOf('Args') > 0) {\n argMark = true\n } else if (line.indexOf('Returns') > 0) {\n returnMark = true\n } else if (line.indexOf('Notes') > 0) {\n noteMark = true\n } else {\n var j = i\n while (argMark) {\n var argLine = lines[pos[j]]\n if (argLine) {\n if ( argLine.indexOf('Returns') > 0\n || argLine.indexOf('Notes') > 0\n || argLine.indexOf('Public') > 0\n || argLine.indexOf('Private') > 0) {\n argMark = false\n i = j - 1\n } else {\n currentDoc.argList.push(argLine.replace('/**/// ',''))\n j++\n }\n } else {\n argMark = false\n i = j - 1\n }\n }\n while (returnMark) {\n var returnLine = lines[pos[j]]\n if (returnLine) {\n if ( returnLine.indexOf('Notes') > 0\n || returnLine.indexOf('Public') > 0\n || returnLine.indexOf('Private') > 0) {\n returnMark = false\n i = j - 1\n } else {\n currentDoc.ret += returnLine.replace('/**/// ','')\n j++\n }\n } else {\n i = j - 1\n returnMark = false\n }\n }\n while (noteMark) {\n var noteLine = lines[pos[j]]\n if (noteLine) {\n if ( noteLine.indexOf('Public') > 0\n || noteLine.indexOf('Private') > 0) {\n noteMark = false\n i = j - 1\n } else {\n currentDoc.notes += noteLine.replace('/**/// ','')\n j++\n }\n } else {\n i = j -1\n noteMark = false\n }\n }\n }\n } // END for\n if (currentDoc)\n docList.push(currentDoc)\n /*\n DEBUG\n */\n //console.log(docList)\n\n return docList\n}", "function markdownDescription(text) { }", "prepareForDocSite() {\n if (this.prepared_) {\n return;\n }\n\n let { stringContents: contents } = this;\n\n contents = this.uncommentMetadata_(contents);\n contents = this.uncommentJekyllSpecifics_(contents);\n contents = this.transformListItemStyles_(contents);\n contents = this.transformWithoutCodeBlocks_(contents, (c) => this.templatizeLocalLinks_(c));\n this.stringContents = contents;\n\n this.prepareMetadata_();\n this.prepared_ = true;\n }", "preprocess(markdown) {\n return markdown;\n }", "async function documentOne(source, config = {}) {\n configure(config)\n\n const buffer = await fs.readFile(source)\n let lines = buffer.toString().split('\\n')\n\n const lang = getLanguage(source, config)\n if (lang) {\n if (lang.literate) {\n lines = litToCode(lines, lang)\n }\n const sections = parse(source, lines, config, lang)\n\n const result = await formatAsHtml(source, sections, config, lang)\n const path = finalPath(source, config)\n\n await write(source, path, result)\n } else {\n console.warn(`docco: file not processed, language not supported: (${path.basename(source)})`)\n }\n}", "function parse(source, lines, config = {}, lang) {\n let codeText, docsText\n const sections = []\n\n configure(config)\n\n docsText = codeText = ''\n for (let line of lines) {\n /* If the line is not empty, it will either go in the code section */\n /* or the docs section, depending on whether the comment character was */\n /* found at the beginning of the line */\n if (line) {\n /* Case #1: it's a \"comment\" */\n /* Text will go in docsText as documentation */\n if (line.match(lang.commentMatcher) && !line.match(lang.commentFilter)) {\n /*\n DETOUR: If there is code in codeText already, close off that section\n the section by pushing it into `sections` and zeroing\n `docsText` and `codeText`\n */\n if (codeText) {\n sections.push({ docsText, codeText })\n docsText = codeText = ''\n }\n\n /* Add the line to the documentation (docsText) taking out the leading */\n /* comment marker */\n if (lang.symbol) {\n line = line.replace(lang.commentMatcher, '')\n }\n docsText += line + '\\n'\n\n /* If the line was a new markdown section (`===`, `---` or `##`), */\n /* close off that section */\n if (/^(---+|===+|#+.*)$/.test(line)) {\n sections.push({ docsText, codeText })\n docsText = codeText = ''\n }\n /* Case #2: it's not a comment */\n /* Note that from this moment on `codeText` is no longer empty, */\n /* which means that the next comment line (destined to docsText) will */\n /* trigger a new section */\n } else {\n codeText += line + '\\n'\n }\n /* If it's an empty line, it will go either in the */\n /* code section or in the docs section. */\n /* We know we are in the code section by checking if */\n /* there is any code in codeText yet */\n } else {\n if (codeText) codeText += line + '\\n'\n else docsText += line + '\\n'\n }\n }\n sections.push({ docsText, codeText })\n\n return sections\n}", "function PostToHTML(relpath, markdown_body) {\n var callback = function (text) {\n\n /* circumvent github's auto-meta parsing */\n text = text.replace(\"(((\",'---');\n text = text.replace(\")))\",'---');\n\n /* write some HTML to format the data */\n var body = document.getElementById(markdown_body);\n var post_head = document.createElement('div');\n var post_body = document.createElement('div');\n body.appendChild(post_head);\n body.appendChild(post_body);\n\n if ((isBlank(text)) || (text == null) || (text == 'null') || (typeof text === 'undefined')) {\n post_head.innerHTML = 'Unable to load text for: '+relpath;\n return;\n }\n\n /* parse YAML header */\n var obj = jsyaml.loadFront(text)\n\n /* check for post meta data */\n var date = typeof obj.Date !== 'undefined' ? obj.Date.toDateString() : '';\n var author = typeof obj.Author !== 'undefined' ? obj.Author : '';\n var summary = typeof obj.Summary !== 'undefined' ? obj.Summary : '';\n var title = typeof obj.Title !== 'undefined' ? obj.Title : '';\n\n /* write some HTML to format the data */\n post_head.innerHTML = '<b>'+title+'</b><br> &nbsp; &nbsp; '+author+\n ' | <small>'+date+'</small><br><br>';\n\n /* convert the unparsed content as markdown */\n post_body.innerHTML = Showdown(obj.__content);\n $('.linenums').removeClass('linenums');\n prettyPrint();\n };\n getFile(relpath, callback);\n}", "function MarkdownParser(options) {\n this.initialize();\n extend(this, this, options, true);\n this.observer = new Observer(this);\n this.markdownSelection = new MarkdownSelection();\n this.listObj = new MDLists({ parent: this, syntax: this.listTags });\n this.formatObj = new MDFormats({ parent: this, syntax: this.formatTags });\n this.undoRedoManager = new UndoRedoCommands(this, options.options);\n this.mdSelectionFormats = new MDSelectionFormats({ parent: this, syntax: this.selectionTags });\n this.linkObj = new MDLink(this);\n this.tableObj = new MDTable({ parent: this, syntaxTag: ({ Formats: this.formatTags, List: this.listTags }) });\n this.clearObj = new ClearFormat(this);\n this.wireEvents();\n }", "function markdownGen(response) {\n return `\n# ${response.title}\n\n# Table of Contents\n\n- [Description](#description)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Contributing](#contributing)\n- [Test](#test)\n- [Credits](#credits)\n- [License](#license)\n- [Questions](#questions)\n\n## Description:\n![License](https://img.shields.io/badge/License-${response.license}-blue.svg \"License Badge\")\n ${response.description}\n\n## Installation:\n ${response.installation}\n\n## Usage:\n ${response.usage}\n\n## Contributing:\n ${response.contribution}\n\n## Test:\n ${response.test}\n\n## Credits:\n ${response.credit}\n\n## License:\n For more information about the License, click the link below:\n- [License](https://opensource.org/licenses/${response.license})\n\n## Questions:\n For questions about this ReadMe Generator, you can visit my GitHub page at the following link:\n- [GitHub Profile](https://github.com/${response.username})\n\nFor additional questions please reach out to my email at: ${response.email}.\n`;\n}", "function pre(context) {\n const { request, content } = context;\n const { document } = content;\n const $ = jquery(document.defaultView);\n\n // Expose the html & body attributes so they can be used in the HTL\n [document.documentElement, document.body].forEach((el) => {\n el.attributesMap = [...el.attributes].reduce((map, attr) => {\n map[attr.name] = attr.value;\n return map;\n }, {});\n });\n\n let $sections = $(document.body).children('div');\n\n // first section has a starting image: add title class and wrap all subsequent items inside a div\n $sections\n .first()\n .has('p:first-child>img')\n .addClass('title')\n .find(':nth-child(1n+2)')\n .wrapAll('<div class=\"header\"></div>');\n\n // sections consisting of only one image\n $sections\n .filter('[data-hlx-types~=\"has-only-image\"]')\n .not('.title')\n .addClass('image');\n\n // sections without image and title class gets a default class\n $sections\n .not('.image')\n .not('.title')\n .addClass('default');\n\n // if there are no sections wrap everything in a default div\n // with appropriate class names from meta\n if ($sections.length === 0) {\n const div = $('<div>').addClass('default');\n if (context.content.meta && context.content.meta.class) {\n context.content.meta.class.split(',').forEach((c) => {\n div.addClass(c.trim());\n });\n }\n $(document.body).children().wrapAll(div);\n $sections = $(document.body).children('div');\n }\n\n // ensure content.data is present\n content.data = content.data || {};\n\n // extract metadata\n const { meta = {} } = content;\n // description: text from paragraphs with 10 or more words\n let match = false;\n const desc = $sections\n .find('p')\n .map(function exractWords() {\n if (match) {\n // already found paragraph for description\n return null;\n }\n const words = $(this).text().trim().split(/\\s+/);\n if (words.length < 10) {\n // skip paragraphs with less than 10 words\n return null;\n }\n match = true;\n return words;\n })\n .toArray();\n meta.description = `${desc.slice(0, 25).join(' ')}${desc.length > 25 ? ' ...' : ''}`;\n meta.url = getAbsoluteUrl(request.headers, request.url);\n meta.imageUrl = getAbsoluteUrl(request.headers, content.image || '/default-meta-image.png');\n}", "set src(src) {\n this\n .fetchMarkdown(src)\n .then(r => this.markdown = r);\n }", "function gendoc(filename,folder) {\n // load js method\n var path = './../lib/';\n var code = fs.readFileSync(path + folder + '/' + filename,'utf8');\n\n // function arguments\n var funstr = /\\$u[.][^{]+/.exec(code)[0].trim();\n var funargs = funstr.split('function')[1];\n\n // comments\n var re = /\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+\\//g;\n var arr = re.exec(code);\n var out = [];\n while (arr !== null) {\n out.push(arr);\n arr = re.exec(code);\n re.lastIndex;\n }\n // category\n var category = out[0][0].replace('/**', '')\n .replace('*/', '')\n .replace(/\\n\\s*\\* ?/g, '\\n')\n .replace(/\\r/g, '');\n\n var txtline = category.split('\\n');\n var catname = txtline[1];\n\n var comment = out[1][0].replace('/**', '')\n .replace('*/', '')\n .replace(/\\n\\s*\\* ?/g, '\\n')\n .replace(/\\r/g, '');\n\n var lines = comment.split('\\n');\n \n doc = {\n 'funargs': funargs,\n 'syntax': '',\n 'category': catname,\n 'name': '',\n 'summary': '',\n 'description': '',\n 'param': [],\n 'returns': [],\n 'example': {},\n 'folder': folder,\n 'filename': filename\n }\n\n \n var count = 0,\n tagdesc = false,\n tagex = false;\n while (count < lines.length) {\n var line = lines[count];\n if (line === '') {\n line = line.replace('','\\n');\n }\n if (line !== '') {\n // method\n if (/^@method/.test(line)) {\n var match = line.replace('@method','');\n doc.name = match.trim();\n }\n // summary\n if (/^@summary/.test(line)) {\n var match = line.replace('@summary','');\n doc.summary = match.trim();\n }\n // description\n if (/^@description/.test(line)) {\n var match = line.replace('@description','');\n doc.description = match.trim();\n tagdesc = true;\n } else\n if (tagdesc === true) {\n if (!/^@/.test(line)) {\n doc.description += ' \\n' + line.trim();\n }\n }\n // parameters\n if (/^@param/.test(line)) {\n tagdesc = false;\n var match = line.replace('@param','')\n .replace('{','')\n .replace('}','')\n .replace(/\\|/g,'/')\n .trim()\n .replace(' ','\\n')\n .replace(' ','\\n')\n .split('\\n');\n doc.param.push(match);\n }\n // returns\n if (/^@return/.test(line)) {\n var match = line.replace('@return','')\n .replace('{','`')\n .replace('}','`')\n .replace(/\\|/g,'/')\n .trim()\n .replace(' ','\\n')\n .replace(' ','\\n')\n .split('\\n');\n doc.returns.push(match);\n }\n // examples\n if (/^@example/.test(line)) {\n var i = 1, txt = [], vars = [],funs = [];\n while (lines[count + i] !== undefined) {\n var tmp = lines[count + i];\n if (/^var/.test(tmp)) {\n vars.push(tmp.trim());\n }\n if (/^ubique/.test(tmp)) {\n funs.push(tmp.trim());\n }\n txt.push(tmp.trim());\n i++;\n }\n doc.example = {'txt':txt, 'vars': vars, 'funs': funs}\n }\n\n }\n count++;\n }\n return doc;\n\n}", "transformMarkdown(params) {\n if (!params.markdown) {\n return { __html: '' };\n }\n return { __html: markdownIt.render(params.markdown) };\n }", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "static renderProperties(properties, tags, modulePathMapper) {\n loop: for (const descriptor of properties) {\n const node = descriptor.node;\n const existingJsDoc = JsDocRenderer.getComment(node);\n const parsed = existingJsDoc == null ? null : doctrine_1.parse(existingJsDoc, { unwrap: true });\n let defaultValue = descriptor.defaultValue;\n let isOptional = descriptor.isOptional;\n let description = parsed == null ? \"\" : parsed.description;\n if (parsed != null) {\n for (const tag of parsed.tags) {\n switch (tag.title) {\n case \"default\":\n defaultValue = tag.description;\n break;\n case \"private\":\n continue loop;\n case \"required\":\n isOptional = false;\n break;\n case \"see\":\n description += `\\nSee: ${tag.description}`;\n break;\n case \"deprecated\":\n description += `\\nDeprecated: {tag.description}`;\n break;\n default: {\n const sourceFile = node.getSourceFile();\n const leadingCommentRanges = ts.getLeadingCommentRanges(sourceFile.text, node.pos);\n const position = sourceFile.getLineAndCharacterOfPosition(leadingCommentRanges[0].pos);\n console.warn(`${path.basename(sourceFile.fileName)} ${position.line + 1}:${position.character} property level tag \"${tag.title}\" are not supported, please file issue`);\n }\n }\n }\n }\n let result = `@property ${renderTypes(descriptor.types, modulePathMapper)} `;\n if (isOptional) {\n result += \"[\";\n }\n result += descriptor.name;\n if (defaultValue != null) {\n result += `=${defaultValue}`;\n }\n if (isOptional) {\n result += \"]\";\n }\n if (description != null) {\n description = description.trim();\n if (description.length > 0) {\n // one \\n is not translated to break as markdown does (because in the code newline means that we don't want to use long line and have to break)\n description = description\n .replace(/\\n\\n/g, \"<br><br>\")\n .replace(/\\n/g, \" \");\n // http://stackoverflow.com/questions/28733282/jsdoc-multiline-description-property\n result += ` ${description}`;\n }\n }\n tags.push(result);\n }\n }", "function generateMarkdown(userResp, userInfo) {\n // We will base the markdown from the Good README directions in 01-HTML\n\n // Title section\n draftMarkdown += \n`\n# ${userResp.title}\n\n![Badge for GitHub repo top language](https://img.shields.io/github/languages/top/${userResp.username}/${userResp.repo}?style=flat&logo=appveyor) ![Badge for GitHub last commit](https://img.shields.io/github/last-commit/${userResp.username}/${userResp.repo}?style=flat&logo=appveyor)\n \nCheck out the badges hosted by [shields.io](https://shields.io/).\n\n\n## Description\n\n${userResp.description}\n`;\n\n // generate table of contents\n let ToC = \n`# Table of Contents`;\n // installation ToC\n if (userResp.installation !== \"\") {\n ToC += \n`\n* [Installation](#installation)\n`};\n\n // usage ToC\n if (userResp.usage !== \"\") {\n ToC += \n`\n* [Usage](#usage)\n`};\n\n // contribute ToC\n if (userResp.contribute !== \"\") {\n ToC += \n`\n* [Contribute](#contribute)\n`};\n\n // tests ToC\n if (userResp.tests !== \"\") {\n ToC += \n`\n* [Tests](#tests)\n`};\n\n // credit ToC\n if (userResp.contribute !== \"\") {\n ToC += \n`\n* [Credits](#credits)\n`};\n\n // license ToC\n if (userResp.contribute !== \"\") {\n ToC += \n`\n* [License](#license)\n`};\n\n draftMarkdown += ToC;\n\n // Installation section\n if (userResp.installation !== \"\") {\n draftMarkdown += \n`\n# Installation\n\n${userResp.installation}\n\n`};\n\n // add Usage section\n if (userResp.usage !== \"\") {\n draftMarkdown += \n`\n# Usage\n\n${userResp.usage}\n\n`};\n\n // contributing section\n if (userResp.contribute !== \"\") {\n draftMarkdown += \n`\n# Contribute\n\n${userResp.contribute}\n\n`};\n\n // tests section\n if (userResp.tests !== \"\") {\n draftMarkdown += \n`\n# Tests\n\n${userResp.tests}\n\n`};\n\n // credit section\n if (userResp.credits !== \"\") {\n draftMarkdown += \n`\n# Credits\n\n${userResp.credits}\n\n`};\n\n // License section\n if (userResp.license !== \"\") {\n draftMarkdown += \n`\n# License\n\n${userResp.license}\n\n`};\n\n // Developer Section\n let devSection = \n`\n\n## Questions or comments?\n\n![Profile pic of the developer](${userInfo.avatar_url})\n\nIf you'd like to contact the developer, please use the info below:\n\n# GitHub:\n\n* @${userInfo.login} \n\n* ${userInfo.url}\n`;\n\n // if github email is valid, add it\n if (userInfo.email !== null) {\n devSection += \n`\n\n* Email: ${userInfo.email}\n`};\n\n // add dev section to markdown\n draftMarkdown += devSection;\n\n // return markdown\n return draftMarkdown;\n}", "function markdown(hljs) {\n const INLINE_HTML = {\n begin: /<\\/?[A-Za-z_]/,\n end: '>',\n subLanguage: 'xml',\n relevance: 0\n };\n const HORIZONTAL_RULE = {\n begin: '^[-\\\\*]{3,}',\n end: '$'\n };\n const CODE = {\n className: 'code',\n variants: [// TODO: fix to allow these to work with sublanguage also\n {\n begin: '(`{3,})[^`](.|\\\\n)*?\\\\1`*[ ]*'\n }, {\n begin: '(~{3,})[^~](.|\\\\n)*?\\\\1~*[ ]*'\n }, // needed to allow markdown as a sublanguage to work\n {\n begin: '```',\n end: '```+[ ]*$'\n }, {\n begin: '~~~',\n end: '~~~+[ ]*$'\n }, {\n begin: '`.+?`'\n }, {\n begin: '(?=^( {4}|\\\\t))',\n // use contains to gobble up multiple lines to allow the block to be whatever size\n // but only have a single open/close tag vs one per line\n contains: [{\n begin: '^( {4}|\\\\t)',\n end: '(\\\\n)$'\n }],\n relevance: 0\n }]\n };\n const LIST = {\n className: 'bullet',\n begin: '^[ \\t]*([*+-]|(\\\\d+\\\\.))(?=\\\\s+)',\n end: '\\\\s+',\n excludeEnd: true\n };\n const LINK_REFERENCE = {\n begin: /^\\[[^\\n]+\\]:/,\n returnBegin: true,\n contains: [{\n className: 'symbol',\n begin: /\\[/,\n end: /\\]/,\n excludeBegin: true,\n excludeEnd: true\n }, {\n className: 'link',\n begin: /:\\s*/,\n end: /$/,\n excludeBegin: true\n }]\n };\n const URL_SCHEME = /[A-Za-z][A-Za-z0-9+.-]*/;\n const LINK = {\n variants: [// too much like nested array access in so many languages\n // to have any real relevance\n {\n begin: /\\[.+?\\]\\[.*?\\]/,\n relevance: 0\n }, // popular internet URLs\n {\n begin: /\\[.+?\\]\\(((data|javascript|mailto):|(?:http|ftp)s?:\\/\\/).*?\\)/,\n relevance: 2\n }, {\n begin: concat$2(/\\[.+?\\]\\(/, URL_SCHEME, /:\\/\\/.*?\\)/),\n relevance: 2\n }, // relative urls\n {\n begin: /\\[.+?\\]\\([./?&#].*?\\)/,\n relevance: 1\n }, // whatever else, lower relevance (might not be a link at all)\n {\n begin: /\\[.+?\\]\\(.*?\\)/,\n relevance: 0\n }],\n returnBegin: true,\n contains: [{\n className: 'string',\n relevance: 0,\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n returnEnd: true\n }, {\n className: 'link',\n relevance: 0,\n begin: '\\\\]\\\\(',\n end: '\\\\)',\n excludeBegin: true,\n excludeEnd: true\n }, {\n className: 'symbol',\n relevance: 0,\n begin: '\\\\]\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true\n }]\n };\n const BOLD = {\n className: 'strong',\n contains: [],\n variants: [{\n begin: /_{2}/,\n end: /_{2}/\n }, {\n begin: /\\*{2}/,\n end: /\\*{2}/\n }]\n };\n const ITALIC = {\n className: 'emphasis',\n contains: [],\n variants: [{\n begin: /\\*(?!\\*)/,\n end: /\\*/\n }, {\n begin: /_(?!_)/,\n end: /_/,\n relevance: 0\n }]\n };\n BOLD.contains.push(ITALIC);\n ITALIC.contains.push(BOLD);\n let CONTAINABLE = [INLINE_HTML, LINK];\n BOLD.contains = BOLD.contains.concat(CONTAINABLE);\n ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);\n CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);\n const HEADER = {\n className: 'section',\n variants: [{\n begin: '^#{1,6}',\n end: '$',\n contains: CONTAINABLE\n }, {\n begin: '(?=^.+?\\\\n[=-]{2,}$)',\n contains: [{\n begin: '^[=-]*$'\n }, {\n begin: '^',\n end: \"\\\\n\",\n contains: CONTAINABLE\n }]\n }]\n };\n const BLOCKQUOTE = {\n className: 'quote',\n begin: '^>\\\\s+',\n contains: CONTAINABLE,\n end: '$'\n };\n return {\n name: 'Markdown',\n aliases: ['md', 'mkdown', 'mkd'],\n contains: [HEADER, INLINE_HTML, LIST, BOLD, ITALIC, BLOCKQUOTE, CODE, HORIZONTAL_RULE, LINK, LINK_REFERENCE]\n };\n}", "constructor () {\n this.markdownParser = new Remarkable('full', { html: true })\n }", "function markdownwiki(options) {\n options = options || {};\n // Enable HTML tags in source\n options.html = options.html == null ? true : options.html;\n // Autoconvert URL-like text to links\n options.linkify = options.linkify == null ? true : options.linkify;\n // Enable some language-neutral replacement + quotes beautification\n options.typographer = options.typographer == null ? true : options.typographer;\n // Convert '\\n' in paragraphs into <br>\n options.breaks = options.breaks == null ? false : options.breaks;\n // jquery container name where to output the md content. default to \".result-html\"\n options.container_name = options.container_name == null ? '.result-html' : options.container_name;\n \n\n // code block highlighter\n if (options.highlight == null) {\n options.highlight = function (str, lang) {\n if (lang && window.hljs.getLanguage(lang)) {\n try {\n return hljs.highlight(lang, str, true).value;\n } catch (__) { }\n }\n return ''; // use external default escaping\n };\n }\n\n // private : internal markdown it renderer. \n var md = window.markdownit(options).use(window.markdownit_wikicmd_plugin);\n\n var mdwiki = {};\n var editor;\n\n var GetEditorText;\n\n // force render a given text\n mdwiki.render = function (text) {\n md.render(text);\n }\n\n // update the content of markdown whenever the editor is changed\n mdwiki.bindToCodeMirrorEditor = function(editor_) {\n editor = editor_;\n GetEditorText = function() {\n return editor && editor.getValue();\n }\n // Setup listeners\n editor.on(\"change\", mdwiki.updateResult);\n }\n\n // NOT tested: update the content of markdown whenever the editor is changed\n mdwiki.bindToAceEditor = function (editor_) {\n editor = editor_;\n GetEditorText = function () {\n return editor && editor.session.getValue();\n }\n // Setup listeners\n editor.on(\"change\", mdwiki.updateResult);\n }\n \n // update result from current editor, this is usually called automatically whenever editor content changed. \n mdwiki.updateResult = function () {\n var source = GetEditorText && GetEditorText();\n $(options.container_name).html(md.render(source));\n }\n return mdwiki;\n}", "function markdown(hljs) {\n const INLINE_HTML = {\n begin: /<\\/?[A-Za-z_]/,\n end: '>',\n subLanguage: 'xml',\n relevance: 0\n };\n const HORIZONTAL_RULE = {\n begin: '^[-\\\\*]{3,}',\n end: '$'\n };\n const CODE = {\n className: 'code',\n variants: [\n // TODO: fix to allow these to work with sublanguage also\n {\n begin: '(`{3,})[^`](.|\\\\n)*?\\\\1`*[ ]*'\n },\n {\n begin: '(~{3,})[^~](.|\\\\n)*?\\\\1~*[ ]*'\n },\n // needed to allow markdown as a sublanguage to work\n {\n begin: '```',\n end: '```+[ ]*$'\n },\n {\n begin: '~~~',\n end: '~~~+[ ]*$'\n },\n {\n begin: '`.+?`'\n },\n {\n begin: '(?=^( {4}|\\\\t))',\n // use contains to gobble up multiple lines to allow the block to be whatever size\n // but only have a single open/close tag vs one per line\n contains: [\n {\n begin: '^( {4}|\\\\t)',\n end: '(\\\\n)$'\n }\n ],\n relevance: 0\n }\n ]\n };\n const LIST = {\n className: 'bullet',\n begin: '^[ \\t]*([*+-]|(\\\\d+\\\\.))(?=\\\\s+)',\n end: '\\\\s+',\n excludeEnd: true\n };\n const LINK_REFERENCE = {\n begin: /^\\[[^\\n]+\\]:/,\n returnBegin: true,\n contains: [\n {\n className: 'symbol',\n begin: /\\[/,\n end: /\\]/,\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: 'link',\n begin: /:\\s*/,\n end: /$/,\n excludeBegin: true\n }\n ]\n };\n const URL_SCHEME = /[A-Za-z][A-Za-z0-9+.-]*/;\n const LINK = {\n variants: [\n // too much like nested array access in so many languages\n // to have any real relevance\n {\n begin: /\\[.+?\\]\\[.*?\\]/,\n relevance: 0\n },\n // popular internet URLs\n {\n begin: /\\[.+?\\]\\(((data|javascript|mailto):|(?:http|ftp)s?:\\/\\/).*?\\)/,\n relevance: 2\n },\n {\n begin: concat(/\\[.+?\\]\\(/, URL_SCHEME, /:\\/\\/.*?\\)/),\n relevance: 2\n },\n // relative urls\n {\n begin: /\\[.+?\\]\\([./?&#].*?\\)/,\n relevance: 1\n },\n // whatever else, lower relevance (might not be a link at all)\n {\n begin: /\\[.+?\\]\\(.*?\\)/,\n relevance: 0\n }\n ],\n returnBegin: true,\n contains: [\n {\n className: 'string',\n relevance: 0,\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n returnEnd: true\n },\n {\n className: 'link',\n relevance: 0,\n begin: '\\\\]\\\\(',\n end: '\\\\)',\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: 'symbol',\n relevance: 0,\n begin: '\\\\]\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true\n }\n ]\n };\n const BOLD = {\n className: 'strong',\n contains: [],\n variants: [\n {\n begin: /_{2}/,\n end: /_{2}/\n },\n {\n begin: /\\*{2}/,\n end: /\\*{2}/\n }\n ]\n };\n const ITALIC = {\n className: 'emphasis',\n contains: [],\n variants: [\n {\n begin: /\\*(?!\\*)/,\n end: /\\*/\n },\n {\n begin: /_(?!_)/,\n end: /_/,\n relevance: 0\n }\n ]\n };\n BOLD.contains.push(ITALIC);\n ITALIC.contains.push(BOLD);\n\n let CONTAINABLE = [\n INLINE_HTML,\n LINK\n ];\n\n BOLD.contains = BOLD.contains.concat(CONTAINABLE);\n ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);\n\n CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);\n\n const HEADER = {\n className: 'section',\n variants: [\n {\n begin: '^#{1,6}',\n end: '$',\n contains: CONTAINABLE\n },\n {\n begin: '(?=^.+?\\\\n[=-]{2,}$)',\n contains: [\n {\n begin: '^[=-]*$'\n },\n {\n begin: '^',\n end: \"\\\\n\",\n contains: CONTAINABLE\n }\n ]\n }\n ]\n };\n\n const BLOCKQUOTE = {\n className: 'quote',\n begin: '^>\\\\s+',\n contains: CONTAINABLE,\n end: '$'\n };\n\n return {\n name: 'Markdown',\n aliases: [\n 'md',\n 'mkdown',\n 'mkd'\n ],\n contains: [\n HEADER,\n INLINE_HTML,\n LIST,\n BOLD,\n ITALIC,\n BLOCKQUOTE,\n CODE,\n HORIZONTAL_RULE,\n LINK,\n LINK_REFERENCE\n ]\n };\n}", "function markdown(hljs) {\n const INLINE_HTML = {\n begin: /<\\/?[A-Za-z_]/,\n end: '>',\n subLanguage: 'xml',\n relevance: 0\n };\n const HORIZONTAL_RULE = {\n begin: '^[-\\\\*]{3,}',\n end: '$'\n };\n const CODE = {\n className: 'code',\n variants: [\n // TODO: fix to allow these to work with sublanguage also\n {\n begin: '(`{3,})[^`](.|\\\\n)*?\\\\1`*[ ]*'\n },\n {\n begin: '(~{3,})[^~](.|\\\\n)*?\\\\1~*[ ]*'\n },\n // needed to allow markdown as a sublanguage to work\n {\n begin: '```',\n end: '```+[ ]*$'\n },\n {\n begin: '~~~',\n end: '~~~+[ ]*$'\n },\n {\n begin: '`.+?`'\n },\n {\n begin: '(?=^( {4}|\\\\t))',\n // use contains to gobble up multiple lines to allow the block to be whatever size\n // but only have a single open/close tag vs one per line\n contains: [\n {\n begin: '^( {4}|\\\\t)',\n end: '(\\\\n)$'\n }\n ],\n relevance: 0\n }\n ]\n };\n const LIST = {\n className: 'bullet',\n begin: '^[ \\t]*([*+-]|(\\\\d+\\\\.))(?=\\\\s+)',\n end: '\\\\s+',\n excludeEnd: true\n };\n const LINK_REFERENCE = {\n begin: /^\\[[^\\n]+\\]:/,\n returnBegin: true,\n contains: [\n {\n className: 'symbol',\n begin: /\\[/,\n end: /\\]/,\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: 'link',\n begin: /:\\s*/,\n end: /$/,\n excludeBegin: true\n }\n ]\n };\n const URL_SCHEME = /[A-Za-z][A-Za-z0-9+.-]*/;\n const LINK = {\n variants: [\n // too much like nested array access in so many languages\n // to have any real relevance\n {\n begin: /\\[.+?\\]\\[.*?\\]/,\n relevance: 0\n },\n // popular internet URLs\n {\n begin: /\\[.+?\\]\\(((data|javascript|mailto):|(?:http|ftp)s?:\\/\\/).*?\\)/,\n relevance: 2\n },\n {\n begin: concat(/\\[.+?\\]\\(/, URL_SCHEME, /:\\/\\/.*?\\)/),\n relevance: 2\n },\n // relative urls\n {\n begin: /\\[.+?\\]\\([./?&#].*?\\)/,\n relevance: 1\n },\n // whatever else, lower relevance (might not be a link at all)\n {\n begin: /\\[.+?\\]\\(.*?\\)/,\n relevance: 0\n }\n ],\n returnBegin: true,\n contains: [\n {\n className: 'string',\n relevance: 0,\n begin: '\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n returnEnd: true\n },\n {\n className: 'link',\n relevance: 0,\n begin: '\\\\]\\\\(',\n end: '\\\\)',\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: 'symbol',\n relevance: 0,\n begin: '\\\\]\\\\[',\n end: '\\\\]',\n excludeBegin: true,\n excludeEnd: true\n }\n ]\n };\n const BOLD = {\n className: 'strong',\n contains: [],\n variants: [\n {\n begin: /_{2}/,\n end: /_{2}/\n },\n {\n begin: /\\*{2}/,\n end: /\\*{2}/\n }\n ]\n };\n const ITALIC = {\n className: 'emphasis',\n contains: [],\n variants: [\n {\n begin: /\\*(?!\\*)/,\n end: /\\*/\n },\n {\n begin: /_(?!_)/,\n end: /_/,\n relevance: 0\n }\n ]\n };\n BOLD.contains.push(ITALIC);\n ITALIC.contains.push(BOLD);\n\n let CONTAINABLE = [\n INLINE_HTML,\n LINK\n ];\n\n BOLD.contains = BOLD.contains.concat(CONTAINABLE);\n ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);\n\n CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);\n\n const HEADER = {\n className: 'section',\n variants: [\n {\n begin: '^#{1,6}',\n end: '$',\n contains: CONTAINABLE\n },\n {\n begin: '(?=^.+?\\\\n[=-]{2,}$)',\n contains: [\n {\n begin: '^[=-]*$'\n },\n {\n begin: '^',\n end: \"\\\\n\",\n contains: CONTAINABLE\n }\n ]\n }\n ]\n };\n\n const BLOCKQUOTE = {\n className: 'quote',\n begin: '^>\\\\s+',\n contains: CONTAINABLE,\n end: '$'\n };\n\n return {\n name: 'Markdown',\n aliases: [\n 'md',\n 'mkdown',\n 'mkd'\n ],\n contains: [\n HEADER,\n INLINE_HTML,\n LIST,\n BOLD,\n ITALIC,\n BLOCKQUOTE,\n CODE,\n HORIZONTAL_RULE,\n LINK,\n LINK_REFERENCE\n ]\n };\n}", "function processParagraph(index, element, inSrc, imageCounter, listCounters, image_path) {\n // First, check for things that require no processing.\n if (element.getNumChildren()==0) {\n return null;\n } \n // Skip on TOC.\n if (element.getType() === DocumentApp.ElementType.TABLE_OF_CONTENTS) {\n return {\"text\": \"[[TOC]]\"};\n }\n \n // Set up for real results.\n var result = {};\n var pOut = \"\";\n var textElements = [];\n var imagePrefix = \"image_\";\n \n // Handle Table elements. Pretty simple-minded now, but works for simple tables.\n // Note that Markdown does not process within block-level HTML, so it probably \n // doesn't make sense to add markup within tables.\n if (element.getType() === DocumentApp.ElementType.TABLE) {\n textElements.push(\"<table>\\n\");\n var nCols = element.getChild(0).getNumCells();\n for (var i = 0; i < element.getNumChildren(); i++) {\n textElements.push(\" <tr>\\n\");\n // process this row\n for (var j = 0; j < nCols; j++) {\n textElements.push(\" <td>\" + element.getChild(i).getChild(j).getText() + \"</td>\\n\");\n }\n textElements.push(\" </tr>\\n\");\n }\n textElements.push(\"</table>\\n\");\n }\n \n // Process various types (ElementType).\n for (var i = 0; i < element.getNumChildren(); i++) {\n var t = element.getChild(i).getType();\n \n if (t === DocumentApp.ElementType.TABLE_ROW) {\n // do nothing: already handled TABLE_ROW\n } else if (t === DocumentApp.ElementType.TEXT) {\n var txt = element.getChild(i);\n pOut += txt.getText();\n textElements.push(txt);\n } else if (t === DocumentApp.ElementType.INLINE_IMAGE) {\n var imglink = element.getChild(i).getLinkUrl();\n result.images = result.images || [];\n var blob = element.getChild(i).getBlob()\n var contentType = blob.getContentType();\n var extension = \"\";\n if (/\\/png$/.test(contentType)) {\n extension = \".png\";\n } else if (/\\/gif$/.test(contentType)) {\n extension = \".gif\";\n } else if (/\\/jpe?g$/.test(contentType)) {\n extension = \".jpg\";\n } else {\n throw \"Unsupported image type: \"+contentType;\n }\n \n var name = imagePrefix + imageCounter + extension;\n blob.setName(name);\n \n imageCounter++;\n if (!return_string || force_save_images) {\n textElements.push('![](' + image_path + '/' + name + ')');\n } else {\n textElements.push('![](' + imglink + ')');\n }\n //result.images.push( {\n // \"bytes\": blob.getBytes(), \n // \"type\": contentType, \n // \"name\": name});\n \n result.images.push({ \"blob\" : blob } )\n \n } else if (t === DocumentApp.ElementType.PAGE_BREAK) {\n // ignore\n } else if (t === DocumentApp.ElementType.HORIZONTAL_RULE) {\n textElements.push('* * *\\n');\n } else if (t === DocumentApp.ElementType.FOOTNOTE) {\n textElements.push(' ('+element.getChild(i).getFootnoteContents().getText()+')');\n } else {\n throw \"Paragraph \"+index+\" of type \"+element.getType()+\" has an unsupported child: \"\n +t+\" \"+(element.getChild(i)[\"getText\"] ? element.getChild(i).getText():'')+\" index=\"+index;\n }\n }\n\n if (textElements.length==0) {\n // Isn't result empty now?\n return result;\n }\n \n var ind_f = element.getIndentFirstLine();\n var ind_s = element.getIndentStart();\n var ind_e = element.getIndentEnd();\n var i_fse = ['ind_f','ind_s','ind_e'];\n var indents = {};\n for (indt=0;indt<i_fse.length;indt++) {\n var indname = i_fse[indt];\n if (eval(indname) > 0) indents[indname] = eval(indname);\n // lazy test, null (no indent) is not greater than zero, but becomes set if indent 'undone'\n }\n var inIndent = (Object.keys(indents).length > 0);\n \n // evb: Add glossary and figure caption too. (And abbreviations: gloss and fig-cap.)\n // process source code block:\n if (/^\\s*---\\s+gloss\\s*$/.test(pOut) || /^\\s*---\\s+source glossary\\s*$/.test(pOut)) {\n result.sourceGlossary = \"start\";\n } else if (/^\\s*---\\s+fig-cap\\s*$/.test(pOut) || /^\\s*---\\s+source fig-cap\\s*$/.test(pOut)) {\n result.sourceFigCap = \"start\";\n } else if (/^\\s*---\\s+src\\s*$/.test(pOut) || /^\\s*---\\s+source code\\s*$/.test(pOut)) {\n result.source = \"start\";\n } else if (/^\\s*---\\s+class\\s+([^ ]+)\\s*$/.test(pOut)) {\n result.inClass = \"start\";\n result.className = RegExp.$1.replace(/\\./g,' ');\n } else if (/^\\s*---\\s*$/.test(pOut)) {\n result.source = \"end\";\n result.sourceGlossary = \"end\";\n result.sourceFigCap = \"end\";\n result.inClass = \"end\";\n } else if (/^\\s*---\\s+jsperf\\s*([^ ]+)\\s*$/.test(pOut)) {\n result.text = '<iframe style=\"width: 100%; height: 240px; overflow: hidden; border: 0;\" '+\n 'src=\"http://www.html5rocks.com/static/jsperfview/embed.html?id='+RegExp.$1+\n '\"></iframe>';\n } else {\n\n prefix = findPrefix(inSrc, element, listCounters);\n \n var pOut = \"\";\n for (var i=0; i<textElements.length; i++) {\n pOut += processTextElement(inSrc, textElements[i]);\n }\n\n // replace Unicode quotation marks (double and single)\n pOut = standardQMarks(pOut);\n \n result.text = prefix+pOut;\n }\n \n var indent_prefix = '> <sub>';\n var indent_alt_prefix = '> ';\n if (inIndent && !inSrc) {\n if (/^#*\\s/.test(result.text)) { // don't subscript-prefix header prefix\n result.text = indent_alt_prefix + result.text;\n } else {\n result.text = indent_prefix + result.text;\n }\n }\n \n return result;\n}", "function generateMarkdown(data) {\n return `\n # Project Title\n <h1 align=\"center\">${data.title} 👋</h1>\n\n <p align=\"center\">\n <img src=\"https://img.shields.io/github/repo-size/MichaelPappas2662/ReadMeGenerator\" />\n <img src=\"https://img.shields.io/github/languages/top/MichaelPappas2662/ReadMeGenerator\" />\n <img src=\"https://img.shields.io/github/issues/MichaelPappas2662/ReadMeGenerator\" />\n <img src=\"https://img.shields.io/github/last-commit/MichaelPappas2662/ReadMeGenerator\" > \n</p>\n\n<p align=\"center\">\n <img src=\"https://img.shields.io/badge/Javascript-yellow\" />\n <img src=\"https://img.shields.io/badge/jQuery-blue\" />\n <img src=\"https://img.shields.io/badge/-node.js-green\" />\n <img src=\"https://img.shields.io/badge/-inquirer-red\" >\n <img src=\"https://img.shields.io/badge/-screencastify-lightgrey\" />\n <img src=\"https://img.shields.io/badge/-json-orange\" />\n</p>\n\n\n # Description\n ${renderLicenseBadge(data.license)}\n\n ${data.description}\n # Table of Contents \n * [Installation](#-Installation)\n * [Usage](#-Usage)\n * [License](#-Installation)\n * [Contributing](#-Contributing)\n * [Tests](#-Tests)\n * [Questions](#-Contact-Information)\n \n # Installation\n ${data.installation}\n # Usage\n ${data.usage}\n # License \n ${renderLicenseSection(data.license)}\n # Contributing \n ${data.contribute}\n # Tests\n ${data.tests}\n # Contact Information \n ![Developer Profile Picture](${data.avatar_url}) \n * GitHub Username: ${data.username}\n * Contact Email: ${data.userEmail}\n \n`;\n}", "function markdown(hljs) {\n const INLINE_HTML = {\n begin: '<', end: '>',\n subLanguage: 'xml',\n relevance: 0\n };\n const HORIZONTAL_RULE = {\n begin: '^[-\\\\*]{3,}', end: '$'\n };\n const CODE = {\n className: 'code',\n variants: [\n // TODO: fix to allow these to work with sublanguage also\n { begin: '(`{3,})(.|\\\\n)*?\\\\1`*[ ]*', },\n { begin: '(~{3,})(.|\\\\n)*?\\\\1~*[ ]*', },\n // needed to allow markdown as a sublanguage to work\n { begin: '```', end: '```+[ ]*$' },\n { begin: '~~~', end: '~~~+[ ]*$' },\n { begin: '`.+?`' },\n {\n begin: '(?=^( {4}|\\\\t))',\n // use contains to gobble up multiple lines to allow the block to be whatever size\n // but only have a single open/close tag vs one per line\n contains: [\n { begin: '^( {4}|\\\\t)', end: '(\\\\n)$' }\n ],\n relevance: 0\n }\n ]\n };\n const LIST = {\n className: 'bullet',\n begin: '^[ \\t]*([*+-]|(\\\\d+\\\\.))(?=\\\\s+)',\n end: '\\\\s+',\n excludeEnd: true\n };\n const LINK_REFERENCE = {\n begin: /^\\[[^\\n]+\\]:/,\n returnBegin: true,\n contains: [\n {\n className: 'symbol',\n begin: /\\[/, end: /\\]/,\n excludeBegin: true, excludeEnd: true\n },\n {\n className: 'link',\n begin: /:\\s*/, end: /$/,\n excludeBegin: true\n }\n ]\n };\n const LINK = {\n begin: '\\\\[.+?\\\\][\\\\(\\\\[].*?[\\\\)\\\\]]',\n returnBegin: true,\n contains: [\n {\n className: 'string',\n begin: '\\\\[', end: '\\\\]',\n excludeBegin: true,\n returnEnd: true,\n relevance: 0\n },\n {\n className: 'link',\n begin: '\\\\]\\\\(', end: '\\\\)',\n excludeBegin: true, excludeEnd: true\n },\n {\n className: 'symbol',\n begin: '\\\\]\\\\[', end: '\\\\]',\n excludeBegin: true, excludeEnd: true\n }\n ],\n relevance: 10\n };\n const BOLD = {\n className: 'strong',\n contains: [],\n variants: [\n {begin: /_{2}/, end: /_{2}/ },\n {begin: /\\*{2}/, end: /\\*{2}/ }\n ]\n };\n const ITALIC = {\n className: 'emphasis',\n contains: [],\n variants: [\n { begin: /\\*(?!\\*)/, end: /\\*/ },\n { begin: /_(?!_)/, end: /_/, relevance: 0},\n ]\n };\n BOLD.contains.push(ITALIC);\n ITALIC.contains.push(BOLD);\n\n var CONTAINABLE = [\n INLINE_HTML,\n LINK\n ];\n\n BOLD.contains = BOLD.contains.concat(CONTAINABLE);\n ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);\n\n CONTAINABLE = CONTAINABLE.concat(BOLD,ITALIC);\n\n const HEADER = {\n className: 'section',\n variants: [\n {\n begin: '^#{1,6}',\n end: '$',\n contains: CONTAINABLE\n },\n {\n begin: '(?=^.+?\\\\n[=-]{2,}$)',\n contains: [\n { begin: '^[=-]*$' },\n { begin: '^', end: \"\\\\n\", contains: CONTAINABLE },\n ]\n }\n ]\n };\n\n const BLOCKQUOTE = {\n className: 'quote',\n begin: '^>\\\\s+',\n contains: CONTAINABLE,\n end: '$',\n };\n\n return {\n name: 'Markdown',\n aliases: ['md', 'mkdown', 'mkd'],\n contains: [\n HEADER,\n INLINE_HTML,\n LIST,\n BOLD,\n ITALIC,\n BLOCKQUOTE,\n CODE,\n HORIZONTAL_RULE,\n LINK,\n LINK_REFERENCE\n ]\n };\n}", "function markdown(hljs) {\n const INLINE_HTML = {\n begin: '<', end: '>',\n subLanguage: 'xml',\n relevance: 0\n };\n const HORIZONTAL_RULE = {\n begin: '^[-\\\\*]{3,}', end: '$'\n };\n const CODE = {\n className: 'code',\n variants: [\n // TODO: fix to allow these to work with sublanguage also\n { begin: '(`{3,})(.|\\\\n)*?\\\\1`*[ ]*', },\n { begin: '(~{3,})(.|\\\\n)*?\\\\1~*[ ]*', },\n // needed to allow markdown as a sublanguage to work\n { begin: '```', end: '```+[ ]*$' },\n { begin: '~~~', end: '~~~+[ ]*$' },\n { begin: '`.+?`' },\n {\n begin: '(?=^( {4}|\\\\t))',\n // use contains to gobble up multiple lines to allow the block to be whatever size\n // but only have a single open/close tag vs one per line\n contains: [\n { begin: '^( {4}|\\\\t)', end: '(\\\\n)$' }\n ],\n relevance: 0\n }\n ]\n };\n const LIST = {\n className: 'bullet',\n begin: '^[ \\t]*([*+-]|(\\\\d+\\\\.))(?=\\\\s+)',\n end: '\\\\s+',\n excludeEnd: true\n };\n const LINK_REFERENCE = {\n begin: /^\\[[^\\n]+\\]:/,\n returnBegin: true,\n contains: [\n {\n className: 'symbol',\n begin: /\\[/, end: /\\]/,\n excludeBegin: true, excludeEnd: true\n },\n {\n className: 'link',\n begin: /:\\s*/, end: /$/,\n excludeBegin: true\n }\n ]\n };\n const LINK = {\n begin: '\\\\[.+?\\\\][\\\\(\\\\[].*?[\\\\)\\\\]]',\n returnBegin: true,\n contains: [\n {\n className: 'string',\n begin: '\\\\[', end: '\\\\]',\n excludeBegin: true,\n returnEnd: true,\n relevance: 0\n },\n {\n className: 'link',\n begin: '\\\\]\\\\(', end: '\\\\)',\n excludeBegin: true, excludeEnd: true\n },\n {\n className: 'symbol',\n begin: '\\\\]\\\\[', end: '\\\\]',\n excludeBegin: true, excludeEnd: true\n }\n ],\n relevance: 10\n };\n const BOLD = {\n className: 'strong',\n contains: [],\n variants: [\n {begin: /_{2}/, end: /_{2}/ },\n {begin: /\\*{2}/, end: /\\*{2}/ }\n ]\n };\n const ITALIC = {\n className: 'emphasis',\n contains: [],\n variants: [\n { begin: /\\*(?!\\*)/, end: /\\*/ },\n { begin: /_(?!_)/, end: /_/, relevance: 0},\n ]\n };\n BOLD.contains.push(ITALIC);\n ITALIC.contains.push(BOLD);\n\n var CONTAINABLE = [\n INLINE_HTML,\n LINK\n ];\n\n BOLD.contains = BOLD.contains.concat(CONTAINABLE);\n ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);\n\n CONTAINABLE = CONTAINABLE.concat(BOLD,ITALIC);\n\n const HEADER = {\n className: 'section',\n variants: [\n {\n begin: '^#{1,6}',\n end: '$',\n contains: CONTAINABLE\n },\n {\n begin: '(?=^.+?\\\\n[=-]{2,}$)',\n contains: [\n { begin: '^[=-]*$' },\n { begin: '^', end: \"\\\\n\", contains: CONTAINABLE },\n ]\n }\n ]\n };\n\n const BLOCKQUOTE = {\n className: 'quote',\n begin: '^>\\\\s+',\n contains: CONTAINABLE,\n end: '$',\n };\n\n return {\n name: 'Markdown',\n aliases: ['md', 'mkdown', 'mkd'],\n contains: [\n HEADER,\n INLINE_HTML,\n LIST,\n BOLD,\n ITALIC,\n BLOCKQUOTE,\n CODE,\n HORIZONTAL_RULE,\n LINK,\n LINK_REFERENCE\n ]\n };\n}", "function Markdown() {\n var self = this;\n this.worker = new Worker('scripts/modules/markdown/workers/markdown.js');\n\n // Promise which signifies whether the worker is ready\n this.workerPromise = Q.defer();\n\n this.worker.onmessage = function(data) {\n var msg = data.data;\n\n switch (msg.msg) {\n\n // Webworker is ready\n case 'ready':\n self.workerPromise.resolve();\n break;\n\n // Request was fullfilled\n case 'done':\n self.promises[msg.promiseId].resolve(msg.data);\n delete self.promises[msg.promiseId];\n break;\n\n // Request failed with errors\n case 'fail':\n self.promises[msg.promiseId].reject(msg.data);\n delete self.promises[msg.promiseId];\n break;\n\n default:\n }\n };\n }", "function RenderedMarkdown(options) {\n var _this = _super.call(this, options) || this;\n _this._rendered = false;\n _this._urlResolved = null;\n _this.addClass(MARKDOWN_CLASS);\n // Initialize the marked library if necessary.\n Private.initializeMarked();\n var source = Private.getSource(options);\n var parts = _1.removeMath(source);\n // Add the markdown content asynchronously.\n marked(parts['text'], function (err, content) {\n if (err) {\n console.error(err);\n return;\n }\n content = _1.replaceMath(content, parts['math']);\n if (!options.model.trusted) {\n content = options.sanitizer.sanitize(content);\n }\n Private.appendHtml(_this.node, content);\n if (options.resolver) {\n _this._urlResolved = Private.handleUrls(_this.node, options.resolver, options.linkHandler);\n }\n Private.headerAnchors(_this.node);\n _this.fit();\n _this._rendered = true;\n if (_this.isAttached) {\n if (_this._urlResolved) {\n _this._urlResolved.then(function () { _1.typeset(_this.node); });\n }\n else {\n _1.typeset(_this.node);\n }\n }\n });\n return _this;\n }", "function markdownPage (req, res, next, params) {\n fs.readFile(params.mdfile, 'utf8', function (err, data) {\n if (err) {\n console.error(err)\n res.status(500).send('Cannot open ' + params.mdfile)\n return\n }\n // Replace variables in markdown file\n data = data.replace(/#{(.+?)}/g, function (m, c1) {\n return res.locals[c1]\n })\n var content = marked(data)\n content = content.replace(/<table>/g, '<table class=\"table\">')\n if (typeof params.replacer === 'function') {\n content = params.replacer(content)\n }\n res.render('index', { title: params.title, body: content })\n })\n}", "function generateMarkdown(data) {\n console.log(data)\n\nreturn `\n# ${data.title} \n \n![license](https://img.shields.io/badge/License-${data.license.split(' ').join('%20')}-blue?style=for-the-badge)\n\n \n## Description\n${data.description}\n\n${data.motivation}\n\n\n## Table of Contents\n \n* [Description](#description)\n* [Features](#features)\n* [Languages](#languages)\n* [Link](#link)\n* [Usage](#usage)\n* [Installation](#installation)\n* [Screenshots](#screenshots)\n* [Questions](#questions)\n* [License](#license)\n${contributeLink(data.contribute)}\n${testLink(data.test)}\n\n\n${generateFeatures(data.features)}\n \n\n## Languages\n\n${data.languages.join(', ')}\n\n\n## Link \n\n[${data.title} Deployed Page](${data.link})\n\n\n## Usage\n\n${data.usage}\n\n\n${generateInstructions(data.instructions)}\n\n\n${generatePics(data.screenShot)}\n\n## Credits\n\n${generateAuthors(data.authors)}\n\n\n## Questions\n\nFind my [GitHub Link](${data.userGithub}) here!\n \nIf you have any questions send me an email at [${data.email}](mailto:${data.email})\n\n\n## License\n\nThis project is covered under ${data.license}\n\n\n${generateContribute(data.contribute)}\n \n\n${generateTest(data.test)}\n\n`;\n}", "function generateMarkdown(data) {\n var link = \"\";\n switch (data.license) {\n case \"MIT\":\n link =\n \"(https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\";\n break;\n case \"Mozilla Public License 2.0\":\n link =\n \"(https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)\";\n break;\n case \"Open Database License\":\n link =\n \"(https://img.shields.io/badge/License-ODbL-brightgreen.svg)](https://opendatacommons.org/licenses/odbl/)\";\n break;\n case \"ISC\":\n link =\n \"(https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)\";\n }\n\n return `\n [![License: ${data.license} ]${link}\n \n # Table of contents\n [description](#description)\n\n [installation](#installation)\n\n [questions](#questions)\n\n\n # Description\n\n ${data.description}\n\n # installation\n\n This program needs ${data.installation} to be installed before being run\n\n # Questions\n\n My github is ${data.github} if you would like to check out my other repos.\n If you have any questions, please feel free to email me @${data.email}\n\n\n\n\n\n `;\n\n /**\n * the table of contents would be first, with the link for each element within brackets\n * the content of each section would be rendered using the ${} notation and populated with the response object\n * I'm not too worried about the markdown syntax, as I am just happy that I got the function to call and write to a file successfully\n */\n}", "function generateMarkdown({ title, description, installation, usage, contributing, tests, license, email, github }) {\n return `\n## ${title}\n\n## Description\n\n${description}\n\n\n${renderLicenseBadge(license)}\n\n## Table of Contents\n1. [Description](#description)\n2. [Installation](#installation)\n3. [Usage](#usage)\n4. [Contributing](#contributing)\n5. [Tests](#tests)\n6. [Questions](#questions)\n\n## Installation\n\n${installation}\n\n## Usage\n\n${usage}\n\n## Contributing\n\n${contributing}\n\n## Tests\n\n${tests}\n\n## Licenses\n\n${renderLicenseLink(license)}\n${renderLicenseSection(license)}\n\n## Questions\nPlease check out my [github profile](${github}) for more questions on the methodology and what have you.\nI can also be addressed at [${email}](${email}) for direct requests.\n`;\n\n}", "function $84964f0d2be25bfb$var$markdown(hljs) {\n const INLINE_HTML = {\n begin: /<\\/?[A-Za-z_]/,\n end: \">\",\n subLanguage: \"xml\",\n relevance: 0\n };\n const HORIZONTAL_RULE = {\n begin: \"^[-\\\\*]{3,}\",\n end: \"$\"\n };\n const CODE = {\n className: \"code\",\n variants: [\n // TODO: fix to allow these to work with sublanguage also\n {\n begin: \"(`{3,})[^`](.|\\\\n)*?\\\\1`*[ ]*\"\n },\n {\n begin: \"(~{3,})[^~](.|\\\\n)*?\\\\1~*[ ]*\"\n },\n // needed to allow markdown as a sublanguage to work\n {\n begin: \"```\",\n end: \"```+[ ]*$\"\n },\n {\n begin: \"~~~\",\n end: \"~~~+[ ]*$\"\n },\n {\n begin: \"`.+?`\"\n },\n {\n begin: \"(?=^( {4}|\\\\t))\",\n // use contains to gobble up multiple lines to allow the block to be whatever size\n // but only have a single open/close tag vs one per line\n contains: [\n {\n begin: \"^( {4}|\\\\t)\",\n end: \"(\\\\n)$\"\n }\n ],\n relevance: 0\n }\n ]\n };\n const LIST = {\n className: \"bullet\",\n begin: \"^[ \t]*([*+-]|(\\\\d+\\\\.))(?=\\\\s+)\",\n end: \"\\\\s+\",\n excludeEnd: true\n };\n const LINK_REFERENCE = {\n begin: /^\\[[^\\n]+\\]:/,\n returnBegin: true,\n contains: [\n {\n className: \"symbol\",\n begin: /\\[/,\n end: /\\]/,\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: \"link\",\n begin: /:\\s*/,\n end: /$/,\n excludeBegin: true\n }\n ]\n };\n const URL_SCHEME = /[A-Za-z][A-Za-z0-9+.-]*/;\n const LINK = {\n variants: [\n // too much like nested array access in so many languages\n // to have any real relevance\n {\n begin: /\\[.+?\\]\\[.*?\\]/,\n relevance: 0\n },\n // popular internet URLs\n {\n begin: /\\[.+?\\]\\(((data|javascript|mailto):|(?:http|ftp)s?:\\/\\/).*?\\)/,\n relevance: 2\n },\n {\n begin: $84964f0d2be25bfb$var$concat(/\\[.+?\\]\\(/, URL_SCHEME, /:\\/\\/.*?\\)/),\n relevance: 2\n },\n // relative urls\n {\n begin: /\\[.+?\\]\\([./?&#].*?\\)/,\n relevance: 1\n },\n // whatever else, lower relevance (might not be a link at all)\n {\n begin: /\\[.+?\\]\\(.*?\\)/,\n relevance: 0\n }\n ],\n returnBegin: true,\n contains: [\n {\n className: \"string\",\n relevance: 0,\n begin: \"\\\\[\",\n end: \"\\\\]\",\n excludeBegin: true,\n returnEnd: true\n },\n {\n className: \"link\",\n relevance: 0,\n begin: \"\\\\]\\\\(\",\n end: \"\\\\)\",\n excludeBegin: true,\n excludeEnd: true\n },\n {\n className: \"symbol\",\n relevance: 0,\n begin: \"\\\\]\\\\[\",\n end: \"\\\\]\",\n excludeBegin: true,\n excludeEnd: true\n }\n ]\n };\n const BOLD = {\n className: \"strong\",\n contains: [],\n variants: [\n {\n begin: /_{2}/,\n end: /_{2}/\n },\n {\n begin: /\\*{2}/,\n end: /\\*{2}/\n }\n ]\n };\n const ITALIC = {\n className: \"emphasis\",\n contains: [],\n variants: [\n {\n begin: /\\*(?!\\*)/,\n end: /\\*/\n },\n {\n begin: /_(?!_)/,\n end: /_/,\n relevance: 0\n }\n ]\n };\n BOLD.contains.push(ITALIC);\n ITALIC.contains.push(BOLD);\n let CONTAINABLE = [\n INLINE_HTML,\n LINK\n ];\n BOLD.contains = BOLD.contains.concat(CONTAINABLE);\n ITALIC.contains = ITALIC.contains.concat(CONTAINABLE);\n CONTAINABLE = CONTAINABLE.concat(BOLD, ITALIC);\n const HEADER = {\n className: \"section\",\n variants: [\n {\n begin: \"^#{1,6}\",\n end: \"$\",\n contains: CONTAINABLE\n },\n {\n begin: \"(?=^.+?\\\\n[=-]{2,}$)\",\n contains: [\n {\n begin: \"^[=-]*$\"\n },\n {\n begin: \"^\",\n end: \"\\\\n\",\n contains: CONTAINABLE\n }\n ]\n }\n ]\n };\n const BLOCKQUOTE = {\n className: \"quote\",\n begin: \"^>\\\\s+\",\n contains: CONTAINABLE,\n end: \"$\"\n };\n return {\n name: \"Markdown\",\n aliases: [\n \"md\",\n \"mkdown\",\n \"mkd\"\n ],\n contains: [\n HEADER,\n INLINE_HTML,\n LIST,\n BOLD,\n ITALIC,\n BLOCKQUOTE,\n CODE,\n HORIZONTAL_RULE,\n LINK,\n LINK_REFERENCE\n ]\n };\n}", "function meta(info, req, next) {\n var buf = new Buffer(0)\n , args = info.args\n , doc = {};\n\n if(args.length) {\n try{\n doc = JSON.parse(info.args.join(''));\n }catch(e) {\n return this.raise(this.errors.EJSON_PARSE, [e.message])\n }\n }\n\n function onReadable(size) {\n var data = req.stdin.read(size); \n /* istanbul ignore if: tough to mock, run: `ldn meta` to verify */\n if(!buf.length && data === null) {\n this.raise(this.errors.ESTDIN);\n }else if(data !== null) {\n buf = Buffer.concat([buf, data], buf.length + data.length);\n }\n }\n\n req.stdin.on('close', function() {\n /* istanbul ignore else: tough to mock */\n if(buf.length) {\n doc.meta = parser(buf);\n\n req.stdout.write(JSON.stringify(doc) + '\\n');\n\n if(req.stdout !== process.stdout) {\n req.stdout.once('finish', next);\n req.stdout.end();\n }\n\n }else{\n next();\n }\n })\n\n req.stdin.on('readable', onReadable.bind(this));\n}", "async function documentationTemplate({\n glob: globString,\n config\n}) {\n // Resolve all paths\n const paths = await new Promise((res, rej) => {\n glob(globString, (err, paths) => {\n err != null ? rej(err) : res(paths);\n });\n }); // Read all files\n\n const files = paths.map(path => ({\n fileName: path,\n text: fs.readFileSync(path, {\n encoding: \"utf8\"\n })\n })); // Analyze the text\n\n const {\n results,\n program\n } = webComponentAnalyzer.analyzeText(files); // Turn the result into markdown\n\n const format = \"markdown\";\n return webComponentAnalyzer.transformAnalyzerResult(format, results, program, config.documentationConfig);\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n${generateLicenseBadge(data)}\n\n## Description\n${data.description}\n\n## Table of Contents\n${generateTableOfContents(data)}\n${generateInstall(data)}\n${generateUsage(data)}\n${generateFeatures(data)}\n${generateContributing(data)}\n${generateTests(data)}\n${generateLicense(data)}\n${generateDevCredits(data)}\n\n## Questions, Comments, Suggestions\nPlease email [${data.contactPerson}](mailto:${data.contactEmail}) with any questions, to report any bugs, or to make any feature suggestions. You can also [contact ${data.contactPerson} on GitHub](https://www.github.com/${data.contactGitHub}/).\n\nThis README was generated by [Ryan R. Campbell's](https://www.github.com/rrcampbell-exe/) [README Generator](https://github.com/rrcampbell-exe/readme-generator).`\n}", "processInline(paragraph) {\n let obj = linepar.toObject(paragraph);\n let url = String(obj[\"url\"]);\n // get type ( html or txt );\n let lastIndex = url.lastIndexOf(\".\");\n let ext = url.substring(lastIndex + 1, url.length);\n var stringData = $.ajax({\n url: url,\n async: false\n }).responseText;\n if (ext == \"txt\") {\n this.parseText(stringData);\n }\n else {\n let div = html.Html.createElement(\"div\", \"\", \"\");\n div.innerHTML = stringData;\n this.elArray.push(div);\n }\n }", "function generateMarkdown(data) {\n return `# ${data.title}\n\n## Description\n${renderLicenseBadge(data.license)} \n${data.desc}\n\n## Table of Contents (Optional)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Credits](#credits)\n- [License](#license)\n\n## Installation\n${data.install}\n\n## Usage\n${data.use}\n\n## Credits\n${data.credit}\n\n${renderLicenseSection(data.license)} \n${renderLicenseLink(data.license)} \n\n## Features\n${data.features}\n\n## How to Contribute\n${data.contrib}\n\n## Tests\n${data.tests}\n`}", "function generateMarkdown(data) {\n return `\n ## Table of Contents \n ----\n * [Description]\n * [Installation]\n * [License]\n * [Contact]\n \n\n # Description\n ## Title ${data.title}\n ## Project Description ${data.projectDescription}\n ## Image ${data.image}\n ## Git Hub Link ${data.githubLink}\n\n # Installation\n ## Installation instructions ${data.installInfo} \n ## How to use ${data.usageInput}\n\n # License \n ## What type of licensesing does this project fall under\n ## ${data.license}\n\n # Contact and Questions\n ## Creator ${data.name}\n ## Email ${data.email}\n ## Other ${data.otherContact}\n ## Contributors ${data.contributInput}\n\n`;\n}", "function main(opts, cb) {\n function onSources(err, sources) {\n if(err) {\n return cb(err); \n }\n if(!sources.length) {\n return cb(new Error('no input markdown definition files found')); \n }\n build(sources, opts, cb);\n }\n collect(opts.files, opts, onSources);\n}", "function mdparser(filep, field) {\n const opts = {\n excerpt_separator: '<!-- more -->',\n engines: { excerpt: false }\n }\n\n try {\n const src = fs.readFileSync(filep,'utf8')\n var doc = matter(src, opts)\n doc.data.mdcontent = doc.content\n delete doc.content\n console.log('We have read',filep)\n const keyn = slugify(doc.data[field]).toLowerCase()\n return {\n [keyn]: doc.data,\n }\n }\n catch (e) {\n console.log('Cannot read', filep, \"\\n\", e)\n return null\n }\n\n}", "function generateMarkdown(data) {\n return `\n# ${data.Title}\nhttps://github.com/emilyepozzi/Readme-Generator\n\n## Description\n${data.Description}\n\n# Table of Contents\n* [Installation](#installation)\n* [Usage](#usage)\n* [License](#license)\n* [Contributing](#contributing)\n* [Tests](#tests)\n* [Username](#username)\n\n# Installation\n${data.Installation}\n\n# Usage\n${data.Usage}\n\n# License\n${renderLicenseBadge(data.License)}\n\n## The Main Contributor in this application :\n${data.Contributing}\n\n# Command needed to test this app in terminal :\n${data.Tests}\n\n# Username Information \n${data.Username}\n\n## Contact Inquiry Questions :\n[My personal GitHub Page](https://github.com/emilyepozzi)\n\n `\n}", "function generateMarkdown(data) {\n\t//console.log(Object.entries(data));\n\n\treturn `\n# ${data.title} ${renderLicenseBadge(data.License)}\n\n${getSection(\"Description\", data.desc)}\n\n## Table Of Contents \n${generateTableOfContents(data)}\n\n${getSection(\"Installation\", data.Installation)}\n\n${getSection(\"Usage\", data.Usage)}\n\n${getImageRefs(data.images)}\n\n${getSection(\"Credits\", data.Credits)}\n\n${renderLicenseSection(data.License)}\n\n${getSection(\"Contributing\", data.Contributing)}\n\n${getSection(\"Tests\", data.Tests)}\n\n${getQuestionsSection(\"Questions\", data.email, data.github)}\n\n \n `;\n}", "description() {\n if (this._description) {\n return this._description;\n }\n for (let i = 0; i < this.sections.length; i++) {\n const section = this.sections[i];\n if (!section.doc) {\n continue;\n }\n const desc = this.extractDescription(section.markedDoc());\n if (desc) {\n this._description = desc;\n return desc;\n }\n }\n return '';\n }", "function generateMarkdown(data) {`\n## Project Title\n\n# ${data.title}\n\n## Project Description\n${data.description}\n\n## Project Link\n${data.project-link}\n\n## :brain: Table Of Contents (TOC)\n1. [Installation](#installation)\n2. [Usage](#usage)\n3. [License](#license)\n4. [Contributing](#contributing)\n5. [Tech](#tech)\n6. [Tests](#tests)\n\n${data.tableOfContents}\n\n## Installation\n\n${data.installation}\n\n## Usage\n\n${data.usage}\n\n${data.photos}\n\n## License\n\n${data.license}\n[![GitHub license] (https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)\n\n## Contributing\n${data.contributers}\n\n## Tech\n${data.technologies}\n\n## Tests\n${data.tests}\n\n## Questions\n${data.questions}\n${data.contact}\n\n`;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n \n ## Description\n ${data.Description}\n \n ## License\n under${data.License}license\n ![github license](https://img.shields.io/badge/%3Clicense%3E-%3CMIT%3E-brightgreen%3E\t\n )\n \n \n ## Table of contents\n ${data.TableOfContents}\n \n ## Installation\n ${data.Installation}\n \n ## Usage\n ${data.Usage}\n \n ## Credits\n ${data.Credits}\n \n ## Test\n ${data.Test}\n \n ## Questions\n ${data.Questions}\n \n ## Username\n ${data.Username}\n \n ## Email\n ${data.Email}\n \n `;\n }", "function textContent(source){\n this.contentTitre = source.contentTitre;\n this.contentPara = source.contentPara;\n this.isImage = source.isImage;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n\n## Table Of Contents \n * [Description](#description)\n * [Installation](#installation) \n * [Usage](#usage) \n * [License](#license) \n * [Contribution](#contribution)\n * [Testing](#testing)\n * [Questions](#questions)\n\n## Visual Presentation\n\nvideo:\n\nhttps://drive.google.com/file/d/1DCuXCwPPzWO1wcOrtFcD3mUfUTQAY8QF/view\n\nScreenshot:\n\n<img width=\"721\" alt=\"Terminal Input\" src=\"https://user-images.githubusercontent.com/82979870/123585993-f035f180-d798-11eb-91f2-1cc9f12b6acd.png\">\n \n## Description\n ${data.description}\n\n## Installation\n ${data.installation}\n\n## Usage\n ${data.usage}\n\n## License \n ${renderLicenseBadge(data.license)} \n ${renderLicenseLink(data.license)}\n ${renderLicenseSection(data.license)}\n\n## Contribution\n ${data.contribution}\n\n## Test\n ${data.test}\n\n## Questions\n * For further information, please send email to ${data.email}\n * Check for details on Github at [${data.github}](https://github.com/${\n data.github\n })\n`;\n}", "function generateMarkdown(data) {\n return `# ${data.Title}\n\n## Table of Contents\n* [Description](#description)\n* [Installation](#installation)\n* [Usage](#usage)\n* [Contributors](#contributors)\n* [Test](#test)\n* [Questions](#questions)\n* [License](#license)\n\n## Description\n${data.Description}\n\n## Installation \n${data.Installation}\n\n## Usage \n${data.Usage}\n\n## Contributors\n${data.Contributors}\n\n## Test\n${data.Test}\n\n## Questions\nContact me:\n\nGithub: [${data.Username}](https://github.com/${data.Username})\n\nEmail: ${data.Email}\n\n## License\n${renderLicenseBadge(data)}\n\n`;\n}", "async fetchMarkdown(src) {\n if(!src.includes('.md')) return '`src` attribute does not specify a Markdown file.';\n return await fetch(src)\n .then(async response => await response.text())\n .catch(e => 'Failed to read Markdown source.')\n }", "function processFileTXT(doc){\n content = doc.body;\n // FILTER: remove tabs\n content = content.replace(/\\t/g, ' ');\n // FILTER: fix smart quotes and m dash with unicode\n content = textPretty(content);\n // FILTER replace meta blocks with comments\n content = content.replace(/=================================/, '<!--');\n content = content.replace(/=================================/, '-->');\n // FILTER replace old page markers <p#> and <c:#>\n content = content.replace(/<p([0-9]+)>/g, \"<span id='pg_$1'></span>\");\n // FILTER: markdown\n md.setOptions({\n gfm: false, tables: false, breaks: false, pedantic: false,\n sanitize: false, smartLists: false, smartypants: false\n });\n content = md(content);\n content = content.replace(/<\\/p>/g, \"\\n\\n\");\n // FILTER add consistent header\n doc.header = HTMLHeaderTemplate(doc.meta);\n // FILTER: Number Paragraphs\n content = numberPars(content, doc.meta);\n doc.body = content;\n // FILTER: HTML5 template into HTML document\n doc.html = HTML5Template(doc);\n return doc;\n}", "function markdown(markdown) {\n return mdast()\n .use([stripBadges, squeezeParagraphs, highlight, html])\n .process(markdown)\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n ## GitHub: ${data.github}\n ## Description\n ${data.description}\n ## Table of Contents\n\n\n * [Installation](#installation)\n * [Testing](#test)\n * [Usage](#usage)\n ${renderLicenseLink(data.license)}\n\n ## Installation\n The ${data.installation} command should be run to install dependencies.\n\n ## Test\n The ${data.test} command should be run to run tests\n\n ## Usage\n ${data.usage}\n\n ${renderLicenseSection(data.license)}\n This project utilizes the ${data.license} license.\n ${renderLicenseBadge(data.license)}\n ## Contributing\n ${data.contributing}\n \n ## Questions\n If you have any questions, you can contact me via email: ${\n data.email\n }. You can also see my code and contact me on Github: [${\n data.github\n }](https://www.github.com/${data.github}) \n`;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n\n## Description\n\n${data.description}\n\n## Table of Contents\n\n* [Description](#description)\n* [Installation](#installation)\n* [Contributors](#contributors)\n* [Test](#test)\n* [Username](#username)\n* [Email](#email)\n* [Questions](#questions)\n \n## Installation\n\n${data.installation}\n\n## Contributors\n\n${data.contributors}\n\n## Test\n\n${data.test}\n\n## Username\n\n${data.username}\n\n## Email\n\n${data.email}\n\n## Questions\n\n${data.questions}\n<br>\nGithub link: https://github.com/${data.username} \\t Email: ${data.email}\n`;\n}", "function parseJsDocString(doc) {\n var e_1, _a;\n // Prepare lines\n var lines = doc.split(\"\\n\").map(function (line) { return line.trim(); });\n var description = \"\";\n var readDescription = true;\n var currentTag = \"\";\n var tags = [];\n /**\n * Parsing will add to \"currentTag\" and commit it when necessary\n */\n var commitCurrentTag = function () {\n if (currentTag.length > 0) {\n var tagToCommit_1 = currentTag;\n var tagMatch = tagToCommit_1.match(/^@(\\S+)\\s*/);\n if (tagMatch != null) {\n tags.push({\n parsed: lazy(function () { return parseJsDocTagString(tagToCommit_1); }),\n node: undefined,\n tag: tagMatch[1],\n comment: tagToCommit_1.substr(tagMatch[0].length)\n });\n }\n currentTag = \"\";\n }\n };\n try {\n // Parse all lines one by one\n for (var lines_1 = __values(lines), lines_1_1 = lines_1.next(); !lines_1_1.done; lines_1_1 = lines_1.next()) {\n var line = lines_1_1.value;\n // Don't parse the last line (\"*/\")\n if (line.match(/\\*\\//)) {\n continue;\n }\n // Match a line like: \"* @mytag description\"\n var tagCommentMatch = line.match(/(^\\s*\\*\\s*)@\\s*/);\n if (tagCommentMatch != null) {\n // Commit current tag (if any has been read). Now \"currentTag\" will reset.\n commitCurrentTag();\n // Add everything on the line from \"@\"\n currentTag += line.substr(tagCommentMatch[1].length);\n // We hit a jsdoc tag, so don't read description anymore\n readDescription = false;\n }\n else if (!readDescription) {\n // If we are not reading the description, we are currently reading a multiline tag\n var commentMatch = line.match(/^\\s*\\*\\s*/);\n if (commentMatch != null) {\n currentTag += \"\\n\" + line.substr(commentMatch[0].length);\n }\n }\n else {\n // Read everything after \"*\" into the description if we are currently reading the description\n // If we are on the first line, add everything after \"/*\"\n var startLineMatch = line.match(/^\\s*\\/\\*\\*/);\n if (startLineMatch != null) {\n description += line.substr(startLineMatch[0].length);\n }\n // Add everything after \"*\" into the current description\n var commentMatch = line.match(/^\\s*\\*\\s*/);\n if (commentMatch != null) {\n if (description.length > 0) {\n description += \"\\n\";\n }\n description += line.substr(commentMatch[0].length);\n }\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (lines_1_1 && !lines_1_1.done && (_a = lines_1.return)) _a.call(lines_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n // Commit a tag if we were currently parsing one\n commitCurrentTag();\n if (description.length === 0 && tags.length === 0) {\n return undefined;\n }\n return {\n description: description,\n tags: tags\n };\n}", "function updateMarkdownPreviews(source, previews) {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n forEach(previews, function (preview) {\n preview.innerHTML = xhr.responseText;\n beautifyPost(preview);\n source.style.minHeight = preview.clientHeight + 'px';\n });\n }\n };\n xhr.open('POST', '/api/markdown/');\n xhr.send(source.value);\n }", "function convertHTMLtoMarkdown() {\n\n}", "function generateMarkdown(data) {\n return `# ${data.Title}\n\n ## Table of Contents\n 1) [Description](#description)\n 2) [Installation](#installation)\n 3) [Usage](#usage)\n 4) [Contributing](#contributing)\n 5) [Tests](#tests)\n 6) [License](#license)\n 7) [Questions](#questions)\n\n ## Description \n ${data.Description}\n\n ## Installation\n ${data.Installation}\n\n ## Usage\n ${data.Usage}\n\n ## Contributing\n ${data.Contributors}\n\n ## Tests\n ${data.Test}\n\n ## License\n ${renderLicenseBadge(data.License)} \n \n ${data.License}\n\n ${renderLicenseSection(data.License)}\n\n ## Questions\n\n Contact via GitHub:\n [link]{https://github.com/${data.GitHub}}\n\n AND/OR\n\n Contact via email:\n [Email:][mailto:${data.Email}]\n`;\n}", "function generateMarkdown(data) {\n let badges = \"https://img.shields.io/badge/license-MIT-red\";\n if (data.license == \"Apache 2.0\") {\n badges = \"https://img.shields.io/badge/license-Apache-red\";\n } else if (data.license == \"GNU\") {\n badges = \"https://img.shields.io/badge/license-GNU-red\";\n } else {\n badges = \"https://img.shields.io/badge/license-MIT-red\"\n };\n\n return `\n # Title \n ## ${data.title}\n\n ## Description\n ${data.description}\n\n # Table of Contents\n * Installation \n * Contributing \n * Tests \n * Usage \n * Questions\n\n ## Installation:\n ${data.installation} \n ## License:\n ${data.license}\n ![badge](${badges}) \n \n ## Contributors:\n ${data.contributor}\n ## Tests:\n ${data.tests}\n ## Usage:\n ${data.usage} \n ## Questions: \nIf you have any questions, you can contact the creator of this repo here: [${data.email}](mailto:${data.email})\nGitHub: https://github.com/${data.username}\n\n## Author Info\n${data.name}\n\n`;\n}", "function MarkdownView() {\r\n\r\n this.compile = function (template) {\r\n return function (context) {\r\n var html = Marked(template, context);\r\n return `<link rel=\"stylesheet\" href=\"/assets/github-markdown.css\">\r\n <style>\r\n .markdown-body {\r\n box-sizing: border-box;\r\n min-width: 200px;\r\n max-width: 980px;\r\n margin: 0 auto;\r\n padding: 45px;\r\n }\r\n </style>\r\n <article class=\"markdown-body\">\r\n ${html}\r\n </article>`;\r\n };\r\n };\r\n}", "set markdown(markdown) {\n this\n .renderMarkdown(markdown)\n .then(r => this.renderedMarkdown = r)\n }", "function build() {\n\tconst markdown = fs\n\t\t// Load markdown.\n\t\t.readFileSync(readmePath, 'utf8')\n\t\t// Uncomment docdash HTML hints.\n\t\t.replace(/(<)!--\\s*|\\s*--(>)/g, '$1$2')\n\t\t// Convert source and npm package links to anchors.\n\t\t.replace(\n\t\t\t/\\[source\\]\\(([^)]+)\\) \\[npm package\\]\\(([^)]+)\\)/g,\n\t\t\t(match, href1, href2) =>\n\t\t\t\t`<p class=\"pee-balls\"><a class=\"a-balls\" href=\"${href1}\">source</a><a href=\"${href2}\">npm package</a></p>`\n\t\t)\n\n\tconst $ = cheerio.load(\n\t\tmarky(markdown, {\n\t\t\tenableHeadingLinkIcons: false,\n\t\t\tsanitize: false\n\t\t})\n\t)\n\n\tconst $header = $('h1')\n\t\t.first()\n\t\t.remove()\n\n\tconst version = $header\n\t\t.find('span')\n\t\t.first()\n\t\t.text()\n\t\t.trim()\n\t\t.slice(1)\n\n\t// Auto-link flodash method references.\n\tautoLink($)\n\t// Rename \"_\" id references to \"flodash\".\n\trenameflodashId($)\n\t// Remove docdash horizontal rules.\n\tremoveHorizontalRules($)\n\t// Remove marky-markdown attribute additions.\n\tremoveMarkyAttributes($)\n\t// Repair marky-markdown wrapping around headers.\n\trepairMarkyHeaders($)\n\t// Cleanup highlights.\n\ttidyHighlights($)\n\n\tconst _html = () => {\n\t\treturn /* html */ `\n\t\t\t<!DOCTYPE html>\n\t\t\t<html class=\"docs gr__flodash_com\" style=\"overflow: auto;\">\n\t\t\t\t<head>\n\t\t\t\t\t<meta charset=\"utf-8\">\n\t\t\t\t\t<meta content=\"IE=edge\" http-equiv=\"X-UA-Compatible\">\n\t\t\t\t\t<title>flodash Docs</title>\n\t\t\t\t\t<meta content=\"width=device-width, initial-scale=1\" name=\"viewport\">\n\t\t\t\t\t<link href=\"assets/css/doc.css\" rel=\"stylesheet\" type=\"text/css\">\n\t\t\t\t\t<script src=\"../vendor/lodash/lodash.min.js\"></script>\n\t\t\t\t\t<script src=\"../vendor/g/fuse@2.6.1,react@15.4.0(react.min.js+react-dom.min.js\"></script>\n\t\t\t\t\t<script async src=\"../assets/js/docs.js\"></script>\n\t\t\t\t\t<link href=\"https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n\t\t\t\t\t<script async src=\"../assets/js/boot.js\"></script>\n\t\t\t\t\t<script async src=\"https://embed.runkit.com\" async></script>\n\t\t\t\t</head>\n\t\t\t\t<body class=\"layout-docs\">\n\t\t\t\t\t<header>\n\t\t\t\t\t\t<div class=\"container\">\n\t\t\t\t\t\t\t\t<div class=\"header-section logo-section\">\n\t\t\t\t\t\t\t\t\t\t<div class=\"logo\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"../index.html\" title=\"flodash\">flodash</a>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"header-group\">\n\t\t\t\t\t\t\t\t\t\t\t\t<h1>flodash</h1>\n\t\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\t<div class=\"header-section mobile-menu\">\n \t\t\t\t\t\t\t<a href=\"#\"><i class=\"fa fa-bars\" aria-hidden=\"true\"></i>Menu</a>\n \t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</header>\n\t\t\t\t\t<div class=\"doc-main\">\n\t\t\t\t\t\t${$.html().trim()}\n\t\t\t\t\t</div>\n\t\t\t\t</body>\n\t\t\t</html>\n\t\t`\n\t}\n\n\tconst __html = /* html */ `${_html()}`\n\n\tfs.writeFile(path.join(docPath, 'balls' + '.html'), __html, util.pitch)\n\t// fs.writeFile(path.join(docPath, 'doc' + '.html'), __html, util.pitch)\n\n}", "function Description(def) {\n if(typeof def === 'string') {\n this.parse(def);\n }else if(def\n && typeof def === 'object'\n && typeof def.txt === 'string'\n && typeof def.md === 'string') {\n this.md = def.md;\n this.txt = def.txt;\n }else{\n throw new Error('invalid value for description');\n }\n}", "function renderMarkdown(options) {\n // Unpack the options.\n var host = options.host, source = options.source, trusted = options.trusted, sanitizer = options.sanitizer, resolver = options.resolver, linkHandler = options.linkHandler, latexTypesetter = options.latexTypesetter, shouldTypeset = options.shouldTypeset;\n // Clear the content if there is no source.\n if (!source) {\n host.textContent = '';\n return Promise.resolve(undefined);\n }\n // Separate math from normal markdown text.\n var parts = latex_1.removeMath(source);\n // Render the markdown and handle sanitization.\n return Private.renderMarked(parts['text']).then(function (content) {\n // Restore the math content in the rendered markdown.\n content = latex_1.replaceMath(content, parts['math']);\n // Santize the content it is not trusted.\n if (!trusted) {\n content = sanitizer.sanitize(content);\n }\n // Set the inner HTML of the host.\n host.innerHTML = content;\n if (host.getElementsByTagName('script').length > 0) {\n console.warn('JupyterLab does not execute inline JavaScript in HTML output');\n }\n // TODO arbitrary script execution is disabled for now.\n // Eval any script tags contained in the HTML. This is not done\n // automatically by the browser when script tags are created by\n // setting `innerHTML`. The santizer should have removed all of\n // the script tags for untrusted source, but this extra trusted\n // check is just extra insurance.\n // if (trusted) {\n // // TODO really want to run scripts?\n // Private.evalInnerHTMLScriptTags(host);\n // }\n // Handle default behavior of nodes.\n Private.handleDefaults(host);\n // Apply ids to the header nodes.\n Private.headerAnchors(host);\n // Patch the urls if a resolver is available.\n var promise;\n if (resolver) {\n promise = Private.handleUrls(host, resolver, linkHandler);\n }\n else {\n promise = Promise.resolve(undefined);\n }\n // Return the rendered promise.\n return promise;\n }).then(function () {\n if (shouldTypeset && latexTypesetter) {\n latexTypesetter.typeset(host);\n }\n });\n}", "function docsMD() {\n if(!jetpack.exists('./docs'))\n jetpack.dir('./docs');\n return spawn('node', [\n 'node_modules/documentation/bin/documentation.js',\n 'build',\n './src',\n '--output',\n './docs/documentation.md',\n '--format',\n 'md',\n '--access',\n 'public',\n '--sort-order',\n 'alpha',\n '--markdown-toc',\n 'false'\n ] , {\n stdio: 'inherit'\n });\n}", "function generateMarkdown(response){\n \n return`\n\n # ${response.title}\n\n\n [![License](https://img.shields.io/badge/License-${response.license}-brightgreen.svg)](https://opensource.org/licenses/${response.license})\n\n ## License:\n For more informtion about the License, click on the link below.\n - [License](https://opensource.org/licenses/${response.license})\n \n # Table of Contents\n\n - [License](#license)\n - [Description](#description) \n - [Installation](#installation)\n - [Usage](#usage)\n - [Contribution](#contribution)\n - [Credits](#credits)\n - [Test](#test)\n - [Questions](#questions)\n\n ## Description:\n \n ${response.description}\n\n ## Installation:\n ${response.installation}\n\n ## Usage\n ${response.usage}\n \n ## Contribution:\n ${response.contribution}\n\n\n ## Test:\n ${response.tests}\n \n \n\n ## Questions:\n For additional questions about this project you can go to my \n GitHub page at the following Link:\n\n - [GitHub Profile](https://www.github.com/${response.username})\n\n For any futher informations do not hesitate to reach out to my email at: ${response.email}\n `;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n\n ## Description\n ${data.description}\n\n ## Table of Contents\n * [Installation](#installation)\n * [Usage](#usage)\n * [Tests](#tests)\n * [Credits](#credits)\n * [License](#licenses)\n * [Questions](#questions)\n \n ## Installation\n ${data.installation_instructions}\n \n ## Usage\n ${data.usage_instructions}\n\n ## Tests\n ${data.tests}\n\n ## Credits\n ${data.contributors}\n\n ## Licenses\n ${renderLicenseSection(data.license)}\n ${renderLicenseBadge(data.license)}\n ${renderLicenseLink(data.license)}\n\n ## Questions\n - Github Page: ${data.github_user}\n - Email: ${data.email}\n`;\n}", "function generateMarkdown(data) {\n // console.log(data)\n const { github, licenseChoice, confirmLiveLink, liveSiteLink, siteDemoLink, ...info } = data;\n\n return `\n # ${info.projectTitle}\n\n ## Table of Contents\n - [Description](#project-description)\n - [Installation](#installation)\n - [Usage](#usage)\n - [Contribution](#contribution)\n - [Testing](#testing)\n - [Questions](#questions)\n\n\n ## Project Description\n ${info.description}\n ${renderLicenseSection(licenseChoice)} \n ${renderLinkSection(liveSiteLink)}\n ${renderDemo(siteDemoLink)}\n\n ## Installation \n ${info.installationInstructions}\n\n ## Usage \n ${info.usageInstructions}\n\n ## Contribution\n ${info.contributionInstructions}\n\n ## Testing\n ${info.testInstructions}\n\n ## Questions\n Reach out to the repo owner, [${github}](https://github.com/${github}) at ${info.questionsEmail}.\n `;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n \n#### Table of Contents\n1. [Description](#description)\n2. [Installation](#installation)\n3. [Usage](#usage)\n4. [Credits](#credits)\n5. [License](#license)\n6. [Questions](#questions)\n## Description\n* ${data.description}\n## Installation \n* ${data.installation}\n## Usage \n* ${data.usage}\n## Credits\n* ${data.credits}\n${renderLicenseSection()}\n${renderLicenseBadge()}\n${renderLicenseLink()}\n\n## Questions\n* For additional help or if you would like to contribute to this project reach out to me at ${data.email}\n* Follow me on Github at [${data.github}](http://github.com/${data.github})`;\n\n}", "function generateMarkdown(payload) {\n return `# Title: ${payload.title} ${makeBadge(\"license\", payload.license)}\n\n## License\nThis project is under the ${payload.license} license\n\n## Table of Contents\n* [Installation](#installation)\n* [Usage](#usage)\n* [License](#license)\n* [Contributing](#contributing)\n* [Test](#test)\n* [Questions](#questions)\n\n## Description\n${payload.description}\n\n## Installation\n${payload.installation}\n\n## Usage\n${payload.usage}\n\n## Contributing\n${payload.contribution}\n\n## Test\n${payload.test}\n\n## Questions\nI learned programming language at ${payload.question} UWA. If you have any questions, please contact me at the Info below\n\n## GitHub\n${payload.username}\n![GitHub license](https://img.shields.io/badge/license-MIT-orange.svg)\nhttps://github.com/${payload.username}/${payload.title}\n\n## Email address\n${payload.email}\n\n`\n}", "function generateMarkdown(data) {\n return `\n ## Github\n ${data.Github}\n\n ## Email\n ${data.email}\n\n ## URL\n ${data.url}\n\n ## Title\n ${data.title}\n\n ## Description\n ${data.description}\n\n ## Table of Contents \n\n * [Description](#Description)\n * [License](#License)\n * [Installation](#Install)\n * [Test](#Test)\n * [Questions](#Questions)\n * [Contributing](#Contributing)\n\n ## License\n ${data.license} <br />\n ${badgeChange(data.license)} \n \n\n ## Install\n ${data.install}\n\n ## Test\n ${data.test}\n\n ## Questions\n ${data.questions}\n\n ## Contributing\n ${data.contributing}\n \n \n`;\n}", "function generateMarkdown(data) {\n//console.log(data)\n return `\n # ${data.title}\n\n ${renderLicenseBadge(data.license)}\n\n ## Description\n ${data.description}\n\n ## Table of Contents\n - [Description](#description)\n - [Installation](#installation)\n - [Usage](#usage)\n - [License](#license)\n - [Contributing](#contributing)\n - [Tests](#tests)\n - [Questions](#questions)\n\n ## Installation\n ${data.installation}\n\n ## Usage\n ${data.usage}\n\n \n ${renderLicenseSection(data.license)}\n\n\n ## Contributing\n ${data.contributing}\n\n ## Tests\n ${data.test}\n\n ## Questions\n Find me on GitHub: [${data.username}](https://github.com/${data.username})\n \n Email me with any questions: ${data.email}\n\n\n This README was generated with ❤️ by [README-generator](https://github.com/latoyadawson/readME-generator)\n `;\n}", "function generateMarkdown(data) {\n return `\n# ${data.title}\n \n## License:\n![license](https://img.shields.io/badge/license-MIT-blue)\n \n\n## Table of Contents\n* [Description](#description)\n* [Usage](#usage)\n* [Contribution](#contribution)\n* [Installation](#installation)\n* [Questions](#questions)\n* [License](#license)\n \n\n\n## Description\n${data.description}\n\n## Usage\n${data.usage}\n\n## Contribution\n${data.contribution}\n\n## Installation\n${data.installation}\n\n## Questions\nPlease contact me at:\n\ngitHub:[${data.gitHub}](https://github.com/dtm5169)\nEmail:[${data.email}](marrowdaisha@gmail.com)\n\n## License\n${data.license} \n\n\n\n`;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n \n${renderLicenseBadge(data)} \n\n## Description\n\n${data.description}\n\n## Table of Contents\n\n* [License](#license)\n\n* [Installation](#installation)\n\n* [Tests](#tests)\n\n* [Usage](#usage)\n\n* [Contributing](#contributing)\n\n* [Questions](#questions)\n\n## License\n\n${data.license}\n\n${renderLicenseSection(data)} \n> ${renderLicenseLink(data)}\n\n## Installation\n\nTo install dependencies use the following in the command line: \n\n\\`\\`\\`\n${data.dependencies}\n\\`\\`\\`\n\n## Tests\n\nTo test: \n\n\\`\\`\\`\n${data.tests}\n\\`\\`\\`\n\n## Usage\n\n\\`\\`\\`\n${data.repoUse}\n\\`\\`\\`\n\n## Contributing\n\n${data.repoContribute}\n\nCheck out my other repos at: <https://github.com/${data.username}>\n\n## Questions\n\nIf you have any questions, please contact me at: ${data.email}\n \n`\n}", "function parseMarkdown(str) {\r\n const results = {};\r\n if (str) {\r\n // Some stuff can break this, so try/catching it if needed.\r\n try {\r\n const res = md.parseInline(str, {});\r\n let url;\r\n if (res[0] && res[0].children) {\r\n url = res[0].children.find((child) => (child.type === 'link_open' && child.attrs\r\n && child.attrs[0] && child.attrs[0][0] === 'href'));\r\n }\r\n results.url = (url && url.attrs) ? url.attrs[0][1] : undefined;\r\n results.str = remove_markdown_1.default(str);\r\n }\r\n catch (err) {\r\n // return nothing\r\n }\r\n }\r\n return results;\r\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n${renderLicenseBadge(data.license)}\n## description\n${data.description}\n## contents\n* [installation](#installation)\n* [usage](#usage)\n* [contribution](#contribution)\n* [testing](#testing)\n* [contact](#contact)\n## installation\n${data.installation}\n## usage\n${data.usage}\n## contribution\n${data.contribution}\n## testing\n${data.testing}\n## contact\n* Github: ${data.Github}\n* email: ${data.email}\n`;\n}", "function generateMarkdown(data) {\n console.log(data);\n return `\n # **${data.title}**\n ${renderLicenseBadge(data.license)} \n\n ## Table of Contents\n 1. [Description](#description)\n 2. [Installation](#installation)\n 3. [Project Usage](#Project-Usage)\n 4. [License Information](#License-Information)\n 5. [Contributors](#Project-Contributors)\n 6. [Testing Instructions](#Testing-Instructions )\n 7. [Contact Info](#Questions)\n \n ## Description\n ${data.description}\n\n ## Installation\n ${data.installation}\n\n ## Project Usage \n ${data.usage}\n\n ## License Information\n ${renderLicenseSection(data.license)}\n\n ## Project Contributors \n ${data.contributing}\n\n ## Testing Instructions \n ${data.tests}\n \n ## Questions?\n ### Please find my contact information below to reach out! \n\n [![Gmail](https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white)](mailto:${data.emailaddress}) [![Github](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/${data.github}) \n\n `\n ;\n}", "function pre(payload) {\n\n let title = null;\n\n // banner is first image and banner text is image alt\n payload.resource.banner = {\n img: '',\n text: ''\n };\n const firstImg = select(payload.resource.mdast, 'image');\n if (firstImg.length > 0) {\n payload.resource.banner = {\n img: firstImg[0].url,\n text: firstImg[0].alt\n }\n }\n\n const content = [];\n let currentSection = {children: [], type: 'standard'};\n\n visit(payload.resource.mdast, [\"paragraph\",\"heading\",\"thematicBreak\"], function (node) {\n\n if (node.type == \"heading\" && node.depth == 1 && !title){\n title = node.children[0].value;\n return;\n }\n if (node.type == \"thematicBreak\") {\n content.push(LayoutMachine.layout(currentSection));\n currentSection = {children: [], type: 'standard'};\n }\n else {\n currentSection.children.push(node);\n }\n });\n\n // content.push(LayoutMachine.layout(currentSection));\n content.push(currentSection);\n\n debugger;\n payload.resource.content = content;\n\n // avoid htl execution error if missing\n payload.resource.meta = payload.resource.meta || {};\n payload.resource.meta.references = payload.resource.meta.references || [];\n payload.resource.meta.icon = payload.resource.meta.icon || '';\n}", "function generateMD(data) { \n // README:\n return `# ${data.uproj} #\n\n## Repository ##\n\n${data.urepo}\n\n## Screenshots ##\n\n<img src=\"${data.usshots}\">\n\n## Table of Contents ##\n\n* [Description](#Description-)\n* [Installation](#Installation-)\n* [Usage](#Usage-)\n* [Tech](#Tech-)\n* [Testing](#Testing-)\n* [Contribution](#Contribution-)\n* [Licensing](#Licensing-)\n* [Contact](#Contact-)\n\n## Description 📌 ##\n\n${data.udescript}\n\n## Installation 🛠 ##\n\n${data.uinstall}\n\n## Usage 💻 ##\n\n${data.uuse}\n\n## Tech 🖥 ##\n\n${data.utech}\n\n## Testing 🧷 ##\n\n${data.utest}\n\n## Contribution 🤝 ##\n\n${data.ucontrib}\n\n## Licensing 🧾 ##\n\n[![license](https://img.shields.io/badge/license${data.uli}-hotpink)](https://shields.io)\n\nCopyright &copy; ${year}\n\n## Contact 🗨 ##\n### For Questions: ###\n\n${data.ualias}: (https://github.com/${data.ualias})\n\n${data.uemail}\n\n\nThis README was generated with 🌼🌿🌷 and 🤍 by ${data.uname}.`;\n}", "function Rules(md) {\n // require(\"./header.js\")(md); // TODO Remove if markdown-it-anchor do the job\n require(\"./markdownLink.js\")(md);\n}", "get type() {\n return 'markdown';\n }", "async function formatSections(source, sections, config = {}, lang) {\n /* [Markdown](https://github.com/markedjs/marked) and HighlightJS */\n /* Set options specified by the user, using to `smartypants: true` */\n /* as a starting point */\n marked.setOptions(config.marked)\n\n /* Code might happen within the markdown documentation as well! If that */\n /* is the case, it will highlight code either using the language specified */\n /* within the Markdown codeblock, or the default language used for the processes */\n /* file */\n marked.setOptions({\n highlight: function (code, language) {\n if (!language) language = lang.name\n if (highlightjs.getLanguage(language)) {\n return highlightjs.highlight(language, code).value\n } else {\n console.warn(`${source}: language '${language}' not recognised, code block not highlighted`)\n return code\n }\n }\n })\n for (const section of sections) {\n let code = highlightjs.highlight(lang.name, section.codeText).value\n code = code.replace(/\\s+$/, '')\n if (code !== '') section.codeHtml = `<div class='highlight'><pre>${code}</pre></div>`\n else section.codeHtml = ''\n if (config.plugin.beforeMarked) {\n const newText = await config.plugin.beforeMarked(section.docsText)\n if (newText !== section.docsText) console.log('newtext:', newText)\n section.docsText = newText\n }\n section.docsHtml = marked(section.docsText)\n }\n }", "function DocScannerConfig() { }", "function generateMarkdown(data) {\n return `# ${data.title}\n## Table of Contents\n## 1.[Installation](#installation)\n## 2.[Usage](#usage)\n## 3.[License](#license)\n## 4.[Contributing](#contributing)\n## 5.[Tests](#tests)\n## 6.[Questions](#questions)\n## 7.[Description](#description)\n \n<a name=\"installation\"></a>\n# Installation\n${data.install}\n\n<a name=\"usage\"></a>\n# Usage\n${data.usage}\n\n<a name=\"license\"></a>\n# License\n${data.badge}\n\n<a name=\"contributing\"></a>\n# Contributing\n${data.contributors}\n\n<a name=\"tests\"></a>\n# Tests\n${data.tests}\n\n<a name=\"questions\"></a>\n# Questions\n* ${data.Email}\n* https://github.com/${data.Github}\n\n<a name=\"description\"></a>\n# Description\n${data.description}\n\n`\n}", "annotatedText (path, doc, $$) {\n if (doc) {\n this.state.doc = doc\n }\n if ($$) {\n this.$$ = $$\n }\n return super.annotatedText(path)\n }", "function generateMarkdown(data) {\n return `# ${data.file}\n\n${renderLicenseBadge(data.licenses)}\n\n# Description: ${data.description}\n\n# Table of Contents\n\n- [Description](#description)<br>\n- [Installation](#installation)<br>\n- [Usage](#Usage)<br>\n- [Contribution](#contribution)<br>\n- [Test](#test)<br>\n${renderLicenseLink(data.licenses)}<br>\n- [Username](#username)<br>\n- [Questions](#questions)\n\n\n## Installation:\n ${data.install}\n\n## Usage: \n${data.usage}\n\n## Contribution: \n${data.guidelines}\n\n## Test: \n${data.test}\n\n${renderLicenseSection(data.licenses)}\n\n## Questions:\n- github profile: https://github.com/${data.gituser}/repo.git\n\nIf you have any questions you can reach me at<br>\n- email: ${data.email}\n\n`;\n}", "function generateMarkdown(data) {\n return `\n# ${data.title}\n\n ![${data.licenseResponse}](${renderLicenseBadge(data)})\n\n## Description\n${data.descript}\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Contributions](#contributions)\n- [Testing](#testing)\n- [License](#license)\n- [Questions](#questions)\n- [Screenshots](#screenshots)\n- [Links](#links)\n\n## Installation\n${data.install}\n\n## Usage\n${data.usage}\n\n## Contributions\n${data.contrib}\n\n## Testing\n${data.test}\n\n## License\n**${renderLicenseLink(data)}**\n\n## Questions\nMy github username is: ${data.github} and the repository for this project is: ${data.repo}\n\nIf you have any questions please contact me at: ${data.email}\n\n## Screenshots\nScreenshot of the deployed project:\n\n![screenshot](${data.images})\n\n\n## Links \nLinks to the deployed project and Github Repository\n\nRepository: **${data.linkRepo}**\n\nDeployed Project: **${data.linkDeploy}**\n`;}", "function generateMarkdown(data) {\n return `\n# ${data.title}\n ${renderLicenseSection(data.license)}\n\n## Description\n ${data.description}\n\n## *Table of Contents*\n\n* [Installation](#installation)\n* [Usage](#usage)\n* [Contributing](#contributing)\n* [Tests](#tests)\n* [Credits](#credits)\n* [Features](#features)\n* [Questions](#questions)\n* [License](#license)\n\n## Installation\n ${data.installation}\n\n## Usage\n ${data.usage}\n \n## Contributing\n ${data.contribution}\n\n## Tests\n ${data.test}\n\n## Credits\n ${data.credits}\n\n## Features\n ${data.features}\n\n## Questions\n * Checkout my [GitHub profile](https://github.com/${data.github})\n * Any additional questions or feedback, feel free to [send an email](mailto:${data.email}). \n\n## License\n Copyright (c) [${data.author}](https://github.com/${data.github}). All rights reserved.\n\n Licensed under the [${data.license}](${renderLicenseLink(data.license)}) license.\n\n`;\n}", "function generateMarkdown(data) {\n return `# ${data.name}\n ## Description \n${data.description}\n## Table of Contents\n*[License]\n*[test]\n*[contributors]\n*[user story]\n\n# User Story \n${data.userstory}\n# Contributors\n${data.contributors}\n# Test \n${data.test}\n#Features\n${data.features}\n# License\n${renderLicenseBadge(data.license)}\n${renderLicenseSection(data.license)}\n${renderLicenseLink(data.license)}\n`;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n${renderLicenseBadge(data.license)}\n\n## Description\n${data.description}\n\n## Technologies\n${data.technologies}\n\n## Installation\n${data.installation}\n\n## Usage \n${data.usage}\n\n## Features\n${data.features}\n\n## Tests\n${data.tests}\n\n## Acknowledgements\n${data.acknowledgements}\n\n## My Profiles\n${data.profiles}\n\n\n\n`;\n}", "document (source) {\n this.documentation = new Documentation(source, this);\n return this;\n }", "function CfnDocumentPropsValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('attachments', cdk.listValidator(CfnDocument_AttachmentsSourcePropertyValidator))(properties.attachments));\n errors.collect(cdk.propertyValidator('content', cdk.requiredValidator)(properties.content));\n errors.collect(cdk.propertyValidator('content', cdk.validateObject)(properties.content));\n errors.collect(cdk.propertyValidator('documentFormat', cdk.validateString)(properties.documentFormat));\n errors.collect(cdk.propertyValidator('documentType', cdk.validateString)(properties.documentType));\n errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name));\n errors.collect(cdk.propertyValidator('requires', cdk.listValidator(CfnDocument_DocumentRequiresPropertyValidator))(properties.requires));\n errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags));\n errors.collect(cdk.propertyValidator('targetType', cdk.validateString)(properties.targetType));\n errors.collect(cdk.propertyValidator('updateMethod', cdk.validateString)(properties.updateMethod));\n errors.collect(cdk.propertyValidator('versionName', cdk.validateString)(properties.versionName));\n return errors.wrap('supplied properties not correct for \"CfnDocumentProps\"');\n}", "function parse(doc) {\n var state, result = {\n types: {},\n properties: {}\n };\n\n function waitForTypesOrProperties(line) {\n if (line.match(/^ Type/)) {\n var type = parseType(line);\n result.types[type.name] = type;\n } else if (line.match(/^ Properties of|^Properties of World/)) {\n state = parseProperties;\n }\n }\n\n function parseProperties(line) {\n var property;\n\n if (line.trim().length === 0) {\n state = waitForTypesOrProperties;\n return;\n }\n\n property = parsePropertyOrOperator(line);\n result.properties[property.key] = property;\n }\n\n state = waitForTypesOrProperties;\n doc.toString().split('\\n').forEach(function(line, i) {\n try {\n state(line);\n } catch (err) {\n console.error('On line ' + (i + 1) + ': ' + err.toString());\n throw err;\n }\n });\n\n return result;\n}", "function generateMarkdown(data) {\n\nreturn `\n# ${data.title} ${renderLicenseBadge(data.license)}\n\n## Description\n\n${data.projDescription}\n\n## Table of contents\n\n* [Installation](#installation)\n* [Usage](#usage)\n* [Contributing](#contributing)\n* [Tests](#tests)\n* [License](#license)\n* [Question](#question)\n\n## Installation\n\n${data.projInstall}\n\n## Usage\n\n${data.projUsage}\n\n## Contributing\n\n${data.projContribute}\n\n## Tests\n\n${data.projTest}\n\n${renderLicenseSection(data.license)}\n\n## Question\n\nGithub: [${data.projGithub}](https://github.com/${data.projGithub}) </br>\nReach me with additional question <${data.projEmail}>\n `\n}", "function generateMarkdown(data) {\n return `\n # ${data.title}\n \n ## Project Description\n\n ${data.desc}\n\n ## Table of Contents\n\n [Installation](#installation)\n\n [Usage](#usage)\n\n [License](#license)\n\n [Contributing](#contributing)\n\n [Tests](#testing)\n \n [Questions/Contact](#questions)\n\n ## Installation\n\n Run the following command to install all dependancies for this project:\n\n ~~~\n ${data.installation}\n ~~~\n\n ## Usage\n\n ${data.usage}\n\n ## License\n\n ${renderLicenseBadge(data.license)}\n\n ${renderLicenseSection(data.license)}\n\n ${renderLicenseLink(data.license)}\n\n ## Contributing\n\n ${data.contributing}\n\n ## Testing\n\n Run the following command to test this project:\n\n ~~~\n ${data.test}\n ~~~\n\n ## Questions\n\n If you have any questions, comments, or concerns about this project, you can reach me at the following links:\n \n Email: ${data.email}\n \n GitHub: [${data.githubUser}](https://github.com/${data.githubUser})\n `;\n}", "function MarkdownView() {\n\n this.compile = function (template) {\n return function (context) {\n var html = Marked(template, context);\n return `<link rel=\"stylesheet\" href=\"/assets/github-markdown.css\">\n <style>\n .markdown-body {\n box-sizing: border-box;\n min-width: 200px;\n max-width: 980px;\n margin: 0 auto;\n padding: 45px;\n }\n </style>\n <article class=\"markdown-body\">\n ${html}\n </article>`;\n };\n };\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n\n ${renderLicenseSection(data.license)}\n\n ## Description\n ${data.description}\n\n ## Table of Contents\n * [Installation](#Installation)\n * [Usage](#Usage)\n * [Contributions](#Contributions)\n * [Testing](#Testing)\n * [Credits](#Credits)\n * [License](#License)\n * [Questions](#Questions?)\n\n\n ## Installation\n\n ${data.installation}\n\n ## Usage\n\n ${data.usage}\n\n ## Contributions\n\n ${data.contributing}\n\n ## Testing\n\n ${data.test}\n\n ## Credits\n ${data.credits}\n\n ## Questions?\n\n Please contact me on the links below if you have any queries on how the application works or to view my other projects:\n\n My GitHub username is ${data.github} \n\n Link to GitHub Profile: ${data.gitURL}\n\n Email: ${data.email}\n`;\n}", "function processFileHTML(doc){\n // parse out into blocks\n // re-assemble with new paragraph numbering\n // add style sheet\n // move assets to the assets folder\n return doc;\n}", "function generateMarkdown(data) {\n return `# ${data.title}\n${renderLicenseBadge(data.license)}\n\n## Description \n${data.description}\n\n## Table of Contents\n* [Installation](#installation)\n* [Usage](#usage)\n* [License](#license)\n* [Contributing](#contributing)\n* [Tests](#tests)\n* [Questions](#questions)\n\n## Installation\n${data.installation}\n\n## Usage\n${data.usage}\n\n## License\n${renderLicenseSection(data.license)}\n\n## Contributing\n${data.contributing}\n\n## Tests\n${data.tests}\n\n## Questions\n${data.questions} \n\nhttps://github.com/${data.username} \n\n${data.email} \n`;\n}", "function configure(config) {\n if (config.configured) return\n config.configured = true\n\n config.output = config.output || 'docs'\n\n config.languages = properObjectWithKeys(config.languages)\n ? { ...defaultLanguages, ...config.languages }\n : defaultLanguages\n\n config.marked = properObjectWithKeys(config.marked)\n ? { ...defaultMarkedOptions, ...config.marked }\n : defaultMarkedOptions\n\n config.layout = config.layout || 'default'\n if (config.layout.match(/^[a-zA-Z0-9]+$/)) {\n config.layout = path.join(__dirname, 'layouts', config.layout)\n }\n\n if (!config.css) config.css = path.join(config.layout, 'docco.css')\n\n config.public = path.join(config.layout, 'public')\n\n if (!config.template) {\n config.template = path.join(config.layout, 'docco.ejs')\n }\n\n config.sources = config.sources || {}\n\n config.sources = config.sources.filter((source) => {\n const there = getLanguage(source, config)\n if (!there) {\n console.warn(`docco: file not processed, language not supported: (${path.basename(source)})`)\n }\n return there\n })\n}" ]
[ "0.60687476", "0.5744102", "0.5629463", "0.54854506", "0.5416786", "0.5379468", "0.5292718", "0.52916867", "0.52667874", "0.5248181", "0.52400845", "0.5222431", "0.519785", "0.5179497", "0.5172039", "0.5149535", "0.51466614", "0.51175636", "0.51146895", "0.51113397", "0.50640094", "0.50490177", "0.50490177", "0.50407714", "0.50304514", "0.50294954", "0.50294954", "0.5007796", "0.4991209", "0.49831563", "0.4978178", "0.49561405", "0.493877", "0.4927971", "0.49037677", "0.48975837", "0.48971042", "0.4893797", "0.4883496", "0.48767462", "0.4875287", "0.48721746", "0.48680693", "0.48677647", "0.48648557", "0.4864659", "0.48531798", "0.48455802", "0.48420447", "0.4840994", "0.48330063", "0.4832695", "0.4819607", "0.4817129", "0.48151532", "0.4810642", "0.4802563", "0.4800304", "0.47821316", "0.4773496", "0.4766566", "0.47665194", "0.47652605", "0.47636676", "0.4761309", "0.47592178", "0.4747917", "0.47358146", "0.47326514", "0.47319835", "0.47319537", "0.47273174", "0.47272566", "0.47207093", "0.47203285", "0.47149253", "0.47128966", "0.47120485", "0.47105718", "0.47105637", "0.47080228", "0.47047827", "0.46994108", "0.46963787", "0.4695783", "0.46938935", "0.46883592", "0.4684004", "0.46786338", "0.46773943", "0.46716172", "0.46664414", "0.4664073", "0.4661486", "0.4655148", "0.46504578", "0.4647144", "0.46463385", "0.46420875", "0.46409187", "0.4639877" ]
0.0
-1
This script was created by HarryTrinh, please don't make a copy with out my credit
function alignedPower(trainerElement, trainerPower, attribute1, attribute2, attribute3, attribute1Val, attribute2Val, attribute3Val, bonusPower){ attribute1Val = parseInt(attribute1Val); attribute2Val = parseInt(attribute2Val); attribute3Val = parseInt(attribute3Val); attribute1Val = calcAttribute(trainerElement, attribute1, attribute1Val); if(attribute2Val > 0){ attribute2Val = calcAttribute(trainerElement, attribute2, attribute2Val); } if(attribute3Val){ attribute3Val = calcAttribute(trainerElement, attribute3, attribute3Val); } var attributeTotal = attribute1Val + attribute2Val + attribute3Val; trainerPower = parseInt(trainerPower); bonusPower = parseInt(bonusPower); // trainerLevel = parseInt(trainerLevel); // var result = ((attributeTotal + 1) * trainerPower) + bonusPower + 15 * (trainerLevel - 1); var result = ((attributeTotal + 1) * trainerPower) + bonusPower; return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "static private internal function m121() {}", "protected internal function m252() {}", "static final private internal function m106() {}", "static private protected internal function m118() {}", "transient protected internal function m189() {}", "static private protected public internal function m117() {}", "transient private internal function m185() {}", "static protected internal function m125() {}", "static private public function m119() {}", "transient private protected internal function m182() {}", "function c0_PG_gettable( ch ) {\r\nvar rc='';\r\n\r\nvar Event_Name='';\r\nvar Event_Site='';\r\nvar Event_Date='';\r\nvar Round='';\r\nvar White='';\r\nvar Black='';\r\nvar Result='';\r\nvar ECO='';\r\nvar WhiteElo='';\r\nvar BlackElo='';\r\nvar Game_Date='';\r\nvar Source_Date='';\r\n\r\nvar AddInfo='';\r\n\r\nvar htms='';\r\n\r\nc0_PGN_header=[];\r\n\r\nPGN_text= c0_ReplaceAll( PGN_text,' ', ' ' );\r\nPGN_text= c0_ReplaceAll( PGN_text, '–', '-');\r\n\r\nfor(var str2=PGN_text;;) {\r\n var at2=str2.indexOf('[');\r\n if(at2<0) break; \r\n var at2_1=str2.indexOf('(');\r\n var at2_2=str2.indexOf('{');\r\n if((at2_1>=0 && at2_1<at2) || (at2_2>=0 && at2_2<at2)) break; \r\n var buf2= str2.substr(at2+1);\r\n buf2= buf2.substr(0, buf2.indexOf(']') );\r\n str2= str2.substr(at2+buf2.length+2);\r\n\r\n c0_PGN_header.push(buf2);\r\n buf2= c0_ReplUrl(buf2); \r\n buf2= c0_ReplaceAll( buf2,'\"','' );\r\n buf2= c0_ReplaceAll( buf2, \"'\" ,'' );\r\n\r\n var buf3=buf2.toUpperCase();\r\n\r\n var at9 = buf3.indexOf('SETUP ');\r\n if(at9>=0 && at9<3) { if( ch==2 ) { c0_fischer=(buf2.substr(at9+6,1)==\"1\") } }\r\n\r\n var at3 = buf3.indexOf('FEN ');\r\n if(at3>=0 && at3<3)\r\n { if( ch==2 && c0_start_FEN.length==0 ) { c0_start_FEN=buf2.substr(at3+4); c0_set_start_position(\"\"); } }\r\n else {\r\n var at3 = buf3.indexOf('EVENT ');\r\n if(at3>=0) Event_Name=buf2.substr(at3+6);\r\n else {\r\n at3 = buf3.indexOf('SITE ');\r\n if(at3>=0) Event_Site=buf2.substr(at3+5);\r\n else {\r\n at3 = buf3.indexOf('DATE ');\r\n if(at3>=0 && at3<3) Game_Date=buf2.substr(at3+5);\r\n else {\r\n at3 = buf3.indexOf('ROUND ');\r\n if(at3>=0) Round=buf2.substr(at3+6);\r\n else {\r\n at3 = buf3.indexOf('WHITE ');\r\n if(at3>=0) White=buf2.substr(at3+6);\r\n else {\r\n at3 = buf3.indexOf('BLACK ');\r\n if(at3>=0) Black=buf2.substr(at3+6);\r\n else {\r\n at3 = buf3.indexOf('ECO ');\r\n if(at3>=0) ECO=buf2.substr(at3+4);\r\n else {\r\n at3 = buf3.indexOf('WHITEELO ');\r\n if(at3>=0) WhiteElo=buf2.substr(at3+9);\r\n else {\r\n at3 = buf3.indexOf('BLACKELO ');\r\n if(at3>=0) BlackElo=buf2.substr(at3+9);\r\n else {\r\n at3 = buf3.indexOf('EVENTDATE ');\r\n if(at3>=0) Event_Date=buf2.substr(at3+10);\r\n else {\r\n at3 = buf3.indexOf('SOURCEDATE ');\r\n if(at3>=0) Source_Date=buf2.substr(at3+11);\r\n else {\r\n at3 = buf3.indexOf('RESULT ');\r\n if(at3>=0) Result=buf2.substr(at3+7);\r\n else {\r\n AddInfo+=((AddInfo.length>0) ? '<BR>' : '' ) + buf2;\r\n }}}}}}}}}}}}}\r\n }\r\n\r\nif(ch==1)\r\n{\r\nif((c0_relative_size_procents<90 && c0_headsize==0) || c0_headsize==10)\r\n {\r\n htms='<TABLE id=\"TBH\" width=\"80\" border=\"0\" bgcolor=\"#CCCC99\" style=\"cursor:move;border:1px solid #666633\" onmouseover=\"c0_over_head(1,99);\">';\r\n if(Round.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">Round: ' + Round + '</font></TD>';\r\n else htms+='<TR><TD id=\"TBH\"><font size=\"3\">more</font></TD>';\r\n htms+='<TD id=\"TBH\"><font size=\"3\">»</font></TD></TR>';\r\n htms+='</TABLE>';\r\n }\r\nelse\r\n {\r\n htms='<TABLE id=\"TBH\" width=\"160\" border=\"0\" bgcolor=\"#CCCC99\" ';\r\n if(c0_headsize==1) htms+=' onmouseout=\"setTimeout(' + \"'\" + 'c0_over_head(0,c0_headsize);' + \"'\" + ',2000);\" ';\r\n htms+=' style=\"cursor:move;border:1px solid #666633\" >';\r\n if(Event_Name.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">Event: ' + Event_Name + '</font></TD></TR> ';\r\n if(Event_Date.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">Event date: ' + Event_Date + '</font></TD></TR>';\r\n if(Event_Site.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">Site: ' + Event_Site + '</font></TD></TR>';\r\n if(Game_Date.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">Date: ' + Game_Date + '</font></TD></TR>';\r\n if(Round.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">Round: ' + Round + '</font></TD></TR>';\r\n if(ECO.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">ECO: ' +\r\n\t'<a title=\"Quick link more about...\" target=\"blank\" href=\"http://www.chessgames.com/perl/chessopening?eco=' + ECO + '\">' + ECO + '</a>' +'</font></TD></TR>';\r\n if(Source_Date.length>0 && Event_Date.length==0 && Game_Date.length==0)\r\n\t\t htms+='<TR><TD id=\"TBH\"><font size=\"3\">Source Date: ' + Source_Date + '</font></TD></TR>';\r\n if(AddInfo.length>0) htms+='<TR><TD id=\"TBH\"><font size=\"3\">' + AddInfo + '</font></TD></TR>';\r\n htms+='<TR><TD id=\"TBH\" align=\"center\" onmouseover=\"c0_over_head(10,99);\"><font size=\"3\">⌂</font></TD></TR>';\r\n htms+='</TABLE>';\r\n }\r\n rc=htms;\r\n}\r\n\r\nif(ch==2 || ch==8)\r\n{\r\n str2= c0_ReplUrl(str2);\r\n if(ch==2)\r\n {\r\n c0_errflag=c0_PG_parseString(str2);\r\n if(c0_fischer && c0_fischer_cst.length>0) c0_fischer_adjustmoved();\r\n }\r\n var at3 = str2.indexOf('*');\r\n if(at3>=0) Result=\"not finished\";\r\n var at3 = str2.indexOf('1/2');\r\n if(at3>=0) Result=\"1/2-1/2\";\r\n var at3 = str2.indexOf('1-0');\r\n if(at3>=0) Result=\"1:0\";\r\n var at3 = str2.indexOf('1:0');\r\n if(at3>=0) Result=\"1:0\";\r\n var at3 = str2.indexOf('0-1');\r\n if(at3>=0) Result=\"0:1\"\r\n var at3 = str2.indexOf('0:1');\r\n if(at3>=0) Result=\"0:1\";\r\n\r\n\r\n if((c0_relative_size_procents<40 && c0_pgnsize==0) || c0_pgnsize==10)\r\n {\r\n htms='<DIV id=\"TBP2\" style=\"cursor:move;border:1px solid #666633;width:100;height:100;overflow-y:scroll;overflow-x:scroll;\">';\r\n htms+='<TABLE id=\"TBP\" width=\"100\" height=\"100\" bgcolor=\"#FFFFCC\" style=\"cursor:move; border:0px solid #666633\">';\r\n htms+='<TR>';\r\n htms+='<TD id=\"TBH\" onmouseover=\"c0_over_pgn(1,99);\"><font size=\"3\">»</font></TD></TR>';\r\n htms+='<TR><TD id=\"TBP\"><font size=\"3\"><b>' + White + (WhiteElo.length>0 ? '(Elo '+WhiteElo+')' : '' ) + ' - </b></font>';\r\n htms+='<font size=\"3\"><b> (' + Result + ') - </b></font>';\r\n htms+='<font size=\"3\"><b>' + Black + (BlackElo.length>0 ? '(Elo '+BlackElo+')' : '' ) + '</b></font>';\r\n htms+='<br>';\r\n str2=c0_PG_3;\r\n htms+='<font size=\"3\">' + str2 + '</font>';\r\n htms+='</TD>';\r\n htms+='</TR></TABLE>';\r\n htms+='</DIV>';\r\n rc=htms;\r\n }\r\n else\r\n {\r\n\r\n if(c0_dh>0 || c0_screensizeW<c0_screensizeH)\r\n {\r\n var wH= c0_dh>0 ? c0_dh : parseInt( c0_screensizeH - 20 - ( c0_at_top + (332*(c0_relative_size_procents/100)*(c0_topview?1.8:1)) +50 ) );\r\n var wW= parseInt(c0_screensizeW-22);\r\n\r\n htms='<DIV id=\"TBP2\" style=\"cursor:move;border:1px solid #666633;width:' + wW.toString() + ';height:' + wH.toString() + '\">';\r\n htms+='<TABLE id=\"TBP\" width=\"' + wW.toString() + '\" height=\"' + wH.toString() + '\" bgcolor=\"#FFFFCC\" ';\r\n //if(c0_pgnsize==1) htms+=' onmouseout=\"setTimeout(' + \"'\" + 'c0_over_pgn(0,c0_pgnsize);' + \"'\" + ',4000);\" ';\r\n htms+=' style=\"cursor:move; border:0px solid #666633\">';\r\n htms+='<TR>';\r\n htms+='<TD id=\"TBP\"><font size=\"3\"><b>' + White + (WhiteElo.length>0 ? '(Elo '+WhiteElo+')' : '' ) + ' - </b></font>';\r\n htms+='<font size=\"3\"><b> (' + Result + ') - </b></font>';\r\n htms+='<font size=\"3\"><b>' + Black + (BlackElo.length>0 ? '(Elo '+BlackElo+')' : '' ) + '</b></font>';\r\n htms+='</TD>';\r\n htms+='<TD id=\"TZH\" width=\"10\" align=\"center\" onmouseover=\"c0_over_pgn(10,99);\"><font size=\"3\">⌂</font></TD>';\r\n htms+='</TR>';\r\n str2=c0_PG_3;\r\n htms+='<TR><TD id=\"TBP\"><font size=\"3\">' + str2 + '</font>';\r\n htms+='</TD>';\r\n htms+='</TR></TABLE>';\r\n htms+='</DIV>';\r\n\r\n rc=htms;\r\n }\r\n else\r\n {\r\n htms='<TABLE id=\"TBP\" width=\"180\" bgcolor=\"#FFFFCC\" ';\r\n //if(c0_pgnsize==1) htms+=' onmouseout=\"setTimeout(' + \"'\" + 'c0_over_pgn(0,c0_pgnsize);' + \"'\" + ',4000);\" ';\r\n htms+=' style=\"cursor:move;border:1px solid #666633\">';\r\n htms+='<TR><TD id=\"TBP\"><font size=\"3\">' + White + (WhiteElo.length>0 ? '<br>(Elo '+WhiteElo+')' : '' ) + '</font></TD>';\r\n htms+='<TD id=\"TBP\"><font size=\"3\">' + Black + (BlackElo.length>0 ? '<br>(Elo '+BlackElo+')' : '' ) + '</font></TD></TR>';\r\n htms+='</TABLE>';\r\n htms+='<TABLE id=\"TBP\" width=\"180\" bgcolor=\"#FFFFCC\" style=\"cursor:move;border:1px solid #666633\">';\r\n htms+='<TR><TD id=\"TBP\" align=\"center\"><font size=\"3\">' + Result + '</font></TD>';\r\n htms+='<TD id=\"TZH\" align=\"center\" onmouseover=\"c0_over_pgn(10,99);\"><font size=\"3\">⌂</font></TD></TR>';\r\n htms+='</TABLE>';\r\n\r\n str2=c0_PG_3;\r\n htms+='<DIV id=\"TBP2\" style=\"cursor:move;border:1px solid #666633;overflow-y:scroll;width:178;height:' + (c0_relative_size_procents<90 ? '80' : (c0_relative_size_procents<110 ? '200' : '340' ) ) + '\" >';\r\n htms+='<TABLE id=\"TBP\" width=\"100%\" bgcolor=\"#FFFFCC\" style=\"border:1px solid #666633\">';\r\n htms+='<TR><TD id=\"TBP\"><font size=\"3\">' + str2 + '</font></TD>';\r\n htms+='</TABLE></DIV>';\r\n htms+='';\r\n rc=htms;\r\n }\r\n\r\n }\r\n\r\n if(c0_PG_viewer) document.title = White + '-' + Black + ' (' + Result + ')';\r\n\r\n}\r\n return rc;\r\n}", "static transient private protected internal function m55() {}", "function Scdr() {\r\n}", "transient final protected internal function m174() {}", "static final private protected internal function m103() {}", "function PrintUsage() {\nvar s = \"\";\n\ns = s + \"\\n ChangeProperties_ADSI.js\";\ns = s + \"\\n \";\ns = s + \"\\n \\t Description:\";\ns = s + \"\\n Sample script that uses ADSI to change properties on machines as listed in a tab-delimited file.\";\ns = s + \"\\n \";\ns = s + \"\\n \\t Syntax:\";\ns = s + \"\\n ChangeProperties_ADSI.js <file name>\";\ns = s + \"\\n \";\ns = s + \"\\n \\t Example:\";\ns = s + \"\\n Cscript /nologo ChangeProperties_ADSI.js c:\\\\mymachines.txt\";\ns = s + \"\\n Cscript /nologo ChangeProperties_ADSI.js mymachines.txt\";\ns = s + \"\\n \";\ns = s + \"\\n \\t Syntax of File:\";\ns = s + \"\\n <machine name> \\t <metabase path> \\t <property name> \\t <value>\";\ns = s + \"\\n \";\ns = s + \"\\n \\t Example of File:\";\ns = s + \"\\n Server1 \\t w3svc \\t ConnectionTimeout \\t 999\";\ns = s + \"\\n Server2 \\t w3svc\\/1 \\t ServerComment \\t My Default Server\";\ns = s + \"\\n Server2 \\t w3svc\\/1\\/root \\t Path \\t c:\\\\webroot\";\ns = s + \"\\n Server1 \\t msftpsvc \\t ConnectionTimeout \\t 999\";\ns = s + \"\\n \";\ns = s + \"\\n \\t Notes:\";\ns = s + \"\\n - The property must exist at the level you specify in the file.\";\ns = s + \"\\n - Not all properties propogate to child nodes. ConnectionTimeout does, ServerComment does not.\";\ns = s + \"\\n - The property value must be of a string, boolean, or integer data type.\";\ns = s + \"\\n - The file must be in ANSI format\";\ns = s + \"\\n - Each line in the file corresponds to one property change. A quick way to create the file that has repeated text is to use Excel where the first column is the machine name, the second column is the metabase path, the third column is the property name and the fourth column is the value you want set. Then, copy all the fields and paste into Notepad. Each line is automatically tab-delimited.\";\ns = s + \"\\n - The user of the script must be an administrator on all of the machines that are listed in the file. If the user account is not an administrator on all of the machines, but there is an account that is an administrator on all of the machines, alter the call to ConnectServer in this script to add a user name and password, or any other parameters like Locale ID.\";\ns = s + \"\\n \";\n\nWScript.Echo(s);\nreturn 1;\n}", "function _____SHARED_functions_____(){}", "function fos6_c() {\n ;\n }", "static transient final protected internal function m47() {}", "static transient private internal function m58() {}", "transient final private protected internal function m167() {}", "function setup() {\n\n\n}", "function setup() {\n\n\n}", "static final private protected public internal function m102() {}", "static final private public function m104() {}", "static transient private protected public internal function m54() {}", "function o700() {\n try {\nif (o947()) {\n try {\no90.o361.o109 = o90.o361.o989;\n}catch(e){}\n try {\no90.o361.o110 = o90.o361.o990;\n}catch(e){}\n }\n}catch(e){}\n}", "function comportement (){\n\t }", "static transient final private internal function m43() {}", "function main(){\n\n\n}", "function o0(o1)\n{\n var o2 = -1;\n try {\nfor (var o259 = 0; o3 < o1.length; function (o502, name, o38, o781, o782, o837, o585, o838, o549) {\n try {\no839.o468();\n}catch(e){}\n // TODO we should allow people to just pass in a complete filename instead\n // of parent and name being that we just join them anyways\n var o840 = name ? o591.resolve(o591.o592(o502, name)) : o502;\n\n function o841(o842) {\n function o843(o842) {\n try {\nif (!o838) {\n try {\no474.o800(o502, name, o842, o781, o782, o549);\n}catch(e){}\n }\n}catch(e){}\n try {\nif (o837) try {\no837();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n }\n var o844 = false;\n try {\nModule['preloadPlugins'].forEach(function (o845) {\n try {\nif (o844) try {\nreturn;\n}catch(e){}\n}catch(e){}\n try {\nif (o845['canHandle'](o840)) {\n try {\no845['handle'](o842, o840, o843, function () {\n try {\nif (o585) try {\no585();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n });\n}catch(e){}\n try {\no844 = true;\n}catch(e){}\n }\n}catch(e){}\n });\n}catch(e){}\n try {\nif (!o844) try {\no843(o842);\n}catch(e){}\n}catch(e){}\n }\n try {\no332('cp ' + o840);\n}catch(e){}\n try {\nif (typeof o38 == 'string') {\n try {\no839.o846(o38, function (o842) {\n try {\no841(o842);\n}catch(e){}\n }, o585);\n}catch(e){}\n } else {\n try {\no841(o38);\n}catch(e){}\n }\n}catch(e){}\n })\n {\n try {\nif (o1[o3] == undefined)\n {\n try {\nif (o2 == -1)\n {\n try {\no2 = o3;\n}catch(e){}\n }\n}catch(e){}\n }\n else\n {\n try {\nif (o2 != -1)\n {\n try {\no4.o5(o2 + \"-\" + (o3-1) + \" = undefined\");\n}catch(e){}\n try {\no2 = -1;\n}catch(e){}\n }\n}catch(e){}\n try {\no4.o5(o3 + \" = \" + o1[o3]);\n}catch(e){}\n }\n}catch(e){}\n }\n}catch(e){}\n}", "static final protected internal function m110() {}", "function oob_system(){\n\t\ntest_find_conflict();\n}//end function oob_system", "function main()\r\n\t{\r\n\t\tif ($(\"font[color*='#007700']\").length>0)\r\n\t\t{\r\n\t\t\tvar captchars = $(\"img[src*='cap_']\");\r\n\t\t\tvar capText='';\r\n\t\t\t$(\"img[src*='slow_1']\").each(function(){capText+= GetCapchar(captchars[GetImgNumber(this.src)-1].src);});\r\n\t\t\t$(\"[onpaste*='return false;']\").attr('onpaste','return true;')\r\n\t\t\t$(\"input[name*='kod']\").attr('value','KAV2009-377333');\r\n\t\t\t$(\"input[name*='captcha']\").attr('value',capText);\r\n\t\t\t$(\"input[name*='zatwierdz']\").attr('value','Register');\r\n\t\t\t$(\"textarea[name*='adres']\").attr('value','Wydział do Foresight\\r\\nul. Wspólna 1/2\\r\\n00-519 Warszawa 52');\r\n\t\t\t$($(\"b\")[2]).html('Code');\r\n\t\t\t$($(\"b\")[3]).html('Your Name');\r\n\t\t\t$($(\"b\")[4]).html('<span>Your Email address</span><font color=\"red\">*</font>');\r\n\t\t\t$($(\"small\")[0]).html('This e-mail will be used to send the activation code');\r\n\t\t\t$($(\"b\")[5]).html('Your address');\r\n\t\t\t$($(\"tr\")[23]).hide();\r\n\t\t\t$($(\"tr\")[24]).hide();\r\n\t\t\t$($(\"tr\")[25]).hide();\r\n\t\t\t$($(\"tr\")[26]).hide();\r\n\t\t}\r\n\t}", "transient private protected public internal function m181() {}", "transient final private internal function m170() {}", "function SBRecordsetPHP_analyzePlatformSpecific()\r\n{\r\n\r\n\r\n}", "static transient final private protected internal function m40() {}", "function hc(){}", "function main()\n{\n setup_display_boxes();\n\n // Create the QSS lookup table\n // This can be done beforehand and saved for use with multiple QSS images\n create_qss_lookup_table();\n}", "function T7(){return typeof window>\"u\"&&(self.window=self),function(n){var e={parse:function(r){var s=e._bin,o=new Uint8Array(r);if(s.readASCII(o,0,4)==\"ttcf\"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var l=s.readUint(o,a);a+=4;for(var c=[],d=0;d<l;d++){var h=s.readUint(o,a);a+=4,c.push(e._readFont(o,h))}return c}return[e._readFont(o,0)]},_readFont:function(r,s){var o=e._bin,a=s;o.readFixed(r,s),s+=4;var l=o.readUshort(r,s);s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2;for(var c=[\"cmap\",\"head\",\"hhea\",\"maxp\",\"hmtx\",\"name\",\"OS/2\",\"post\",\"loca\",\"glyf\",\"kern\",\"CFF \",\"GPOS\",\"GSUB\",\"SVG \"],d={_data:r,_offset:a},h={},p=0;p<l;p++){var m=o.readASCII(r,s,4);s+=4,o.readUint(r,s),s+=4;var v=o.readUint(r,s);s+=4;var y=o.readUint(r,s);s+=4,h[m]={offset:v,length:y}}for(p=0;p<c.length;p++){var x=c[p];h[x]&&(d[x.trim()]=e[x.trim()].parse(r,h[x].offset,h[x].length,d))}return d},_tabOffset:function(r,s,o){for(var a=e._bin,l=a.readUshort(r,o+4),c=o+12,d=0;d<l;d++){var h=a.readASCII(r,c,4);c+=4,a.readUint(r,c),c+=4;var p=a.readUint(r,c);if(c+=4,a.readUint(r,c),c+=4,h==s)return p}return 0}};e._bin={readFixed:function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<8|r[s+3])/65540},readF2dot14:function(r,s){return e._bin.readShort(r,s)/16384},readInt:function(r,s){return e._bin._view(r).getInt32(s)},readInt8:function(r,s){return e._bin._view(r).getInt8(s)},readShort:function(r,s){return e._bin._view(r).getInt16(s)},readUshort:function(r,s){return e._bin._view(r).getUint16(s)},readUshorts:function(r,s,o){for(var a=[],l=0;l<o;l++)a.push(e._bin.readUshort(r,s+2*l));return a},readUint:function(r,s){return e._bin._view(r).getUint32(s)},readUint64:function(r,s){return 4294967296*e._bin.readUint(r,s)+e._bin.readUint(r,s+4)},readASCII:function(r,s,o){for(var a=\"\",l=0;l<o;l++)a+=String.fromCharCode(r[s+l]);return a},readUnicode:function(r,s,o){for(var a=\"\",l=0;l<o;l++){var c=r[s++]<<8|r[s++];a+=String.fromCharCode(c)}return a},_tdec:typeof window<\"u\"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(r,s,o){var a=e._bin._tdec;return a&&s==0&&o==r.length?a.decode(r):e._bin.readASCII(r,s,o)},readBytes:function(r,s,o){for(var a=[],l=0;l<o;l++)a.push(r[s+l]);return a},readASCIIArray:function(r,s,o){for(var a=[],l=0;l<o;l++)a.push(String.fromCharCode(r[s+l]));return a},_view:function(r){return r._dataView||(r._dataView=r.buffer?new DataView(r.buffer,r.byteOffset,r.byteLength):new DataView(new Uint8Array(r).buffer))}},e._lctf={},e._lctf.parse=function(r,s,o,a,l){var c=e._bin,d={},h=s;c.readFixed(r,s),s+=4;var p=c.readUshort(r,s);s+=2;var m=c.readUshort(r,s);s+=2;var v=c.readUshort(r,s);return s+=2,d.scriptList=e._lctf.readScriptList(r,h+p),d.featureList=e._lctf.readFeatureList(r,h+m),d.lookupList=e._lctf.readLookupList(r,h+v,l),d},e._lctf.readLookupList=function(r,s,o){var a=e._bin,l=s,c=[],d=a.readUshort(r,s);s+=2;for(var h=0;h<d;h++){var p=a.readUshort(r,s);s+=2;var m=e._lctf.readLookupTable(r,l+p,o);c.push(m)}return c},e._lctf.readLookupTable=function(r,s,o){var a=e._bin,l=s,c={tabs:[]};c.ltype=a.readUshort(r,s),s+=2,c.flag=a.readUshort(r,s),s+=2;var d=a.readUshort(r,s);s+=2;for(var h=c.ltype,p=0;p<d;p++){var m=a.readUshort(r,s);s+=2;var v=o(r,h,l+m,c);c.tabs.push(v)}return c},e._lctf.numOfOnes=function(r){for(var s=0,o=0;o<32;o++)r>>>o&1&&s++;return s},e._lctf.readClassDef=function(r,s){var o=e._bin,a=[],l=o.readUshort(r,s);if(s+=2,l==1){var c=o.readUshort(r,s);s+=2;var d=o.readUshort(r,s);s+=2;for(var h=0;h<d;h++)a.push(c+h),a.push(c+h),a.push(o.readUshort(r,s)),s+=2}if(l==2){var p=o.readUshort(r,s);for(s+=2,h=0;h<p;h++)a.push(o.readUshort(r,s)),s+=2,a.push(o.readUshort(r,s)),s+=2,a.push(o.readUshort(r,s)),s+=2}return a},e._lctf.getInterval=function(r,s){for(var o=0;o<r.length;o+=3){var a=r[o],l=r[o+1];if(r[o+2],a<=s&&s<=l)return o}return-1},e._lctf.readCoverage=function(r,s){var o=e._bin,a={};a.fmt=o.readUshort(r,s),s+=2;var l=o.readUshort(r,s);return s+=2,a.fmt==1&&(a.tab=o.readUshorts(r,s,l)),a.fmt==2&&(a.tab=o.readUshorts(r,s,3*l)),a},e._lctf.coverageIndex=function(r,s){var o=r.tab;if(r.fmt==1)return o.indexOf(s);if(r.fmt==2){var a=e._lctf.getInterval(o,s);if(a!=-1)return o[a+2]+(s-o[a])}return-1},e._lctf.readFeatureList=function(r,s){var o=e._bin,a=s,l=[],c=o.readUshort(r,s);s+=2;for(var d=0;d<c;d++){var h=o.readASCII(r,s,4);s+=4;var p=o.readUshort(r,s);s+=2;var m=e._lctf.readFeatureTable(r,a+p);m.tag=h.trim(),l.push(m)}return l},e._lctf.readFeatureTable=function(r,s){var o=e._bin,a=s,l={},c=o.readUshort(r,s);s+=2,c>0&&(l.featureParams=a+c);var d=o.readUshort(r,s);s+=2,l.tab=[];for(var h=0;h<d;h++)l.tab.push(o.readUshort(r,s+2*h));return l},e._lctf.readScriptList=function(r,s){var o=e._bin,a=s,l={},c=o.readUshort(r,s);s+=2;for(var d=0;d<c;d++){var h=o.readASCII(r,s,4);s+=4;var p=o.readUshort(r,s);s+=2,l[h.trim()]=e._lctf.readScriptTable(r,a+p)}return l},e._lctf.readScriptTable=function(r,s){var o=e._bin,a=s,l={},c=o.readUshort(r,s);s+=2,l.default=e._lctf.readLangSysTable(r,a+c);var d=o.readUshort(r,s);s+=2;for(var h=0;h<d;h++){var p=o.readASCII(r,s,4);s+=4;var m=o.readUshort(r,s);s+=2,l[p.trim()]=e._lctf.readLangSysTable(r,a+m)}return l},e._lctf.readLangSysTable=function(r,s){var o=e._bin,a={};o.readUshort(r,s),s+=2,a.reqFeature=o.readUshort(r,s),s+=2;var l=o.readUshort(r,s);return s+=2,a.features=o.readUshorts(r,s,l),a},e.CFF={},e.CFF.parse=function(r,s,o){var a=e._bin;(r=new Uint8Array(r.buffer,s,o))[s=0],r[++s],r[++s],r[++s],s++;var l=[];s=e.CFF.readIndex(r,s,l);for(var c=[],d=0;d<l.length-1;d++)c.push(a.readASCII(r,s+l[d],l[d+1]-l[d]));s+=l[l.length-1];var h=[];s=e.CFF.readIndex(r,s,h);var p=[];for(d=0;d<h.length-1;d++)p.push(e.CFF.readDict(r,s+h[d],s+h[d+1]));s+=h[h.length-1];var m=p[0],v=[];s=e.CFF.readIndex(r,s,v);var y=[];for(d=0;d<v.length-1;d++)y.push(a.readASCII(r,s+v[d],v[d+1]-v[d]));if(s+=v[v.length-1],e.CFF.readSubrs(r,s,m),m.CharStrings){s=m.CharStrings,v=[],s=e.CFF.readIndex(r,s,v);var x=[];for(d=0;d<v.length-1;d++)x.push(a.readBytes(r,s+v[d],v[d+1]-v[d]));m.CharStrings=x}if(m.ROS){s=m.FDArray;var w=[];for(s=e.CFF.readIndex(r,s,w),m.FDArray=[],d=0;d<w.length-1;d++){var _=e.CFF.readDict(r,s+w[d],s+w[d+1]);e.CFF._readFDict(r,_,y),m.FDArray.push(_)}s+=w[w.length-1],s=m.FDSelect,m.FDSelect=[];var S=r[s];if(s++,S!=3)throw S;var b=a.readUshort(r,s);for(s+=2,d=0;d<b+1;d++)m.FDSelect.push(a.readUshort(r,s),r[s+2]),s+=3}return m.Encoding&&(m.Encoding=e.CFF.readEncoding(r,m.Encoding,m.CharStrings.length)),m.charset&&(m.charset=e.CFF.readCharset(r,m.charset,m.CharStrings.length)),e.CFF._readFDict(r,m,y),m},e.CFF._readFDict=function(r,s,o){var a;for(var l in s.Private&&(a=s.Private[1],s.Private=e.CFF.readDict(r,a,a+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(r,a+s.Private.Subrs,s.Private)),s)[\"FamilyName\",\"FontName\",\"FullName\",\"Notice\",\"version\",\"Copyright\"].indexOf(l)!=-1&&(s[l]=o[s[l]-426+35])},e.CFF.readSubrs=function(r,s,o){var a=e._bin,l=[];s=e.CFF.readIndex(r,s,l);var c,d=l.length;c=d<1240?107:d<33900?1131:32768,o.Bias=c,o.Subrs=[];for(var h=0;h<l.length-1;h++)o.Subrs.push(a.readBytes(r,s+l[h],l[h+1]-l[h]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(r,s){for(var o=0;o<r.charset.length;o++)if(r.charset[o]==s)return o;return-1},e.CFF.glyphBySE=function(r,s){return s<0||s>255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[s])},e.CFF.readEncoding=function(r,s,o){e._bin;var a=[\".notdef\"],l=r[s];if(s++,l!=0)throw\"error: unknown encoding format: \"+l;var c=r[s];s++;for(var d=0;d<c;d++)a.push(r[s+d]);return a},e.CFF.readCharset=function(r,s,o){var a=e._bin,l=[\".notdef\"],c=r[s];if(s++,c==0)for(var d=0;d<o;d++){var h=a.readUshort(r,s);s+=2,l.push(h)}else{if(c!=1&&c!=2)throw\"error: format: \"+c;for(;l.length<o;){h=a.readUshort(r,s),s+=2;var p=0;for(c==1?(p=r[s],s++):(p=a.readUshort(r,s),s+=2),d=0;d<=p;d++)l.push(h),h++}}return l},e.CFF.readIndex=function(r,s,o){var a=e._bin,l=a.readUshort(r,s)+1,c=r[s+=2];if(s++,c==1)for(var d=0;d<l;d++)o.push(r[s+d]);else if(c==2)for(d=0;d<l;d++)o.push(a.readUshort(r,s+2*d));else if(c==3)for(d=0;d<l;d++)o.push(16777215&a.readUint(r,s+3*d-1));else if(l!=1)throw\"unsupported offset size: \"+c+\", count: \"+l;return(s+=l*c)-1},e.CFF.getCharString=function(r,s,o){var a=e._bin,l=r[s],c=r[s+1];r[s+2],r[s+3],r[s+4];var d=1,h=null,p=null;l<=20&&(h=l,d=1),l==12&&(h=100*l+c,d=2),21<=l&&l<=27&&(h=l,d=1),l==28&&(p=a.readShort(r,s+1),d=3),29<=l&&l<=31&&(h=l,d=1),32<=l&&l<=246&&(p=l-139,d=1),247<=l&&l<=250&&(p=256*(l-247)+c+108,d=2),251<=l&&l<=254&&(p=256*-(l-251)-c-108,d=2),l==255&&(p=a.readInt(r,s+1)/65535,d=5),o.val=p??\"o\"+h,o.size=d},e.CFF.readCharString=function(r,s,o){for(var a=s+o,l=e._bin,c=[];s<a;){var d=r[s],h=r[s+1];r[s+2],r[s+3],r[s+4];var p=1,m=null,v=null;d<=20&&(m=d,p=1),d==12&&(m=100*d+h,p=2),d!=19&&d!=20||(m=d,p=2),21<=d&&d<=27&&(m=d,p=1),d==28&&(v=l.readShort(r,s+1),p=3),29<=d&&d<=31&&(m=d,p=1),32<=d&&d<=246&&(v=d-139,p=1),247<=d&&d<=250&&(v=256*(d-247)+h+108,p=2),251<=d&&d<=254&&(v=256*-(d-251)-h-108,p=2),d==255&&(v=l.readInt(r,s+1)/65535,p=5),c.push(v??\"o\"+m),s+=p}return c},e.CFF.readDict=function(r,s,o){for(var a=e._bin,l={},c=[];s<o;){var d=r[s],h=r[s+1];r[s+2],r[s+3],r[s+4];var p=1,m=null,v=null;if(d==28&&(v=a.readShort(r,s+1),p=3),d==29&&(v=a.readInt(r,s+1),p=5),32<=d&&d<=246&&(v=d-139,p=1),247<=d&&d<=250&&(v=256*(d-247)+h+108,p=2),251<=d&&d<=254&&(v=256*-(d-251)-h-108,p=2),d==255)throw v=a.readInt(r,s+1)/65535,p=5,\"unknown number\";if(d==30){var y=[];for(p=1;;){var x=r[s+p];p++;var w=x>>4,_=15&x;if(w!=15&&y.push(w),_!=15&&y.push(_),_==15)break}for(var S=\"\",b=[0,1,2,3,4,5,6,7,8,9,\".\",\"e\",\"e-\",\"reserved\",\"-\",\"endOfNumber\"],T=0;T<y.length;T++)S+=b[y[T]];v=parseFloat(S)}d<=21&&(m=[\"version\",\"Notice\",\"FullName\",\"FamilyName\",\"Weight\",\"FontBBox\",\"BlueValues\",\"OtherBlues\",\"FamilyBlues\",\"FamilyOtherBlues\",\"StdHW\",\"StdVW\",\"escape\",\"UniqueID\",\"XUID\",\"charset\",\"Encoding\",\"CharStrings\",\"Private\",\"Subrs\",\"defaultWidthX\",\"nominalWidthX\"][d],p=1,d==12&&(m=[\"Copyright\",\"isFixedPitch\",\"ItalicAngle\",\"UnderlinePosition\",\"UnderlineThickness\",\"PaintType\",\"CharstringType\",\"FontMatrix\",\"StrokeWidth\",\"BlueScale\",\"BlueShift\",\"BlueFuzz\",\"StemSnapH\",\"StemSnapV\",\"ForceBold\",0,0,\"LanguageGroup\",\"ExpansionFactor\",\"initialRandomSeed\",\"SyntheticBase\",\"PostScript\",\"BaseFontName\",\"BaseFontBlend\",0,0,0,0,0,0,\"ROS\",\"CIDFontVersion\",\"CIDFontRevision\",\"CIDFontType\",\"CIDCount\",\"UIDBase\",\"FDArray\",\"FDSelect\",\"FontName\"][h],p=2)),m!=null?(l[m]=c.length==1?c[0]:c,c=[]):c.push(v),s+=p}return l},e.cmap={},e.cmap.parse=function(r,s,o){r=new Uint8Array(r.buffer,s,o),s=0;var a=e._bin,l={};a.readUshort(r,s),s+=2;var c=a.readUshort(r,s);s+=2;var d=[];l.tables=[];for(var h=0;h<c;h++){var p=a.readUshort(r,s);s+=2;var m=a.readUshort(r,s);s+=2;var v=a.readUint(r,s);s+=4;var y=\"p\"+p+\"e\"+m,x=d.indexOf(v);if(x==-1){var w;x=l.tables.length,d.push(v);var _=a.readUshort(r,v);_==0?w=e.cmap.parse0(r,v):_==4?w=e.cmap.parse4(r,v):_==6?w=e.cmap.parse6(r,v):_==12?w=e.cmap.parse12(r,v):console.debug(\"unknown format: \"+_,p,m,v),l.tables.push(w)}if(l[y]!=null)throw\"multiple tables for one platform+encoding\";l[y]=x}return l},e.cmap.parse0=function(r,s){var o=e._bin,a={};a.format=o.readUshort(r,s),s+=2;var l=o.readUshort(r,s);s+=2,o.readUshort(r,s),s+=2,a.map=[];for(var c=0;c<l-6;c++)a.map.push(r[s+c]);return a},e.cmap.parse4=function(r,s){var o=e._bin,a=s,l={};l.format=o.readUshort(r,s),s+=2;var c=o.readUshort(r,s);s+=2,o.readUshort(r,s),s+=2;var d=o.readUshort(r,s);s+=2;var h=d/2;l.searchRange=o.readUshort(r,s),s+=2,l.entrySelector=o.readUshort(r,s),s+=2,l.rangeShift=o.readUshort(r,s),s+=2,l.endCount=o.readUshorts(r,s,h),s+=2*h,s+=2,l.startCount=o.readUshorts(r,s,h),s+=2*h,l.idDelta=[];for(var p=0;p<h;p++)l.idDelta.push(o.readShort(r,s)),s+=2;for(l.idRangeOffset=o.readUshorts(r,s,h),s+=2*h,l.glyphIdArray=[];s<a+c;)l.glyphIdArray.push(o.readUshort(r,s)),s+=2;return l},e.cmap.parse6=function(r,s){var o=e._bin,a={};a.format=o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2,a.firstCode=o.readUshort(r,s),s+=2;var l=o.readUshort(r,s);s+=2,a.glyphIdArray=[];for(var c=0;c<l;c++)a.glyphIdArray.push(o.readUshort(r,s)),s+=2;return a},e.cmap.parse12=function(r,s){var o=e._bin,a={};a.format=o.readUshort(r,s),s+=2,s+=2,o.readUint(r,s),s+=4,o.readUint(r,s),s+=4;var l=o.readUint(r,s);s+=4,a.groups=[];for(var c=0;c<l;c++){var d=s+12*c,h=o.readUint(r,d+0),p=o.readUint(r,d+4),m=o.readUint(r,d+8);a.groups.push([h,p,m])}return a},e.glyf={},e.glyf.parse=function(r,s,o,a){for(var l=[],c=0;c<a.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(r,s){var o=e._bin,a=r._data,l=e._tabOffset(a,\"glyf\",r._offset)+r.loca[s];if(r.loca[s]==r.loca[s+1])return null;var c={};if(c.noc=o.readShort(a,l),l+=2,c.xMin=o.readShort(a,l),l+=2,c.yMin=o.readShort(a,l),l+=2,c.xMax=o.readShort(a,l),l+=2,c.yMax=o.readShort(a,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var d=0;d<c.noc;d++)c.endPts.push(o.readUshort(a,l)),l+=2;var h=o.readUshort(a,l);if(l+=2,a.length-l<h)return null;c.instructions=o.readBytes(a,l,h),l+=h;var p=c.endPts[c.noc-1]+1;for(c.flags=[],d=0;d<p;d++){var m=a[l];if(l++,c.flags.push(m),(8&m)!=0){var v=a[l];l++;for(var y=0;y<v;y++)c.flags.push(m),d++}}for(c.xs=[],d=0;d<p;d++){var x=(2&c.flags[d])!=0,w=(16&c.flags[d])!=0;x?(c.xs.push(w?a[l]:-a[l]),l++):w?c.xs.push(0):(c.xs.push(o.readShort(a,l)),l+=2)}for(c.ys=[],d=0;d<p;d++)x=(4&c.flags[d])!=0,w=(32&c.flags[d])!=0,x?(c.ys.push(w?a[l]:-a[l]),l++):w?c.ys.push(0):(c.ys.push(o.readShort(a,l)),l+=2);var _=0,S=0;for(d=0;d<p;d++)_+=c.xs[d],S+=c.ys[d],c.xs[d]=_,c.ys[d]=S}else{var b;c.parts=[];do{b=o.readUshort(a,l),l+=2;var T={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(T),T.glyphIndex=o.readUshort(a,l),l+=2,1&b){var A=o.readShort(a,l);l+=2;var L=o.readShort(a,l);l+=2}else A=o.readInt8(a,l),l++,L=o.readInt8(a,l),l++;2&b?(T.m.tx=A,T.m.ty=L):(T.p1=A,T.p2=L),8&b?(T.m.a=T.m.d=o.readF2dot14(a,l),l+=2):64&b?(T.m.a=o.readF2dot14(a,l),l+=2,T.m.d=o.readF2dot14(a,l),l+=2):128&b&&(T.m.a=o.readF2dot14(a,l),l+=2,T.m.b=o.readF2dot14(a,l),l+=2,T.m.c=o.readF2dot14(a,l),l+=2,T.m.d=o.readF2dot14(a,l),l+=2)}while(32&b);if(256&b){var C=o.readUshort(a,l);for(l+=2,c.instr=[],d=0;d<C;d++)c.instr.push(a[l]),l++}}return c},e.GPOS={},e.GPOS.parse=function(r,s,o,a){return e._lctf.parse(r,s,o,a,e.GPOS.subt)},e.GPOS.subt=function(r,s,o,a){var l=e._bin,c=o,d={};if(d.fmt=l.readUshort(r,o),o+=2,s==1||s==2||s==3||s==7||s==8&&d.fmt<=2){var h=l.readUshort(r,o);o+=2,d.coverage=e._lctf.readCoverage(r,h+c)}if(s==1&&d.fmt==1){var p=l.readUshort(r,o);o+=2;var m=e._lctf.numOfOnes(p);p!=0&&(d.pos=e.GPOS.readValueRecord(r,o,p))}else if(s==2&&d.fmt>=1&&d.fmt<=2){p=l.readUshort(r,o),o+=2;var v=l.readUshort(r,o);o+=2,m=e._lctf.numOfOnes(p);var y=e._lctf.numOfOnes(v);if(d.fmt==1){d.pairsets=[];var x=l.readUshort(r,o);o+=2;for(var w=0;w<x;w++){var _=c+l.readUshort(r,o);o+=2;var S=l.readUshort(r,_);_+=2;for(var b=[],T=0;T<S;T++){var A=l.readUshort(r,_);_+=2,p!=0&&(V=e.GPOS.readValueRecord(r,_,p),_+=2*m),v!=0&&(W=e.GPOS.readValueRecord(r,_,v),_+=2*y),b.push({gid2:A,val1:V,val2:W})}d.pairsets.push(b)}}if(d.fmt==2){var L=l.readUshort(r,o);o+=2;var C=l.readUshort(r,o);o+=2;var R=l.readUshort(r,o);o+=2;var k=l.readUshort(r,o);for(o+=2,d.classDef1=e._lctf.readClassDef(r,c+L),d.classDef2=e._lctf.readClassDef(r,c+C),d.matrix=[],w=0;w<R;w++){var H=[];for(T=0;T<k;T++){var V=null,W=null;p!=0&&(V=e.GPOS.readValueRecord(r,o,p),o+=2*m),v!=0&&(W=e.GPOS.readValueRecord(r,o,v),o+=2*y),H.push({val1:V,val2:W})}d.matrix.push(H)}}}else{if(s==9&&d.fmt==1){var F=l.readUshort(r,o);o+=2;var J=l.readUint(r,o);if(o+=4,a.ltype==9)a.ltype=F;else if(a.ltype!=F)throw\"invalid extension substitution\";return e.GPOS.subt(r,a.ltype,c+J)}console.debug(\"unsupported GPOS table LookupType\",s,\"format\",d.fmt)}return d},e.GPOS.readValueRecord=function(r,s,o){var a=e._bin,l=[];return l.push(1&o?a.readShort(r,s):0),s+=1&o?2:0,l.push(2&o?a.readShort(r,s):0),s+=2&o?2:0,l.push(4&o?a.readShort(r,s):0),s+=4&o?2:0,l.push(8&o?a.readShort(r,s):0),s+=8&o?2:0,l},e.GSUB={},e.GSUB.parse=function(r,s,o,a){return e._lctf.parse(r,s,o,a,e.GSUB.subt)},e.GSUB.subt=function(r,s,o,a){var l=e._bin,c=o,d={};if(d.fmt=l.readUshort(r,o),o+=2,s!=1&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==4||s==5&&d.fmt<=2||s==6&&d.fmt<=2){var h=l.readUshort(r,o);o+=2,d.coverage=e._lctf.readCoverage(r,c+h)}if(s==1&&d.fmt>=1&&d.fmt<=2){if(d.fmt==1)d.delta=l.readShort(r,o),o+=2;else if(d.fmt==2){var p=l.readUshort(r,o);o+=2,d.newg=l.readUshorts(r,o,p),o+=2*d.newg.length}}else if(s==4){d.vals=[],p=l.readUshort(r,o),o+=2;for(var m=0;m<p;m++){var v=l.readUshort(r,o);o+=2,d.vals.push(e.GSUB.readLigatureSet(r,c+v))}}else if(s==5&&d.fmt==2){if(d.fmt==2){var y=l.readUshort(r,o);o+=2,d.cDef=e._lctf.readClassDef(r,c+y),d.scset=[];var x=l.readUshort(r,o);for(o+=2,m=0;m<x;m++){var w=l.readUshort(r,o);o+=2,d.scset.push(w==0?null:e.GSUB.readSubClassSet(r,c+w))}}}else if(s==6&&d.fmt==3){if(d.fmt==3){for(m=0;m<3;m++){p=l.readUshort(r,o),o+=2;for(var _=[],S=0;S<p;S++)_.push(e._lctf.readCoverage(r,c+l.readUshort(r,o+2*S)));o+=2*p,m==0&&(d.backCvg=_),m==1&&(d.inptCvg=_),m==2&&(d.ahedCvg=_)}p=l.readUshort(r,o),o+=2,d.lookupRec=e.GSUB.readSubstLookupRecords(r,o,p)}}else{if(s==7&&d.fmt==1){var b=l.readUshort(r,o);o+=2;var T=l.readUint(r,o);if(o+=4,a.ltype==9)a.ltype=b;else if(a.ltype!=b)throw\"invalid extension substitution\";return e.GSUB.subt(r,a.ltype,c+T)}console.debug(\"unsupported GSUB table LookupType\",s,\"format\",d.fmt)}return d},e.GSUB.readSubClassSet=function(r,s){var o=e._bin.readUshort,a=s,l=[],c=o(r,s);s+=2;for(var d=0;d<c;d++){var h=o(r,s);s+=2,l.push(e.GSUB.readSubClassRule(r,a+h))}return l},e.GSUB.readSubClassRule=function(r,s){var o=e._bin.readUshort,a={},l=o(r,s),c=o(r,s+=2);s+=2,a.input=[];for(var d=0;d<l-1;d++)a.input.push(o(r,s)),s+=2;return a.substLookupRecords=e.GSUB.readSubstLookupRecords(r,s,c),a},e.GSUB.readSubstLookupRecords=function(r,s,o){for(var a=e._bin.readUshort,l=[],c=0;c<o;c++)l.push(a(r,s),a(r,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(r,s){var o=e._bin,a=s,l=[],c=o.readUshort(r,s);s+=2;for(var d=0;d<c;d++){var h=o.readUshort(r,s);s+=2,l.push(e.GSUB.readChainSubClassRule(r,a+h))}return l},e.GSUB.readChainSubClassRule=function(r,s){for(var o=e._bin,a={},l=[\"backtrack\",\"input\",\"lookahead\"],c=0;c<l.length;c++){var d=o.readUshort(r,s);s+=2,c==1&&d--,a[l[c]]=o.readUshorts(r,s,d),s+=2*a[l[c]].length}return d=o.readUshort(r,s),s+=2,a.subst=o.readUshorts(r,s,2*d),s+=2*a.subst.length,a},e.GSUB.readLigatureSet=function(r,s){var o=e._bin,a=s,l=[],c=o.readUshort(r,s);s+=2;for(var d=0;d<c;d++){var h=o.readUshort(r,s);s+=2,l.push(e.GSUB.readLigature(r,a+h))}return l},e.GSUB.readLigature=function(r,s){var o=e._bin,a={chain:[]};a.nglyph=o.readUshort(r,s),s+=2;var l=o.readUshort(r,s);s+=2;for(var c=0;c<l-1;c++)a.chain.push(o.readUshort(r,s)),s+=2;return a},e.head={},e.head.parse=function(r,s,o){var a=e._bin,l={};return a.readFixed(r,s),s+=4,l.fontRevision=a.readFixed(r,s),s+=4,a.readUint(r,s),s+=4,a.readUint(r,s),s+=4,l.flags=a.readUshort(r,s),s+=2,l.unitsPerEm=a.readUshort(r,s),s+=2,l.created=a.readUint64(r,s),s+=8,l.modified=a.readUint64(r,s),s+=8,l.xMin=a.readShort(r,s),s+=2,l.yMin=a.readShort(r,s),s+=2,l.xMax=a.readShort(r,s),s+=2,l.yMax=a.readShort(r,s),s+=2,l.macStyle=a.readUshort(r,s),s+=2,l.lowestRecPPEM=a.readUshort(r,s),s+=2,l.fontDirectionHint=a.readShort(r,s),s+=2,l.indexToLocFormat=a.readShort(r,s),s+=2,l.glyphDataFormat=a.readShort(r,s),s+=2,l},e.hhea={},e.hhea.parse=function(r,s,o){var a=e._bin,l={};return a.readFixed(r,s),s+=4,l.ascender=a.readShort(r,s),s+=2,l.descender=a.readShort(r,s),s+=2,l.lineGap=a.readShort(r,s),s+=2,l.advanceWidthMax=a.readUshort(r,s),s+=2,l.minLeftSideBearing=a.readShort(r,s),s+=2,l.minRightSideBearing=a.readShort(r,s),s+=2,l.xMaxExtent=a.readShort(r,s),s+=2,l.caretSlopeRise=a.readShort(r,s),s+=2,l.caretSlopeRun=a.readShort(r,s),s+=2,l.caretOffset=a.readShort(r,s),s+=2,s+=8,l.metricDataFormat=a.readShort(r,s),s+=2,l.numberOfHMetrics=a.readUshort(r,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(r,s,o,a){for(var l=e._bin,c={aWidth:[],lsBearing:[]},d=0,h=0,p=0;p<a.maxp.numGlyphs;p++)p<a.hhea.numberOfHMetrics&&(d=l.readUshort(r,s),s+=2,h=l.readShort(r,s),s+=2),c.aWidth.push(d),c.lsBearing.push(h);return c},e.kern={},e.kern.parse=function(r,s,o,a){var l=e._bin,c=l.readUshort(r,s);if(s+=2,c==1)return e.kern.parseV1(r,s-2,o,a);var d=l.readUshort(r,s);s+=2;for(var h={glyph1:[],rval:[]},p=0;p<d;p++){s+=2,o=l.readUshort(r,s),s+=2;var m=l.readUshort(r,s);s+=2;var v=m>>>8;if((v&=15)!=0)throw\"unknown kern table format: \"+v;s=e.kern.readFormat0(r,s,h)}return h},e.kern.parseV1=function(r,s,o,a){var l=e._bin;l.readFixed(r,s),s+=4;var c=l.readUint(r,s);s+=4;for(var d={glyph1:[],rval:[]},h=0;h<c;h++){l.readUint(r,s),s+=4;var p=l.readUshort(r,s);s+=2,l.readUshort(r,s),s+=2;var m=p>>>8;if((m&=15)!=0)throw\"unknown kern table format: \"+m;s=e.kern.readFormat0(r,s,d)}return d},e.kern.readFormat0=function(r,s,o){var a=e._bin,l=-1,c=a.readUshort(r,s);s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2,a.readUshort(r,s),s+=2;for(var d=0;d<c;d++){var h=a.readUshort(r,s);s+=2;var p=a.readUshort(r,s);s+=2;var m=a.readShort(r,s);s+=2,h!=l&&(o.glyph1.push(h),o.rval.push({glyph2:[],vals:[]}));var v=o.rval[o.rval.length-1];v.glyph2.push(p),v.vals.push(m),l=h}return s},e.loca={},e.loca.parse=function(r,s,o,a){var l=e._bin,c=[],d=a.head.indexToLocFormat,h=a.maxp.numGlyphs+1;if(d==0)for(var p=0;p<h;p++)c.push(l.readUshort(r,s+(p<<1))<<1);if(d==1)for(p=0;p<h;p++)c.push(l.readUint(r,s+(p<<2)));return c},e.maxp={},e.maxp.parse=function(r,s,o){var a=e._bin,l={},c=a.readUint(r,s);return s+=4,l.numGlyphs=a.readUshort(r,s),s+=2,c==65536&&(l.maxPoints=a.readUshort(r,s),s+=2,l.maxContours=a.readUshort(r,s),s+=2,l.maxCompositePoints=a.readUshort(r,s),s+=2,l.maxCompositeContours=a.readUshort(r,s),s+=2,l.maxZones=a.readUshort(r,s),s+=2,l.maxTwilightPoints=a.readUshort(r,s),s+=2,l.maxStorage=a.readUshort(r,s),s+=2,l.maxFunctionDefs=a.readUshort(r,s),s+=2,l.maxInstructionDefs=a.readUshort(r,s),s+=2,l.maxStackElements=a.readUshort(r,s),s+=2,l.maxSizeOfInstructions=a.readUshort(r,s),s+=2,l.maxComponentElements=a.readUshort(r,s),s+=2,l.maxComponentDepth=a.readUshort(r,s),s+=2),l},e.name={},e.name.parse=function(r,s,o){var a=e._bin,l={};a.readUshort(r,s),s+=2;var c=a.readUshort(r,s);s+=2,a.readUshort(r,s);for(var d,h=[\"copyright\",\"fontFamily\",\"fontSubfamily\",\"ID\",\"fullName\",\"version\",\"postScriptName\",\"trademark\",\"manufacturer\",\"designer\",\"description\",\"urlVendor\",\"urlDesigner\",\"licence\",\"licenceURL\",\"---\",\"typoFamilyName\",\"typoSubfamilyName\",\"compatibleFull\",\"sampleText\",\"postScriptCID\",\"wwsFamilyName\",\"wwsSubfamilyName\",\"lightPalette\",\"darkPalette\"],p=s+=2,m=0;m<c;m++){var v=a.readUshort(r,s);s+=2;var y=a.readUshort(r,s);s+=2;var x=a.readUshort(r,s);s+=2;var w=a.readUshort(r,s);s+=2;var _=a.readUshort(r,s);s+=2;var S=a.readUshort(r,s);s+=2;var b,T=h[w],A=p+12*c+S;if(v==0)b=a.readUnicode(r,A,_/2);else if(v==3&&y==0)b=a.readUnicode(r,A,_/2);else if(y==0)b=a.readASCII(r,A,_);else if(y==1)b=a.readUnicode(r,A,_/2);else if(y==3)b=a.readUnicode(r,A,_/2);else{if(v!=1)throw\"unknown encoding \"+y+\", platformID: \"+v;b=a.readASCII(r,A,_),console.debug(\"reading unknown MAC encoding \"+y+\" as ASCII\")}var L=\"p\"+v+\",\"+x.toString(16);l[L]==null&&(l[L]={}),l[L][T!==void 0?T:w]=b,l[L]._lang=x}for(var C in l)if(l[C].postScriptName!=null&&l[C]._lang==1033)return l[C];for(var C in l)if(l[C].postScriptName!=null&&l[C]._lang==0)return l[C];for(var C in l)if(l[C].postScriptName!=null&&l[C]._lang==3084)return l[C];for(var C in l)if(l[C].postScriptName!=null)return l[C];for(var C in l){d=C;break}return console.debug(\"returning name table with languageID \"+l[d]._lang),l[d]},e[\"OS/2\"]={},e[\"OS/2\"].parse=function(r,s,o){var a=e._bin.readUshort(r,s);s+=2;var l={};if(a==0)e[\"OS/2\"].version0(r,s,l);else if(a==1)e[\"OS/2\"].version1(r,s,l);else if(a==2||a==3||a==4)e[\"OS/2\"].version2(r,s,l);else{if(a!=5)throw\"unknown OS/2 table version: \"+a;e[\"OS/2\"].version5(r,s,l)}return l},e[\"OS/2\"].version0=function(r,s,o){var a=e._bin;return o.xAvgCharWidth=a.readShort(r,s),s+=2,o.usWeightClass=a.readUshort(r,s),s+=2,o.usWidthClass=a.readUshort(r,s),s+=2,o.fsType=a.readUshort(r,s),s+=2,o.ySubscriptXSize=a.readShort(r,s),s+=2,o.ySubscriptYSize=a.readShort(r,s),s+=2,o.ySubscriptXOffset=a.readShort(r,s),s+=2,o.ySubscriptYOffset=a.readShort(r,s),s+=2,o.ySuperscriptXSize=a.readShort(r,s),s+=2,o.ySuperscriptYSize=a.readShort(r,s),s+=2,o.ySuperscriptXOffset=a.readShort(r,s),s+=2,o.ySuperscriptYOffset=a.readShort(r,s),s+=2,o.yStrikeoutSize=a.readShort(r,s),s+=2,o.yStrikeoutPosition=a.readShort(r,s),s+=2,o.sFamilyClass=a.readShort(r,s),s+=2,o.panose=a.readBytes(r,s,10),s+=10,o.ulUnicodeRange1=a.readUint(r,s),s+=4,o.ulUnicodeRange2=a.readUint(r,s),s+=4,o.ulUnicodeRange3=a.readUint(r,s),s+=4,o.ulUnicodeRange4=a.readUint(r,s),s+=4,o.achVendID=[a.readInt8(r,s),a.readInt8(r,s+1),a.readInt8(r,s+2),a.readInt8(r,s+3)],s+=4,o.fsSelection=a.readUshort(r,s),s+=2,o.usFirstCharIndex=a.readUshort(r,s),s+=2,o.usLastCharIndex=a.readUshort(r,s),s+=2,o.sTypoAscender=a.readShort(r,s),s+=2,o.sTypoDescender=a.readShort(r,s),s+=2,o.sTypoLineGap=a.readShort(r,s),s+=2,o.usWinAscent=a.readUshort(r,s),s+=2,o.usWinDescent=a.readUshort(r,s),s+=2},e[\"OS/2\"].version1=function(r,s,o){var a=e._bin;return s=e[\"OS/2\"].version0(r,s,o),o.ulCodePageRange1=a.readUint(r,s),s+=4,o.ulCodePageRange2=a.readUint(r,s),s+=4},e[\"OS/2\"].version2=function(r,s,o){var a=e._bin;return s=e[\"OS/2\"].version1(r,s,o),o.sxHeight=a.readShort(r,s),s+=2,o.sCapHeight=a.readShort(r,s),s+=2,o.usDefault=a.readUshort(r,s),s+=2,o.usBreak=a.readUshort(r,s),s+=2,o.usMaxContext=a.readUshort(r,s),s+=2},e[\"OS/2\"].version5=function(r,s,o){var a=e._bin;return s=e[\"OS/2\"].version2(r,s,o),o.usLowerOpticalPointSize=a.readUshort(r,s),s+=2,o.usUpperOpticalPointSize=a.readUshort(r,s),s+=2},e.post={},e.post.parse=function(r,s,o){var a=e._bin,l={};return l.version=a.readFixed(r,s),s+=4,l.italicAngle=a.readFixed(r,s),s+=4,l.underlinePosition=a.readShort(r,s),s+=2,l.underlineThickness=a.readShort(r,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(r,s){var o=r.cmap,a=-1;if(o.p0e4!=null?a=o.p0e4:o.p3e1!=null?a=o.p3e1:o.p1e0!=null?a=o.p1e0:o.p0e3!=null&&(a=o.p0e3),a==-1)throw\"no familiar platform and encoding!\";var l=o.tables[a];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,d=0;d<l.endCount.length;d++)if(s<=l.endCount[d]){c=d;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(d=0;d<l.groups.length;d++){var h=l.groups[d];if(h[0]<=s&&s<=h[1])return h[2]+(s-h[0])}return 0}throw\"unknown cmap table format \"+l.format},e.U.glyphToPath=function(r,s){var o={cmds:[],crds:[]};if(r.SVG&&r.SVG.entries[s]){var a=r.SVG.entries[s];return a==null?o:(typeof a==\"string\"&&(a=e.SVG.toPath(a),r.SVG.entries[s]=a),a)}if(r.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:r.CFF.Private?r.CFF.Private.defaultWidthX:0,open:!1},c=r.CFF,d=r.CFF.Private;if(c.ROS){for(var h=0;c.FDSelect[h+2]<=s;)h+=2;d=c.FDArray[c.FDSelect[h+1]].Private}e.U._drawCFF(r.CFF.CharStrings[s],l,c,d,o)}else r.glyf&&e.U._drawGlyf(s,r,o);return o},e.U._drawGlyf=function(r,s,o){var a=s.glyf[r];a==null&&(a=s.glyf[r]=e.glyf._parseGlyf(s,r)),a!=null&&(a.noc>-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(r,s){for(var o=0;o<r.noc;o++){for(var a=o==0?0:r.endPts[o-1]+1,l=r.endPts[o],c=a;c<=l;c++){var d=c==a?l:c-1,h=c==l?a:c+1,p=1&r.flags[c],m=1&r.flags[d],v=1&r.flags[h],y=r.xs[c],x=r.ys[c];if(c==a)if(p){if(!m){e.U.P.moveTo(s,y,x);continue}e.U.P.moveTo(s,r.xs[d],r.ys[d])}else m?e.U.P.moveTo(s,r.xs[d],r.ys[d]):e.U.P.moveTo(s,(r.xs[d]+y)/2,(r.ys[d]+x)/2);p?m&&e.U.P.lineTo(s,y,x):v?e.U.P.qcurveTo(s,y,x,r.xs[h],r.ys[h]):e.U.P.qcurveTo(s,y,x,(y+r.xs[h])/2,(x+r.ys[h])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(r,s,o){for(var a=0;a<r.parts.length;a++){var l={cmds:[],crds:[]},c=r.parts[a];e.U._drawGlyf(c.glyphIndex,s,l);for(var d=c.m,h=0;h<l.crds.length;h+=2){var p=l.crds[h],m=l.crds[h+1];o.crds.push(p*d.a+m*d.b+d.tx),o.crds.push(p*d.c+m*d.d+d.ty)}for(h=0;h<l.cmds.length;h++)o.cmds.push(l.cmds[h])}},e.U._getGlyphClass=function(r,s){var o=e._lctf.getInterval(s,r);return o==-1?0:s[o+2]},e.U.getPairAdjustment=function(r,s,o){var a=!1;if(r.GPOS)for(var l=r.GPOS,c=l.lookupList,d=l.featureList,h=[],p=0;p<d.length;p++){var m=d[p];if(m.tag==\"kern\"){a=!0;for(var v=0;v<m.tab.length;v++)if(!h[m.tab[v]]){h[m.tab[v]]=!0;for(var y=c[m.tab[v]],x=0;x<y.tabs.length;x++)if(y.tabs[x]!=null){var w,_=y.tabs[x];if((!_.coverage||(w=e._lctf.coverageIndex(_.coverage,s))!=-1)&&y.ltype!=1){if(y.ltype==2){var S=null;if(_.fmt==1){var b=_.pairsets[w];for(p=0;p<b.length;p++)b[p].gid2==o&&(S=b[p])}else if(_.fmt==2){var T=e.U._getGlyphClass(s,_.classDef1),A=e.U._getGlyphClass(o,_.classDef2);S=_.matrix[T][A]}if(S){var L=0;return S.val1&&S.val1[2]&&(L+=S.val1[2]),S.val2&&S.val2[0]&&(L+=S.val2[0]),L}}}}}}}if(r.kern&&!a){var C=r.kern.glyph1.indexOf(s);if(C!=-1){var R=r.kern.rval[C].glyph2.indexOf(o);if(R!=-1)return r.kern.rval[C].vals[R]}}return 0},e.U._applySubs=function(r,s,o,a){for(var l=r.length-s-1,c=0;c<o.tabs.length;c++)if(o.tabs[c]!=null){var d,h=o.tabs[c];if(!h.coverage||(d=e._lctf.coverageIndex(h.coverage,r[s]))!=-1){if(o.ltype==1)r[s],h.fmt==1?r[s]=r[s]+h.delta:r[s]=h.newg[d];else if(o.ltype==4)for(var p=h.vals[d],m=0;m<p.length;m++){var v=p[m],y=v.chain.length;if(!(y>l)){for(var x=!0,w=0,_=0;_<y;_++){for(;r[s+w+(1+_)]==-1;)w++;v.chain[_]!=r[s+w+(1+_)]&&(x=!1)}if(x){for(r[s]=v.nglyph,_=0;_<y+w;_++)r[s+_+1]=-1;break}}}else if(o.ltype==5&&h.fmt==2)for(var S=e._lctf.getInterval(h.cDef,r[s]),b=h.cDef[S+2],T=h.scset[b],A=0;A<T.length;A++){var L=T[A],C=L.input;if(!(C.length>l)){for(x=!0,_=0;_<C.length;_++){var R=e._lctf.getInterval(h.cDef,r[s+1+_]);if(S==-1&&h.cDef[R+2]!=C[_]){x=!1;break}}if(x){var k=L.substLookupRecords;for(m=0;m<k.length;m+=2)k[m],k[m+1]}}}else if(o.ltype==6&&h.fmt==3){if(!e.U._glsCovered(r,h.backCvg,s-h.backCvg.length)||!e.U._glsCovered(r,h.inptCvg,s)||!e.U._glsCovered(r,h.ahedCvg,s+h.inptCvg.length))continue;var H=h.lookupRec;for(A=0;A<H.length;A+=2){S=H[A];var V=a[H[A+1]];e.U._applySubs(r,s+S,V,a)}}}}},e.U._glsCovered=function(r,s,o){for(var a=0;a<s.length;a++)if(e._lctf.coverageIndex(s[a],r[o+a])==-1)return!1;return!0},e.U.glyphsToPath=function(r,s,o){for(var a={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var d=s[c];if(d!=-1){for(var h=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,p=e.U.glyphToPath(r,d),m=0;m<p.crds.length;m+=2)a.crds.push(p.crds[m]+l),a.crds.push(p.crds[m+1]);for(o&&a.cmds.push(o),m=0;m<p.cmds.length;m++)a.cmds.push(p.cmds[m]);o&&a.cmds.push(\"X\"),l+=r.hmtx.aWidth[d],c<s.length-1&&(l+=e.U.getPairAdjustment(r,d,h))}}return a},e.U.P={},e.U.P.moveTo=function(r,s,o){r.cmds.push(\"M\"),r.crds.push(s,o)},e.U.P.lineTo=function(r,s,o){r.cmds.push(\"L\"),r.crds.push(s,o)},e.U.P.curveTo=function(r,s,o,a,l,c,d){r.cmds.push(\"C\"),r.crds.push(s,o,a,l,c,d)},e.U.P.qcurveTo=function(r,s,o,a,l){r.cmds.push(\"Q\"),r.crds.push(s,o,a,l)},e.U.P.closePath=function(r){r.cmds.push(\"Z\")},e.U._drawCFF=function(r,s,o,a,l){for(var c=s.stack,d=s.nStems,h=s.haveWidth,p=s.width,m=s.open,v=0,y=s.x,x=s.y,w=0,_=0,S=0,b=0,T=0,A=0,L=0,C=0,R=0,k=0,H={val:0,size:0};v<r.length;){e.CFF.getCharString(r,v,H);var V=H.val;if(v+=H.size,V==\"o1\"||V==\"o18\")c.length%2!=0&&!h&&(p=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(V==\"o3\"||V==\"o23\")c.length%2!=0&&!h&&(p=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(V==\"o4\")c.length>1&&!h&&(p=c.shift()+a.nominalWidthX,h=!0),m&&e.U.P.closePath(l),x+=c.pop(),e.U.P.moveTo(l,y,x),m=!0;else if(V==\"o5\")for(;c.length>0;)y+=c.shift(),x+=c.shift(),e.U.P.lineTo(l,y,x);else if(V==\"o6\"||V==\"o7\")for(var W=c.length,F=V==\"o6\",J=0;J<W;J++){var K=c.shift();F?y+=K:x+=K,F=!F,e.U.P.lineTo(l,y,x)}else if(V==\"o8\"||V==\"o24\"){W=c.length;for(var ue=0;ue+6<=W;)w=y+c.shift(),_=x+c.shift(),S=w+c.shift(),b=_+c.shift(),y=S+c.shift(),x=b+c.shift(),e.U.P.curveTo(l,w,_,S,b,y,x),ue+=6;V==\"o24\"&&(y+=c.shift(),x+=c.shift(),e.U.P.lineTo(l,y,x))}else{if(V==\"o11\")break;if(V==\"o1234\"||V==\"o1235\"||V==\"o1236\"||V==\"o1237\")V==\"o1234\"&&(_=x,S=(w=y+c.shift())+c.shift(),k=b=_+c.shift(),A=b,C=x,y=(L=(T=(R=S+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,w,_,S,b,R,k),e.U.P.curveTo(l,T,A,L,C,y,x)),V==\"o1235\"&&(w=y+c.shift(),_=x+c.shift(),S=w+c.shift(),b=_+c.shift(),R=S+c.shift(),k=b+c.shift(),T=R+c.shift(),A=k+c.shift(),L=T+c.shift(),C=A+c.shift(),y=L+c.shift(),x=C+c.shift(),c.shift(),e.U.P.curveTo(l,w,_,S,b,R,k),e.U.P.curveTo(l,T,A,L,C,y,x)),V==\"o1236\"&&(w=y+c.shift(),_=x+c.shift(),S=w+c.shift(),k=b=_+c.shift(),A=b,L=(T=(R=S+c.shift())+c.shift())+c.shift(),C=A+c.shift(),y=L+c.shift(),e.U.P.curveTo(l,w,_,S,b,R,k),e.U.P.curveTo(l,T,A,L,C,y,x)),V==\"o1237\"&&(w=y+c.shift(),_=x+c.shift(),S=w+c.shift(),b=_+c.shift(),R=S+c.shift(),k=b+c.shift(),T=R+c.shift(),A=k+c.shift(),L=T+c.shift(),C=A+c.shift(),Math.abs(L-y)>Math.abs(C-x)?y=L+c.shift():x=C+c.shift(),e.U.P.curveTo(l,w,_,S,b,R,k),e.U.P.curveTo(l,T,A,L,C,y,x));else if(V==\"o14\"){if(c.length>0&&!h&&(p=c.shift()+o.nominalWidthX,h=!0),c.length==4){var O=c.shift(),U=c.shift(),X=c.shift(),D=c.shift(),G=e.CFF.glyphBySE(o,X),$=e.CFF.glyphBySE(o,D);e.U._drawCFF(o.CharStrings[G],s,o,a,l),s.x=O,s.y=U,e.U._drawCFF(o.CharStrings[$],s,o,a,l)}m&&(e.U.P.closePath(l),m=!1)}else if(V==\"o19\"||V==\"o20\")c.length%2!=0&&!h&&(p=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,h=!0,v+=d+7>>3;else if(V==\"o21\")c.length>2&&!h&&(p=c.shift()+a.nominalWidthX,h=!0),x+=c.pop(),y+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,y,x),m=!0;else if(V==\"o22\")c.length>1&&!h&&(p=c.shift()+a.nominalWidthX,h=!0),y+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,y,x),m=!0;else if(V==\"o25\"){for(;c.length>6;)y+=c.shift(),x+=c.shift(),e.U.P.lineTo(l,y,x);w=y+c.shift(),_=x+c.shift(),S=w+c.shift(),b=_+c.shift(),y=S+c.shift(),x=b+c.shift(),e.U.P.curveTo(l,w,_,S,b,y,x)}else if(V==\"o26\")for(c.length%2&&(y+=c.shift());c.length>0;)w=y,_=x+c.shift(),y=S=w+c.shift(),x=(b=_+c.shift())+c.shift(),e.U.P.curveTo(l,w,_,S,b,y,x);else if(V==\"o27\")for(c.length%2&&(x+=c.shift());c.length>0;)_=x,S=(w=y+c.shift())+c.shift(),b=_+c.shift(),y=S+c.shift(),x=b,e.U.P.curveTo(l,w,_,S,b,y,x);else if(V==\"o10\"||V==\"o29\"){var ne=V==\"o10\"?a:o;if(c.length==0)console.debug(\"error: empty stack\");else{var ie=c.pop(),q=ne.Subrs[ie+ne.Bias];s.x=y,s.y=x,s.nStems=d,s.haveWidth=h,s.width=p,s.open=m,e.U._drawCFF(q,s,o,a,l),y=s.x,x=s.y,d=s.nStems,h=s.haveWidth,p=s.width,m=s.open}}else if(V==\"o30\"||V==\"o31\"){var fe=c.length,de=(ue=0,V==\"o31\");for(ue+=fe-(W=-3&fe);ue<W;)de?(_=x,S=(w=y+c.shift())+c.shift(),x=(b=_+c.shift())+c.shift(),W-ue==5?(y=S+c.shift(),ue++):y=S,de=!1):(w=y,_=x+c.shift(),S=w+c.shift(),b=_+c.shift(),y=S+c.shift(),W-ue==5?(x=b+c.shift(),ue++):x=b,de=!0),e.U.P.curveTo(l,w,_,S,b,y,x),ue+=4}else{if((V+\"\").charAt(0)==\"o\")throw console.debug(\"Unknown operation: \"+V,r),V;c.push(V)}}}s.x=y,s.y=x,s.nStems=d,s.haveWidth=h,s.width=p,s.open=m};var t=e,i={Typr:t};return n.Typr=t,n.default=i,Object.defineProperty(n,\"__esModule\",{value:!0}),n}({}).Typr}", "function setup() {}", "function MASH_FileManager() {\n\n\n}", "function updateroster() {\n\n}", "function setup() {\r\n}", "function vB_PHP_Emulator()\n{\n}", "function C101_KinbakuClub_RopeGroup_ReleaseTwin() {\n}", "function Macex() {\r\n}", "function Main()\n {\n \n }", "function GBBanner_hardware()\n{\ndocument.write('<table width=\"610\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">');\ndocument.write('<tr>');\ndocument.write('<td width=\"478\" height=\"70\" background=\"http://image.gamebase.com.tw/images2005/idx_468.gif\" align=\"center\" valign=\"middle\">');\ndocument.write('<div id=\"zone144\" name=\"zone144\"></div>');\ndocument.write('</td>');\ndocument.write('<td width=\"12\">&nbsp;</td>');\ndocument.write('<td width=\"120\" height=\"60\" bgcolor=\"#000000\" align=\"center\">');\ndocument.write('<div id=\"zone302\" name=\"zone302\"></div>');\ndocument.write('</td>');\ndocument.write('</tr>');\ndocument.write('</table>');\ndocument.write('<br>');\ndocument.write('<table width=\"610\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">');\ndocument.write('<tr>');\ndocument.write('<td width=\"300\" height=\"40\" valign=\"middle\">');\nsearch2006();\ndocument.write('</td>');\ndocument.write('<td>');\ndocument.write('<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">');\ndocument.write('<tr><td width=\"33%\" align=\"center\"><font size=\"2\">');\ndocument.write('<div id=\"zone303\" name=\"zone303\"></div>');\ndocument.write('</font></td>');\ndocument.write('<td width=\"33%\" align=\"center\"><font size=\"2\">');\ndocument.write('<div id=\"zone304\" name=\"zone304\"></div>');\ndocument.write('</font></td>');\ndocument.write('<td width=\"33%\" align=\"center\"><font size=\"2\">');\ndocument.write('<div id=\"zone305\" name=\"zone305\"></div>');\ndocument.write('</font></td>');\ndocument.write('</tr>');\ndocument.write('</table>');\n\ndocument.write('</td>');\ndocument.write('</tr>');\ndocument.write('</table>');\t\t\n}", "function bakePinKeyframes(){ //start script\n app.beginUndoGroup(\"Bake Pin Keyframes\");\n\n //if(parseFloat(app.version) >= 10.5){\n var theComp = app.project.activeItem; //only selected\n\n // check if comp is selected\n if (theComp == null || !(theComp instanceof CompItem)){\n // if no comp selected, display an alert\n alert(\"Please establish a comp as the active item and run the script again.\");\n } else { \n var theLayers = theComp.selectedLayers;\n if(theLayers.length==0){\n alert(\"Please select some layers and run the script again.\");\n }else{\n // otherwise, loop through each selected layer in the selected comp\n for (var i = 0; i < theLayers.length; i++){\n // define the layer in the loop we're currently looking at\n var curLayer = theLayers[i];\n // Select layer to add expression to\n if (curLayer.matchName == \"ADBE AV Layer\"){\n if(curLayer.effect.puppet != null){\n var wherePins = curLayer.property(\"Effects\").property(\"Puppet\").property(\"arap\").property(\"Mesh\").property(\"Mesh 1\").property(\"Deform\");\n var pinCount = wherePins.numProperties;\n for (var n = 1; n <= pinCount; n++){\n // Get position of puppet pin\n var pin = curLayer.effect(\"Puppet\").arap.mesh(\"Mesh 1\").deform(n).position;\n try{\n convertToKeyframes(pin);\n }catch(e){}\n } \n }\n //else{\n var curProperty;\n try{\n curProperty = curLayer.property(\"position\");\n convertToKeyframes(curProperty);\n }catch(e){}\n try{\n curProperty = curLayer.property(\"anchorPoint\");\n convertToKeyframes(curProperty);\n }catch(e){}\n try{\n curProperty = curLayer.property(\"rotation\");\n convertToKeyframes(curProperty);\n }catch(e){}\n try{\n curProperty = curLayer.property(\"scale\");\n convertToKeyframes(curProperty);\n }catch(e){}\n try{\n curProperty = curLayer.property(\"opacity\");\n convertToKeyframes(curProperty);\n }catch(e){}\n //}\n }else{\n alert(\"This currently only works on footage layers.\")\n }\n }\n }\n }\n\n /*\n } else {\n alert(\"Sorry, this feature only works with CS5.5 and higher.\");\n }\n */\n \n app.endUndoGroup();\n} //end script", "function test_host_tagged_crosshair_op_vsphere65() {}", "function smutEngine() {\r\n\tsmut=\"#@&*%!#@&*%!#@&*%!\";\r\n\tcmp=\"sex shit fuck piss dick porno cum cunt prick arse feck \"\r\n\t+\"asshole pedophile man-boy man/boy dong twat \";\r\n\ttxt=document.isn.dirt.value;\r\n\ttstx=\"\";\r\n\tfor (var i=0;i<16;i++){\r\n\t\tpos=cmp.indexOf(\" \");\r\n\t\twrd=cmp.substring(0,pos);\r\n\t\twrdl=wrd.length\r\n\t\tcmp=cmp.substring(pos+1,cmp.length);\r\n\t\twhile (txt.indexOf(wrd)>-1){\r\n\t\t\tpos=txt.indexOf(wrd);\r\n\t\t\ttxt=txt.substring(0,pos)+smut.substring(0,wrdl)\r\n\t\t\t+txt.substring((pos+wrdl),txt.length);\r\n\t\t}\r\n\t}\r\n\tdocument.isn.dirt.value=txt;\r\n}", "function CMDDV1() {}", "function Xuice() {\r\n}", "function checkgenus(){\r\n\r\n}", "function StupidBug() {}", "function main(){\n\t\n}", "static transient final protected public internal function m46() {}", "function sprinkles() {\n\n\t}", "function Ze(){if(ea)t.innerHTML=ha;else if(ia)t.innerHTML=ia;$e();eb&&hb.call(window,eb);nb();eb=-1;bb=[];cb={};ac=j;Zb=0;$b=[];w.Cc();Bb=0;Cb=[];document.documentElement.className=\"js no-treesaver\";document.documentElement.style.display=\"block\"}", "function setup() {\n\n\t\t\t\t\t}", "function c0_from_Crafty_standard(c0_move,c0_color47)\r\n{\r\nc0_move=c0_ReplaceAll( c0_move, \"ep\", \"\" );\r\n\r\nvar c0_becomes7=\"\";\r\nvar c0_ret7=c0_fischer_cst_fCr(c0_move);\r\nif(c0_ret7.length>0) return c0_ret7;\r\nelse if(c0_move.substr(0,5)==\"O-O-O\" || c0_move.substr(0,5)==\"0-0-0\")\r\n\t{\r\n\tif(c0_color47==\"w\")\r\n\t\t{ \r\n\t\t if(c0_position.indexOf(\"wKc1\")<0 && c0_can_be_moved( \"15\",\"13\",false) ) c0_ret7=\"e1c1[0]\";\r\n\t \t}\r\n\telse\r\n\t\t{\r\n\t\t if(c0_position.indexOf(\"bKc8\")<0 && c0_can_be_moved( \"85\",\"83\",false) ) c0_ret7=\"e8c8[0]\";\r\n\t \t}\r\n\t}\r\nelse if(c0_move.substr(0,3)==\"O-O\" || c0_move.substr(0,3)==\"0-0\")\r\n\t{\r\n\tif(c0_color47==\"w\")\r\n\t\t{ \r\n\t\t if(c0_position.indexOf(\"wKg1\")<0 && c0_can_be_moved( \"15\",\"17\",false) ) c0_ret7=\"e1g1[0]\";\r\n\t\t}\r\n\telse\r\n\t\t{\r\n\t\t if(c0_position.indexOf(\"bKg8\")<0 && c0_can_be_moved( \"85\",\"87\",false) ) c0_ret7=\"e8g8[0]\";\r\n\t\t}\r\n\t}\r\nelse if( (\"{ab}{ba}{bc}{cb}{cd}{dc}{de}{ed}{ef}{fe}{fg}{gf}{gh}{hg}\").indexOf(c0_move.substr(0,2))>=0 )\r\n {\r\n var c0_Z81horiz=c0_move.charCodeAt(0) - 96;\r\n var c0_Z82horiz=c0_move.charCodeAt(1) - 96;\r\n\r\n for(var c0_i8=0;c0_position.length>c0_i8; c0_i8+=5)\r\n\t{\r\n\tvar c0_Z8color=c0_position.substr(c0_i8,1);\r\n\tvar c0_Z8figure=c0_position.substr(c0_i8+1,1);\r\n\tvar c0_Z8horiz=(c0_position.substr(c0_i8+2,1)).charCodeAt(0) - 96;\r\n\tvar c0_Z8vert=parseInt(c0_position.substr(c0_i8+3,1));\r\n\tvar c0_Z82vert=c0_Z8vert+(c0_color47==\"w\" ? 1 : -1 );\r\n\tvar c0_Z8from_at72 = c0_Z8vert.toString() + c0_Z8horiz.toString();\r\n\tvar c0_Z8to_at72 = c0_Z82vert.toString() + c0_Z82horiz.toString();\r\n\r\n\tif(c0_Z8color==c0_color47 && c0_Z8figure==\"p\" && c0_Z81horiz==c0_Z8horiz )\r\n\t\t{\r\n\t\tif( c0_can_be_moved( c0_Z8from_at72, c0_Z8to_at72,false) )\r\n\t\t\t{\r\n\t\t\tc0_ret7=c0_convE777(c0_Z8from_at72)+c0_convE777(c0_Z8to_at72);\r\n\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n c0_becomes7=promoIf(c0_move);\r\n c0_ret7+=c0_becomes7;\r\n }\r\nelse\r\n {\r\n var c0_cp7=c0_move.length;\r\n\r\n var c0_figure7=c0_move.substr(0,1);\r\n if(c0_figure7==\"N\" || c0_figure7==\"B\" || c0_figure7==\"R\" || c0_figure7==\"Q\" || c0_figure7==\"K\") c0_move = c0_move.substr(1);\r\n else c0_figure7=\"p\";\r\n\r\n c0_becomes7=promoIf(c0_move);\r\n if(c0_becomes7.length>0)\r\n\t{\r\n\tvar c0_sh7=c0_move.indexOf(\"=\");\r\n\tif(c0_sh7<0) c0_sh7=c0_move.lastIndexOf( c0_becomes7.substr(1,1).toLowerCase() );\r\n if(c0_sh7>0) c0_move = c0_move.substr(0, c0_sh7);\r\n\t}\r\n c0_move=c0_ReplaceAll( c0_move, \"+\", \"\" );\r\n c0_move=c0_ReplaceAll( c0_move, \"-\", \"\" );\r\n c0_move=c0_ReplaceAll( c0_move, \"x\", \"\" );\r\n c0_move=c0_ReplaceAll( c0_move, \"X\", \"\" );\r\n c0_move=c0_ReplaceAll( c0_move, \"#\", \"\" );\r\n c0_move=c0_ReplaceAll( c0_move, \"!\", \"\" );\r\n c0_move=c0_ReplaceAll( c0_move, \"?\", \"\" );\r\n\r\n var c0_cp7=c0_move.length;\r\n c0_cp7--;\t\r\n var c0_to_at7 = c0_move.substr(c0_cp7-1,2);\r\n var c0_vert72=parseInt(c0_move.substr(c0_cp7--,1));\r\n var c0_horiz72=(c0_move.substr(c0_cp7--,1)).charCodeAt(0) - 96;\r\n var c0_to_at72 = c0_vert72.toString() + c0_horiz72.toString();\r\n\r\n if(c0_cp7>=0)\r\n {\r\n var c0_vert71=parseInt(c0_move.substr(c0_cp7,1));\r\n if(isNaN(c0_vert71) || c0_vert71<1 || c0_vert71>8) c0_vert71=0; else c0_cp7--;\r\n }\r\n else c0_vert71=0;\r\n\r\n if(c0_cp7>=0)\r\n {\r\n var c0_horiz71=(c0_move.substr(c0_cp7--,1)).charCodeAt(0) - 96;\r\n if(c0_horiz71<1 || c0_horiz71>8) c0_horiz71=0;\r\n }\r\n else c0_horiz71=0;\r\n\r\n for(var c0_i4=0;c0_position.length>c0_i4; c0_i4+=5)\r\n\t{\r\n\tvar c0_Z4color=c0_position.substr(c0_i4,1);\r\n\tvar c0_Z4figure=c0_position.substr(c0_i4+1,1);\r\n\tvar c0_Z4horiz=(c0_position.substr(c0_i4+2,1)).charCodeAt(0) - 96;\r\n\tvar c0_Z4vert=parseInt(c0_position.substr(c0_i4+3,1));\r\n\tvar c0_Z4from_at72 = c0_Z4vert.toString() + c0_Z4horiz.toString();\r\n\tvar c0_Z4from_at7 = c0_position.substr(c0_i4+2,2);\r\n\r\n\t\r\n\tif(c0_Z4color==c0_color47 && c0_figure7==c0_Z4figure)\r\n\t\t{\r\n\t\t if((c0_vert71==0 || c0_vert71==c0_Z4vert) &&\r\n\t\t\t(c0_horiz71==0 || c0_horiz71==c0_Z4horiz) )\r\n\t\t\t\t{\r\n\t\t\t\tif( c0_can_be_moved( c0_Z4from_at72,c0_to_at72,false))\r\n\t\t\t\t\t{\r\n\t\t\t\t\tc0_ret7=c0_Z4from_at7+c0_to_at7+c0_becomes7;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t}\r\n\t}\r\n }\r\nreturn c0_ret7;\r\n}", "function wa(){}", "function setup() { \n\n}", "function fewLittleThings(){\r\n\t\r\n\t//document.getElementById('col-dx').childNodes[2].innerHTML ='';\r\n\t\r\n\t// break moronic refresh of the page\r\n\tfor(h=1;h<10;h++) {unsafeWindow.clearTimeout(h);}\r\n\tdocument.body.appendChild(document.createElement('script')).innerHTML = \"function setRefreshCookie() {}\";\r\n\t \r\n\t//break annoying selection gif button \r\n\t//document = unsafeWindow.document;\r\n\t//document.onmouseup = null;\r\n\tdocument.body.appendChild(document.createElement('script')).innerHTML = \"function mostraPulsante() {}\";\r\n\t\r\n\t\r\n\t}", "function fechaserver() {\n}", "function lalalala() {\n\n}", "function AeUtil() {}", "function charJawSide(){ //start script\n app.beginUndoGroup(\"Create Character Jaw Rig Side\");\n\n //if(parseFloat(app.version) >= 10.5){\n var theComp = app.project.activeItem; //only selected\n\n // check if comp is selected\n if (theComp == null || !(theComp instanceof CompItem)){\n // if no comp selected, display an alert\n alert(\"Please establish a comp as the active item and run the script again.\");\n } else {\n var theLayers = theComp.selectedLayers;\n if(theLayers.length==0){\n alert(\"Please select a precomp and run the script again.\");\n }else{\n // otherwise, loop through each selected layer in the selected comp\n for (var i = 0; i < theLayers.length; i++){\n // define the layer in the loop we're currently looking at\n var curLayer = theLayers[i];\n // Select layer to add expression to\n if (curLayer.matchName == \"ADBE AV Layer\"){\n //first check if this is a footage layer\n //next check if this is a comp.\n var myLayer = theComp.selectedLayers[0];\n if(myLayer.source.numLayers==null){\n //not a comp; send alert.\n alert(\"This only works on precomp layers.\");\n }else{\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n //myLayer is indeed a precomp. OK to do stuff.\n var slider = myLayer.property(\"Effects\").addProperty(\"Slider Control\");\n slider.name = \"jaw side control\"\n var headNull = myLayer.source.layers.addNull();\n var upperJawNull = myLayer.source.layers.addNull();\n var lowerJawNull = myLayer.source.layers.addNull();\n headNull.name = \"head placeholder\";\n upperJawNull.name = \"upper jaw placeholder\";\n lowerJawNull.name = \"lower jaw placeholder\";\n //when asset replaces null, anchor point will be centered.\n headNull.transform.anchorPoint.setValue([50,50]);\n upperJawNull.transform.anchorPoint.setValue([50,50]);\n lowerJawNull.transform.anchorPoint.setValue([50,50]);\n headNull.property(\"Opacity\").setValue(100);\n upperJawNull.property(\"Opacity\").setValue(100);\n lowerJawNull.property(\"Opacity\").setValue(100);\n //parenting jaws to head\n upperJawNull.parent = headNull;\n lowerJawNull.parent = headNull;\n //expressions\n //headNullExprPos;\n //headNullExprRot;\n headNullExprScale = \"var x = transform.scale[0];\" + \"\\r\" +\n \"var y = transform.scale[1];\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"[x,y+(s/-4)];\";\n //headNull.property(\"Position\").expression = headNullExprPos;\n //headNull.property(\"Rotation\").expression = headNullExprRot;\n headNull.property(\"Scale\").expression = headNullExprScale;\n //--\n upperJawNullExprPos = \"var x = transform.position[0];\" + \"\\r\" +\n \"var y = transform.position[1];\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = -0.2;\" + \"\\r\" +\n \"[x, y+(s*scaler)];\";\n upperJawNullExprRot = \"var r = transform.rotation;\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = 0.2;\" + \"\\r\" +\n \"r+(s*scaler);\";\n //upperJawNullExprScale;\n upperJawNull.property(\"Position\").expression = upperJawNullExprPos;\n upperJawNull.property(\"Rotation\").expression = upperJawNullExprRot;\n //upperJawNull.property(\"Scale\").expression = upperJawNullExprScale;\n //--\n lowerJawNullExprPos = \"var x = transform.position[0];\" + \"\\r\" +\n \"var y = transform.position[1];\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = 2;\" + \"\\r\" +\n \"[x, y+(s*scaler)];\";\n lowerJawNullExprRot = \"var r = transform.rotation;\" + \"\\r\" +\n \"var s = comp(\\\"\" + theComp.name + \"\\\").layer(\\\"\" + myLayer.name + \"\\\").effect(\\\"\" + slider.name + \"\\\")(\\\"Slider\\\");\" + \"\\r\" +\n \"var scaler = -1.0;\" + \"\\r\" +\n \"r+(s*scaler);\";\n //lowerJawNullExprScale; \n lowerJawNull.property(\"Position\").expression = lowerJawNullExprPos;\n lowerJawNull.property(\"Rotation\").expression = lowerJawNullExprRot;\n //lowerJawNull.property(\"Scale\").expression = lowerJawNullExprScale;\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n }\n }else{\n //not a footage layer; send alert.\n alert(\"This only works on precomp layers.\");\n }\n }\n }\n }\n \n app.endUndoGroup();\n} //end script", "function setup() {\n\n}", "function setup() {\n\n}", "function setup() {\n\n}", "function setup() {\n\n}", "function setup() {\n \n}", "function beetle_lvl4() {}", "function mainProcess()\n\t{\n\t\naddLookup(\"EngCSMComments\",\"1.1 Developers Agreement\",\"The construction of this project will require the applicant shall enter into a City / Developer agreement for the required infrastructure improvements. The applicant shall contact Janet Schmidt at jschmidt@cityofmadison.com to schedule the development of the plans and the agreement. The City Engineer will not sign off on this project without the agreement executed by the developer. Obtaining a developer's agreement generally takes approximately 4-6 weeks, minimum. (MGO 16.23(9)c)\");\n \naddLookup(\"EngCSMComments\",\"1.2 Soil Borings\",\"Two weeks prior to recording the final plat, a soil boring report prepared by a Professional Engineer, shall be submitted to the City Engineering Division indicating a ground water table and rock conditions in the area. If the report indicates a ground water table or rock condition less than 9' below proposed street grades, a restriction shall be added to the final plat, as determined necessary by the City Engineer. (MGO 16.23(9)(d)(2) and 16.23(7)(a)(13))\");\n \naddLookup(\"EngCSMComments\",\"1.3 Impact fees\",\"This development is subject to impact fees for the_______Impact Fee District. All impact fees are due and payable at the time building permits are issued. (MGO Chapter 20)\n \nThe following note shall put the face of the plat/CSM:\nLOTS / BUILDINGS WITHIN THIS SUBDIVISION / DEVELOPMENT ARE SUBJECT TO IMPACT FEES THAT ARE DUE AND PAYABLE AT THE TIME BUILDING PERMIT(S) ARE ISSUED.\");\n /*\naddLookup(\"EngCSMComments\",\"1.4 Deferred Assments\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.1 ROW dedication\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.2 PLE grading sloping\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.3 ROW dedication for ingress/egress\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.4 Street vacation\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.5 Street design guidelines\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.6 15 ft Radii at intersections\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.7 25ft Radii at intersections\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.8 ROW width\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.9 Min Centerline Radius\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.10 Permanent cul de sac\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.11 Temp cul de sac\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.12 40ft util easement for transmission lines\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.13 No ped bike connections required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.14 PLE for ped/bike easement\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.15 Private easement for ped/bike\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.16 Public sanitary easement\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.17 Public sidewalk easement\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.18 Public storm easement\",\"x\");\n \naddLookup(\"EngCSMComments\",\"2.19 Public water easement\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.1 Street/SW improvements\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.2 Setback\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.3 Excessive grading\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.4 Park Frontage limited\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.5 Waiver street, construct sidewalk\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.6 Wtreet improvements\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.7 Sidewalk and ditching\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.8 Grade row and ditch\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.9 Value of sidewalk > $5000\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.10 Value of sidewalk < $5000\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.11 Waiver sidewalk\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.12 Grade ROW for future SW\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.13 Temp ingress/egress\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.14 Ingress/Egress\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.15 Intersection sight distance\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.16 Adequate sight distance\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.17 Approved street names\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.18 Private Street signs\",\"x\");\n \naddLookup(\"EngCSMComments\",\"3.19 Addressing\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.1 EROSION CONTROL STD\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.2 NON-EXCLUSIVE EASEMENTS STORM\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.3 ARROWS FOR DRAINGE\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.4 NO CHANGE IN DRAINGE\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.6 REMOVE ARROWS\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.7 MASTER DRAINGE PLAN REQUIRED\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.8 INTERDEPENDENT DRAINGE AGREEMENT REQUIREMENT\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.9 NOTE ON CSM RE CHAPTER 37\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.10 REQUIREMENT TO GO TO COE\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.11 WETLAND WDNR ACOE\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.12 MAPPING CAD SUBMITTAL\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.13 CAD SUBMITTAL ENGINEERING\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.14 WDNR NOI REQUIREMENT\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.15 SWU PAYMENT PRIOR TO SUBDIVIDE\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.16 POSSIBLE CONTAMINATED DEWATERING\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.17 CONSTRUCTION DEWATERING\",\"x\");\n \naddLookup(\"EngCSMComments\",\"4.18 PERMANENT DEWATERING\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.0 Developer required to build sanitary sewer\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.1 MMSD connection fees due\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.2 City of Madison sanitary sewer connection fees due\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.3 Each duplex unit shall have a separate lateral\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.4 MMSD review of plans required.\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.5 Ownership/ Maintenance Agreement Needed for shared Lateral\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.6 Sewer Plug Permit Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.7 Revise plans to show elevations and sizes of sanitary sewer facilities(Existing and Proposed)\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.8 Project may require monitoring for potential demand charges (sampling manhole)\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.9 Sanitary Sewer Easement Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.10 Sanitary Sewer Access Road Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.11 MMSD Connection Permit Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"5.12 Septic System Abandonment Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.1 PLSS Tie Sheets\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.2 Coordinate System and Coordinates\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.3 CADD Data Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.4 Easements\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.5 Final Review\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.6 Recording and APO Data\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.7 Drainage Easement Release and Creation\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.8 Temporary Turnaround Easement\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.9 Release of Easements\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.10 Offsite Easements\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.11 Easement Language\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.12 Utility Easements Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.13 Utility Easement language\",\"x\");\n \naddLookup(\"EngCSMComments\",\"6.14 Street Dedication Note\",\"x\");\n \naddLookup(\"EngCSMComments\",\"7.1 Phase 1 ESA Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"7.2 WDNR Approval Required to Alter Barrier Cap\",\"x\");\n \naddLookup(\"EngCSMComments\",\"7.3 Open Contaminant Site - WDNR Coordination Required\",\"x\");\n \naddLookup(\"EngCSMComments\",\"7.4 Management of Contaminated Soil\",\"x\");\n*/\n \t}", "static transient final private protected public internal function m39() {}", "transient private public function m183() {}", "function init_sys_data()\r\n{\t\r\n\tvar hdrstr= \"app4STATICS\";\r\n\tvar ftrstr= \"College of Engineering :: Michigan State University\";\r\n\t\r\n\tvar marks= [ '\\u0040',\t\t// start marker @\r\n\t\t\t\t '\\u007c' ]\t// end marker |\r\n\t\r\n\tvar codearr= [\r\n\t\t{ name:'deg', \tcode:'\\u00b0' },\r\n\t\t{ name:'plusminus',\tcode:'\\u00b1' },\r\n\t\t{ name:'super2', \tcode:'\\u00b2' },\r\n\t\t{ name:'super3', \tcode:'\\u00b3' },\r\n\t\t\t\t\t \r\n \t\t{ name:'alpha', \tcode:'\\u03b1' },\r\n\t\t{ name:'beta', \tcode:'\\u03b2' },\r\n\t\t{ name:'gamma', \tcode:'\\u03b3' },\r\n\t\t{ name:'delta', \tcode:'\\u03b4' },\r\n\t\t{ name:'epsilon', \tcode:'\\u03b5' },\r\n\t\t{ name:'zeta', \t\tcode:'\\u03b6' },\r\n\t\t{ name:'eta', \t\tcode:'\\u03b7' },\r\n\t\t{ name:'theta', \tcode:'\\u03b8' },\r\n\t\t{ name:'iota', \t\tcode:'\\u03b9' },\r\n\t\t{ name:'kappa', \tcode:'\\u03ba' },\r\n\t\t{ name:'lambda', \tcode:'\\u03bb' },\r\n\t\t{ name:'mu', \t\tcode:'\\u03bc' },\r\n\t\t{ name:'nu', \t\tcode:'\\u03bd' },\r\n\t\t{ name:'xi', \t\tcode:'\\u03be' },\r\n\t\t{ name:'omicron', \tcode:'\\u03bf' },\t\t\t\t\t \r\n\t\t{ name:'pi', \tcode:'\\u03c0' },\t\t\t\t\t \r\n\t\t{ name:'rho', \tcode:'\\u03c1' },\r\n\t\t//\t { name:'sigmaend', code:'\\u03c2' },\r\n\t\t{ name:'sigma', \tcode:'\\u03c3' }, \t\t\t\t\t \r\n\t\t{ name:'tau', \tcode:'\\u03c4' },\r\n\t\t{ name:'upsilon', \tcode:'\\u03c5' },\t\t\t\t\t \r\n\t\t{ name:'phi', \tcode:'\\u03c6' },\r\n\t\t{ name:'chi', \tcode:'\\u03c7' },\t\t\t\t\t \r\n\t\t{ name:'psi', \tcode:'\\u03c8' },\r\n\t\t{ name:'omega',\t\tcode:'\\u03c9' } ]\r\n\r\n\tvar sysdat= {\thdrstr:\t\thdrstr,\r\n\t\t\t\t\tftrstr:\t\tftrstr,\r\n\t\t\t\t\tmarks:\t marks,\r\n\t\t\t\t\tcodearr:\tcodearr };\r\n\t\t\t\t\t \r\n\treturn sysdat;\r\n}", "function test_crosshair_op_host_vsphere65() {}", "function checkfamily() {\r\n\r\n \r\n}", "transient final private protected public internal function m166() {}", "function c0_shortCode(ch7,P1){\r\n var cDret='';\r\n var cDp0=\"abcdefghijklmnopqrstuvxyz0123456789ABCDEFGHIJKLMNOPQRSTUVXYZ\";\r\n var cf1s=c0_f_evals1;\r\n var cf2s=c0_f_evals2;\r\n c0_f_evals1=null;\r\n c0_f_evals2=null;\r\n var cDp=c0_get_next_moves();\r\n c0_f_evals1=cf1s;\r\n c0_f_evals2=cf2s;\r\n var cDp1='';\r\n for(var c77=0;c77<cDp.length;c77+=5){\r\n var c7move=cDp.substr(c77,4);\r\n if( ( c0_position.charAt( c0_position.indexOf(c7move.substr(0,2))-1 )==\"p\" ) &&\r\n\t ((\"18\").indexOf( c7move.charAt(3) )>=0) )\r\n\t\t{\r\n\t\tcDp1+=c7move+\"[Q]\"+';'+c7move+\"[R]\"+';'+c7move+\"[B]\"+';'+c7move+\"[N]\"+';';\r\n\t\t}\r\n else cDp1+=c7move+' ;';\r\n if(cDp.charAt(c77+4)==\"[\") c77+=3;\r\n }\r\n\r\n if(ch7==1)\r\n\t{\r\n\tvar cDcmp=P1;\r\n\tif((cDcmp.length>4) && (cDcmp.substr(4,3)==\"[0]\")) cDcmp=cDcmp.substr(0,4);\r\n\tcDret=cDp0.charAt(cDp1.indexOf(cDcmp)/8);\r\n\t}\r\n else if(ch7==-1)\r\n\t{\r\n\tvar cDmove=cDp1.substr( (cDp0.indexOf(P1))*8,7);\r\n\tc0_become_from_engine=cDmove.charAt(5);\r\n\tif(c0_become_from_engine==' ') c0_become_from_engine='Q';\r\n\tc0_become=c0_become_from_engine;\r\n\tif( (\"Q \").indexOf( cDmove.charAt(5) )>=0 ) cDmove=cDmove.substr(0,4);\r\n\tcDret=cDmove;\r\n\t}\r\n return cDret;\r\n}", "function c0_get_FEN()\r\n{\r\nvar c0_vert7=8;\r\nvar c0_horz7=1;\r\nvar c0_fs1=\"\";\r\nvar c0_em7=0;\r\n\r\nfor( var c0_vert7=8; c0_vert7>=1; )\r\n {\r\n for( var c0_horz7=1; c0_horz7<=8; c0_horz7++ )\r\n\t{\r\n\tvar c0_pos7 = String.fromCharCode(96+c0_horz7)+c0_vert7.toString();\r\n\tvar c0_at7=c0_position.indexOf( c0_pos7 );\r\n\tif( c0_at7>=0 )\r\n\t\t{\r\n\t\tif( c0_em7>0 ) { c0_fs1+=c0_em7.toString(); c0_em7=0; }\r\n\t\tvar c0_ch7=c0_position.substr( c0_at7-1, 1 );\r\n\t\tvar c0_color7=c0_position.substr( c0_at7-2, 1 );\r\n\t\tif( c0_color7==\"w\" ) c0_fs1+=c0_ch7.toUpperCase();\r\n\t\telse c0_fs1+=c0_ch7.toLowerCase();\r\n\t\t}\r\n\telse c0_em7++;\r\n\t}\r\n if( c0_em7>0 ) { c0_fs1+=c0_em7.toString(); c0_em7=0; }\r\n c0_vert7--;\r\n if(c0_vert7<1) break;\r\n c0_fs1+=\"/\";\r\n }\r\n\r\nc0_fs1+=\" \" + (( c0_sidemoves>0)? \"w\" : \"b\" ) + \" \";\r\n\r\nif( (c0_w00 || c0_wKingmoved || (c0_wLRockmoved && c0_wRRockmoved)) && \r\n (c0_b00 || c0_bKingmoved || (c0_bLRockmoved && c0_bRRockmoved)) ) c0_fs1+=\"- \";\r\nelse\r\n {\r\n if( !(c0_w00 || c0_wKingmoved) && !c0_wLRockmoved ) c0_fs1+=\"Q\";\r\n if( !(c0_w00 || c0_wKingmoved) && !c0_wRRockmoved ) c0_fs1+=\"K\";\r\n if( !(c0_b00 || c0_bKingmoved) && !c0_bLRockmoved ) c0_fs1+=\"q\";\r\n if( !(c0_b00 || c0_bKingmoved) && !c0_bRRockmoved ) c0_fs1+=\"k\";\r\n c0_fs1+=\" \";\r\n }\r\n\r\n var c0_enpass7=\"-\";\r\n\r\n if(c0_lastmovepawn>0)\r\n\t{\r\n\tvar c0_lmove7=c0_moveslist.substr( c0_moveslist.length-4, 4 );\r\n\tvar c0_vert7 = c0_lmove7.charCodeAt(1)\r\n\r\n\tif( c0_lmove7.substr(0,1)==c0_lmove7.substr(2,1) &&\r\n\t\t(c0_lmove7.charCodeAt(0)-96==c0_lastmovepawn) &&\r\n\t\t (( c0_lmove7.substr(1,1)==\"7\" && c0_lmove7.substr(3,1)==\"5\" ) ||\r\n\t\t ( c0_lmove7.substr(1,1)==\"2\" && c0_lmove7.substr(3,1)==\"4\" )) )\r\n\t{\r\n\t var c0_at7=c0_position.indexOf( c0_lmove7.substr(2,2) );\r\n\t if( c0_at7>=0 && c0_position.substr( c0_at7-1,1 )==\"p\" )\r\n\t\t{\r\n\t\tc0_enpass7=c0_lmove7.substr(0,1);\r\n\t\tif( c0_lmove7.substr(1,1)==\"7\" ) c0_enpass7+=\"6\"; else c0_enpass7+=\"3\";\r\n\t\t}\r\n\t}\r\n\t}\r\nc0_fs1+=c0_enpass7 + \" \";\r\n\r\nc0_fs1+=\"0 \";\t\t// position repeating moves....\r\n\r\nvar c0_mcount7=1;\r\nfor( var c0_i7=0; c0_i7<c0_moveslist.length; )\r\n\t{\r\n\tc0_i7+=4;\r\n\tif(c0_moveslist.substr(c0_i7,1)==\"[\") c0_i7+=3;\r\n\tc0_mcount7+=0.5;\r\n\t}\r\nc0_fs1+=(parseInt( c0_mcount7.toString() )).toString() + \" \";\r\n\r\nreturn c0_fs1;\r\n}", "function getv2(){\r\n\t//\t\t\tfind(\"//script[@type='text/javascript']\", XPFirst).src.search(/(\\d).js$/);\r\n\t\t\t\tvar a=document.title;\r\n\t\t\t\tif (a==\"Travian cnt\") {\r\n\t\t\t\treturn 1 }else {\r\n\t\t\t\treturn 3}\r\n\t\t}", "function Expt() {\r\n}", "function jessica() {\n $log.debug(\"TODO\");\n }", "function DWRUtil() { }", "function Sread() {\r\n}", "function beetle_lvl5() {}", "function Ha(){}", "function Pythia() {}", "function o0() {\n try {\neval(\"var Array = function(i) { WScript.Echo(i); }\");\n}catch(e){}\n try {\no1 = o489.o617(o31, {\n o696: true\n });\n}catch(e){}\n}", "function CIQ(){}", "function RgbaBase() {\n\n}", "function emulate0(query,levion){\n//console.log(\"tttttttttttttttttttttttttttttttttttttttttttttttt\"+query)\ntry{levenshtein=require(path.resolve('%CD%', './plugins/modules/levenshtein').replace('\\\\%CD%', ''))\n}catch(err){console.log(\"errrrrrreur\"+err)}\n //lis le nom des plugins\n f1 = path.resolve('%CD%', './plugins/demarrage/item/plugins.json').replace('\\\\%CD%', '');//console.log(f1)\n data5=fs.readFileSync(f1,'utf8').toString();\n objet5 = JSON.parse(data5); longueur5 = objet5.nompluguine.length \n\n //nom plugin 1 par 1\n for (i=0;i<longueur5;i++){//console.log(objet5.nompluguine[i])\n//on test si query fait pati des xml EX : query XML query\n \n \n f2 = path.resolve('%CD%', './plugins/demarrage/item/'+objet5.nompluguine[i] +'item.json').replace('\\\\%CD%', '');\n data6=fs.readFileSync(f2,'utf8').toString(); garbage1=0\n \n if ( (objet5.nompluguine[i].search(\"garbage\",\"gi\")>-1) ){ garbage1=1 }\n \n data6=fs.readFileSync(f2,'utf8').toString(); \n \n try{ objet6 = JSON.parse(data6);jsonStr6 = JSON.stringify(objet6); longueur6 = objet6.nompluguine.length }\n catch(err){console.log(err)}\n\n for(y=0;y<longueur6;y++){// si match== emulate +nom appel..\n \n //////////////////////\n levi=levenshtein(objet6.nompluguine[y],query)\n querylengthlevi=query.length\n objet6lengthlevi=objet6.nompluguine[y].length\n concordancelevi=(levi*100)/objet6lengthlevi\n //console.log(\"consordanceeeeeeeeeeeeee \" +concordancelevi)\n\n if( (concordancelevi<25) && (levion==1) ){\n console.log(\"concordance levi : \" +levi+\" \"+concordancelevi+\" \"+ objet6.nompluguine[y])\n query=objet6.nompluguine[y]\n }//fin concorancelevi\n \n /////////////////////\n\n\n\n if (query.search(new RegExp(objet6.nompluguine[y],\"gi\")) >-1){\n \n console.log('concordance dans les xml de : '+query+\" dans : \"+objet6.nompluguine[y]+ \" du plugin : \"+objet5.nompluguine[i]) \n \n if(garbage1==1){ \n console.log(\"!!!!!garbage!!!!\"+garbage1+objet5.nompluguine[i])\n objet5.nompluguine[i]=objet5.nompluguine[i].replace(new RegExp(\"garbage\",\"gi\"),\"\");\n console.log(objet5.nompluguine[i])\n garbage1=0; SARAH.run(objet5.nompluguine[i], { 'dictation' : query});\n callback({'tts' : \"\"}); return false\n }//fin if garbage1\n \n //le nom de sarah en v3 ou v4\n try{\n filePathcontent1 = path.resolve('%CD%', './custom.ini').replace('\\\\%CD%', '');\n content = fs.readFileSync(filePathcontent1,'utf8');ini = require('./ini/ini');fs = require('fs')\n nomappel = ini.parse(fs.readFileSync(filePathcontent1, 'utf-8')).common.name;//console.log('le nom : '+nomappel)\n }//fin try\n catch (Exception) {\n filePathcontent1 = path.resolve('%CD%', './client/custom.ini').replace('\\\\%CD%', '');\n content = fs.readFileSync(filePathcontent1,'utf8');ini = require('./ini/ini');fs = require('fs')\n nomappel = ini.parse(fs.readFileSync(filePathcontent1, 'utf-8')).bot.name;//console.log('le nom : '+nomappel)\n }//fin catch\n //concordance donc on émul\n url1 = 'http://127.0.0.1:8888/?emulate='+nomappel+' '+objet6.nompluguine[y];console.log('on connais donc ont appel depuis cortana : '+url1)\n request = require('request');\n request({ url : url1 })\n\n////on verifie si on ajoute aux phrases clés\n filePathrea = path.resolve('%CD%', './plugins/mémoiredemathilde/phrasescles/phrasescles.json').replace('\\\\%CD%', '');\n \n fs.readFile(filePathrea, function(err,data){\n \n objet = JSON.parse(data);jsonStr = JSON.stringify(objet);//console.log(objet.phrasescles)\n \n queryrecherchefin=query.search(new RegExp(\"\\\\b\" + objet6.nompluguine[y] + \"\\\\b\",\"gi\"))\n queryrecherche=\"\"\n\n for(iii=0;iii<queryrecherchefin;iii++){queryrecherche=queryrecherche+query[iii]};//console.log('*'+queryrecherche+'-')\n \n for(ii=0;ii<objet.phrasescles.length;ii++){queryrecherche=queryrecherche.trim()\n debut=objet.phrasescles[ii].search(new RegExp(queryrecherche,\"gi\"))\n // console.log(debut+objet.phrasescles[ii]+queryrecherche)\n if (debut>-1){//console.log('pas de push pour : '+objet.phrasescles[i]+queryrecherche)\n console.log('fini pour cortana le pluguin est actif et phrasescles connus')\n callback({'tts' : \"\"});\n return false\n }//fin if debut\n\n }//fin for ii\n\n //on ajoute aux phrases cles\n // if(queryrecherche.length>4){\n if(queryrecherche.length>4){\n queryrecherche=queryrecherche.trim()\n objet.phrasescles.push(queryrecherche); new_jsonStr = JSON.stringify(objet);\n console.log(\"valeur rajoutée au json phrasescles & fini pour cortana le pluguin est actif \"+queryrecherche)\n filePathphrasescles1 = path.resolve('%CD%', './plugins/mémoiredemathilde/phrasescles/phrasescles.json').replace('\\\\%CD%', '')\n fs.writeFile(filePathphrasescles1,new_jsonStr)\n }//fin if querysearch\n\n })//fs.read\n\n callback({'tts' : \"\"});\n return false///////////fin car on connais\n\n }//fin if query search nom plugin\n }//fin for Y\n}//fin for i\n\nif (levion==0){console.log(\"2 eme passage avec levi\"); levion=1 ; emulate0(query,levion)}\nelse{emulate(query)}\n//on re test avec levi\n\n//rien donc on émul pour voir\n\n}// fin fnct emulate0", "function chamarAperto(){\n commandAbortJob();\n commandSelectParameterSet(1);\n commandVehicleIdNumberDownload(\"ASDEDCUHBG34563EDFRCVGFR6\");\n commandDisableTool();\n commandEnableTool();\n}", "function runScript() {\n\tconsole.time(\"index\");\n var job = tabs.activeTab.attach({\n \tcontentScriptFile: [self.data.url(\"models_50_wif/benign/CompositeBenignCountsA.js\"),\n \t\t\t\t\t\tself.data.url(\"models_50_wif/benign/CompositeBenignCountsAB.js\"),\n\t\t\t\t\t\tself.data.url(\"models_50_wif/benign/CompositeBenignTotal.js\"),\n\t\t\t\t\t\tself.data.url(\"models_50_wif/malicious/CompositeMaliciousTotal.js\"),\n \t\t\t\t\t\tself.data.url(\"models_50_wif/malicious/CompositeMaliciousCountsA.js\"),\n \t\t\t\t\t\tself.data.url(\"models_50_wif/malicious/CompositeMaliciousCountsAB.js\"),\n self.data.url(\"CompositeWordTransform.js\"),\n \t\t\t\t\t\tself.data.url(\"DetectComposite.js\")]\n \n \n });\n \n job.port.on(\"script-response\", function(response) {\n\t\n\tconsole.log(response);\n });\n}" ]
[ "0.6420683", "0.6101661", "0.6100119", "0.5898372", "0.57818085", "0.5644934", "0.56343484", "0.560767", "0.5444407", "0.54394007", "0.5439112", "0.53767216", "0.53376806", "0.5326476", "0.525771", "0.52242565", "0.52150166", "0.52107114", "0.5195999", "0.51881397", "0.51482636", "0.51352125", "0.5121366", "0.5111612", "0.5111612", "0.5083618", "0.507945", "0.50732684", "0.507152", "0.50638694", "0.5054016", "0.50476944", "0.503821", "0.5028221", "0.5015137", "0.50062037", "0.50017375", "0.49993134", "0.49947912", "0.49925774", "0.49899217", "0.49773836", "0.49638462", "0.49617288", "0.49612144", "0.4958107", "0.495626", "0.49478546", "0.492552", "0.49208498", "0.4895908", "0.4883012", "0.48760808", "0.4874036", "0.4871869", "0.4868454", "0.48524135", "0.48387536", "0.4827369", "0.48208472", "0.48202315", "0.48160133", "0.4815186", "0.4814851", "0.48099524", "0.48092026", "0.48065943", "0.4804342", "0.47979376", "0.4791649", "0.47889745", "0.4786094", "0.4785512", "0.4785512", "0.4785512", "0.4785512", "0.4783971", "0.4783041", "0.4773474", "0.47726694", "0.4770512", "0.47639444", "0.4761961", "0.47589457", "0.47550792", "0.4752042", "0.47468442", "0.4746296", "0.47435838", "0.4736823", "0.47334343", "0.47212946", "0.47165993", "0.47072226", "0.469996", "0.46947652", "0.46933028", "0.469078", "0.46884397", "0.468687", "0.4677901" ]
0.0
-1
Creation d'une fonction pour supprimer un article du panier
function deleteProduct(index) { //Creation de 2 paniers let panier = []; let newPanier = []; let strStorage = localStorage.getItem("panier"); /*On récupere le panier on effectue une boucle à l'interieur si l'id est différent du productId prit en paramétre un push est effectué dans newPanier avec les produits correspondant sans celui sélectionné */ if (strStorage !== null) { panier = JSON.parse(strStorage); for (let i = 0; i < panier.length; i++) { if (i != index) { newPanier.push(panier[i]); } } } panier = newPanier; localStorage.setItem("panier", JSON.stringify(panier)); window.location.reload(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function suppr_art(){\n\tvar nb=document.querySelectorAll('.article').length; //ie8 ne supporte pas getElementsByClassName, on utilise querySelectorAll à la place\n\n\tif (confirm ('Voulez vous supprimer ces '+nb+' article(s) ?')){\n\t\tfor (var i=0;i<nb;i++){\n\t\t\tdocument.getElementById('tabArticle').deleteRow(-1);\n\t\t}\n\t\tajout_article();\n\t}\n}", "function undelete_article(articleid)\n{\n change_article_state(articleid, \"undelete\", \"undeletebtn-a\" + articleid);\n}", "function removeArticle() {\n if (Nb_article > 0) {\n Nb_article -= 2;\n }\n initialize();\n}", "function suppr_un_art(){\n\tdocument.getElementById('tabArticle').deleteRow(-1);\n\tif(document.querySelectorAll('.article').length ==0)\n\t\tajout_article();\n\t\n}", "function removeArticle(articleId){\n var articleUrl = urlAdress + '/' + articleId + key;\n $.ajax(articleUrl, {\n type: 'DELETE',\n success: function(){ \n /*Set actual page to default first page, remove button for removed article. */\n $lastUsedButton.remove();\n showDefaultPage();\n updateUsedButtonLook($('.menu button:first-child')); \n //window.location.reload(); //alternative, just reload website instead \n },\n error: function(){console.log('Error: could not remove article');}\n });\n }", "static supprimerArticle(NumArticle, cb) {\n let query = connection.query('DELETE FROM article WHERE NumArticle = ?', NumArticle, (error, results) => {\n if (error) throw error;\n cb(results);\n });\n }", "function delete_article(articleid)\n{\n change_article_state(articleid, \"delete\", \"deletebtn-a\" + articleid);\n}", "function deletingchildelem() {\r\n $(\"#newcontent22\").remove();\r\n}", "function deleteElementPanier(element){\n\n var id = element.parentElement.getAttribute(\"data-index\");\n var taille = panier.length;\n\n // On supprime l'élément du panier (Tableau)\n for(var i = 0 ; i < taille ; i++){\n if(panier[i].id == id){\n panier.splice(i, 1);\n break; // Inutile de continuer\n }\n }\n // On supprime l'élément du panier (Modal)\n element.parentElement.parentElement.removeChild(element.parentElement);\n\n // On rafraichi le calcul du total\n refreshSomme();\n\n // Si le panier est vide, on affiche un message\n if(panier.length < 1){\n $(\"#panierModal>div>ul\").append(getMsgPanierVide());\n }\n\n // Faut-il toujours afficher le bouton Payer ?\n displayButtonPayer();\n\n // Nb article dans le panier\n refreshButtonPanier();\n}", "function deleteArticles() {\n\tvar articles = document.getElementsByTagName(\"article\");\n\n\tfor (i = articles.length - 1; i >= 0; i--) {\n\t\tarticles[i].parentNode.removeChild(articles[i]);\n\t}\n}", "removeArticle(event) {\n\t\t\tthis.articles = this.articles.filter(article => article.title !== event )\n\t\t}", "function clearArticles() {\r\n d3.select(\"body\").select(\"#articles-panel\").select(\"div\").remove();\r\n}", "function remover_poligono()\n{\n\tif(creator){\n\t\tcreator.destroy();\n\t\tcreator=null;\n\t}\n}", "function SupprimerDuPanier(button) {\n\tdocument.getElementById(\"searchbar\").value = \"\";\n\tvar name = $(button).parent().find(\".title\").html();\n\tfor (var i = 0; i < panier.length; i++) {\n\t\tif(panier[i].name == name) {\n\t\t\tpanier.splice(i, 1);\n\t\t\tRefreshPanier();\n\t\t\treturn;\n\t\t}\n\t}\n}", "function borrarTarea(){\n\t\t$(this).parent().remove(); //borra la tarea específica\n\t}", "function resetArticle(){\n\t$( \"#RASHhead\" ).empty();\n\t$( \"#paperdiv\" ).empty();\n\tif (articleN)\n\t\tconfs[confN].submissions[articleN].annotations = []; //svuota la cache delle annotazioni\n}", "function deleteArticle() {\n if (confirm(\"Are you sure you want to delete?\")) {\n const articleId = this.id.replace('delete-', '');\n window.location.href = `./DeleteArticle?articleId=${articleId}`;\n }\n }", "function clear() {\n $(\"#article-section\").empty();\n }", "function clear() {\n $(\"#article-section\").empty();\n }", "function deletePannier() {\n dispatch({\n type: \"RESET\"\n })\n }", "delete() {\n $(`#${this.idDOM}`).remove();\n }", "deleteArticle(articleId) {\n this.articles.find(article => article.config.id === articleId).delete();\n }", "deconstruct () {\r\n this.removeChild(this.title)\r\n\r\n for (let button of this.buttons) {\r\n this.removeChild(button)\r\n }\r\n\r\n for (let axis of this.axis) {\r\n this.removeChild(axis)\r\n }\r\n }", "function remove_tache(){\n\t// Recuperation de l'id de la tache\n\tvar id_tache = liste_infos_tache.getCoupler().getLastInformation();\n\t\n\t// Mise a jour BDD\n\tvar xhr = new XMLHttpRequest();\n\txhr.open(\"DELETE\", \"/taches/\"+id_tache, false);\n\txhr.send();\n\t\n\t// Notification interface\n\tmaj_listes_taches_after_edit();\n\ttitre_tache_selectContainer.setHTMLContent('<h2 class=\"hight_titre_liste\">SELECTIONNER UNE TACHE</h2>');\n\ttitre_tache_selectContainer.update();\n\tliste_infos_tache.clear();\n\tliste_infos_tache.update();\n\tdesc_tache_selectContainer.clear();\n\tdesc_tache_selectContainer.update();\n\tdocument.getElementsByClassName('btn_showPopup_clo_tache')[0].disabled = true;\n\tGraphicalPopup.hidePopup(popup_clo_tache.getPopupIndex());\n}", "supprimerParId(id) {\n console.log(id + \" <=id \");\n mongoose.model('Article').deleteOne({\"_id\" : id}).then((result)=>{\n console.log('ok deleted');\n }).catch((err)=>{\n console.log(err);\n });\n }", "function setArticle(article){\n cleanArticleFields(); \n \n if(article){\n $('.author').text('Author: ');\n $('.date').text('Date: '); \n $('.title').append('<span>' + article.title + '</span>' );\n var authorWithLink = '<span> <a href=\\'mailto:'\n + article.authorEmail \n + '\\'>' + article.author \n +'</a></span>';\n \n $('.author').append(authorWithLink);\n $('.date').append('<span>' + article.date + '</span>' ); \n $('.text').append( article.text );\n $('.text').append( '<p> <button>Remove article</button></p>' );\n $('.article-view button').on('click', function(){\n removeArticle(article._id);\n });\n \n } else {\n showDefaultPage(errorArticleObject); \n }\n }", "function supprimerFonction() \n{\n\tidDeSupp.value = this.parentElement.parentElement.getElementsByTagName('p')[5].innerHTML;\n\t//console.log(this + 'SUPPRIMER'); \n\tformulaireSupp.submit();\n}", "function deletarTarefa(tarefa) {\n // REMOVER ITEM\n tarefas.splice(tarefas.indexOf(tarefa.textContent), 1)\n\n // RENDERIZAR TELA NOVAMENTE\n renderizarTarefas()\n\n // SALVAR DADOS\n saveStorage() \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 }", "function removerAdicional() {\n\n abrirModalProgress()\n removerDadosFirebase();\n\n}", "function deleteOld() {\r\n let all = qsa(\".newsPiece\");\r\n for (let i = 0; i < all.length; i++) {\r\n all[i].remove();\r\n }\r\n if (qs(\".errorMessage\")) {\r\n qs(\".errorMessage\").remove();\r\n }\r\n id(\"resultNum\").textContent = \"\";\r\n }", "function deleteArticleClick(event){\n \n event.stopPropagation(); //Stop event bubbling\n \n var articles = new Articles(); //New article object\n \n var markedId = $(this).parents('article').attr(\"data-value\"); //Get article ID\n \n // If id was determined correctly delete article\n if(markedId){\n articles.removeArticle(markedId).done(deleteResponse);\n }else{\n popUp(\"error\",\"Failed to get target article ID\");\n }\n\n}//END deleteArticleClick", "eliminer() {\n //console.log(\"ELIMINER le divImage \"+this.divImage);\n this.divImage.parentNode.removeChild(this.divImage);\n\t}", "function removeArticle(articleId) {\n\t\t\treturn $http.delete('http://localhost:4000/articles?articleId=' + articleId).success(function (res) {\n\t\t\t\treturn res;\n\t\t\t});\n\t\t}", "deleteArticleImage(key)\n {\n let vm = this;\n\n if(vm.articleImages[key].pivot)\n {\n Api.http\n .delete(`/articles/${vm.article.id}/images/${vm.articleImages[key].id}`)\n .then(response => {\n if(response.status === 204)\n {\n vm.articleImages.splice(key, 1);\n Vue.toast('Article image detached successfully', {\n className: ['nau_toast', 'nau_success'],\n });\n }\n });\n }\n else\n {\n vm.articleImages.splice(key, 1);\n\n Vue.toast('Article image detached successfully', {\n className: ['nau_toast', 'nau_success'],\n });\n }\n }", "function SupprimerElementConfirme(objet){\n\tjQuery('#informationModal').modal('hide');\n\tjQuery(location).attr('href', objet);\n}", "function handleRemoveAll(_event) {\n for (let i = 0; i < carticles.length; i++) {\n document.getElementById(\"div\" + i).remove();\n }\n warenkorbsumme = 0;\n gesamtSumme.innerText = \"Gesamtsumme: \" + warenkorbsumme.toLocaleString(\"de-DE\", { style: \"currency\", currency: \"EUR\" });\n localStorage.clear();\n }", "remove() {\r\n this.page.sections = this.page.sections.filter(section => section._memId !== this._memId);\r\n reindex(this.page.sections);\r\n }", "function handlenoteDelete() {\n var currentnote = $(this).parents(\".note-panel\").data(\"id\");\n deletenote(currentnote);\n }", "remove(){\n //\n }", "function delme() { this.parentNode.removeChild(this);\t}", "function deleteNeume(){\n currentSyllable.neumes.splice(currentNeumeIndex, 1);\n \n currentNeumeIndex = 0;\n \n document.getElementById(\"input\").innerHTML = neumeDataChangeForm();\n document.getElementById(\"meiOutput\").value = createMEIOutput();\n createSVGOutput();\n}", "destroy() {\n nodes.splice(nodes.indexOf(el), 1);\n }", "function removeArticle(id) {\n console.log(\"called removeArticle:\", id);\n let idx = id.replace('jumbotron-','');\n console.log(data.articles[idx].title);\n article = {\n \"key\": data.articles[idx].publishedAt\n }\n\n $.ajax({\n url: \"/remove-article\",\n type: 'POST',\n data: JSON.stringify(article),\n processData: false,\n contentType: 'application/json'\n }).success(function (data) {\n console.log(data);\n $('#'+id).remove();\n });\n}", "function deleteQ(){\n var pageElement = document.querySelector(\".sub-question-area\");\n pageElement.remove();\n }", "delete() {\n let $self = $(`#${this.idDOM}`);\n if(this.commentSection !== undefined) {\n this.commentSection.delete();\n this.commentSection = undefined;\n }\n $self.remove();\n Object.keys(this.buttons).forEach(type => this.buttons[type].delete());\n }", "function nacteni()\n{\n var platenko=document.getElementById(\"kresleni\");\nplatenko.removeChild(kruh);\n}", "function clearpanier(){\n userpanier=[];\n localStorage.setItem('panier',JSON.stringify(userpanier));\n (document.querySelector(\"#countarticle\")).innerHTML=(getpanier());\n\t(document.querySelector(\"#countarticle1\")).innerHTML=(getpanier());\n (document.querySelector(\"#cmdvalider\")).innerHTML=\"\";\n}", "delete() {\n this.html.remove();\n }", "function resetDiv()\n{\n let news = document.getElementById(\"new\");\n news.remove();\n}", "function deleteChamp(l){\n\tvar supprimer = document.getElementById('line'+l);\n\tsupprimer.remove();\n}", "reset() {\n this.tag = undefined;\n this.keyword = undefined;\n this.articles.forEach(article => article.delete());\n this.articles = [];\n }", "function unsaveArticle(){\n // Grab the id associated with the article from the submit button\n var thisId = $(this).attr(\"data-id\");\n\n $.ajax({\n method: \"POST\",\n url: \"/unsave/\" + thisId,\n })\n // With that done\n .done(function(data) {\n // Log the response\n console.log(data);\n location.reload();\n });\n }", "function removeButton(){\n $(\"#car-view\").empty();\n var topic = $(this).attr('data-name');\n var itemindex = topics.indexOf(topic);\n if (itemindex > -1) {\n topics.splice(itemindex, 1);\n renderButtons();\n }\n }", "function clearPages() {\n\t\t$(articleContainer).html('');\n\t}", "removeIt(docID) {\n this.assertDefined(docID);\n // remove the Answers associated with this question\n MentorAnswers.removeQuestion(docID);\n // OK, clear to delete.\n super.removeIt(docID);\n }", "function removerPagto() {\n\t\tvar indice = 0;\n\t\t$.get(\n\t\t\tAPP+'/'+$('#role').val()+'/pagamentos_pedidos/del',\n\t\t\t{\n\t\t\t\tindice: indice\n\t\t\t},\n\t\t\tfunction(data){ \n\t\t\t\t$('.pagamentos tbody').find('.'+indice).remove();\n\t\t\t},\n\t\t\t'html'\n\t\t\t);\n\t}", "function pageBeforeRemove() {\n\t mb.destroy();\n\t pageContainer.off('page:beforeremove', pageBeforeRemove);\n\t }", "function pageBeforeRemove() {\n\t m.destroy();\n\t pageContainer.off('page:beforeremove', pageBeforeRemove);\n\t }", "delete() {\n this.eachElem((node) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }", "delete() {\n this.eachElem((node) => {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n });\n }", "function removeTinyMCE(){\n tinymce.remove('div');\n }", "destroy() {\n Nova.$off(`ckeditor:media:${this.attribute}:write`, this.writeContent.bind(this))\n }", "function eliminarDetalle(index){\r\n if(detallesOrden.length == 1){\r\n sessionStorage.removeItem(\"DetallesOrden\");\r\n document.getElementById(\"tablaDetalles\").innerHTML = \"\";\r\n return;\r\n }\r\n detallesOrden.splice(index,1);\r\n guardarDetalles();\r\n poblarDetalle();\r\n}", "hideContent() {\n let $self = $(`#${this.idDOM}`);\n let $content = $self.children('.article-big-content');\n\n if(this.commentSection !== undefined) {\n this.commentSection.delete();\n this.commentSection = undefined;\n }\n $content.empty();\n this.contentShown = false;\n articlesBigContainer.selectedArticle = undefined;\n }", "function deleteCreation(id){\n $(\"#currentCreation\").remove();\n $(\"#making\").slideUp(\"slow\");\n var widget=GetWidget(id);\n var idPanel= widget.panel;\n var panel=GetPanel(idPanel) \n panel.deleteElement(widget)\n}", "function removerCategoria() {\n consultarProdutos();\n}", "function clearArticles() {\n for (var i = 0; i <= dataArr.length + 2; i++){\n var clearMe = document.getElementById('article-generator');\n if(clearMe.hasChildNodes()) {\n clearMe.removeChild(clearMe.lastChild);\n }\n }\n}", "function wpabstracts_delete_topic(){\n jQuery('#topics_table').find(\"tr:last\").remove();\n}", "removerPosicao(posicao){}", "remove () {\n // cleanup\n }", "function deleteSlide() {\n var slideToDelete = $('.to-delete');\n slideToDelete.remove();\n }", "function Ni(t){delete Li[t]}", "function deDisplay() {\n\t\tvar p;\n\t\tp = document.querySelector(\"#contenu #titre\");\n\t\twhile (p.firstChild) {\n\t\t\tp.removeChild(p.firstChild);\n\t\t}\n\t\tp = document.querySelector(\"#contenu #fonds_leves\");\n\t\twhile (p.firstChild) {\n\t\t\tp.removeChild(p.firstChild);\n\t\t}\n}", "function deleteArticles(id) {\n\t\n\taddOverLay();\n\t$.ajax({\n\t\turl : HOST_PATH + \"admin/article/deletearticles\",\n\t\tmethod : \"post\",\n\t\tdata : {\n\t\t\t'id' : id\n\t\t},\n\t\tdataType : \"json\",\n\t\ttype : \"post\",\n\t\tsuccess : function(data) {\n\t\t\tif (data != null) {\n\t\t\t\twindow.location.href = \"trasharticle\";\n\t\t\t} else {\n\t\t\t\twindow.location.href = \"trasharticle\";\n\t\t\t}\n\t\t}\n\t});\n}", "function removePref(event) { \r\n \r\n const pref = event.currentTarget;\r\n \r\n /*Cambio l'immagine del cuore*/\r\n pref.src = listPreferiti[0]; \r\n pref.removeEventListener('click', removePref);\r\n pref.addEventListener('click',insertPref);\r\n\r\n /*Seleziono il nodo 'padre' e trovo l'id. \r\n Seleziono tutti i div della sezione Preferiti,\r\n li scorro e se trovo un div con lo stesso id lo rimuovo.*/\r\n\r\n var source = pref.parentNode; \r\n var idSource = source.id; \r\n const boxes = document.querySelectorAll('#sectionPref div'); \r\n for(const box of boxes){ \r\n if (box.id==idSource){ \r\n box.remove();\r\n break;\r\n }\r\n }\r\n \r\n /*Poichè ho reso cliccabile il cuore nella sezione Preferiti, se l'utente elimina\r\n il preferito cioè clicca sul cuore, devo aggiornare il corrispettivo elemento della sezione\r\n \"Tutti gli elementi\".*/\r\n \r\n const griglia = document.querySelectorAll('#grid div'); \r\n for(const div of griglia) { \r\n if(div.id == idSource) {\r\n div.childNodes[2].src = listPreferiti[0];\r\n div.childNodes[2].removeEventListener('click',removePref); \r\n div.childNodes[2].addEventListener('click',insertPref);\r\n }\r\n }\r\n \r\n /*Nascondo la sezione Preferiti*/\r\n if (document.querySelectorAll('#sectionPref div').length==0) { \r\n let p = document.getElementById(\"sezionePreferiti\");\r\n p.classList.add('hidden');\r\n }\r\n}", "function clearArticles() {\n $.ajax({\n method: \"DELETE\",\n url: \"/articles\"\n })\n .then(getArticles);\n location.reload()\n }", "function affichagePanier (){\n if (panier.length > 0){\n document.getElementById(\"panierVide\").remove();\n\n /*Nous allons présenter le panier à l'utilisateut sous forme de tableau que nous plaçons dans la section \"Sectionpanier\"*/\n let tableauSection = document.getElementById(\"Sectionpanier\");\n\n //Création du tableau\n let tableauPanier = create(\"table\", \"class\", \"tableauPanier\");\n let tableauHeaderLigne = create(\"tr\", \"class\", \"tableauHeaderLigne\");\n let tableauHeaderImage = document.createElement(\"th\");\n let tableauHeaderNom = document.createElement(\"th\");\n let tableauHeaderPrix = document.createElement(\"th\");\n let tableauHeaderAction = document.createElement(\"th\");\n let tableauFooterLigne = create(\"tr\", \"class\", \"tableauFooterLigne\");\n let tableauFooterPrixTotal = create(\"th\", \"class\", \"tableauFooterPrixTotal\");\n\n /*Attributs suplémentaires*/\n tableauFooterPrixTotal.setAttribute(\"colspan\", \"4\");\n\n /*Hiérarchisation des élements crées*/\n tableauSection.appendChild(tableauPanier);\n tableauPanier.appendChild(tableauHeaderLigne);\n tableauHeaderLigne.appendChild(tableauHeaderImage);\n tableauHeaderLigne.appendChild(tableauHeaderNom);\n tableauHeaderLigne.appendChild(tableauHeaderPrix);\n tableauHeaderLigne.appendChild(tableauHeaderAction);\n\n /*Attribution des données aux élements créees*/\n tableauHeaderImage.textContent = \"Article(s)\";\n tableauHeaderNom.textContent = \"Nom(s)\";\n tableauHeaderPrix.textContent = \"Prix\";\n tableauHeaderAction.textContent = \"Action\";\n\n /*Création d'une ligne dans le tableau pour chaque produit composant le panier*/\n JSON.parse(localStorage.getItem(\"monPanier\")).forEach((article, index) => {\n let articleLigne = create(\"tr\", \"id\", \"articleLigne\");\n let articleImage = create(\"img\", \"id\", \"articleImage\");\n let articleNom = create(\"td\", \"id\", \"articleNom\");\n let articlePrix = create(\"td\", \"id\", \"articlePrix\");\n let articleAction = create(\"i\", \"id\", index);\n\n /*Attributs suplémentaires*/\n articleImage.setAttribute(\"src\", article.imageUrl);\n articleAction.setAttribute(\"alt\", \"Retirer l'article du panier.\");\n articleAction.setAttribute(\"class\", \"fas fa-trash-alt\"); //Logo poubelle pour supprimer l'article du panier.\n \n /*Suppression de l'article en cliquant sur la poubelle*/\n articleAction.addEventListener(\"click\", function(event){\n suppressionArticle(event.target.id);\n });\n \n /*Hiérarchisation des élements crées*/\n tableauPanier.appendChild(articleLigne);\n articleLigne.appendChild(articleImage);\n articleLigne.appendChild(articleNom);\n articleLigne.appendChild(articlePrix);\n articleLigne.appendChild(articleAction);\n\n /*Attribution des données aux élements créees*/\n articleNom.textContent = article.name;\n articlePrix.textContent = article.price / 100 + \" \" + \"euros\";\n });\n\n /*Création de la ligne du bas du tableau affichant le prix total de la commande*/\n tableauPanier.appendChild(tableauFooterLigne);\n tableauFooterLigne.appendChild(tableauFooterPrixTotal);\n \n JSON.parse(localStorage.getItem(\"monPanier\")).forEach(priceArticle => {\n total += priceArticle.price / 100;\n });\n\n tableauFooterPrixTotal.textContent = \"Prix total: \" + total + \" euros\"; \n }\n}", "function eliminarActividad(e) {\n\n var actividadBorrar = e.target.dataset.id; //hay que utilizar la propiedad del dataset porque si solo pidieramos el valor del target donde está el boton (pues estamos enlazando la funcion de eliminar con un boton concreto), solo recibiriamos el <i> del icono (mal), no el id de todo el articulo, por lo que es necesario imprimirle al icono el id del articulo entero para que se relacione cada boton con el id de su articulo. El otro metodo sería remontarnos 5 generaciones con parentNode hasta llegar el article y pedir el id.\n \n for (let i = 0; i< agendaActividades.length; i++){ //recorremos el array para encontrar la actividad que tiene un id coincidente\n\n if(agendaActividades[i].id == actividadBorrar) //el [i] funciona como contador\n {\n agendaActividades.splice(i, 1); //recorremos el array original y se aplica a partir del articulo coincidente y en la cantidad que elijamos. 1 en este caso.\n pintarActividades(agendaActividades); //pintamos de nuevo los restantes\n }\n }\n}", "function emptyTrash(item_id){\n let removedItem = document.querySelector(\"#item_\" + item_id + \" > .item-text > .prod-title\").innerHTML;\n let removedPrice = document.querySelector(\"#item_\" + item_id + \" > .item-text > .cart-item-price\").innerHTML;\n sum -= removedPrice;\n document.getElementById(\"total\").innerHTML = parseFloat(sum.toFixed(2));\n document.querySelector(\"#item_\" + item_id).remove();\n alert(\"Voulez-vous supprimer l'article: \" + removedItem + \" ?\");\n allRemoved(); // s'il n'y a plus d'articles dans le panier appeler la fonction allRemoved()\n}", "function ConjuntoGenerico_Remover(chave) {\r\n if (chave == null) {\r\n throw \"NullPointerException {\" + chave + \"}\";\r\n }\r\n var obj = this.Tabela[chave];\r\n this.Tabela[chave] = null;\r\n return obj;\r\n}", "removeAction(){\n // Elimino el todo seleccionado\n removeTodo(this);\n }", "function unhide_article(articleid)\n{\n change_article_state(articleid, \"unhide\", \"unhidebtn-a\" + articleid);\n}", "function deletePublication(req, res, next,proxyMensagem) {\n\tlet pub = new Publication();\n\tvar reqMensagem = req.body.Publication;\n\tpub.deletePublication(reqMensagem).then((msgCreated) => {\n\t\treturn res.json(msgCreated);\n\t}).catch((err) => {\n\t\treturn res.send(\"Publication delete failed\" + err);\n\t});\n\treturn next();\n}", "delete() {\n $(`comment-${this.config['id']}`).remove();\n }", "remove() {\n // remove the para, and filterdiv\n this.para.remove()\n this.filterDiv.remove()\n this.labelholder.remove()\n this.maxel.element.remove()\n this.minel.element.remove()\n }", "function deleteItem(){ \n $(this).parent().remove();\n }", "function supprimer_docs(id,obj=null)\n {\n if(obj==null) \n obj=jsonObj.fils;\n for (indice in obj)\n {\n if(obj[indice].estArticle)\n { \n for(key in obj[indice].contenu.docs)\n {\n if(key==id && confirm('Attention ! cet élément ne sera plus récuperable, êtes-vous sûr de vouloir supprimer ?'))\n {\n delete obj[indice].contenu.docs[key] ;\n delete obj[indice].child--;\n tracer_arbo(); \n return;\n }\n }\n }\n else\n {\n supprimer_docs(id, obj[indice].fils);\n } \n }\n }", "function supprimerImageCarte() {\n\t\tvar id = document.getElementById('supprimePlateauCarte')[document.getElementById('supprimePlateauCarte').selectedIndex].value;\n\t\tif (!isNaN(id)) {\n\t\t\tif (confirmation()) {\n\t\t\t\t/* Supression de l'element selectionne */\n\t\t\t\tnew Ajax.Request(\n\t\t\t\t\t\tURL_INCLUDES+'majBase.inc.php',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmethod: 'get',\n\t\t\t\t\t\t\tparameters: {\n\t\t\t\t\t\t\t\taction: 'suppression',\n\t\t\t\t\t\t\t\ttable: 'carte_plateaux',\n\t\t\t\t\t\t\t\tid: id\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonComplete:function(RETOUR){\n\t\t\t\t\t\t\t\tparent.document.getElementById('infos').innerHTML = RETOUR.responseText;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t/* Reaffichage de la carte */\n\t\t\t\t\t\t\t\tafficheCarte(document.getElementById('nomCarteEnregistree')[document.getElementById('nomCarteEnregistree').selectedIndex].value,'',0,0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n//\t\t\t\t\n//\t\t\t\t\n//\t\t\t\t\n//\t\t\t\t\n//\t\t\t\t\n//\t\t\t\tnew Ajax.Updater(\n//\t\t\t\t\t'infos',\n//\t\t\t\t\tURL_INCLUDES+'majBase.inc.php',\n//\t\t\t\t\t{\n//\t\t\t\t\t\tmethod: 'get',\n//\t\t\t\t\t\tparameters: {\n//\t\t\t\t\t\t\taction: 'suppression',\n//\t\t\t\t\t\t\ttable: 'carte_plateaux',\n//\t\t\t\t\t\t\tid: id\n//\t\t\t\t\t\t}\n//\t\t\t\t\t}\n//\t\t\t\t);\n//\t\t\t\t\n//\t\t\t\t/* Reaffichage de la carte */\n//\t\t\t\tafficheCarte(document.getElementById('nomCarteEnregistree')[document.getElementById('nomCarteEnregistree').selectedIndex].value,'',0,0);\n\t\t\t}\n\t\t} else {\n\t\t\talert(\"Choisissez un plateau à supprimer.\");\n\t\t}\n\t}", "function pageBeforeRemove() {\n m.destroy();\n pageContainer.off('page:beforeremove', pageBeforeRemove);\n }", "remove(){\n this.removeViews(Object.keys(this.views));\n this.el.innerHTML = null;\n this.layouts[this.layout].isRendered = false;\n this.layout = null;\n }", "function pageBeforeRemove() {\n mb.destroy();\n pageContainer.off('page:beforeremove', pageBeforeRemove);\n }", "function eliminar_img_foto(tab,camp)\n{\n\t$1('image_'+camp+'_controles1');\n\t$0('image_'+camp+'_copiando');\n\t$1('image_'+camp+'_default');\n\t$('image_'+camp+'_img').src=USU_IMG_DEFAULT;\n\t$('form_'+camp).reset();\n\t$0('image_'+camp+'_img_cerrar');\n\t$('upload_in_'+camp).value='eliminar';\n\n}", "function deleteElement() {\n myPresentation.getCurrentSlide().deleteElement()\n}", "function deleteListItem(event) {\n var card = $(event.target).closest('article');\n var deleteId = card.prop('dataset').id;\n card.remove();\n removeFromCollection(deleteId);\n if (!localStorage.length) resetFilter();\n if ($('article').length < 11) {\n $('.js-show-more').prop('disabled', true);\n };\n}", "delete(){\n let td = this.getCase();\n let img = td.lastChild;\n if(img != undefined) td.removeChild(img);\n }", "removeFigure(){\n\n this[figure] = null;\n }", "function limpiar(){\n\tlocalStorage.clear();\n\tvar divCont = document.getElementById('content');\n\tdivCont.parentNode.removeChild(divCont);\n}", "function clearPanier() {\n //mettre au panier au click de l'utilisateur\n let inputClear = document.getElementById(\"facture\");\n inputClear.innerHTML += '<div class=\"btn btn-primary mx-5 my-3\" id=\"clear_basket\">Vider votre panier</div>';\n document.getElementById(\"clear_basket\").addEventListener(\"click\", () => {\n let confirmation = confirm(\"Êtes-vous sûr de vouloir supprimer votre commande ?\");\n if (confirmation == true) {\n localStorage.clear();\n document.location.reload(true)\n };\n });\n}", "remove(){\n\n }", "function resetArticle(group, name, version) {\n var $root = $('article[data-group=\\'' + group + '\\'][data-name=\\'' + name + '\\']:visible');\n var content = renderArticle(group, name, version);\n\n $root.after(content);\n var $content = $root.next();\n\n // Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte)\n $content.find('.versions li.version a').on('click', changeVersionCompareTo);\n\n $('#sidenav li[data-group=\\'' + group + '\\'][data-name=\\'' + name + '\\'][data-version=\\'' + version + '\\']').removeClass('has-modifications');\n\n $root.remove();\n return;\n }" ]
[ "0.7112562", "0.7020479", "0.6965465", "0.69086385", "0.6894984", "0.662584", "0.65662783", "0.6562634", "0.6542179", "0.6437033", "0.6387203", "0.6355308", "0.6337193", "0.6271713", "0.62660056", "0.6217893", "0.61961585", "0.6120943", "0.6090716", "0.60642904", "0.60430187", "0.60313547", "0.60311496", "0.60300916", "0.6023637", "0.6005316", "0.59894174", "0.5981698", "0.5980999", "0.5974098", "0.59516144", "0.5943543", "0.59397763", "0.59385735", "0.59263426", "0.5912275", "0.59104156", "0.59091574", "0.59030867", "0.5902493", "0.58975804", "0.5895793", "0.5871631", "0.58714885", "0.58702195", "0.58664566", "0.5857767", "0.585268", "0.585038", "0.5848183", "0.5833346", "0.5829807", "0.58177185", "0.58051455", "0.58031374", "0.5801026", "0.5799084", "0.57989883", "0.5798718", "0.57975763", "0.57975763", "0.5795629", "0.5795407", "0.57936", "0.5783644", "0.5778885", "0.5778082", "0.57695657", "0.5767697", "0.575473", "0.5752337", "0.57479155", "0.57461053", "0.57431406", "0.57417864", "0.573852", "0.5737185", "0.57299584", "0.5729101", "0.5727532", "0.57130694", "0.5712031", "0.5705435", "0.5697917", "0.569779", "0.5695437", "0.5694369", "0.5693908", "0.56938154", "0.56925994", "0.56806517", "0.5678658", "0.56749177", "0.56641704", "0.566195", "0.56607217", "0.5659769", "0.5656425", "0.5654172", "0.5653802", "0.56530184" ]
0.0
-1
Llenar el listado de Desembolsos
function all() { var deferred = $q.defer(); $http.get('/api/desembolsos/?format=json') .success(function (data) { deferred.resolve(data); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "function dibujarComentarios(_datos)\n{\n\tvar lista = $('#lista-comentarios');\n\tlista.empty();\n\tfor(var i in _datos)\n\t{\n\t\tvar html = '<li class=\"list-group-item\">'+\n \n '<div class=\"primercommit\">'+\n '<h4><Span>'+_datos[i].name+'</Span> dice:</h4>'+\n '<span>'+_datos[i].content+'</span>'+\n '</li>';\n \n\t\tlista.append(html);\n\t}\n}", "function listarAvionetasDespegadasDuranteElDia() {\n var contador = 0;\n\n console.log('-------------INICIO LISTADO-----');\n console.log('Fecha: ' + describirFecha(elDiaDeHoy.fecha));\n console.log('Total de Avionetas: ' + elDiaDeHoy.cantidadTotal);\n console.log('Total de Fumigación: ' + elDiaDeHoy.cantidadDeFumigacion);\n\n console.log('');\n console.log('-----Detalle de despegues-----');\n\n // Se recorren todos los despegues\n while (contador < elDiaDeHoy.despeguesDeAvionetas.length) {\n\n console.log('Despegue: ' + contador);\n\n console.log('Hora: ' + describirHora(elDiaDeHoy.despeguesDeAvionetas[contador].hora));\n console.log('Placa: ' + elDiaDeHoy.despeguesDeAvionetas[contador].Avioneta.placa);\n console.log('Numero De Pilotos: ' + elDiaDeHoy.despeguesDeAvionetas[contador].Avioneta.cantidadPilotos);\n\n // Se toma la avioneta y se evalua si es de fumigacion para el resultado\n if (elDiaDeHoy.despeguesDeAvionetas[contador].Avioneta.esDeFumigacion) {\n console.log('Avioneta de Fumigacion: Si');\n }\n else {\n console.log('Avioneta de Fumigacion: No');\n }\n\n console.log('');\n\n // se avanza en uno el contador\n contador++;\n }\n\n console.log('-------------FIN LISTADO-----');\n}", "function deletList() {\n setPedido([])\n setAcao(!acao)\n }", "function jogosDaDesenvolvedora(desenvolvedora){\n let jogos = [];\n\n for (let categoria of jogosPorCategoria) {\n for ( let jogo of categoria.jogos ) {\n if (jogo.desenvolvedora === desenvolvedora){\n jogos.push(jogo.titulo)\n } \n }\n }\n console.log(\"Os jogos da \" + desenvolvedora + \" são: \" + jogos)\n}", "function livrosAugustoCury() {\n let livros = [];\n for (let categoria of livrosPorCategoria) {\n for (let livro of categoria.livros) {\n if (livro.autor === 'Augusto Cury') {\n livros.push(livro.titulo);\n }\n }\n }\n console.log('Livros do Augusto Cury: ' , livros);\n}", "function afficher() {\n console.log (\"\\nVoici la liste de tous vos contacts :\");\n Gestionnaire.forEach(function (liste) {\n\n console.log(liste.decrire()); // on utilise la méthode decrire créé dans nos objets\n\n }); // la parenthese fermante correspond à la la parenthese de la méthode forEach()\n\n}", "function afficherContact() { \n contactLists.forEach(function(contactList){ \n console.log(contactList.decrire());\n });\n}", "async function liste() {\n const bilan = await Present.findAll({\n where: {\n Classe: \"lp-fi\"\n }\n });\n //console.log(date);\n //var nom;\n const abs = await Absent.findAll({\n where: {\n Classe: \"lp-fi\"\n }\n });\n\n const exampleEmbed = new MessageEmbed()\n .setColor('#4C1B1B')\n .setTitle(\"La liste des appels d'aujourd'hui \")\n .setTimestamp(message.createdAt)\n /*bilan.forEach((eleve) => {\n console.log(eleve.NomEleve);\n nom = eleve.NomEleve;\n exampleEmbed.addField(\n `${eleve.filter(el => el === eleve.toLowerCase()).map(elv => elv.NomEleve).join(', ')}`\n )\n });*/\n exampleEmbed.addField(\n `voici la liste des élèves présent :`,\n `${bilan.map(elv => elv.NomEleve).join(', \\n')}`\n );\n\n exampleEmbed.addField(\n `voici la liste des élèves absent :`,\n `${abs.map(elv => elv.NomEleve).join(', \\n')}`\n );\n message.channel.send(exampleEmbed)\n }", "function Liste() {\r\n this.elenco = [];\r\n\r\n this.inizializza =\r\n function(y) {\r\n for (var i = 0; i < y.length; i++) {\r\n var lista = new Lista();\r\n lista.inizializza(y[i]);\r\n this.elenco.push(lista);\r\n };\r\n }\r\n\r\n //scorre tutte le Scuole e creo un array associativo con le opzioni scuole\r\n this.creaSelectScuola =\r\n function() {\r\n var scuole = {};\r\n for (var i = 0; i < this.elenco.length; i++) {\r\n scuole[this.elenco[i].scuola] = true;\r\n }\r\n var selectDiv = \"<option value='null'>scegli una scuola</option>\";\r\n for (var i in scuole) {\r\n selectDiv += '<option value=\"' + i + '\">' + i + '</option>';\r\n }\r\n return selectDiv;\r\n }\r\n\r\n //scorre i maestri in base alla scuola e creo un array associativo relativo \r\n this.creaSelectMaestro =\r\n function(scuola) {\r\n var maestri = {};\r\n for (var i = 0; i < this.elenco.length; i++) {\r\n if (this.elenco[i].scuola == scuola) {\r\n maestri[this.elenco[i].maestro] = true;\r\n }\r\n }\r\n var selectDiv = \"<option value='null'>scegli un maestro</option>\";\r\n for (var i in maestri) {\r\n selectDiv += '<option value=\"' + i + '\">' + i + '</option>';\r\n }\r\n return selectDiv;\r\n }\r\n\r\n //cerca la lista in base alla scuola e al maestro scelti\r\n this.cercaMaestro =\r\n function(maestro, scuola) {\r\n var z = [];\r\n for (var i = 0; i < this.elenco.length; i++) {\r\n if (this.elenco[i].scuola == scuola && this.elenco[i].maestro == maestro) {\r\n z.push(this.elenco[i]);\r\n }\r\n }\r\n return z;\r\n }\r\n}", "function listoKurimas() {\n divuiAte();\n pridedamVerteIMasyva();\n var divListui = document.createElement('div'); // sukuriam diva listui\n // divui id\n divListui.id = \"divoId\";\n // pridedam sukurta diva i body\n document.getElementsByTagName('body')[0].appendChild(divListui);\n // sukuriam ul taga\n var ulDivui = document.createElement('ul');\n // idedam ul i diva\n divListui.appendChild(ulDivui);\n // sukuriam for loopa kad pridetu i ul masyvo \n // elementus kaip li\n var kiekListeYraLi = komentaruMasyvas.length;\n \n\n //////////////////////////////////////////////////////////////////////////\n // cia GAL su get element by tag name pasigauti sukurta ul ir appendint kuriamus li \n // i ji?\n for (var i = 0; i < kiekListeYraLi; ++i) {\n var listoElementas = document.createElement('li');\n listoElementas.innerHTML = komentaruMasyvas[i];\n ulDivui.appendChild(listoElementas);\n\n };\n document.getElementById('divasIsHtmlSkriptoVietai').appendChild(divListui);\n\n}", "async getList() {\n const data = await this.getData();\n return data.map((medewerkers) => {\n return {\n voornaam: medewerkers.voornaam,\n basisrol: medewerkers.basisrol,\n geboortedatum: medewerkers.geboortedatum,\n };\n });\n }", "function generateList() {\n const ul = document.querySelector(\".list\");\n abrigoList.forEach((abrigo) => {\n const li = document.createElement(\"li\");\n const div = document.createElement(\"div\");\n const a = document.createElement(\"a\");\n const p = document.createElement(\"p\");\n a.addEventListener(\"click\", () => {\n irParaAbrigo(abrigo);\n });\n div.classList.add(\"abrigo-item\");\n a.innerText = abrigo.properties.name;\n a.href = \"#\";\n p.innerText = abrigo.properties.address;\n\n div.appendChild(a);\n div.appendChild(p);\n li.appendChild(div);\n ul.appendChild(li);\n });\n}", "function renderizado() {\n listaNombres.innerHTML=''\n nombres.forEach( ( item ) => {\n const html = `<li>${item}</li>`;\n listaNombres.innerHTML += html;\n })\n}", "function obterLista(elemento) {\n switch (elemento) {\n case 'insetos':\n crudService.listarRegistros(rotaInseto, sucessoInseto)\n\n function sucessoInseto(res) {\n $scope.listInsetos = res.data;\n }\n break;\n case 'ordem':\n crudService.listarRegistros(rotaOrdem, sucessoOrdem)\n\n function sucessoOrdem(res) {\n $scope.listOrdem = res.data;\n }\n break;\n }\n }", "function getList() {\n return fetch(\n 'https://5f91384ae0559c0016ad7349.mockapi.io/departments',\n ).then((data) => data.json());\n }", "get listadoArray(){ //Queremos transformar nuestro objeto en arrays para poder presentarlo de mejor manera por consola\n\n const listado=[];\n\n Object.keys(this._listado).forEach(key =>{\n\n const tarea=this._listado[key];\n listado.push(tarea);\n\n \n }); //Esta funcion nos devuelve el array de todas las llaves\n\n\n return listado;\n }", "getLista() {\n return this.lista.filter(usuario => usuario.nombre !== 'sin-nombre');\n }", "function iniciar(){\n for(var i = 1; i <= 31; i ++){\n var dezena = diaSorteService.montaDezena(i);\n vm.dezenas.push(dezena);\n }\n }", "function getListas(req, res){\n var claseId = req.params.clase;\n \n if(!claseId){\n //Sacar todos las listas de la BD\n var find = Lista.find({}).sort('nro_lista');\n }else{\n //Sacar las lista de una clase en concreto de la BD\n var find = Lista.find({clase: claseId}).sort('anio'); \n }\n \n find.populate({path: 'clase'}).exec((err, lista) => {\n if(err){\n res.status(500).send({message: 'Error en la peticion'});\n }else{\n if(!lista){\n res.status(404).send({message: 'No hay listas'});\n }else{\n res.status(200).send({lista});\n }\n }\n });\n }", "function MostrarCarrito() {\n\n\n\tvar div = document.getElementById(\"mostrarcarrito\");\n\tdiv.innerHTML = \"\";\n\n\tvar Title = document.createElement(\"h2\");\n\tTitle.appendChild(document.createTextNode(\"Listado:\"));\n\tvar Articlelist = document.createElement(\"ul\");\n\n\tvar cont = 0;\n\n\tcarritocompra.items.forEach(element => {\n\n\t\tvar Article = document.createElement(\"li\");\n\t\tArticle.appendChild(document.createTextNode(element.num_serie + \" - \" + element.nombre + \" - \" + element.precio + \"€ -- \" + carritocompra.cantidades[cont] + \" Unidades\"));\n\t\tArticlelist.appendChild(Article);\n\t\tcont++;\n\t});\n\n\tdiv.appendChild(Title);\n\tdiv.appendChild(Articlelist);\n\n}", "function excluirDados(id){\n if(confirm(\"Tem Serteza que Quer excluir\")){\n if(id === list.length - 1) {//linpando ultimo\n list.pop(); //pop server para apagar um item \n }else if(id === 0){//excluindo o primeiro\n list.shift();//shift apaga o primeiro item\n }else {\n var arrayInicial = list.slice(0,id);//apagando itens no meio do formulario\n var arrayFinal = list.slice(id + 1);\n list = arrayInicial.concat(arrayFinal);\n }\n setList(list);\n }\n}", "static async list(){\n let sql = 'Select * from theloai';\n let list =[];\n try {\n let results = await database.excute(sql);\n results.forEach(element => {\n let tl = new TheLoai();\n tl.build(element.id,element.tenTheLoai,element.moTa);\n list.push(tl);\n });\n return list;\n\n } catch (error) {\n throw error; \n } \n }", "function listar(data){\n var lista = $('<ul></ul>');\n var li;\n var div = $('#update');\n var flag_ped = false, flag_sol_ped = false;\n div.empty();\n div.removeClass();\n div.toggle(true); \n $.each(data, function(index, obj){\n if(obj['POSICION'] && !(obj['MESSAGE']) && (obj['NUMERO'])){\n li = $('<li></li>');\n li.html('<b>Sol. Pedido: </b>'+obj['NUMERO']);// Solicitud de pedido \n lista.append(li);\n div.addClass('lista_sol');\n flag_sol_ped = true;\n }else{\n if(obj['NUMERO'] && !(obj['MESSAGE']) && !(obj['POSICION'])){\n li = $('<li></li>');\n li.html('<b>Pedido: </b>'+obj['NUMERO']);// Pedidos \n lista.append(li);\n div.addClass('lista_ped');\n flag_ped = true; \n }else{\n if(obj['POSICION'] && obj['MESSAGE'] && obj['NUMERO']){\n li = $('<li></li>');\n li.html('<b>Mensaje: </b>'+obj.MESSAGE);//este es el mensaje cuando se libera/rechaza pedidos\n lista.append(li);\n div.addClass('lista_mensaje');\n }else{\n li = $('<li></li>');\n li.html('<b>Mensaje: </b>'+obj);//este es el mensaje cuando se libera solicitudes de pedidos\n lista.append(li);\n div.addClass('lista_mensaje');\n }\n }\n }\n });\n if(flag_ped) $('<b>'+data.length+'</b><span> Pedidos Seleccionados</span>').prependTo(div);\n if(flag_sol_ped) $('<b>'+data.length+'</b><span> Sol. Pedidos Seleccionados</span>').prependTo(div);\n div.append(lista);\n}", "getLista() {\n let listaTemporal = this.lista.filter((usuario) => {\n // if(usuario.nombre!='sin-nombre'){//cuando si tenga un nombre lo retornare a una lista temporal\n return usuario;\n // }\n });\n return listaTemporal;\n }", "function getEmpleadosDropdown() {\n $http.post(\"lateral/getNombresDropdown\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaEmpleados.data = r.data.d.data;\n \n }\n })\n }", "function listarTodosAprendiz(){\r\n\t\r\n\tlistarTodosAprendizGenerico(\"listarTodos\");\r\n\r\n}", "async function listarVeterinarias() {\n const entidad = \"veterinarias\";\n try {\n //*fetch es una promesa por eso se pone el await\n const respuesta = await fetch(` ${url}/${entidad}`);\n //*las que viene del servidor y eso va a tomar lo que vino en las repsuestas y lo va a convertit en un json y como es una promesa se pone el await para que obtenga la respuesta de la promesa\n const veterinariasDelServidor = await respuesta.json();\n //* la respuesta sera un array y eso se hace cn el objeto array de js y el metodo de ese objeto isarray y eso verificara si eso es un array\n if (Array.isArray(veterinariasDelServidor)) {\n //*si es un array si si guardamos eso en la variables consultas que es el arreglo que inicializaos al inicio\n veterinarias = veterinariasDelServidor;\n }\n //* si todo sale bien deberiamos de pintar la consultas y la pintaremos con el html de esa tabla, si esa respuesta es ok es decir es que si tenemos consultas\n //*y esas consultas las vamos a recorrer y vamos a poner una const y la vamos a recorrer con .map y por cada consulta vamos a imprimir consulta y el map recibe un callback y ese callbakc recibira la concatenacion de todo eso\n if (respuesta.ok) {\n //*por cada consulta entonces imprimimos primero el inidce por eso tambien debemos de pasar el indice por donde le paso la consulta para que la recorras\n //*map me devuelve un array de todos los string necesitamos decirle join para que unan todos los string mediante un string vacio osea que no le agregue algo mas al string que simplemente sea un string\n //*haciendo el oppendchild\n veterinarias.forEach((_veterinaria, indice) => {\n const optionActual = document.createElement(\"option\");\n optionActual.innerHTML = `${_veterinaria.nombre} ${_veterinaria.apellido}`;\n optionActual.value = indice;\n //*el select de la veterinaria\n veterinaria.appendChild(optionActual);\n });\n\n //*_veterinaria esto es veterinari local\n //*destructuras la consulta con el fin de obtener la mascota completa pero para no complicar las cosas pondremos consulta.mascota.nombre\n //const htmlMascotas= mascotas.map((mascota, indice)=>\n //`<option value=\"${indice}\" >${mascota.nombre}</option>`\n //).join(\"\");\n //*qu el innerhtml sea igual a los que llegue en html consultas\n\n // mascota.innerHTML += htmlMascotas\n //mascota.appendChild(htmlMascotas);\n }\n } catch (error) {\n console.log({ error });\n $(\".alert-danger\").show();\n }\n}", "function listarTodosPregunta(){\r\n\r\n\tlistarTodosPreguntaGenerico(\"listarTodos\");\r\n\r\n}", "function mostrarArreglo() { //carga en la tabla html los elementos que ya se encuentran \"precargados\" en el arreglo\n for (const pedido of pedidos) {\n mostrarItem(pedido);\n }\n}", "function loadAll() {\n var cidades = eurecaECBrasil.filtrarCidadeTextoService();\n return cidades.split(/, +/g).map( function (cidade) {\n return {\n value: cidade.toLowerCase(),\n display: cidade\n }; \n });\n }", "function obterDoadores(){\n var doadoresUniversal = [];\n for(var i=0; i<goldSaints.length; i++){\n var cavaleiro = goldSaints[i];\n if(cavaleiro.tipoSanguineo === 'O'){\n doadoresUniversal.push(cavaleiro);\n }\n }\n return doadoresUniversal;\n}", "function jogosDaRespawn(){\n let jogos = [];\n\n for (let categoria of jogosPorCategoria) {\n for ( let jogo of categoria.jogos ) {\n if (jogo.desenvolvedora == \"Respawn Entertainment\"){\n jogos.push(jogo.titulo)\n } \n }\n }\n console.log(\"Os jogos da Respawn Entertainment são \" + jogos)\n}", "function listarReceitas(lista){\r\n\r\n var receitas = \"\"; //Variavel para armazenar as receitas\r\n\r\n for(var i = 0; i < lista.length; i++){\r\n receitas += lista[i].nome + \"<br>\";\r\n }//end for\r\n\r\n $(\"#receitas\").html(receitas);\r\n\r\n}//end listarReceitas", "function mostrarResultados(nomesFiltrados){\n ul.innerHTML = [];\n letters.forEach(letra =>{\n let li = document.createElement('li');\n let h5 = document.createElement('h5');\n \n ul.append(li);\n li.classList.add('collection-header');\n li.append(h5);\n h5.innerHTML = `${letra}`;\n \n nomesFiltrados.forEach((nomeFiltrado) => {\n if(letra === nomeFiltrado.letter){\n let liItem = document.createElement('li');\n let aItem = document.createElement('a');\n ul.append(liItem);\n liItem.classList.add('collection-item');\n liItem.append(aItem);\n aItem.href = '#';\n aItem.innerHTML = `${nomeFiltrado.name}`;\n }\n });\n });\n}", "function maartjisTask(maartjesTasks) {\n let body = document.getElementById('body');\n let header = document.createElement('h1');\n let textHeader = document.createTextNode('Lists of Maartjies Task befor Filtered ');\n document.innerHTML = document.getElementById('body').appendChild(textHeader);\n let ul = document.createElement('ul');\n body.appendChild(ul);\n\n for (let val of maartjesTasks) {\n let nameli = document.createElement('li');\n\n let listNod1 = document.createTextNode('Task:' + val.name);\n\n ul.appendChild(nameli);\n document.innerHTML = nameli.appendChild(listNod1);\n\n let durationli = document.createElement('li');\n let listNod2 = document.createTextNode('Duration:' + val.duration);\n\n nameli.appendChild(durationli);\n document.innerHTML = durationli.appendChild(listNod2);\n }\n }", "function listar(ok,error){\n console.log(\"Funcionlistar DAO\")\n helper.query(sql,\"Maestro.SP_SEL_ENTIDAD_FINANCIERA\",[],ok,error)\n}", "function lista_adyacentes(id_nodo, grafo)\n{\nvar lista=new Array();\nvar tam=grafo.length;\n\tfor(var i=0;i<tam;i++)\n\t{\n\t\tif(id_nodo==grafo[i][0])\n\t\t{\n\t\tcopiar_arreglo(lista,grafo[i]);\n\t\treturn lista;\n\t\t}\n\t}\n\tconsole.log(\"arroje error\");\n}", "agregarGastoListado(nombre, cantidad) {\n //const gastosListado = $('#gastos ul');\n const gastosListado = document.querySelector('#gastos ul');\n console.log(gastosListado);\n const li = document.createElement('li');\n li.className = 'list-group.item d-flex justify-content-between align-items-center';\n\n li.innerHTML = `\n ${nombre}\n <span class = \"badge badge-primary badge-pills\"> ${cantidad}</span>\n `;\n\n gastosListado.appendChild(li);\n }", "function usunListeKafelkow() {\n // jest tylko 1 ul (elt 0) w dokumencie\n let listaKafelkow = document.getElementsByTagName(\"ul\")[0];\n listaKafelkow.remove();\n}", "function listDeNombres(list) {\n let nameList =[];\n for (let i = 0; i < list.length; i++) {\n const user = list[i];\n if (user.id > 1) {\n nameList.push(user.name)\n }\n }\n console.log(nameList)\n}", "function listDevises() {\n /*******************************************************************\n ********************************************************************\n ***@GET(admin/devise/list)******************************************\n **********\n ***@return JsonParser***********************************************\n ********************************************************************\n ********************************************************************/\n $http({\n method: 'GET',\n url: baseUrl + 'admin/devise/list',\n data: {},\n headers: { 'Authorization': 'Bearer ' + localStorage.getItem('jeton') }\n }).then(function successCallback(response) {\n $scope.listDevises = response.data.devise_list;\n //console.log(\"La liste de toutes les devises \",$scope.listDevises);\n }).catch(function(err) {\n if (err.status == 500 && localStorage.getItem('jeton') != '' && localStorage.getItem('jeton') != null && localStorage.getItem('jeton') != undefined) {\n deconnectApi.logout(sessionStorage.getItem(\"iduser\")).then(function(response) {\n $location.url('/access/login');\n $state.go('access.login');\n }).catch(function(response) {});\n };\n });\n }", "function deptList() {\n return connection.query(\"SELECT id, dept_name FROM departments\");\n}", "async function obtenerDepartamentos() {\n try {\n let response = await axios.get(URL_departamentos)\n let data = response.data.items\n let result = []\n\n // Opcion por defecto\n result.push(<option value={0} key={0}>Seleccione una Opción</option>)\n \n for (let index in data) { \n result.push(<option value={data[index].codigo} key={data[index].codigo}>{data[index].nombre}</option>)\n }\n setDepartamentos(result)\n \n // Se obtiene el municipio por defecto a partir del departamento por defecto\n recalcularMunicipios()\n\n } catch (error) {\n console.log('Fallo obteniendo los departamentos / municipios' + error)\n } \n }", "function mostrarListadoSaldoConductor(){\n ocultarFormularios();\n \n let sListado = oDGT.listadoSaldoConductor();\n \n document.getElementById(\"areaListado\").innerHTML= sListado;\n document.getElementById(\"titulo\").innerHTML= \"Listado de conductores con saldo pendiente\";\n}", "agregarGastoListado(gastos) {\n this.limpiarHTML();\n //iterar sobre los gastos\n gastos.forEach(gasto => {\n const { cantidad, nombre, id } = gasto;\n\n //Crear un LI\n\n const nuevoGasto = document.createElement('li');\n nuevoGasto.className = 'list-group-item d-flex justify-content-between align-items-center';\n nuevoGasto.dataset.id = id;\n\n //Agregar el HTML gasto\n nuevoGasto.innerHTML = `\n ${nombre}\n <span class=\"gasto\">${cantidad} € </span>`;\n\n //Boton para borrar el gasto\n const btnBorrar = document.createElement('button');\n btnBorrar.classList.add('btn', 'btn-danger', 'borrar-gasto');\n btnBorrar.setAttribute(\"type\", \"button\")\n btnBorrar.innerHTML = 'Borrar &times';\n nuevoGasto.appendChild(btnBorrar);\n\n //Agregar el html\n listado.appendChild(nuevoGasto);\n\n });\n }", "function limpiarListaClientes1() {\n\t\tvar indexCliente = 1; \n\t\tvar indexValidacion = 2; \n\t\t//tomamos la lista actual del rowset \n\t\tvar listaClientes = listado1.datos; \n\t\t//realizamos la tranformaion \n\t\tfor (var i=0; i < listaClientes.length; i++){\n\t\t\tlistaClientes[i][indexCliente] = \"\"; \n\t\t\tlistaClientes[i][indexValidacion] = \"\"; \n\t\t}\n\t\tlistado1.repinta();\n\t\t//focalizo en el primer campo de la lista\n\t\t if (listado1.datos.length > 0) {\n\t\t \t\teval(\"listado1.preparaCamposDR()\");\n\t\t\t\tfocaliza('frmlistado1.Texto1_0',''); \n\t\t }\n\n\t}", "function listarAulas () {\n aulaService.listar().then(function (resposta) {\n //recebe e manipula uma promessa(resposta)\n $scope.aulas = resposta.data;\n })\n }", "function listarEmergencias(){\n \n /*EN LA SIGUIENTE LLAMADA AJAX SE RECUPERAN DATOS DE LAS EMERGENCIAS Y SE AÑADEN COMO CODIGO HTML*/\n $.ajax({\n url:'listarEmergencias.php',\n data:{},\n method:'POST',\n dataType:'json',\n success: function(datosEmergencia){\n for(var i in datosEmergencia){\n /*EL CÓDIGO HTML MOSTRADO TIENE UN TAG DE CLASS=ALTA, \n ESTO DESPLIEGA UN ÍCONO EN EL LISTADO DE LAS EMERGENCIAS, ASOCIADO A LA PRIORIDAD\n DE LA MISMA, ES POR STO QUE SE REALIZAN IF'S CON RESPECTO A LA PRIORIDAD'*/\n if(datosEmergencia[i].priority==\"Alta\"){\n $('#lista-emergencias ul').append('<li value=\"100\" data-lat='+datosEmergencia[i].latitude+' data-long='+datosEmergencia[i].longitude+'><div id=\"contenedor-lista-emergencias\"><div id=\"datos-emergencia\" ><p>Id emergencia: '+datosEmergencia[i].id_emergency+'</p>Dirección: '+datosEmergencia[i].address+'</p></div><div id=\"imagen-prioridad\" class=\"Alta\">'+datosEmergencia[i].priority+'</div></div></li><hr>'); \n \n }\n if(datosEmergencia[i].priority==\"Desconocida\"){\n $('#lista-emergencias ul').append('<li value=\"100\" data-lat='+datosEmergencia[i].latitude+' data-long='+datosEmergencia[i].longitude+'><div id=\"contenedor-lista-emergencias\"><div id=\"datos-emergencia\" ><p>Id emergencia: '+datosEmergencia[i].id_emergency+'</p>Dirección: '+datosEmergencia[i].address+'</p></div><div id=\"imagen-prioridad\" class=\"Desconocida\">'+datosEmergencia[i].priority+'</div></div></li><hr>'); \n \n }\n if(datosEmergencia[i].priority==\"Muy Alta\"){\n $('#lista-emergencias ul').append('<li value=\"100\" data-lat='+datosEmergencia[i].latitude+' data-long='+datosEmergencia[i].longitude+'><div id=\"contenedor-lista-emergencias\"><div id=\"datos-emergencia\" ><p>Id emergencia: '+datosEmergencia[i].id_emergency+'</p>Dirección: '+datosEmergencia[i].address+'</p></div><div id=\"imagen-prioridad\" class=\"MuyAlta\">'+datosEmergencia[i].priority+'</div></div></li><hr>'); \n \n }\n if(datosEmergencia[i].priority==\"Media\"){\n $('#lista-emergencias ul').append('<li value=\"100\" data-lat='+datosEmergencia[i].latitude+' data-long='+datosEmergencia[i].longitude+'><div id=\"contenedor-lista-emergencias\"><div id=\"datos-emergencia\" ><p>Id emergencia: '+datosEmergencia[i].id_emergency+'</p>Dirección: '+datosEmergencia[i].address+'</p></div><div id=\"imagen-prioridad\" class=\"Media\">'+datosEmergencia[i].priority+'</div></div></li><hr>'); \n \n }\n if(datosEmergencia[i].priority==\"Baja\"){\n $('#lista-emergencias ul').append('<li value=\"100\" data-lat='+datosEmergencia[i].latitude+' data-long='+datosEmergencia[i].longitude+'><div id=\"contenedor-lista-emergencias\"><div id=\"datos-emergencia\" ><p>Id emergencia: '+datosEmergencia[i].id_emergency+'</p>Dirección: '+datosEmergencia[i].address+'</p></div><div id=\"imagen-prioridad\" class=\"Baja\">'+datosEmergencia[i].priority+'</div></div></li><hr>'); \n \n } \n \n }\n $('#lista-emergencias ul li').click(function(){\n /*ESTA FUNCIÓN PERMITE QUE AL SELECCIONAR UNA DE LAS EMERGENCIAS DE LA LISTA,\n EL MAPA SE CENTRE CON RESPECTO A LA MISMA*/\n //console.log('lat'+$(this).attr('data-lat')+'long'+$(this).attr('data-long'));\n var lat=$(this).attr('data-lat');\n var long=$(this).attr('data-long');\n map.panTo([lat,long],15,{animation:true});\n map.panBy([-308,0]);\n \n \n });\n \n },\n error: function (xhr, ajaxOptions, thrownError) {\n alert(\"error\"+xhr.status+\"\"+thrownError);\n \n }\n });\n}", "function cargarListaDisfrutadas(){\n\t//Eliminamos el listado para construirlo de nuevo\n\t$('#disfrutadas div[data-role=\"content\"] ul').remove();\n\t$('#disfrutadas div[data-role=\"content\"]').html(\"<ul data-role='listview' data-theme='c'></ul>\");\n\t//Obtenemos los ids almacenados\n\tvar listaItemIds = getListaDisfrutadasIds();\n\tvar code = \"\"; \t\t\n\t// Get the HTML code for the list of items.\t\t\t\t\n\tfor(item in listaItemIds)\n\t{\n\t\tvar jsonData = localStorage.getItem(listaItemIds[item]);\n\t\tif(jsonData)\n\t\t{\n\t\t\tvar data = JSON.parse(jsonData);\n\t\t\tvar html = \"<li id='\" + data.clave + \"'><a id='\" + data.clave + \"' href='#verdisfrutada'>\" + \"<h3>\" + data.fecha + \"</h3>\" + \"<span class='ui-li-count'>\"+ data.tiempoEntrada + \"</span>\" + \"</a></li>\";\t\n\t\t\t $('#disfrutadas div[data-role=\"content\"] ul').append(html);\n\t\t}\n\t}\n\tcargarDatosDisfrutadas(); \n}", "function getDepartamentoEmpleados(id) {\n $http.post(\"Departamentos/getDepartamentoEmpleados\", { id: id }).then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.lista.data = r.data.d.getDepartamentoEmpleados;\n vm.lista.disp = [].concat(vm.lista.data);\n }\n })\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 getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }", "addNuevos(auditorias){\n // al agregar un elemento unico, se debe ubicar: DESPUES de los auditorias sin fecha, y ANTES que los auditorias con fecha\n // buscar el indice del primer inventario con fecha\n let indexConFecha = this.lista.findIndex(aud=>{\n let dia = aud.aud_fechaProgramada.split('-')[2]\n return dia!=='00'\n })\n if(indexConFecha>=0){\n // se encontro el indice\n this.lista.splice(indexConFecha, 0, ...auditorias)\n }else{\n // no hay ninguno con fecha, agregar al final\n this.lista = this.lista.concat(auditorias)\n }\n }", "function obtenerArbolDepartamentos(s, d, e) {\n if(s) {\n $('form[name=frmGestionPerfil] .arbolDepartamento').append(procesarArbolDep(d));\n $('form[name=frmGestionPerfil] .arbolDepartamento').genTreed(); // Añade clases y imagenes a la lista html para hacerla interactiva\n\n $('form[name=frmGestionPerfil] .arbolDepartamento.tree li').dblclick(function (e) {\n let me = $(this);\n $('form[name=frmGestionPerfil] .tree li').each(function () {\n $(this).removeClass('filaSeleccionada');\n });\n me.addClass('filaSeleccionada');\n\n Moduls.app.child.templateParamas.template.Forms.frmGestionPerfil.set({\n p_objtiv: me.attr('id')\n });\n\n $('form[name=frmGestionPerfil] [name=nomdep]').val(me.attr('name'));\n $('form[name=frmGestionPerfil] [name=nomdep]').change();\n $('form[name=frmGestionPerfil] .arbolDepartamento').addClass('dn');\n return false;\n });\n } else {\n validaErroresCbk(d, true);\n }\n}", "function montarLista() {\n $('#listaRedes').html('<div class=\"list-group-item text-secondary\">Conectando...</div>');\n var lista = $(\"#listaRedes\");\n var redesCadastradas = [];\n $.get(\"http://localhost:4567/lote/getall\", (data) => {\n if (data) {\n if (data.length > 0) {\n $('#listaRedes').empty();\n for (var i = 0; i < data.length; i++) {\n var lote = data[i];\n if (lote['status'] == 1) {\n var id_rede = lote['id-rede'];\n criarDiv(id_rede, lote);\n }\n }\n $('#filtrarDiv').show();\n } else {\n $('#listaRedes').html('<div class=\"list-group-item text-secondary\">Nenhum lote cadastrado.</div>');\n $('#dadosLote').empty();\n }\n } else {\n $('#listaRedes').html('<div class=\"list-group-item text-danger\">Não foi possível obter os dados.</div>');\n $('#dadosLote').empty();\n }\n }).done(function (data) {\n\n }).fail(function () {\n $('#listaRedes').html('<div class=\"list-group-item text-secondary\">Erro ao comunicar com o servidor.</div>');\n $('#dadosLote').empty();\n }).always(function () {\n\n });\n}", "get listadoArr () {\n const listadoArreglado = [];\n Object.keys(this._listado).forEach( key => {\n const tarea = this._listado[key];\n listadoArreglado.push(tarea);\n });\n return listadoArreglado;\n }", "function findLists() {}", "function buildListePatrimoine() {\n\n\t$('#liste-fiches-patrimoine li').remove();\n\n\tvar num_row = 1;\n\n\t$.each(fiches_patrimoine, function(index, fiche) {\n\t\t\t\n\t\tvar vignette = '';\n\t\tif(fiche.photos == undefined) {\n\t\t\tconsole.log(fiche.nom);\n\t\t}\n\t\telse if (fiche.photos.length > 0)\n\t\t{\n\t\t\tvignette = serviceURL + 'sitlor/photos_100/'+ fiche.photos[0].src;\n\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvignette = 'img/no-photo.png';\n\t\t}\n\n\t\tvar li = \n\t\t'<li id=\"fiche' + fiche.id + '\" class=\"row' + num_row + '\">' +\n\t \t\t'<a data-transition=\"slide\" href=\"detail-fiche.html?id=' + fiche.id + '\" class=\"clearfix\">' +\n\t \t\t\t'<img src=\"' + vignette + '\" alt=\"lieu\" title=\"lieu\" class=\"vignette-liste\" />' +\n\t \t\t\t'<div class=\"infos\">' +\n\t\t \t\t\t'<h2 class=\"titre\"><span class=\"content\">' + fiche.nom + '</span></h2>' +\n\t\t \t\t\t'<div class=\"distance-ville\">' +\n\t\t\t \t\t\t'<p class=\"distance\">' + fiche.distanceLabel + '</p>' +\n\t\t\t \t\t\t'<p class=\"ville\">' + fiche.ville + '</p>' +\n\t\t \t\t\t'</div>' +\n\t\t\t\t'</div>' +\n\t\t\t'</a>' +\n\t\t'</li>';\n\n\t\tvar $fichesPatrimoine = $('#liste-fiches-patrimoine');\n\t\t$fichesPatrimoine.hide();\n\t\t$('#liste-fiches-patrimoine').append(li);\n\n\t\tnum_row++;\n\n\t\tif (num_row == 5)\n\t\t{\n\t\t\tnum_row = 1;\n\t\t}\n\t});\n}", "agregar_gasto_listado(nombre_gasto, cnt_gasto) {\n const gastos_listado = document.querySelector('#gastos ul'); //donde se va a agregar ese nuevo gasto\n\n //crear li para el gasto\n const li = document.createElement('li');\n li.className = 'list-group-item d-flex justify-content-between align-items-center';\n\n li.innerHTML = `\n ${nombre_gasto}\n <span class = \"badge badge-primary badge-pill\"> $${cnt_gasto} </span>\n `;\n\n //insertar en el ul\n gastos_listado.appendChild(li);\n }", "function construirLista(frutas, tipo) {\n var url_peticion = \"/api/fruta/\";\n var url_apiDelete = \"/api/fruta/\";\n var nombre_tipo = \"\";\n var titulo = \"\";\n switch (tipo) {\n case \"costa\":\n url_peticion = url_peticion + idCategoriaCosta;\n nombre_tipo = \"FrutaCosta\";\n break;\n case \"sierra\":\n url_peticion = url_peticion + idCategoriaSierra;\n nombre_tipo = \"FrutaSierra\";\n break;\n default:\n // code block\n }\n\n\n for (var fruta in frutas[\"frutas\"]) {\n var idFruta = frutas[\"frutas\"][fruta][\"id\"];\n var urlFruta = frutas[\"frutas\"][fruta][\"url\"];\n var nombreFruta = frutas[\"frutas\"][fruta][\"nombre\"];\n var p = $(\"<p></p>\")\n .hide()\n .text(idFruta);\n var div = $(\"<div></div>\");\n\n var imgFruta = $(\"<img></img>\")\n .attr(\"src\", urlFruta)\n .addClass(\"img-fluid\");\n var aFruta = $(\"<a></a>\");\n var imgEdit = $(\"<img></img>\")\n .attr(\"src\", \"./images/BOTONES/EDITAR.png\")\n .attr(\"id\", \"btnEdit\" + nombre_tipo + nombreFruta + idFruta)\n .attr(\"data-value\", idFruta)\n .addClass(\"img-fluid\");\n var aEdit = $(\"<a></a>\")\n .attr(\"href\", \"#divform\");\n var imgDel = $(\"<img></img>\")\n .attr(\"src\", \"./images/BOTONES/ELIMINAR.png\")\n .attr(\"id\", \"btnDel\" + nombre_tipo + nombreFruta + idFruta)\n .attr(\"data-value\", idFruta)\n .addClass(\"img-fluid\");\n var aDel = $(\"<a></a>\")\n .attr(\"href\", \"#\");\n\n var divBoton = $(\"<div></div>\");\n var divFruta = $(\"<div></div>\");\n titulo = nombreFruta;\n var h2 = $(\"<h2></h2>\")\n .text(titulo);\n aFruta.append(imgFruta);\n divFruta.append(aFruta);\n aEdit.append(imgEdit);\n divBoton.append(aEdit);\n aDel.append(imgDel);\n divBoton.append(aDel);\n\n div.append(h2);\n div.append(divFruta);\n div.append(divBoton);\n\n $('#lista' + nombre_tipo).append(div);\n $('#lista' + nombre_tipo).append(p);\n //ELIMINAR\n\n $(\"#btnDel\" + nombre_tipo + nombreFruta + idFruta).on('click', function (e) {\n var id = $(this).data(\"value\");\n $.ajax({\n url: url_apiDelete + id,\n type: 'DELETE',\n success: function (result) {\n location.reload();\n }\n });\n location.reload();\n });\n\n //EDITAR\n $(\"#btnEdit\" + nombre_tipo + nombreFruta + idFruta).on('click', function (e) {\n var id = $(this).data(\"value\");\n console.log(\"clic\" + id);\n contruirForm(nombre_tipo, \"editar\", id)\n });\n };\n}", "function listarConceptos() {\n\tvar contadorconceptos = 0; //contador\n\twhile (contadorconceptos < listaConceptos.length) {\n\t\tlet concepto = listaConceptos[contadorconceptos].concepto;\n\t\tlet categoriaSemantica = listaConceptos[contadorconceptos].categoria_semantica;\n\t\tlet li = document.createElement('li');\n\t\tlet a = document.createElement('a');\n\t\ta.setAttribute('class', 'collection-item');\n\t\ta.setAttribute('nroConcepto', contadorconceptos);\n\t\ta.setAttribute('id', 'concepto' + contadorconceptos);\n\t\ta.setAttribute('concepto', concepto);\n\t\ta.href = '#!';\n\t\ta.addEventListener(\n\t\t\t'click',\n\t\t\tfunction() {\n\t\t\t\tSeleccionarConcepto(a);\n\t\t\t},\n\t\t\tfalse\n\t\t); //llamo a la funcion al clickear\n\t\tlet a_content = document.createTextNode(concepto);\n\t\ta.appendChild(a_content);\n\t\tli.appendChild(a);\n\t\tdiv_conceptos.appendChild(li);\n\t\tcontadorconceptos++;\n\t}\n}", "function formataDados(tipo) {\r\n for (const entry of itens) {\r\n let redator = {\r\n nome: '',\r\n links: [],\r\n };\r\n redator.nome = entry.author[0].name.$t;\r\n\r\n let link = {\r\n titulo: '',\r\n url: '',\r\n tipo: '',\r\n semana: 0,\r\n };\r\n\r\n link.tipo = tipo;\r\n link.titulo = entry.title.$t;\r\n //TODO alterar\r\n jQuery.each(entry.link, function (i, url) {\r\n if (url.rel == 'alternate') {\r\n link.url = url.href;\r\n return false;\r\n }\r\n });\r\n link.data = entry.published.$t;\r\n\r\n verificaRedator = redatores.find(\r\n (redatores) => redatores['nome'] === redator.nome\r\n );\r\n\r\n if (!verificaRedator) {\r\n redator.links.push(link);\r\n redatores.push(redator);\r\n } else {\r\n verificaRedator.links.push(link);\r\n }\r\n }\r\n redatores.sort(ordenaNomesAsc);\r\n}", "function listarInstrutores () {\n instrutorService.listar().then(function (resposta) {\n //recebe e manipula uma promessa(resposta)\n $scope.instrutores = resposta.data;\n })\n instrutorService.listarAulas().then(function (resposta) {\n $scope.aulas = resposta.data;\n })\n }", "function obtenerListadoGastos() {\n let listadoGastos = JSON.parse(localStorage.getItem(\"listado_gastos\"))\n if (listadoGastos == null) {\n listadoGastos = [];\n actulizarLista(listadoGastos)\n }\n return listadoGastos;\n}", "function clienteListo(){\n console.log('se eliminará de la lista al siguinte cliente: ' + clientes[0]);\n clientes.shift();\n console.log('la lista de clientes ahora es: '+ clientes);\n return clientes;\n}", "function listDatas(data) {\r\n\t\t\r\n\t\tfor (var i = 0; i < data.waren.length; i++) {\r\n\r\n\t\t\tfor (var i2 = 0; i2 < data.lg.length; i2++) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\tif(data.waren[i].leergutid == data.lg[i2].id) {\r\n\r\n\t\t\t\t\tproductLg = data.lg[i2].kastenpfand + \"€/\" + data.lg[i2].flaschenpfand + \"€/\" + data.lg[i2].rahmenpfand + \"€\";\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$('.warenCont').first().clone().appendTo('#warenTabelle');\r\n\r\n\t\t\t$('#warenTabelle').find($('.nameValue')[i+1]).text(data.waren[i].ware);\t\r\n\t\t\t$('#warenTabelle').find($('.idValue')[i+1]).text(data.waren[i].id);\r\n\r\n\t\t\tswitch(data.waren[i].isdrink) {\r\n\r\n\t\t\t\tcase \"0\":\r\n\t\t\t\t$('#warenTabelle').find($('.dataValue')[i+1]).attr('data-value', data.waren[i].isdrink).text(\"Leihware\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue1')[i+1]).text(data.waren[i].kistenpreis + \"€\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue2')[i+1]).text(\"Nicht vorhanden\");\r\n\t\t\t\t$('#warenTabelle').find($('.maxFlValue')[i+1]).text(\"Rahmen nicht vorhanden\");\r\n\t\t\t\t$('#warenTabelle').find($('.lgValue')[i+1]).text(\"Dieses Produkt hat keinen Pfand\");\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"1\":\r\n\t\t\t\t$('#warenTabelle').find($('.dataValue')[i+1]).attr('data-value', data.waren[i].isdrink).text(\"Wein, Sekt, Schnaps\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue1')[i+1]).text(data.waren[i].kistenpreis + \"€\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue2')[i+1]).text(\"Nicht vorhanden\");\r\n\t\t\t\t$('#warenTabelle').find($('.maxFlValue')[i+1]).text(\"Rahmen nicht vorhanden\");\r\n\t\t\t\t$('#warenTabelle').find($('.lgValue')[i+1]).text(\"Dieses Produkt hat keinen Pfand\");\r\n\t\t\t\tbreak;\r\n\r\n\t\t\t\tcase \"2\":\r\n\t\t\t\t$('#warenTabelle').find($('.dataValue')[i+1]).attr('data-value', data.waren[i].isdrink).text(\"Getränk\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue2')[i+1]).text(\"Nicht vorhanden\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue1')[i+1]).text(data.waren[i].kistenpreis + \"€\");\r\n\t\t\t\t$('#warenTabelle').find($('.maxFlValue')[i+1]).text(\"Rahmen nicht vorhanden\");\r\n\t\t\t\t$('#warenTabelle').find($('.lgValue')[i+1]).text(\"Dieses Produkt hat keinen Pfand\");\r\n\t\t\t\t$('#warenTabelle').find($('.lgValue')[i+1]).text(productLg);\r\n\t\t\t\tbreak;\r\n\r\n\r\n\t\t\t\tcase \"3\":\r\n\t\t\t\t$('#warenTabelle').find($('.dataValue')[i+1]).attr('data-value', data.waren[i].isdrink).text(\"Kastengetränk\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue1')[i+1]).text(data.waren[i].kistenpreis + \"€\");\r\n\t\t\t\t$('#warenTabelle').find($('.pricesValue2')[i+1]).text(data.waren[i].einzelpreis + \"€\");\r\n\t\t\t\t$('#warenTabelle').find($('.maxFlValue')[i+1]).text(data.waren[i].maxfl);\r\n\t\t\t\t$('#warenTabelle').find($('.lgValue')[i+1]).text(productLg);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t$('.warenCont').first().remove();\r\n\r\n\t\t$('.editBtn').on('touchstart click', editProduct); \r\n\t}", "cousin(liste){ //liste d'objet\r\n\t\tlet save = [];\r\n\t\tliste.map(obj =>{\r\n\t\t\tlet son = this.son(obj);\r\n\t\t\tif (son != undefined){\r\n\t\t\t\tsave = save.concat(son);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t})\r\n\t\t\r\n\t\treturn save;\r\n\t}", "listarPendientesCompletados (completado=true){\n\n //Arreglos para diferenciar tareas completas de pendientes \n const listadoCompletas=[];\n const listadoPendientes=[];\n\n\n //recorridos del listado arreglado \n this.listadoArr.forEach((tarea)=>{\n\n //destructuracion de la tarea, lo que necesito\n const {descripcion, completadoEn} = tarea;\n\n //dependiendo del estado de las tareas las agrego a los arreglos establecidos para cada caso\n (completadoEn)\n ? listadoCompletas.push(tarea)\n : listadoPendientes.push(tarea);\n })\n\n //Separar si quiero ver las completadas o las pendientes\n if(completado){\n\n console.log('');\n\n //recorrido e impresion de las tareas completadas\n listadoCompletas.forEach((tareasCompletadas,i)=>{\n const indice = `${i+1}.`.green;\n const {descripcion, completadoEn} = tareasCompletadas;\n console.log(`${indice} ${descripcion} :: ${completadoEn.green}`);\n })\n } else {\n\n console.log('');\n\n //recorrido e impresion de las tareas pendietes \n listadoPendientes.forEach((tareasPendientes,i)=>{\n const indice = `${i+1}.`.green;\n const {descripcion, completadoEn} = tareasPendientes;\n console.log(`${indice} ${descripcion} :: ${'Pendiente'.red}`);\n })\n }\n }", "function ordenar() {\n let seleccion = $(\"#miSeleccion\").val().toUpperCase();\n popularListaCompleta();\n listaCompletaClases = listaCompletaClases.filter(Clase => Clase.dia ==\n seleccion);\n renderizarProductos();\n}", "function getJoueurListe() {\r\n\trequest(\"GET\", \"admin.php?methode=JOUEUR_liste\" , true, setData);\r\n}", "function seperateList(obj) {\n if (obj.status != \"success\") {\n document.querySelector(\"#content\").innerHTML = \"<p><i>There was a problem!</i></p>\";\n return;\n }\n\n let breedList = Object.keys(obj.message);\n}", "getListName() {}", "async busca_todos_os_dados( caminhoes ){\n const caminhoes_c_dados = Promise.all(\n caminhoes.map( async (item) => {\n\n const caminhao = await connection('fDescarregamento')\n .select('*')\n .where( 'ID', '=', item.ID );\n\n if ( caminhao.length > 0 ){\n const [{ Status, Chegada, Saida, Peso_chegada, Peso_saida, Assinaturas }] = caminhao;\n\n return { ...item, Status, Chegada, Saida, Peso_chegada, Peso_saida, Assinaturas: JSON.parse( Assinaturas ) };\n } else return item;\n\n })\n );\n\n return caminhoes_c_dados;\n }", "function inicioComponenteLista() {\r\n let url = '../server/abmGenerico.php?action=listar';\r\n const lista = getFromServer(url);\r\n}", "function viewDepatments() {\n var query = \"SELECT * FROM DEPARTMENTS\";\n con.query(query, function(err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log(\"\\n\" + \"|| Name: \" + res[i].name + \"|| ID: \" + res[i].id);\n }\n runManager();\n });\n }", "function ListaTipoZona(){\n DoPostAjax({\n url: \"Citas/CtrlCitas/ListarTipoZona\"\n }, function(err, data) {\n if (err) {\n Notificate({\n titulo: 'Ha ocurrido un error',\n descripcion: 'Error con la lista de los tipo de zona.',\n tipo: 'error',\n duracion: 4\n });\n } else {\n let respuesta=JSON.parse(data);\n $(\"#SltComuna\").html(\"<option value='-1'>Seleccione una comuna.</option>\");\n\n for (var val in respuesta) {\n $(\"#SltComuna\").append(\"<option value='\"+respuesta[val].idTipoZona+\"'>\"+respuesta[val].descripcionTipozona+\"</option>\");\n }\n }\n });\n}", "mostraAlunos(dados) {\n console.log(dados)\n // cria uma variavel que ira armazenar todo esse HTML\n let card = ''\n // faz o loop no array dados que armazena as noticias\n dados.alunos.map(function (elemento) {\n // adiciona a variavel card todo o HTML com as informações\n // += serve para adicionar sem sobrescrever\n card += `\n <div class=\"card\">\n <h2>Chamada ${elemento.id}</h2>\n <p>${elemento.name}</p>\n </div>\n `\n });\n\n this.alunos.innerHTML = card\n }", "function agregoServicios() {\n for (let i = 0; i < SERVICIOS.length; i++) {\n document.getElementById(\"otrosservicios\").innerHTML += \"<li>\" + SERVICIOS[i].nombre + \"</li>\"\n }\n}", "function carregaUnidadesSolicitantes(){\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tcarregarListaNaoSolicitantes();\n\tcarregarListaSolicitantes();\n}", "rangoDatos(objeto,f,pg) {\n\t\tlet lista = [];\n\t\t//console.log(objeto);\n\t\tif(objeto==null){\n\t\t\treturn lista;\n\t\t}\n\t\tfor(let i = parseInt(f); i<(parseInt(f)+parseInt(pg)); i++){\n\t\t\tif(objeto.length==i){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tlista.push(objeto[i]);\n\t\t}\n\t\treturn lista;\n\t}", "function cargarSedes() {\n var array = [\"Lima\", \"Santiago\", \"Mexico\", \"Brasil\"];\n // Ordena el Array Alfabeticamente\n array.sort();\n addOptions(\"cboSede\", array);\n }", "function contarAutores() {\n let autores = [];\n for (let categoria of livrosPorCategoria) {\n for (let livro of categoria.livros) {\n if (autores.indexOf(livro.autor) == -1) {\n autores.push(livro.autor);\n }\n }\n }\n console.log('Total de autores: ' , autores.length);\n}", "function list(ctx) {\n $('#contente-list').html('');\n let id = ctx.params.list;\n let nameList = $('#nameList').data('namelist');\n console.log($(this));\n console.log(nameList);\n console.log(id); \n\n /*\n $.get(`https://api.mercadolibre.com/sites/MPE/search?category=${nameList}`, function(data, status) {\n data.results.forEach(element => {\n $('#contente-list').append(` <div class=\"card m-2\" style=\"width: 18rem;\">\n <img class=\"card-img-top\" src=\"${element.thumbnail}\" alt=\"Card image cap\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">S/. ${element.price}</h5>\n <p class=\"card-text\">${element.title}.</p>\n <a href=\"#\" class=\"btn btn-primary\" id=\"btn-pay\">Comprar</a>\n </div>\n </div>`);\n }); \n }); \n */\n}", "asistencia_persona(equipo){\n let len = equipo.length;\n let asistencias = [];\n\n for (var i = 0; i <len; ++i) {\n let asistencia_persona = equipo[i].asistencia;\n asistencias.push(asistencia_persona);\n \n }\n\n return asistencias;\n }", "get listadoArr() { //utilizo un getter para retornar un nuevo arreglo\n\n const listado = []; //este es el arreglo que luego devuelvo con el return\n Object.keys(this._listado).forEach(key => { //El arreglo lo completo con las tareas que carga el usuario\n const tarea = this._listado[key]; //Esta funcion permite retornar todas las llaves que tenga el objeto. Esto crea un arreglo de strings. Con el forEach recorro el array y extraigo cada una de las llaves que estan dentro de _listado. Luego las agrego al array con el .push\n listado.push( tarea )\n\n });\n return listado;\n }", "show () {\n\t\tlet list = [];\n\t\tlet head = this.head;\n\t\twhile (head) {\n\t\t\tlist.push(head.data);\n\t\t\thead = head.next;\n\t\t}\n\t\treturn list;\n\t}", "function infor_pessoa(pessoa) {\n pessoa.dados.forEach(function (item) { return console.log(item); });\n}", "function displayCaddie() {\n let list = \"\";\n\n for (let i = 0; i < productsList.length; i++) {\n // Récupère le produit à l'indice i\n const product = productsList[i];\n\n // si élément actuel ajouté au panier\n // alors on ajoute \"X code\" à la variable list\n\n if(product.total > 0 ){\n list = list + product.total + \" \";\n list = list + product.name + \", \";\n\n }\n\n }\n\n // Parcours tous les éléments du panier\n document.getElementById(\"resultat\").innerHTML = list;\n\n}", "function listContent (geoID) {\r\n var geoIDsansFR = geoID.id.replace(\"id-\",\"\");\r\n var index = -1;\r\n var nameReg = \"Not found\" ;\r\n for (i=0 ; i < dataReg.cumul_par_reg_lasts.length ; i++) {\r\n\r\n if (dataReg.cumul_par_reg_lasts[i].reg_id == geoIDsansFR) {\r\n index = i;\r\n nameReg = dataReg.cumul_par_reg_lasts[i].reg_nom ;\r\n break; \r\n }\r\n }\r\n\r\n if (index != -1) {\r\n var totalDC = dataReg.cumul_par_reg_lasts[index].dc ;\r\n } else {\r\n console.log(\"Erreur: \"+geoIDsansFR+ \" not found\")\r\n }\r\n dcTitle = \"<h2>Mort</h2>\" ;\r\n $(list_title).html(dcTitle);\r\n dcText = nameReg + \" : <em class='num red'>\" + totalDC + \"</em>\" ;\r\n $(geoID).html(dcText);\r\n \r\n}", "function mostrarPaqueteDeOpciones(cliente) {\n return autosDB.filter(auto => (clientePuedePagar(cliente, auto) && !auto.vendido))\n}", "function ExamList() { //Elenco degli esami, nel vettore list\r\n\r\n this.list = [];\r\n\r\n /** 4) ADD -> arrow function, metto in coda al vettore (push) */\r\n\r\n this.add = (exam) => {\r\n this.list.push(exam);\r\n };\r\n\r\n /** 5) FIND -> ritorna l'esame che ha il codice che passo come parametro -> arrow function */ \r\n\r\n this.find = (code) => {\r\n\r\n //filter ritorna un array nuovo con gli elementi che passano il test;\r\n //Dato l'array list, lo filtro così: per ogni corso (course) presente in list, metto come condizione (dopo =>) che il suo codice sia pari a code\r\n //MA....Ritorna Array di corsi con quel codice -> io devo tornare UN esame -> ritorno il primo elemento dell'array, tanto noi sappiamo ogni esame ha code univoco\r\n \r\n return this.list.filter(course => course.code== code)[0];\r\n };\r\n\r\n /** 6) AFTER DATE -> elenco esami dopo una certa data */\r\n this.afterDate =(data) => { //filtro sopra data dell'esame -> course è l'elemento presente in list, seleziono solo elementi con data maggiore a data passata in parametro\r\n\r\n return this.list.filter (course => course.date.isAfter(data));\r\n } \r\n\r\n /** 7) LIST BY DATE -> ritorna un array di esami ordinati per data crescente */\r\n\r\n this.listBydate = () => {\r\n\r\n\r\n // NB sort restituisce la lista originaria ordinata, modifica la lista -> io non voglio quello\r\n //poichè mi dice di restituire UNA copia della lista ordinata, non di ordinarla metto prima [...this.list], che colloca il risultato di list dentro un nuovo array\r\n return [...this.list].sort((a,b) => (a.date.isAfter(b.date) ? 1 : -1)); \r\n //Incresing score quindi metto così prchè se a è inferiore torno -1, quindi se a viene dopo ritorno 1 e viceversa\r\n };\r\n\r\n\r\n /** 8) LIST BY SCORE -> ritorno un array di esami ordinati per voto (DECRESCENTE) */\r\n\r\n this.listByScore = () => {\r\n\r\n\r\n // NB sort restituisce la lista originaria ordinata, modifica la lista -> io non voglio quello\r\n //poichè mi dice di restituire UNA copia della lista ordinata, non di ordinarla metto prima [...this.list], che colloca il risultato di list dentro un nuovo array\r\n\r\n return [...this.list].sort((a,b) => (b.score - a.score));\r\n //eseguo b - a poichè li voglio in ordine DECRESCENTE, \r\n\r\n };\r\n \r\n\r\n /** 9) CALCOLO DELLA MEDIA */\r\n\r\n this.average = () => {\r\n\r\n // V1 prendo la lista dei corsi con tutti gli attributi -> passo a MAP e dico di creare una nuova lista contenente solo SCORE, i voti\r\n //a questo punto applico a catena REDUCE sopra il vettore con solo i voti \r\n // paramentri:(voglio calcolare la somma elementi -> avg, elemento su cui ciclo -> score,salvato dopo map)\r\n //operazione da compiere avg(accumulatore + voto)\r\n \r\n //return this.list.map(voti=> voti.score).reduce((avg,somma) => avg+somma,0 )/(this.list.length);\r\n\r\n\r\n //V2 come prima, ma senza map -> estraggo lo score mentre faccio il reduce\r\n return this.list.reduce((avg, course) => avg + course.score, 0)/this.list.length;\r\n\r\n };\r\n\r\n\r\n\r\n\r\n\r\n}", "function listar(){ \n var dog = JSON.parse(tbDogs[tbDogs.length-1]);\n $(\"#vitrine\").append(\n '<div class=\"resultado-dog\">'+\n '<img class=\"img-dog\" src=\"'+dog.Foto+'\">'+\n '<div class=\"texto-foto '+dog.Cor+' '+dog.Font+'\">'+\n '<span>Raça:</span><span class=\"raca-resultado\">'+dog.Raca+'</span><br>'+\n '<span>Nome:</span><span class=\"nome-resultado\">'+dog.Nome+'</span>'+ \n '</div>'+ \n '</div>')\n \n }", "function createResultList(dta){\nx = 0;\ncontent = \"\";\ndta.forEach(function(element) {\n\t\t\n\t\tcontent += '<div id=\"p'+element['id']+'\" > ';\n\t\tif (null != leaveOfAbsence) {\n\t\tcontent += '<a href=\"#\" onClick=\"leaveOfAbsenceNotice('+element['id']+')\" class=\"navigation waves-effect waves-light teal-text\">';\n\t\t} else {\n\t\tcontent += '<a href=\"#\" onClick=\"absentNotice('+element['id']+')\" class=\"navigation waves-effect waves-light teal-text\">';\n\t\t}\n\t\tcontent += element['name']+', ' \n\t\t+ element['vorname'] + '( '\n\t\t+ element['klasse'] \n\t\t+')</a></div>'\n\t\t//+'<div id=\"'+element['name']+'\"></div></div>';\n\t\t\n\t\tx++;\n\t\t});\t\n\treturn content;\n}", "function listarReceitasPossiveis(receitas,ingredientes){\r\n\r\n var receitasPossiveis = \"\";\r\n\r\n for(var i = 0; i < receitas.length; i++){ // Itera entre as receitas\r\n \r\n var possivel = 0; //Variavel que diz se e possivel ou nao fazer a receita\r\n\r\n for(var j = 0; j < receitas[i].ingredientes.length; j++){ // Itera entre os ingredientes das receitas\r\n for(var k = 0; k < ingredientes.length; k++){ // Itera entre os ingredientes possiveis\r\n\r\n if(receitas[i].ingredientes[j].nome == ingredientes[k].nome){\r\n if(receitas[i].ingredientes[j].quantidade <= ingredientes[k].quantidade) {\r\n possivel++;\r\n }\r\n }\r\n\r\n }//end fork\r\n }//end forj\r\n\r\n if(possivel > 0){receitasPossiveis += receitas[i].nome + \"<br>\";}\r\n\r\n }//end fori\r\n\r\n $(\"#receitasPossiveis\").html(receitasPossiveis);\r\n\r\n}//end listarReceitasPossiveis", "function cargar_enfermedades() {\n var array = ['Hepatitis C', 'Artritis idiopática juvenil', 'Fibrosis quística', 'Cáncer gástrico', 'Esquizofrenia', 'Diabetes Mellitus tipo I', 'Hemofilia', 'Gran quemado', 'Lupus eritematoso sistémico', 'Retinopatía del prematuro'];\n array.sort();\n addOptions(\"enfermedad\", array);\n}", "function afficherParties(){\n var liste = $('#parties ul')\n , content = 'Aucune partie'\n , i;\n // si aucune partie dans la liste\n if(parties.length == 0){\n liste.html(content);\n } else {\n content = '';\n for(i = 0; i < parties.length; i++){\n content += '<li>'+ parties[i] +'</li>';\n } \n liste.html(content);\n }\n }", "function carregarListaSolicitantes(){\n\tdwr.util.useLoadingMessage();\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tFacadeAjax.getListaSolicitantes(unidade, function montaComboUnidadeTRE(listBeans){\n\t\tDWRUtil.removeAllOptions(\"comboUnidadesSolicitantes\");\n\t\tDWRUtil.addOptions(\"comboUnidadesSolicitantes\", listBeans, \"idUnidade\",\"nome\");\n\t});\n}", "function empezarDibujo() {\n pintarLinea = true;\n lineas.push([]);\n }", "function printLexemesInList(list) {\n sessionService.getSession().then(function (session) {\n var config = session.projectSettings().config;\n var ws = config.entry.fields.lexeme.inputSystems[1];\n var arr = [];\n for (var i = 0; i < list.length; i++) {\n if (angular.isDefined(list[i].lexeme[ws])) {\n arr.push(list[i].lexeme[ws].value);\n }\n }\n\n console.log(arr);\n });\n }", "function cargarListado() { \r\n\r\n if (localStorage.getItem(\"Listado\") != null) {\r\n \t\r\n var Listado = JSON.parse(localStorage.getItem(\"Listado\")); //Este parse? TAREA: lean de parse y stringify tambien y de JSON.algo \r\n\r\n for (var i = 0; i < Listado.length; i++) {\r\n \r\n var elementoLI = Listado[i]; // el elementoLI es un objeto, no olvidar.\r\n\r\n // En el fondo, leemos todo lo almacenado y vamos automáticamente generando los <li> con la función inventada para eso.\r\n nuevaEntradaEnLista(elementoLI.elemento, elementoLI.borrable);\r\n }\r\n }\r\n}" ]
[ "0.6674509", "0.6460851", "0.6407208", "0.6366784", "0.6306566", "0.6185598", "0.6102222", "0.60410565", "0.60213345", "0.6008032", "0.6004217", "0.5990757", "0.598904", "0.5979011", "0.5972526", "0.59663796", "0.5965407", "0.5961293", "0.59405625", "0.5921241", "0.59082425", "0.5890163", "0.5871939", "0.58492666", "0.58440745", "0.58400357", "0.58394736", "0.5825691", "0.58233434", "0.5819561", "0.5816941", "0.58097917", "0.5802959", "0.57996273", "0.5793574", "0.5792256", "0.5785782", "0.578506", "0.5774998", "0.577015", "0.57698023", "0.57577807", "0.57561594", "0.57379174", "0.5728397", "0.57235056", "0.5711657", "0.5706247", "0.5703565", "0.57018435", "0.56949764", "0.5690877", "0.5689985", "0.56890297", "0.5676097", "0.56638247", "0.56593317", "0.56515545", "0.565127", "0.56442714", "0.56387323", "0.56327647", "0.56304526", "0.5627147", "0.5620437", "0.56098354", "0.56096673", "0.5603962", "0.5598713", "0.5595082", "0.5587612", "0.55824184", "0.5577536", "0.5577458", "0.5576279", "0.5571299", "0.55622655", "0.55605656", "0.5559471", "0.55593455", "0.55538344", "0.5553676", "0.55517024", "0.5551695", "0.5538598", "0.5535502", "0.55343276", "0.5530739", "0.5523463", "0.550043", "0.549591", "0.5475711", "0.54756373", "0.5474014", "0.54725945", "0.5471706", "0.5470442", "0.54691494", "0.5466236", "0.54640675", "0.54628557" ]
0.0
-1
Buscar un numero de cheque en especifico en listado de documentos
function byNoCheque(NoCheque) { var deferred = $q.defer(); all().then(function (data) { var result = data.filter(function (registro) { return registro.cheque == NoCheque; }); if(result.length > 0) { deferred.resolve(result); } else { deferred.reject(); } }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function contLike(elNum,elId){\nvar igualC = document.getElementById(arrComentarios.length + 1).value;\t\nvar contadorAux = document.getElementById(\"num\");\n\nconsole.log(contadorAux);\n\nvar recorreLike = arrComentarios.filter(function(c){\n\treturn c.id = igualC;\n})\n\t\tvar elNum = parseInt(elNum);\n\t\tvar contador = elNum + 1;\n\n\n\treturn contadorAux.innerHTML = \" \" + contador;\n}", "function DocumentoByCheque(NoCheque) {\n var deferred = $q.defer();\n var doc = NoCheque != undefined? NoCheque : 0;\n\n $http.get('/desembolsojson/?nocheque={NoCheque}&format=json'.replace('{NoCheque}', doc))\n .success(function (data) {\n deferred.resolve(data);\n });\n\n return deferred.promise;\n }", "async function getCancha(numero) {\n const connectionMongo = await connection.getConnection();\n numero = parseInt(numero);\n const cancha = await connectionMongo\n .db('canchitAppDB')\n .collection('canchas')\n .findOne({ numero: numero });\n await connectionMongo.close();\n\n return cancha;\n}", "contaGoleiro(){\n let contador = 0;\n\n sorteio.selectJogadoresConfirmados().filter(function(e){\n if(e.goleiro){\n contador++;\n }\n });\n\n return contador;\n }", "function indexCalculator(number){\n /*\n for(let i = 0; i < products.length; i++){\n if( products[i].productNo == number) return i;\n }\n */\n let currProduct = products.find(object => object.productNo === displayNum.innerHTML);\n return products.indexOf(currProduct);\n}", "function obtenerMenorNumero(numeros){\n let menorNumero = numeros[0];\n for (let i = 0; i<numeros.length ; i++){\n if( numeros[i] < menorNumero){\n menorNumero = numeros[i];\n }\n }\n\n return menorNumero;\n}", "get(num) {\n let nodeToCheck = this.head;\n let count = 0;\n \n if(num > this.length) return \"Doesn't Exist!\"\n \n while(count < num) {\n nodeToCheck = nodeToCheck.next;\n count++;\n }\n \n return nodeToCheck;\n }", "function BuscarIndiceAnuncio(id){\n //Validar datos\n for(let i=0; i<listaAnuncios.length; i++){\n if(listaAnuncios[i].id == id)\n return i;\n }\n \n return -1;\n}", "function findIndexById(check){\n // Loop through until we find id that matches the check\n for(let i = 0; i < toDos.length; i ++) {\n if (toDos[i].id === parseInt(check)) {\n return i;\n }\n }\n return false;\n}", "function buscador (documento,valor){ //documneto a ser buscado e o que buscar\n let teste\n db.collection(documento).get().then((querySnapshot) => {\n querySnapshot.forEach((doc) => {\n // console.log(`${doc.id} => ${doc.data().nome}=>${doc.data().endereço}=>${doc.data().observacao}`)\n if (valor == doc.id) {\n result.innerHTML = `<h3>fone:${doc.id} <br>nome: ${doc.data().nome}<br> endereço:${doc.data().endereço}<br>obs:${doc.data().observacao}</h3>`\n teste = 1\n } else {\n if (teste != 1) {\n result.innerHTML = `<h3>nada encontrado</h3>`\n }\n }\n\n })\n})}", "function comprobacion(e) {\n\t var numeros=\"0123456789\";\n\nfunction tiene_numeros(texto){\n for(i=0; i<texto.length; i++){\n if (numeros.indexOf(texto.charAt(i),0)!=-1){\n \t//si retorna 1 es que encontro numeros en el texto\n return 1;\n }\n }\n //si retorna 0 solo contiene letras\n return 0;\n}\n}", "function obtenerNombreMarcador(marcador){\n\t\tvar idLeaflet = marcador['_leaflet_id'];\n\t\tfor (var i in markers){\n\t\t\tconsole.log(markers[i]);\n\t\t\tconsole.log(i);\n\t\t\tif(idLeaflet == markers[i]['_leaflet_id'])\n\t\t\t\treturn i;\n\t\t}\n\t\treturn null;\n\t}", "LanzarBomba(num){\n return this.bomba[num];\n\n }", "function choose(number){\n\tPERSONAJE = number;\n}", "function setContadorDocumentos(data) {\n $(\"#spanNumDocumentos\").text(data);\n }", "function rowOfDocId(){ \n var sourcesheet = SpreadsheetApp.openById('1WQBEVDTyK8XvTG5BkMJMbqWMyKTf3aYuFjCQPuc23GI').getSheetByName('Client Master List');\n var sourcevalues = sourcesheet.getDataRange().getValues();\n var companynumber = ActiveCompanyNumber();\n \n for (var i = 0; i < sourcevalues.length;i++){\n for (var j = 0; j < sourcevalues[i].length; j++){\n if(sourcevalues[i][j] == companynumber){\n\n return i+1;\n }\n }\n }\n}", "function soma(nnumero){\r\n let cont = 0;\r\n for (let num of numeros){\r\n cont = cont +num\r\n }\r\n return soma \r\n }", "function getDbNumber(db) {\n docUrl = cloudant_url + '/_dbs/_all_docs?include_docs=true';\n ajaxGet(docUrl, parse);\n\n function parse(data) {\n var myData = JSON.parse(data);\n var o = 0;\n while(myData.rows[o].doc._id != db) {\n o++;\n }\n getShards(myData.rows[o].doc);\n }\n }", "function doSearch(req, res, Prescription, depth){\n Prescription.find().sort('+number').exec(function (err, prescriptions) {\n\n });\n}", "function retrieveNoteId() {\n let noteObject = getExistingNotes()\n if (!noteObject) {\n return 1\n }\n\n const keysArray = Object.keys(noteObject)\n const numberKeys = keysArray.map((key) => Number(key))\n console.log(numberKeys)\n return numberKeys.length + 1\n}", "function remplirLesDonnees(data) {\n lesDocuments = data.lesDocuments;\n for (const documents of lesDocuments){\n afficherDocument(documents)\n }\n}", "function pvrInvoiceNumber(jsonInvoice) {\n var prefixLength = jsonInvoice[\"document_info\"][\"number\"].indexOf('-');\n if (prefixLength >= 0) {\n return jsonInvoice[\"document_info\"][\"number\"].substr(prefixLength + 1);\n }\n return jsonInvoice[\"document_info\"][\"number\"]\n}", "function presionarNumero(numero){\n console.log(\"numero\",numero)\n\n calculadora.agregarNumero(numero)\n actualizarDisplay()\n}", "function getArticlesNum(path) {\n return ArticleModel.find({ path: { $regex: '\\^' + path } })\n .then((articles) => { \n return articles.length;\n });\n}", "function getNumero(){\r\n var numero= \"<inconnu>\"; \r\n try{\r\n var numero = tags(id(\"editionNumber\"),'span')[0].lastChild.nodeValue\r\n } catch (e) { }\r\n return numero;\r\n }", "function obtener_ultimo_folio() {\n var consulta = conexion_ajax(\"/servicios/dh_cursos.asmx/Obtener_ultimo_folio\")\n $(\"#folio_curso\").val((consulta+1))\n}", "static getNextNumber(server) {\t\n\t\tlet dir = `./polls/${server}`;\n\t\tif (!fs.existsSync(dir))\n\t\t\tfs.mkdirSync(dir);\n\n\t\tlet fileList = fs.readdirSync(dir);\n\t\tfor (let i = 0; ; i++) {\n\t\t\tif (!fileList.includes(`${i}.json`))\n\t\t\t\treturn i;\n\t\t}\n\t}", "function numero(key){\n\tif(respuesta == key){\n\n\t\tmostrarMensaje(\"../../imagen/icon/exito.png\",\"matematica/felicitaciones.webm\",\"../../audio/efecto_sonido/felicitaciones.ogg\");\n\n\t\tfin = getActual();\t\n\n\t\tanotarDesempeno();\n\n\t\tsetTimeout(function(){\n\t\t\tcargarActividad();\n\t\t\t$(\"#campoRespuesta\").val(\"\");\n\t\t}, 3000);\n\n\t\t$(\"#intentoCont\").val(0);\t\t\t\n\t}\n\telse{\n\t\tmostrarMensaje(\"../../imagen/icon/fracaso1.png\",\"matematica/error_repetir.webm\",\"../../audio/efecto_sonido/error_repetir.ogg\");\n\n\t\t$(\"#intentoCont\").val( parseInt($(\"#intentoCont\").val()) + 1 );\n\t}\n}", "function Cletras (cadena){\n var numeroL = eliminarespacios(cadena).length;\n return (\"3.- Numero de Letras: \"+numeroL);\n}", "function etsiSuurinId(joukkueet) {\n let suurinId = joukkueet[0].id;\n for (let i in joukkueet) {\n if (suurinId < joukkueet[i].id) {\n suurinId = joukkueet[i].id;}\n \n }\n return (suurinId + 1);\n}", "function getOrderNo(req, res) {\n serviceOrder.count({ companyId: req.body.companyId }).exec(function (err, result) {\n if (err) {\n res.json({ code: Constant.ERROR_CODE, message: Constant.INTERNAL_ERROR });\n }\n else {\n res.json({ code: Constant.SUCCESS_CODE, orderNo: 'SO-' + parseInt(100000 + result + 1) });\n }\n });\n}", "function namesNumber(name) {\n console.log(name);\n }", "function checkNumSeguidores(node){\r\n return node.num_followers >= document.getElementById('num_followers').value;\r\n}", "function nombre_alumno(num){\n\t\treturn alumnos[num].nombre;\n\t}", "function findBookIndexFromTheSite(shortBookName) {\n let books = [];\n for (let i = 2; i <= 67; i++) {\n books.push(\n document.querySelector(`#search-tips-table > tbody > tr:nth-child(${i})`)\n .innerText\n );\n }\n var shortBooks = books.map((a) => a.split(\"/\")).map((b) => b[1].trim()); //get the handles\n //var shortBooks = books.map((a) => a.split(\"/\")).map((b) => b[0].trim()); //get the full name\n return shortBooks.indexOf(shortBookName) + 1;\n}", "function indexPrioridadeMotoboy(loja, indexMotoboy) {\n if(indexMotoboy && indexMotoboy + 1 < lojas[loja].motoboysComPrioridade) {\n indexMotoboy += 1\n return indexMotoboy\n }\n else {\n return 0\n }\n}", "function getCardByNum(num) {\n //serarch the cards array and get the one with the index equal to num\n for (let i = 0; i < boardCards.length; i++) {\n if (boardCards[i].index === num) return boardCards[i];\n }\n return null;\n}", "function validarCliente(number) {\n var validacion = \"\";\n for (var cliente of clientes) {\n if (number == cliente.numero) {\n validacion = true;\n }\n }\n return validacion;\n}", "setQtd(){\n let contador = 0;\n\n sorteio.selecionaJogadores().filter(function(e){\n if(e.confirmado){\n contador++;\n }\n });\n\n document.getElementById(\"qtd\").innerHTML = contador;\n \n }", "function getName(incrementor){\n\t{for(item of newList.itemList){\n\t\tif(item.name >= incrementor){\n\t\t\tincrementor = item.name + 1;\n\t\t\t}\n\t\t}\n\t}\n\treturn incrementor;\n}", "function getbook(booktitle,bauthor)\n {\n for(var i=0;i<allBooks.length;i++)\n {\n if(allBooks[i].btitle==booktitle&&allBooks[i].author==bauthor)\n {\n return i;\n }\n }\n return -1;\n\n }", "afficherAvecLimit(lm) {\n return mongoose.model('Publicite')\n .find()\n .limit(lm)\n .exec()\n .then((err,projet)=> console.log(projet));\n }", "afficherAvecLimit(lm) {\n return mongoose.model('Article')\n .find()\n .limit(lm)\n .exec()\n .then((err,projet)=> console.log(projet));\n }", "async function getUnitNum(){\n await db.collection(\"Office\").doc(\"officeView\").get().then(function(doc){\n if (doc.exists) {\n var keys = Object.keys(doc.data())\n if(keys.length > 1 && tempUnits.length == 0){\n tempUnits.push(++(keys[keys.length - 2]))\n }\n else{\n if(tempUnits.length == 0)\n tempUnits.push(100)\n else\n tempUnits.push((tempUnits[0])++)\n }\n } else {\n // doc.data() will be undefined in this case\n console.log(\"No such document!\");\n }\n }).catch(function(error) {\n console.log(\"Error getting document:\", error);\n })\n}", "function getSerialNumber() {\n let filesInDir = fs.readdirSync(\n `${__dirname}/../documents/storage`,\n (err, files) => {\n if (err) res.status(500).send(err);\n }\n );\n\n filesInDir = filesInDir.filter(file => {\n return file != DS_Store; // in order to ignore the '.DS_Store' file\n });\n\n for (let i = 0; i < filesInDir.length; i++)\n filesInDir[i] = filesInDir[i].slice(0, -4);\n\n return filesInDir.length === 0 ? 0 : Math.max(...filesInDir);\n}", "function productNum() {\n let s = document.URL; //Tallentaa nykyisen URL:in\n s = s.slice(-2); //Ottaa URL:ista kaksi viimeistä merkkiä\n s = s.replace('#', ''); //Jos yksi niistä on \"#\", poistaa sen\n\n return Number(s); //Palauttaa index numeron\n}", "async function GetNotasDeMateriaId(estudiante, materia) {\n return db.collection('materia').where('estudiante', '==', estudiante)\n .where('materia', '==', materia).get().then(snapshot => {\n return snapshot.docs.map(doc => doc.data().id);\n })\n}", "selecionarProduto() {\n cy.get('#\\\\31 37012_order_products').select('7')\n }", "function cargarNumeroCH(){\n\t//debugger;\n\tvar usuario_nombre = (localStorage.getItem(\"Usuario_Actual\")) + \"chambas\";\n\tvar listClient =JSON.parse(localStorage.getItem(usuario_nombre));\n\tif(listClient == null){\n\t\tvar numeroCha = 0;\n\t\tdocument.getElementById(\"numero\").setAttribute(\"value\", numeroCha);\n\t}else{\n\t\tvar numeroCha = listClient.length;\n\t\tdocument.getElementById(\"numero\").setAttribute(\"value\", numeroCha);\n\t}\n\t\n}", "function proximoRegistro() {\n let ultimo = personas.find((x) => x.id === personas.length);\n let registro = ultimo.id + 1;\n return registro;\n}", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "function whatCategory(num, cat) {\n for(var i = 0; i < cat.categories.length; i++) {\n if(cat.categories[i].id === num) {\n return cat.categories[i].name\n }\n }\n}", "function findVehiculo(dominio) {\n\t\tlet vehicle;\n\t\tfor (let i = 0; i < vehiculos.length; i++) {\n\t\t\tif (dominio === vehiculos[i][\"dominio\"]) {\n\t\t\t\tvehicle = i;\n\t\t\t}\n\t\t}\n\t\treturn vehicle;\n\t}", "function findVehiculo(dominio) {\n\t\tlet vehicle;\n\t\tfor (let i = 0; i < vehiculos.length; i++) {\n\t\t\tif (dominio === vehiculos[i][\"dominio\"]) {\n\t\t\t\tvehicle = i;\n\t\t\t}\n\t\t}\n\t\treturn vehicle;\n\t}", "function findQty(itemNumber, items) {\n var targetedNumber = items.filter((item) => item.itemNumber === itemNumber);\n return targetedNumber;\n }", "function setCajasDefault(num) {\n for (var i = 0; i < self.datosProyecto.businesModel.length; i++) {\n var cajas = [];\n for (var x = 0; x < num; x++) {\n var idContador = x + 1;\n var caja = {\n id: idContador,\n titulo: \"\",\n descripcion: \"\",\n color: \"#bad9f9\",\n textoCheck: \"\"\n };\n cajas.push(caja);\n }\n self.datosProyecto.businesModel[i].cajas = cajas;\n }\n}", "function cargarNumeroCL(){\n\t//debugger;\n\tvar usuario_nombre = (localStorage.getItem(\"Usuario_Actual\")) + \"clientes\";\n\tvar listChamba =JSON.parse(localStorage.getItem(usuario_nombre));\n\tif(listChamba == null){\n\t\tvar numeroCli = 0;\n\t\tdocument.getElementById(\"numero\").setAttribute(\"value\", numeroCli);\n\t}else{\n\t\tvar numeroCli = listChamba.length;\n\t\tdocument.getElementById(\"numero\").setAttribute(\"value\", numeroCli);\n\t}\n\t\n}", "function getENumber(ele) {\n return parseInt($(ele).attr(HTML_NAME).slice(1));\n}", "function kerko( vektor, vlera )\n{\n\tfor( var i = 0; i < vektor.length; i++ )\n\t\tif( vektor[ i ] == vlera )\n\t\t\treturn i;\n\n\t\treturn null;\n}", "function getIndiceDeLogro() {\n 'use strict';\n var indicelogro = 1, theForm = document.forms.cakeform, densidadSelec = theForm.elements.indicelogro;\n indicelogro = porcen_indice_logro[densidadSelec.value];\n return indicelogro;\n}", "function generaNumeroCasuale (){\n return numero = Math.floor(Math.random()*100);\n}", "function busquedaPrincipalPorDefecto(){\n construirFiltros(\"HideDuplicateItems\", \"true\");\n buscarPorClave(\"Deporte\",12,1);\n search(\"Sports\",null,1,\"customerRating\",\"desc\",12);\n}", "function getVisita(num) {\n var url = '/Visita/List/' + num + '/' + visita.rowSize;\n $.get(url, function (data) {\n $('.content').html(data);\n })\n }", "function getSubcategoriesNum(path) {\n return CategoryModel.find({ path: { $regex: '\\^' + path } })\n .then((categories) => categories.length);\n}", "buscarNodo(dato){\n if (this.tamanio == 0){\n console.log(\"No hay elementos en la lista.\")\n } else{\n let isEncontrado = false\n let aux = this.primero\n while(aux != null){\n if (aux.dato == dato){\n isEncontrado = true\n return aux.id \n }\n aux = aux.siguiente\n }\n\n if (isEncontrado == false){\n console.log(\"El elemento no se encuentra\")\n alert(\"El dato no se encuentra en la lista.\")\n }\n }\n }", "function cargarNumeroI(){\n\t//debugger;\n\tvar usuario_nombre = (localStorage.getItem(\"Usuario_Actual\")) + \"invoices\";\n\tvar listInvoices =JSON.parse(localStorage.getItem(usuario_nombre));\n\tif(listInvoices == null){\n\t\tvar numeroInv = 0;\n\t\tdocument.getElementById(\"numero\").setAttribute(\"value\", numeroInv);\n\t}else{\n\t\tvar numeroInv = listInvoices.length;\n\t\tdocument.getElementById(\"numero\").setAttribute(\"value\", numeroInv);\n\t}\n\t\n}", "function getLastIdInDom(){\n lastID=-1;\n const listeChildren=document.querySelector('#liste').children;\n for(domPostit in listeChildren){\n if(lastID<parseInt(domPostit.id.substring(7)))\n {\n lastID=domPostit.id.substring(7);\n }\n }\n}", "function getItemNum (url) {\n return url.substr (url.lastIndexOf('/')+1, url.length-1);\n}", "function getFirstUniqueIndex() {\n for(var i = 1; i < Number.MAX_VALUE; i++) {\n if(!document.querySelector('.image_wrap .image_con > .image_pin[data-pin-index=\"' + i + '\"]')) {\n return i;\n }\n }\n }", "function obtenerNumeroDigitado(botonDigitado) {\n return botonDigitado[1];\n}", "function calculateNumber() {\n ShipElementModel.find({}, (err, arr) => {\n number = arr.length\n })\n}", "function num(numero){\n document.calculadora.visor.value += numero;\n}", "function getNumClass(num) {\n var numToWords = ['empty', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight'];\n return numToWords[num];\n\n}", "function getTheListItem(num1,num2) {\n let listItem = document.querySelector(\"#myPage ul:nth-child(\"+num1+\")\");\n return listItem.querySelector(\"ul li:nth-child(\"+num2+\")\");\n}", "function getEmpty(){\n\n for(var i = 1; i<= 16; i++){\n var ruutu = $(\".\"+i);\n \n if(ruutu.text() === \"\"){\n return (i);\n }\n }\n \n \n }", "get findLimit(){ return this._findLimit()}", "function getAdmDocNumber(itemId) {\n\tif (itemId != undefined)\n\t\treturn itemId.substr(5, 9);\n\telse return \"\";\n}", "function numberLine(data){\n\tline = data.nb;\n\tdocument.getElementById(\"NombreTournage\").innerHTML=line;\n}", "_getTheIndex(type) {\n switch (type) {\n case \"publications\":\n return 0;\n case \"conference paper\":\n return 1;\n case \"report\":\n return 2;\n case \"article\":\n return 3;\n }\n }", "function getNumero(numero) {\n if (numero === void 0) { numero = 12; }\n return 'el numero es ' + numero;\n}", "function selectionIndex(passage) {\n var selection = $(passage).find('#selection .word');\n var startId = $(passage).find('.word').index(selection.first());\n if(selection.length == 1) { // single word\n return startId;\n } else { // range of words\n return startId + \"-\" + (startId + selection.length - 1);\n } \n }", "function getCuponesPorIndustria(idIndustria){\n\t\n}", "function takeANumber(katzDeliLine,name){\n katzDeliLine.push(name);\n return `Welcome, ${name}. You are number ${katzDeliLine.indexOf(name) + 1} in line.`\n}", "function SearchBy(omodel, _comptenumber) {\n var getquery = omodel.findOne(({ _id: _comptenumber }), {});\n return getquery;\n}", "getCategoryNumber(category){\n for(let i = 0; i < json.jsonArray.length; i++){\n if(json.jsonArray[i].key === category){\n return i;\n }\n }\n }", "function getIdentifierCountForCreator(creator, callback) {\n var reqPath = 'https://archive.org/advancedsearch.php?q=creator:' + creator + '&fl%5b%5D=numCount&output=json';\n request(reqPath, function (err, response, body) {\n var resJson = JSON.parse(response.body);\n var numFound = resJson.response.numFound;\n callback(numFound);\n });\n}", "function listAllIdWith(value){\n return $q.when(db.allDocs({\n include_docs: true,\n startkey: value,\n endkey: value + '\\uffff'\n }));\n }", "function findN(number,num){\n const result1=number.find(function(n)\n{\n return n > num\n})\nreturn result1\n}", "function fetchGroupNum(){\n db.get('decision/'+groupNumber).then(function(doc){\n console.log(doc);\n chosenNumber = doc.location;\n $('#location'+chosenNumber).show();\n attachNotes();\n });\n\n}", "findIndex(elementos, clave) {\n for (var i = 0; i < elementos.length; i++) {\n if (elementos[i].clave == clave)\n return i;\n }\n return -1;\n }", "function aumenta(str,n){\n //prendo l'elemento e un numero (1 o -1)\n var x = document.getElementById(str);\n //se il n==1 allora devo incrementare il valore dell'elemento \n if(n==1){\n x.value++;\n }\n //se n==-1 devo decrementare il valore dell'elemento\n if(n==-1){\n x.value--;\n }\n //controllo che il valore non sia <0, se diventa minore di 0 allora lo pongo a zero\n if(x.value<0) x.value=0;\n //siccome ho cambiato il valore richiamo la funzione conta per aggiornare i valori \n conta();\n}", "function bajarNota(url, orden, siguienteID, listaID) {\n \n lista = listaID;\n\n notaID = url;\n if(siguienteID>=0){\n \n \n ordenViejo =parseInt(orden);\n ordenNuevo =parseInt(ordenViejo+1);\n \n $.ajax({\n url: 'php/notas.php',\n data: {\n notaID: notaID,\n funcion: \"sorteable\", \n notaIDanterior: siguienteID,\n ordenNuevo: ordenNuevo,\n ordenViejo: ordenViejo\n \n \n },\n type: 'get',\n context: document.body,\n success: function (data) {\n actualizarLista(data);\n }\n });\n }\n}", "function listContent (geoID) {\r\n var geoIDsansFR = geoID.id.replace(\"id-\",\"\");\r\n var index = -1;\r\n var nameReg = \"Not found\" ;\r\n for (i=0 ; i < dataReg.cumul_par_reg_lasts.length ; i++) {\r\n\r\n if (dataReg.cumul_par_reg_lasts[i].reg_id == geoIDsansFR) {\r\n index = i;\r\n nameReg = dataReg.cumul_par_reg_lasts[i].reg_nom ;\r\n break; \r\n }\r\n }\r\n\r\n if (index != -1) {\r\n var totalDC = dataReg.cumul_par_reg_lasts[index].dc ;\r\n } else {\r\n console.log(\"Erreur: \"+geoIDsansFR+ \" not found\")\r\n }\r\n dcTitle = \"<h2>Mort</h2>\" ;\r\n $(list_title).html(dcTitle);\r\n dcText = nameReg + \" : <em class='num red'>\" + totalDC + \"</em>\" ;\r\n $(geoID).html(dcText);\r\n \r\n}", "function nbListeExamenBio () {\n\treturn $(\"ExamensBiologiques\").length;\n}", "function indexDocument(){\n document.getElementById('response-box').innerHTML = \"\";\n var input_id = document.getElementById('input_doc_id').value;\n //get the paragraph number document_id to index parahs\n var c = document_id[input_id];\n if(input_id==\"\"){\n document.getElementById('response-box').innerHTML = \"Enter some id to index\";\n } else if(c===undefined){\n document.getElementById('response-box').innerHTML = \"No such document\";\n }\n else {\n document.getElementById('response-box').insertAdjacentHTML('beforeend', input_id+\": \" + parahs[c]);\n }\n}", "function DOCSEnh2Num(filename) {\n\t var docnum = 0;\n\t var c = \"\";\n\t var numbersRegex = /[0-9]/;\n\t var lettersRegex = /[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/;\n\t \n\t // Calculate doc number from characters\n\t for (j = 1; j < filename.length+1; j++){\n \tdocnum *= 36;\n \tc = filename.slice(j-1,j).toUpperCase();\n \tif (!!numbersRegex.test(c)) {\n\t\t\t\tdocnum += Number(c);\n }\n\t\t\telse if (!!lettersRegex.test(c)) {\n\t\t\t\tdocnum = docnum + c.charCodeAt(0) - 55;\n\t\t\t\t}\n\t\t\telse if (c === \"@\") {\n\t\t\t\tdocnum += 10;\n\t\t\t\t}\n\t\t\telse if (c === \"#\") {\n\t\t\t\tdocnum += 14;\n\t\t\t\t}\n\t\t\telse if (c === \"$\") {\n\t\t\t\tdocnum += 18;\n\t\t\t\t}\n\t\t\telse if (c === \"_\") {\n\t\t\t\tdocnum += 24;\n\t\t\t\t}\n\t\t\telse if (c === \"%\") {\n\t\t\t\tdocnum += 30;\n\t\t\t\t}\n\t\t\telse {\n\t\t\t\tdocnum = 0;\n\t\t\t\t}\n }\n\t return docnum;\n}", "function findElement(panierUtilisateur, produitSearch){\n\tfor(let j = 0; j < panierUtilisateur.length; j++){\n\t\tif(panierUtilisateur[j]._id == produitSearch._id){\n\t\t\treturn j;\n\t\t}\n\t}\n\treturn -1;\n}", "function printHistorico(numero){ \r\n document.getElementById(\"historico\").value = numero;\r\n}", "function getPaths(num, callback){\n var count = 0;\n db.each(\"SELECT path from paths\", function(err, row){\n count++;\n if(count < num){\n callback(err, row);\n }\n });\n}", "function prendidati(){\n let num=document.getElementById('input').getElementsByClassName(\"numero\");\n let ci_sono=[];\n let contatore=0;\n for(let i=0;i<num.length;i++){\n if(!(ci_sono.includes(parseInt(num[i].value)))){\n if(numeri.includes(parseInt(num[i].value))){\n contatore++;\n ci_sono.push(parseInt(num[i].value));\n }\n }\n }\n if(contatore>=3){\n document.getElementById(\"message\").innerHTML=\"<h1>bravo <br>hai indovinato <br>\"+contatore+\"<br>\"+ci_sono+\" </h1>\";\n }else{\n document.getElementById(\"message\").innerHTML=\"<h1>o no hai <br>indovinato solo<br>\"+contatore+\"<br>\"+ci_sono+\" </h1>\";\n }\n document.getElementById(\"input\").classList+= \" d-none\";\n}" ]
[ "0.57553023", "0.5551764", "0.53502184", "0.5320882", "0.5289834", "0.5248008", "0.51939994", "0.5192254", "0.5182573", "0.5130904", "0.51215017", "0.5098444", "0.5062239", "0.5060516", "0.50550854", "0.50253034", "0.50190943", "0.497711", "0.49726623", "0.49675027", "0.49449345", "0.49299836", "0.49285746", "0.49162528", "0.49051186", "0.48990834", "0.4891102", "0.4885046", "0.48643944", "0.4864322", "0.48561093", "0.48482537", "0.4847813", "0.4841646", "0.48415005", "0.48349372", "0.482685", "0.48146507", "0.48137853", "0.4812596", "0.48092467", "0.4808763", "0.48085296", "0.48018655", "0.48016095", "0.47847375", "0.47832948", "0.477306", "0.4766121", "0.47519478", "0.47509125", "0.47429854", "0.47426215", "0.47426215", "0.4739694", "0.47312662", "0.4729104", "0.47213328", "0.471219", "0.47092697", "0.4706031", "0.46941063", "0.46882927", "0.46869847", "0.46795538", "0.46789396", "0.4671074", "0.46624953", "0.46605316", "0.46587142", "0.46535438", "0.46522045", "0.4651152", "0.46509555", "0.464857", "0.46399254", "0.46396914", "0.46363512", "0.46357727", "0.46336132", "0.4619179", "0.46173653", "0.46172437", "0.4613634", "0.4611108", "0.46098918", "0.46094444", "0.4605646", "0.46047184", "0.46040356", "0.46022803", "0.4596396", "0.4595843", "0.45953816", "0.45920718", "0.458755", "0.45875427", "0.45859572", "0.45835137", "0.45751777" ]
0.46761313
66
Buscar un desembolso en especifico (Desglose) By Cheque
function DocumentoByCheque(NoCheque) { var deferred = $q.defer(); var doc = NoCheque != undefined? NoCheque : 0; $http.get('/desembolsojson/?nocheque={NoCheque}&format=json'.replace('{NoCheque}', doc)) .success(function (data) { deferred.resolve(data); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fBuscarEjsPE() {\n hideEverythingBut(\"#ejerciciosBusquedaPE\");\n //la limpieza de búsquedas se hará al terminar sesión, de modo que al volver a la búsqueda, se podrá ver la última búsqueda realiza y sus resultados\n}", "buscarDado(d) {\n\t\t// Intenta por si es un entero\n\t\tif (!isNaN(d)) {\n\t\t\tthis.entero += parseInt(d);\n\t\t\treturn; //si es entero sumo y salgo\n\t\t}\n\n\t\tif (d.includes(\"d\")) {\n\t\t\tlet sumando = d;\n\t\t\tlet sumandos;\n\t\t\tsumandos = sumando.split(\"d\");\n\t\t\t//hago D(dados, caras)\n\t\t\tlet _d = new D(parseInt(sumandos[0]),\n\t\t\t\tparseInt(sumandos[1]));\n\t\t\t// //console.log(this.dados);\n\t\t\t//Busco si existe el dado con ese nº de caras\n\t\t\tfor (let i of this.dados) {\n\t\t\t\tif (i.caras == _d.caras) {\n\t\t\t\t\t//si existe lo sumo\n\t\t\t\t\ti.sum(_d);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//si no existe lo añado\n\t\t\tthis.dados.push(_d);\n\t\t}\n\n\t}", "function BdConsultaDescGeneralInmuebleComple(pFolio, pTipoConstruccion, pUsuarioOperacion) {\n let etiquetaLOG = `${ ruta } [Usuario: ${ pUsuarioOperacion }] METODO: BdConsultaDescGeneralInmuebleComple `;\n try {\n logger.info(etiquetaLOG);\n const client = new Pool(configD);\n\n let sQuery = `SELECT * FROM fConsultaInmConstrucComplemento('${pFolio}','${pTipoConstruccion}');`;\n\n logger.info(`${ etiquetaLOG } ${sQuery} `);\n\n return new Promise(function(resolve, reject) {\n client.query(sQuery)\n .then(response => {\n client.end();\n logger.info(etiquetaLOG + 'RESULTADO: ' + JSON.stringify(response.rows));\n resolve(response.rows);\n })\n .catch(err => {\n client.end()\n logger.error(etiquetaLOG + 'ERROR: ' + err.message + ' CODIGO_BD(' + err.code + ')');\n reject(err.message + ' CODIGO_BD(' + err.code + ')');\n })\n });\n } catch (err) {\n logger.error(`${ ruta } ERROR: ${ err } `);\n throw (`Se presentó un error en BdConsultaDescGeneralInmuebleComple: ${err}`);\n }\n}", "function descargarFactura(idFactura) {\n console.log(\"Factura a descargar:\" + idFactura);\n}", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "function comer(golondrina, alpiste) { \n return {\n nombre: golondrina.nombre,\n energia: golondrina.energia + 10 * alpiste\n }\n}", "function inhabilitarOpcionYmostrar(){\n\n let cuadrados = document.querySelectorAll(\"div.fila-buscaminas div.cuadrado\");\n\n cuadrados.forEach( c => {\n c.removeEventListener(\"click\",Juego.buscarMina)\n c.classList.remove(\"sin-descubrir\");\n });\n\n}", "function empezarDibujo() {\n pintarLinea = true;\n lineas.push([]);\n }", "function afficherLegendeCarte() {\n if (couvertureQoS == \"couverture\") {\n if (carteCouverture == \"voix\") afficherLegendeCarteCouvVoix();\n else if (carteCouverture == \"data\") afficherLegendeCarteCouvData();\n } else if (couvertureQoS == \"QoS\") {\n actualiserMenuSelectionOperateurs();\n if (agglosTransports == \"transports\") afficherLegendeCarteQoSTransport();\n else if(agglosTransports == 'agglos') afficherLegendeCarteQoSAgglos();\n else if(driveCrowd == \"crowd\") afficherLegendeCarteQoSAgglos();\n }\n}", "filtrarSugerencias(resultado, busqueda){\n \n //filtrar con .filter\n const filtro = resultado.filter(filtro => filtro.calle.indexOf(busqueda) !== -1);\n console.log(filtro);\n \n //mostrar los pines\n this.mostrarPines(filtro);\n }", "function empezarDibujo() {\n pintarLinea = true;\n lineas.push([]);\n }", "function telaDeBuscarEstoque(tipo) {\r\n let codigoHTML = ``;\r\n\r\n codigoHTML += `<div class=\"shadow-lg p-3 mb-5 bg-white rounded\">`\r\n if (tipo == 'produto') {\r\n codigoHTML += `<h4 class=\"text-center\"><span class=\"fas fa-boxes\"></span> Buscar produtos</h4>`\r\n } else {\r\n codigoHTML += `<h4 class=\"text-center\"><span class=\"fas fa-boxes\"></span> Buscar ingredientes</h4>`\r\n }\r\n codigoHTML += `<div class=\"card-deck col-6 mx-auto d-block\">\r\n <div class=\"input-group mb-3\">\r\n <input id=\"nome\" type=\"text\" class=\"form-control form-control-sm mousetrap\" placeholder=\"Nome do item\">\r\n <button onclick=\"if(validaDadosCampo(['#nome'])){buscarEstoque('nome', '${tipo}');}else{mensagemDeErro('Preencha o campo nome!'); mostrarCamposIncorrreto(['nome']);}\" type=\"button\" class=\"btn btn-outline-info btn-sm\">\r\n <span class=\"fas fa-search\"></span> Buscar\r\n </button>\r\n <br/>\r\n <button onclick=\"buscarEstoque('todos', '${tipo}');\" type=\"button\" class=\"btn btn-outline-info btn-block btn-sm\" style=\"margin-top:10px;\">\r\n <span class=\"fas fa-search-plus\"></span> Exibir todos\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div id=\"resposta\"></div>`\r\n\r\n document.getElementById('janela2').innerHTML = codigoHTML;\r\n}", "async function buscarEstoque(tipoBusca, tipo) {\r\n let codigoHTML = ``, json = null, json2 = null, produtosFilterCategorias = [];\r\n\r\n if (tipo == 'produto') {\r\n if (tipoBusca == 'nome') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`itemsDesk/${$(\"#nome\").val()}`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n json.data = json.data.filter((element) => element.stock != null)\r\n json2 = await requisicaoGET(`categories`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n for (let category of json2.data) {\r\n produtosFilterCategorias.push({ 'name': category.name, 'itens': json.data.filter((element) => category.products.findIndex((element1) => element1._id == element._id) > -1) })\r\n }\r\n } else if (tipoBusca == 'todos') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`itemsDesk`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n json.data = json.data.filter((element) => element.stock != null)\r\n json2 = await requisicaoGET(`categories`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n for (let category of json2.data) {\r\n produtosFilterCategorias.push({ 'name': category.name, 'itens': json.data.filter((element) => category.products.findIndex((element1) => element1._id == element._id) > -1) })\r\n }\r\n }\r\n } else if (tipo == 'ingrediente') {\r\n if (tipoBusca == 'nome') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`ingredients/${$(\"#nome\").val()}`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n await aguardeCarregamento(false)\r\n } else if (tipoBusca == 'todos') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`ingredients`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n await aguardeCarregamento(false)\r\n }\r\n }\r\n\r\n VETORDEITENSESTOQUE = [];\r\n\r\n codigoHTML += `<div class=\"shadow-lg p-3 mb-5 bg-white rounded\">\r\n <div id=\"grafico\" class=\"col-10 mx-auto\" style=\"height: 50vh\"></div>\r\n </div>\r\n <div class=\"shadow-lg p-3 mb-5 bg-white rounded\">\r\n <h5 class=\"text-center\">Atualizar estoque do produto ou bebida</h5>\r\n <table class=\"table table-bordered table-sm col-12 mx-auto\" style=\"margin-top:10px\">\r\n <thead class=\"thead-dark\">\r\n <tr>\r\n <th scope=\"col\">Nome</th>\r\n <th scope=\"col\">Preço unidade</th>\r\n <th scope=\"col\">Quantidade</th>\r\n <th scope=\"col\">Adicionar quantidade</th>\r\n <th scope=\"col\">Preço de custo</th>\r\n <th scope=\"col\">#</th>\r\n </tr>\r\n </thead>\r\n <tbody>`\r\n\r\n if (tipo == 'ingrediente') {\r\n\r\n for (let item of json.data) {\r\n VETORDEITENSESTOQUE.push(item);\r\n codigoHTML += '<tr>'\r\n if (item.drink) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-wine-glass-alt\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else if (item.drink == false) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-utensils\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-boxes\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n }\r\n codigoHTML += `<th class=\"table-warning text-dark\" style=\"width:10vw\">R$${(parseFloat(item.priceUnit ? item.priceUnit : item.cost)).toFixed(2)}</th>`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<td class=\"table-${item.stock > 2000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} g</strong></td>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<td class=\"table-${item.stock > 3000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} ml</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-${item.stock > 5 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} unid.</strong></td>`\r\n }\r\n codigoHTML += `<td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"quantidade${item._id}\" value=10 />\r\n <div class=\"input-group-prepend\">`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<span class=\"input-group-text\">g</span>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<span class=\"input-group-text\">ml</span>`\r\n } else {\r\n codigoHTML += `<span class=\"input-group-text\">unid.</span>`\r\n }\r\n codigoHTML += `</div>\r\n </div> \r\n </td>\r\n <td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <div class=\"input-group-prepend\">\r\n <span class=\"input-group-text\">R$</span>\r\n </div>\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"precocusto${item._id}\" value=${tipo == 'produto' ? (parseFloat(item.cost)).toFixed(2) : (parseFloat(item.price)).toFixed(2)} />\r\n </div>\r\n </td>\r\n <td class=\"table-secondary text-dark\" style=\"width:7vw\">\r\n <button onclick=\"if(validaDadosCampo(['#quantidade${item._id}'])){confirmarAcao('Atualizar quantidade!', 'atualizarEstoque(this.value,${tipo == 'produto' ? true : false})', '${item._id}');}else{mensagemDeErro('Preencha o campo quantidade com um valor válido!'); mostrarCamposIncorrreto(['quantidade${item._id}']);}\" class=\"btn btn-success btn-sm\">\r\n <span class=\"fas fa-sync\"></span> Alterar\r\n </button>\r\n </td>\r\n </tr>`\r\n }\r\n\r\n } else if (tipo == 'produto') {\r\n\r\n for (let itemCategory of produtosFilterCategorias) {\r\n\r\n if (itemCategory.itens[0] != null) {\r\n codigoHTML += `<tr class=\"bg-warning\">\r\n <th colspan=\"6\" class=\"text-center\"> ${itemCategory.name}</th>\r\n </tr>`\r\n }\r\n\r\n for (let item of itemCategory.itens) {\r\n VETORDEITENSESTOQUE.push(item);\r\n codigoHTML += '<tr>'\r\n if (item.drink) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-wine-glass-alt\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else if (item.drink == false) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-utensils\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-boxes\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n }\r\n codigoHTML += `<th class=\"table-warning text-dark\" style=\"width:10vw\">R$${(parseFloat(item.priceUnit ? item.priceUnit : item.cost)).toFixed(2)}</th>`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<td class=\"table-${item.stock > 2000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} g</strong></td>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<td class=\"table-${item.stock > 3000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} ml</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-${item.stock > 5 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} unid.</strong></td>`\r\n }\r\n codigoHTML += `<td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"quantidade${item._id}\" value=10 />\r\n <div class=\"input-group-prepend\">`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<span class=\"input-group-text\">g</span>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<span class=\"input-group-text\">ml</span>`\r\n } else {\r\n codigoHTML += `<span class=\"input-group-text\">unid.</span>`\r\n }\r\n codigoHTML += `</div>\r\n </div> \r\n </td>\r\n <td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <div class=\"input-group-prepend\">\r\n <span class=\"input-group-text\">R$</span>\r\n </div>\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"precocusto${item._id}\" value=${tipo == 'produto' ? (parseFloat(item.cost)).toFixed(2) : (parseFloat(item.price)).toFixed(2)} />\r\n </div>\r\n </td>\r\n <td class=\"table-secondary text-dark\" style=\"width:7vw\">\r\n <button onclick=\"if(validaDadosCampo(['#quantidade${item._id}'])){confirmarAcao('Atualizar quantidade!', 'atualizarEstoque(this.value,${tipo == 'produto' ? true : false})', '${item._id}');}else{mensagemDeErro('Preencha o campo quantidade com um valor válido!'); mostrarCamposIncorrreto(['quantidade${item._id}']);}\" class=\"btn btn-success btn-sm\">\r\n <span class=\"fas fa-sync\"></span> Alterar\r\n </button>\r\n </td>\r\n </tr>`\r\n }\r\n }\r\n\r\n }\r\n codigoHTML += `</tbody>\r\n </table>\r\n </div>`\r\n\r\n if (json.data[0] == null) {\r\n document.getElementById('resposta').innerHTML = `<h5 class=\"text-center\" style=\"margin-top:20vh;\"><span class=\"fas fa-exclamation-triangle\"></span> Nenhum produto ou ingrediente encontrado!</h5>`;\r\n } else {\r\n document.getElementById('resposta').innerHTML = codigoHTML;\r\n setTimeout(function () { gerarGraficoEstoque(json); }, 300)\r\n }\r\n}", "busquedaElemento(nombre) {\n /*\n Se dividirá la búsqueda según el tipo de acceso / o //\n */\n if (!this.controladorDobleSimple) {\n //VERIFICAMOS SI EL OBJETO A BUSCAR PARTE DE LA RAIZ O NO \n if (!this.inicioRaiz) {\n //SE COMIENZA EN LA RAIZ \n for (let entry of this.ArrayEtiquetas) {\n //Usamos una variable auxiliar para almacenar el objeto en cuestion\n let auxiliarBusqueda = entry;\n //Dado que es la raiz, ubicamos la posición en STACK en donde se encuentra el principio de la misma Y la asignados a una variable temporal\n this.codigoTemporal += \"P=\" + auxiliarBusqueda.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var i = 0; i < nombre.length; i++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${nombre.charCodeAt(i)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaSimple();\\n\";\n //Verificamos si encontramos el elemento\n if (auxiliarBusqueda.id == nombre) {\n this.pathCompleto = true;\n //Si se encuentra, significa que la siguiente busqueda se debe hacer a partir de este elemento\n this.consolaSalidaXPATH.push(auxiliarBusqueda);\n //Establecemos que ya no comience desde la raiz\n this.inicioRaiz = true;\n }\n }\n }\n //Ahora se procede a iniciar desde el elemento padre en caso de ya haberlo encontrado en la raiz \n else {\n this.temporalGlobal.aumentar();\n //this.codigoTemporalMetodos += this.temporalGlobal.retornarString() + \"=stackXPATH[(int)PXP];\";\n //this.codigoTemporalMetodos += \"PXP = PXP + 1;\\n\";\n //Iniciamos la búsqueda en el último elementro encontrado dentro de la lista final\n let auxiliarContadorConsola = 0;\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let auxiliarBusqueda = this.consolaSalidaXPATH[i];\n //C3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3D\n //C3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3DC3D\n //Examinamos cada uno de los hijos de ese elemento\n for (var j = 0; j < auxiliarBusqueda.hijos.length; j++) {\n //Si coincide la busqueda, se agrega a la lista final y se activan las banderas respectivas\n let temporal = auxiliarBusqueda.hijos[j];\n //C3D/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// \n this.codigoTemporal += \"encontrarPrimerHijo();\\n\";\n this.codigoTemporal += \"P=\" + temporal.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var x = 0; x < nombre.length; x++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${nombre.charCodeAt(x)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaSimple();\\n\";\n //C3D\n ///////////////////////////////////////////////////\n if (temporal.id == nombre) {\n this.pathCompleto = true;\n this.consolaSalidaXPATH.push(temporal);\n auxiliarContadorConsola = i;\n }\n }\n }\n //Fragmento que nos sirve para ir guardando los padres asi como el nuevo inicio de la lista\n this.contadorConsola = auxiliarContadorConsola;\n this.arrayPosicionPadres.push(this.contadorConsola);\n this.contadorConsola++;\n // this.codigoTemporal += \"//CONTADOR: \" + this.contadorConsola + \"\\n\";\n }\n }\n else { //ELSE PARA BUSCAR CON EL TIPO DE ACCESO //\n //nuevamente verificamos si se inicia en la raiz o en el elemento en cuestion \n if (!this.inicioRaiz) {\n //this.arrayPosicionPadres.push(0);\n //En caso de iniciar en la raiz partimos del array de etiquetas \n for (let entry of this.ArrayEtiquetas) {\n let auxiliarBusqueda = entry;\n //C3D*************************************************************************************************************\n //Dado que es la raiz, ubicamos la posición en STACK en donde se encuentra el principio de la misma Y la asignados a una variable temporal\n this.codigoTemporal += \"P=\" + auxiliarBusqueda.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var i = 0; i < nombre.length; i++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${nombre.charCodeAt(i)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaSimple();\\n\";\n //C3D*************************************************************************************************************\n //Verificamos si encontramos el elemento\n if (auxiliarBusqueda.id == nombre) {\n this.pathCompleto = true;\n //Agregamos a la lista el elementro encontrado\n this.consolaSalidaXPATH.push(auxiliarBusqueda);\n //Establecemos que ya no comience desde la raiz\n }\n //Llamamos al método recursivo ya que al ser tipo de acceso doble tiene que buscar en todos los lados posibles\n this.auxiliarDoble(auxiliarBusqueda, nombre);\n }\n //Activamos la bandera para ya no iniciar desde la raiz sino en el ultimo elementro encontrado\n this.inicioRaiz = true;\n }\n else {\n //Establecemos el limite de inicio y fin\n this.temporalGlobal.aumentar();\n let auxiliarContadorConsola = 0;\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let auxiliarBusqueda = this.consolaSalidaXPATH[i];\n //Revisamos cada uno de los hijos\n for (var j = 0; j < auxiliarBusqueda.hijos.length; j++) {\n //Si coinciden los valores respectivos\n let temporal = auxiliarBusqueda.hijos[j];\n this.codigoTemporal += \"encontrarPrimerHijo();\\n\";\n this.codigoTemporal += \"P=\" + temporal.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var x = 0; x < nombre.length; x++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${nombre.charCodeAt(x)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaSimple();\\n\";\n if (temporal.id == nombre) {\n //Guardamos el nuevo elemento a mostrar o examinar y actualizamos el punto de inicio de la lista final\n this.pathCompleto = true;\n this.consolaSalidaXPATH.push(temporal);\n auxiliarContadorConsola = i;\n }\n //Se llama al método recursivo para iniciar la busqueda a fondo \n this.auxiliarDoble(temporal, nombre);\n }\n }\n //Establecemos los nuevos puntos de inicio asi como los padres\n this.contadorConsola = auxiliarContadorConsola;\n this.arrayPosicionPadres.push(this.contadorConsola);\n this.contadorConsola++;\n } //fin inicio raiz DOBLE\n } //FIN DE TIPO DE ACCESO://\n }", "function buscarFleteros(){\n socket.emit(\"buscarFlete\", idU, function(choferes){\n chofOrd = choferesCercanos(choferes);\n validarArray(start);\n });\n }", "function cnsRH_abre(texto,divDaConsulta,ordem,naoPesquisa){\n\tif(!CNSRH_SAFETY){\n\t\tcnsRH_safety(function(){ cnsRH_abre(texto,divDaConsulta,ordem,naoPesquisa); },true,true);\n\t\treturn;\n\t}\n\n\t//COLOCA NO OBEJTO A DIV ONDE A CONSULTA FOI INSERIDA\n\tobjFuncRH.divDaConsulta = divDaConsulta;\n\n\t//ALTERA ORDEM DO COMBO DE PESQUISA\n\tif(!empty(ordem)){\n\t\t$('#cnsRH_ordem').parent().dropdown(\"set selected\",ordem);\n\t}\n\n\t//COLOCA NO CAMPO DE PESQUISA DA CONSULTA OQUE FOI PESQUISADO\n\tget('cnsRH_pesquisa').value = texto.trim();\n\n\tif(naoPesquisa !== undefined && naoPesquisa === true){\n\t\t$CNSRHdimmer.dimmer(\"consulta show\");\n\t}else{\n\t\t//MONTA A QUERY\n\t\tcnsRH_montaQuery();\n\t}\n}", "function ordenar() {\n let seleccion = $(\"#miSeleccion\").val().toUpperCase();\n popularListaCompleta();\n listaCompletaClases = listaCompletaClases.filter(Clase => Clase.dia ==\n seleccion);\n renderizarProductos();\n}", "irAlBoss(){\n this.salaActual = new Sala(this.salaActual.jugador, this.salaActual, posicionSala.bossBatle, \"Boss.txt\",5, this.counterId++);\n }", "function getCuponesPorIndustria(idIndustria){\n\t\n}", "function mostrarprmaelementocequiv(habp,com){\n\n\t\t\t//////////////////////////////////PLAN HABILITADORAS ////////////////////////////////////////////////\t\t\t\n\t\t\t\t\t\t// ESFUERZO PROPIO PLAN EN BOLIVARES \t\t\t\t\t\n\t\t\t\t\t\tvar laborep = filtrarcostohab(habp,filtrolabor,5,com,1);\n\t\t\t\t\t\tvar bbep = filtrarcostohab(habp,filtrobb,5,com,1);\n\t\t\t\t\t\tvar mep = filtrarcostohab(habp,filtrom,5,com,1);\n\t\t\t\t\t\tvar scep = filtrarcostohab(habp,filtrosc,5,com,1);\n\t\t\t\t\t\tvar oep = filtrarcostohab(habp,filtroo,5,com,1);\n\t\t\t\t\t\tvar totalep = filtrartotal(laborep,bbep,mep,scep,oep);\n \n \t\t\t\t\t\t \t\t // ESFUERZOS PROPIOS PLAN EN DOLARES\n \t\t\t\t\t\t var laborepdol = filtrarcostohab(habp,filtrolabor,5,com,2);\n \t\t\t\t\t\t var bbepdol = filtrarcostohab(habp,filtrobb,5,com,2);\n \t\t\t\t\t\t var mepdol = filtrarcostohab(habp,filtrom,5,com,2);\n \t\t\t\t\t\t var scepdol = filtrarcostohab(habp,filtrosc,5,com,2);\n \t\t\t\t\t\t var oepdol = filtrarcostohab(habp,filtroo,5,com,2);\n \t\t\t\t\t\t var totalepdol = filtrartotal(laborepdol,bbepdol,mepdol,scepdol,oepdol);\n\n \t\t\t\t\t\t // DTTO ORIENTAL PLAN EN BOLIVARES\n\t\t\t\t\t \t var labordtto = filtrarcostohab(habp,filtrolabor,4,com,1);\n \t\t\t\t\t\t var bbdtto = filtrarcostohab(habp,filtrobb,4,com,1);\n \t\t\t\t\t\t var mdtto = filtrarcostohab(habp,filtrom,4,com,1);\n \t\t\t\t\t\t var scdtto = filtrarcostohab(habp,filtrosc,4,com,1);\n \t\t\t\t\t\t var odtto = filtrarcostohab(habp,filtroo,4,com,1);\n \t\t\t\t\t\t var totaldtto = filtrartotal(labordtto,bbdtto,mdtto,scdtto,odtto);\n\n \t\t\t\t\t\t // DTTO ORIENTAL PLAN EN DOLARES\n \t\t\t\t\t\t var labordttodol = filtrarcostohab(habp,filtrolabor,4,com,2);\n \t\t\t\t\t\t var bbdttodol = filtrarcostohab(habp,filtrobb,4,com,2);\n \t\t\t\t\t\t var mdttodol = filtrarcostohab(habp,filtrom,4,com,2);\n \t\t\t\t\t\t var scdttodol = filtrarcostohab(habp,filtrosc,4,com,2);\n \t\t\t\t\t\t var odttodol = filtrarcostohab(habp,filtroo,4,com,2);\n \t\t\t\t\t\t var totaldttodol = filtrartotal(labordttodol,bbdttodol,mdttodol,scdttodol,odttodol);\n\n\n \t\t\t\t\t\t /// DIVISION ORIENTAL PLAN EN BOLIVARES\n \t\t\t\t\t\t var labordivo = filtrardivo(labordtto,laborep);\n \t\t\t\t\t\t var bbdivo = filtrardivo(bbdtto,bbep);\n \t\t\t\t\t\t var mdivo = filtrardivo(mdtto,mep);\n \t\t\t\t\t\t var scdivo = filtrardivo(scdtto,scep);\n \t\t\t\t\t\t var odivo = filtrardivo(odtto,oep);\n \t\t\t\t\t\t var totaldivo = filtrartotal(labordivo,bbdivo,mdivo,scdivo,odivo);\n\n \t\t\t\t\t\t /// DIVISION ORIENTAL PLAN EN DOLARES\n \t\t\t\t\t\t var labordivodol = filtrardivo(labordttodol,laborepdol);\n \t\t\t\t\t\t var bbdivodol = filtrardivo(bbdttodol,bbepdol);\n \t\t\t\t\t\t var mdivodol = filtrardivo(mdttodol,mepdol);\n \t\t\t\t\t\t var scdivodol = filtrardivo(scdttodol,scepdol);\n \t\t\t\t\t\t var odivodol = filtrardivo(odttodol,oepdol);\n \t\t\t\t\t\t var totaldivodol = filtrartotal(labordivodol,bbdivodol,mdivodol,scdivodol,odivodol);\n\n \t\t\t\t\t\t /// DIVISION ORIENTAL PLAN EN DOLARES EQUIVALENTES\n \t\t\t\t\t\t var labordivoDeqv = filtroequivalente(labordivo,labordivodol);\n \t\t\t\t\t\t var bbdivoDeqv = filtroequivalente(bbdivo,bbdivodol);\n \t\t\t\t\t\t var mdivoDeqv = filtroequivalente(mdivo,mdivodol);\n \t\t\t\t\t\t var scdivoDeqv = filtroequivalente(scdivo,scdivodol);\n \t\t\t\t\t\t var odivoDeqv = filtroequivalente(odivo,odivodol);\n \t\t\t\t\t\t var totaldivoDeqv = filtrartotal(labordivoDeqv,bbdivoDeqv,mdivoDeqv,scdivoDeqv,odivoDeqv);\n\n \t\t\t\t\t\t ////////////////////// FIN PLAN ////////////////////////////////////////////////\n \t\t\t\t\t\t var laborybbdivoDeqv = filtrardivo(labordivoDeqv,bbdivoDeqv);\n\n \t\t\t\t\t\t\n \t\t\t\t\t\tvar\tinformacion = cabeceracategoriaprmva('red-header','ELEMENTO DE COSTO');\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Labor y Beneficios',laborybbdivoDeqv); \n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Materiales',mdivoDeqv);\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Servicios y Contratos',scdivoDeqv);\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Otros Costos y Gastos',odivoDeqv);\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('red-header','Total',totaldivoDeqv); \n \t\t\t\t\treturn informacion;\n\n}", "function byNoCheque(NoCheque) {\n var deferred = $q.defer();\n all().then(function (data) {\n var result = data.filter(function (registro) {\n return registro.cheque == NoCheque;\n });\n\n if(result.length > 0) {\n deferred.resolve(result);\n } else {\n deferred.reject();\n }\n });\n return deferred.promise;\n }", "function retourDeMonClic(idClique)\r\n {\r\n \r\n // console.log(idClique)+\" = clic\";\r\n // ex: e1, c1 ...\r\n\r\n // Affiche et garde la première lettre (position 0)\r\n let premiereLettreDeId = idClique.charAt(0); // ex: e\r\n\r\n\r\n// *********** Objectif retirer la première lettre pour avoir le numéro de l'id \r\n \r\n // Remplacer c ou e par rien\r\n let numeroId = idClique.replace(premiereLettreDeId, \"\");\r\n\r\n\r\n // On / off \r\n // (si = e + int et première lettre égal à e)\r\n\r\n if(idClique== (premiereLettreDeId + numeroId) && (premiereLettreDeId == \"e\")){\r\n\r\n x = document.getElementById(idClique).parentNode.nodeName;\r\n // console.log(x +\" lien parent\") // DIV\r\n\r\n let PointageCibleOn=document.getElementById(\"tache\"+numeroId);\r\n // console.log(numeroId + \" : id cliqué !\");\r\n\r\n let cibleIcon=document.getElementById(\"ico\"+numeroId);\r\n\r\n // Ajout du fond vert \"tache\"+numeroId\r\n PointageCibleOn.style.backgroundColor=\"rgba(232, 255, 117, 1)\";\r\n\r\n\r\n // ajout de class pour le design css\r\n\r\n cibleIcon.setAttribute(\"class\",\"far fa-check-circle\");\r\n\r\n// *********** Chercher le key de maListeDesTaches qui contient comme id: x le id cliqué \r\n \r\n for (let a = 0; a < maListeDesTaches.length; a++) {\r\n const element = maListeDesTaches[a];\r\n // console.log(element);\r\n\r\n// *********** Etat à true (pour mémoriser la couleur et ico validé)\r\n\r\n if (maListeDesTaches[a].id==numeroId) {\r\n // alert(\"L'array \"+a+\" à la valeur\"+maListeDesTaches[a].tache);\r\n maListeDesTaches[a].etat=true;\r\n console.log(maListeDesTaches)\r\n\r\n // ****** storage à sauver (mis à jour)\r\n localStorage.setItem(\"donnesSauvegardees\", JSON.stringify(maListeDesTaches));\r\n\r\n // break fonctionne également\r\n return;\r\n }\r\n }\r\n\r\n }\r\n\r\n// *********** Supprimer le Div cliqué\r\n\r\n if(idClique== (premiereLettreDeId + numeroId) && (premiereLettreDeId == \"c\")){\r\n\r\n function supprimerDiv() {\r\n \r\n // pointer le div tache et son numéro\r\n let myobj = document.getElementById(\"tache\"+numeroId);\r\n console.log(numeroId + \" Numéro Id cliqué\")\r\n\r\n // supprime la cible\r\n myobj.remove();\r\n\r\n\r\n// *********** supprimer la clef de id cliqué de l'objet ******************************************************************************\r\n \r\n // Supprimer de mon tableau id correspondant 1 = le nombre entrée(s) à supprimer\r\n maListeDesTaches.splice(numeroId, 1);\r\n\r\n // ****** storage à sauver (mis à jour)\r\n localStorage.setItem(\"donnesSauvegardees\", JSON.stringify(maListeDesTaches));\r\n }\r\n\r\n // Appel fonction\r\n supprimerDiv();\r\n\r\n\r\n } // fin condition if\r\n } // fin retourDeMonClic", "function getDesempenho(){\n init(1200, 500,\"#infos2\");\n executa(dados_atuais, 0,10,4);\n showLegendasRepetencia(false);\n showLegendasDesempenho(true);\n showLegendasAgrupamento(false);\n}", "function BdDescGeneralInmuebleComple(pIdInmConstruccion, pValorUniRepoNuevo, pLosaConcreto,\n pUsuarioOperacion) {\n\n let etiquetaLOG = ruta + '[Usuario: ' + pUsuarioOperacion + '] METODO: BdDescGeneralInmuebleComple ';\n\n try {\n logger.info(etiquetaLOG);\n\n const client = new Pool(configD);\n\n logger.info(etiquetaLOG + 'SELECT * FROM fInmConstrucComplemento (pIdInmConstruccion, pValorUniRepoNuevo, pLosaConcreto, pUsuarioOperacion);');\n let sQuery = `SELECT * FROM fInmConstrucComplemento (${pIdInmConstruccion}, (${pValorUniRepoNuevo}::decimal), (${pLosaConcreto}::char), ${pUsuarioOperacion});`;\n\n logger.info(`${ etiquetaLOG } ${sQuery} `);\n\n return new Promise(function(resolve, reject) {\n client.query(sQuery)\n .then(response => {\n client.end()\n logger.info(etiquetaLOG + 'RESULTADO: ' + JSON.stringify(response.rows));\n resolve(response.rows);\n })\n .catch(err => {\n client.end()\n logger.error(etiquetaLOG + 'ERROR: ' + err + ' CODIGO_BD(' + err.code + ')');\n reject(err.message + ' CODIGO_BD(' + err.code + ')');\n })\n });\n } catch (err) {\n logger.error(`${ ruta } ERROR: ${ err }`);\n throw (`Se presentó un error en BdDescGeneralInmuebleComple: ${err}`);\n }\n}", "function busquedaPrincipalPorDefecto(){\n construirFiltros(\"HideDuplicateItems\", \"true\");\n buscarPorClave(\"Deporte\",12,1);\n search(\"Sports\",null,1,\"customerRating\",\"desc\",12);\n}", "function obterDoadores(){\n var doadoresUniversal = [];\n for(var i=0; i<goldSaints.length; i++){\n var cavaleiro = goldSaints[i];\n if(cavaleiro.tipoSanguineo === 'O'){\n doadoresUniversal.push(cavaleiro);\n }\n }\n return doadoresUniversal;\n}", "function buscarCliente(cdni) {\n let resultado = baseCliente.filter(fila => fila.dni == cdni);\n\n for (const cliente of resultado) {\n return cliente;\n }\n\n}", "function buscarCerca (posicion) {\n /* Completar la función buscarCerca que realice la búsqueda de los lugares\n del tipo (tipodeLugar) y con el radio indicados en el HTML cerca del lugar\n pasado como parámetro y llame a la función marcarLugares. */\n var lugar = document.querySelector('#tipoDeLugar').value;\n console.log(lugar);\n var radio = document.querySelector('#radio').value;\n console.log(radio);\n servicioLugares.nearbySearch({\n location: posicion,\n radius: radio,\n type: lugar,\n }, marcadorModulo.marcarLugares);\n }", "function buscarPedidosLiquidados(idSucursal, idCliente, fechaInicial, fechaFinal, idAlmacen, tipo, PedidoSolicitudMaterial, opcion_buscador){\n\tswitch(opcion_buscador){\n\t\tcase '1':\n\t\t\t//alert('idSucursal: '+idSucursal);\talert('idCliente: '+idCliente); alert('fechaInicial: '+fechaInicial); alert('fechaFinal: '+fechaFinal);\n\t\t\tif(idSucursal == -1 && idCliente == -1 && fechaInicial == '' && fechaFinal == ''){\n\t\t\t\talert('Debe elegir algun criterio');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif( (fechaInicial != \"\" && fechaFinal == \"\") || (fechaInicial == \"\" && fechaFinal != \"\") ){\n\t\t\t\talert('Debe elegir las dos fechas');\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\t//var FechaInicioConv = convierteFechaJava(fechaInicial);\n\t\t\t\t//var FechaFinConv = convierteFechaJava(fechaFinal);\n\t\t\t\tif(fechaInicial > fechaFinal){\n\t\t\t\t\talert(\"La fecha incial no puede ser mayor a la fecha final\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\tbreak;\n\t\tcase '2':\n\t\t\t//alert('idAlmacen: '+idAlmacen); alert('tipo: '+tipo); alert('PedidoSolicitudMaterial: '+PedidoSolicitudMaterial);\n\t\t\tif(idAlmacen == -1 && tipo == '' && PedidoSolicitudMaterial == ''){\n\t\t\t\talert('Debe elegir algun criterio');\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\tif( (tipo == 'P' || tipo == 'S') && PedidoSolicitudMaterial == ''){\n\t\t\t\t\talert('Debe introducir el pedido o la solucitud');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\tbreak;\n\t}\n\tvar $contenidoAjax = $('div#div_surtido').html('<br/><p align=\"center\"><img src=\"../../imagenes/general/wait.gif\" width=\"20\"/></p>');\n\tvar fechaInicial = cambiarFormatoFecha(fechaInicial,'ymd','/');\n\tvar fechaFinal = cambiarFormatoFecha(fechaFinal,'ymd','/');\n\t$.ajax({ \n\t\tmethod: \"GET\",\n\t\turl: \"../ajax/buscarPedidosLiquidados.php\",\n\t\tdata:{idSucursal:idSucursal, idCliente:idCliente, fechaInicial:fechaInicial, fechaFinal:fechaFinal, idAlmacen:idAlmacen, tipo:tipo, PedidoSolicitudMaterial:PedidoSolicitudMaterial, opcion_buscador:opcion_buscador},\n\t\tdataType:\"json\",\n\t\tsuccess: function(data) { // Aquí desaparece la imagen ya que estamos reemplazando todo el HTML del contenido de la div. \n\t\t\t$contenidoAjax.html(data);\n\t\t\t//alert(data);\n\t\t}\n\t})\n\t.done(function(data){});\n\n\t\n}", "function jeu_piocherDsPaquet(me){\n\t\tmy_logger((me?PROMPT_ME:PROMPT_IA)+\" Piocher une carte\");\n\t\t//piocher la première carte du paquet\n\t\tpioche = paquet2.cartes.shift();\n\t\tcarte_piochee=JSON.parse(pioche);\n\t\t\n\t\t//Si carte adv => en jeu pour ADV\n\t\t//\t\tSSI nb carteADV en jeu <4\n\t\tme = !(etreCarteAdv(carte_piochee));\n\t\tcimetiere = (compterCarteEnjeu(me)>=4);\n\t\t\n\t\tidxDispo = trouverIndiceDispo(me);\n\t\t\n\t\tif (!cimetiere && idxDispo!=-1){\t\t\t\t\t\t\n\t\t\tctrCarte=(me?cc_jeuMe:cc_jeuAdv);\n\t\t\tmy_logger((me?PROMPT_ME:PROMPT_IA)+\" \"+carte_piochee.nom+\" mise en jeu pour \"+(me?\"me\":\"adv\")+ \" en \"+idxDispo);\n\t\t\t\n\t\t\t//créer une carte pour ADV et afficher\n\t\t\tposerCarteEnJeu(carte_piochee,me,idxDispo);\n\t\t\t\n\t\t\tif (me){\n\t\t\t\tjeu_me[idxDispo]=carte_piochee;\n\t\t\t\tcc_jeuMe++;\n\t\t\t}else{\n\t\t\t\tjeu_adv[idxDispo]=carte_piochee;\n\t\t\t\tcc_jeuAdv++;\n\t\t\t}\t\t\t\t\t\t\n\t\t}else{\n\t\t\tsacrifierUneCarte(-1,carte_piochee,me,true);\n\n\t\t\talert((me?PROMPT_ME:PROMPT_IA)+\" \"+carte_piochee.nom+\" placée ds cimetière !\");\n\t\t}\n\t\tif (me){\n\t\t\tnbc_paquet_me--;\n\t\t}else{\n\t\t\tnbc_paquet_adv--;\n\t\t}\n\t }", "function obtenerDatosProducto(producto) {\n console.log(producto)\n const productoAgregado = menu.find((item) => producto === `sku_${item.id}`)\n}", "function mostrarJogada (e){\n\n escolha.style.display = \"none\"\n containerPlay.style.display = \"none\"\n containerJogada.style.display = \"flex\"\n containerRegras.style.display = \"flex\"\n\n nivelDificuldade = e.target.id\n\n return geracaoTorreHanoi(nivelDificuldade)\n\n}", "function agregarCarrito(seleccion){\n let encontrado = listaProductos.find(producto => producto.nombre == seleccion);\n const card = `\n <div class= \"carritoContainer\">\n <img class=\"imagenProductoComprado\" src=\"${encontrado.img}\">\n <h5 class=\"productoComprado\">${encontrado.nombre}</h5>\n <h6 class=\"productoPrecio\">${encontrado.precio}</h6>\n </div>` \n\n let carro = document.getElementById('botonCarrito')\n carro.innerHTML += card\n}", "function sacarDeCarrito(e) {\r\n //Obtenemos el elemento desde el cual se disparó el evento\r\n let boton = e.target;\r\n let id = boton.id;\r\n //Nos quedamos solo con el numero del ID\r\n let index = id.substring(3);\r\n\r\n carrito.splice(index, 1);\r\n\r\n //Despues que actulizamos el carrito volvemos a actualizar el DOM\r\n $(`#carrito${index}`).fadeOut(\"slow\", function () {\r\n actualizarCarritoLocal(carrito);\r\n });\r\n}", "getEleccionPaquete(){\r\n\r\n if( eleccion == \"IGZ\" ){\r\n //Igz - descuento del 15\r\n console.log(\"Elegiste Iguazú y tiene el 15% de decuento\");\r\n return this.precio - (this.precio*0.15);\r\n }\r\n else if (eleccion == \"MDZ\"){\r\n //mdz - descuento del 10\r\n console.log(\"Elegiste Mendoza y tiene el 10% de descuento\");\r\n return this.precio - (this.precio*0.10);\r\n }\r\n else if (eleccion == \"FTE\"){\r\n //fte - no tiene descuento \r\n console.log(\"Elegiste El Calafate, lamentablemente no tiene descuento\");\r\n return \"\";\r\n }\r\n \r\n }", "function melhorEco(dados) {\n return dados;\n}", "buscarSumandos(dado) {\n\t\t// si hay un menos hago que sea un + num negativo\n\t\t// let _dado = dado.replace(\"-\", \"+-\");\n\t\tlet _dado = dado;\n\t\tlet sumandos;\n\t\tif (_dado.includes(\"+\")) {// separo en sumandos\n\t\t\tsumandos = _dado.split(\"+\");\n\t\t\tfor (let i = 0; i < sumandos.length; i++) {\n\t\t\t\t// el dado máximo de cada sumando y el minimo\n\t\t\t\tthis.buscarDado(sumandos[i]);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.buscarDado(_dado);\n\t\t}\n\n\t}", "function buscarFlete(){\n\n $('#fatalClose').unbind(\"click\").click(function(){\n $('#modalSolicitud').modal('hide'); \n socket.disconnect();\n });\n\n socket.socket.reconnect();\n start = 0;\n var datos={\"idUsuario\" : idU,\"origen\" : $('#start').val(), \"destino\" : $('#end').val(), \"cargar\" : $('#slider-flip-C').val(), \"descargar\" : $('#slider-flip-D').val(), \"comentario\" : $('#textarea').val()};\n\t\t$('#modalSolicitud').modal({\n\t\t show: true,\n\t\t backdrop: false,\n\t\t keyboard: false\n\t\t});\t\t\n \n //Chofer finaliza la transaccion\n socket.on('finalizaFlete', function(data){\n $('#modalFin').modal({\n backdrop: false,\n keyboard: false,\n show: true\n });\n $('#btnFin').css('display','none');\n finalizarFlete(data,\"Ha finalizado!\",false); \n });\n\n\t\tenviarSolicitud(datos);\n\n }", "function buscarPorColeccion(req, res) {\n\n // viene x los params de la url \n let busqueda = req.params.bus;\n let tabla = req.params.tabla;\n\n // busqueda es el parametro de la url \n // 'i' may y minus es insensible\n let regex = new RegExp(busqueda, 'i'); // aqui convertimos la busqueda con la ex regular\n\n let promesa;\n\n // busqueda contiene lo que busco \n // ej : coleccion/usuarios/manuel ===>>> colecccion/tabla/busqueda\n\n // pregunto por cada coleccion que viene en la tabla \n switch (tabla) {\n\n case 'usuarios':\n promesa = buscarUsuarios(busqueda, regex);\n break;\n\n case 'controles':\n promesa = buscarControles(busqueda, regex);\n break;\n\n case 'modulos':\n promesa = buscarModulos(busqueda, regex);\n break;\n\n case 'hospitales':\n promesa = buscarHospitales(busqueda, regex);\n break;\n\n case 'medicos':\n promesa = buscarMedicos(busqueda, regex);\n break; \n\n default:\n\n return res.status(400).json({\n ok: false,\n mensaje: 'los colecciones de busqueda solo son usuarios, modulos y controles',\n error: { message: 'tipo de coleccion/documento no valido' }\n })\n }\n\n // en ecma6 existe propiedades de obj computadas \n // ponemos tabla entre [] y nos da su valor , que puede ser usuarios medicos hospitales \n // si no lo ponemos entre [] imprime tabla \n\n promesa.then(data => {\n\n res.status(200).json({\n ok: true,\n [tabla]: data\n })\n })\n\n}", "function inserirDesconto() {\n if (desconto > 0) {\n const divDesconto = document.createElement('div');\n divDesconto.classList.add('desconto');\n const descricao = document.createElement('h2');\n descricao.appendChild(document.createTextNode('Descontos'));\n divDesconto.appendChild(descricao);\n const divValorDesc = document.createElement('div');\n divValorDesc.classList.add('valor-desc');\n divDesconto.appendChild(divValorDesc);\n const valorDesc = document.createElement('h2');\n valorDesc.appendChild(\n document.createTextNode(\n desconto.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' })\n )\n );\n divValorDesc.appendChild(valorDesc);\n const cupomDesc = document.createElement('span');\n cupomDesc.appendChild(\n document.createTextNode('CUPOM: MEUPRIMEIROVESTIDOPRETO')\n );\n\n divValorDesc.appendChild(cupomDesc);\n\n resumo.insertBefore(divDesconto, freteInserido);\n }\n}", "function irsozinho() {\n\tvar inst = document.getElementById(\"manobraunicabox\").value.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '\\n');\n\tvar inst = inst.split ('Telefone')[1];\n\tvar inst = inst.split ('\\n')[1];\n\tvar inst = inst.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '');\n\t\n\tvar estado = document.getElementById(\"manobraunicabox\").value.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '\\n');\n\tvar estado = estado.split('Localidade\\nEsta')[1];\n\tvar estado = estado.split('\\n')[7];\n\tvar estado = estado.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '');\t\n\n\tvar cidade = document.getElementById(\"manobraunicabox\").value.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '\\n');\n\tvar cidade = cidade.split('Localidade\\nEsta')[1];\n\tvar cidade = cidade.split('\\n')[8];\n\tvar cidade = cidade.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '');\n\t\n\tvar ard = document.getElementById(\"manobraunicabox\").value.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '\\n');\n\tvar ard = ard.split('alimentador')[1];\n\tvar ard = ard.split ('rio')[1];\n\tvar ard = ard.split ('Porta')[0];\n\tvar ard = ard.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '');\n\t//utilizar indexOf para encontrar este trecho do ard no select\n\t\n\t\n\tvar rin = document.getElementById(\"manobraunicabox\").value.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '\\n');\n\tvar rin = rin.split('alimentador')[1];\n\tvar rin = rin.split ('Rin')[1];\n\tvar rin = rin.split ('\\n')[1];\n\tvar rin = rin.split('Encapsulamento')[0];\n\tvar rin = rin.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '');\n\t\n\tvar contagem = document.getElementById(\"manobraunicabox\").value.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '\\n');\n\tvar contagem = contagem.split('alimentador')[1];\n\tvar contagem = contagem.split ('Voz')[1];\n\tvar contagem = contagem.split ('Prim')[0];\n\tvar contagem = contagem.split ('-');\n\tvar contagemA = contagem[0];\n\tvar contagemB = contagem[1];\n\tvar contagemF = contagemA+'-'+contagemB;\n\tvar contagemF = contagemF.replace(/(?:\\r\\n|\\r|\\n|\\t)/g, '');\n\t\n\tsessionStorage.setItem('texto',document.getElementById(\"manobraunicabox\").value);\n\tsessionStorage.setItem('inst',inst);\n\tsessionStorage.setItem('estado',estado);\n\tsessionStorage.setItem('cidade',cidade);\n\tsessionStorage.setItem('ard',ard);\n\tsessionStorage.setItem('rin',rin);\n\tsessionStorage.setItem('contagem',contagemF);\n\t\n\t\n\t//console.log ('Instância: '+inst+'\\nCidade: '+cidade+'\\nArmário: '+ard+'\\nContagem: '+contagemF+'\\nRin: '+rin);\n\t\n\t\n\t\n\tsetTimeout(function (){\n\t\t//MASSIVA_PRIMARIO_AC\n\t\tif(typeof(document.getElementsByName('perfil')[0]) !== 'undefined' && document.getElementsByName('perfil')[0] !== null) {\n\t\t\tvar perfil = document.getElementsByName('perfil')[0].options.selectedIndex;\n\t\t\tif (perfil==0|perfil==null){\n\t\t\t\tfor (p=0;p<document.getElementsByName('perfil')[0].options.length;p++){\n\t\t\t\t\tif(document.getElementsByName('perfil')[0].options[p].text=='MASSIVA_PRIMARIO_'+sessionStorage.getItem('estado')){\n\t\t\t\t\t\t//console.log(document.getElementsByName('perfil')[0].options[i].text+'-'+i);\n\t\t\t\t\t\tdocument.getElementsByName('perfil')[0].options[p].selected=true;\n\t\t\t\t\t\tsessionStorage.setItem ('continuar', 'sim');\n\t\t\t\t\t\tdocument.initForm.submit();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\t\t\t\n\t\tvar cidadeOrigem = document.getElementsByName('cidadeOrigem.cityName')[0].options.selectedIndex;\n\t\tvar armarioOrigem = document.getElementsByName('armarioOrigem.locationId')[0].options.selectedIndex;\n\t\tvar shelfOrigem = document.getElementsByName('shelfOrigem.equipmentId')[0].options.selectedIndex;\n\n\t\tif ((cidadeOrigem==0|cidadeOrigem==null)&sessionStorage.getItem('setCidade')!='ok'){\n\t\t\tfor (i=0;i<document.getElementsByName('cidadeOrigem.cityName')[0].options.length;i++){\n\t\t\t\tif(document.getElementsByName('cidadeOrigem.cityName')[0].options[i].text==sessionStorage.getItem('cidade')){\n\t\t\t\t\t//console.log(document.getElementsByName('cidadeOrigem.cityName')[0].options[i].text+'-'+i);\n\t\t\t\t\tdocument.getElementsByName('cidadeOrigem.cityName')[0].options[i].selected=true;\n\t\t\t\t\tsessionStorage.setItem ('continuar', 'sim');\n\t\t\t\t\tsessionStorage.setItem ('setCidade','ok');\n\t\t\t\t\tVerificaCidade('Cidade');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if((armarioOrigem==0|armarioOrigem!=null)&sessionStorage.getItem('setOrigem')!='ok'){\n\t\t\tfor (j=0;j<document.getElementsByName('armarioOrigem.locationId')[0].options.length;j++){\n\t\t\t\tif (document.getElementsByName('armarioOrigem.locationId')[0].options[j].text.indexOf(sessionStorage.getItem('ard'))> -1){\n\t\t\t\t\tdocument.getElementsByName('armarioOrigem.locationId')[0].options[j].selected=true;\n\t\t\t\t\tsessionStorage.setItem ('continuar', 'sim');\n\t\t\t\t\tsessionStorage.setItem ('setOrigem','ok');\n\t\t\t\t\tverificaOrigemDestinoArmario('origem');\n\t\t\t\t}\t\t\t\t\n\t\t\t}\t\n\t\t}\n\t\telse if ((shelfOrigem==0|shelfOrigem!=null)&sessionStorage.getItem('setRin')!='ok') {\n\t\t\tfor (l=0;l<document.getElementsByName('shelfOrigem.equipmentId')[0].options.length;l++){\n\t\t\t\tif (document.getElementsByName('shelfOrigem.equipmentId')[0].options[l].text.indexOf(sessionStorage.getItem('rin'))> -1){\n\t\t\t\t\tdocument.getElementsByName('shelfOrigem.equipmentId')[0].options[l].selected=true;\n\t\t\t\t\tsessionStorage.setItem ('continuar', 'sim');\n\t\t\t\t\tsessionStorage.setItem ('setRin','ok');\n\t\t\t\t\tatualizaValorTecnologia('origem');\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tsessionStorage.setItem ('continuar', 'nao');\n\t\t}\t\n\t}, 1000);\n\tdocument.getElementsByName('instancias')[0].value=sessionStorage.getItem('inst');\n}", "static GetUtilidad(cadenaDeConexion, fI, fF, idSucursal, result) {\n\n var sucursal = '';\n if (idSucursal != 1) {\n sucursal = `AND info_ingresos.codSucursal=` + idSucursal;\n }\n console.log(\"sucursal \", sucursal);\n sqlNegocio(\n cadenaDeConexion,\n ` SELECT base.codMes, SUM(base.precioVenta) as totalVenta from (SELECT info_grupopartidas.nombreGrupo,info_ingresos.codMes,\n\n CASE info_grupopartidas.nombreGrupo\n WHEN 'EGRESOS' THEN -(SUM(info_ingresos.sumPrecioVenta))\n WHEN 'INGRESOS' THEN SUM(info_ingresos.sumPrecioVenta)\n END as precioVenta\n \n \n from info_ingresos LEFT JOIN\n info_partidas on info_ingresos.idPartida = info_partidas.idPartida LEFT JOIN \n info_grupopartidas on info_grupopartidas.idGrupoPartida = info_partidas.idGrupo \n where info_ingresos.fecEmision BETWEEN '`+ fI + `' AND '` + fF + `' AND info_ingresos.estado=1 ` + sucursal + ` AND ( info_grupopartidas.nombreGrupo = 'EGRESOS' or info_grupopartidas.nombreGrupo = 'INGRESOS')\n group by info_grupopartidas.nombreGrupo,info_ingresos.codMes)as base group by base.codMes\n order by base.codMes ASC`,\n [],\n function (err, res) {\n if (err) {\n console.log(\"error: \", err);\n result(null, err);\n }\n else {\n result(null, res);\n }\n });\n }", "function jogosDaDesenvolvedora(desenvolvedora){\n let jogos = [];\n\n for (let categoria of jogosPorCategoria) {\n for ( let jogo of categoria.jogos ) {\n if (jogo.desenvolvedora === desenvolvedora){\n jogos.push(jogo.titulo)\n } \n }\n }\n console.log(\"Os jogos da \" + desenvolvedora + \" são: \" + jogos)\n}", "function recogerBusqueda(e) { \n\n let palabraBuscar = e.target.value.toLowerCase();\n\n var listaBusqueda = filtrarBusqueda(agendaActividades, palabraBuscar); //funcion filtrarBusqueda linea 22/interno\n\n pintarActividades(listaBusqueda); //Pintamos el resultado del filtro con la funcion pintarActividades que a su vez usa la funcion pintarActividad\n}", "function Buscar() {\n //todos objBusqueda esta en los respectivos js\n var objConf = objConfiguracionGlobal;\n var objBus = objBusquedaGlobal;\n\n //recibe el valor id cama.js\n var valor = get(objBus.id);\n\n //url absoluta y agrega el contenido de la tabla a divContenedor\n fetchGet(`${objBus.url}/?${objBus.nombreParametro}=` + valor, function (res) {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n\n /* fetch(`${objBus.url}/?${objBus.nombreParametro}=` + valor)\n .then(res => res.json())\n .then(res => {\n var respuesta = generarTabla(objConf, res);\n document.getElementById(\"divContenedor\").innerHTML = respuesta;\n\n })\n */\n\n //pintar({\n // //ahora cambia esta linea\n // url: `${objBus.url}/?${objBus.nombreParametro}=` + valor,\n // id: objConf.id,\n // cabeceras: objConf.cabeceras,\n // propiedades: objConf.propiedades\n\n //}, objBus)\n\n}", "finirLeTour() {\n switch (this.etat) {\n case ETAT_INITIALISATION:\n default:\n // Appel à \"finirLeTour\" lorsque la game est en initialisation (case ETAT_INITIALISATION)\n // OU dans un état inconnu (default case).\n console.log(\"DEFAULT CASE !\");\n break;\n case ETAT_DEPLACEMENT:\n this.changerJoueur();\n this.joueurs[this.indexJoueurActuel].casesPossiblesDeplacement();\n break;\n case ETAT_COMBAT:\n console.log(\"FIGHT CASE !\");\n // On change de joueur\n this.changerJoueur();\n\n // Pour chaque \"paire\" de boutons (1 paire par joueur)\n this.boutons.forEach((pair, idx) => {\n // On désactive les boutons si ceux-ci font partie de l'objet \"pair\"\n // qui correspond au joueur dont le tour est terminé.\n pair.attaquer[0].disabled = idx === this.indexAutreJoueur;\n pair.defendre[0].disabled = idx === this.indexAutreJoueur;\n });\n break;\n }\n }", "function buscarProjeto(idProjeto) {\n\n // atribuir a variavel projetoEncontrado o retorno do filtro\n // projeto é cada posição do array que o filtro vai acessar para buscar nossa condição\n // return é o resultado da nossa condicao\n\n // tambem poderiamos usar o metodo find\n\n /*let projetoEncontrado = listaDeProjetos.filter(function (projeto){\n return projeto.idProjeto === idProjeto;\n });*/\n let projetoEncontrado = listaDeProjetos.find(function (projeto){\n return projeto.idProjeto === idProjeto;\n });\n\n if(projetoEncontrado !== undefined){\n return projetoEncontrado;\n } else {\n return `Projeto nao encontrado`;\n }\n}", "toString(){\n //Se aplica poliformismo (multiples formas en tiempo de ejecucion)\n //el metodo que se ejecuta depende si es una referencia de tipo padre \n //o de tipo hijo\n return this.nombreCompleto();\n }", "toString(){\r\n //Se aplica poliformismo (multiples formas en tiempo de ejecucion)\r\n //el metodo que se ejecuta depende si es una referencia de tipo padre \r\n //o de tipo hijo\r\n return this.nombreCompleto();\r\n }", "function posarBoleta(e) {\r\n// console.log(\"has clicat el \"+ e.target.getAttribute('id'));\r\n if (numDeClics==0) {\r\n //si guanya\r\n if (e.target.getAttribute('id')==aleatorio) {\r\n resultat(\"guany\", \"Felicitats :)\");\r\n // resultat(\"Felicitats :)\");\r\n //si perd\r\n }else{\r\n // resultat(\"Torna a provar! :S\");\r\n resultat(\"perd\", \"Torna a provar! :S\");\r\n\r\n }\r\n numDeClics=numDeClics+1;\r\n }\r\n}", "function buscarCerca(posicion) {\n /* Completar la función buscarCerca que realice la búsqueda de los lugares\n del tipo (tipodeLugar) y con el radio indicados en el HTML cerca del lugar\n pasado como parámetro y llame a la función marcarLugares. */\n let radio = parseInt(document.getElementById(\"radio\").value);\n let tipoLugar = document.getElementById(\"tipoDeLugar\").value;\n let request = {\n location: posicion,\n radius: radio,\n type: tipoLugar\n };\n servicioLugares.nearbySearch(request, marcadorModulo.marcarLugares);\n }", "function comprarCurso(e){\n e.preventDefault();\n //delegation para agregar carrito\n\n if(e.target.classList.contains('agregar-carrito')){\n const curso = e.target.parentElement.parentElement;\n //acá lo que hizo es seleccionar una parte del interior de la card del curso\n //se tiene que seleccionar toda la cart, por esto, hizo el segundo parent element,\n //para llegar al padre anterior, ahi ya selecciono toda la card\n\n leerDatosCursos(curso);\n //esta funcion va recibir la info de curso y va a leerla.\n } //se envian los cursos seleccionados pa tomar datos\n\n \n}", "function InfoLesion(cie10, id, elemento){\n\n // Consulto el indice del arreglo por medio de la propiedad id\n var indice = buscarLesion(id);\n\n // Con el #id del elemento consulto el texto de la etiqueta <p>,\n // el cual es el nombre de la lesión\n var nombreLesion = $('#' + elemento + ' .item_text > p').text();\n var codigoLesion = $('#' + elemento + ' .item_codigo > p > span').text();\n\n // Valido si la lesión existe en el arreglo infoLesion\n if (buscarLesion(id) != -1) {\n\n // Elimino la lesión si existe en el arreglo infoLesion\n infoLesion.splice(indice , 1);\n\n // Animación para item que emulan las lesiones seleccionadas\n // en la barrar superior.\n $(\"#fracturaSelect_\" + id).animate({\n width:'0px',\n opacity: 0\n }, 200 , function() {\n\n // Cuando termina la animación se elimina el elemento del DOM\n $(\"#fracturaSelect_\" + id).remove();\n\n });\n\n // Setear la variable global\n seleccion = false;\n\n }\n\n // Si la lesión no esta en el arreglo infoLesion\n else {\n\n // Agragar clase lesionActiva a la lesion seleccionada,\n // esto da el efecto de selección de color verde\n $('#' + elemento).addClass('lesionActiva');\n\n // Objeto temporal con la información de la lesión seleccionada\n var tempInfoLesion = {\n 'nombre': nombreLesion,\n 'cie10' : cie10,\n 'id' : id,\n 'especificacion' : ''\n };\n\n // Agrego al final del arreglo infoLesion el objeto temporal\n infoLesion.push(tempInfoLesion);\n\n // Crear y imprimir en la barra superior un nuevo item\n // el cual representa a una lesión\n $(\"#cont-barraFracturasSelectId\").append(\"\\\n <li class='fracturaSelect' id='fracturaSelect_\"+ id +\"' title='\"+ nombreLesion +\"'>\\\n <p>\"+ codigoLesion +\"</p>\\\n <i class='fa fa-times' onclick=\\\"InfoLesion(null , \"+ id +\" ,'\"+ elemento +\"')\\\"></i>\\\n </li>\\\n \");\n\n // Setear la variable global\n seleccion = true;\n\n }\n\n // Actualizar cantidad de lesiones seleccionadas\n var bola_plus = document.getElementById('bola_plus');\n bola_plus.setAttribute('fracturasSeleccionadas' , infoLesion.length);\n\n // Validar si no hay lesiones seleccionadas y remover clase lesionActiva\n if (seleccion === false) {\n $('#'+elemento).removeClass('lesionActiva');\n }\n\n }", "function afficher() {\n console.log (\"\\nVoici la liste de tous vos contacts :\");\n Gestionnaire.forEach(function (liste) {\n\n console.log(liste.decrire()); // on utilise la méthode decrire créé dans nos objets\n\n }); // la parenthese fermante correspond à la la parenthese de la méthode forEach()\n\n}", "recorrerArbolConsulta(nodo) {\n //NODO INICIO \n if (this.tipoNodo('INICIO', nodo)) {\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //NODO L, ES LA LISTA DE CONSULTAS \n if (this.tipoNodo('L', nodo)) {\n //SE RECORREN TODOS LOS NODOS QUE REPRESENTAN UNA CONSULTA \n for (var i = 0; i < nodo.hijos.length; i++) {\n this.recorrerArbolConsulta(nodo.hijos[i]);\n this.reiniciar();\n // this.codigoTemporal += \"xxxxxxxxxxxxxxxxxxxx-\"+this.contadorConsola+\".\"+\"\\n\";\n }\n }\n //PARA RECORRER TODOS LOS ELEMENTOS QUE COMPONEN LA CONSULTA \n if (this.tipoNodo('CONSULTA', nodo)) {\n for (var i = 0; i < nodo.hijos.length; i++) {\n this.pathCompleto = false;\n this.controladorAtributoImpresion = false;\n this.controladorDobleSimple = false;\n this.controladorPredicado = false;\n this.recorrerArbolConsulta(nodo.hijos[i]);\n }\n }\n //PARA RECORRER TODOS LOS ELEMENTOS QUE COMPONEN LA CONSULTA \n if (this.tipoNodo('VAL', nodo)) {\n for (var i = 0; i < nodo.hijos.length; i++) {\n this.pathCompleto = false;\n this.controladorAtributoImpresion = false;\n this.controladorDobleSimple = false;\n this.controladorPredicado = false;\n this.recorrerArbolConsulta(nodo.hijos[i]);\n }\n }\n //PARA VERIFICAR EL TIPO DE ACCESO, EN ESTE CASO // \n if (this.tipoNodo('DOBLE', nodo)) {\n this.controladorDobleSimple = true;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //PARA VERIFICAR EL TIPO DE ACCESO, EN ESTE CASO: /\n if (this.tipoNodo('SIMPLE', nodo)) {\n //Establecemos que se tiene un acceso de tipo DOBLE BARRA \n this.controladorDobleSimple = false;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UN IDENTIFICADOR \n if (this.tipoNodo('identificador', nodo)) {\n const str = nodo.hijos[0];\n this.busquedaElemento(str);\n }\n //PARA VERIFICAR SI LO QUE SE VA A ANALIZAR ES UN PREDICADO \n if (this.tipoNodo('PREDICADO', nodo)) {\n this.controladorPredicado = true;\n const identificadorPredicado = nodo.hijos[0];\n //Primero se procede a la búsqueda del predicado\n this.codigoTemporal += \"//Inicio ejecucion predicado\\n\";\n this.busquedaElemento(identificadorPredicado);\n //Seguidamente se resuelve la expresión\n let resultadoExpresion = this.resolverExpresion(nodo.hijos[1]);\n let anteriorPredicado = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=\" + anteriorPredicado + \";\\n\";\n let predicadoVariable = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"PXP = \" + predicadoVariable + \";\\n\";\n this.codigoTemporal += \"ubicarPredicado();\\n\";\n //SI EL RESULTADO ES DE TIPO ETIQUETA\n if (resultadoExpresion.tipo == 4) {\n let datos = resultadoExpresion.valor;\n let a = datos[0];\n let b = datos[1];\n let c = datos[2];\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n // salidaXPATH.getInstance().push(this.consolaSalidaXPATH[i].dameID());\n this.auxiliarPredicado(a, b, c, this.consolaSalidaXPATH[i]);\n }\n }\n //SI EL RESULTADO ES DE TIPO ETIQUETA\n if (resultadoExpresion.tipo == 1) {\n this.consolaSalidaXPATH.push(this.consolaSalidaXPATH[(this.contadorConsola + resultadoExpresion.valor) - 1]);\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n }\n this.controladorPredicadoInicio = false;\n }\n //PARA VERIFICAR QUE ES UN PREDICADO DE UN ATRIBUTO\n if (this.tipoNodo('PREDICADO_A', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n const identificadorPredicadoAtributo = nodo.hijos[0];\n //RECORREMOS LO QUE VA DENTRO DE LLAVES PARA OBTENER EL VALOR\n //AQUI VA EL METODO RESOLVER EXPRESION DE SEBAS PUTO \n return this.recorrerArbolConsulta(nodo.hijos[1]);\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UN ATRIBUTO \n if (this.tipoNodo('atributo', nodo)) {\n this.controladorAtributoImpresion = true;\n const identificadorAtributo = nodo.hijos[0];\n if (this.inicioRaiz) {\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let x = this.consolaSalidaXPATH[i];\n //let nodoBuscarAtributo = this.consolaSalidaXPATH[this.consolaSalidaXPATH.length - 1];\n let nodoBuscarAtributo = x;\n //CODIGO DE 3 DIRECCIONES \n this.codigoTemporal += \"P=\" + nodoBuscarAtributo.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var z = 0; z < identificadorAtributo.length; z++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${identificadorAtributo.charCodeAt(z)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaAtributo();\\n\";\n //CODIGO DE 3 DIRECCIONES \n //Se procede a la búsqueda de los atributos en todos los nodos\n for (let entry of nodoBuscarAtributo.atributos) {\n let atributoTemporal = entry;\n let nombreAbributo = atributoTemporal.dameNombre();\n if (nombreAbributo == identificadorAtributo) {\n this.atributoID = identificadorAtributo;\n this.pathCompleto = true;\n // this.contadorConsola = i;\n // this.consolaSalidaXPATH.push(nodoBuscarAtributo);\n }\n }\n /*for (let entry of nodoBuscarAtributo.hijos) {\n this.busquedaAtributo(entry, identificadorAtributo);\n }*/\n if (this.controladorDobleSimple) {\n this.busquedaAtributo(x, identificadorAtributo);\n }\n }\n }\n else {\n this.inicioRaiz = true;\n for (let entry of this.ArrayEtiquetas) {\n let temp = entry;\n //CODIGO DE 3 DIRECCIONES \n this.codigoTemporal += \"P=\" + temp.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var z = 0; z < identificadorAtributo.length; z++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${identificadorAtributo.charCodeAt(z)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaAtributo();\\n\";\n //CODIGO DE 3 DIRECCIONES \n for (let entry2 of temp.atributos) {\n let aTemp = entry2;\n let nameAtt = aTemp.dameNombre();\n if (nameAtt == identificadorAtributo) {\n this.atributoID = identificadorAtributo;\n this.pathCompleto = true;\n }\n }\n if (this.controladorDobleSimple) {\n this.busquedaAtributo(entry, identificadorAtributo);\n }\n }\n }\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES CUALQUIER ELEMENTO \n if (this.tipoNodo('any', nodo)) {\n //SIGNIFICA ACCESO DOBLE\n if (this.controladorDobleSimple) {\n let controladorNuevoInicio = -1;\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let temporal = this.consolaSalidaXPATH[i];\n for (let entry of temporal.hijos) {\n //insertamos TODOS los hijos\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirContenido();\\n\";\n this.consolaSalidaXPATH.push(entry);\n if (controladorNuevoInicio == -1)\n controladorNuevoInicio = this.consolaSalidaXPATH.length - 1;\n this.complementoAnyElement(entry);\n }\n }\n this.contadorConsola = controladorNuevoInicio;\n this.pathCompleto = true;\n }\n //SIGNIFICA ACCESO SIMPLE \n else {\n //Controlamos el nuevo acceso para cuando coloquemos un nuevo elemento en la lista \n let controladorNuevoInicio = -1;\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let temporal = this.consolaSalidaXPATH[i];\n for (let entry of temporal.hijos) {\n //insertamos TODOS los hijos\n this.consolaSalidaXPATH.push(entry);\n if (controladorNuevoInicio == -1)\n controladorNuevoInicio = this.consolaSalidaXPATH.length - 1;\n }\n }\n this.contadorConsola = controladorNuevoInicio;\n this.pathCompleto = true;\n }\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UNA PALABRA RESERVADA que simplicaria un AXE \n if (this.tipoNodo('reservada', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n const identificador = nodo.hijos[0];\n this.auxiliarAxe = identificador;\n //VERIFICAMOS EL TIPO DE ACCESO DE AXE \n if (this.controladorDobleSimple)\n this.dobleSimpleAxe = true;\n }\n if (this.tipoNodo('AXE', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n if (this.dobleSimpleAxe)\n this.controladorDobleSimple = true;\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var i = 0; i < this.auxiliarAxe.length; i++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${this.auxiliarAxe.charCodeAt(i)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n this.codigoTemporal += \"PXP =\" + this.temporalGlobal.retornarString() + \";\\n\";\n this.codigoTemporal += \"ejecutarAxe();\\n\";\n //Si Solicita implementar el axe child\n if (this.auxiliarAxe == \"child\") {\n //ESCRIBIMOS LOS IFS RESPECTIVOS \n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //Si necesitsa implementar el axe attribute\n if (this.auxiliarAxe == \"attribute\") {\n //Le cambiamos la etiqueta de identificador a atributo para fines de optimizacion de codigo\n nodo.hijos[0].label = \"atributo\";\n //Escribimos el codigo en C3D para la ejecución del axe atributo \n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //Si necesitsa implementar el ancestor\n if (this.auxiliarAxe == \"ancestor\") {\n //Va a resolver el predicado o identificador que pudiese venir \n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n if (this.auxiliarAxe == \"descendant\") {\n this.controladorDobleSimple = true;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //Reiniciamos la variable cuando ya se acabe el axe\n this.auxiliarAxe = \"\";\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UN ATRIBUTO \n if (this.tipoNodo('X', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n //const identificadorAtributo = nodo.hijos[0] as string;\n this.controladorDobleSimple = true;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n /*\n EN ESTA PARTE SE VA A PROCEDER PARA IR A BUSCAR EL ELEMENTO SEGÚN TIPO DE ACCESO\n */\n }\n //PARA VERIFICAR SI SE NECESITAN TODOS LOS ATRIBUTOS DEL NODO ACTUAL \n if (this.tipoNodo('any_att', nodo)) {\n this.controladorText = true;\n const identificadorAtributo = nodo.hijos[0];\n //Verificamos el tipo de acceso\n //Significa acceso con prioridad\n if (this.controladorDobleSimple) {\n //VERIFICAMOS DESDE DONDE INICIAMOS\n if (!this.inicioRaiz) {\n this.inicioRaiz = true;\n for (let entry of this.ArrayEtiquetas) {\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n this.complementoAnnyAtributte(entry);\n }\n }\n else {\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let entry = this.consolaSalidaXPATH[i];\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n this.complementoAnnyAtributte(entry);\n }\n }\n }\n //Acceso sin prioridad\n else {\n if (!this.inicioRaiz) {\n for (let entry of this.ArrayEtiquetas) {\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n }\n }\n else {\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let entry = this.consolaSalidaXPATH[i];\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n }\n }\n }\n } //FIN ANNY ATT\n //PARA VERIFICAR SI SE ESTÁ INVOCANDO A LA FUNCIÓN TEXT() \n if (this.tipoNodo('text', nodo)) {\n this.controladorText = true;\n const identificadorAtributo = nodo.hijos[0];\n //Si se necesita el texto de el actual y los descendientes\n if (this.controladorDobleSimple) {\n for (var i = this.contadorConsola; i < this.consolaSalidaXPATH.length; i++) {\n /*if (this.consolaSalidaXPATH[i].dameValor() == \"\" || this.consolaSalidaXPATH[i].dameValor() == \" \") {\n \n } else {\n // salidaXPATH.getInstance().push(this.consolaSalidaXPATH[i].dameValor());\n }*/\n this.codigoTemporal += \"P=\" + this.consolaSalidaXPATH[i].posicion + \";\\n\";\n this.codigoTemporal += \"text();\\n\";\n this.complementoText(this.consolaSalidaXPATH[i]);\n }\n }\n else {\n //si necesita solo el texto del actual \n for (var i = this.contadorConsola; i < this.consolaSalidaXPATH.length; i++) {\n /* if (this.consolaSalidaXPATH[i].dameValor() == \"\" || this.consolaSalidaXPATH[i].dameValor() == \" \") {\n \n } else {\n //salidaXPATH.getInstance().push(this.consolaSalidaXPATH[i].dameValor());\n }*/\n this.codigoTemporal += \"P=\" + this.consolaSalidaXPATH[i].posicion + \";\\n\";\n this.codigoTemporal += \"text();\\n\";\n }\n }\n }\n //PARA VERIFICAR SI ES EL TIPO DE ACCESO AL PADRE: \":\" \n if (this.tipoNodo('puntos', nodo)) {\n const cantidad = nodo.hijos[0];\n //DOSPUNTOSSSSSSSSS\n if (cantidad.length == 2) {\n this.pathCompleto = true;\n if (this.auxiliarArrayPosicionPadres == -1) {\n this.auxiliarArrayPosicionPadres = this.arrayPosicionPadres.length - 1;\n }\n for (var i = this.auxiliarArrayPosicionPadres; i >= 0; i--) {\n let contadorHermanos = this.arrayPosicionPadres[i];\n let controladorInicio = 0;\n if (i > 0) {\n while (contadorHermanos != this.arrayPosicionPadres[i - 1]) {\n this.consolaSalidaXPATH.push(this.consolaSalidaXPATH[contadorHermanos]);\n this.codigoTemporal += \"P =\" + this.consolaSalidaXPATH[contadorHermanos].posicion + \";\\n\";\n if (controladorInicio == 0) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n }\n controladorInicio++;\n contadorHermanos--;\n this.auxiliarArrayPosicionPadres = contadorHermanos;\n }\n }\n else {\n while (contadorHermanos >= 0) {\n this.consolaSalidaXPATH.push(this.consolaSalidaXPATH[contadorHermanos]);\n this.codigoTemporal += \"P =\" + this.consolaSalidaXPATH[contadorHermanos].posicion + \";\\n\";\n if (controladorInicio == 0) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n }\n controladorInicio++;\n contadorHermanos--;\n this.auxiliarArrayPosicionPadres = contadorHermanos;\n }\n }\n break;\n }\n this.codigoTemporal += \"busquedaSimple();\\n\";\n }\n //SIGNIFICA QUE TIENE SOLO UN PUNTO \n else {\n this.pathCompleto = true;\n }\n ///DOS PUNTOOOOOOOOOOOOOOOOS\n }\n }", "function EscuelaDigital(nombre) {\n this.cursos = [];\n this.nombre = nombre;\n }", "function create_bieudo(e) {\n var id_dialog = $('.cke_dialog_contents_body:visible').attr('id');\n var _nbd = $('#' + id_dialog + ' #_bd_num').val();\n var _onedb = $('#' + id_dialog + ' #_bd_oned').val();\n var _twodb = $('#' + id_dialog + ' #_bd_twod').val();\n if (_nbd == '') {\n alert('Chua nhap!');\n } else {\n\n var _ht = '<div class=\"_cbieudo\">' + _nbd + '_' + _onedb + '_' + _twodb + '</div>';\n $('#' + id_dialog + ' .hienthi').html(_ht);\n //_parse_cbd();\n // === parse ===\n var _cbd = $('._cbieudo').text();\n if (_cbd != '') {\n var arr_cbd = _cbd.split('_');\n var arr_cbd1 = arr_cbd[0].split('-');\n var arr_cbd2 = arr_cbd[1].split('-');\n var arr_cbd3 = arr_cbd[2].split('-');\n var htm = '<div class=\"_line_bd\">';\n for (var i = 0; i < arr_cbd1[0]; i++) {\n if (i === 0 && arr_cbd2[0] >= 1) {\n htm += '<span class=\"_p_bd\"><span class=\"_bdone _' + arr_cbd2[0] + '\"><span>' + arr_cbd2[1] + '</span></span></span>';\n //}else if( i == (_onedb1) && _twodb1 >0){\n } else if (i == (arr_cbd1[0] - 1) && arr_cbd3[0] > 0) {\n htm += '<span class=\"_p_bd\"><span class=\"_bdtwo _' + arr_cbd3[0] + '\"><span>' + arr_cbd3[1] + '</span></span></span>';\n } else\n htm += '<span class=\"_p_bd\"></span>';\n }\n htm += '<span class=\"_p_end\"></span>';\n if (arr_cbd1[1] != '')\n htm += '<span class=\"_bdall\"><span>' + arr_cbd1[1] + '</span></span>';\n htm += '</div><div class=\"space20\"></div>';\n }\n $('.view_btn').prepend(htm);\n\n }\n}", "constructor(ojos, boca, extremidades, duenio) {\n super(ojos, boca, extremidades);\n this.duenio = duenio;\n this.estaDomesticado = true;\n }", "function heredaDe(prototipoHijo, prototipoPadre) { // Esta es una funcion que recibe funciones\n var fn = function () {} // Creamos una funcion vacia\n fn.prototype = prototipoPadre.prototype // Hacemos una copia del prototipo del Padre para guardarlo en el protitipo de nuestra funcion vacia\n prototipoHijo.prototype = new fn // De esa forma evitamos acceder directamente a la funcion y no la pizamos\n prototipoHijo.prototype.constructor = prototipoHijo //Asignamos la funcion constructora\n //Si no agregamos la ultima linea se estaria llamando al constructor de prototipo padre\n}", "function gestoreMaestro(scuola, maestro) {\r\n try {\r\n\r\n var scuola = nodoSelScuola.value;\r\n var maestro = nodoSelMaestro.value;\r\n var z = contenuti.cercaMaestro(maestro, scuola);\r\n\r\n if (z.length > 0) {\r\n var zDiv = \"\";\r\n for (var i = 0; i < z.length; i++) {\r\n zDiv += z[i].generaDiv();\r\n }\r\n nodoRisultati.innerHTML = zDiv;\r\n }\r\n } catch (e) {\r\n alert(\"gestoreMaestro \" + e);\r\n }\r\n}", "toString(){\n //se aplica polimorfismo(el metodo que se ejecuta depende si es una referencia\n // de tipo padre o de tipo hijo)\n return this.nombreCompleto();\n }", "function nuevoEsquemaComision(cuadroOcultar, cuadroMostrar){\n\t\tcuadros(\"#cuadro1\", \"#cuadro2\");\n\t\tlimpiarFormularioRegistrar(\"#form_esquema_comision_registrar\");\n\t\t$(\"#id_vendedor_registrar\").focus();\n\t}", "function buscarVehiculo(cplaca) {\n let resultado = baseVehiculo.filter(fila => fila.placa == cplaca);\n\n for (const vehiculo of resultado) {\n return vehiculo;\n }\n\n}", "function desclickear(e){\n movible = false;\n figura = null;\n}", "function eliminarCurso(e) {\n\n if (e.target.classList.contains('borrar-curso')) {\n const cursoId = e.target.getAttribute('data-id')\n\n // Elimina del arreglo de articulosCarrito por el data-id\n articulosCarrito = articulosCarrito.filter(curso => curso.id !== cursoId)\n // console.log(articulosCarrito)\n carritoHTML() // Iterar sobre el carrito y mostrar su HTML\n }\n}", "function cargarDulces() {\n // inicio carga de caramelo en tablero\n function dulce(r,c,obj,src) {\n return {\n r: r, \n c: c, \n src:src, \n locked:false, \n isInCombo:false, \n o:obj \n };\n }\n\n // preparando el tablero\n for (var r = 0; r < rows; r++) {\n grid[r]=[];\n for (var c =0; c < cols; c++) {\n grid[r][c]= new dulce(r,c,null,azarDulce());\n }\n }\n\n // Coordenadas iniciales:\n var height = $('.panel-tablero').height(); \n var cellHeight = height / 7;\n\n // creando imagenes en el tablero\n for (var r = 0; r < rows; r++) {\n for (var c =0; c< cols; c++) {\n var cell = $(\"<img class='dulce' id='dulce_\"+r+\"_\"+c+\"' r='\"+r+\"' c='\"+c+\n \"'ondrop='_onDrop(event)' ondragover='_onDragOverEnabled(event)'src='\"+\n grid[r][c].src+\"' style='height:\"+cellHeight+\"px'/>\");\n cell.attr(\"ondragstart\",\"_ondragstart(event)\");\n $(\".col-\"+(c+1)).append(cell);\n grid[r][c].o = cell;\n }\n }\n}", "function buscarHopedajes(busqueda, regex) {\n\n return new Promise((resolve, reject) => {\n\n Hospedaje.find({ nombre: regex })\n .populate('usuario', 'nombre email')\n .exec(\n\n (err, hospedajes) => {\n if (err) {\n reject('Error al buscar hospedaje', err);\n\n } else {\n resolve(hospedajes)\n }\n });\n\n });\n\n}", "function dibujarFresado109(modelo,di,pos,document){\n\t\n\t//ESTABLECER CAPA\n\tvar op_fresado = new RAddObjectsOperation();\n\tdi.setCurrentLayer(\"Fresado\"); //Seleccionar la capa de fresado\n\t\n\tvar plieguesInf=[pliegueInf1, pliegueInf2, pliegueInf3, pliegueInf4]\n\t\n\t//sacar el mayor pliegue\n\tpliegueInferior=pliegueInf1\n\tfor (var n=0; n<4 ;n=n+1){\n\t\tif (pliegueInferior<plieguesInf[n]){\n\t\t\tpliegueInferior=plieguesInf[n]\n\t\t}\n\t} \n\t\n\t\n\t//Puntos trayectoria \n \n\t\n\tvar fresado11 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior)\n\tvar fresado12 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+pliegueInferior)\n\tvar fresado13 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+pliegueInferior)\n\tvar fresado14 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior)\n\tvar fresado15 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior)\n\t\n\tvar fresado16 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+pliegueIzq)\n\tvar fresado17 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\t\n\tvar fresado18 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado19 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado20 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado21 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\tvar fresado22 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca)\n\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado15 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado22 , fresado17 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado17 , fresado16 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado11 , fresado18 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado19 , fresado12 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado13 , fresado20 ));\n\top_fresado.addObject(line,false);\n\tvar line = new RLineEntity(document, new RLineData( fresado21 , fresado14 ));\n\top_fresado.addObject(line,false);\n\n\t\n\t\n\t\n\t\n\t\n\t//anchura1 - Inferior\n\tif (anchura1>pliegueInf1){\n\t\tvar fresado10 = new RVector(pos.x+alaIzquierda,pos.y+pliegueInferior+alaInferior-pliegueIzq) \n\t\tvar fresado1 = new RVector(pos.x+alaIzquierda,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado2 = new RVector(pos.x+alaIzquierda+pliegueIzq,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\tvar fresado3 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueInf1,pos.y+alaInferior+pliegueInferior-pliegueInf1)\n\t\t\n\t\tvar line = new RLineEntity(document, new RLineData( fresado10 , fresado1 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado1 , fresado3 ));\n\t\top_fresado.addObject(line,false);\n\t\tvar line = new RLineEntity(document, new RLineData( fresado2 , fresado11 ));\n\t\top_fresado.addObject(line,false);\n\n\t} \n\t\n\t//anchura2 - Inferior\n\tif (anchura2>(pliegueInf2*2)){\n\t\tvar fresado4 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar fresado5 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueInf2,pos.y+alaInferior+pliegueInferior-pliegueInf2)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado4 , fresado5 ));\n\t\top_fresado.addObject(line,false);\n\t}\n\t\n\t//anchura3 - Inferior\n\tif (anchura3>(pliegueInf3*2)){\n\t\tvar fresado6 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar fresado7 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueInf3,pos.y+alaInferior+pliegueInferior-pliegueInf3)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado6 , fresado7 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t} \n\t\n\t//anchura4 - Inferior\n\tif (anchura4>pliegueInf4){\n\t\tvar fresado8 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueInf4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar fresado9 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior-pliegueInf4)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado8 , fresado9 ));\n\t\top_fresado.addObject(line,false);\n\t} \n\t\n\t\n\t\n\n\t\n\t\t\n\n\t\n\t//anchura1 - Superior\n\tif (anchura1>(pliegueSuperior*2)){\n\t\tvar fresado25 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado26 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado25 , fresado26 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ //Esto es para hacer el fresado externo o no\n\t\t\tvar fresado23 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado24 = new RVector(pos.x+alaIzquierda+pliegueIzq+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado23 , fresado24 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado27 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado28 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado27 , fresado28 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura2 - Superior\n\tif (anchura2>(pliegueSuperior*2)){\n\t\tvar fresado31 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado32 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado31 , fresado32 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado29 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado30 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado29 , fresado30 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado33 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado34 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado33 , fresado34 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura3 - Superior\n\tif (anchura3>pliegueSuperior*2){ \n\t\tvar fresado37 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado38 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado37 , fresado38 ));\n\t\top_fresado.addObject(line,false);\n\t \n\t\t\n\t\tif (crearFresado==1){ \n\t\t\tvar fresado35 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado36 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado35 , fresado36 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t\tvar fresado39 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar fresado40 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3-pliegueSuperior+margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado39 , fresado40 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t//anchura4 - Superior\n\tif (anchura4>pliegueSuperior){\n\t\tvar fresado43 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar fresado44 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+anchura4,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\tvar line = new RLineEntity(document, new RLineData( fresado43 , fresado44 ));\n\t\top_fresado.addObject(line,false);\n\t\t\n\t\t\n\t\tif (crearFresado==1){\n\t\t\tvar fresado41 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior+alaSuperior)\n\t\t\tvar fresado42 = new RVector(pos.x+alaIzquierda+pliegueIzq+anchura1+anchura2+anchura3+pliegueSuperior-margenFresado,pos.y+alaInferior+pliegueInferior+alturaPlaca+pliegueSuperior)\n\t\t\tvar line = new RLineEntity(document, new RLineData( fresado41 , fresado42 ));\n\t\t\top_fresado.addObject(line,false);\n\t\t\t\n\t\t}\n\t}\n\t\n\t\n\t\n\treturn op_fresado;\n}", "function _CarregaPericias() {\n for (var chave_pericia in tabelas_pericias) {\n var pericia = tabelas_pericias[chave_pericia];\n var achou = false;\n for (var i = 0; i < pericia.classes.length; ++i) {\n // Aplica as pericias de mago a magos especialistas tambem.\n if (pericia.classes[i] == 'mago') {\n achou = true;\n break;\n }\n }\n if (!achou) {\n continue;\n }\n for (var chave_classe in tabelas_classes) {\n var mago_especialista = chave_classe.search('mago_') != -1;\n if (mago_especialista) {\n pericia.classes.push(chave_classe);\n }\n }\n }\n var span_pericias = Dom('span-lista-pericias');\n // Ordenacao.\n var divs_ordenados = [];\n for (var chave_pericia in tabelas_pericias) {\n var pericia = tabelas_pericias[chave_pericia];\n var habilidade = pericia.habilidade;\n var prefixo_id = 'pericia-' + chave_pericia;\n var div = CriaDiv(prefixo_id);\n var texto_span = Traduz(pericia.nome) + ' (' + Traduz(tabelas_atributos[pericia.habilidade]).toLowerCase() + '): ';\n if (tabelas_pericias[chave_pericia].sem_treinamento) {\n texto_span += 'ϛτ';\n }\n div.appendChild(\n CriaSpan(texto_span, null, 'pericias-nome'));\n\n var input_complemento =\n CriaInputTexto('', prefixo_id + '-complemento', 'input-pericias-complemento',\n {\n chave_pericia: chave_pericia,\n handleEvent: function(evento) {\n AtualizaGeral();\n evento.stopPropagation();\n }\n });\n input_complemento.placeholder = Traduz('complemento');\n div.appendChild(input_complemento);\n\n var input_pontos =\n CriaInputNumerico('0', prefixo_id + '-pontos', 'input-pericias-pontos',\n { chave_pericia: chave_pericia,\n handleEvent: function(evento) {\n ClickPericia(this.chave_pericia);\n evento.stopPropagation(); } });\n input_pontos.min = 0;\n input_pontos.maxlength = input_pontos.size = 2;\n div.appendChild(input_pontos);\n\n div.appendChild(CriaSpan(' ' + Traduz('pontos') + '; '));\n div.appendChild(CriaSpan('0', prefixo_id + '-graduacoes'));\n div.appendChild(CriaSpan('+0', prefixo_id + '-total-bonus'));\n div.appendChild(CriaSpan(' = '));\n div.appendChild(CriaSpan('+0', prefixo_id + '-total'));\n\n // Adiciona as gEntradas\n gEntradas.pericias.push({ chave: chave_pericia, pontos: 0 });\n // Adiciona ao personagem.\n gPersonagem.pericias.lista[chave_pericia] = {\n graduacoes: 0, bonus: new Bonus(),\n };\n // Adiciona aos divs.\n divs_ordenados.push({ traducao: texto_span, div_a_inserir: div});\n }\n divs_ordenados.sort(function(lhs, rhs) {\n return lhs.traducao.localeCompare(rhs.traducao);\n });\n divs_ordenados.forEach(function(trad_div) {\n if (span_pericias != null) {\n span_pericias.appendChild(trad_div.div_a_inserir);\n }\n });\n}", "distrito() {\n return super.informacion('distrito');\n }", "function chargerDonnees(){\n document.getElementById(\"pseudo\").innerHTML = /*window.mon_identifiant + \" --> \" + */ \"Chat privé avec \"+escapeHtml(window.destinataire);\n document.getElementById(\"messageChat\").innerHTML = window.historique;\n}", "function registroCarrito(curso) {\n return `<p> ${curso.nombreCurso} \n <span class=\"badge bg-warning\"> Precio Unitario: $ ${curso.precioCurso}</span>\n <span class=\"badge bg-dark\">${curso.cantidad}</span>\n <span class=\"badge bg-success\"> Precio total: $ ${curso.subtotal()}</span>\n <a id=\"${curso.id}\" class=\"btn btn-info btn-add\">+</a>\n <a id=\"${curso.id}\" class=\"btn btn-warning btn-restar\">-</a>\n <a id=\"${curso.id}\" class=\"btn btn-danger btn-delete\">x</a>\n \n </p>`\n}", "function obtenerColoresDegradados() {\r\n return [\"90-#ff0000-#9d0000\",\"90-#00ff00-#009d00\",\"90-#0000ff-#00009d\",\"90-#ffff00-#A99200\",\"90-#FF8000-#AA6000\",\"90-#8000FF-#420373\",\"90-#FF8080-#FF8888\",\"90-#808080-#00009d\",\"90-#800000-#00009d\",\"90-#800080-#4D0178\"]; \r\n}", "function mostrarDatosCompra() {\n //Tomo los datos que pasé en la funcion navegar\n const unaCompra = this.data;\n if (unaCompra) {\n const idProd = unaCompra.idProducto;\n const productoComprado = obtenerProductoPorID(idProd);\n const subTotal = unaCompra.cantidad * productoComprado.precio;\n //Escribo el mensaje a mostrar\n const mensaje = `Producto <strong>${productoComprado.nombre}</strong>.\n <br> Cantidad comprada: <strong>${unaCompra.cantidad}</strong>.<br>\n Sub Total: <strong> $${subTotal}</strong>`;\n //Muestro el mensaje\n $(\"#pDetalleCompraMensaje\").html(mensaje);\n } else {\n ons.notification.alert(\"Ocurrió un error, por favor contacte al administrador\", { title: 'Oops!' });\n }\n}", "function AdicionaNivelFeiticoConhecido(\n chave_classe, precisa_conhecer, div_conhecidos, indice_filho) {\n var nivel = indice_filho + (tabelas_feiticos[chave_classe].possui_nivel_zero ? 0 : 1);\n var feiticos_conhecidos =\n gPersonagem.feiticos[chave_classe].conhecidos[nivel];\n // Se não precisa conhecer, o jogador pode adicionar feiticos como se fosse um grimório.\n if (feiticos_conhecidos.length == 0 && precisa_conhecer) {\n return;\n }\n var div_nivel = CriaDiv();\n div_nivel.appendChild(CriaSpan(Traduz('Nível') + ' ' + nivel + ':'));\n if (!precisa_conhecer) {\n div_nivel.appendChild(CriaBotao('+', null, null, function() {\n if (gEntradas.feiticos_conhecidos[chave_classe] == null) {\n gEntradas.feiticos_conhecidos[chave_classe] = {};\n }\n if (gEntradas.feiticos_conhecidos[chave_classe][nivel] == null) {\n gEntradas.feiticos_conhecidos[chave_classe][nivel] = [];\n }\n gEntradas.feiticos_conhecidos[chave_classe][nivel].push('');\n AtualizaGeralSemLerEntradas();\n }));\n }\n div_nivel.appendChild(CriaBr());\n div_nivel.appendChild(CriaDiv('div-feiticos-conhecidos-' + chave_classe + '-' + nivel));\n div_conhecidos.appendChild(div_nivel);\n}", "static buscarLaurelPorId(idLaurel) {\n\t\tlog.info('Búscando Laurel');\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tLaurelController.buscarLaurelPorId(idLaurel).then((laurel) => {\n\t\t\t\tlog.info('Laurel encontrado');\n\t\t\t\tresolve(laurel !== null ? cambiaFechasLaurel(laurel.toObject()) : laurel);\n\t\t\t}).catch((error) => {\n\t\t\t\tlog.error('Error al buscar el laurel en el type', error);\n\t\t\t\treject(error);\n\t\t\t});\n\t\t});\n\t}", "getBuscaProfundidade(verticeEscolhido) {\n\t\tif(this.trep == 1) {\n\t\t\tlet lista = this.getRepresentacao()\n\t\t\tlet quantVertice = this.getQNos()\n\t\t\tlet principal = verticeEscolhido\n\t\t\tlet backtracking = [];\n\t\t\tlet buscaProf = [];\n\t\t\tlet arrayVertices = [];\n\t\t\tlet tempo = 0;\n\n\t\t //Criação de uma lista de array contendo todos os vertices diferentes do\n\t\t //vertice escolhido pelo usuário\n\t\t for(let i = 0; i < quantVertice; i++) {\n\t\t \tif(verticeEscolhido != i) arrayVertices.push(i);\n\t\t }\n\t\t /*Estrutura auxiliar de array bidimensional contendo na primeira posição da\n\t\t segunda dimensão um objeto tendo cor, tempo da primeira passagem,\n\t\t tempo da segunda passagem e antecessor. Na segunda posição da mesma dimensão a grafo*/\n\t\t for(let i = 0; i < quantVertice; i++){\n\t\t \tbuscaProf[i] = {\n\t\t \t\tcor: \"branco\",\n\t\t \t\ttempoInicial: \"indef\",\n\t\t \t\ttempoFinal: \"indef\",\n\t\t \t\tantecessor: \"indef\",\n\t\t \t\tadj: lista[i]\n\t\t \t}\n\t\t }\n while(arrayVertices.length > 0){\n\n\t\t \tif(buscaProf[verticeEscolhido].cor == \"branco\"){\n\n\t\t \t\tbuscaProf[verticeEscolhido].cor = \"cinza\"\n\t\t \t\tbuscaProf[verticeEscolhido].tempoInicial = ++tempo\n\t\t \t\tbuscaProf[verticeEscolhido].antecessor = null\n\n\t\t \t\tbacktracking.push(verticeEscolhido);\n\n\t\t \t\tvar verticeSecundario\n\n\t\t \t\twhile(backtracking.length > 0){\n\n\t\t \t\t\tif(buscaProf[verticeEscolhido].adj.length > 0){\n\n\t\t \t\t\t\tverticeSecundario = buscaProf[verticeEscolhido].adj.shift().vertice;\n\n\t\t \t\t\t\tif(buscaProf[verticeSecundario].cor == \"branco\"){\n\n\t\t \t\t\t\t\tbuscaProf[verticeSecundario].cor = \"cinza\"\n\t\t \t\t\t\t\tbuscaProf[verticeSecundario].tempoInicial = ++tempo\n\t\t \t\t\t\t\tbuscaProf[verticeSecundario].antecessor = verticeEscolhido\n\t\t \t\t\t\t\tbacktracking.push(verticeEscolhido)\n\t\t \t\t\t\t\tverticeEscolhido = verticeSecundario\n\t\t \t\t\t\t}\n\n\n\t\t \t\t\t}\n\t\t \t\t\telse{\n\t\t \t\t\t\tbuscaProf[verticeEscolhido].cor = \"preto\"\n\t\t \t\t\t\tbuscaProf[verticeEscolhido].tempoFinal = ++tempo\n\t\t \t\t\t\tverticeEscolhido = backtracking.pop()\n\n\t\t \t\t\t}\n\t\t \t\t}\n\n\t\t \t}\n\t\t \tverticeEscolhido = arrayVertices.shift();\n\t\t }\n\n\t\t buscaProf[principal].antecessor = null\n\n\t\t return buscaProf;\n\t\t}\n\t\telse {\n\t\t\tlet matriz = this.getRepresentacao()\n\t\t\tlet quantVertice = this.getQNos()\n\t\t\tlet principal = verticeEscolhido\n\t\t\tlet backtracking = []\n\t\t\tlet buscaProf = []\n\t\t\tlet arrayVertices = []\n\t\t\tlet tempo = 0\n\n\t\t\tfor(let i = 0; i < quantVertice; i++) {\n\t\t\t\tif(verticeEscolhido != i) arrayVertices.push(i);\n\t\t\t}\n\n\t\t\tfor(let j = 0; j < quantVertice; j++){\n\t\t\t\tvar obj = {\n\t\t\t\t\tcor: \"branco\",\n\t\t\t\t\ttempoInicial: \"indef\",\n\t\t\t\t\ttempoFinal: \"indef\",\n\t\t\t\t\tantecessor: \"indef\"\n\t\t\t\t}\n\t\t\t\tbuscaProf[j] = obj\n\t\t\t}\n //contador de vertices, recebe a quantidade de vértices - 1, para ir até o penúltimo na busca\n\t\t\tlet contVert = quantVertice - 1\n\n\t\t\twhile(contVert > 0){\n\t\t\t\tif(buscaProf[verticeEscolhido].cor == \"branco\"){\n\t\t\t\t\tbuscaProf[verticeEscolhido].cor = \"cinza\"\n\t\t\t\t\tbuscaProf[verticeEscolhido].tempoInicial = ++tempo\n\t\t\t\t\tbuscaProf[verticeEscolhido].antecessor = null\n\n\t\t\t\t\tbacktracking.push(verticeEscolhido)\n\n\t\t\t\t\tvar verticeSecundario\n\n\n\t\t\t\t\twhile(backtracking.length > 0){\n\n\t\t\t\t\t\tfor(verticeSecundario = 0; verticeSecundario < quantVertice; verticeSecundario++){\n\t\t\t\t\t\t\tif(matriz[verticeEscolhido][verticeSecundario] != \"inf\"){\n\t\t\t\t\t\t\t\tif(buscaProf[verticeSecundario].cor == \"branco\"){\n\t\t\t\t\t\t\t\t\tbuscaProf[verticeSecundario].cor = \"cinza\"\n\t\t\t\t\t\t\t\t\tbuscaProf[verticeSecundario].tempoInicial = ++tempo\n\t\t\t\t\t\t\t\t\tbuscaProf[verticeSecundario].antecessor = verticeEscolhido\n\n\t\t\t\t\t\t\t\t\tbacktracking.push(verticeEscolhido)\n\t\t\t\t\t\t\t\t\tverticeEscolhido = verticeSecundario\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(verticeSecundario == quantVertice){\n\t\t\t\t\t\t\tbuscaProf[verticeEscolhido].cor = \"preto\"\n\t\t\t\t\t\t\tbuscaProf[verticeEscolhido].tempoFinal = ++tempo\n\t\t\t\t\t\t\tverticeEscolhido = backtracking.pop()\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tverticeEscolhido = arrayVertices.shift();\n\t\t\t\tcontVert--\n\t\t\t}\n\n\t\t\tbuscaProf[principal].antecessor = null\n\t\t\treturn buscaProf\n\t\t}\n }", "function cargar_enfermedades() {\n var array = ['Hepatitis C', 'Artritis idiopática juvenil', 'Fibrosis quística', 'Cáncer gástrico', 'Esquizofrenia', 'Diabetes Mellitus tipo I', 'Hemofilia', 'Gran quemado', 'Lupus eritematoso sistémico', 'Retinopatía del prematuro'];\n array.sort();\n addOptions(\"enfermedad\", array);\n}", "function ativaCarregando(Texto) {\n\tfixH();\n\tif ($('div.Direita div.Carregando')) {\n\t\tif (Texto) {\n\t\t\t$('div.Direita div.Carregando span b').html(Texto);\n\t\t}\n\t\tif ($('div.Direita div.Carregando').css('display') == 'none') {\n\t\t\t$('div.Direita div.Carregando').css('display','table');\n\t\t} else {\n\t\t\t$('div.Direita div.Carregando').css('display','none');\n\t\t}\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function cargarFondo()\n{\n fondo.cargaOK = true;\n dibujar();\n}", "async busca_todos_os_dados( caminhoes ){\n const caminhoes_c_dados = Promise.all(\n caminhoes.map( async (item) => {\n\n const caminhao = await connection('fDescarregamento')\n .select('*')\n .where( 'ID', '=', item.ID );\n\n if ( caminhao.length > 0 ){\n const [{ Status, Chegada, Saida, Peso_chegada, Peso_saida, Assinaturas }] = caminhao;\n\n return { ...item, Status, Chegada, Saida, Peso_chegada, Peso_saida, Assinaturas: JSON.parse( Assinaturas ) };\n } else return item;\n\n })\n );\n\n return caminhoes_c_dados;\n }", "function filtrar() {\n container.innerHTML = '';\n let texto = buscador.value.toLowerCase();\n\n for (const stock of stocks) {\n let nombre = stock.nombre.toLowerCase();\n if (nombre.indexOf(texto) !== -1) {\n container.innerHTML += `<div class=\"c9__card\">\n <img src=\"${stock.img}\" alt=\"\">\n <h1>${stock.nombre}</h1>\n <p><b><i>$${stock.precio}</i></b></p>\n <a href=\"#\" id='${stock.id}' class=\"btn-compra\">Sumar al carrito</a>\n </div>`\n }\n }\n if (container.innerHTML === '') {\n container.innerHTML += `<div class=\"c9__card\"><p>Producto no encontrado</p></div>`\n }\n miEvento()\n}", "nombreCompleeto(){\n //return this._nombre+ ' '+this._apellido+ ', '+this._departamento;\n //super es par aceder metodo padre\n return super.nombreCompleeto()+ ', '+this._departamento;\n }", "function donut(){\r\n\tvar jira = document.getElementById(\"id_input\").value.toUpperCase();\r\n\tvar str_busqueda = '../../provrest/hxjiraxfab/' + jira \t\r\n\t$.get(str_busqueda).done(function( data ) {\t \t\t\r\n\t\tif (data != null){\r\n\t\t\tvar fabrica = document.getElementById('id_f').value;\r\n\t\t\tif (fabrica == 22){ //Si la fabrica es PANDORA \r\n\t\t\t\tcargarGraficoDonut(data.horas_prueba,data.consumido_prueba);\r\n\t\t\t}else{\r\n\t\t\t\tcargarGraficoDonut(data.horas_desarrollo,data.consumido_desarrollo);\r\n\t\t\t} \r\n\t\t\tdocument.getElementById(\"resultado\").innerHTML = data.descripcion;\r\n\t\t}\t \t\t\r\n\t})\r\n\t.fail(function () {\r\n\t\tdocument.getElementById(\"resultado\").innerHTML = \"No existe\";\r\n });\r\n}", "function buscarPasajes(fecha, origen, destino) {\n pasajeVm.date = $filter('date')(new Date(fecha), \"yyyy-MM-dd\");\n pasajeService.getPasajes(pasajeVm.date, origen, destino).then(function(resp){\n pasajeVm.pasajes = resp;\n if (pasajeVm.pasajes.msg){ // si no se encontraron resultados\n SweetAlert.timed(\"Ups!\", resp.msg, \"info\", 2500);\n }\n },\n function error(resp) {\n SweetAlert.swal(\"Ha ocurrido un error!\", resp.msg, \"error\");\n });\n }", "function Carregando(divDesejaExcluir, divDetalheEvento) {\r\n var divDesejaExcluir = document.getElementById(divDesejaExcluir);\r\n divDesejaExcluir.style.display = 'none';\r\n var divDetalheEvento = document.getElementById(divDetalheEvento);\r\n divDetalheEvento.style.display = 'none';\r\n var spnProcessando = document.getElementById(\"spnProcessando\");\r\n spnProcessando.style.display = 'block';\r\n}", "function finDeSemana (dia) {\t\n\tswitch (dia){\n\t\tcase \"viernes\":\n\t\tconsole.log(\"buen finde\");\n\t\tbreak;\n\t\tcase \"lunes\":\n\t\tconsole.log(\"buena semana\");\n\t\tbreak;\n\t\tdefault:\n\t\tconsole.log(\"buen dia\");\n\t}\n}", "function buscarNombreOEti(pData) {\n //Si hay productos con ese nombre, los trae\n if (pData.data.length > 0) {\n crearListadoProductos(pData);\n //Si no encontró por nombre, busca por etiquetas\n } else {\n filtrarProductosXEtiqueta();\n }\n}", "addNuevo(auditoria){\n // al agregar un elemento unico, se debe ubicar: DESPUES de los inventarios sin fecha, y ANTES que los inventarios con fecha\n // buscar el indice del primer inventario con fecha\n let indexConFecha = this.lista.findIndex(auditoria=>{\n let dia = auditoria.aud_fechaProgramada.split('-')[2]\n return dia!=='00'\n })\n if(indexConFecha>=0){\n // se encontro el indice\n this.lista.splice(indexConFecha, 0, auditoria)\n }else{\n // no hay ninguno con fecha, agregar al final\n this.lista.push(auditoria)\n }\n }", "function comprarCursos(e){\n e.preventDefault();\n\n//OBTENER ID DEL BOTÓN PRESIONADO\nconst idCurso = e.target.id;\n\n//OBTENER OBJETO DEL CURSO CORRESPONDIENTE AL ID\nconst seleccionado = carrito.find(p => p.id == idCurso);\n\n//SI NO SE ENCONTRO EL ID BUSCAR CORRESPONDIENTE AL ID\nif (seleccionado == undefined){\n \n carrito.push(cursosDisponibles.find(p => p.id == idCurso));\n} else{\n //SI SE ENCONTRÓ AGREGAR CANTIDAD\n seleccionado.agregarCantidad(1);\n}\n\n// carrito.push(seleccionado);\n\n// //FUNCION QUE SE EJECUTA CUANDO SE CARGA EL DOM\n// $(document).ready (function(){\n// if(\"carrito\" in localStorage){\n// const arrayLiterales = JSON.parse(localStorage.getItem(\"carrito\"));\n// for(const literal of arrayLiterales){\n\n// carrito.push(new cursos(literal.id, literal.nombreCurso, literal.precioCurso, literal.categoria))\n \n// }\n \n// }\n// });\n\n//GUARDAR EN LOCALSTORAGE \nlocalStorage.setItem(\"carrito\", JSON.stringify(carrito));\n\n//GENERAR SALIDA CURSO\ncarritoUI(carrito);\n}", "function agregarComentario(id_miembro){\n\n\n res= document.getElementById(\"comentar\").value; //Se toma a traves del id, el comentario realizado(valor).\n document.getElementById(\"mostrarComentario\").innerHTML+= res + \"<br>\"; //Hace visible el comentario relizado.\n\tres= document.getElementById(\"comentar\").value= \"\";//Despues que se genera el click vuelve al valor original.\n}", "function cargar(evento,elemento,bandera)\n\t\t{\n\n\t\t\tvar Negocio=$(evento).find(\".titulo\").text();\n\t\t\tvar Distancia=$(evento).find(\".distancia\").text();\n\t\t\tvar Id=$(evento).attr(\"id\")\n\t\t var datos=\"Id=\"+Id+'&Distancia='+Distancia+'&Negocio='+Negocio;\n\t\t ajax(elemento,datos,'Modelos/Evento.php');\n\n\t\t\n\t\t}", "function buscarPedidos(opcion){\n\t\tif(opcion=='1'){\n\t\t\tvar fecha1=$(\"#fechadel\").val();\n\t\t\tvar fecha2=$(\"#fechaal\").val();\n\t\t\t//var FechaInicioConv = convierteFechaJava(fecha1);\n\t\t\t//var FechaFinConv = convierteFechaJava(fecha2);\n\t\t\tif(fecha2<fecha1)\n\t\t\t{ \n\t\t\t\talert(\"La fecha incial no puede ser mayor a la fecha final\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\n\t\t\tvar FechaInicioConv = cambiarFormatoFecha(fecha1,'ymd','/');\n\t\t\tvar FechaFinConv = cambiarFormatoFecha(fecha2,'ymd','/');\n\n\t\t\t\n\t\t\tvar id_cliente=$(\"#select-cliente\").val();\n\t\t\tvar datos='cliente='+id_cliente+'&fecha1='+FechaInicioConv+'&fecha2='+FechaFinConv;\n\t\t}\n\t\tif(opcion=='2'){\n\t\t\tvar pedido=$(\"#pedido\").val();\n\t\t\tvar datos='pedido='+pedido;\n\t\t\tif(pedido==''){\n\t\t\t\talert(\"Ingrese un Pedido\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t$(\"#scroll-tabla\").html('');\n\t\t$.ajax({\n\t\t\tmethod:'POST',\n\t\t\turl:'../../code/ajax/especiales/buscarPedidos.php',\n\t\t\tdata:datos,\n\t\t\tsuccess: function(data) {\n\t\t\t\t$(\"#scroll-tabla\").html(data);\n\t\t\t}\n\t\t});\n\t}", "function borrarDelCarrito (e){\n let producto = arrayProductos.find(elemento => elemento.nombre==$(e.target).parent().attr(\"id\").split(\"Eli\")[0]);\n let cantidad = arrayCarrito.filter(el => el === producto.nombre).length;\n \n producto.stock= producto.stock + cantidad;\n if (producto.stock>0){\n $(`#${producto.nombre}CardproductosDestacados`).css(\"opacity\", 1);\n $(`#${producto.nombre}CardgrillaProductos`).css(\"opacity\", 1);\n }\n\n total = total - producto.precio*cantidad;\n arrayCarrito = arrayCarrito.filter(el => el != producto.nombre);\n $(\"#numBadge\").html(`${arrayCarrito.length}`);\n mostrarTotal();\n \n $(`#${producto.nombre}EnCarrito`).css({\"background-color\": \"#E8F5E9\", \"border-color\": \" #007E33\"})\n .animate(({width: '110%', margin: '-1.25rem'}));\n $(`#${producto.nombre}EnCarrito`).slideUp(\"slow\", function () {\n $(`#${producto.nombre}EnCarrito`).remove();\n siCarritoVacio();\n })\n}", "decrire() {\n return `${this.nom} a ${this.sante} points de vie, ${\n this.force\n } en force et ${this.xp} points d'expérience`;\n }", "decrire() {\n return `${this.nom} a ${this.sante} points de vie, ${\n this.force\n } en force et ${this.xp} points d'expérience`;\n }", "decrire() {\n return `${this.nom} a ${this.sante} points de vie, ${\n this.force\n } en force et ${this.xp} points d'expérience`;\n }", "function heredaDe(protoHijo,protoPadre) {\n//3.Aqui le decimos al ptto hijo quien sera su padre :v\n\tvar fn = function () {} //4. funcion vacia\n\tfn.prototype = protoPadre.prototype //5. al prototipo de esta le asignamos el prototipo padre\n\tprotoHijo.prototype = new fn //6. Nuevo objeto de la funcion q creamos, es decir lo mismo pero pasamos a otro objeto.\n\t//7. asignamos constructor\n\tprotoHijo.prototype.constructor = protoHijo\n\t//Esto es algo complejo, pero en la clase q viene será más sencillo\n}", "function cargar(or) {\n //console.log(or);\n aguja = or;\n var orden = datosjson.filter(ordenpuntual); //filtra con la orden puntual \n console.log(orden);\n let est = document.getElementById('estado');\n let pro = document.getElementById('producto');\n let com = document.getElementById('comercio');\n let fal = document.getElementById('falla');\n let dom = document.getElementById('domicilio');\n let loc = document.getElementById('localidad');\n let tel = document.getElementById('telefono');\n let cor = document.getElementById('correo');\n let tik = document.getElementById('ticket');\n let rep = document.getElementById('rephasta');\n let asg = document.getElementById('aseg');\n\n if (orden[0].estado != null) {\n est.innerHTML = orden[0].estado;\n }\n pro.innerHTML = orden[0].producto + '-' + orden[0].marca + '-' + orden[0].marca + 'MOD ' + orden[0].modelo + '-SN:' + orden[0].serie;\n com.innerHTML = orden[0].compradoen;\n fal.innerHTML = orden[0].observaciones;\n dom.innerHTML = orden[0].domicilio;\n if (orden[0].localidad === null) {} else {\n loc.innerHTML = orden[0].localidad;\n }\n if (orden[0].telefono === null) {} else {\n tel.innerHTML = orden[0].telefono;\n }\n if (orden[0].selectseguro === null) {} else {\n asg.innerHTML = orden[0].selectseguro;\n }\n if (orden[0].selectseguro === null) {} else {\n asg.innerHTML = orden[0].selectseguro;\n }\n\n if (orden[0].repararhasta === null) {} else {\n rep.innerHTML = orden[0].repararhasta;\n }\n\n if (orden[0].email === null) {} else {\n cor.innerHTML = orden[0].email;\n }\n\n if (orden[0].ticket === null) {} else {\n cor.innerHTML = orden[0].ticket;\n }\n\n var historiaHTML = '<ul>';\n var notas = JSON.parse(orden[0].notas);\n\n for (n in notas) {\n\n historiaHTML += '<li>';\n historiaHTML += '<div class=\\\"hfecha\\\">' + notas[n].fecha + '</div>';\n historiaHTML += '<div class=\\\"hestado\\\">' + notas[n].nota + '</div>';\n historiaHTML += '<div class=\\\"hoperador\\\">' + notas[n].operador + '</div>';\n historiaHTML += '</li>';\n\n }\n\n historiaHTML += '</ul>';\n\n document.getElementById('historia').innerHTML = historiaHTML;\n //console.log(historiaHTML);\n\n var historiaHTML = '';\n\n\n\n\n\n\n modal('ver');\n\n}", "function limpiarDulces(){\n\tcdulcesH=verifHorizontal()\n\tcdulcesV=verifVertical()\n\n\tif(cdulcesH == 0 && cdulcesV == 0){\n\t\t$(\"#score-text\").text(puntos)\n\t\tclearInterval(eliminar)\n\t\tbnewd=0\n\t\tnewdulces = setInterval(function(){nuevosdulces()}, 600)\n\t}\n\n// 5 - CUANDO SE GENERA UNA COMBINACIÓN AUMENTA LA PUNTUACION X100\n\n\t$(\"div[class*='col-'\").css(\"justify-content\", \"flex-end\")\n\t$(\".borrar\").hide(\"pulsate\", 1000, function(){\n\t\tpuntos = puntos + ($(\".borrar\").length * 100)\n\t\t$(\".borrar\").remove(\"img\")\n\t})\n\n\t$(\".elemento\").draggable({\n\t\tcontainment: \".panel-tablero\",\n\t\trevert: true,\n\t\treverDuration: 0,\n\t\tsnap: true,\n\t\tsnapMode: \"inner\",\n\t\tsnapTolerance: 40,\n\t})\n// DRAG AND DROP - CUANDO REALIZAMOS UN MOVIMIENTO AUMENTA EL CONTADOR\n\t$(\".elemento\").droppable({\n\t\tdrop: function(event, ui){\n\t\t\tvar dropped = ui.draggable;\n\t\t\tvar droppedOn = this;\n\t\t\tprueba=0;\n\t\t\tdo{\n\t\t\t\tprueba = dropped.swap($(droppedOn));\n\t\t\t}while(prueba==0)\n\t\t\tcdulcesH=verifHorizontal()\n\t\t\tcdulcesV=verifVertical()\n\t\t\tmove++\n\t\t\t$(\"#movimientos-text\").text(move)\n\t\t\tif(cdulcesV==0 && cdulcesH==0){\n\t\t\t\tdropped.swap($(droppedOn));\n\t\t\t}\n\t\t}\n\t})\n}", "function ClickGerarAleatorioComum() {\n GeraAleatorioComum();\n AtualizaGeral();\n}" ]
[ "0.6125786", "0.59025437", "0.57932484", "0.5762509", "0.5747994", "0.57421374", "0.5737452", "0.573485", "0.573443", "0.56919545", "0.56745094", "0.5668218", "0.56661063", "0.5657739", "0.5622976", "0.5622175", "0.5620696", "0.55930334", "0.55802584", "0.55442864", "0.5533003", "0.5518975", "0.55131066", "0.55111104", "0.54728323", "0.5469945", "0.5438456", "0.54356885", "0.54270494", "0.5426622", "0.54212195", "0.5402752", "0.54000473", "0.53899914", "0.5387655", "0.5385795", "0.5377613", "0.5371401", "0.5347609", "0.53452444", "0.5343217", "0.5340402", "0.5340023", "0.5325332", "0.531799", "0.5316483", "0.5315751", "0.5310363", "0.5307344", "0.5297632", "0.5290762", "0.52846974", "0.5281993", "0.52667814", "0.5261834", "0.5261729", "0.5255064", "0.5247955", "0.52358294", "0.5228609", "0.52277917", "0.5226513", "0.5224789", "0.5224455", "0.5212606", "0.5209656", "0.52074575", "0.52054316", "0.5202012", "0.520063", "0.5198271", "0.5190258", "0.51860595", "0.5181493", "0.5180979", "0.51808965", "0.5179494", "0.5176843", "0.5176235", "0.51750094", "0.51734066", "0.51712704", "0.5164933", "0.5163095", "0.51623154", "0.5161934", "0.5157898", "0.51548624", "0.5147796", "0.5146971", "0.51456416", "0.5141629", "0.513785", "0.51351774", "0.5134899", "0.5134899", "0.5134899", "0.5132401", "0.5131406", "0.5125685", "0.5119298" ]
0.0
-1
Buscar un desembolso en especifico (Desglose) By ID
function DocumentoById(Id) { var deferred = $q.defer(); var doc = Id != undefined? Id : 0; $http.get('/desembolsojson/?id={id}'.replace('{id}', doc)) .success(function (data) { deferred.resolve(data); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCuponesPorIndustria(idIndustria){\n\t\n}", "obterPorId(_id){\n return this.lista.filter( aluno => aluno._id === _id )[0];\n }", "function buscarImagen(id, datos){\n const imagen = datos.includes.Asset.find((asset) => {\n return asset.sys.id == id; });\n return imagen \n}", "function buscarNotaPorId(id) {\n var uri = __env.apiUrl + 'nota/buscar/id/' + id;\n return $http({\n url: uri,\n method: \"GET\",\n headers: { \"Content-Type\": \"application/json\" }\n }).then(function (response) {\n return response;\n });\n }", "getPersonaById(id) {\n //BUSCO DENTRO DEL ARREGLO PERSONAS Y SI ENCUENTRA UNA\n //DEVUELVE ESA PERSONA, SI NO, DEVUELVE UNDEFINED\n let persona = this.personas.filter(persona => {\n return persona.id === id;\n })[0];\n\n return persona;\n }", "static buscarLaurelPorId(idLaurel) {\n\t\tlog.info('Búscando Laurel');\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tLaurelController.buscarLaurelPorId(idLaurel).then((laurel) => {\n\t\t\t\tlog.info('Laurel encontrado');\n\t\t\t\tresolve(laurel !== null ? cambiaFechasLaurel(laurel.toObject()) : laurel);\n\t\t\t}).catch((error) => {\n\t\t\t\tlog.error('Error al buscar el laurel en el type', error);\n\t\t\t\treject(error);\n\t\t\t});\n\t\t});\n\t}", "buscaPorIdEstado(id, res) {\n const sql = `select ti.*, e.nome as estado, e.sigla, r.nome as regiao from times ti\n inner join estados e on (e.estado_id = ti.estado_id)\n inner join regioes r on (r.regiao_id = e.regiao_id)\n where e.estado_id = ${id} `\n\n conexao.query(sql, (erro, resultados) => {\n if(erro) {\n res.status(400).json(erro)\n } else {\n res.status(200).json(resultados)\n }\n })\n }", "function ecraFilme(id) {\n return getFilme(id)\n .then(function (filme) {\n mostraFilme(filme);\n })\n .catch(function (erro) {\n console.error(erro);\n });\n}", "function buscarProjeto(idProjeto) {\n\n // atribuir a variavel projetoEncontrado o retorno do filtro\n // projeto é cada posição do array que o filtro vai acessar para buscar nossa condição\n // return é o resultado da nossa condicao\n\n // tambem poderiamos usar o metodo find\n\n /*let projetoEncontrado = listaDeProjetos.filter(function (projeto){\n return projeto.idProjeto === idProjeto;\n });*/\n let projetoEncontrado = listaDeProjetos.find(function (projeto){\n return projeto.idProjeto === idProjeto;\n });\n\n if(projetoEncontrado !== undefined){\n return projetoEncontrado;\n } else {\n return `Projeto nao encontrado`;\n }\n}", "function pedirPersonaje(id) {\n const URL = `${API_URL}${PERSONAJES.replace(\":id\", id)}`;\n $.get(URL, OPCIONES, PERSONAJE);\n}", "getPersona(id) {\n let persona = this.personas.filter(persona => {\n return persona.id === id;\n })[0];\n //filter() retorna un nuevo arreglo y nosotros buscamos la posicion 0 de ese arreglo\n\n //si no se encuentra ninguna persona con el id, retorna undefined por defecto\n return persona;\n }", "getEventoById(id) {\n return eventos.find(evento => evento.id === parseInt(id, 10));\n }", "obtenerFincasProductor(id) {\n return axios.get(`${API_URL}/v1/reportefincaproductor/${id}`);\n }", "buscarNodo(dato){\n if (this.tamanio == 0){\n console.log(\"No hay elementos en la lista.\")\n } else{\n let isEncontrado = false\n let aux = this.primero\n while(aux != null){\n if (aux.dato == dato){\n isEncontrado = true\n return aux.id \n }\n aux = aux.siguiente\n }\n\n if (isEncontrado == false){\n console.log(\"El elemento no se encuentra\")\n alert(\"El dato no se encuentra en la lista.\")\n }\n }\n }", "borrarPersona(id) {\n\n let personaBorrada = this.getPersona(id);\n\n //si pasa el id que se encontro, y devuelve una cadena de personas con todas las personas que no tengan ese id\n this.personas = this.personas.filter(persona => {\n return persona.id != id\n })\n\n return personaBorrada;\n }", "async function findById (id = null) {\r\n debug('Lista de Poa|filtros');\r\n try {\r\n let respuestaPoa = await PoasRepository.findById(id);\r\n console.log('--->', respuestaPoa);\r\n if (!respuestaPoa){\r\n throw new Error ('No hay Valor');\r\n }\r\n if(respuestaPoa.estado === 'INACTIVO') {\r\n throw new Error('El Poa ya fue desactivado');\r\n }\r\n return respuestaPoa;\r\n } catch (error) {\r\n throw new Error (error.message);\r\n }\r\n }", "function ecraFilmePersonagens(id) {\n return getFilmePersonagens(id)\n .then(function (personagens) {\n mostraFilmePersonagens(personagens);\n })\n .catch(function (erro) {\n console.error(erro);\n });\n}", "getPersona(id) {\n let persona = this.personas.filter(persona => persona.id === id)[0];\n\n /*\n Si encuentra una persona que cumpla con la propiedad, retornara un objeto\n si no retornara undefined\n */\n return persona;\n }", "function obtenerDatosProducto(producto) {\n console.log(producto)\n const productoAgregado = menu.find((item) => producto === `sku_${item.id}`)\n}", "function buscarCliente(cdni) {\n let resultado = baseCliente.filter(fila => fila.dni == cdni);\n\n for (const cliente of resultado) {\n return cliente;\n }\n\n}", "leerProductosConId(id){\n if (this.listaProductos[id-1]==undefined) {\n return {error:\"Ese producto no existe aun\"}\n } else {\n return this.listaProductos[id-1]\n } \n }", "function descargarFactura(idFactura) {\n console.log(\"Factura a descargar:\" + idFactura);\n}", "function cargar_historial (I_id) {\n console.log(\"cargar historial\");\n\n //descargarse user_persona (comparando el ID del usuario que metes, con todos los IDs de usuario en la base de datos)\n usuario = usuarios.find(o => o.ID === I_id);\n console.log(usuario.ID);\n //BBDD descargarse user_persona\n\n //Por cada clapp, mostrar sus datos añadiendolos a una lista\n usuario.historial_clapps.forEach(function(I_userClapps) {\n console.log(I_userClapps.clappeado);\n var banda = bandas.find(o => o.name === I_userClapps.clappeado);\n console.log(banda);\n $(\".clapps\").append(\n '<li class=\"clappeado\"><img src=\"' + banda.imagen + '\"><p class=\"band\">' + banda.name + '</p><p class=\"clapps_dados\">' + I_userClapps.num_clapps + '</p></li>'\n );\n });\n }", "borrarPersona(id) {\n //Obteniendo la info de la persona que sera borrada\n let personaBorrada = this.getPersona(id);\n\n /*\n Retorna todas las personas del arreglo \"personas\" cuyo id sea diferente al \n id de la persona que se quiere eliminar y asignar esas personas encontradas\n al arreglo personas\n */\n this.personas = this.personas.filter(persona => persona.id != id);\n\n //Retornando a la persona borrada\n return personaBorrada;\n }", "function listContent (geoID) {\r\n var geoIDsansFR = geoID.id.replace(\"id-\",\"\");\r\n var index = -1;\r\n var nameReg = \"Not found\" ;\r\n for (i=0 ; i < dataReg.cumul_par_reg_lasts.length ; i++) {\r\n\r\n if (dataReg.cumul_par_reg_lasts[i].reg_id == geoIDsansFR) {\r\n index = i;\r\n nameReg = dataReg.cumul_par_reg_lasts[i].reg_nom ;\r\n break; \r\n }\r\n }\r\n\r\n if (index != -1) {\r\n var totalDC = dataReg.cumul_par_reg_lasts[index].dc ;\r\n } else {\r\n console.log(\"Erreur: \"+geoIDsansFR+ \" not found\")\r\n }\r\n dcTitle = \"<h2>Mort</h2>\" ;\r\n $(list_title).html(dcTitle);\r\n dcText = nameReg + \" : <em class='num red'>\" + totalDC + \"</em>\" ;\r\n $(geoID).html(dcText);\r\n \r\n}", "function getEmpleadosFiltrados(id) {\n $http.post(\"EmpleadosTabla/getEmpleadosFiltrados\", { id: id }).then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.lista.data = r.data.d.getEmpleadosFiltrados;\n vm.lista.disp = [].concat(vm.lista.data);\n }\n })\n }", "borrarPersona(id) {\n\n let personaBorrada = this.getPersonaById(id);\n\n this.personas = this.personas.filter(persona => {\n return persona.id != id\n });\n\n return personaBorrada;\n }", "function get_cargo(id) {\n let key = datastore.key([CARGO, parseInt(id, 10)]);\n const q = datastore.createQuery(CARGO).filter('__key__', \"=\", key);\n return datastore.runQuery(q).then((entity) => {\n return entity[0].map(ds.fromDataStore); \n });\n}", "buscaDados(id) {\n\n fetch(`${url}read/produto`, {\n method: 'POST',\n body: JSON.stringify({ id }),\n headers: { 'Content-Type': 'application/json' }\n })\n .then(res => res.json())\n .then(res => {\n if (res.length == 0) {\n Alert.alert('OPS!', 'Você ainda não possui produtos cadastrados.')\n }\n this.setState({ dados: res });\n })\n }", "getUsuario(id) {\n for (let usuario of this.lista) {\n if (usuario.id === id) {\n return usuario;\n }\n }\n }", "async function carregarDadosIngrediente(id) {\r\n\r\n await aguardeCarregamento(true)\r\n await telaIngrediente('atualizar', id);\r\n await aguardeCarregamento(false)\r\n const dado = VETORDEINGREDIENTESCLASSEINGREDIENTE.find((element) => element._id == id);\r\n try {\r\n document.getElementById('nomeingrediente').value = dado.name\r\n document.getElementById('precocustoingrediente').value = (parseFloat(dado.price)).toFixed(2)\r\n document.getElementById('quantidadeingrediente').value = parseInt(dado.stock)\r\n document.getElementById('unidademedidaingrediente').value = dado.unit\r\n document.getElementById('descricaoingrediente').value = dado.description\r\n } catch (error) {\r\n mensagemDeErro('Não foi possível carregar os dados do produto!')\r\n }\r\n}", "buscaPorIdTime(id, res) {\n const sql = ` select ti.*, e.nome as estado, e.sigla, r.nome as regiao from times ti\n inner join estados e on (e.estado_id = ti.estado_id)\n inner join regioes r on (r.regiao_id = e.regiao_id)\n where ti.time_id = ${id} `\n conexao.query(sql, (erro, resultados) => {\n if(erro) {\n res.status(400).json(erro)\n } else {\n res.status(200).json(resultados)\n }\n })\n }", "static oneSala(req, res){\n var id = req.params.id;\n Salas.findAll({\n where: {especialidadID : id}\n //attributes: ['id', ['description', 'descripcion']]\n }).then((data) => {\n res.status(200).json(data);\n });\n }", "function IncetDat(id) {\n var auxc = new ApiCiudad(\"\", \"\", \"\");\n var id_conte_lis = \"#LCiuDist\" + id;\n var id_conte_depart = \"#LDepDist\" + id;\n $(id_conte_lis).html(\" \"); // limpia la casilla para que se pueda ver \n var id_depart = $(id_conte_depart).val();\n var dat = {\n llave: id_conte_lis,\n idCiu: 0,\n iddist: id_depart\n };\n auxc.idDepart = id_depart;\n auxc.List(dat);\n}", "function restar (id){\n \n let productoeliminado = carrito.find((el) => el.id == id);\n let indice = carrito.indexOf(productoeliminado)\n carrito.splice(indice, 1)\n activarCarrito()\n total.innerHTML = ``\n \n }", "function seleccionarBodegas(obj){\n var sede = obj.val(); \n if(sede != ''){\n $.ajax({\n type:\"POST\",\n url:\"/ajax/bodegas/escogerBodega\",\n data: {\n idSede : sede\n },\n dataType:\"json\",\n success:function (respuesta){\n obj.parents(\"#contenedorSelectorBodegas\").find(\"#selectorBodegas\").html(respuesta.contenido);\n }\n\n }); \n \n } \n }", "function loadCor(id) {\n var dilon=JSON.stringify(carRec[id]);\n var noop = JSON.parse(dilon);\n console.log(noop);\n $(\"#misdatos\").empty();\n $(\"#misdatos\").append(\n \" <h4>\"+\"Destinatario: \"+noop.destino+\"</h4>\",\n \" <h4>\"+\"Mensaje: \"+noop.mensaje+\"</h4>\",\n \" <h4>\"+\"Fecha: \"+noop.fecha+\"</h4>\" \n );\n }", "function selectDisc(id){\n\n const torreClicada = document.querySelector(`#${id}`)\n const disco = torreClicada.lastElementChild\n\n if(disco === null){\n return disco\n }\n\n return disco.id\n\n}", "getVenueUsingId(id) {\r\n let sql_getVenue = `SELECT id, venue_name, street, city, state, zip FROM venue_tb\r\n WHERE id = ${id}`;\r\n let result = this.apdao.all(sql_getVenue);\r\n return result;\r\n }", "function BuscarIndiceAnuncio(id){\n //Validar datos\n for(let i=0; i<listaAnuncios.length; i++){\n if(listaAnuncios[i].id == id)\n return i;\n }\n \n return -1;\n}", "verProductoPorId(id) {\n return productosArray.filter((prod) => prod.id === parseInt(id))[0]\n }", "function menuMostrarId(req, res) {\n const idParams = req.params.id;\n errorParams(idParams,res);\n Menu.findById(idParams).exec((err, respDB) => {\n errorBD(err, respDB,res);\n res.status(200).json({\n ok: true,\n menu: respDB\n });\n });\n}", "function agregar(id) {\n let productoElegido = productos.find((el) => el.id == id);\n if (productoElegido.stock >= 1 ) {\n carrito.push(productoElegido);\n activarCarrito()\n \n \n \n } else {\n carrito.splice(productos.find((el) => el.id == id));\n \n }\n \n }", "function cargarNotas(idSoporte) {\n if (idSoporte) {\n $scope.showLoader($scope, \"Cargando notas...\", \"SoporteDetalleCtrl:cargarNotas\");\n return SoporteService.cargarNotas(idSoporte).then(function (data) {\n $scope.soporteNotas = data;\n }, function (error) {\n console.log(error);\n if (error.message) {\n //$scope.showAlert('ERROR', error.message);\n }\n }).finally(function () {\n $scope.hideLoader($scope, \"SoporteDetalleCtrl:cargarNotas\");\n });\n }\n }", "function obtenerPersonajeOrden4(id) {\n\n return new Promise( (resolve, reject) => {\n const url = `${API_URL}${PEOPLE_URL.replace(':id', id)}`\n $.get(url, opts, function(data){\n resolve(data)\n })\n .fail( () => reject(id) )\n\n } )\n \n}", "function obtenerPersonaje(id) {\n return new Promise((resolve, reject) => {\n const URL = `${API_URL}${PEOPLE_URL.replace(':id', id)}`\n $\n .get(URL, opts, function (data) {\n resolve(data)\n })\n .fail(() => reject(id))\n })\n\n}", "function obtenerPersonaje(id) {\n return new Promise((resolve, reject) => {\n const URL = `${API_URL}${PEOPLE_URL.replace(':id', id)}`\n $\n .get(URL, opts, function (data) {\n resolve(data)\n })\n .fail(() => reject(id))\n })\n\n}", "static citaLugar(req,res){\n var url = req.params.id;\n \n Citas_Medicas.findAll({\n where : { especialidad : url }\n })\n .then((data) => {\n res.status(200).send(data);\n })\n }", "function agregarComentario(id_miembro){\n\n\n res= document.getElementById(\"comentar\").value; //Se toma a traves del id, el comentario realizado(valor).\n document.getElementById(\"mostrarComentario\").innerHTML+= res + \"<br>\"; //Hace visible el comentario relizado.\n\tres= document.getElementById(\"comentar\").value= \"\";//Despues que se genera el click vuelve al valor original.\n}", "function mostrarDatosProveedor() {\n //tomar el idProveedor desde el value del select\n let idProvedor = document.getElementById(\"idProveedor\").value;\n //buscar el proveedor en la lista\n for (let i = 0; i < listaProveedores.length; i++) {\n let dato = listaProveedores[i].getData();\n if(dato['idProveedor'] === parseInt(idProvedor)){\n //desplegar los datos en el formulario\n vista.setDatosForm(dato);\n break;\n }\n }\n}", "async findByID(id) {\n try {\n // busca o produto\n const findProduto = await this.dbProduto.findByPk(id)\n // retorna o produto\n return findProduto;\n } catch (error) {\n // mostra o erro no console\n console.log(error);\n // gera um erro\n throw new Error({ 'ProdutosService error: ': error.message });\n }\n }", "function listarCursos(curso) {\r\n\r\n const objCarrito = {\r\n imagen: curso.querySelector('img').src,\r\n nombre: curso.querySelector('h3').textContent,\r\n precio: curso.querySelector('span').textContent,\r\n id: curso.querySelector('a').getAttribute('data-id'),\r\n cantidad: 1\r\n }\r\n\r\n // arrayCarrito.push(objCarrito);\r\n\r\n console.log(arrayCarrito)\r\n\r\n // Verificamos si existe el id\r\n const existe = arrayCarrito.some(curso => curso.id === objCarrito.id)\r\n\r\n console.log(existe)\r\n if (existe) {\r\n\r\n const curso = arrayCarrito.map(curso => {\r\n\r\n if (curso.id === objCarrito.id) {\r\n\r\n curso.cantidad++;\r\n return curso\r\n\r\n } else {\r\n curso\r\n }\r\n\r\n })\r\n\r\n arrayCarrito = [...arrayCarrito]\r\n\r\n } else {\r\n arrayCarrito = [...arrayCarrito, objCarrito]\r\n }\r\n\r\n carritoHtml();\r\n\r\n}", "function getDepartamentoEmpleados(id) {\n $http.post(\"Departamentos/getDepartamentoEmpleados\", { id: id }).then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.lista.data = r.data.d.getDepartamentoEmpleados;\n vm.lista.disp = [].concat(vm.lista.data);\n }\n })\n }", "function obtenerPersonaje(id) {\n return new Promise((resolve,reject) => {\n const url = `${API_URL}${PEOPLE_URL.replace(':id', id)}`\n $\n .get(url,opts,function(data){\n resolve(data)\n })\n .fail(() => reject(id))\n })\n}", "function obtenerPersonaje(id){\n return new Promise((resolve,reject) => {\n const url =`${API_URL}${PEOPLE_URL.replace(`:id`,id)}`\n\n $.get(url,opts,function(data){\n resolve(data)\n })\n .fail(()=>reject(id))\n })\n}", "function obtenerPersonaje(id) {\n return new Promise( (resolve,reject) => {\n const url = `${API_URL}${PEOPLE_URL.replace(':id',id)}`;\n $.get(url, opts, function (data) {\n resolve(data);\n }).fail( () => {\n reject(id);\n });\n });\n}", "obtenerProductor(id) {\n return axios.get(`${API_URL}/v1/productorpersonaReporte/${id}`);\n }", "function getBookingTitle(id) {\n return bookings ? bookings.find(b => b.id === id).titre : \"\";\n }", "function mostrarComentarios(id) {\n //console.log(id);\n if (typeof id === \"number\"){\n id = \"respuesta__\" + id;\n }\n $(\"div#\"+id).slideToggle();\n $(\"div.respuesta:not(#\"+id+\")\").slideUp();\n}", "buscarDado(d) {\n\t\t// Intenta por si es un entero\n\t\tif (!isNaN(d)) {\n\t\t\tthis.entero += parseInt(d);\n\t\t\treturn; //si es entero sumo y salgo\n\t\t}\n\n\t\tif (d.includes(\"d\")) {\n\t\t\tlet sumando = d;\n\t\t\tlet sumandos;\n\t\t\tsumandos = sumando.split(\"d\");\n\t\t\t//hago D(dados, caras)\n\t\t\tlet _d = new D(parseInt(sumandos[0]),\n\t\t\t\tparseInt(sumandos[1]));\n\t\t\t// //console.log(this.dados);\n\t\t\t//Busco si existe el dado con ese nº de caras\n\t\t\tfor (let i of this.dados) {\n\t\t\t\tif (i.caras == _d.caras) {\n\t\t\t\t\t//si existe lo sumo\n\t\t\t\t\ti.sum(_d);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//si no existe lo añado\n\t\t\tthis.dados.push(_d);\n\t\t}\n\n\t}", "function borrarCreado(id) {\n const index1 = searchById(id, misGifos);\n misGifos.splice(index1, 1);\n setLocal(\"mis\", misGifos);\n const index2 = searchById(id, arrayMisGifos);\n arrayMisGifos.splice(index2, 1);\n if (document.getElementById(\"btnMis\").classList.contains(\"active\")) {\n renderMisGifos();\n }\n}", "getMisCurso(curso, id) {\n document.getElementById(\"Curso\").value = curso[0];\n document.getElementById(\"Estudiante\").value = curso[1];\n document.getElementById(\"Profesor\").value = curso[2];\n document.getElementById(\"Grado\").value = curso[3];\n document.getElementById(\"Pago\").value = curso[4];\n document.getElementById(\"Fecha\").value = curso[5];\n inscripcionID = id;\n }", "async function getDpaProvincias(req, res) {\n let busqueda = req.params.id;\n\n try {\n let provinciasObtenidas = await DPA.findAll({where: {TIPO: req.params.id}, order: [['NOMBRE', 'ASC']]});\n\n if (provinciasObtenidas.length > 0) {\n res.status(200).send({\n data: provinciasObtenidas,\n message: \"DPA cargado correctamente\"\n });\n } else {\n res.status(402).send({\n message: 'No existe DPA registrada en la base de datos'\n });\n\n\n }\n } catch (err) {\n res.status(500).send({\n message: 'error:' + err\n });\n }\n}", "function ocultar_mostrar(id){\n\t\t\n\t\tif(id !== 0){\n\t\t\t\t\t\n\t\t\tfor( var i = 1;i < id ; i++ ){\n\t\t\tif(i < id){\n\t\t\t\t\n\t\t\t\t$.ajax({\n\t\t\t\t\ttype: 'GET',\n\t\t\t\t\turl: '/crm-app/api/v1/usuario/listamodulos/' + i,\n\t\t\t\t\tdataType: 'json',\n\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\t\tconsole.log(response);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar descrip = response.descripcionmodulo;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tdocument.getElementById(descrip).style.display = 'block';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t}", "function mostrarCargoDepartamento(id){\n\n $.get('CargosDepartamentosMostrar/'+id, function (data) { \n $(\"#tabla_DepartamentoCargo\").html(\"\");\n $.each(data, function(i, item) { //recorre el data \n cargartablaCargoDepartamento(item); // carga los datos en la tabla\n }); \n });\n \n}", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "function buscarVehiculo(cplaca) {\n let resultado = baseVehiculo.filter(fila => fila.placa == cplaca);\n\n for (const vehiculo of resultado) {\n return vehiculo;\n }\n\n}", "function getApresentacaoCampus(id) {\n db.transaction(function(tx){\n tx.executeSql('SELECT * FROM apresentacao where campus = (select campus from campus where id = \"'+id+'\") ORDER BY data DESC',[],\n function(tx,results){\n var len = results.rows.length;\n console.log('apresentacao campus table: '+len+'rows found');\n for(var i = 0; i<len ; i++){\n $$('#apresentacao-list-campus').append(`\n <li class=\"swipeout remove-callback\" id=\"${results.rows.item(i).id}\">\n <a href=\"detalhe.html?id=${results.rows.item(i).id}\" class=\"item-link swipeout-content item-content\">\n <div class=\"item-inner\">\n <div class=\"item-title\">${results.rows.item(i).tema}</div>\n <div class=\"item-after\">${results.rows.item(i).data}</div>\n </div>\n </a>\n </li>\n `);\n }\n },\n function(err){\n console.log(err);\n });\n });\n }", "function poeCarrinho(item){\n // percorrendo o carrinho vendo se ja tem um item\n for(let i=0; i<arrayCarrinho.length; i++){\n if(arrayCarrinho[i].id == item.id){\n // já tem um no carrinho, não precisamos add ele no carrinho\n return\n }\n }\n // o produto não existe dentro do carrinho, logo podemos add ele\n arrayCarrinho.push(item)\n}//poeCarrinho", "function InfoLesion(cie10, id, elemento){\n\n // Consulto el indice del arreglo por medio de la propiedad id\n var indice = buscarLesion(id);\n\n // Con el #id del elemento consulto el texto de la etiqueta <p>,\n // el cual es el nombre de la lesión\n var nombreLesion = $('#' + elemento + ' .item_text > p').text();\n var codigoLesion = $('#' + elemento + ' .item_codigo > p > span').text();\n\n // Valido si la lesión existe en el arreglo infoLesion\n if (buscarLesion(id) != -1) {\n\n // Elimino la lesión si existe en el arreglo infoLesion\n infoLesion.splice(indice , 1);\n\n // Animación para item que emulan las lesiones seleccionadas\n // en la barrar superior.\n $(\"#fracturaSelect_\" + id).animate({\n width:'0px',\n opacity: 0\n }, 200 , function() {\n\n // Cuando termina la animación se elimina el elemento del DOM\n $(\"#fracturaSelect_\" + id).remove();\n\n });\n\n // Setear la variable global\n seleccion = false;\n\n }\n\n // Si la lesión no esta en el arreglo infoLesion\n else {\n\n // Agragar clase lesionActiva a la lesion seleccionada,\n // esto da el efecto de selección de color verde\n $('#' + elemento).addClass('lesionActiva');\n\n // Objeto temporal con la información de la lesión seleccionada\n var tempInfoLesion = {\n 'nombre': nombreLesion,\n 'cie10' : cie10,\n 'id' : id,\n 'especificacion' : ''\n };\n\n // Agrego al final del arreglo infoLesion el objeto temporal\n infoLesion.push(tempInfoLesion);\n\n // Crear y imprimir en la barra superior un nuevo item\n // el cual representa a una lesión\n $(\"#cont-barraFracturasSelectId\").append(\"\\\n <li class='fracturaSelect' id='fracturaSelect_\"+ id +\"' title='\"+ nombreLesion +\"'>\\\n <p>\"+ codigoLesion +\"</p>\\\n <i class='fa fa-times' onclick=\\\"InfoLesion(null , \"+ id +\" ,'\"+ elemento +\"')\\\"></i>\\\n </li>\\\n \");\n\n // Setear la variable global\n seleccion = true;\n\n }\n\n // Actualizar cantidad de lesiones seleccionadas\n var bola_plus = document.getElementById('bola_plus');\n bola_plus.setAttribute('fracturasSeleccionadas' , infoLesion.length);\n\n // Validar si no hay lesiones seleccionadas y remover clase lesionActiva\n if (seleccion === false) {\n $('#'+elemento).removeClass('lesionActiva');\n }\n\n }", "function obtenerPersonaje(id){\n\n return new Promise(( resolve, reject)=>{\n const url = `${API_URL}${PEOPLE_URL.replace(':id',id)}`;\n\n $\n //La funcion resolve no se va a llavar hasta que el get este resuelto\n .get(url,opts,function( data){\n resolve(data);\n })\n .fail( () => reject(id) )\n\n })\n}", "static listOne(req, res){ \n var id = req.params.id; \n console.log(id + \" este es\");\n Especialidad.findAll({\n where: {id: id}\n //attributes: ['id', ['description', 'descripcion']]\n }).then((one) => {\n res.status(200).json(one);\n }); \n }", "function diagnostico(id,codigo,descripcion,complicacion)\r\n{\r\n\tthis.id = id;\r\n\tthis.codigo = codigo;\r\n \tthis.descripcion = descripcion;\r\n \tthis.complicacion = complicacion;\r\n}", "getUmpireUsingId(id) {\r\n let sql_getUmpire = `SELECT A.id, A.user_id, B.full_name \r\n FROM umpire_tb A\r\n INNER JOIN user_tb B\r\n ON (A.user_id = B.id)\r\n WHERE A.id = ${id}`;\r\n let result = this.apdao.all(sql_getUmpire);\r\n return result;\r\n }", "function getApresentacaoCampus(id) {\n db.transaction(function (tx) {\n tx.executeSql('SELECT * FROM apresentacao where campus = (select campus from campus where id = \"' + id + '\") ORDER BY data DESC', [],\n function (tx, results) {\n var len = results.rows.length;\n console.log('apresentacao campus table: ' + len + 'rows found');\n for (var i = 0; i < len; i++) {\n $$('#apresentacao-list-campus').append(`\n <li class=\"swipeout remove-callback\" id=\"${results.rows.item(i).id}\">\n <a href=\"detalhe.html?id=${results.rows.item(i).id}\" class=\"item-link swipeout-content item-content\">\n <div class=\"item-inner\">\n <div class=\"item-title\">${results.rows.item(i).tema}</div>\n <div class=\"item-after\">${results.rows.item(i).data}</div>\n </div>\n </a>\n </li>\n `);\n }\n },\n function (err) {\n console.log(err);\n });\n });\n}", "static get_one_conulta_p(req, res) {\n const { id_cita } = req.params\n return Consultas\n .findAll({\n where:{id_cita : id_cita },\n include:[{\n model : Recetas\n }]\n })\n .then(Consultas => res.status(200).send(Consultas));\n }", "obtenerProductor(id) {\n return axios.get(`${API_URL}/v1/productorreporte/${id}`);\n }", "async findByIdLivro(req, res) {\n const query = ['idlivro', '==', req.params.id];\n await firebaseHelper.firestore\n .queryData(db, 'reserva', query)\n .then(doc => res.status(200).send(doc))\n }", "function ecraFilmeImagens(id) {\n return getFilmeImagens(id)\n .then(function (imagens) {\n mostraFilmeImagens(imagens);\n })\n .catch(function (erro) {\n console.error(erro);\n });\n}", "function mostrarEsconderOpcionesRecurrencia(id) {\n if (id == '' || id == null) {\n $(\"#recurrenciaContainer\").removeClass(\"hidden\");\n } else {\n $(\"#recurrenciaContainer\").addClass(\"hidden\");\n }\n}", "function datosEmpleado(id) {\n\n var deferred = $q.defer();\n\n EmpresasService.trabajadorEmpresa(id).then(function correcto(resp) {\n\n deferred.resolve(resp[0]);\n\n }, function error(error) {\n\n console.log(error);\n\n deferred.reject(error);\n\n });\n\n return deferred.promise;\n }", "function excluirDados(id){\n if(confirm(\"Tem Serteza que Quer excluir\")){\n if(id === list.length - 1) {//linpando ultimo\n list.pop(); //pop server para apagar um item \n }else if(id === 0){//excluindo o primeiro\n list.shift();//shift apaga o primeiro item\n }else {\n var arrayInicial = list.slice(0,id);//apagando itens no meio do formulario\n var arrayFinal = list.slice(id + 1);\n list = arrayInicial.concat(arrayFinal);\n }\n setList(list);\n }\n}", "static OneCuaderno(req, res){ \n const { id } = req.params\n Cuadernos.findAll({\n where: {id: id}\n //attributes: ['id', ['description', 'descripcion']]\n }).then((one) => {\n res.status(200).json(one);\n }); \n }", "function buscarHijo(nodo, id, valor)\n{\n\tvar resultado = null;\n\tif (nodo!=null && nodo.getAttribute) \n\t{\n\t\tvar v = nodo.getAttribute(id);\n\t\tif (v!=null && v==valor)\n \t\treturn nodo;\n\t\tvar child = nodo.firstChild;\n\t\twhile (child != null)\n\t\t{\n\t\t\tresultado = buscarHijo(child, id, valor);\n\t\t\tif (resultado!=null)\n\t\t\t\treturn resultado;\n\t\t\tchild = child.nextSibling;\n\t\t}\n }\n\treturn null;\n}", "function obtenerProductoPorID(idProducto) {\n let producto = null;\n let i = 0;\n while (!producto && i < productos.length) {\n let unProducto = productos[i];\n if (unProducto._id === idProducto) {\n producto = productos[i];\n }\n i++;\n }\n return producto;\n}", "function buscarContenido(lista, labelClave, labelContenido, idBuscado){\n console.log(lista);\n for(var i=0;i<lista.length;i++ ){\n if(lista[i][labelClave] === idBuscado)\n return lista[i][labelContenido];\n }\n}", "function obtenerPersonaje(id) { //funcion que recibe un id como parametro\n const url = `${API_URL}${PEOPLE_URL.replace(':id', id)}`; //cambiamos el id de la url dependiendo de cual queremos ver\n $.get(url, opts, onPeopleResponse); //metodo del jquery para hacer el request\n}", "getObjectById (id) {\n\n for (var emitters of this.emitters) {\n if (emitters.id === id) {\n return emitters\n }\n }\n\n for (var fields of this.fields) {\n if (fields.id === id) {\n return fields\n }\n }\n\n return null\n }", "buscarTurnosPorId(id) {\n return __awaiter(this, void 0, void 0, function* () {\n const found = yield this.db.query('SELECT * FROM turnos WHERE id = ?', [id]);\n if (found.length > 1)\n return found[0][0];\n return null;\n });\n }", "function obtenerPersonaje(id) {\n // Y esta funcion retorna una promesa\n // en el constructor de la promesa le pasamos como-\n // parametros resolve y reject\n\n return new Promise((resolve, reject) => {\n // Dentro de esta arrow function hacemos el llamado-\n // asincrono\n const url = `${API_URL}${PEOPLE_URL.replace(\":id\", id)}`;\n // Seguimos utilizando jquery\n // pero esta vez ya no le pasamos el callback-\n // y le pasamos una function y por parametro le pasamos-\n // la data que nos llegue\n $.get(url, opts, function(data) {\n // Con la data que nos llegue resolvemos la promesa-\n // y cuando esta funcion se ejecute llamamos-\n // el resolve pasandole la data, es decir el personaje\n\n // Esta funcion resolve no se va llamar hasta que-\n // la funcion que esta dentro del get se ejecute-\n // es decir hasta que el get sea exitoso\n resolve(data);\n\n // luego le pasamos el fail para manejar el error-\n // y lo unico que hacemos es rechazar la promesa-\n // pasandole el id que hibamos a obtener el id del personaje\n }).fail(() => reject(id));\n });\n}", "function obtenerPersonaje(id){\n\treturn new Promise((resolve,reject)=>{\n\t\tconst url = `${API_URL}${PEOPLE_URL.replace(':id', id)}`\n\t\t$\n\t\t\t.get(url, opts, function(data){\n\t\t\t\tresolve(data)\n\t\t\t\t//data = personaje\n\t\t\t\t//La funcion no se ejecuta hasta que el get sea exitoso//La funcion no se ejecuta hasta que el get sea exitoso\n\t\t\t})\n\t\t\t.fail(() => reject(id))\n\t\t\t//id del personaje\n\n\t});\n}", "function esconderDivCadastro(obj){\r\n document.getElementById('conteudo').style.display=\"hidden\";\r\n switch(obj.id){\r\n case 'div':\r\n document.getElementById('conteudo').style.display=\"block\";\r\n document.getElementById('div1').style.display=\"hidden\";\r\n break;\r\n case 'sair':\r\n document.getElementById('conteudo').style.display=\"hidden\";\r\n document.getElementById('div1').style.display=\"block\";\r\n break;\r\n }\r\n }", "function mostrarMas(id) {\n console.log(id);\n $(\"#comentario\"+id+\" li\").show();\n\n}", "function leerCurso(curso){\r\n \r\n const infoCurso = {\r\n id: curso.querySelector('a').getAttribute('data-id'),\r\n imagen: curso.querySelector('img').src,\r\n nombre: curso.querySelector('h4').textContent,\r\n autor: curso.querySelector('.autor-curso').textContent,\r\n calificacion: curso.querySelector('.estrellas-curso span').textContent,\r\n precio: curso.querySelector('.precio span').textContent,\r\n cantidad: 1\r\n\r\n\r\n }\r\n\r\n const cursoDuplicado = articulosCarrito.some( curso => curso.id === infoCurso.id);\r\n if(cursoDuplicado){\r\n const i = articulosCarrito.map(curso =>{\r\n if(curso.id === infoCurso.id){\r\n curso.cantidad++;\r\n return curso;\r\n }else{\r\n return curso;\r\n }\r\n });\r\n articulosCarrito = [...i];\r\n }else{\r\n articulosCarrito = [...articulosCarrito, infoCurso];\r\n //console.log(articulosCarrito);\r\n\r\n\r\n }\r\n\r\n llenarCarrito();\r\n \r\n}", "function busquedaPrincipalPorDefecto(){\n construirFiltros(\"HideDuplicateItems\", \"true\");\n buscarPorClave(\"Deporte\",12,1);\n search(\"Sports\",null,1,\"customerRating\",\"desc\",12);\n}", "async getBeneficiarioById(request, response) {\n const id = parseInt(request.params.id)\n \n pool.query('SELECT * FROM pessoas_fisicas WHERE id_pessoa_fisica = $1', [id], (error, results) => {\n if (error) {\n throw error\n }\n response.status(200).json(results.rows)\n })\n }", "getById(id) {\r\n const list = new List(this);\r\n list.concat(`('${id}')`);\r\n return list;\r\n }", "function cargarPeriodo(idSelect){\r\n\r\n\tconsultar(\"detalle\",\"listarTodosPorIdMaestro?idMaestro=3\",true).done(function(data){\r\n\r\n\t\t$(\"#\"+idSelect).empty();\r\n\t\t$(\"#\"+idSelect).append(\"<option value='0'>-- Seleccione --</option>\");\r\n\r\n\t\tdata.forEach(function(item){\r\n\r\n\t\t\t$(\"#\"+idSelect).append(\"<option value='\"+item.id+\"'>\"+item.nombre+\"</option>\");\t\t\t\t\r\n\t\t});\r\n\r\n\t});\r\n\r\n}", "function buscarRol(id) {\n\t\t\tOpcionRolService.buscarRol(id)\n\t\t\t.then(function(response) {\n\t\t\t\t// MANEJO DE RESPUESTA\n\t\t\t\tresponse = JSON.parse(response.respuesta);\n\n\t\t\t\tif (response.codigo === 1) {\n\t\t\t\t\tvar data = response.datos[0];\n\t\t\t\t\t$scope.id = data.id;\n\t\t\t\t\t$scope.descripcion = data.descripcion;\n\t\t\t\t\t$scope.ruc = data.ruc;\n\t\t\t\t\t$scope.proceso = 2;\t// 2: editar\n\t\t\t\t}\n\t\t\t}, function(err) {\n\t\t\t\t// MANEJO DE ERRORES\n\t\t\t});\n\t\t}", "function poliyaId(id){\n oqituvchiService.getById(id,malumotQuy,console.log(\"xato\")); \n}", "function leerDatosDeProducto(productoAgregado) {\n const idProductoSeleccionado = parseInt(\n productoAgregado.querySelector(\"a\").getAttribute(\"data-id\")\n );\n\n let datoProductos = {};\n\n productosEnStock.forEach((producto) => {\n if (producto.id === idProductoSeleccionado) {\n datoProductos = { ...producto };\n datoProductos.cantidad = 1;\n }\n });\n const existe = coleccionProductos.some(\n (producto) => producto.id === datoProductos.id\n );\n\n if (existe) {\n //actualizamos la cantidad\n const productosListaSinCopia = coleccionProductos.map((producto) => {\n if (producto.id === datoProductos.id) {\n producto.cantidad++;\n return producto;\n } else {\n return producto;\n }\n });\n } else {\n //agrega elemento al arreglo de carrito\n coleccionProductos = [...coleccionProductos, datoProductos];\n }\n\n carritoHTML();\n}" ]
[ "0.68603635", "0.68139905", "0.6617569", "0.6322625", "0.6321053", "0.630884", "0.62141055", "0.6195054", "0.61876005", "0.618343", "0.615696", "0.61434543", "0.6100849", "0.6077855", "0.60695535", "0.602773", "0.60158944", "0.60087883", "0.60066396", "0.6002418", "0.5987984", "0.59865344", "0.5977845", "0.5975188", "0.59729475", "0.59305745", "0.5926299", "0.5900787", "0.58923405", "0.5872154", "0.5859771", "0.5859334", "0.584858", "0.5844512", "0.5819438", "0.5806262", "0.5795202", "0.57773685", "0.57744944", "0.57712686", "0.5759872", "0.57437253", "0.57385546", "0.5734367", "0.5733831", "0.5724517", "0.5724517", "0.57207876", "0.57167053", "0.5713299", "0.5710738", "0.5703357", "0.5702104", "0.5696687", "0.56928486", "0.5688812", "0.5685664", "0.5683083", "0.56817245", "0.5680629", "0.5674682", "0.56740826", "0.5672443", "0.56720567", "0.56699324", "0.5658175", "0.56535316", "0.56489813", "0.56468713", "0.5644215", "0.5638378", "0.56367594", "0.5629398", "0.56263554", "0.5607611", "0.5604673", "0.559413", "0.5587155", "0.55869275", "0.5584797", "0.5582487", "0.5577947", "0.5568825", "0.5566107", "0.55640125", "0.5563349", "0.555116", "0.5541108", "0.5535038", "0.55339116", "0.5532752", "0.55177516", "0.55137", "0.55083615", "0.5507541", "0.5501712", "0.55003583", "0.5499362", "0.5491492", "0.5488043", "0.5487129" ]
0.0
-1
Impresion de Desembolso (incrementa el campo de IMPRESO)
function impresionDesembolso(desembolso) { var deferred = $q.defer(); $http.post('/desembolso/print/{desembolso}/'.replace('{desembolso}', desembolso), {'desembolso': desembolso}). success(function (data) { deferred.resolve(data); }). error(function (data) { deferred.resolve(data); }); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adicionar (){\n const valor = contador + 1\n setContador(valor) \n }", "function cumpleanosModificadonObjeto(persona) {\n persona.edad += 1;\n}", "increment() {\n\t\t++this.amount;\n\t}", "static increment(){\n return { \n type: 'INC'\n }\n }", "function increment() {\n return increment.count++;\n }", "function increasePomos() {\n currPomos++;\n document.getElementById('currentPomos').innerHTML = currPomos;\n}", "function cumpleanos(persona){\n persona.edad += 1\n\n}", "onInc() {\n this.count++;\n }", "static getInc() {\n return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);\n }", "function aumentarCantidad2() {\n etiquetaCantidad2.innerHTML++;\n}", "async _incrementSequenceNo() {\n const that = this\n this.sequenceNoData[\"sequence-no\"]++\n return await that.bookkeepingDb.put(that.sequenceNoData).then((result) => {\n that.sequenceNoData._rev = result.rev\n })\n }", "function Increment(){\n setCounter(counter + 1) \n }", "function aumentarCantidad1() {\n etiquetaCantidad1.innerHTML++;\n}", "accionIncrementar({commit}) {\n commit('incrementar', 10)\n }", "function increment() {\n\tnumber += 1; /*\n\t\t\t\t\t * Function for automatic increment of field's \"Name\"\n\t\t\t\t\t * attribute.\n\t\t\t\t\t */\n}", "function cumpleanos(persona){\n return{\n ...persona,\n edad: persona.edad + 1\n }\n}", "function increment(){\n\t\tsetCount(prevCount=>prevCount+1)\n\t}", "nextID(){\n this.uniiqueID = this.uniiqueID || 0;\n return this.uniiqueID++;\n }", "nextImg(){\r\n (this.contatore == this.immagini.length - 1 ) ? this.contatore = 0 : this.contatore++;\r\n console.log(this.contatore);\r\n }", "function amelioration(){\n return nbMultiplicateurAmelioAutoclick +9;\n}", "function agregarImpuesto(){\n\n\t\t\tvar impuesto = $('#nuevoImpuestoVenta').val();\n\n\t\t\t//var precioTotal = $('#nuevoTotalVenta').attr('total')\n\t\t\tvar precioTotal = $('#nuevoTotalVenta').attr('total')\n\t\t \n\n\t\t\tvar precioImpuesto = Number(precioTotal*impuesto/100);\n\n\n\t\t\tvar totalConImpuesto = Number(precioImpuesto)+Number(precioTotal);\n\n\t\t\t$('#nuevoTotalVenta').val(totalConImpuesto);\n\t\t\t$('#totalVenta').val(totalConImpuesto);\n\t\t\t$('#nuevoPrecioImpuesto').val(precioImpuesto);\n\t\t\t$('#nuevoPrecioNeto').val(precioTotal);\n\n\t\t}", "function incrementAC() {\r\n return {\r\n type: INCREMENT\r\n }\r\n}", "get increment(){ return this._increments.peek(); }", "_getAndIncrementId() {\n return this._id++;\n }", "function increment (orig) {\n return orig !== undefined ? orig + 1 : 1\n }", "function cumpleanosSinModificarObjeto(persona) {\n return {\n ...persona,\n edad: persona.edad + 1,\n };\n}", "function carneasadatampiquena_plus() {\n var valore = document.getElementById(\"carneasadatampiquena\").innerHTML;\n if (valore < 20) {\n valore++;\n document.getElementById(\"carneasadatampiquena\").innerHTML = valore;\n }\n}", "@action\n increment() {\n this.set('number', this.number + 1);\n }", "function AjPoFo() {\r\n \r\n if (perso.Por < 2) { //Test si assez d'argent\r\n alert(\"Vous n'avez pas assez d'argent\");\r\n console.log(\"Pas assez d'argent / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Por -= 2; //Or du perso -2\r\n perso.Pinv[0] += 1; //Nombre de potion +1 \r\n document.getElementById('or').value = perso.Por; //affiche Or du perso dans la div caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affiche le nombre de potion\r\n console.log(\"Achat d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function increment1() {\n SpreadsheetApp.getActiveSheet().getRange('A1').setValue(SpreadsheetApp.getActiveSheet().getRange('A1').getValue() + 1);\n}", "function proximoRegistro() {\n let ultimo = personas.find((x) => x.id === personas.length);\n let registro = ultimo.id + 1;\n return registro;\n}", "function __full_incr_op(parent, me, val) {\n // Edit found entry in place\n me.got.V.P += val; // Increment P\n if (ZH.IsUndefined(me.got.V.D)) me.got.V.D = val; // SET DELTA\n else me.got.V.D += val; // INCR DELTA\n\n // decrements modify in place -> to-be-delta.modified[]\n var entry = exports.CreateDeltaEntry(me.op_path, me.got);\n upsert_delta_modified(me, entry)\n}", "function reestablece(){\n colector = \"0\";\n operacion = \"\";\n operador0 = 0;\n operador1 = 0;\n resultado = 0;\n iteracion = 0;\n }", "function cumpleanos(persona) {\n return {\n ...persona,\n edad: persona.edad + 1\n }\n}", "function incr(elementId) {\n\tif( !document.getElementById) {\n\t\treturn;\n\t}\n\tvar e = document.getElementById( elementId );\n\tvar i = parseInt(e.innerHTML)\n\ti++\n\te.innerHTML = i\t\n}", "function somarPontoJogador() {\n jogadorPontos++;\n document.getElementById('jogador-pontos').innerHTML = jogadorPontos;\n}", "function cumpleanos(persona)\n{\n return{\n ...persona,\n edad:persona.edad +1\n }\n}", "iinc() {\n this.value++;\n return this;\n }", "function idUpdate(){\n dynamID.currID = dynamID.currID + 1;\n return (dynamID.currID - 1);\n}", "decrement(){\n this.increment(null, true);\n }", "function afficherPlusUn() {\n node.innerHTML = ++deb;\n\n if (deb < n) { \n // Si on est pas arrive a la valeur finale, on relance notre compteur une nouvelle fois\n \tsetTimeout(afficherPlusUn, delta); // applique un délais d'affichage\n }\n }", "function agregarImpuesto()\n{\n\tvar impuesto = $(\"#nuevoImpuestoVenta\").val();\n\tvar precioTotal = $(\"#nuevoTotalVenta\").attr(\"total\");\n\n\tvar precioImpuesto = Number(precioTotal * impuesto /100);\n\tvar totalConImpuesto = Number(precioImpuesto) + Number(precioTotal);\n\n\t$(\"#nuevoTotalVenta\").val(totalConImpuesto);\n\t$(\"#nuevoPrecioImpuesto\").val(precioImpuesto);\n\t$(\"#totalVenta\").val(totalConImpuesto);\n\t$(\"#nuevoPrecioNeto\").val(precioTotal);\n}", "function cumpleanosClonandoObjeto(persona){\n return {\n ...persona,\n edad: persona.edad += 1\n }\n}", "function increment(){\n return {\n type: \"INCREMENT\"\n }\n}", "function actualizaMov(){\r\n var valorActual = Number($('#movimientos-text').text());\r\n var resultado = valorActual += 1;\r\n $('#movimientos-text').text(resultado);\r\n}", "Avanzar()\n {\n if(this.state.indiceActual<this.state.Preguntas.length-1)\n this.setState((state) => (\n {indiceActual: this.state.indiceActual+1})\n );\n\n }", "function fieldInc(doc, field, value) {\n // Requires(doc !== undefined)\n // Requires(field !== undefined)\n // Requires(typeof(value) == 'number')\n\n fieldSet(doc, field, value, function (oldValue) {\n if (oldValue === undefined)\n return value;\n if ((typeof oldValue) == \"number\")\n return oldValue + value;\n return oldValue;\n });\n }", "function incrementer (original) {\n return original + 1;\n // Add your code above this line\n}", "function somarPontoComputador() {\n computadorPontos++;\n document.getElementById('computador-pontos').innerHTML = computadorPontos;\n}", "function increase(InputFirstId,InputEconomyId){\n\n let CountFirst=parseInt(InputFirstId.value);\n\n if(isNaN(CountFirst)){\n // alert(\"insert proper value\");\n InputFirstId.value=0;\n }\n else {\n CountFirst = CountFirst + 1;\n InputFirstId.value = CountFirst;\n\n calculate();\n }\n}", "niveauSuivant()\r\n\t{\r\n\t\tthis._termine = false;\r\n\t\tthis._gagne = false;\r\n\t\tthis._niveau++;\r\n\t\tthis.demarrerNiveau();\r\n\t}", "function importe2()\n {\n var cant = document.getElementById('cantidad').value;\n var pUnitario = document.getElementById('pUnitario').value;\n document.getElementById('importe').value = cant * pUnitario;\n }", "function obtener_ultimo_folio() {\n var consulta = conexion_ajax(\"/servicios/dh_cursos.asmx/Obtener_ultimo_folio\")\n $(\"#folio_curso\").val((consulta+1))\n}", "increment() {\n this.referenceCount++;\n }", "function increasment(num) {\n return ++num;\n}", "function macho_plus() {\n var valore = document.getElementById(\"macho\").innerHTML;\n if (valore < 20) {\n valore++;\n document.getElementById(\"macho\").innerHTML = valore;\n }\n}", "function pontuaJogador(jogadorUm) {\r\n if (jogadorUm) // pontua jogador 1\r\n jogador1.innerHTML = \"<span class='label'>P1</span><span>\" + ++pontuacao1 + \"</span>\"\r\n else // pontua jogador 2\r\n jogador2.innerHTML = \"<span class='label'>P2</span><span>\" + ++pontuacao2 + \"</span>\"\r\n}", "function increment (orig) {\n return orig !== undefined ? orig + 1 : 1\n}", "function increment (orig) {\n return orig !== undefined ? orig + 1 : 1\n}", "function increment (orig) {\n return orig !== undefined ? orig + 1 : 1\n}", "function increment (orig) {\n return orig !== undefined ? orig + 1 : 1\n}", "function nume(num) {\r\n if (typeof gvisor == 'undefined') {\r\n document.calcula.tela.value=\"\";\r\n }\r\n document.calcula.tela.value = document.calcula.tela.value + num;\r\n gvisor = 1;\r\n}", "__crearDummy(annoMesDia, idLocal, auditor){\n return {\n idDummy: this.idDummy++, // asignar e incrementar\n aud_idAuditoria: null,\n aud_fechaProgramada: annoMesDia,\n aud_fechaProgramadaFbreve: '',\n aud_fechaProgramadaDOW: '',\n aud_idAuditor: auditor,\n local_idLocal: idLocal,\n local_ceco: '-',\n local_direccion: '',\n local_comuna: '',\n local_region: '',\n local_nombre: '-',\n local_stock: '',\n local_horaApertura: '',\n local_horaCierre: '',\n local_fechaStock: '',\n cliente_nombreCorto: ''\n }\n }", "function countPlus(){\n setCount(count+1)\n }", "increment()\n {\n this.cntr++;\n document.getElementById('label').innerHTML = `${this.cntr}`;\n }", "function handleContador(){\n props.incrementCounter(1);\n }", "function incrementValue(e) {\n e.preventDefault();\n var fieldName = $(e.target).data('field');\n var parent = $(e.target).closest('div');\n var currentVal = parseInt(parent.find('input[name=' + fieldName + ']').val(), 10);\n\n if (!isNaN(currentVal)) {\n parent.find('input[name=' + fieldName + ']').val(currentVal + 1);\n } else {\n parent.find('input[name=' + fieldName + ']').val(0);\n }\n }", "function incrementarID() {\n if (temas.length > 0) {\n topicID = temas[temas.length-1].tema_id+1;\n } else {\n topicID = 1;\n }\n}", "function agregarNumero(num){\n opActual = opActual + num; \n actualizarDisplay();\n}", "function cumpleaños(persona){\n return{\n ...persona,\n edad: persona.edad +1\n }\n}", "function cumpleanos(persona){\n return {\n ...persona,\n edad: persona.edad + 1//si puedo modicar y crea como un nuevo objeto\n }\n}", "function inc(count) {\n count.value++;\n return count;\n}", "function nuevoFin(){\n let previo = fin;\n fin = mapa[inputFinalX.value()][inputFinalY.value()];\n fin.obstaculo = false;\n fin.corrienteFuerte = false;\n fin.corriente = false;\n fin.pintar(0);\n previo.pintar(255);\n}", "function movementUpdate(){\n var valueActual= Number($('#movimientos-text').text());\n var result= valueActual +=1;\n $('#movimientos-text').text(result);\n}", "function counterGeneracionPoema() {\nif (counter == 0) {\n counter = tiempoParaCambiarTodo/1000;\n} counter--;\n document.getElementById(\"outputTiempo\").innerHTML = counter; \n}", "function impostaDati (importo, indice) {\n capVarImp.impostaValutaEAllineaADestra(\"#totaleCompetenzaTrovatoAnno\" + indice, importo.stanziamento);\n capVarImp.impostaValutaEAllineaADestra(\"#totaleResiduiTrovatoAnno\" + indice, importo.stanziamentoResiduo);\n capVarImp.impostaValutaEAllineaADestra(\"#totaleCassaTrovatoAnno\" + indice, importo.stanziamentoCassa);\n }", "function anterior () {\n \n if (aux_2 == 0){\n \n aux_2 = 0;\n \n }\n\n else{\n\n aux_2 = aux_2-1;\n\n }\n\n document.images.Diapositiva.src = Fotos[aux_2];\n }", "function increment() {\n return { type: 'INCREMENT' };\n}", "Increment(){\n this.count += 1;\n console.log(this.count);\n }", "function agregarImpuestoC(){\n\n let impuestoC = $(\"#nuevoImpuestoCompra\").val();\n let precioTotalC = $(\"#nuevoTotalCompra\").attr(\"total\");\n \n let precioImpuestoC = Number(precioTotalC * impuestoC/100);\n let totalConImpuestoC = Number(precioImpuestoC) + Number(precioTotalC);\n\n $(\"#nuevoTotalCompra\").val(totalConImpuestoC);\n $(\"#totalCompra\").val(totalConImpuestoC);\n $(\"#nuevoPrecioImpuestoC\").val(precioImpuestoC);\n $(\"#nuevoPrecioNetoC\").val(precioTotalC);\n}", "function incrementCounter() {\n setCounter(counter + 1);\n }", "function incrementValue(e) {\n e.preventDefault();\n var fieldName = $(e.target).data('field');\n var parent = $(e.target).closest('div');\n var currentVal = parseInt(parent.find('input.' + fieldName).val(), 10);\n\n if (!isNaN(currentVal)) {\n parent.find('input.' + fieldName).val(currentVal + 1);\n } else {\n parent.find('input.' + fieldName).val(0);\n }\n}", "function addUno() {\n var q = document.getElementById('q1').textContent;\n q = isNaN(q) ? 0 : q;\n q++;\n console.log(\"fatto \" + q);\n totaleAdd();\n return document.getElementById(\"q1\").innerHTML = q;\n}", "increment() {\n this[$referenceCount]++;\n }", "siguiente() {\n this.ultimo += 1; // forma corta de hacer un accumulado \n \n /* mi objeto de 1 ticket a rellenarlo \n * es decir cada vez se llama siguiente en esta linea se crea nueva instancia : nuevo Objeto a rellenar\n */\n const ticket = new Ticket( this.ultimo, null ); \n this.tickets.push( ticket );\n\n this.guardarDB();\n return 'Ticket ' + ticket.numero;\n }", "incrementIndex() {\n this.currentIndex = this.frames.length === this.currentIndex + 1 ? 0 : this.currentIndex + 1;\n }", "function incrementVariable() {\n \t\ti = i + 1;\n \t}", "function edadEvil (persona)\n{\n persona.edad += 1\n}// esta función modificara la edad del objeto en cuestion, esto se hace por si quieres modificar el objecto original ", "function reglaAumPrecioFullCobertura(){\n if(producto.f_cobertura.sellIn -1){\n precio_FullCobertura + 1;\n }else{\n\n }\n}", "function paginaAnterior(){\r\n if (pagina_actual > 1) {\r\n pagina_actual--;\r\n cambiar_pagina(pagina_actual);\r\n }\r\n}", "function increment(orig) {\n return orig !== undefined ? orig + 1 : 1;\n}", "function nuevoInicio(){\n let previo = inicio;\n inicio = mapa[inputInicioX.value()][inputInicioY.value()];\n inicio.obstaculo = false;\n inicio.corrienteFuerte = false;\n inicio.corriente = false;\n inicio.pintar(0);\n previo.pintar(255);\n}", "function add(num) {\n \"use strict\";\n update($(\"#steps\").text()*1 + num);\n }", "function SaveSerieNumber() {\n rowResult.push(\"0\");\n }", "come(suma){\n console.log(`${this.nombre} esta comiendo`)\n this.energia += suma\n }", "async _getIdAndIncrement() {\n const instance = this._instance;\n const id = await instance.get('zombie_id_serial').value();\n\n // increment\n await instance.update('zombie_id_serial', n => n + 1).write();\n\n return id;\n }", "function edad(fecha, campo = undefined) {\n let campoEdad = campo;\n let hoy = new Date();\n let cumpleanos = new Date(fecha);\n let edad = hoy.getFullYear() - cumpleanos.getFullYear();\n let m = hoy.getMonth() - cumpleanos.getMonth();\n\n if (m < 0 || (m === 0 && hoy.getDate() < cumpleanos.getDate())) {\n edad--;\n }\n if (campoEdad == undefined) {\n\n console.log(campoEdad);\n } else {\n\n campoEdad.value = edad;\n }\n}", "function incrementId(){\n //increment the counter\n incrementProgress.child('counter').transaction(function(currentValue){\n return (currentValue || 0) + 1\n }, function(err, committed, ss){\n if(err){\n setError(err);\n }\n \n else if(committed){\n //if update succeeds, then create a record\n addRecord(ss.val());\n }\n });\n }", "function increment(){\r\n return this.count++;\r\n}", "function postInc(){\n\ta = 5;\n\tconsole.log(5);\n}", "function num(numero){\n document.calculadora.visor.value += numero;\n}" ]
[ "0.6580336", "0.60892767", "0.60505396", "0.59683603", "0.5882958", "0.5852795", "0.58424515", "0.58356947", "0.5824835", "0.58118397", "0.5787494", "0.5783863", "0.5781738", "0.5739387", "0.57322735", "0.5667989", "0.56590635", "0.5649055", "0.5644376", "0.5641948", "0.56209975", "0.56162846", "0.56052804", "0.5598716", "0.55964535", "0.559599", "0.559227", "0.55891025", "0.5569898", "0.5563216", "0.55315894", "0.5525902", "0.5521149", "0.5505965", "0.5491353", "0.54897046", "0.54692376", "0.5431176", "0.5430307", "0.5426849", "0.54261273", "0.5423534", "0.5419327", "0.5416295", "0.5404816", "0.54007196", "0.53860086", "0.53838605", "0.53806883", "0.5378204", "0.5375097", "0.5374239", "0.5367418", "0.5363488", "0.53325933", "0.53305167", "0.53211886", "0.53195244", "0.53195244", "0.53195244", "0.53195244", "0.5317498", "0.5312893", "0.5304952", "0.53040063", "0.5297864", "0.52976555", "0.5295771", "0.5284687", "0.5278712", "0.52778476", "0.52751076", "0.5272867", "0.5269683", "0.5257915", "0.52528244", "0.52521086", "0.52511823", "0.52500296", "0.5245222", "0.5244337", "0.52333426", "0.5230978", "0.5228459", "0.52196014", "0.52172667", "0.5216611", "0.5215153", "0.52140325", "0.52114874", "0.5210667", "0.52045614", "0.52039266", "0.5199328", "0.5189098", "0.5185985", "0.51817", "0.5179146", "0.51740474", "0.5167023", "0.51518" ]
0.0
-1
Functional component used to display a page not found message. Uses withRouter to link uses back to the App root.
function PageNotFound () { return ( <div> <div className="page-not-found"> <div className="page-not-found__copy"> Oops...Looks like something went wrong! </div> <div className="page-not-found__actions"> <Link to="/">Click here</Link> to return to the Readable homepage. </div> </div> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function NotFound(){\n return(\n <PageDefault>\n <h1>Page not found</h1>\n <h2>Error 404!</h2>\n </PageDefault>\n )\n}", "function PageNotFound() {\n return (\n <>\n <div className=\"body-wrapper\">\n <h1>That is not a valid URL!</h1>\n <br />\n <br />\n <p>\n Would you like to <Link to=\"/allplaces\">view all places?</Link>\n </p>\n </div>\n </>\n );\n}", "function PageNotFound(props) {\r\n\treturn(\r\n\t\t<div id=\"page-not-found-container\" className=\"text-center\">\r\n\t\t\t<h1 id=\"page-not-found-message\">\r\n\t\t\t\t<FormattedMessage \r\n\t\t\t\t\tid=\"pagenotfound.message\" \r\n\t\t\t\t\tdefaultMessage=\"\"\r\n\t\t\t\t/>\t\t\t\r\n\t\t\t</h1> \r\n\t\t</div>\r\n\t\t);\r\n}", "function NotFound() {\n return (\n <div>\n <h1>May be youare looking for some other page?</h1>\n </div>\n );\n}", "function notfound() {\n return (\n <>\n <div className=\"notfound\">\n <p>Page not found :(</p>\n <a href=\"/\">\n <button className=\"myButton\" href=\"/\">\n Return to home page\n </button>\n </a>\n </div>\n </>\n );\n}", "function NotFoundPage() {\n return (\n <span>\n <AppHeader />\n\n <h1 style={{ marginTop: 100 }}>Page Not Found</h1>\n\n <Footer />\n\n </span>\n );\n}", "function NotFound() {\n return (\n <div className=\"page-container\">\n\t\t\t<div className=\"page-content-wrapper\">\n\t\t\t\t<div className=\"page-content\">\n\t\t\t\t\t<div className=\"page-bar\">\n\t\t\t\t\t\t<div className=\"page-title-breadcrumb\">\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"row\">\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<h1>404 Not Found</h1>\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</div>\n\t\t</div>\n );\n}", "function NotFound(){\n return <div>Path Not Found</div>\n}", "function notFound(req,h){\n return h.view('404',{},{layout: 'error-layout'}).code(404)\n}", "render() {\n return(\n <div className=\"ErrorPage\">\n <div className=\"padding dark-text center-text\">\n <img src={require(\"../../assets/images/wulogger_bear_simple.png\")} alt=\"bear\" className=\"center\"/>\n <h1>404 - Page not found</h1>\n <p>The page you are looking for decided to take a rest day and is not currently running</p>\n <Link className=\"text-link\" to='/home'><p>Go back to the home page</p></Link>\n </div>\n </div>\n );\n }", "function NotFound(props) {\n return (\n <Card title=\"Not found\" level={3}>\n <p>There's nothing to see here.</p>\n </Card>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n \n <Router>\n <Navigation />\n <Switch>\n <Route path=\"/housedetails/:id\" component={HouseDetails} />\n <Route path=\"/:page\" component={PageRenderer} />\n <Route path=\"/\" render={() => <Redirect to=\"/Home\" />} />\n <Route component={() => 404} /> \n </Switch>\n </Router>\n \n <Footer />\n </div>\n );\n}", "function PageNotFound (props) {\n return (\n <div className=\"page-not-found\">\n {/* <Header match={props.match} history={props.history} /> */}\n <div className=\"container\">\n\n <h1 style={{fontWeight:'normal',letterSpacing:'1px',wordSpacing:'2px',color: '#7b727c'}}>\n WHERE ARE YOU?\n </h1>\n\n </div>\n </div>\n )\n}", "function NotFound() {\n return (\n <Fragment>\n <Helmet>\n <title>Not Found</title>\n </Helmet>\n <div className=\"bounds\">\n <h1>Not Found</h1>\n <p>Sorry! We couldn&apos;t find the page you&apos;re looking for.</p>\n </div>\n </Fragment>\n );\n}", "function pageNotFound(req, res){\n\t// res.send(\"<h1>404 page not found<h1>\");\n\treturn res.render('404');\n}", "function notFound(req, res) {\n res.status(404).render('404.ejs')\n}", "function ErrorPage() {\n return (\n <div>\n <Nav/>\n <h1>YOU FOUND THE SECRET PAGE!</h1>\n <p>Just kidding this is a single page React application, so if anything you just found a secret component....</p>\n <p>But,alas, you did not, this is an error,click on a link above to get back to where you were intended to go</p>\n </div>\n \n \n\n );\n}", "function NotFound() {\n return (\n <div className=\"d-flex justify-content-center align-items-center\">\n <h1 className=\"adil-not-found\">404: Page Not Found</h1>\n </div>\n );\n}", "function pageNotFound( request, response ) {\n response.send( `<p>Error: Page not found. URL = ${request.url}</p>` );\n}", "function notFoundErrorHandler() {\n history.replace(\"/\");\n }", "function notFoundHandler() {\n \n }", "notFound() {}", "render() {\n return (\n <Wrapper>\n <Sidebar />\n <Container>\n <SearchInput />\n <Switch>\n <Redirect from=\"/\" to=\"/discover/popular\" exact />\n <Route path=\"/discover/:name\" component={Discover} />\n <Route path=\"/genre/:id\" component={Genres} />\n <Route path=\"/search/:query\" component={Search} />\n <Route path=\"/movie/:id\" component={MainFIlm} />\n <Route>\n <NotFound>\n <img src={pnf} alt=\"404.\"></img>\n </NotFound>\n </Route>\n </Switch>\n </Container>\n </Wrapper>\n );\n }", "render(){\n return(\n <Router history={hashHistory}>\n <Layout>\n <Switch>\n\n <Route exact path=\"/\" component={Home}/>\n \n <Route path=\"/eventLog\" component={EventLog}/>\n \n\n\n\n <Route render={function(){\n return <p> not found</p>\n }\n } />\n </Switch>\n </Layout>\n </Router>\n \n )\n }", "function NotFound(){return/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_theme_Layout__WEBPACK_IMPORTED_MODULE_1__[/* default */ \"a\"],{title:\"Page Not Found\"},/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\",{className:\"container margin-vert--xl\"},/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\",{className:\"row\"},/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\",{className:\"col col--6 col--offset-3\"},/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"h1\",{className:\"hero__title\"},\"Page Not Found\"),/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"p\",null,\"We could not find what you were looking for.\"),/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"p\",null,\"Please contact the owner of the site that linked you to the original URL and let them know their link is broken.\")))));}", "function NotFound(){\n /**\n * Build specific component */\n function buildComponent(){\n const notFoundPage = buildElement('div', {'id': 'profile-notFound'}, [\n buildElement('img', {'id': 'profile-notFound-img', 'src': 'https://mblogthumb-phinf.pstatic.net/MjAxOTA5MDZfMTgg/MDAxNTY3NzUyNDQ0NTgx.Ebcq2J8i8Rg44ixvQyCfmGqAZNCPMjZCrT_Dog7Mts4g.-4d34s3UnvbtDhjS5xU2ZOcuYJIBKcFgp1iAt-lgarIg.PNG.lw_10page/002_notfound%EC%9B%90%EC%9D%B8.png?type=w800'})\n ])\n updateElement('root', {}, ['']);\n updateElement('root', {}, [notFoundPage]);\n }\n function attachHandlers(){}\n function addComponents(){}\n\n /**\n * initialize component when rendering on browser\n */\n function init(){\n buildComponent();\n attachHandlers();\n addComponents();\n }\n init(); // 컴포넌트 생성 + 이벤트핸들러 연결\n}", "function App() {\n return (\n <div className=\"page-container\">\n <div className=\"content-wrap\">\n <Router>\n <Switch>\n <Route path=\"/login\" exact component={LoginPage} />\n\n <Route path=\"/register\" exact component={RegisterPage} />\n\n <Route path=\"/listing/:id\" component={ListingPage} />\n\n <Route path=\"/editListing/:id\" component={EditListingPage} />\n\n <Route path=\"/search\" component={SearchPage} />\n\n <Route path=\"/About\" exact component={AboutPage} />\n\n <PrivateRoute path=\"/profile\" exact component={ProfilePage} />\n\n <PrivateRoute\n path=\"/editProfile\"\n exact\n component={EditProfilePage}\n />\n\n <PrivateRoute\n path=\"/createListing\"\n exact\n component={CreateListingPage}\n />\n\n {/* For now 404 goes to the main page */}\n <Route path=\"/\" component={HomePage} />\n </Switch>\n </Router>\n </div>\n <AppFooter />\n </div>\n );\n}", "function notFound(res)\n{\n res.send('<h1>Page not found.</h1>', 404);\n}", "function Main(){\n \n return (\n <main className=\"content\">\n <Router>\n <Route exact path=\"/\" component={Home}/>\n <Route exact path=\"/productos\" component={Productos}/>\n <Route exact path=\"/productos/vista-test\" component={Productos}/>\n {/* <Route component={PageNotFound}/> */}\n </Router>\n </main>\n )\n \n\n}", "function NoPageFound(props){\n return(\n <div id={\"divStyle\"}>\n <Typography variant=\"h1\" color={'primary'} component=\"h1\" align=\"center\">\n No Page Found!\n </Typography>\n </div>\n )\n}", "function App(props) {\n return (\n <div>\n <Switch>\n <Route path=\"/\" exact component={DegenerativeTriangle}/>\n <Route path=\"/results\" exact component={DegenerativeTriangleResults}/>\n <Route path=\"**\" render={() => <h1>Page Not Found!</h1>} />\n </Switch>\n </div>\n );\n}", "render() {\n invariant(\n false,\n '<Redirect> elements are for router configuration only and should not be rendered'\n )\n }", "_notFound() {\r\n console.error('NOT FOUND');\r\n }", "function notFoundHandler(req, res, next) {\n next(createError(404, \"Your requested content was not found!\"));\n}", "function notFoundHandler(req, res, next) {\n next(createError(404, \"Your requested content was not found!\"));\n}", "function InvalidMatchIdPage() {\n return <h1>404 - Match Id Not Found</h1>\n}", "function respondNotFound(res) {\n res.render('notFound', {\n pageTitle: 'Not found',\n bodyID: 'body_not_found',\n mainTitle: 'Not found'\n });\n}", "function App() {\n return (\n <Router>\n <Header/>\n <Switch>\n <Route path={'/'} exact component={Home}/>\n <Route path={'/about'} component={About}/>\n <Route path={'/project'} component={Project}/>\n <Route component={(props) => <div>404 Not found</div>}/>\n {/*<Route path={'/project/:id'} component={ProjectDetails}/>*/}\n </Switch>\n </Router>\n );\n}", "function App() {\n\n return (\n\n <Router>\n <GlobalStore.GlobalProvider>\n <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/register\" component={Register} />\n <Route exact path=\"/wall\" component={Wall} />\n {/* <Route component={NoMatch} /> */}\n </Switch>\n </GlobalStore.GlobalProvider>\n </Router>\n );\n}", "error404(req, res) {\n res.notFound();\n }", "render() {\n return (\n <Router>\n <Switch>\n <Route exact path='/service' component={ServiceAvailable}/>\n <Route exact path='/admin' component={Admin}/>\n <Route exact path='/adminlog' component={AdminFront}/>\n <Route exact path='/previousbooking' component={Previous}/>\n <Route exact path='/' component={Homei}/>\n <Route exact path='/404' component={ErrorPage}/>\n <Redirect to=\"/404\"/>\n </Switch>\n </Router>\n \n \n );\n }", "function notFound(req, res) {\n res.status(404).send('Sorry, this route does not exist.');\n}", "notFound(data, cb) {\n cb(404);\n }", "function notFound(req, res, next) {\n console.error('Route not found')\n response.error(req, res, `Route ${req.originalUrl} not found`, 404)\n}", "function NoMatch() {\n return (\n <div>\n <h1>404 Page Not Found</h1>\n <h2>\n <span role=\"img\" aria-label=\"Face With Rolling Eyes Emoji\">\n 🙄\n </span>\n </h2>\n </div>\n );\n}", "createErrorPage() {\n // if there is a user error\n if (this.state.errorMessage) {\n return (\n <div className=\"center\">\n <div className=\"font20px\" style={{ margin: \"20px\" }}>\n Something went wrong.\n </div>\n <div className=\"font14px\">\n {this.state.errorMessage} Try refreshing or contacting support.\n </div>\n <Button style={{ margin: \"20px\" }} onClick={() => goTo(\"/myEvaluations\")}>\n Take Me Home\n </Button>\n </div>\n );\n }\n\n // if there is a Moonshot error\n return <MiscError />;\n }", "function notFoundHandler (ctx) {\n ctx.status = 404\n}", "render() {\n if (!this.props.error && this.state.hasUiError) {\n this.setState({ hasUiError: false })\n }\n\n return this.state.hasUiError ? null : <Route path=\"/\" component={App} />\n }", "function catchNotFoundError() {\n Swal.fire('Not found', '404 ERROR', 'error');\n}", "function notPageFound(req, res){\n res.write(\"No se ha encontrado la pagina solicitada.\");\n res.end();\n}", "function all(req, res) {\n renderer.renderAndSend('notfound.jade', req, res, {});\n}", "render(){\n return (\n <BrowserRouter >\n <Switch>\n <Route exact path=\"/\" component={App}/>\n <Route path=\"/:query\" component={App} />\n <Route component={NotFound}/>\n </Switch>\n </BrowserRouter>\n\n );\n}", "function notFound(request, response) {\n response.status(404).send({\n success: false,\n message: '404: cannot find route'\n });\n}", "function NoMatch() {\n \n return (\n <>\n <h1> 404 - Page Not Found</h1>\n <h1>\n <span role=\"img\" ariab-label=\"Face With Rolling Eyes Emoji\">\n 🙄\n </span>\n </h1>\n </>\n );\n}", "function App() {\n return (\n <Router>\n <header>\n <nav>\n <ul>\n <li><Link to=\"/\">Home</Link></li>\n <li><Link to=\"/about\">About</Link></li>\n <li><Link to=\"/posts\">Posts</Link></li>\n </ul>\n </nav>\n </header>\n <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/about\" component={About} />\n <Route exact path=\"/about/:username\" component={About} />\n <Route exact path=\"/posts\" component={Posts} />\n <Route exact path=\"/posts/:id\" component={Post} />\n {/*<Route path=\"*\" component={NotFound} />*/}\n <Redirect from=\"*\" to=\"/\" />\n </Switch>\n </Router>\n );\n}", "function notFound(req, res, next) {\n res.status(404);\n const error = new Error('Not Found data - ' + req.originalUrl);\n next(error);\n}", "function notfound_action(){\n \n res.status = 200;\n \n var action, output, name;\n \n // setup path names to look through\n var names = req.path.split('/');\n \n // resolve path names against the object hierarchy\n var obj = root;\n do {\n if (obj.get(names[0]))\n obj = obj.get(names[0]);\n else\n break;\n }\n while (names.shift());\n \n if (!obj.render)\n res.redirect(obj._parent.href());\n \n req.data.action = names[0] || 'main';\n \n // handle idempotent requests as such\n idempotentAction = req.data.action +'_'+ req.method.toLowerCase();\n \n // call a softcoded idempotent action\n if (obj.actions[idempotentAction])\n obj.actions[idempotentAction].call(obj,names);\n \n // call a softcoded standard action\n else if (obj.actions[req.data.action])\n obj.actions[req.data.action].call(obj,names);\n \n // render auto-action-enabled views \n else if (obj.actionviews_json \n && obj.actionviews_json[req.data.action] \n && obj.access[req.data.action])\n obj.renderPage();\n \n // if the main action was denied, redirect to the login\n else if (req.data.action == 'main')\n res.redirect(obj.href('login'));\n \n // otherwise redirect to the main action\n else \n res.redirect(obj.href());\n}", "function notFound() {\n const notFoundDiv = document.createElement('div')\n notFoundDiv.setAttribute('class', 'p-5 not-found')\n\n const span = document.createElement('span')\n span.textContent = '404'\n \n\n const h1 = document.createElement('h1')\n h1.textContent = '🧟‍♂️ No Monster Found 🧟‍♂️'\n\n notFoundDiv.append(span, h1)\n allMonster.append(notFoundDiv)\n}", "function App() {\n\n return (\n <Router>\n <div className=\"App\">\n <Navigation/>\n <Switch>\n <Redirect from='/members' exact={true} to='/members/all'/>\n <Redirect from='/rush' exact={true} to='/rush/requirements'/>\n <Route path=\"/\" exact component={Home}/>\n {/* <Route path=\"/faq\" component={PageNotFound}/> */}\n <Route path=\"/history\" component={History}/>\n {/* <Route path=\"/values\" component={PageNotFound}/> */}\n <Route path=\"/rush\" exact component={Rush}/>\n <Route path=\"/rush/:activetab\" component={Rush}/>\n {/* <Route path=\"/login\" component={PageNotFound}/> */}\n {/* <Route path=\"/family-tree\" component={PageNotFound}/> */}\n <Route path=\"/members\" exact component={Members}/>\n <Route path=\"/members/:activetab\" component={Members}/>\n <Route path=\"/page-not-found\" component={PageNotFound}/>\n\n <Redirect from='/'to='/page-not-found'/>\n </Switch>\n <Footer/>\n </div>\n </Router>\n );\n}", "function do404(app) {\n return async function(req, res) {\n const message = `${req.method} not supported for ${req.originalUrl}`;\n res.status(NOT_FOUND).\n send(app.locals.mustache.render('errors', { errors: [{ msg: message, }] }));\n };\n}", "function ErrorPage({ statusCode }) {\n return (\n <React.Fragment>\n <Head>\n <title>Topper</title>\n </Head>\n <div>\n {statusCode === 404 ? <p>Error 404</p> : <p>Big fucking error</p>}\n </div>\n </React.Fragment>\n );\n}", "function response404(res)\n{\n res.render(\"response404\");\n}", "function ReactRouterDom() {\n return (\n <Router>\n <NavBar />\n <Switch>\n <Route exact path=\"/\">\n <Home />\n </Route>\n <Route path=\"/about\"> {/* /about in the link will lead us to \"About\" component*/}\n <About />\n </Route>\n <Route path=\"/people\">\n <People />\n </Route>\n <Route path=\"/person/:id\" children={<Person />}></Route>\n <Route path=\"*\"> {/* * means this page will open no matter from what page i try to access invalid link*/}\n <Error />\n </Route>\n\n </Switch>\n </Router>\n )\n}", "function render404Page(res) {\n // TODO make this fancier\n res.writeHead(404);\n res.write('Not found :-(');\n res.end();\n}", "function App() {\n return (\n <Router>\n <div>\n <Nav />\n <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/saved\" component={Saved} />\n <Route component={NoMatch} />\n </Switch>\n </div>\n </Router>\n );\n}", "function routeDontFound() {\n var dinamic = dinamicRoutes();\n dinamic.status && __webpack_require__(\"./src/ts/components sync recursive ^\\\\.\\\\/.*\\\\.ts$\")(\"./\" + dinamic.route.component + \".ts\").page();\n}", "function notFoundHandler(req, res, next) {\n res.status(404).json(responseGenerator(null, 404, \"Not found\"));\n}", "render() {\n return (\n <div >\n <p>{this.props.locale.common.pagenotavaliable}</p>\n <a onClick={(e) => this.goBack}><span>{this.props.locale.common.GO_BACK}</span></a>\n </div>\n )\n }", "function routeDontFound() {\n var dinamic = dinamicRoutes();\n dinamic.status && __webpack_require__(\"./src sync recursive ^\\\\.\\\\/.*\\\\.ts$\")(\"./\" + project + \"/js/components/\" + dinamic.route.component + \".ts\").page();\n}", "function customUrlNotFound() {\n return function raiseUrlNotFoundError(req, res) {\n var path = require('path');\n var error = new Error('Cannot ' + req.method + ' ' + req.url);\n error.status = 404;\n res.sendFile(path.join(__dirname, '../../', 'client/404.html'));\n };\n}", "function notFound(req, res) {\n res.writeHead(404);\n res.write('Not found');\n res.end();\n}", "function Main() {\n return (\n <Router>\n <div>\n <Switch>\n <Route path='/' exact component={Home} />\n <Route path='/blackjack' component={Blackjack} />\n <Route path='*' component={NoPage} />\n </Switch>\n </div>\n </Router>\n );\n}", "render() {\n return(\n <HashRouter>\n <div className=\"container\">\n <Navigation />\n\n <Route exact path=\"/search\" render={ () => <SearchForm onSearch={this.performSearch} onSelectTitle={this.handleTitle} /> } />\n <h1 style={{display: this.state.loading ? 'block' : 'none' }}><br/>Loading...</h1>\n\n <Switch>\n <Route exact path=\"/\" render={ () => <Redirect to=\"/cats\"/> } />\n <Route exact path=\"/cats\" render={ () => <Cats fetch={this.fetchDefault} photos={this.state.catsPhotos} title=\"Cats\" /> } />\n <Route exact path=\"/dogs\" render={ () => <Dogs fetch={this.fetchDefault} photos={this.state.dogsPhotos} title=\"Dogs\" /> } />\n <Route exact path=\"/flowers\" render={ () => <Flowers fetch={this.fetchDefault} photos={this.state.flowersPhotos} title=\"Flowers\" /> } />\n <Route exact path=\"/search\" render={ () => <CurrentPhotos photos={this.state.currentPhotos} title={this.state.imageTitle} /> } />\n\n <Route component={PageNotFound} />\n </Switch>\n </div>\n </HashRouter>\n );\n }", "function navigateNow(destinationUrl) {\n if (typeof window !== 'undefined') {\n if (destinationUrl === NotFoundPage$1) {\n routerCurrent.setActive({ path: NotFoundPage$1 });\n } else {\n navigateTo(destinationUrl);\n }\n }\n\n return destinationUrl\n }", "function pageNotFound(res) {\r\n\r\n fs.readFile(__dirname + '/PageNotFound.html', function (err, content) {\r\n\r\n // restituisco il file\r\n res.writeHead(404) ;\r\n res.end(content) ;\r\n }) ;\r\n}", "function notFound(req, res){\n res.writeHead(404, {\"Content-Type\": \"text/html\"});\n res.write(\"404 Not Found\");\n res.end();\n}", "componentDidMount() {\r\n const { questions } = this.props;\r\n const id = this.props.match.params.question_id;\r\n const question = questions[id];\r\n if (!question) {\r\n const { history } = this.props;\r\n history.push(\"/404Page\");\r\n }\r\n }", "function errorHandleNoRoutes() {\n\tinfoWindow.setContent(\"<h1>No Route Found</h1>\");\n}", "function App() {\n return (\n <GlobalProvider>\n <GlobalStyle />\n <Router>\n <Switch>\n <Route exact path=\"/\" component={MainPage} />\n <Route exact path=\"/settings\" component={Settings} />\n <Route exact path=\"/404\" component={NotFound} />\n <Redirect to=\"/404\" />\n </Switch>\n </Router>\n </GlobalProvider>\n );\n}", "function notFoundRouteHandler(req, res) {\n res.status(500).send(\"Sorry, something went wrong\");\n}", "function AppRouter() {\n return (\n <Router>\n <React.Fragment>\n <AppNav />\n <Routes>\n <Route path=\"/\" element={<SearchPage />} />\n <Route path=\"/saved\" element={<SavedPage />} />\n <Route element={<NotFound />} />\n </Routes>\n <AppFooter />\n </React.Fragment>\n </Router>\n );\n}", "function App() {\n return (\n <>\n <div className=\"container\">\n <div className=\"row\">\n <div className=\"col\">\n <h1>WannaBuy.com</h1>\n </div>\n <div className=\"col\">\n <Link to=\"/wannabuys/new\">What do you want to buy?</Link>\n </div>\n <div className=\"col\">\n <Link to=\"/wannabuys/\">Back to home</Link>\n </div>\n </div>\n </div>\n <div className=\"container-flex justify-content-center\">\n <Router>\n <Redirect from=\"/\" to=\"/wannabuys\" noThrow=\"true\" />\n <CreateItem path=\"/wannabuys/new\" />\n <SingleItem path=\"/wannabuys/:id\" />\n <Items path=\"/wannabuys\" />\n </Router>\n </div>\n </>\n );\n}", "static routeNotFound(res) {\n res.writeHead(404, {'Content-Type': 'text/html'});\n res.write('Not Found');\n res.end();\n }", "function App() {\n return (\n <div className=\"App\">\n <BrowserRouter>\n <nav>\n <ul>\n <li>\n <Link to=\"/about/stam\" >About</Link>\n </li>\n <li>\n <Link to=\"/\" >Home</Link>\n </li>\n <li>\n <Link to=\"/settings\" >Settings</Link>\n </li>\n </ul>\n </nav>\n \n <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route path=\"/about/:myName\" component={About} />\n <Route path=\"/settings\" render={() => {\n return (\n <Suspense fallback={<div>Loading...</div>}>\n <div>\n <Lazy />\n </div>\n </Suspense>\n );\n }} />\n <Route path=\"**\" component={Error404} />\n </Switch>\n \n </BrowserRouter>\n </div>\n );\n}", "function showRoutingError() {\n\t\t\tvar el = $('#routeError');\n\t\t\tel.html(preferences.translate('noRouteAvailable'));\n\t\t\tel.show();\n\t\t}", "_routePageChanged(page) {\n const routes = ['repository-list'];\n this.page = page || 'repository-list'; // defaults to home route if no page\n\n // if we are trying to access anything other than / or /repository-list return 404 page\n if (routes.indexOf(this.page) === -1){\n this.page = '404';\n }\n }", "function AppRouter (){\n return (\n <BrowserRouter>\n \n \n <Layout>\n <Switch>\n <Route path=\"/register\" component={Register} exact/>\n <Route path=\"/login\" component={Login} exact/>\n <Route path=\"/todos\" component={Todos} exact/>\n <Route path=\"*\" component={Error404}/>\n </Switch>\n </Layout>\n \n \n\n </BrowserRouter>\n );\n}", "function errorLoadRoute(err) {\n // On error loaded page we can redirect user to 404 page or error page.\n console.error('Loaded page failed', err);\n}", "function App() {\n return (\n <BrowserRouter>\n <Loader />\n <Header />\n <div className=\"container\">\n <Switch>\n <Route exact path=\"/\" component={Login} />\n <Private expected=\"admin\" src=\"/admin/:any\" page={Admin} />\n <Private expected=\"faculty\" src=\"/faculty/:any\" page={Faculty} />\n <Private expected=\"student\" src=\"/student/:any\" page={Student} />\n {/* <Route component={Errpage} /> */}\n </Switch>\n </div>\n <Footer />\n </BrowserRouter>\n );\n}", "function App() {\n return (\n <div className=\"App\">\n <Sidebar/>\n <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/home\" component={Home} />\n <Route exact path=\"/about-us/\" component={AboutUs}/>\n <Route exact path=\"/food-and-drinks\" component={FoodAndDrinks}/>\n <Route exact path=\"/our-story\" component={OurStory}/>\n <Route exact path=\"/locations\" component={Locations}/>\n <Route exact path=\"/contact\" component={Contact}/>\n <Route exact path=\"/blog/:slug\" component={BlogPost}/>\n {/* Errorpage heeft een error */}\n {/* <Route component={Error}/> */}\n </Switch>\n </div>\n );\n}", "function notFoundHandler(req, res) {\n serveFile(\"../templates/404.html\", 404, {}, req, res);\n}", "function App() {\n return (\n <Router>\n <div className=\"App font-body \">\n <Navbar />\n <Switch>\n <Route exact path=\"/\" component={CustomersList}/> \n <Route exact path=\"/customerdetails/:id\" component={CustomerDetails}/> \n <Route exact path=\"/customersessions/:id\" component={CustomerSessions}/>\n <Route exact path=\"/trainerdetails\" component={TrainerDetails}/> \n <Route exact path=\"/sessiondetails/:id\" component={SessionDetails}/>\n <Route exact path=\"/signin\" component={Login}/>\n <Route path=\"*\"> \n <NotFound />\n </Route>\n </Switch>\n </div>\n </Router>\n );\n}", "static get notFoundError() {\n return getErrorObject('OFFER_NOT_FOUND', 404);\n }", "function App() {\n const location = useLocation();\n\n return (\n <React.Fragment>\n <Header></Header>\n <AnimatePresence exitBeforeEnter>\n <Switch location={location} key={location.key}>\n <Route path='/contact'>\n <Suspense fallback={<SuspenseSpinner />}>\n <ContactPage></ContactPage>\n </Suspense>\n </Route>\n <Route path='/about'>\n <Suspense fallback={<SuspenseSpinner />}>\n <AboutMePage></AboutMePage>\n </Suspense>\n </Route>\n <Route path='/projects'>\n <Suspense fallback={<SuspenseSpinner />}>\n <ProjectsPage></ProjectsPage>\n </Suspense>\n </Route>\n <Route path='/' exact>\n <Suspense fallback={<SuspenseSpinner />}>\n <HomePage></HomePage>\n </Suspense>\n </Route>\n <Route path='*' exact>\n <Suspense fallback={<SuspenseSpinner />}>\n <NotFoundPage></NotFoundPage>\n </Suspense>\n </Route>\n </Switch>\n </AnimatePresence>\n </React.Fragment>\n );\n}", "function display404(url, req, res) {\n res.writeHead(404, {\n 'Content-Type': 'text/html'\n });\n res.write(\"<h1>404 Not Found </h1>\");\n res.end(\"The page you were looking for: \" + url + \" can not be found \");\n}", "function App() {\n\n return (\n <Router> \n <div className=\"App\">\n <Navbar/>\n <header className=\"App-header\">\n <Switch>\n <Route exact path=\"/\">\n <Home/>\n </Route>\n <Route exact path=\"/signup\">\n <Signup/>\n </Route>\n <Route exact path=\"/signin\">\n <Signin/>\n </Route>\n <Route path=\"/new-post\">\n <NewPost/>\n </Route>\n <Route path=\"/post/:id\">\n <PostDetails/>\n </Route>\n <Route path=\"\">\n <NotFound/>\n </Route>\n </Switch>\n </header>\n </div>\n </Router>\n \n );\n}", "function App() {\n return (\n <>\n <Router>\n <Suspense fallback={<div>Loading...</div>}>\n <AnimatePresence>\n <Switch>\n <Route exact path=\"/\" component={Home} />\n {/* <Route path=\"/About\" component={About} />\n <Route path=\"/join\" component={JoinCea} />\n <Route path=\"/login\" component={Login} />\n <Route path=\"/work\" component={Work} />\n <Route path=\"/hiring\" component={Hiring} />\n <Route path=\"/contact\" component={Contact} /> */}\n {/* <Route path=\"/Robots\" component={Robots} /> */}\n </Switch>\n </AnimatePresence>\n </Suspense>\n </Router>\n </>\n )\n}", "function notFound() {\n return Joi.object({\n statusCode: Joi.number().valid(404).required(),\n error: Joi.string().required(),\n message: Joi.string().required(),\n })\n .label('_not_found_error')\n .description('Resource not found');\n}", "function notFound() {\n statusCode = 404;\n outputFile = \"404.html\";\n }", "function notFoundErrorHandler(err, req, res, next) {\n res.status(404)\n res.send(\"error - Resource not found \");\n}" ]
[ "0.7501168", "0.7420509", "0.74190855", "0.7300435", "0.70926124", "0.70417213", "0.703691", "0.6877237", "0.6804018", "0.67175037", "0.6623011", "0.6616456", "0.65986395", "0.65974677", "0.65944153", "0.6589223", "0.65851396", "0.65691113", "0.6529919", "0.6498586", "0.6413116", "0.6406645", "0.6401148", "0.6385012", "0.6376567", "0.6368838", "0.6345802", "0.6313407", "0.63101906", "0.6240013", "0.62094474", "0.62056315", "0.62054247", "0.6175946", "0.6175946", "0.61700636", "0.61511177", "0.6102732", "0.6092134", "0.60748607", "0.6072383", "0.6069225", "0.603068", "0.60286117", "0.60034853", "0.60009867", "0.59824485", "0.59794307", "0.59740317", "0.59678096", "0.5960939", "0.59558594", "0.5953675", "0.59144545", "0.5900028", "0.5895797", "0.5892471", "0.5849036", "0.5840591", "0.58327764", "0.5830509", "0.58237475", "0.5814096", "0.5802013", "0.5801708", "0.58015794", "0.578483", "0.57624733", "0.57498", "0.574817", "0.5718316", "0.57120675", "0.57109624", "0.57089186", "0.57087445", "0.570397", "0.5702847", "0.5702622", "0.5699736", "0.5697881", "0.5693722", "0.56931156", "0.5683252", "0.5668534", "0.56604326", "0.5653394", "0.5652503", "0.56469196", "0.5643584", "0.5637167", "0.56311375", "0.5630038", "0.56280357", "0.56269366", "0.5612806", "0.55989456", "0.55955607", "0.5576701", "0.55726224", "0.5562778" ]
0.7389535
3
this closes the document.ready function functions: this area is for functions======================= updateEnemyBars: this function will update the health and counter bars of the enemies
function updateEnemyBars (fighterClass, fighterHealthClass, fighterCounterClass) { var healthPercent; var counterPercent; healthPercent = ((fighterClass.health * 100) / fighterClass.healthMax); counterPercent = ((fighterClass.counter * 100) / fighterClass.counterMax); console.log("enemy health percent: " + healthPercent); console.log("enemy counter percent: " + counterPercent); //these commands update the bars in the character $ ("." + fighterHealthClass).css("width",healthPercent + "%"); $ ("." + fighterCounterClass).css("width",counterPercent + "%"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function worldUpdate() {\r\n\t$('#distance').html(prettify(Game.world.distance));\r\n\t$('#zone').html(Game.zone);\r\n\r\n\t//enemy\r\n\t$('#enemyHealth').html(prettify(Game.enemy.health));\r\n\r\n\tvar enemyHealthBar = document.getElementById(\"enemyHealthBar\");\r\n\tvar hp = (Game.enemy.health / Game.enemy.totalhealth) * 100;\r\n\tenemyHealthBar.style.width = hp + '%';\r\n\r\n\tif (Game.enemy.health >= Game.enemy.totalhealth) Game.enemy.health = Game.enemy.totalhealth;\r\n\r\n\tif (Game.enemy.health <= 0) {\r\n\t\tenemyHealthBar.style.width = '0%';\r\n\t\tendFight();\r\n\t}\r\n}", "update(){\n this.graphics.clear();\n for(let bar of this.healthBars){\n if(!bar.visible){\n continue;\n }\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.health/100);\n this.draw(bar);\n }\n for(let bar of this.progressBars){\n if(bar.track.state === \"closed\"){\n bar.visible = true;\n }\n else{\n bar.visible = false;\n }\n if(bar.visible){\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.tapCount/bar.track.maxTap);\n this.draw(bar);\n }\n }\n }", "function updateAll() {\n //var marioElem = document.getElementById(\"mario\");\n if (damage > 0) {\n player.health -= damage;\n var fireElem = document.getElementById(\"fire\").attributes\n //document.getElementById(\"mario\").classlist.add(\"vader\")\n }\n\n //totalDamage();\n damage = 0;\n update.innerText = player.health.toString();\n playerName.innerText = player.name;\n displayHits.innerText = player.hits.toString();\n\n if (player.health < 30) {\n document.getElementById(\"player-panel\").classList.add(\"panel-danger\");\n healthBarElem.classList.add('progress-bar-danger');\n } else if (player.health > 30 && player.health < 60) {\n document.getElementById(\"player-panel\").classList.remove(\"panel-danger\");\n document.getElementById(\"player-panel\").classList.add(\"panel-warning\");\n healthBarElem.classList.remove('progress-bar-danger');\n healthBarElem.classList.add('progress-bar-warning');\n } else {\n document.getElementById(\"player-panel\").classList.remove(\"panel-danger\");\n document.getElementById(\"player-panel\").classList.remove(\"panel-warning\");\n document.getElementById(\"player-panel\").classList.add(\"panel-default\");\n healthBarElem.classList.remove('progress-bar-danger');\n healthBarElem.classList.remove('progress-bar-warning');\n healthBarElem.classList.add('progress-bar-success');\n\n\n }\n if (player.health <= 0) {\n termElem.src = 'img/boom-sm.png';\n player.health = 0;\n updateHealthBar();\n // disabled buttons come back after timeout\n disableButtons();\n debugger\n winnerElem.innerText = player.name + \" Wins! The Terminator was destroyed in \" + player.hits + \" hits!\";\n winnerElem.style.color = \"green\";\n clearInterval(interval);\n }\n updateHealthBar();\n\n}", "function firstInitHealthBar() {\r\n hbWidth = userIntThis.sys.game.config.width*0.20;\r\n hbHeight = userIntThis.sys.game.config.height*0.05;\r\n hbIncrement = hbWidth/maxHealth;\r\n hbReady = true;\r\n oldHealth = maxHealth;\r\n healthBar = userIntThis.add.graphics();\r\n healthBar.setDepth(500);\r\n}", "function parseHealthBar() {\r\n if (hbReady) {\r\n hbReady = false;\r\n drawHealthBar();\r\n setTimeout(setHBReady(), 250);\r\n }\r\n}", "function updateDisp()\n\t\t\t{\n// Updates the numbers and graphics for the 4 main stats\n\t\t\t\tdocument.querySelector(\".healthValue\").innerHTML = health;\n\t\t\t\tdocument.querySelector(\".healthBar\").style.right = (100 - health * 10) + \"%\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".hungerValue\").innerHTML = hunger;\n\t\t\t\tdocument.querySelector(\".hungerBar\").style.right = (100 - hunger * 10) + \"%\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".thirstValue\").innerHTML = thirst;\n\t\t\t\tdocument.querySelector(\".thirstBar\").style.right = (100 - thirst * 10) + \"%\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".staminaValue\").innerHTML = stamina;\n\t\t\t\tdocument.querySelector(\".staminaBar\").style.right = (100 - stamina * 10) + \"%\";\n// Updates the values of the inventory items\n\t\t\t\tdocument.querySelector(\".stoneBank\").innerHTML = stoneBank;\n\t\t\t\tdocument.querySelector(\".leafBank\").innerHTML = leafBank;\n\t\t\t\tdocument.querySelector(\".branchBank\").innerHTML = branchBank;\n\t\t\t\tdocument.querySelector(\".wheatSeedBank\").innerHTML = wheatSeedBank;\n\t\t\t\tdocument.querySelector(\".waterBank\").innerHTML = waterBank;\n\t\t\t\tdocument.querySelector(\".berryBank\").innerHTML = berryBank;\n\t\t\t\tdocument.querySelector(\".fungusBank\").innerHTML = fungusBank;\n\t\t\t\tdocument.querySelector(\".sharpStoneBank\").innerHTML = sharpStoneBank;\n\t\t\t\tdocument.querySelector(\".leafTarpBank\").innerHTML = leafTarpBank;\n\t\t\t\tdocument.querySelector(\".smoothBranchBank\").innerHTML = smoothBranchBank;\n\t\t\t\tdocument.querySelector(\".ropeBank\").innerHTML = ropeBank;\n// Updates various buttons' disabled status and inner text\n\t\t\t\tif (stoneBank >= 2)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sharpenStoneButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sharpenStoneButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (leafBank >= 5 && ropeBank >= 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sewLeavesButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sewLeavesButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (sharpStoneBank >= 1 && branchBank >= 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".smoothBranchButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".smoothBranchButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (branchBank >= 5 && leafBank >= 5)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".makeRopeButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".makeRopeButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (pickaxeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (pickaxeTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").innerHTML = \"Tin Pickaxe<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (axeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (axeTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".axeButton\").innerHTML = \"Tin Axe<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (shovelTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (shovelTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".shovelButton\").innerHTML = \"Tin Shovel<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (hoeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (hoeTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".hoeButton\").innerHTML = \"Tin Hoe<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (sickleTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (sickleTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sickleButton\").innerHTML = \"Tin Sickle<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdocument.querySelector(\".collectWater\").innerHTML = \"Collect Water (\" + waterTurns + \")\";\n\t\t\t\tdocument.querySelector(\".collectWater\").disabled = !waterTurns;\n\t\t\t\tdocument.querySelector(\".drinkWater\").innerHTML = \"Drink Water (\" + waterBank + \")\";\n\t\t\t\tdocument.querySelector(\".drinkWater\").disabled = !waterBank;\n\t\t\t\tdocument.querySelector(\".collectBerries\").innerHTML = \"Collect Berries (\" + berryTurns + \")\";\n\t\t\t\tdocument.querySelector(\".collectBerries\").disabled = !berryTurns;\n\t\t\t\tdocument.querySelector(\".eatBerries\").innerHTML = \"Eat Berries (\" + berryBank + \")\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".eatFungus\").innerHTML = \"Eat Fungus (\" + fungusBank + \")\";\n\t\t\t\tdocument.querySelector(\".eatFungus\").disabled = !fungusBank;\n\t\t\t\t\n// Checks if the player has died\n\t\t\t\tif (health <= 0)\n\t\t\t\t{\n\t\t\t\t\tdead();\n\t\t\t\t}\n\t\t\t}", "function parseHealthBar() {\n if (hbReady) {\n hbReady = false;\n drawHealthBar();\n setTimeout(setHBReady(), 250);\n }\n}", "function increaseHealth() \n{\n if(healthBarScript.healthWidth < 199) \n\t {\n\t healthBarScript.healthWidth = healthBarScript.healthWidth + 1;\n\t }\n}", "function drawHealthBar() {\n maxHealthUpdate();\n healthBar.clear();\n \n hbX = userIntThis.cameras.main.scrollX + userIntThis.sys.game.config.width*0.73;\n hbY = userIntThis.cameras.main.scrollY + userIntThis.sys.game.config.height*0.0225;\n healthBar.lineStyle(1,0x000000,1);\n healthBar.fillStyle(0xff0000,1);\n healthBar.strokeRect(hbX,hbY,hbWidth,hbHeight);\n \n if (currentHealth > 0) {\n healthBar.fillRect(hbX,hbY,hbIncrement*oldHealth,hbHeight);\n }\n}", "function parseHealthBarAnimate() {\r\n hbReady = true;\r\n healthDif = oldHealth - currentHealth;\r\n if (healthDif != 0) {\r\n intervalVar = setInterval(oldHealthCtr, 50);\r\n }\r\n}", "function combatEnder() {\n var playerTile = mapArrays[testPlayer.y][testPlayer.x];\n playerTile.monsterHere = false;\n currentEnemy.statReset();\n $(\"#\" + currentEnemy.name + \"-image\").fadeOut(\"slow\");;\n currentEnemy = {};\n playerInCombat = false;\n $(\"#monster-description\").text(\"\");\n $(\"#monster-name\").text(\"\");\n $(\"#monster-sounds\").text(\"\");\n $(\"#monster-health-number\").hide();\n $(\"#monster-health\").hide();\n $(\"#room-hider\").delay(600).fadeIn(100);\n $(\"#room-description\").delay(600).fadeIn(\"slow\")\n $(\"#searcher-images\").delay(600).fadeIn(\"slow\");\n surroundingChecker(testPlayer);\n}", "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 drawHealthBar() {\r\n healthBar.clear();\r\n hbX = userIntThis.cameras.main.scrollX + userIntThis.sys.game.config.width*0.775;\r\n hbY = userIntThis.cameras.main.scrollY + userIntThis.sys.game.config.height*0.0225;\r\n healthBar.lineStyle(1,0x000000,1);\r\n healthBar.fillStyle(0xff0000,1);\r\n healthBar.strokeRect(hbX,hbY,hbWidth,hbHeight);\r\n \r\n if (currentHealth > 0) {\r\n healthBar.fillRect(hbX,hbY,hbIncrement*oldHealth,hbHeight);\r\n }\r\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 yourEnemies() {\n \n if (yourFighter=='luke') {\n\n $('#yourEnemy').append('<div id =\"enemy2\"></div>');\n $('#enemy2').append('<div>Obi-Wan Kenobi</div>');\n $('#enemy2').append('<img id = \"obi-wan2\" src=\"assets/images/obi-wan-kenobi.png\" width=150px height=150px><br>');\n $('#enemy2').append(obiPower);\n\n $('#yourEnemy').append('<div id =\"enemy3\"></div>');\n $('#enemy3').append('<div>Darth Vader</div>');\n $('#enemy3').append('<img id = \"darth2\" src=\"assets/images/darth-vader.png\" width=150px height=150px><br>');\n $('#enemy3').append(darthPower);\n\n\n $('#yourEnemy').append('<div id =\"enemy4\"></div>');\n $('#enemy4').append('<div>Kylo Ren</div>');\n $('#enemy4').append('<img id = \"kylo2\" src=\"assets/images/kylo-ren.png\" width=150px height=150px><br>');\n $('#enemy4').append(kyloPower); \n\n\n } /* end if luke */\n\n\n if (yourFighter=='obi-wan') {\n\n $('#yourEnemy').append('<div id =\"enemy1\"></div>');\n $('#enemy1').append('<div>Luke Skywalker</div>');\n $('#enemy1').append('<img id = \"luke2\" src=\"assets/images/luke-skywalker.png\" width=150px height=150px><br>');\n $('#enemy1').append(lukePower);\n\n \n $('#yourEnemy').append('<div id =\"enemy3\"></div>');\n $('#enemy3').append('<div>Darth Vader</div>');\n $('#enemy3').append('<img id = \"darth2\" src=\"assets/images/darth-vader.png\" width=150px height=150px><br>');\n $('#enemy3').append(darthPower);\n\n $('#yourEnemy').append('<div id =\"enemy4\"></div>');\n $('#enemy4').append('<div>Kylo Ren</div>');\n $('#enemy4').append('<img id = \"kylo2\" src=\"assets/images/kylo-ren.png\" width=150px height=150px><br>');\n $('#enemy4').append(kyloPower);\n\n\n } /* end if obi-wan */\n\n if (yourFighter=='darth') {\n\n $('#yourEnemy').append('<div id =\"enemy1\"></div>');\n $('#enemy1').append('<div>Luke Skywalker</div>');\n $('#enemy1').append('<img id = \"luke2\" src=\"assets/images/luke-skywalker.png\" width=150px height=150px><br>');\n $('#enemy1').append(lukePower);\n\n $('#yourEnemy').append('<div id =\"enemy2\"></div>');\n $('#enemy2').append('<div>Obi-Wan Kenobi</div>');\n $('#enemy2').append('<img id = \"obi-wan2\" src=\"assets/images/obi-wan-kenobi.png\" width=150px height=150px><br>');\n $('#enemy2').append(obiPower);\n\n $('#yourEnemy').append('<div id =\"enemy4\"></div>');\n $('#enemy4').append('<div>Kylo Ren</div>');\n $('#enemy4').append('<img id = \"kylo2\" src=\"assets/images/kylo-ren.png\" width=150px height=150px><br>');\n $('#enemy4').append(kyloPower);\n\n } /* end if darth */\n\n if (yourFighter=='kylo') {\n\n $('#yourEnemy').append('<div id =\"enemy1\"></div>');\n $('#enemy1').append('<div>Luke Skywalker</div>');\n $('#enemy1').append('<img id = \"luke2\" src=\"assets/images/luke-skywalker.png\" width=150px height=150px><br>');\n $('#enemy1').append(lukePower);\n\n $('#yourEnemy').append('<div id =\"enemy2\"></div>');\n $('#enemy2').append('<div>Obi-Wan Kenobi</div>');\n $('#enemy2').append('<img id = \"obi-wan2\" src=\"assets/images/obi-wan-kenobi.png\" width=150px height=150px><br>');\n $('#enemy2').append(obiPower);\n\n $('#yourEnemy').append('<div id =\"enemy3\"></div>');\n $('#enemy3').append('<div>Darth Vader</div>');\n $('#enemy3').append('<img id = \"darth2\" src=\"assets/images/darth-vader.png\" width=150px height=150px><br>');\n $('#enemy3').append(darthPower);\n \n\n } /* end if kylo */\n\n $(\"#luke2\").on(\"click\", function(){\n if (!yourEnemy) {\n yourEnemy='luke';\n $('#enemy1').replaceWith('');\n enemyPower=8;\n $('#defender').after('<div id =\"enemyFighter\"></div>');\n $('#enemyFighter').append('<div>Luke Skywalker</div>');\n $('#enemyFighter').append('<img src=\"assets/images/luke-skywalker.png\" width=150px height=150px><br>');\n $('#enemyFighter').append('<div id=\"lukePower\"></div>');\n $('#lukePower').html(lukePower);\n attack();\n } /* end if (yourEnemy ==\"\") */\n \n }) /* end luke2 (enemy) click */\n\n $(\"#obi-wan2\").on(\"click\", function(){\n if (!yourEnemy) {\n yourEnemy='obi-wan';\n $('#enemy2').replaceWith('');\n enemyPower=12;\n $('#defender').after('<div id =\"enemyFighter\"></div>');\n $('#enemyFighter').append('<div>Obi-Wan Kenobi</div>');\n $('#enemyFighter').append('<img src=\"assets/images/obi-wan-kenobi.png\" width=150px height=150px><br>');\n $('#enemyFighter').append('<div id=\"obiPower\"></div>');\n $('#obiPower').html(obiPower);\n attack();\n } /* end if (yourEnemy ==\"\") */\n }) /* end obi-wan2 (enemy) click */\n\n $(\"#darth2\").on(\"click\", function(){\n if (!yourEnemy) {\n yourEnemy='darth';\n $('#enemy3').replaceWith('');\n enemyPower=25;\n $('#defender').after('<div id =\"enemyFighter\"></div>');\n $('#enemyFighter').append('<div>Darth Vader</div>');\n $('#enemyFighter').append('<img src=\"assets/images/darth-vader.png\" width=150px height=150px><br>');\n $('#enemyFighter').append('<div id=\"darthPower\"></div>');\n $('#darthPower').html(darthPower);\n attack();\n } /* end if (yourEnemy ==\"\") */\n \n }) /* end darth2 (enemy) click */\n\n $(\"#kylo2\").on(\"click\", function(){\n if (!yourEnemy) {\n yourEnemy='kylo';\n $('#enemy4').replaceWith('');\n enemyPower=20;\n $('#defender').after('<div id =\"enemyFighter\"></div>');\n $('#enemyFighter').append('<div>Kylo Ren</div>');\n $('#enemyFighter').append('<img src=\"assets/images/kylo-ren.png\" width=150px height=150px><br>');\n $('#enemyFighter').append('<div id=\"kyloPower\"></div>');\n $('#kyloPower').html(kyloPower);\n attack();\n } /* end if (yourEnemy ==\"\") */\n }) /* end obi-wan2 (enemy) click */\n\n\n\n\n}", "function loadEnemies() {\n //create enemies\n enemyShipList = GameLogic.buildEnemyListByLevel(currentLevel, browserWidth, browserHeight);\n //create bosses\n bossList = GameLogic.getBossListByLevel(currentLevel, browserWidth, browserHeight);\n //alert user if difficulty has increased\n GameLogic.notifyDifficulty(currentLevel);\n}", "function afterLevel(x) {\n if (x) {\n levelReached.firstChild.data = \"Level \"+level+\", \"+((Settings.night)?\"night \":\"day \")+Math.ceil(level/2);\n if (level==1) svgDocument.getElementById(\"controls\").setAttributeNS(null, \"visibility\", \"visible\")\n levelReached.setAttributeNS(null, \"visibility\", \"visible\")\n playSound('gotBonus');\n window.setTimeout(\"afterLevel(0)\", 2000);\n } else { // a bit a lot of reseting there, but there were sometimes occuring really strange errors on several timers\n levelReached.setAttributeNS(null, \"visibility\", \"hidden\");\n if (level==1) svgDocument.getElementById(\"controls\").setAttributeNS(null, \"visibility\", \"hidden\")\n for (var i = enemies.length-1; i >= 0; i--) {\n enemies[i].resetTimers();\n enemies[i].alive = 0;\n }\n while (activeElements.hasChildNodes()) activeElements.removeChild(activeElements.firstChild);\n while (enemyShots.hasChildNodes()) enemyShots.removeChild(enemyShots.firstChild);\n while (eThumbs.hasChildNodes()) eThumbs.removeChild(eThumbs.firstChild);\n enemies = new Array();\n destroyedCount = 0;\n window.setTimeout(\"generateEnemy()\", 1000);\n }\n}", "function updateHealthbar() {\n let redPos = redBar.components.position;\n redPos.width = (health - currHealth) / health * redPos.height * 4;\n\n let greenPos = greenBar.components.position;\n greenPos.width = greenPos.height * 4 - redPos.width;\n }", "function parseHealthBarAnimate() {\n hbReady = true;\n healthDif = oldHealth - currentHealth;\n if (healthDif != 0) {\n intervalVar = setInterval(oldHealthCtr, 50);\n }\n}", "function updateEnemyStats() {\n\t\t$(\"#enemyHealth\").html(\"HP: \" + enemyPicked.health + \"<br />Attack: \" + enemyPicked.attack);\n\t\t$(\"#enemyName\").html(enemyPicked.display);\n\t}", "function maxHealthUpdate() {\r\n hbIncrement = hbWidth/maxHealth; \r\n}", "function subtractHealth() {\n fighterObj.health = fighterObj.health - enemyObj.counterAttack;\n enemyObj.health = enemyObj.health - fighterObj.attackNew;\n fighterObj.attackNew = fighterObj.attackNew + fighterObj.attack;\n\n\n\n\n\n if (fighterObj.health <= 0) {\n $(\".info-pop-up-text\").text(enemyObj.name + \" killed you!\");\n $(\"#resetLoose\").css(\"display\", \"block\");\n $(\".info-pop-up\").css(\"display\", \"flex\");\n\n\n }\n\n if (enemyObj.health <= 0) {\n $(\".enemy-display\").empty();\n $(\".info-pop-up-text\").text(enemyObj.name + \" is dead! Pick your next enemy!\");\n $(\".info-pop-up\").css(\"display\", \"flex\");\n $(\".resetWin\").css(\"display\", \"none\");\n setTimeout(function () {\n $(\".info-pop-up\").css(\"display\", \"none\");\n\n }, 2500);\n\n $(\".enemyDisplay\").empty();\n enemyChosen = false;\n defeatedFighters.push(enemyObj);\n }\n\n if (defeatedFighters.length == 3) {\n $(\".info-pop-up-text\").css(\"color\", \"red\");\n $(\".ultimate-win\").css(\"display\", \"flex\");\n $(\".info-pop-up\").css(\"display\", \"none\");\n $(\".ultimate-win-text\").text(\" You are the supreme winner\");\n $(\".resetWin\").css(\"display\", \"flex\");\n\n }\n }", "function update() {\r\n const name = $(\r\n \"#wrapper > div.contents > div.cnt-raid > div.cnt-raid-stage > div.prt-targeting-area > div.prt-stage-area > a.btn-targeting.enemy-1.invisible > div.enemy-info > div.name\"\r\n );\r\n const percent = $(\"#enemy-hp0\");\r\n if (name.text() != \"\" && $(\"#list-content\").children().length == 0) {\r\n console.log($(\"#title\"));\r\n $(\"#title\").append(\"Ultimate Bahamut\");\r\n }\r\n if (\r\n parseInt(percent.text()) <= triggers[curr_trigger].percent + 5 &&\r\n !done &&\r\n percent.text() != \"0\"\r\n ) {\r\n const warning_text = $(\r\n \"#wrapper > div.contents > div.cnt-raid > div.cnt-raid-stage > div.prt-targeting-area\"\r\n );\r\n if (curr_trigger < triggers.length - 1) {\r\n console.log(curr_trigger);\r\n if (parseInt(percent.text()) >= triggers[curr_trigger + 1].percent) {\r\n console.log(\"ABOUT TO WARN\");\r\n // if its not the last one check if in between triggers\r\n $(\r\n '<p class=\"lead\" style = \"font-family:\"Roboto\";color:red;margin-left:150px\" id = \"warning-text\">INCOMING TRIGGER</p>'\r\n )\r\n .appendTo(warning_text)\r\n .fadeOut(8000);\r\n }\r\n curr_trigger++;\r\n } else {\r\n $(\r\n '<p class=\"lead\" style = \"font-family:\"Roboto;color:red;margin-left:150px\" id = \"warning-text\">INCOMING TRIGGER</p>'\r\n )\r\n .appendTo(warning_text)\r\n .fadeOut(8000);\r\n done = true;\r\n }\r\n }\r\n }", "_drawHealthBar() {\n const { x, y, width, height } = this.config;\n this._bar = this.scene.add.rectangle( x, y, width, height,\n this.config.barColor );\n this._bar.setOrigin( 0, 0 );\n }", "function maxHealthUpdate() {\n hbIncrement = hbWidth/maxHealth; \n}", "function animateBars() {\n\n\tuserRegisteredAmount();\n\tAmountofAdv();\n\t\n\tuserProgressBar();\n\tretailerProgressBar();\n\tadsProgressBar();\n\t\n}", "function maxHealthBoost(tempHealth) {\n maxHealth += tempHealth; \n currentHealth = maxHealth;\n maxHealthUpdate();\n parseHealthBarAnimate();\n}", "update() {\r\n for (let enemy of allEnemies) {\r\n\r\n if (this.y === enemy.y && (enemy.x + enemy.step / 4 > this.x &&\r\n enemy.x < this.x + this.step / 4)) {\r\n this.reset();\r\n }\r\n\r\n if (this.y === 120) {\r\n console.log(\"Hi\");\r\n this.reset();\r\n\r\n };\r\n //Matthew Crawford's arcade game walkthrough was used to get a basic start on collision and enemy rendering\r\n\r\n //Shows when the player wins after level 3 has been reached\r\n\r\n if (this.y === 17) {\r\n this.reset();\r\n level++;\r\n if (level > 3) {\r\n $('h3').css(\"display\", \"block\").append('You have Won!');\r\n setTimeout(Result, 999);\r\n level = 1;\r\n }\r\n document.getElementById(\"myspan\").innerHTML = level;\r\n }\r\n }\r\n\r\n }", "function healthCheck() {\n for (var i = 0; i < partyMemberArray.length; i++) {\n if (partyMemberArray[i].hp < 1) {\n partyMemberArray[i].KO = true;\n partyMemberArray[i].hp = 0;\n if (fighter.KO) {\n $(\"#playerCharacter1\").animate({\n opacity: '0.5',\n });\n }\n if (whiteMage.KO) {\n $(\"#playerCharacter2\").animate({\n opacity: '0.5',\n });\n }\n if (blackMage.KO) {\n $(\"#playerCharacter3\").animate({\n opacity: '0.5',\n });\n }\n }\n }\n}", "function fightEnemy() {\r\n\tcurrHpPerc = Math.floor((currentHp / playerDetails.hp) * 100);\r\n\tget(\"player-hp\").style.width = currHpPerc + \"%\";\r\n\tlogArray = [ ]; //wipe log array\r\n\tstartCombat();\r\n}", "function reduceHealth() \n{\n if(healthBarScript.healthWidth > -8) \n {\n healthBarScript.healthWidth = healthBarScript.healthWidth - 1;\n } \n}", "function updateEnemies(){\n\n //animate enemies :\n for(var i=0; i<enemies.length;i++){\n enemies[i].update();\n enemies[i].draw();\n //player ran into enemy\n if(player.minDist(enemies[i]) <= player.width - platformWidth/2){\n console.log(\"Killed by enemies\");\n gameOver();\n }\n }\n\n //remove enemies gone off screen :\n if (enemies[0] && enemies[0].x < -platformWidth) {\n \n enemies.splice(0 ,1);\n }\n }", "completeLevel() {\n player.reset();\n if (score % 2 == 0 && allEnemies.length < 4) {\n allEnemies.push(new Enemy(0, Math.random() * 160 + 50, Math.random() * 90 + 70));\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}", "function setEnemyHealth(kills) {\n var base = 100;\n var mod = rollTwoDie(kills, 10) * 3;\n return base + mod;\n }", "function fighting() {\n enemies.forEach((enemy, index_enemy) => {\n allies.forEach((ally, index_ally) => {\n if (enemies[index_enemy].combat && allies[index_ally].combat == true) {\n enemies[index_enemy].hp = enemies[index_enemy].hp - allies[index_ally].damage / 60;\n allies[index_ally].hp = allies[index_ally].hp - enemies[index_enemy].damage / 60;\n hit_sound.volume = 0.5;\n hit_sound.play();\n //console.log(\"Enemy HP: \" + enemies[index_enemy].hp);\n //console.log(\"Ally HP: \" + allies[index_ally].hp);\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").src = \"zombie_action2.png\";\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").src = \"adventurer_action2.png\";\n }\n if (enemies[index_enemy].hp < 0) {\n enemies.splice(index_enemy, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n points = points + 30;\n updatePoints();\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").remove();\n }\n if (allies[index_ally].hp < 0) {\n allies.splice(index_ally, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").remove();\n }\n\n });\n });\n // Laat ze doorlopen als combat voorbij is\n allies.forEach((ally, index_ally) => {\n allies[index_ally].combat = false;\n });\n enemies.forEach((enemy, index_enemy) => {\n enemies[index_enemy].combat = false;\n });\n\n}", "function updateSinglePlayerHealthBar(currTurn){\n\n var HEALTH_BAR_X = GAME_WIDTH + 10;\n var HEALTH_BAR_Y = 100;\n var HEALTH_BAR_HEIGHT = 20;\n //Calculate the width of the bar as a percentage of the player's current health\n var healthBarWidth = calcHealthBarWidth(currTurn, statScreen.SinglePlayer.PlayerIndex);\n //redraw the health bar\n singleGraphics.beginFill(HEALTH_BAR_COLOR);\n statScreen.SinglePlayer.HealthBar.Bar = singleGraphics.drawRect(\n HEALTH_BAR_X, \n HEALTH_BAR_Y, \n healthBarWidth, \n HEALTH_BAR_HEIGHT);\n singleGraphics.endFill();\n}", "function heroDefeated() {\r\n\t\t$(\".title\").replaceWith(\r\n `<div class= \"BOO\"> MIGHTY ZERO. YOU DIED TOO!!! </div>`\r\n\t\t);\r\n\r\n\r\n\t\t$(\"#fightMode\").hide();\r\n\t\t$(\".defender\").hide();\r\n\t\t$(\"#challengers\").hide();\r\n\t\t$(\"#defeated\").hide();\r\n\t\t$(\"#defTitle\").hide();\r\n\t\t$(\"#attack\").hide();\r\n\r\n\t\t//updates hero stats\r\n\t\t$(\".hero .healthpoints\").html(\"KO\");\r\n\t}", "function monsterbar() {\n var elem = document.getElementById(\"monsterbar\"); \n\tif (monsterhealth > 0) {\t\t\t\n\t\tvar mwidth = monsterhealth/monsterhp * 100;\n\t} else {\n\t\tvar mwidth = 0;\n\t}\n\telem.style.width = mwidth + '%';\n}", "readyGame(party, enemies) {\r\n $('body').empty();\r\n $('body').append($('<audio/>').attr(\"src\", \"media/battle.mp3\").attr(\"loop\", \"true\").attr(\"autoplay\", \"true\").attr(\"type\", \"audio/mpeg\").css(\"visibility\", \"hidden\"));\r\n this.gameDIV.append(this.partyDIV);\r\n this.gameDIV.append(this.enemyDIV);\r\n $('body').append(this.gameDIV);\r\n let p = 0;\r\n party.forEach(member => {\r\n let thisMember = $('<li/>').addClass('memberLI');;\r\n thisMember.append($(\"<img/>\").addClass('party').attr(\"id\", 'p' + p).attr(\"src\", \"media/\" + braveVesperia.find(c => c.id == member.id).img));\r\n let thisMemberData = $('<ul/>').addClass('control').attr('id', 'd' + p);\r\n thisMember.append(thisMemberData);\r\n let memberName = $('<div/>').addClass('memberName');\r\n memberName.append($('<h2/>').text(member.name));\r\n memberName.append($('<img/>').addClass('memberElement').attr('src', 'media/portraits/' + member.element + '.png'));\r\n thisMemberData.append(memberName);\r\n thisMemberData.append($('<h3/>').text(member.health + '/' + braveVesperia[member.id].health));\r\n thisMemberData.append($('<progress/>').attr('value', member.health).attr('max', braveVesperia[member.id].health));\r\n thisMemberData.append($('<button/>').addClass('attack').text('ATTACK'));\r\n if (member.arte1.type === 0) {\r\n thisMemberData.append($('<button/>').addClass('arte1').attr('data-tooltip', 'Hits: ' + member.arte1.hits + ', enemies: ' + (member.arte1.isMultiTarget?'all':'1')).text(member.arte1.name));\r\n } else {\r\n thisMemberData.append($('<button/>').addClass('healingArte').attr('data-tooltip', 'Heals a base 5000 health').text(member.arte1.name));\r\n }\r\n thisMemberData.append($('<button/>').addClass('arte2').attr('data-tooltip', 'Hits: ' + member.arte2.hits + ', enemies: ' + (member.arte2.isMultiTarget?'all':'1')).text(member.arte2.name));\r\n this.partyDIV.append(thisMember);\r\n p++;\r\n });\r\n let turnNumber = $('<h2/>').attr('id', 'turn').text('Turn: ' + this.model.gameState.turnCount);\r\n let wave = $('<h2/>').attr('id', 'wave').text('WAVE: ' + this.model.gameState.wave);\r\n let arenaTop = $('<data/>');\r\n arenaTop.append(wave);\r\n arenaTop.append(turnNumber);\r\n this.arenaDIV.append(arenaTop);\r\n let howToPlayLink = $('<a/>').attr('href', 'media/How_To_Play.pdf').attr('target', '_blank').text('How To Play');\r\n let elementalAdvantageImage = $('<img/>').attr('src', 'media/portraits/elementaladvantage.png')\r\n let hitCount = $('<h3/>').attr('id', 'hitCount').text('Hit Count: ' + this.model.turnState.hitCount);\r\n let turnDamage = $('<h3/>').attr('id', 'hitCount').text('Total Damage: ' + Math.floor(this.model.gameState.totalDamage));\r\n let arenaBottom = $('<data/>');\r\n arenaBottom.append(howToPlayLink);\r\n arenaBottom.append(elementalAdvantageImage);\r\n arenaBottom.append(hitCount);\r\n arenaBottom.append(turnDamage);\r\n this.arenaDIV.append(arenaBottom);\r\n this.gameDIV.append(this.arenaDIV);\r\n let e = 0;\r\n enemies.forEach(enemy => {\r\n let thisEnemy = $('<li/>').addClass('enemyLI');\r\n let thisEnemyData = $('<data/>').addClass('control').attr('id', 'd' + e);\r\n thisEnemy.append(thisEnemyData);\r\n thisEnemyData.append($('<h3/>').text(enemy.name));\r\n thisEnemyData.append($('<h4/>').text(enemy.health + '/' + baddies[enemy.id - 100].health));\r\n thisEnemyData.append($('<progress/>').attr('value', enemy.health).attr('max', baddies[enemy.id - 100].health));\r\n thisEnemy.append($(\"<img/>\").addClass('enemy').attr(\"id\", 'e' + e).attr(\"src\", baddies.find(e => e.id == enemy.id).img));\r\n this.enemyDIV.append(thisEnemy);\r\n e++;\r\n });\r\n }", "handlePlayerEnemyCollision() {\n // Take damage if outside the post-hit invincibility stage\n if (this.playerDamageDelay === 0 && this.playerHealth > 0) {\n //console.log('Damage taken')\n this.playerHitSound.play();\n this.playerHealth = this.playerHealth - 1;\n this.playerDamageDelay = 30;\n }\n // check if the player is dead\n if (this.playerHealth === 0) {\n console.log('Player DIED')\n this.playerDyingSound.play();\n // Spawn at location\n this.level.player.x = this.playerSpawnLocation.x;\n this.level.player.y = this.playerSpawnLocation.y;\n // Add to death counter\n this.playerHealth = 5;\n this.playerDeathCount = this.playerDeathCount + 1;\n console.log('Death Count', this.playerDeathCount);\n // if player dies 3 times, reset level\n if(this.playerDeathCount === 3){\n this.stopMusic();\n this.level.state.start('Level1');\n }\n }\n this.healthBar_hud.play(this.playerHealth + '', 1, false);\n this.livesRemain_hud.play(3 - this.playerDeathCount + '');\n }", "function nextEnemy(){\n\tpopUpEnemy1Dead.style.display = \"none\";\n\tslideKillLog.style.display = \"none\";\n\tenemy1CharCard.style.display = 'none'\n\tslideNextEnemy.style.display = \"block\";\n\n\tvar winGold = (Math.round(currentEnemyCard/10)) + Math.floor((Math.random() * goldRewardDice) + 1);\n\tfoundGold.innerHTML = winGold;\n\tplayer1.gold += winGold;\n\n\trefresh();\n\n\tenemyArray[currentEnemyCard].currentHealth = enemyArray[currentEnemyCard].health;\n\tenemy1HealthCounter.innerHTML = enemyArray[currentEnemyCard].currentHealth;\n\tlogSlideRollResult.innerHTML = '...';\n\tlogSlideResultLine2.innerHTML = 'You look around..';\n\tlogSlideResultLine3.innerHTML = \"and see an angry peasant\";\n\ttableDeathScore.innerHTML = deathCount;\n\ttableKillScore.innerHTML = killCount;\n}", "function healthBarReset() {\r\n oldHealth = maxHealth;\r\n healthDif = 0;\r\n if (intervalVar !== undefined) {\r\n clearInterval(intervalVar);\r\n }\r\n}", "function setAttack() {\n $(\"#fight-outcome\").empty();\n\n arenaObj.enemy.health -= arenaObj.ally.attack;\n arenaObj.enemy.stats();\n\n killCharacter();\n\n $(\"#fight-outcome\").empty();\n\n arenaObj.ally.health -= arenaObj.enemy.counter;\n arenaObj.ally.stats();\n\n killCharacter();\n\n console.log(\"Your enemy HP is \" + arenaObj.enemy.health \n + \" and your HP is \" + arenaObj.ally.health);\n}", "function updateEnemySummary() {\n enemyMortgageSummary = []\n enemyPropertiesinPlaySummary = []\n enemyPropertiesinPlayColors = []\n enemyBasicRentSummary = []\n enemyU1Summary = []\n enemyU2Summary = []\n enemyU3Summary = []\n enemyU4Summary = []\n function getMortgages(obj){\n if(obj.inPlay == \"no\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var mortgageStatus = propertyCards.filter(getMortgages);\n $.each(mortgageStatus, function (){enemyMortgageSummary.push(this.name)})\n\n function getinPlay(obj){\n if(obj.inPlay == \"yes\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var inPlayStatus = propertyCards.filter(getinPlay);\n inPlayStatus.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(inPlayStatus, function (){enemyPropertiesinPlaySummary.push(this.name)})\n $.each(inPlayStatus, function (){enemyPropertiesinPlayColors.push(this.color)})\n\n\n function getBasicRent(obj){\n if(obj.rentStatus == \"basic\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var basicRentStatus = propertyCards.filter(getBasicRent);\n $.each(basicRentStatus, function (){enemyBasicRentSummary.push(this.name)})\n\n function getU1(obj){\n if(obj.rentStatus == \"upgrade1\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u1Status = propertyCards.filter(getU1);\n u1Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u1Status, function (){enemyU1Summary.push(this.name)})\n\n function getU2(obj){\n if(obj.rentStatus == \"upgrade2\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u2Status = propertyCards.filter(getU2);\n u2Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u2Status, function (){enemyU2Summary.push(this.name)})\n\n function getU3(obj){\n if(obj.rentStatus == \"upgrade3\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u3Status = propertyCards.filter(getU3);\n u3Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u3Status, function (){enemyU3Summary.push(this.name)})\n\n function getU4(obj){\n if(obj.rentStatus == \"upgrade4\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u4Status = propertyCards.filter(getU4);\n u1Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u4Status, function (){enemyU4Summary.push(this.name)})\n}", "function timePlay() {\r\n hg = hg;\r\n st += 2;\r\n status();\r\n Time = setTimeout(function(){timePlay()}, 5000);\r\n console.log(\"Time \" + Time + \" Hunger \" + hg + \" Health Point \" + hp);\r\n \r\n document.getElementById(\"healthbar\").innerHTML = hp;\r\n $(\"#healthbar\").css(\"width\", hp);\r\n document.getElementById(\"hungerbar\").innerHTML = hg;\r\n $(\"#hungerbar\").css(\"width\", hg);\r\n document.getElementById(\"staminabar\").innerHTML = st;\r\n $(\"#staminabar\").css(\"width\", st);\r\n\r\n\r\n hg = hg - 5;\r\n if(hg <= 0)\r\n {\r\n hg = 0;\r\n hp -= 5;\r\n }\r\n\r\n if (hp <= 20)\r\n {\r\n $(\"#healthbar\").switchClass(\"bg-success\",\"bg-danger\", hp ,\"easeInOutQuad\");\r\n }\r\n if (hp == 0){\r\n\r\n gameOver();\r\n }\r\n}", "function attack(currentEnemy, currentHero) {\n if (currentEnemy.health > 0) {\n currentEnemy.health -= currentHero.strength;\n console.log(\"health: \" + currentEnemy.health);\n currentHero.strength += currentHero.counterStrike;\n console.log(\"strength: \" + currentHero.strength);\n counterAttack(currentEnemy, currentHero);\n showHealth();\n if (currentEnemy.health <= 0) {\n $(\"#defender\").empty();\n isEnemy = false;\n count++;\n console.log(count);\n if (count === 3) {\n $(\"#messages\").html(\"<h2>You Win!! Grab a Wookie, and Celebrate!</h2>\");\n $(\"#reset\").html(\"<button>Reset</button\").children().attr(\"id\",\"reset-button\");\n $(\"#reset-button\").on(\"click\", function(){\n location.reload();\n reset();\n console.log(\"reset button clicked\");\n }); \n\n }\n } \n } \n}", "function drawHealthBar(){\n push();\n rectMode(CORNER);\n //background rectangle of health bar\n fill(64,43,112);\n rect(0,height-50,width/1 + 10,30);\n //The health bar\n fill(153, 153, 255);\n healthBar = map(harryHealth,0,harryMaxHealth, 0, width);\n rect(0, height-50,healthBar,30);\n //Text showing the Energy level\n textFont (\"Helvetica\")\n fill(64,43,112);\n textSize(15);\n textAlign(CENTER,CENTER);\n var energyText = \"ENERGY LEFT\";\n text(energyText,width/2,height-35);\n pop();\n}", "function enemyLogic() {\r\n\tif (currentEnemy.health <= 0) {\r\n\t\tdocument.getElementById('enemyHealth').innerHTML = \"Riperinos\";\r\n\t\tmoney += currentEnemy.goldDrop;\r\n\t\tenemyNumber++;\r\n\t\tenemyType++;\r\n\t\tif (enemyType >= monsterTypes.length)\r\n\t\t{\r\n\t\t\tenemyType -= monsterTypes.length;\r\n\t\t}\r\n\t\tcurrentEnemy = new createMonster(enemyNumber % 8 == 0, enemyType).monster;\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}", "function respawnAliveEnemies(enemyArr)\r\n{\r\n HP--;\r\n if(HP <= 0){youLose();}\r\n else{\r\n HPBox.textContent = \"HP = \" + HP;\r\n for(i = 0; i < enemies.length; i++)\r\n {\r\n if(i<10)\r\n {\r\n enemyArr[i].y = 20;\r\n }\r\n else if(i>=10 && i <20)\r\n {\r\n enemyArr[i].y = 70;\r\n }\r\n else if(i>=20 && i < 30)\r\n {\r\n enemyArr[i].y = 120;\r\n }\r\n var iMod = i % 10;\r\n enemyArr[i].x = 42 + (54*iMod);\r\n enemyArr[i].direction = -1;\r\n enemyArr[i].speedy = (enemyArr[i].speedy+0.1);\r\n }\r\n }\r\n}", "checkCollisionEndboss() {\n if (this.isCollidingEndboss()) {\n this.character.hitByEndboss();\n this.statusBar.setPercentage(this.character.energy);\n }\n }", "function loadBars() {\n\n\t\tif($('#section3').attr('finished') == 1) return true;\n\t\t\t$(\".progress-wrapp\").each(function(index){\n\t\t\t\t$(\".progress-wrapp\").eq(index).find(\".progress > span\").each(function(index2){\n\t\t\t\t\t$(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2).data(\"origWidth\", $(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2).width()).width(0);\n\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t$(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2)\n\t\t\t\t\t\t\t\t.animate({\n\t\t\t\t\t\t\t\t\twidth: $(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2).data(\"origWidth\")\n\t\t\t\t\t\t\t\t},\t1000);\n\t\t\t\t\t\t},index*600);\n\t\t\t\t});\t\t\t\n\t\t\t});\n\t\t$('#section3').attr('finished', 1);\n\t}", "energyDown(){\n this.energy = this.energy - 0.05;//decrease player's energy\n if(player.energy > 0)//if player has energy then show bar\n {\n EnergyBar.x = (EnergyBar.x-0.05);//decrease energy bar\n EnergyBar.setScale((player.energy/player.maxEnergy),1);//scale energy Bar\n energy = player.getEnergy();\n }\n else if(player.energy == 0)//else destroy bar\n {\n EnergyBar.destroy();\n energy = player.getEnergy();\n }\n }", "function playerHeal(tempHealth){\n currentHealth += tempHealth;\n if (currentHealth > maxHealth){\n currentHealth = maxHealth;\n }\n parseHealthBarAnimate();\n}", "function battleEnemy() {\n\n $(\"#attackBtn\").on('click',function(){\n\n\n // text to show how much damage was taken, and manipulate hp\n\n \n\n currentEnemy.hp -= currentChar.attack;\n $(\"#battle-text\").text(\"You dealt \" + currentEnemy.name + \" \" + currentChar.attack + \" damage\");\n \n if(currentEnemy.hp > 0){\n currentChar.hp -= currentEnemy.counter;\n $(\"#counter-text\").text(\"You took \" + currentEnemy.counter + \" damage\");\n currentChar.attack += initialAtk;\n }\n\n else{\n\n $(\"#counter-text\").text(\"You beat \" +currentEnemy.name);\n }\n\n // to change hp under current char \n\n if (isCurrentCharMario === true){\n $(\"#mario-hp\").text(currentChar.hp);\n if (currentChar.hp === 0) {\n $(\"#battle-text\").text(\"YOU LOSE\");\n }\n }\n\n else if (isCurrentCharLuigi === true){\n $(\"#luigi-hp\").text(currentChar.hp);\n if (currentChar.hp === 0) {\n $(\"#battle-text\").text(\"YOU LOSE\");\n }\n }\n\n else if (isCurrentCharWario === true){\n $(\"#wario-hp\").text(currentChar.hp);\n if (currentChar.hp === 0) {\n $(\"#battle-text\").text(\"YOU LOSE\");\n }\n }\n\n else if (isCurrentCharBowser === true){\n $(\"#bowser-hp\").text(currentChar.hp);\n if (currentChar.hp === 0) {\n $(\"#battle-text\").text(\"YOU LOSE\");\n }\n }\n \n // display current hp of enemy and show when enemy hp is 0\n \n if (isCurrentEnemyMario === true){\n if (currentEnemy.hp <= 0){\n $(\"#mario-hp\").text(\"0\");\n }\n else {\n $(\"#mario-hp\").text(currentEnemy.hp);\n }\n }\n\n else if (isCurrentEnemyLuigi === true){\n if (currentEnemy.hp <= 0){\n $(\"#luigi-hp\").text(\"0\");\n }\n else {\n $(\"#luigi-hp\").text(currentEnemy.hp);\n }\n }\n\n else if (isCurrentEnemyWario === true){\n if (currentEnemy.hp <= 0){\n $(\"#wario-hp\").text(\"0\");\n }\n else {\n $(\"#wario-hp\").text(currentEnemy.hp);\n }\n }\n\n else if (isCurrentEnemyBowser === true){\n if (currentEnemy.hp <= 0){\n $(\"#bowser-hp\").text(\"0\");\n }\n else {\n $(\"#bowser-hp\").text(currentEnemy.hp);\n }\n }\n \n \n });\n \n}", "function barHeight() {\n$( \"#bar\" ).each(function() {\n $( \"#bar\" ).height($(\"#c1\").height() + 50);\n });\n window.setTimeout(barHeight, 100);\n}", "loseHealth() {\n this.health--;\n this.tint = 0xff0000;\n //check if health is 0\n if(this.health === 0) {\n //remove time event before removing enemyobject\n this.timeEvent.destroy();\n //remove enemy\n this.destroy();\n } else {\n //if not 0, reset tint back to normal after a delay\n this.scene.time.addEvent({\n delay: 200, \n callback: () => {\n this.tint = 0xffffff;\n }\n });\n }\n }", "function healthBarReset() {\n oldHealth = maxHealth;\n healthDif = 0;\n if (intervalVar !== undefined) {\n clearInterval(intervalVar);\n }\n}", "function Draw()\n{\n //Clear everything before drawing\n ctx.clearRect(0, 0, objCanvas.width, objCanvas.height);\n \n //Call handlers\n EnemyHandling();\n ProjectileHandling();\n PlayerHandling();\n \n //Draw enemies with their health bars\n arr_enemyObjects.forEach(function(element, index)\n {\n //Draw the object\n ctx.drawImage(element.objSprite, element.x, element.y);\n \n //Draw a health bar for the enemy\n //Start by drawing a black background\n ctx.fillStyle = \"#000000\";\n ctx.fillRect(element.x, element.y, element.objSprite.width, 3);\n //Calculate the length of the health bar according to the remaining health points\n let nbrHealthBarLength = element.intHealthPoints / element.intMaxHealth;\n //Then, draw the health bar\n ctx.fillStyle = \"#FF0000\";\n ctx.fillRect(element.x, element.y, element.objSprite.width * nbrHealthBarLength, 3);\n });\n \n //Draw projectiles\n arr_activeProjectiles.forEach(function(element, index)\n {\n ctx.drawImage(element.objSprite, element.x, element.y);\n });\n \n //Draw player\n ctx.drawImage(objPlayerSprite, intPlayerx, intPlayery);\n \n //Draw the player's score\n ctx.font = \"25px Arial\";\n ctx.fillStyle = \"#000000\";\n let strScoreDisplay = \"Score : \" + intPlayerScore;\n ctx.fillText(strScoreDisplay, (intLevelWidth - ctx.measureText(strScoreDisplay).width) / 2, 32);\n}", "updateAfterCollision() {\n this.setStartingPosition();\n this.decrementLives();\n\n if (this.lives < 1) {\n allEnemies = [];\n this.started = false;\n showLoseModal();\n }\n }", "function setupBars(number,chartDims){\n\tvar i;\n\tvar padding=0.1; //percentage of white space around bars\n\t\n\tvar texture = new PIXI.RenderTexture(renderer, 10, 10);\n\tvar graphics = new PIXI.Graphics();\n\tgraphics.beginFill(0xFF3000);\n\tgraphics.drawRect(0, 0, 10, 10);\n\tgraphics.endFill();\n\ttexture.render(graphics);\n\t\n\tfor (i=0;i<number;i++){\n\t\tbars[i]= new PIXI.Sprite(texture); \n\t\tbardet[i]=new PIXI.Text(' ');\n\t\tstage.addChild(bars[i]);\n\t\tstage.addChild(bardet[i]);\n\t\t//console.log(i);\t\n\t\tbars[i].position.set(chartDims[0]+chartDims[2]*(i/number+1/number*padding),(chartDims[3]*0.9+chartDims[1]))\n\t\tbars[i].width=(chartDims[2]/number*(1.0-2.0*padding))\n\t\tbars[i].height=(chartDims[3]*0.1);\n\t}\n\n\t\n}", "function update(time)\n\t{\n\n //stats.begin();\n\n cont++;\n\n // Need to update only if not dead\n if(!dead)\n requestAnimFrame(update);\n\n // Establish the fps used in the rest of the operations\n fps = 1000/(time-oldtime);\n oldtime = time;\n params.fps = fps;\n\n\n //Create enemies at a rate modified by params.difficulty\n if(cont%(Math.round(60/params.difficulty))==0){\n \n // Change color of difficulty var\n var barPercent = params.difficulty*100/params.maxDifficulty;\n $bar.width(barPercent+\"%\");\n\n if(barPercent > 33 && barPercent < 66){\n $bar.removeClass(\"progress-bar-success\").addClass(\"progress-bar-info\");\n }\n else if(barPercent > 66){\n $bar.removeClass(\"progress-bar-info\").addClass(\"progress-bar-danger\");\n }\n\n /*FIXME*/\n // Creation of different powers enemies\n var texture = bluetexture,\n enemy = null;\n \n var rndTexture = Math.random();\n\n if( rndTexture < 0.3){\n texture = redtexture;\n enemy = new RedPower();\n\n }\n else if(rndTexture >= 0.3 && rndTexture < 0.6){\n texture = greentexture;\n enemy = new GreenPower();\n\n }\n else{\n enemy = new BluePower();\n }\n\n // Creates enemies at different positions\n createObject(Math.random()*16 + 10, Math.random()*19 + 3, texture, enemy);\n\n if(Math.random()<0.1)\n createObject(Math.random()*16 + 10, Math.random()*19 + 3, \"w1.png\", new PowerUp());\n\n }\n\n\n\n /*console.log(Math.floor(containerDisplay.position.x-STAGE_WIDTH));\n if(Math.floor(containerDisplay.position.x-STAGE_WIDTH)%STAGE_WIDTH == 0){\n */\n // The rate of the floor and ceil creation\n if(cont%(60/2)==0){\n createFloor(floorActualX*6+1, 0.5);\n createFloor(floorActualX*6+1, 20);\n createFloor(floorActualX*6+1, Math.random()*10+5);\n floorActualX++;\n }\n\n /*createFloor(containerDisplay.position.x*6+1*-1, 0.5);\n createFloor(containerDisplay.position.x*6+1*-1, 20);\n createFloor(containerDisplay.position.x*6+1*-1, Math.random()*10+5);*/\n\n //The world steps at the same frame rate as the fps given by requestAnimFrame \n world.world.Step(1 / fps*2, 8, 3);\n world.world.ClearForces();\n \n const n = world.actors.actors.length;\n\n //iterate through actors and get their positions updated from the physics engine\n for (var i = 0; i < n; i++)\n {\n var body = world.actors.bodies[i];\n\n if(body === undefined) continue;\n \n var actor = world.actors.actors[i],\n position = actor.GetPosition();\n\n body.position.x = position.x * METER;\n body.position.y = (STAGE_HEIGHT - position.y * METER);\n body.rotation = -1 * actor.GetAngle();\n\n\n //Optimization of actors: if the actor has passed the \n //left of the screen and is not visible, destroy it.\n if(position.x + 10 < character.GetPosition().x){\n world.world.DestroyBody(actor);\n world.actors.actors.splice(i,1);\n world.actors.bodies.splice(i,1);\n }\n }\n \n\n var position = character.GetPosition();\n \n //set difficulty\n //difficulty = Math.round(position.x/params.difficultyFactor);\n if(params.difficulty < params.maxDifficulty)\n params.difficulty = position.x/params.difficultyFactor + 3;\n\n\n //make the character run\n addVel(character, 0.267*10);\n\n if (jump){\n addJump(character, 5);\n jump = false;\n }\n\n //update the position of the screen to the position of the character plus a given offset\n containerDisplay.position.x = position.x*METER*-1 + CHAR_OFFSET;\n\n //call method render from Pixi\n renderer.render(stage);\n\n\t}", "function checkEndGame() {\n if (barWidth >= 100) {\n endGame();\n }\n }", "function EnemyHandling()\n{\n arr_enemyObjects.forEach(function(element, index)\n {\n //Collision checking with projectiles\n arr_activeProjectiles.forEach(function(projectile, projectileIndex)\n {\n if (element.x < projectile.x + projectile.objSprite.width && element.x + element.objSprite.width > projectile.x && element.y < projectile.y + projectile.objSprite.height && element.y + element.objSprite.height > projectile.y)\n {\n arr_activeProjectiles.splice(projectileIndex, 1);\n element.intHealthPoints -= projectile.intDamage;\n }\n });\n \n //If the enemy has no health left or went to the end of the level, we remove it and add to the player's score\n if(element.intHealthPoints < 1 || element.x < -element.objSprite.width)\n {\n intPlayerScore += element.intScore;\n arr_enemyObjects.splice(index, 1);\n }\n \n //Move the enemy\n element.HorizontalMovement(); \n });\n}", "function syncHealthBar() {\n if (health <= 0) {\n hpBar.frame = hpBar.animations.frameTotal - 1;\n } else {\n let percentGone = (HP - health) / HP;\n let nextFrame = parseInt(hpBar.animations.frameTotal * percentGone);\n if (nextFrame >= 0 && nextFrame < hpBar.animations.frameTotal) {\n hpBar.frame = nextFrame;\n }\n }\n}", "function SetBars() {\n //setting progress bars values\n document.getElementsByTagName(\"progress\")[0].value = levels[0]; \n document.getElementsByTagName(\"progress\")[1].value = levels[1]; \n // calling setInterval to food progress bar\n foodInterval = setInterval(ProgessBar,300, 0);\n // calling setInterval to pills progress bar\n healthInterval = setInterval(ProgessBar, 500, 1);\n}", "function updatedeath(){\n \n //find animals where title is dead ensure they die\n $('.animal[title=dead]').each(function() {\n \n $(this).find(\".elephant\").parent(\".animal\").stop().fadeOut(800);\n $(this).find(\".monkey\").parent(\".animal\").stop().fadeOut(800);\n $(this).find(\".giraffe\").parent(\".animal\").stop().fadeOut(800);\n \n });\n \n \n \n // find elephants that are still sick and make sure they die\n $('.animal[title=alive]').each(function() {\n \n //Get Current health\n var animalHealth = $(this).find(\".health\").html();\n //remove % for math\n var removePercentage = animalHealth.replace('%','');\n //remove random health number\n \n \n //stop elephant under sick variable\n if(removePercentage < sickElephant ){ \n \n // add 1 close to death count and to stop movement and to prepare for death on deathElephant variable\n var closeToDeathCount = $(this).data(\"closeToDeath\");\n var NewDeathCount = parseFloat(closeToDeathCount)+1; \n \n $(this).data(\"closeToDeath\", NewDeathCount); \n \n $(this).find(\".elephant\").parent(\".animal\").stop(0);\n \n \n \n }\n \n })\n \n \n }", "function updateInterface () {\n updateAll()\n var health = game.player.returnAttribute('health')\n if (health > 75) {\n $('#playerImage').attr('src', './static/images/hero.png')\n }\n\n if (health < 76 && health > 50) {\n $('#playerImage').attr('src', './static/images/hero75.png')\n $('#playerHealth').css('color', 'white')\n }\n\n if (health < 51 && health > 25) {\n $('#playerImage').attr('src', './static/images/hero50.png')\n $('#playerHealth').css('color', 'white')\n }\n\n if (health < 26) {\n $('#playerImage').attr('src', './static/images/hero25.png')\n $('#playerHealth').css('color', 'red')\n }\n\n if (health < 1) {\n var modal = document.getElementById('loseModal')\n modal.style.display = 'block'\n }\n\n if (game.room.monsterInRoom('health') < 1) {\n if (game.room.monsterInRoom('name') === 'Dragon') {\n modal = document.getElementById('winnerModal')\n modal.style.display = 'block'\n } else {\n modal = document.getElementById('winModal')\n modal.style.display = 'block'\n $('#takeLoot').show()\n $('#monsterName1').text(game.room.monsterInRoom('name').toUpperCase())\n game.loot.lootFinder()\n }\n\n if (game.loot.returnFoundItem() === 0) {\n $('#takeLoot').hide()\n $('#roomLoot').html(game.readout.noLootFound())\n } else {\n $('#roomLoot').html(game.loot.displayLoot())\n $('#takeLoot').unbind().click(function () {\n game.loot.equipLoot()\n $('#roomLoot').html(game.readout.equipLoot())\n $('#takeLoot').hide()\n })\n }\n $('#nextRoom').unbind().click(function () {\n game.readout.clearReadout()\n game.room.nextRoom()\n game.readout.displayFlavourText()\n modal.style.display = 'none'\n updateAll()\n })\n }\n}", "function drawHealthState() \n {\n for (let index = 0; index < playerGameObjectsArray.length; index++) \n {\n if (playerGameObjectsArray[index].health >= 76) \n {\n playerGameObjectsArray[index].img = cannonImage;\n } \n if (playerGameObjectsArray[index].health >= 50 && playerGameObjectsArray[index].health <= 75) \n {\n playerGameObjectsArray[index].img = cannonImageDamaged1;\n }\n if (playerGameObjectsArray[index].health >= 1 && playerGameObjectsArray[index].health <= 49) \n {\n playerGameObjectsArray[index].img = cannonImageDamaged2;\n }\n if (playerGameObjectsArray[index].health == 0) \n {\n playerGameObjectsArray[index].img = cannonImageDestroyed;\n } \n\n }\n }", "function initializeScreen() {\n var vHP;\n hideElements('#idDefender');\n hideElements('#idEnimiesAvailable');\n $(\"#idEnemiesHeader\").hide();\n $(\"#idDefenderHeader\").hide();\n $(\"#idFightSection\").hide();\n $('#idYourCharacter').children().each( function(index){ \n vHP=$(this).children('.charValue').attr('data-hp-value') ;\n $(this).children('.charValue').text(vHP);\n $(this).show();\n });\n \n $('#idMessage').text(\"\");\n mouseClickBaseChar=true;\n mouseClickEnemyChar=false;\n mouseClickAttack=false;\n vBaseCharacter=\"\";\n vDefenderCharacter=\"\";\n vCounter=0;\n numberOfEnemies=0;\n\n }", "function updateHealth() {\n // Reduce player health based on width of the display\n playerHealth = playerHealth - width / 3000;\n // Constrain the result to a sensible range\n playerHealth = constrain(playerHealth, 0, playerMaxHealth);\n // Check if the player is dead (0 health)\n if (playerHealth === 0) {\n // If so, reset health, and update how many lives the player has left\n playerHealth = playerMaxHealth;\n updatePlayerLives();\n }\n}", "function newEnemy() {\n gameState = 1;\n battleVictoryCounter++;\n $(\"#defeated_enemies\").append($(\"#\" + currentEnemy));\n $(\"#\" + currentEnemy).children(\"p\").addClass(\"defeated\");\n\n //If time permits: swap out enemy picture with dead enemy picture\n\n $(\"#\" + ourCharacter).children(\"img\").removeClass(\"mirror\");\n $(\"#character_window\").children(\"h2\").text(\"Selected Character\");\n $(\"#versus\").remove();\n $(\"#instructions_text\").text(\"Great job! You've defeated \" + eval(currentEnemy)[\"name\"] + \"! Click on an available enemy to start a new fight!\");\n }", "update() {\n if (this.x > 406) {\n this.x = 406;\n } else if (this.x < 0) {\n this.x = 0;\n } else if (this.y > 400) {\n this.y = 400;\n // increasing the speed of eniemies by each next level\n } else if (this.y < 0) {\n player.x = 200\n player.y = 400\n\n enemy1.speed = random(100, this.counter * 100);\n enemy2.speed = random(130, this.counter * 150);\n enemy3.speed = random(150, this.counter * 200);\n // swet alert when player complete the level\n swal(\n \"Good job!\",\n \"You Win!!! Play next level\",\n \"success\",\n );\n level.textContent = `LEVEL ${++this.counter}`;\n highestLevel.textContent = `Highest Level${this.counter}`;\n }\n\n }", "update() {\n if (this.y > this.yFallBounds[this.phase]) {\n this.healthBar.updateHealth(-18);\n }\n const TICK = this.game.clockTick;\n this.time2 = this.timer.getTime();\n this.attackEnd = this.timer.getTime();\n this.bowTime += TICK;\n if (this.healthBar.isDead()) {\n this.dead = true;\n this.deadCount+= this.game.clockTick;\n if (this.deadCount > 1.5) {\n PARAMS.GAMEOVER = true;\n }\n }\n\n //-------------adjust constants to alter physics-----------\n //run\n let max_run = 200; //adjust for maximum run speed\n let acc_run = 300; //adjust for maximum acceleration\n const ACC_SPRINT = 600; //adjust for maximum sprint acc\n const MAX_SPRINT = 800 //adjust for maximum sprint\n\n //skids\n const DEC_SKID = 4000;\n const TURN_SKID = 50;\n //jump\n const JUMP_ACC = 600; //adjust for maximum jump acc\n const MAX_JUMP = 1000; //adjust for maximum jump height\n const DBL_JUMP_MOD = 100; //adjust for double jump boost\n //falling\n const MAX_FALL = 1000; //adjust for fall speed\n const STOP_FALL = 1575;\n //in air deceleration\n const AIR_DEC = 1;\n if (PARAMS.START && !PARAMS.PAUSE) {\n if (this.dead) {\n this.velocity.y = 0;\n this.velocity.x = 0;\n this.BB = new BoundingBox(0, 0, 0, 0);\n } else {\n // collision\n var that = this;\n this.game.entities.forEach(function (entity) {\n if (entity.BB && that.BB.collide(entity.BB)) {\n if (entity instanceof Arrow && !entity.isAssassin) {\n that.healthBar.updateHealth(-PARAMS.DIFFICULTY);\n ASSET_MANAGER.playAsset(\"./audio/arrow_impact_soft.mp3\")\n that.velocity.x *= .95;\n } else if (that.velocity.y > 0) { // falling\n if ((entity instanceof Land || entity instanceof FloatingLand || entity instanceof Bridge) // landing\n && (that.lastBB.bottom) <= entity.BB.top) { // was above last tick\n that.velocity.y = 0;\n that.y = entity.BB.top - that.BB.height;\n that.updateBB();\n }\n } else if (that.velocity.y < 0) { // jumping\n if (entity instanceof FloatingLand) {\n if (that.lastBB.top > entity.BB.bottom) {\n that.velocity.y *= -.2;\n that.y = that.lastBB.y;\n that.updateBB();\n }\n }\n }\n if ((entity instanceof CaveWall || entity instanceof Land || entity instanceof FloatingLand)\n && entity.BB.top - that.BB.bottom < -5) {\n if (that.BB.left < entity.BB.left) {\n that.x = entity.BB.left - (that.BB.width * 2) + 20;\n if (that.velocity.x > 0) {\n that.velocity.x *= -.2;\n }\n } else { //<-\n if (that.velocity.x < 0) {\n that.velocity.x *= -.2;\n }\n that.x = that.lastBB.left - 5;\n }\n } else if (entity instanceof HealthPotion) {\n if (!that.healthBar.isFull()) {\n that.healthBar.updateHealth(10);\n entity.drank = true;\n }\n } else if (entity instanceof Soul) {\n if (entity.isKey) {\n PARAMS.SOULS += entity.value;\n entity.consumed = true;\n that.isKeyed = true;\n } else {\n PARAMS.SOULS += entity.value;\n entity.consumed = true;\n }\n } else if (entity instanceof Portal) {\n if (that.isKeyed) {\n that.teleport = true;\n }\n } else if (entity instanceof IceArrow) {\n if (!that.hasIceArrow) {\n that.hasIceArrow = true;\n entity.consumed = true;\n }\n }\n\n }\n if (entity instanceof Dragon) {\n if (entity.BB && that.BB.collide(entity.BB)) {\n that.velocity.x *= -.9;\n if (that.facing === 0) {\n that.x -= 5;\n } else {\n that.x += 5;\n }\n }\n if (entity.ABB && that.BB.collide(entity.ABB)) {\n if (!that.hit) {\n switch (PARAMS.DIFFICULTY) {\n case PARAMS.EASY:\n that.healthBar.updateHealth(-1);\n break;\n case PARAMS.NORMAL:\n that.healthBar.updateHealth(-3);\n break;\n case PARAMS.HARD:\n that.healthBar.updateHealth(-7);\n break;\n }\n that.hit = true;\n ASSET_MANAGER.playAsset(\"./audio/dragon_hit.mp3\");\n }\n } else {\n that.hit = false;\n }\n }\n if ((entity instanceof ShadowWarrior || entity instanceof Knight || entity instanceof RedEye)\n && entity.BB && that.BB.collide(entity.BB)) {\n that.velocity.x *= .9;\n }\n if (entity.ABB && entity instanceof ShadowWarrior && that.BB.collide(entity.ABB)) {\n if (that.state !== 3) {\n that.healthBar.updateHealth(-(.5 + PARAMS.DIFFICULTY));\n ASSET_MANAGER.playAsset(\"./audio/sword_hit_player2.mp3\");\n }\n }\n if (entity.ABB && entity instanceof Knight && that.BB.collide(entity.ABB)) {\n if (that.state !== 3) {\n that.healthBar.updateHealth(-PARAMS.DIFFICULTY);\n ASSET_MANAGER.playAsset(\"./audio/sword_hit_player_knight.mp3\");\n }\n\n }\n\n });\n\n let yVel = Math.abs(this.velocity.y);\n //this physics will need a fine tuning;\n let attackLength = 0;\n if (this.game.One) {\n this.weapon = 0;\n attackLength = 380;\n this.weaponIcon.updateWeapon(0);\n }\n if (this.game.Two) {\n this.weapon = 1;\n attackLength = 450;\n this.weaponIcon.updateWeapon(1);\n }\n if (this.game.Three) {\n this.weapon = 2;\n attackLength = 750;\n this.weaponIcon.updateWeapon(2);\n }\n if (this.attackEnd - this.attackStart > attackLength) {\n this.attacking = false;\n } else {\n this.attacking = true;\n }\n if ((this.attackEnd - this.attackStart > attackLength - 200) && (this.attackEnd - this.attackStart < attackLength) &&\n this.state === 2) {\n this.attackWindow = true;\n } else {\n\n this.attackWindow = false;\n this.arrowFlag = true;\n }\n this.updateBB();\n if (!this.attacking) {\n if (!this.game.B) {\n this.jumpFlag = false;\n }\n if (this.game.right) {\n this.facing = 0;\n this.state = 1;\n } else if (this.game.left) {\n this.facing = 1;\n this.state = 1;\n } else if (this.game.A) {\n this.state = 2;\n if (yVel < 20) {\n this.velocity.x = 0;\n }\n this.bowTime = 0;\n this.attackStart = this.timer.getTime();\n }\n\n if (this.game.B) {\n this.state = 3;\n if (this.velocity.y > 500) this.state = 0;\n } else if (!this.game.A && !this.game.B && !this.game.right && !this.game.left) {\n this.state = 0;\n }\n if (this.game.C) {\n if (this.game.left || this.game.right) {\n this.state = 4;\n }\n acc_run = ACC_SPRINT;\n max_run = MAX_SPRINT;\n }\n if (this.game.A && this.game.B) {\n if (this.velocity.y > 200) this.state = 0;\n else this.state = 3;\n }\n if (this.game.B && this.game.C && (this.game.right || this.game.left)) {\n this.state = 0;\n }\n\n //if moving right and then face left, skid\n if (this.game.left && this.velocity.x > 0 && yVel < 20) {\n this.velocity.x -= TURN_SKID;\n }\n //if moving left ann then face right, skid\n if (this.game.right && this.velocity.x < 0 && yVel < 20) {\n this.velocity.x += TURN_SKID;\n }\n //if you unpress left and right while moving right\n if (!this.game.right && !this.game.left) {\n if (this.facing === 0) { //moving right\n if (this.velocity.x > 0 && yVel < 20) {\n this.velocity.x -= DEC_SKID * TICK;\n } else if (yVel < 20) {\n this.velocity.x = 0;\n } else if (this.velocity.x > 0) { //this is where you control horizontal deceleration when in air\n this.velocity.x -= AIR_DEC;\n }\n } else { //if you unpress left and right while moving left\n if (this.velocity.x < 0 && yVel < 20) {\n this.velocity.x += DEC_SKID * TICK;\n } else if (yVel < 20) {\n this.velocity.x = 0;\n } else if (this.velocity.x < 0) { //this is where you control horizontal deceleration when in air\n this.velocity.x += AIR_DEC;\n }\n }\n }\n //Run physics\n if (this.facing === 0) { //facing right\n if (this.game.right && !this.game.left) { //and pressing right.\n if (yVel < 10 && !this.game.B) { //makes sure you are on ground\n this.velocity.x += acc_run * TICK;\n }\n }\n } else if (this.facing === 1) { //facing left\n if (!this.game.right && this.game.left) { //and pressing left.\n if (yVel < 10 && !this.game.B) { //makes sure you are on ground\n this.velocity.x -= acc_run * TICK;\n }\n }\n }\n\n if (this.game.B) {\n let timeDiff = this.time2 - this.time1;\n if (this.velocity.y === 0) { // add double jump later\n this.time1 = this.timer.getTime();\n this.velocity.y -= JUMP_ACC;\n this.fallAcc = STOP_FALL;\n this.jumpFlag = true;\n } else if (!this.jumpFlag && timeDiff > 100 && timeDiff < 250) {\n this.velocity.y -= DBL_JUMP_MOD;\n this.fallAcc = STOP_FALL;\n }\n }\n if (this.velocity.y < 0) {\n this.state = 3;\n }\n }\n // max speed calculation\n if (this.velocity.x >= max_run) this.velocity.x = max_run;\n if (this.velocity.x <= -max_run) this.velocity.x = -max_run;\n // update position\n this.velocity.y += this.fallAcc * TICK;\n this.y += this.velocity.y * TICK * PARAMS.SCALE;\n if (this.velocity.y >= MAX_FALL) this.velocity.y = MAX_FALL;\n if (this.velocity.y <= -MAX_JUMP) this.velocity.y = -MAX_FALL;\n\n this.x += this.velocity.x * TICK * PARAMS.SCALE;\n if (this.teleport) {\n ASSET_MANAGER.playAsset(\"./audio/teleport.mp3\")\n PARAMS.SAVEDSOULS = PARAMS.SOULS;\n this.phase++;\n this.x = this.portalLocations[this.phase].x;\n this.y = this.portalLocations[this.phase].y;\n PARAMS.XSPAWN = this.x;\n PARAMS.YSPAWN = this.y;\n if (this.phase === 1) {\n this.game.phaseOneDone();\n }\n if (this.phase === 2) {\n ASSET_MANAGER.playAsset(\"./audio/growl.mp3\");\n this.game.phaseTwoDone();\n }\n this.velocity.x = 0;\n this.isKeyed = false;\n this.teleport = false;\n }\n this.updateBB(); //Update your bounding box every tick\n }\n }\n }", "function death()\n{\t\n\n\tplayer.velocity.y = 20;\t\n\tfor(var i = 0; i < boundaries.length; i ++) boundaries.get(i).velocity.x = 0;\n\tfor(var i = 0; i < rocks.length; i ++) rocks.get(i).velocity.x = 0;\n\tif(player.bounce(rocks)) player.velocity.y = 0;\n\tdeathScreen();\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 gameOverSong.play();\n }\n}", "function buildBattle() {\n selectNextEnemy();\n stageNumber += 1;\n stageNumberDiv.textContent = \"Stage \" + stageNumber;\n cpuBattleH = cpuBattle[1];\n cpuH100 = cpuBattleH;\n cpuBattleD = cpuBattle[2];\n cpuBattleD2 = cpuBattle[3];\n cpuInfoDiv.textContent = cpuBattle[0];\n cpuImg.setAttribute('src', cpuBattle[4]);\n\n cpuHitCounter = 0;\n specialBar(playerSpecialBar, playerHitCounter);\n specialBar(cpuSpecialBar, cpuHitCounter);\n removeSpecialButton();\n changeBackground();\n bannerElement.remove();\n\n var playerBattle = localStorage.playerComplete.split(\",\");\n playerBattleH = playerBattle[1];\n playerH100 = playerBattleH;\n playerBattleD = playerBattle[2];\n playerBattleD2 = playerBattle[3];\n\n //append info to html\n playerInfoDiv.textContent = playerBattle[0];\n playerImg.setAttribute('src', playerBattle[4]);\n playerImg.setAttribute('class', 'black-border-fifty');\n playerImgDiv.appendChild(playerImg);\n\n cpuImg.setAttribute('class', 'black-border-fifty');\n cpuImgDiv.appendChild(cpuImg);\n cpuHB.setAttribute('style', 'width: 100%');\n cpuHB.setAttribute('class', 'progress-bar cpuBar');\n playerHBar.setAttribute('style', 'width: 100%');\n playerHBar.setAttribute('class', 'progress-bar playerBar');\n\n hitButton.addEventListener('click', battle);\n kickButton.addEventListener('click', battle);\n\n // adds event listener for stop stage song\n stopButton2 = document.getElementById('stopButton2');\n stopButton2.addEventListener('click', stopMusic2);\n\n playStageSong();\n\n}", "function UpdateHealthBar() {\n\tthis.healthBar.transform.localScale =\n\t\t\tnew Vector3(this.currentHealth / this.maxHealth, 1 ,1);\n\t//set the bg bar to be in the same location as the health bar\n\tthis.healthBarBg.transform.position = this.healthBar.transform.position;\n}", "function Attack() {\n enemyHP -= attackPower\n attackPower += 2\n if (enemyHP > 0) {\n playerHP -= $('.enemy').data('counter')\n $('#playerMessage').text('Player HP: ' + playerHP)\n $('#enemyMessage').text('Enemy HP: ' + enemyHP)\n // Enemy beats player\n if (playerHP <= 0) {\n $('#enemyMessage').text('You Lose')\n $('#playerMessage').text('Select your Element')\n GameOver();\n }\n }\n // Player beats Enemy\n else {\n console.log('enemy dead')\n $('.attack').attr('disabled', true);\n $('.enemy').hide('slow');\n $('.element').removeClass('enemy')\n enemiesDead++\n // Player beats all three Enemeies\n if (enemiesDead == 3) {\n Achievement($Water,'Water','blue')\n Achievement($Fire,'Fire','darkorange')\n Achievement($Air,'Air','lightblue')\n Achievement($Earth,'Earth','green')\n elementsMastered++;\n // Player beats all three Enemies with all four Elements\n if(elementsMastered === 4){\n $('#enemyMessage').text('You are the')\n $('#title').text('ELEMENT MASTER')\n $('#playerMessage').text('')\n }else{\n $('#enemyMessage').text('You Win')\n $('#playerMessage').text('Select another Element')\n }\n GameOver();\n }\n else {\n selectedEnemy = false;\n $('#enemyMessage').text('Select another Opponent')\n }\n }\n // Outputs proper Achievement div in the Achievments row\n function Achievement (element,elementClass,color){\n if (element.hasClass('player') && !$('#achievements').hasClass(elementClass)) {\n var $achievement = $('<div>')\n var $title = $('<p></p>')\n $title.addClass('title')\n $title.text(elementClass + \" Master\")\n $achievement.append($title)\n $achievement.attr({\n class:'col-1',\n class:'text-center'\n })\n $achievement.css({\n backgroundColor: color,\n color: \"white\",\n opacity: \"0.8\",\n padding: \"30px\",\n })\n $achievement.appendTo(\"#achievements\")\n $('#achievements').addClass(elementClass)\n }\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 drawStatusPanel (context, pos_x, pos_y, isEnemy, name, gender, level, status, \n currentHP, maxHP, currentEXP, maxEXP) {\n var width = 150;\n var height = 50;\n var radius = 5;\n var fontSize = 13;\n var percentHP = currentHP / maxHP;\n var percentEXP = currentEXP / maxEXP;\n var healthBarColor;\n\n // back panel\n\n context.fillStyle = \"rgba(0, 0, 0, 0.5)\";\n roundRect(context, pos_x, pos_y, width, height - 11, radius, true, false);\n\n // draw HP bar\n\n if (percentHP <= 0.15) {\n healthBarColor = \"red\";\n }\n else if (percentHP <= 0.5) {\n healthBarColor = \"gold\";\n }\n else if (percentHP <= 1) {\n healthBarColor = \"lawngreen\";\n }\n\n var gradient = context.createLinearGradient( pos_x + 28, pos_y + (height / 2.5), pos_x + 28, pos_y + (height / 2.5) + 3);\n gradient.addColorStop(0, \"#FFF\"); \n gradient.addColorStop(1, \"#000\");\n context.fillStyle = gradient;\n roundRect(context, pos_x + 28, pos_y + (height / 2.5), width - (25 + 8), 4, 2, true, false);\n\n var gradient = context.createLinearGradient( pos_x + 28, pos_y + (height / 2.5), pos_x + 28, pos_y + (height / 2.5) + 3);\n gradient.addColorStop(0, \"#FFF\"); \n gradient.addColorStop(1, healthBarColor);\n context.fillStyle = gradient;\n roundRect(context, pos_x + 28, pos_y + (height / 2.5), (width - (25 + 8)) * percentHP, \n 4, 2, true, false);\n\n // draw EXP bar\n\n if (!isEnemy) {\n var gradient = context.createLinearGradient( pos_x + 5, pos_y + (height / 6 * 5), pos_x + 5, pos_y + (height / 6 * 5) + 3);\n gradient.addColorStop(0, \"#FFF\"); \n gradient.addColorStop(1, \"#000\");\n context.fillStyle = gradient;\n roundRect(context, pos_x + 5, pos_y + (height / 6 * 5), width - (2 * 5), 4, 2, true, false);\n\n var gradient = context.createLinearGradient( pos_x + 5, pos_y + (height / 6 * 5), pos_x + 5, pos_y + (height / 6 * 5) + 3);\n gradient.addColorStop(0, \"#FFF\"); \n gradient.addColorStop(1, \"deepskyblue\");\n context.fillStyle = gradient;\n roundRect(context, pos_x + 5, pos_y + (height / 6 * 5), (width - (2 * 5)) * percentEXP, \n 4, 2, true, false);\n }\n\n // draw status label\n\n var statusColor = \"transparent\";\n var statusTextColor = \"greenYellow\";\n var statusText = \" HP\";\n\n if (status === \"burn\"){\n statusColor = \"#E05848\";\n statusTextColor = \"#FFF\";\n statusText = \"BRN\";\n }\n else if (status === \"faint\") {\n statusColor = \"#B00000\";\n statusTextColor = \"#FFF\";\n statusText = \"FNT\";\n }\n else if (status === \"freeze\") {\n statusColor = \"#009898\";\n statusTextColor = \"#FFF\";\n statusText = \"FRZ\";\n }\n else if (status === \"paralyze\") {\n statusColor = \"#E8A800\";\n statusTextColor = \"#FFF\";\n statusText = \"PAR\";\n }\n else if (status === \"poison\") {\n statusColor = \"#C040C8\";\n statusTextColor = \"#FFF\";\n statusText = \"PSN\";\n }\n else if (status === \"sleep\") {\n statusColor = \"#687060\";\n statusTextColor = \"#FFF\";\n statusText = \"SLP\";\n }\n\n context.font = fontSize - 5 + \"px Verdana\";\n context.fillStyle = statusColor;\n roundRect(context, pos_x + 5, pos_y + (height / 2.5) + ((fontSize - 5) / 2) - (fontSize - 5) + 1, \n 19, 11, 2, true, false);\n context.fillStyle = statusTextColor;\n context.fillText(statusText, pos_x + 5 + 1, pos_y + (height / 2.5) + ((fontSize - 4) / 2));\n\n // draw HP numbers \n\n if (!isEnemy) {\n context.font = fontSize - 2 + \"px Verdana\";\n context.fillStyle = \"#FFF\";\n context.fillText(currentHP + \" / \" + maxHP, pos_x + 25, pos_y + fontSize + 22);\n }\n\n // draw pokemon's name\n\n context.font = fontSize + \"px Verdana\";\n context.fillStyle = \"#FFF\";\n context.fillText(name, pos_x + 5, pos_y + fontSize);\n\n // draw gender symbol\n\n var g;\n\n if (gender === \"male\") {\n g = '♂';\n context.fillStyle = \"#B3E5FC\";\n }\n else if (gender === \"female\") {\n g = '♀';\n context.fillStyle = \"#FF80AB\";\n }\n else {\n g = \"\";\n }\n\n context.font = fontSize + \"px Verdana\";\n context.fillText(g, pos_x + 97, pos_y + fontSize);\n\n // draw level lavel \n\n context.font = fontSize - 3 + \"px Verdana\";\n context.fillStyle = \"orange\";\n context.fillText(\"Lv\", pos_x + 108, pos_y + fontSize); \n\n // draw level number\n\n context.font = fontSize + \"px Tahoma\";\n context.fillStyle = \"#FFF\";\n context.fillText(level, pos_x + 121, pos_y + fontSize);\n}", "function Start() \n{\n\t\n\tguiHealth = GameObject.Find(\"GameManager\");\n healthBarScript = guiHealth.GetComponent(GuiDisplayJava) as GuiDisplayJava;\n \n // Set initial value of the health...\n \n // Uncomment the line below and call reduceHealth() in the Update() method to watch health decrease\n healthBarScript.healthWidth = 199;\n \n // Uncomment the line below and call increaseHealth() in the Update() method to watch health increase\n // healthBarScript.healthWidth = -8;\n \n}", "function gameOver() {\n playerAlive = false; \n\n //Reset health and the health bar.\n currentHealth = maxHealth;\n healthBarReset();\n\n //Clear skeleton interval if applicable. \n if (skeleInterval !== undefined) {\n clearInterval(skeleInterval);\n }\n\n //Kill all enemeis on the level to prevent bugs when resetting. \n for (i = 0; i < enemyCount; i++){\n enemies[i].alive = false; \n }\n\n //Reset inventory to a prior state (stored in resetInventory)\n for (j = 0; j < inventory.length; j++) {\n inventory[j] = (resetInventory[j]);\n }\n\n if (currentLevelID === 'colchisFields' && userIntThis.ritualItemText.alpha > 0) {\n userIntThis.ritualItemText.alpha = 0;\n } else if (userIntThis.ritualItemText.alpha > 0){\n userIntThis.updateRitualItemText();\n }\n\n //Restart the level. \n createThis.scene.restart(currentLevelID);\n}", "function enemies(){\n //Enemy 1\n enemy1Interval = setInterval(function(){\n var pos1 = 16;\n var pos2 = e1;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();}\n $(\"#16-\"+(e1+1)).css('background-image',\"\");\n $(\"#16-\"+(e1)).css('background-image', 'url(\"images/red-car.png\")');\n e1--;\n if(e1<-1)\n {\n e1 = 14;\n }\n },350);\n\n //Enemy 2\n setInterval(function(){\n var pos1 = 15;\n var pos2 = e2;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();}\n $(\"#15-\"+(e2+1)).css('background-image',\"\");\n $(\"#15-\"+(e2)).css('background-image', 'url(\"images/pink-car.png\")');\n e2--;\n if(e2<-1)\n {\n e2 = 14;\n }\n },250);\n //Enemy 3\n setInterval(function(){\n var pos1 = 14;\n var pos2 = e3;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();}\n $(\"#14-\"+(e3+1)).css('background-image',\"\");\n $(\"#14-\"+(e3)).css('background-image', 'url(\"images/blue-car.png\")');\n e3--;\n if(e3<-1)\n {\n e3 = 14;\n }\n },200);\n //Enemy 4\n setInterval(function(){\n var pos1 = 11;\n var pos2 = e4;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();}\n $(\"#11-\"+(e4+1)).css('background-image',\"\");\n $(\"#11-\"+(e4)).css('background-image', 'url(\"images/pink-car.png\")');\n e4--;\n if(e4<-1)\n {\n e4 = 14;\n }\n },150);\n //Enemy 5\n setInterval(function(){\n var pos1 = 9;\n var pos2 = e5;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();}\n $(\"#9-\"+(e5+1)).css('background-image',\"\");\n $(\"#9-\"+(e5)).css('background-image', 'url(\"images/red-car.png\")');\n e5--;\n if(e5<-1)\n {\n e5 = 14;\n }\n },125);\n //Enemy 6\n setInterval(function(){\n var pos1 = 8;\n var pos2 = e6;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();} \n $(\"#8-\"+(e6+1)).css('background-image',\"\");\n $(\"#8-\"+(e6)).css('background-image', 'url(\"images/pink-car.png\")');\n e6--;\n if(e6<-1)\n {\n e6 = 14;\n }\n },100);\n //Enemy 7\n setInterval(function(){\n var pos1 = 7;\n var pos2 = e7;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();} \n $(\"#7-\"+(e7+1)).css('background-image',\"\");\n $(\"#7-\"+(e7)).css('background-image', 'url(\"images/blue-car.png\")');\n e7--;\n if(e7<-1)\n {\n e7 = 14;\n }\n },150);\n //Enemy 8\n setInterval(function(){\n var pos1 = 4;\n var pos2 = e8;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();}\n $(\"#4-\"+(e8+1)).css('background-image',\"\");\n $(\"#4-\"+(e8)).css('background-image', 'url(\"images/red-car.png\")');\n e8--;\n if(e8<-1)\n {\n e8 = 14;\n }\n },50);\n //Enemy 9\n setInterval(function(){\n var pos1 = 3;\n var pos2 = e9;\n if(currentPosR==pos1&&currentPosC==pos2){loseLife();}\n $(\"#3-\"+(e9+1)).css('background-image',\"\");\n $(\"#3-\"+(e9)).css('background-image', 'url(\"images/pink-car.png\")');\n e9--;\n if(e9<-1)\n {\n e9 = 14;\n }\n },130);\n}", "update(deltaTime){\n this.healthBar.scale.x = this.health / this.maxHealth;\n if(this.health <= 0){\n this.die();\n }\n \n if(this.health > this.maxHealth){\n this.health = this.maxHealth;\n }\n }", "function check() {\n OOP.forArr(walls,function (wall) {\n if(wall.isStaticIntersect(player.getStaticBox()))\n {\n if(wall.enemyBlock)\n {\n damage.currentTime = 0.75;\n damage.play();\n pjs.camera.move(point(-10,0));\n try\n {\n health--;\n hs.shift();\n var el = document.querySelectorAll('#healths > img');\n el[el.length-1].remove();\n }\n catch(e)\n {}\n }\n }\n });\n OOP.forArr(mobs,function (mob) {\n if(mob.isIntersect(player))\n {\n try\n {\n damage.currentTime = 0.75;\n damage.play();\n\n health--;\n hs.shift();\n var el = document.querySelectorAll('#healths > img');\n el[el.length-1].remove();\n\n pjs.camera.move(point(-10,0));\n }\n catch (e) {}\n }\n });\n setTimeout(check,250);\n}", "function endGame(pos) {\n $('#' + pos + \" .gauge-fill\").height(0);\n $('#' + pos + ' .icon').css(\"display\", \"none\");\n if(enlarged != \"\") {\n hideCurrGame();\n }\n delete activeArray[pos];\n onFire += 1;\n if(onFire == 5){\n onFireAction();\n }\n if(activeArray.length == 0){\n cleanSweepAction();\n }\n}", "function updateEndEnemies(enemyArr, currEnemy)\r\n{\r\n //if we shot the leftmost or rightmost enemy, update\r\n if(currEnemy == leftEnemy)\r\n {\r\n while(leftMostCol < 10){\r\n if(enemiesR3[leftMostCol].alive)\r\n {\r\n leftEnemy = enemiesR3[leftMostCol];\r\n break;\r\n }\r\n else if(enemiesR2[leftMostCol].alive)\r\n {\r\n leftEnemy = enemiesR2[leftMostCol];\r\n break;\r\n }\r\n else if(enemiesR1[leftMostCol].alive)\r\n {\r\n leftEnemy = enemiesR1[leftMostCol];\r\n break;\r\n }\r\n leftMostCol++;\r\n }\r\n }\r\n if(currEnemy == rightEnemy)\r\n {\r\n while(rightMostCol >= 0){\r\n if(enemiesR3[rightMostCol].alive)\r\n {\r\n rightEnemy = enemiesR3[rightMostCol];\r\n break;\r\n }\r\n else if(enemiesR2[rightMostCol].alive)\r\n {\r\n rightEnemy = enemiesR2[rightMostCol];\r\n break;\r\n }\r\n else if(enemiesR1[rightMostCol].alive)\r\n {\r\n rightEnemy = enemiesR1[rightMostCol];\r\n break;\r\n }\r\n rightMostCol--;\r\n }\r\n }\r\n}", "function updateBarsFrom(owner){\n owner.cards.forEach(function(card){\n //barra de vida\n startedTweens++;\n card.lifeBar.lbl.text = card.life + '/' + card.maxLife;\n var newWidth = card.lifeBar.fullWidth * card.life / card.maxLife;\n var lifeTween = self.game.add.tween(card.lifeBar.mask).to({x: card.lifeBar.mask.originalX + (card.lifeBar.fullWidth - newWidth) * (card.lifeBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n lifeTween.onComplete.add(onTweenCompleted);\n //barra de defensa\n startedTweens++;\n card.defenseBar.lbl.text = card.defense + '/' + card.maxDefense;\n var newWidth = card.defenseBar.fullWidth * card.defense / card.maxDefense;\n var defenseTween = self.game.add.tween(card.defenseBar.mask).to({x: card.defenseBar.mask.originalX + (card.defenseBar.fullWidth - newWidth) * (card.defenseBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n defenseTween.onComplete.add(onTweenCompleted);\n //barra de magia\n startedTweens++;\n card.magicBar.lbl.text = card.magic + '/' + card.maxMagic;\n var newWidth = card.magicBar.fullWidth * card.magic / card.maxMagic;\n var magicTween = self.game.add.tween(card.magicBar.mask).to({x: card.magicBar.mask.originalX + (card.magicBar.fullWidth - newWidth) * (card.magicBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n magicTween.onComplete.add(onTweenCompleted);\n\n if(card.magic == card.maxMagic){\n card.magicFrame.visible = true;\n }\n else {\n card.magicFrame.visible = false;\n }\n\n if(card.life == 0) {\n card.alpha = 0.5;\n } else {\n card.alpha = 1;\n }\n });\n }", "function EnemyMech(x, y) {\n //default value for the sprite key\n this.spriteName = 'enemyMech';\n //storage for the sprite\n this.sprite = null;\n //score 'bounty'\n this.score = 100;\n //grid x position\n this.x = x;\n //grid y position\n this.y = y;\n //pixel x location\n this.truex = hexGrid.hexTiles[x][y].truex;\n //pixel y location\n this.truey = hexGrid.hexTiles[x][y].truey;\n //team it belongs to\n this.team = teams.enemy;\n //range of weapons\n this.range = 3;\n //health of enemy\n this.health = 2;\n //array to store health tiles\n this.healthSprites = [];\n //bool if action is taken\n this.exhausted = false;\n //called each enemy turn\n this.routine = function () {\n //move randomly to a valid adjacent tile\n EnemyMove(this);\n //shoot a player in range\n EnemyShoot(this);\n }\n this.clickEvent = function() {\n \n }\n //called when sprite is first drawn\n this.draw = function() {\n this.sprite = game.add.sprite(this.truex, this.truey, this.spriteName);\n this.sprite.anchor.setTo(0.5);\n this.sprite.scale.setTo(MECHSCALE);\n this.drawHealth();\n }\n //draws the health tiles\n this.drawHealth = function() {\n for (i=0; i < this.healthSprites.length; i++) {\n this.healthSprites[i].destroy();\n }\n this.healthSprites = [];\n for (i=0; i < this.health; i++) {\n var spriteWidth = 8;\n var healthSprite = game.add.sprite(this.truex + (spriteWidth * i) - (this.health * (spriteWidth / 2)) + spriteWidth / 2, this.truey - 30, 'health');\n healthSprite.anchor.setTo(0.5);\n healthSprite.scale.setTo(HEALTHSCALE);\n this.healthSprites.push(healthSprite);\n }\n }\n //function to move the unit to a position\n this.changePosition = function(x, y) {\n var oldx = this.x;\n var oldy = this.y;\n this.x = x;\n this.y = y;\n this.truex = hexGrid.hexTiles[x][y].truex;\n this.truey = hexGrid.hexTiles[x][y].truey;\n this.sprite.x = this.truex;\n this.sprite.y = this.truey;\n hexGrid.hexTiles[x][y].mech = this;\n hexGrid.hexTiles[oldx][oldy].mech = null;\n this.drawHealth();\n }\n ///called when mech is destroyed\n this.destroy = function() {\n score.addScore(this.score);\n this.sprite.destroy();\n for (i=0; i < this.healthSprites.length; i++) {\n this.healthSprites[i].destroy();\n }\n hexGrid.hexTiles[this.x][this.y].mech = null;\n remove(enemies, this);\n }\n //assigns itself to the mech field of the tile it is on\n hexGrid.hexTiles[x][y].mech = this;\n //adds itself to the active enemy array\n enemies.push(this);\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 }", "function healthIndicators() {\n var mobs = Entity.getAll();\n\n for(var i = 0; i < mobs.length; i++) {\n\n\n var xq = Entity.getX(mobs[i]) - getPlayerX();\n\n var yq = Entity.getY(mobs[i]) - getPlayerY();\n\n var zq = Entity.getZ(mobs[i]) - getPlayerZ();\n\n\n\n if(xq * xq + yq * yq + zq * zq <= 40 * 40 && mobs[i] != getPlayerEnt()) {\n\n if(Entity.getEntityTypeId(mobs[i]) == 10) {\n Entity.setNameTag(mobs[i], nameColor + \"Chicken \" + healthColor + Entity.getHealth(mobs[i]) + \"/4\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 11) {\n Entity.setNameTag(mobs[i], nameColor + \"Cow \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 12) {\n Entity.setNameTag(mobs[i], nameColor + \"Pig \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 13) {\n Entity.setNameTag(mobs[i], nameColor + \"Sheep \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 14) {\n Entity.setNameTag(mobs[i], nameColor + \"Wolf \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 15) {\n Entity.setNameTag(mobs[i], nameColor + \"Villager \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 16) {\n Entity.setNameTag(mobs[i], nameColor + \"Mooshroom \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 17) {\n Entity.setNameTag(mobs[i], nameColor + \"Squid \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\nif(Entity.getEntityTypeId(mobs[i]) == 18) {\n Entity.setNameTag(mobs[i], nameColor + \"Rabbit \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 19) {\n Entity.setNameTag(mobs[i], nameColor + \"Bat \" + healthColor + Entity.getHealth(mobs[i]) + \"/6\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 20) {\n Entity.setNameTag(mobs[i], nameColor + \"Iron Golem \" + healthColor + Entity.getHealth(mobs[i]) + \"/100\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 21) {\n Entity.setNameTag(mobs[i], nameColor + \"Snow Golem \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 22) {\n Entity.setNameTag(mobs[i], nameColor + \"Ocelot \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 32) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 33) {\n Entity.setNameTag(mobs[i], nameColor + \"Creeper \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 34) {\n Entity.setNameTag(mobs[i], nameColor + \"Skeleton \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 35) {\n Entity.setNameTag(mobs[i], nameColor + \"Spider \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 36) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie Pigman \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 37) {\n Entity.setNameTag(mobs[i], nameColor + \"Slime \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 38) {\n Entity.setNameTag(mobs[i], nameColor + \"Enderman \" + healthColor + Entity.getHealth(mobs[i]) + \"/40\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 39) {\n Entity.setNameTag(mobs[i], nameColor + \"Silverfish \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 40) {\n Entity.setNameTag(mobs[i], nameColor + \"Cave Spider \" + healthColor + Entity.getHealth(mobs[i]) + \"/12\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 41) {\n Entity.setNameTag(mobs[i], nameColor + \"Ghast \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 42) {\n Entity.setNameTag(mobs[i], nameColor + \"Magma Cube \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 43) {\n Entity.setNameTag(mobs[i], nameColor + \"Blaze \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\");\n }\nif(Entity.getEntityTypeId(mobs[i]) == 44) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie Villager \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\");\n }\nif(Entity.getEntityTypeId(mobs[i]) == 45) {\n Entity.setNameTag(mobs[i], nameColor + \"Witch \" + healthColor + Entity.getHealth(mobs[i]) + \"/26\");\n }\n }\n }\n}", "function newGame() {\n\n $(\"#\" + ourCharacter).removeClass(\"us\");\n for (var i = 0; i < enemies.length; i++) {\n $(\"#\" + enemies[i]).removeClass(\"enemies\");\n }\n\n gameState = 0;\n battleVictoryCounter = 0;\n enemies = [\"gunner\", \"swordsman\", \"archer\", \"mage\"];\n gunner[\"healthPoints\"] = 140;\n swordsman[\"healthPoints\"] = 140;\n archer[\"healthPoints\"] = 140;\n mage[\"healthPoints\"] = 140;\n gunner[\"attackPower\"] = 5;\n swordsman[\"attackPower\"] = 5;\n archer[\"attackPower\"] = 5;\n mage[\"attackPower\"] = 5;\n gunner[\"counterAttackPower\"] = 25;\n swordsman[\"counterAttackPower\"] = 25;\n archer[\"counterAttackPower\"] = 25;\n mage[\"counterAttackPower\"] = 25;\n\n \n\n $(\"#gunner\").empty().html(\"<img src=\\\"./assets/images/gunner.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + gunner[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + gunner[\"healthPoints\"] + \"</p>\");\n $(\"#swordsman\").empty().html(\"<img src=\\\"./assets/images/swordsman.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + swordsman[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + swordsman[\"healthPoints\"] + \"</p>\");\n $(\"#archer\").empty().html(\"<img src=\\\"./assets/images/archer.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + archer[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + archer[\"healthPoints\"] + \"</p>\");\n $(\"#mage\").empty().html(\"<img src=\\\"./assets/images/mage.jpg\\\">\").prepend(\"<p class=\\\"name\\\">\" + mage[\"name\"] + \"</p>\").append(\"<p class=\\\"health_points\\\">HP: \" + mage[\"healthPoints\"] + \"</p>\");\n $(\"#character_window\").children(\"h2\").text(\"Character Selection\");\n $(\"#character_window\").append($(\"#gunner\")).append($(\"#swordsman\")).append($(\"#archer\")).append($(\"#mage\"));\n $(\"#versus\").remove();\n $(\"#log_text\").empty();\n $(\"#instructions_text\").text(\"Welcome to the Stickfigure Showdown! Choose a character to get started...\");\n }", "function preload() {\n\t// Clickables and Adventure\n\tclickablesManager = new ClickableManager('data/clickableLayout.csv');\n\tadventureManager = new AdventureManager('data/adventureStates.csv', 'data/interactionTable.csv', 'data/clickableLayout.csv');\n\n\t// Fonts\n\tfontChanga = loadFont('font/Changa.otf');\n\tfontCairo = loadFont('font/Cairo.otf');\n fontChangaBold = loadFont('font/Changa_ExtraBold.otf');\n\n\t// Music and Sounds\n\tclickL = loadSound('sfx/click_low.mp3');\n\tclickH = loadSound('sfx/click_high.mp3');\n vib = loadSound('sfx/vib.mp3');\n\n // Images\n talkBubble = loadImage('assets/dialogue/box.png');\n talkBubbleDynamic = loadImage('assets/dialogue/dialoguebox.png');\n life_img = loadImage('assets/objects/life.png');\n potsticker_img = loadImage('assets/objects/potsticker.png');\n power_img = loadImage('assets/objects/power.png');\n\n // Dialogue\n enemyDialogue[0] = 'Hey, pretty lady.';\n enemyDialogue[1] = 'Wanna be my China doll?';\n enemyDialogue[2] = 'Ni hao...';\n enemyDialogue[3] = 'Me so horny...';\n enemyDialogue[4] = 'Me love you long time.';\n enemyDialogue[5] = 'Come over here...';\n enemyDialogue[6] = 'Let me touch you.';\n enemyDialogue[7] = 'What’s your Chinese name?';\n enemyDialogue[8] = 'You look exotic.';\n enemyDialogue[9] = 'I love Asian women.';\n\n // Pause between enemy dialogue\n enemyDialogueTimer = new Timer(7000);\n enemyDialogueTimer.start();\n\n // Dialogue stays up for 4.5 seconds\n enemyDialogueDuration = new Timer(4500);\n\n // How often can the player take damage from enemy sprites\n enemyDamageTimer = new Timer(5000);\n}", "function updateTopMenuValues(playerHealth, bossHealth){\n\n // Update the Healthbar values \n setHealthbarValues(playerHealth, bossHealth);\n\n // Update the value of the satisfaction bar based on its current value\n setSatisfactionBarValue();\n\n // Set the text message\n generateMessage();\n}", "loseHealth() {\n this.DB = store.get(GameConstants.DB.DBNAME);\n //delete extra lifes if exists\n if (this.health>5){ \n let currentExtraLifes = parseInt(this.DB.extralifes);\n if (this.DB.extralifes>0){\n this.DB.extralifes = currentExtraLifes - 1; \n store.set(GameConstants.DB.DBNAME, this.DB);\n }\n }\n this.health--;\n this.scene.textHealth.setText(this.scene.TG.tr('COMMONTEXT.LIVES') + this.health);\n if (this.health === 0) {\n //Turn alarm music off\n this.alarmON = false;\n this.healthAlarm.stop(); \n //gameOver\n this.scene.gameOverText('gameOver');\n this.gameOver = true;\n this.emit(GameConstants.Events.GAME_OVER);\n }else if (this.health == 1){\n //Turn alarm music on\n this.alarmON = true;\n if (this.DB.SFX) {\n this.healthAlarm.play();\n }\n }else{\n this.alarmON = false;\n this.healthAlarm.stop(); \n }\n\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 }", "drawHealthBar(){\n this.healthBar.beginFill(0xFF0000);\n this.healthBar.drawRect(0, -12, 575, 25);\n this.healthBar.x = this.x;\n this.healthBar.y = this.y;\n this.healthBar.scale.x = this.health / this.maxHealth;\n this.healthBar.endFill();\n }", "function attackDefender() {\r\n $(\"#attackResult\").html(`</div class = \"strike\"> ${defenderName} has been attacked for ${attackCurrent} health points. </div>\r\n <br>\r\n <br>\r\n </div class = \"returned\"> ${defenderName} counter attacked for ${counterAttack} health points. </div>`\r\n );\r\n\t\t\r\n\t\t\r\n\t\t// updates the hero hp displayed below image\r\n hpHero -= counterAttack;\r\n\t\t$(\".hero .healthpoints\").html(\"HP: \" + hpHero);\r\n\t\t$(\".hero #healthbar\").css(\"width\" , hpHero/heroTotalHealth*100+\"%\");\r\n \r\n // updates the defender hp displayed below image\r\n hpAttacker -= attackCurrent;\r\n\t\t$(\".defender .healthpoints\").html(\"HP: \" + hpAttacker);\r\n\t\t$(\".defender #healthbar\").css(\"width\" , hpAttacker/defenderTotalHealth*100+\"%\");\r\n\r\n // sets conditions for winning and losing\r\n // hero loses if hp goes to less than 0\r\n\t\tif (hpHero <= 0) {\r\n\t\t\theroDefeated();\r\n\t\t\t$(\"#attack\").hide();\r\n\t\t}\r\n\r\n // the other guy also loses if hp goes to less than 0\r\n\t\tif (hpAttacker <= 0) {\r\n\t\t\tdefenderDefeated(defenderName);\r\n\t\t}\r\n\r\n // hero wins only if he defeats all three other fighters AND has hp greater than 0\r\n\t\tif (defeatedDads.length >= 3 && hpHero >0 ) {\r\n\t\t\t$(\"#attack\").hide();\r\n\t\t\t$(\"#defTitle\").show();\r\n\t\t\t$(\"#challengers\").hide();\r\n\t\t\t$(\".defender\").hide();\r\n\t\t\t$(\".hero\").append(\r\n\t\t\t\t`<div> We have a WINNER!!! </div>`\r\n\t\t\t);\r\n\t\t}\r\n\r\n // the current value of the hero's attack is then added to the base attach, \r\n // effectively multiplying the number of attacks by the base attack value\r\n\t\tattackCurrent += attackBase;\r\n\t}", "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 }" ]
[ "0.65949917", "0.64337116", "0.63488334", "0.633253", "0.6284872", "0.6261083", "0.62480927", "0.6132932", "0.60952646", "0.6084168", "0.6084016", "0.6065441", "0.60620546", "0.60593873", "0.6047584", "0.60468805", "0.60406053", "0.6039369", "0.6026554", "0.6007479", "0.5988085", "0.5985451", "0.5948756", "0.5929044", "0.5911377", "0.5877917", "0.58520615", "0.5845085", "0.58210254", "0.57888025", "0.5787476", "0.5783474", "0.5771296", "0.5744595", "0.5727509", "0.5700427", "0.5699932", "0.5686082", "0.5679493", "0.56599486", "0.56510293", "0.56492", "0.5649155", "0.5644886", "0.56371355", "0.5635529", "0.56282955", "0.56202686", "0.5618321", "0.56154233", "0.56103164", "0.5605855", "0.56057817", "0.56009257", "0.55923945", "0.5590652", "0.5586732", "0.5582163", "0.5581417", "0.55735826", "0.5572603", "0.55633736", "0.5560728", "0.55598295", "0.55534124", "0.5541143", "0.5536414", "0.55313975", "0.55260694", "0.55205876", "0.55194974", "0.55148673", "0.5510698", "0.55050576", "0.5490975", "0.54909736", "0.54890615", "0.5488286", "0.5487944", "0.5478262", "0.5476057", "0.54682213", "0.54681194", "0.5467278", "0.5465542", "0.5461783", "0.54498327", "0.5440474", "0.54355526", "0.54339343", "0.5429425", "0.5428801", "0.5428696", "0.54271203", "0.54233176", "0.54202485", "0.54139817", "0.5409863", "0.540586", "0.5399456" ]
0.702743
0
updateEnemyBars: ========================================= updatePlayerBars: this function updates the health and attack bars of the player
function updatePlayerBars (fighterClass, fighterHealthClass, fighterAttackClass) { var healthPercent; var attackPercent; healthPercent = ((fighterClass.health * 100) / fighterClass.healthMax); attackPercent = ((fighterClass.attack * 100) / fighterClass.attackMax); console.log("player health percent: " + healthPercent); console.log("player attack percent: " + attackPercent); $ ("." + fighterHealthClass).css("width",healthPercent + "%"); $ ("." + fighterAttackClass).css("width",attackPercent + "%"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateEnemyBars (fighterClass, fighterHealthClass, fighterCounterClass) {\n\tvar healthPercent;\n\tvar counterPercent;\n\n\thealthPercent = ((fighterClass.health * 100) / fighterClass.healthMax);\n\n\tcounterPercent = ((fighterClass.counter * 100) / fighterClass.counterMax);\n\n\tconsole.log(\"enemy health percent: \" + healthPercent);\n\tconsole.log(\"enemy counter percent: \" + counterPercent);\n\t\n\t//these commands update the bars in the character\n\t$ (\".\" + fighterHealthClass).css(\"width\",healthPercent + \"%\");\n\t$ (\".\" + fighterCounterClass).css(\"width\",counterPercent + \"%\");\n\n}", "update(){\n this.graphics.clear();\n for(let bar of this.healthBars){\n if(!bar.visible){\n continue;\n }\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.health/100);\n this.draw(bar);\n }\n for(let bar of this.progressBars){\n if(bar.track.state === \"closed\"){\n bar.visible = true;\n }\n else{\n bar.visible = false;\n }\n if(bar.visible){\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.tapCount/bar.track.maxTap);\n this.draw(bar);\n }\n }\n }", "function updateHealthbar() {\n let redPos = redBar.components.position;\n redPos.width = (health - currHealth) / health * redPos.height * 4;\n\n let greenPos = greenBar.components.position;\n greenPos.width = greenPos.height * 4 - redPos.width;\n }", "function worldUpdate() {\r\n\t$('#distance').html(prettify(Game.world.distance));\r\n\t$('#zone').html(Game.zone);\r\n\r\n\t//enemy\r\n\t$('#enemyHealth').html(prettify(Game.enemy.health));\r\n\r\n\tvar enemyHealthBar = document.getElementById(\"enemyHealthBar\");\r\n\tvar hp = (Game.enemy.health / Game.enemy.totalhealth) * 100;\r\n\tenemyHealthBar.style.width = hp + '%';\r\n\r\n\tif (Game.enemy.health >= Game.enemy.totalhealth) Game.enemy.health = Game.enemy.totalhealth;\r\n\r\n\tif (Game.enemy.health <= 0) {\r\n\t\tenemyHealthBar.style.width = '0%';\r\n\t\tendFight();\r\n\t}\r\n}", "function updateSinglePlayerHealthBar(currTurn){\n\n var HEALTH_BAR_X = GAME_WIDTH + 10;\n var HEALTH_BAR_Y = 100;\n var HEALTH_BAR_HEIGHT = 20;\n //Calculate the width of the bar as a percentage of the player's current health\n var healthBarWidth = calcHealthBarWidth(currTurn, statScreen.SinglePlayer.PlayerIndex);\n //redraw the health bar\n singleGraphics.beginFill(HEALTH_BAR_COLOR);\n statScreen.SinglePlayer.HealthBar.Bar = singleGraphics.drawRect(\n HEALTH_BAR_X, \n HEALTH_BAR_Y, \n healthBarWidth, \n HEALTH_BAR_HEIGHT);\n singleGraphics.endFill();\n}", "function updateGUIStatusBar(nameOfBar, points, maxPoints, direction) {\n // check, if optional direction parameter is valid.\n if (!direction || !(direction >= 0 && direction < 4)) direction = 0;\n\n // get the bar and update it\n let statusBar = Engine.GetGUIObjectByName(nameOfBar);\n if (!statusBar) return;\n\n let healthSize = statusBar.size;\n let value = 100 * Math.max(0, Math.min(1, points / maxPoints));\n\n // inverse bar\n if (direction == 2 || direction == 3) value = 100 - value;\n\n if (direction == 0) healthSize.rright = value;\n else if (direction == 1) healthSize.rbottom = value;\n else if (direction == 2) healthSize.rleft = value;\n else if (direction == 3) healthSize.rtop = value;\n\n statusBar.size = healthSize;\n}", "function movePlayerBar(){\n\t\t\tvar position=texture.getPosition();\n\t\t\tvar y1=position.y;\n\t\t\tvar y2=position.y+size.height;\n\t\t\tvar y1_aux=(dir!=1?y1+speed:y1-speed);\n\t\t\tvar y2_aux=(dir!=1?y2+speed:y2-speed);\n\t\t\t\n\t\t\t//Comprobamos que la bola no rebasaria los limites verticales\n\t\t\tif(y1_aux<y_min || y2_aux>y_max){\n\t\t\t\ty1_aux=(y1_aux<y_min)?y_min:y_max-size.height;\n\t\t\t\tstopMove(dir);\n\t\t\t}\n\t\t\ttexture.move(x,y1_aux);\n\t\t\ttexture.fireOnChangeEvent();\n\t\t}", "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 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 gameOverSong.play();\n }\n}", "function updateHealth() {\n // Reduce player health\n playerHealth = playerHealth - 0.5;\n // Constrain the result to a sensible range\n playerHealth = constrain(playerHealth, 0, playerMaxHealth);\n\n //When the shift button is pressed, player's health\n //will decrease faster, especially without the constrain\n if (keyIsDown(SHIFT)) {\n playerHealth = playerHealth - 2;\n }\n //When the sift button is released, the health\n //will decrease at it's normal rate\n else {\n playerHealth = playerHealth - 0.5;\n playerHealth = constrain(playerHealth, 0, playerMaxHealth);\n }\n\n // Check if the player is dead (0 health)\n if (playerHealth === 0) {\n // If so, the game is over\n gameOver = true;\n }\n}", "function updateHealth() {\n // Reduce player health based on width of the display\n playerHealth = playerHealth - width / 3000;\n // Constrain the result to a sensible range\n playerHealth = constrain(playerHealth, 0, playerMaxHealth);\n // Check if the player is dead (0 health)\n if (playerHealth === 0) {\n // If so, reset health, and update how many lives the player has left\n playerHealth = playerMaxHealth;\n updatePlayerLives();\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 update() {\r\n game.physics.arcade.collide(player, layer);\r\n game.physics.arcade.collide(NPC, layer);\r\n game.physics.arcade.collide(layer2, cageKey);\r\n game.physics.arcade.collide(layer, cage);\r\n\r\n collision();\r\n\r\n movement();\r\n\r\n cropRect.width = healthBar.width * (player.health / healthOld);\r\n\r\n healthBar.updateCrop();\r\n\r\n healthOld = player.health;\r\n }", "function setEnemyHealth(kills) {\n var base = 100;\n var mod = rollTwoDie(kills, 10) * 3;\n return base + mod;\n }", "function drawHealthBar() {\n maxHealthUpdate();\n healthBar.clear();\n \n hbX = userIntThis.cameras.main.scrollX + userIntThis.sys.game.config.width*0.73;\n hbY = userIntThis.cameras.main.scrollY + userIntThis.sys.game.config.height*0.0225;\n healthBar.lineStyle(1,0x000000,1);\n healthBar.fillStyle(0xff0000,1);\n healthBar.strokeRect(hbX,hbY,hbWidth,hbHeight);\n \n if (currentHealth > 0) {\n healthBar.fillRect(hbX,hbY,hbIncrement*oldHealth,hbHeight);\n }\n}", "function updateAll() {\n //var marioElem = document.getElementById(\"mario\");\n if (damage > 0) {\n player.health -= damage;\n var fireElem = document.getElementById(\"fire\").attributes\n //document.getElementById(\"mario\").classlist.add(\"vader\")\n }\n\n //totalDamage();\n damage = 0;\n update.innerText = player.health.toString();\n playerName.innerText = player.name;\n displayHits.innerText = player.hits.toString();\n\n if (player.health < 30) {\n document.getElementById(\"player-panel\").classList.add(\"panel-danger\");\n healthBarElem.classList.add('progress-bar-danger');\n } else if (player.health > 30 && player.health < 60) {\n document.getElementById(\"player-panel\").classList.remove(\"panel-danger\");\n document.getElementById(\"player-panel\").classList.add(\"panel-warning\");\n healthBarElem.classList.remove('progress-bar-danger');\n healthBarElem.classList.add('progress-bar-warning');\n } else {\n document.getElementById(\"player-panel\").classList.remove(\"panel-danger\");\n document.getElementById(\"player-panel\").classList.remove(\"panel-warning\");\n document.getElementById(\"player-panel\").classList.add(\"panel-default\");\n healthBarElem.classList.remove('progress-bar-danger');\n healthBarElem.classList.remove('progress-bar-warning');\n healthBarElem.classList.add('progress-bar-success');\n\n\n }\n if (player.health <= 0) {\n termElem.src = 'img/boom-sm.png';\n player.health = 0;\n updateHealthBar();\n // disabled buttons come back after timeout\n disableButtons();\n debugger\n winnerElem.innerText = player.name + \" Wins! The Terminator was destroyed in \" + player.hits + \" hits!\";\n winnerElem.style.color = \"green\";\n clearInterval(interval);\n }\n updateHealthBar();\n\n}", "function updateBars(bars,n,colorScale, chart)\n {\n\n setScale(chart);\n\n var yScale = d3.scale.linear()\n .range([0, chartHeight]) \n .domain([0, scaleMax]); \n\n bars.attr(\"x\", function(d, i)\n {\n return (i * (chartInnerWidth / csvData.length)) + leftPadding;\n })\n .attr(\"height\", function(d)\n {\n return yScale(parseFloat(d[expressed]));\n })\n .attr(\"y\", function(d)\n {\n return (chartHeight - yScale(parseFloat(d[expressed]))) + topBottomPadding;\n })\n .style(\"fill\", function(d)\n {\n return colorScale(d[expressed]);\n })\n .on(\"mouseover\", function(d)\n {\n var nm = d.geography.split(' ');\n val = d[expressed];\n highlight(nm[0], val);\n })\n .on(\"mouseout\", function(d)\n {\n var nm = d.geography.split(' ');\n dehighlight(nm[0])\n })\n .on(\"mousemove\", moveLabel);\n }", "function UpdateHealthBar() {\n\tthis.healthBar.transform.localScale =\n\t\t\tnew Vector3(this.currentHealth / this.maxHealth, 1 ,1);\n\t//set the bg bar to be in the same location as the health bar\n\tthis.healthBarBg.transform.position = this.healthBar.transform.position;\n}", "function playerHeal(tempHealth){\n currentHealth += tempHealth;\n if (currentHealth > maxHealth){\n currentHealth = maxHealth;\n }\n parseHealthBarAnimate();\n}", "function updateTopMenuValues(playerHealth, bossHealth){\n\n // Update the Healthbar values \n setHealthbarValues(playerHealth, bossHealth);\n\n // Update the value of the satisfaction bar based on its current value\n setSatisfactionBarValue();\n\n // Set the text message\n generateMessage();\n}", "function updateBarsFrom(owner){\n owner.cards.forEach(function(card){\n //barra de vida\n startedTweens++;\n card.lifeBar.lbl.text = card.life + '/' + card.maxLife;\n var newWidth = card.lifeBar.fullWidth * card.life / card.maxLife;\n var lifeTween = self.game.add.tween(card.lifeBar.mask).to({x: card.lifeBar.mask.originalX + (card.lifeBar.fullWidth - newWidth) * (card.lifeBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n lifeTween.onComplete.add(onTweenCompleted);\n //barra de defensa\n startedTweens++;\n card.defenseBar.lbl.text = card.defense + '/' + card.maxDefense;\n var newWidth = card.defenseBar.fullWidth * card.defense / card.maxDefense;\n var defenseTween = self.game.add.tween(card.defenseBar.mask).to({x: card.defenseBar.mask.originalX + (card.defenseBar.fullWidth - newWidth) * (card.defenseBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n defenseTween.onComplete.add(onTweenCompleted);\n //barra de magia\n startedTweens++;\n card.magicBar.lbl.text = card.magic + '/' + card.maxMagic;\n var newWidth = card.magicBar.fullWidth * card.magic / card.maxMagic;\n var magicTween = self.game.add.tween(card.magicBar.mask).to({x: card.magicBar.mask.originalX + (card.magicBar.fullWidth - newWidth) * (card.magicBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n magicTween.onComplete.add(onTweenCompleted);\n\n if(card.magic == card.maxMagic){\n card.magicFrame.visible = true;\n }\n else {\n card.magicFrame.visible = false;\n }\n\n if(card.life == 0) {\n card.alpha = 0.5;\n } else {\n card.alpha = 1;\n }\n });\n }", "function drawHealthBar() {\r\n healthBar.clear();\r\n hbX = userIntThis.cameras.main.scrollX + userIntThis.sys.game.config.width*0.775;\r\n hbY = userIntThis.cameras.main.scrollY + userIntThis.sys.game.config.height*0.0225;\r\n healthBar.lineStyle(1,0x000000,1);\r\n healthBar.fillStyle(0xff0000,1);\r\n healthBar.strokeRect(hbX,hbY,hbWidth,hbHeight);\r\n \r\n if (currentHealth > 0) {\r\n healthBar.fillRect(hbX,hbY,hbIncrement*oldHealth,hbHeight);\r\n }\r\n}", "update(deltaTime){\n this.healthBar.scale.x = this.health / this.maxHealth;\n if(this.health <= 0){\n this.die();\n }\n \n if(this.health > this.maxHealth){\n this.health = this.maxHealth;\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}", "function syncHealthBar() {\n if (health <= 0) {\n hpBar.frame = hpBar.animations.frameTotal - 1;\n } else {\n let percentGone = (HP - health) / HP;\n let nextFrame = parseInt(hpBar.animations.frameTotal * percentGone);\n if (nextFrame >= 0 && nextFrame < hpBar.animations.frameTotal) {\n hpBar.frame = nextFrame;\n }\n }\n}", "function animateBars() {\n\n\tuserRegisteredAmount();\n\tAmountofAdv();\n\t\n\tuserProgressBar();\n\tretailerProgressBar();\n\tadsProgressBar();\n\t\n}", "function barUpdate() {\n\t// changes the color of the background depending on the percent\n\tif (Math.abs(($bar.width()/$statusBar.width()) - percentCorrect) == 100 ) {\n\t\tcolorChange(2000);\n\t\t}\n\telse if (Math.abs(($bar.width()/$statusBar.width()) - percentCorrect) >= 30) {\n\t\tcolorChange(1500);\n\t\t}\n\telse {\n\t\tcolorChange(900);\n\t};\n}", "update() {\r\n this.moveEnemy();\r\n // player human collision\r\n for (let activePlayer of gGameEngine.players) {\r\n if (this.detectPlayerCollision({\r\n x: activePlayer.bmp.x,\r\n y: activePlayer.bmp.y\r\n })) {\r\n activePlayer.alive = false;\r\n activePlayer.animate('dead');\r\n }\r\n }\r\n // playerAI collision\r\n if (this.detectPlayerAICollision({\r\n x: gGameEngine.playerAI.bmp.x,\r\n y: gGameEngine.playerAI.bmp.y\r\n })) {\r\n gGameEngine.playerAI.alive = false;\r\n gGameEngine.playerAI.animate('dead');\r\n }\r\n }", "function updateEnemyStats() {\n\t\t$(\"#enemyHealth\").html(\"HP: \" + enemyPicked.health + \"<br />Attack: \" + enemyPicked.attack);\n\t\t$(\"#enemyName\").html(enemyPicked.display);\n\t}", "function cypherOnUpdateBarAttributes(updateData) {\r\n const update = [\"bar1\", \"bar2\", \"bar3\"].some(b => {\r\n let bar = this.data[b];\r\n if (!bar)\r\n return false;\r\n\r\n return bar.attribute && hasProperty(updateData, \"data.\"+bar.attribute);\r\n });\r\n\r\n if (update)\r\n this.object.drawBars();\r\n }", "function updateBoard(){\n draw(levelMap);\n\n /*\n levelMap[player.getCurrentPosition().y][player.getCurrentPosition().x] = 1;\n levelMap[enemy.getCurrentPosition().y][enemy.getCurrentPosition().x] = 2;\n\n if(player.getCurrentPosition().y == levelMap.length - 1) player.setGoalReached(true);\n if(enemy.getCurrentPosition().y == 0) enemy.setGoalReached(true);\n\n draw(levelMap);\n\n //Clean the cells where the player was standed\n levelMap[player.getCurrentPosition().y][player.getCurrentPosition().x] = 0;\n levelMap[enemy.getCurrentPosition().y][enemy.getCurrentPosition().x] = 0;\n\n //Read the x and y positions of player and enemy to put them in the board\n if(!player.getGoalReached()){\n player.setCurrentPosition(player.getCurrentPosition().x,player.getCurrentPosition().y+1);\n }\n\n if(!enemy.getGoalReached()){\n enemy.setCurrentPosition(enemy.getCurrentPosition().x,enemy.getCurrentPosition().y-1);\n }\n */\n}", "drawHealthBar(){\n this.healthBar.beginFill(0xFF0000);\n this.healthBar.drawRect(0, -12, 575, 25);\n this.healthBar.x = this.x;\n this.healthBar.y = this.y;\n this.healthBar.scale.x = this.health / this.maxHealth;\n this.healthBar.endFill();\n }", "function _updateBar(sel) {\n sel.each(function(dd) {\n var bar = d3.select(this).selectAll('.bar')\n .data(dd)\n\n // exit\n bar.exit().remove()\n\n // enter\n bar.enter().append('rect').attr('class', 'bar')\n\n // update\n var sumX = 0\n bar\n .attr('x', function(d) {\n var x = sumX\n sumX += scale(d.duration)\n return x\n })\n .attr('y', 0)\n .attr('width', function(d) {\n return scale(d.duration)\n })\n .attr('height', barHeight)\n .style('fill', function(d) {\n return color(d.actionType)\n })\n\n })\n }", "function updateChart(bars, labels, n, colorScale){\r\n\r\n //position bars\r\n bars.attr(\"x\", 0)\r\n //size/resize bars\r\n .attr(\"y\", function(d, i){\r\n return i * (chartHeight / n)\r\n })\r\n .attr(\"width\", function(d){\r\n var ww = wScale(d[expressed]);\r\n if (ww>0) {\r\n return wScale(d[expressed]);\r\n } else {\r\n return 0;\r\n } \r\n })\r\n .attr(\"height\", chartHeight / n - 1)\r\n //color/recolor bars\r\n .style(\"fill\", function(d){\r\n return choropleth(d, colorScale);\r\n });\r\n\r\n labels.attr(\"x\", +7)\r\n .attr(\"y\", function(d, i){\r\n return (i * (labelHeight / n)) + (labelHeight / n * .5) + 5;\r\n });\r\n \r\n d3.select(\".chartTitle\").text(drop1Choice); \r\n }", "update() {\n for (const bug of allEnemies) {\n this.bugCollision(bug);\n }\n\n if (boss) {\n this.bugCollision(boss);\n }\n }", "update() {\n if (this.y > this.yFallBounds[this.phase]) {\n this.healthBar.updateHealth(-18);\n }\n const TICK = this.game.clockTick;\n this.time2 = this.timer.getTime();\n this.attackEnd = this.timer.getTime();\n this.bowTime += TICK;\n if (this.healthBar.isDead()) {\n this.dead = true;\n this.deadCount+= this.game.clockTick;\n if (this.deadCount > 1.5) {\n PARAMS.GAMEOVER = true;\n }\n }\n\n //-------------adjust constants to alter physics-----------\n //run\n let max_run = 200; //adjust for maximum run speed\n let acc_run = 300; //adjust for maximum acceleration\n const ACC_SPRINT = 600; //adjust for maximum sprint acc\n const MAX_SPRINT = 800 //adjust for maximum sprint\n\n //skids\n const DEC_SKID = 4000;\n const TURN_SKID = 50;\n //jump\n const JUMP_ACC = 600; //adjust for maximum jump acc\n const MAX_JUMP = 1000; //adjust for maximum jump height\n const DBL_JUMP_MOD = 100; //adjust for double jump boost\n //falling\n const MAX_FALL = 1000; //adjust for fall speed\n const STOP_FALL = 1575;\n //in air deceleration\n const AIR_DEC = 1;\n if (PARAMS.START && !PARAMS.PAUSE) {\n if (this.dead) {\n this.velocity.y = 0;\n this.velocity.x = 0;\n this.BB = new BoundingBox(0, 0, 0, 0);\n } else {\n // collision\n var that = this;\n this.game.entities.forEach(function (entity) {\n if (entity.BB && that.BB.collide(entity.BB)) {\n if (entity instanceof Arrow && !entity.isAssassin) {\n that.healthBar.updateHealth(-PARAMS.DIFFICULTY);\n ASSET_MANAGER.playAsset(\"./audio/arrow_impact_soft.mp3\")\n that.velocity.x *= .95;\n } else if (that.velocity.y > 0) { // falling\n if ((entity instanceof Land || entity instanceof FloatingLand || entity instanceof Bridge) // landing\n && (that.lastBB.bottom) <= entity.BB.top) { // was above last tick\n that.velocity.y = 0;\n that.y = entity.BB.top - that.BB.height;\n that.updateBB();\n }\n } else if (that.velocity.y < 0) { // jumping\n if (entity instanceof FloatingLand) {\n if (that.lastBB.top > entity.BB.bottom) {\n that.velocity.y *= -.2;\n that.y = that.lastBB.y;\n that.updateBB();\n }\n }\n }\n if ((entity instanceof CaveWall || entity instanceof Land || entity instanceof FloatingLand)\n && entity.BB.top - that.BB.bottom < -5) {\n if (that.BB.left < entity.BB.left) {\n that.x = entity.BB.left - (that.BB.width * 2) + 20;\n if (that.velocity.x > 0) {\n that.velocity.x *= -.2;\n }\n } else { //<-\n if (that.velocity.x < 0) {\n that.velocity.x *= -.2;\n }\n that.x = that.lastBB.left - 5;\n }\n } else if (entity instanceof HealthPotion) {\n if (!that.healthBar.isFull()) {\n that.healthBar.updateHealth(10);\n entity.drank = true;\n }\n } else if (entity instanceof Soul) {\n if (entity.isKey) {\n PARAMS.SOULS += entity.value;\n entity.consumed = true;\n that.isKeyed = true;\n } else {\n PARAMS.SOULS += entity.value;\n entity.consumed = true;\n }\n } else if (entity instanceof Portal) {\n if (that.isKeyed) {\n that.teleport = true;\n }\n } else if (entity instanceof IceArrow) {\n if (!that.hasIceArrow) {\n that.hasIceArrow = true;\n entity.consumed = true;\n }\n }\n\n }\n if (entity instanceof Dragon) {\n if (entity.BB && that.BB.collide(entity.BB)) {\n that.velocity.x *= -.9;\n if (that.facing === 0) {\n that.x -= 5;\n } else {\n that.x += 5;\n }\n }\n if (entity.ABB && that.BB.collide(entity.ABB)) {\n if (!that.hit) {\n switch (PARAMS.DIFFICULTY) {\n case PARAMS.EASY:\n that.healthBar.updateHealth(-1);\n break;\n case PARAMS.NORMAL:\n that.healthBar.updateHealth(-3);\n break;\n case PARAMS.HARD:\n that.healthBar.updateHealth(-7);\n break;\n }\n that.hit = true;\n ASSET_MANAGER.playAsset(\"./audio/dragon_hit.mp3\");\n }\n } else {\n that.hit = false;\n }\n }\n if ((entity instanceof ShadowWarrior || entity instanceof Knight || entity instanceof RedEye)\n && entity.BB && that.BB.collide(entity.BB)) {\n that.velocity.x *= .9;\n }\n if (entity.ABB && entity instanceof ShadowWarrior && that.BB.collide(entity.ABB)) {\n if (that.state !== 3) {\n that.healthBar.updateHealth(-(.5 + PARAMS.DIFFICULTY));\n ASSET_MANAGER.playAsset(\"./audio/sword_hit_player2.mp3\");\n }\n }\n if (entity.ABB && entity instanceof Knight && that.BB.collide(entity.ABB)) {\n if (that.state !== 3) {\n that.healthBar.updateHealth(-PARAMS.DIFFICULTY);\n ASSET_MANAGER.playAsset(\"./audio/sword_hit_player_knight.mp3\");\n }\n\n }\n\n });\n\n let yVel = Math.abs(this.velocity.y);\n //this physics will need a fine tuning;\n let attackLength = 0;\n if (this.game.One) {\n this.weapon = 0;\n attackLength = 380;\n this.weaponIcon.updateWeapon(0);\n }\n if (this.game.Two) {\n this.weapon = 1;\n attackLength = 450;\n this.weaponIcon.updateWeapon(1);\n }\n if (this.game.Three) {\n this.weapon = 2;\n attackLength = 750;\n this.weaponIcon.updateWeapon(2);\n }\n if (this.attackEnd - this.attackStart > attackLength) {\n this.attacking = false;\n } else {\n this.attacking = true;\n }\n if ((this.attackEnd - this.attackStart > attackLength - 200) && (this.attackEnd - this.attackStart < attackLength) &&\n this.state === 2) {\n this.attackWindow = true;\n } else {\n\n this.attackWindow = false;\n this.arrowFlag = true;\n }\n this.updateBB();\n if (!this.attacking) {\n if (!this.game.B) {\n this.jumpFlag = false;\n }\n if (this.game.right) {\n this.facing = 0;\n this.state = 1;\n } else if (this.game.left) {\n this.facing = 1;\n this.state = 1;\n } else if (this.game.A) {\n this.state = 2;\n if (yVel < 20) {\n this.velocity.x = 0;\n }\n this.bowTime = 0;\n this.attackStart = this.timer.getTime();\n }\n\n if (this.game.B) {\n this.state = 3;\n if (this.velocity.y > 500) this.state = 0;\n } else if (!this.game.A && !this.game.B && !this.game.right && !this.game.left) {\n this.state = 0;\n }\n if (this.game.C) {\n if (this.game.left || this.game.right) {\n this.state = 4;\n }\n acc_run = ACC_SPRINT;\n max_run = MAX_SPRINT;\n }\n if (this.game.A && this.game.B) {\n if (this.velocity.y > 200) this.state = 0;\n else this.state = 3;\n }\n if (this.game.B && this.game.C && (this.game.right || this.game.left)) {\n this.state = 0;\n }\n\n //if moving right and then face left, skid\n if (this.game.left && this.velocity.x > 0 && yVel < 20) {\n this.velocity.x -= TURN_SKID;\n }\n //if moving left ann then face right, skid\n if (this.game.right && this.velocity.x < 0 && yVel < 20) {\n this.velocity.x += TURN_SKID;\n }\n //if you unpress left and right while moving right\n if (!this.game.right && !this.game.left) {\n if (this.facing === 0) { //moving right\n if (this.velocity.x > 0 && yVel < 20) {\n this.velocity.x -= DEC_SKID * TICK;\n } else if (yVel < 20) {\n this.velocity.x = 0;\n } else if (this.velocity.x > 0) { //this is where you control horizontal deceleration when in air\n this.velocity.x -= AIR_DEC;\n }\n } else { //if you unpress left and right while moving left\n if (this.velocity.x < 0 && yVel < 20) {\n this.velocity.x += DEC_SKID * TICK;\n } else if (yVel < 20) {\n this.velocity.x = 0;\n } else if (this.velocity.x < 0) { //this is where you control horizontal deceleration when in air\n this.velocity.x += AIR_DEC;\n }\n }\n }\n //Run physics\n if (this.facing === 0) { //facing right\n if (this.game.right && !this.game.left) { //and pressing right.\n if (yVel < 10 && !this.game.B) { //makes sure you are on ground\n this.velocity.x += acc_run * TICK;\n }\n }\n } else if (this.facing === 1) { //facing left\n if (!this.game.right && this.game.left) { //and pressing left.\n if (yVel < 10 && !this.game.B) { //makes sure you are on ground\n this.velocity.x -= acc_run * TICK;\n }\n }\n }\n\n if (this.game.B) {\n let timeDiff = this.time2 - this.time1;\n if (this.velocity.y === 0) { // add double jump later\n this.time1 = this.timer.getTime();\n this.velocity.y -= JUMP_ACC;\n this.fallAcc = STOP_FALL;\n this.jumpFlag = true;\n } else if (!this.jumpFlag && timeDiff > 100 && timeDiff < 250) {\n this.velocity.y -= DBL_JUMP_MOD;\n this.fallAcc = STOP_FALL;\n }\n }\n if (this.velocity.y < 0) {\n this.state = 3;\n }\n }\n // max speed calculation\n if (this.velocity.x >= max_run) this.velocity.x = max_run;\n if (this.velocity.x <= -max_run) this.velocity.x = -max_run;\n // update position\n this.velocity.y += this.fallAcc * TICK;\n this.y += this.velocity.y * TICK * PARAMS.SCALE;\n if (this.velocity.y >= MAX_FALL) this.velocity.y = MAX_FALL;\n if (this.velocity.y <= -MAX_JUMP) this.velocity.y = -MAX_FALL;\n\n this.x += this.velocity.x * TICK * PARAMS.SCALE;\n if (this.teleport) {\n ASSET_MANAGER.playAsset(\"./audio/teleport.mp3\")\n PARAMS.SAVEDSOULS = PARAMS.SOULS;\n this.phase++;\n this.x = this.portalLocations[this.phase].x;\n this.y = this.portalLocations[this.phase].y;\n PARAMS.XSPAWN = this.x;\n PARAMS.YSPAWN = this.y;\n if (this.phase === 1) {\n this.game.phaseOneDone();\n }\n if (this.phase === 2) {\n ASSET_MANAGER.playAsset(\"./audio/growl.mp3\");\n this.game.phaseTwoDone();\n }\n this.velocity.x = 0;\n this.isKeyed = false;\n this.teleport = false;\n }\n this.updateBB(); //Update your bounding box every tick\n }\n }\n }", "function updateEnemies(){\n\n //animate enemies :\n for(var i=0; i<enemies.length;i++){\n enemies[i].update();\n enemies[i].draw();\n //player ran into enemy\n if(player.minDist(enemies[i]) <= player.width - platformWidth/2){\n console.log(\"Killed by enemies\");\n gameOver();\n }\n }\n\n //remove enemies gone off screen :\n if (enemies[0] && enemies[0].x < -platformWidth) {\n \n enemies.splice(0 ,1);\n }\n }", "function updateBar() {\n\n // total points left in game\n let pointsAvailable = score + updateRemaining();\n\n let winningScore = (pointsAvailable%2 === 0) ?\n (pointsAvailable/2)+1 :\n Math.ceil(pointsAvailable/2);\n\n let pointsUntilWin = winningScore - score;\n let winningPosition = winningScore/maxPoints*100;\n\n //update CSS with new values:\n\n pointsBar.style.width = `${score/maxPoints*100}%`;\n remainingBar.style.width = `${updateRemaining()/maxPoints*100}%`;\n pointer.style.marginLeft = `${winningPosition}%`;\n\n untilWin.innerText = (pointsUntilWin > 0) ?\n `win in ${pointsUntilWin} points` :\n `win achieved`;\n\n if (pointsUntilWin < 0){\n untilWin.style.color = \"white\";\n }\n\n}", "function maxHealthBoost(tempHealth) {\n maxHealth += tempHealth; \n currentHealth = maxHealth;\n maxHealthUpdate();\n parseHealthBarAnimate();\n}", "function cypherTokenDrawBars() {\r\n if (!this.actor || this.data.displayBars === CONST.TOKEN_DISPLAY_MODES.NONE)\r\n return;\r\n\r\n [\"bar1\", \"bar2\", \"bar3\"].forEach((b, i) => {\r\n //0.8: when creating a new tokens, the bars property does not exist...\r\n if (!this.hasOwnProperty(\"bars\"))\r\n return;\r\n\r\n const bar = this.bars[b];\r\n const attr = this.getBarAttribute(b);\r\n\r\n if (!attr || attr.type !== \"bar\")\r\n return bar.visible = false;\r\n\r\n this._drawBar(i, bar, attr);\r\n bar.visible = true;\r\n });\r\n}", "_drawHealthBar() {\n const { x, y, width, height } = this.config;\n this._bar = this.scene.add.rectangle( x, y, width, height,\n this.config.barColor );\n this._bar.setOrigin( 0, 0 );\n }", "function updateVolumeBar()\n {\n\n // get volume percentage as a whole number\n var volumePercentage = (getVolume() * 100).toFixed(0);\n\n // apply percentage to the width of volume bar\n // update text below bar to match percentage\n $(\".volume .volume-bar-percentage\").css({\"width\": volumePercentage + \"%\"});\n $(\".volume .volume-text strong\").text(volumePercentage+ \" %\");\n\n // set bar color\n if (getVolume() > 0.75)\n {\n $(\".volume\").removeClass(\"green yellow red\").addClass(\"green\");\n } else if (getVolume() > 0.25) {\n $(\".volume\").removeClass(\"green yellow red\").addClass(\"yellow\");\n } else {\n $(\".volume\").removeClass(\"green yellow red\").addClass(\"red\");\n }\n\n }", "function updateBar(){\n var bar = $('#progress');\n\tif (variables.progress < 100){\n\t\tvariables.progress += 5;\n\t\tbar.width(variables.progress + '%');\n\t} else {\n\t\tvariables.progress = 0;\n\t\tvariables.videos += 1;\n\t\tbar.width(\"0%\");\n\t\tclearKeys();\n\t\tloadRound();\n\t}\n}", "function increaseHealth() \n{\n if(healthBarScript.healthWidth < 199) \n\t {\n\t healthBarScript.healthWidth = healthBarScript.healthWidth + 1;\n\t }\n}", "update() {\n for ( let i = 0; i < this.barNodes.length; i++ ) {\n this.barNodes[ i ].update();\n }\n }", "function updateBlockedShots()\n{\n totalBlock = T1.blockedShots + T2.blockedShots;\n\n var t1_bar = Math.floor((T1.blockedShots / totalBlock) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-block-shot-num\").innerHTML = \"<b>\" + T1.blockedShots + \"</b>\";\n document.querySelector(\".t2-block-shot-num\").innerHTML = \"<b>\" + T2.blockedShots + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-block-shot-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-block-shot-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function KinkyDungeonUpdateBuffs(delta, endFloor) {\n\t// Tick down buffs the buffs\n\tKinkyDungeonSendEvent(\"tickBuffs\", {delta: delta});\n\tKinkyDungeonTickBuffs(KinkyDungeonPlayerBuffs, delta, endFloor, KinkyDungeonPlayerEntity);\n\tfor (let enemy of KinkyDungeonEntities) {\n\t\tif (!enemy.buffs) enemy.buffs = {};\n\t\tKinkyDungeonTickBuffs(enemy.buffs, delta, endFloor, enemy);\n\t}\n\n\t// Apply the buffs\n\tfor (let b of KinkyDungeonBullets) {\n\t\tif (b.bullet.spell && b.bullet.spell.buffs) { // Apply the buff\n\t\t\tfor (let buff of b.bullet.spell.buffs) {\n\n\t\t\t\tif (buff.player && buff.range >= Math.sqrt((KinkyDungeonPlayerEntity.x - b.x) * (KinkyDungeonPlayerEntity.x - b.x) + (KinkyDungeonPlayerEntity.y - b.y) * (KinkyDungeonPlayerEntity.y - b.y))) {\n\t\t\t\t\tKinkyDungeonApplyBuff(KinkyDungeonPlayerBuffs, buff);\n\t\t\t\t}\n\t\t\t\tif (buff.enemies) {\n\t\t\t\t\tfor (let enemy of KinkyDungeonEntities) {\n\t\t\t\t\t\tif ((KDHostile(enemy) || !buff.noAlly) && (KDAllied(enemy) || !buff.onlyAlly) && buff.range >= Math.sqrt((enemy.x - b.x) * (enemy.x - b.x) + (enemy.y - b.y) * (enemy.y - b.y))) {\n\t\t\t\t\t\t\tKinkyDungeonApplyBuff(enemy.buffs, buff);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function updateBars() {\n const chartBars = document.querySelectorAll(\"#chart-bars g\");\n // Wykonanie na duzych slupkach\n for (let i = 0; i < chartBars.length; i++) {\n const bar = chartBars[i].children;\n // Wykonanie na malych slupkach w duzym slupku\n let yStartingPoint = 79.834364;\n let separation = 0; // Pierwszy odstep jest rowny 0, pozniej 1.1\n for (let rect = 0; rect < bar.length; rect++) {\n const e = bar[rect];\n const numOf = Number(e.getAttribute(\"data-value\")); // Odczytanie ilosci, np. numOfNumbers = 5\n const smallBarHeight = (gridMaxHeight / highestYLable) * numOf; // Wyliczenie jaka powinien miec maly slupek wysokosc\n yStartingPoint -= smallBarHeight; // Dostosowanie poczatkowego punktu w odniesieniu do wysokosci\n const x = parseFloat(e.getAttribute(\"x\"));\n e.setAttribute(\"x\", x + 26); // Przesuiecie starego slupka (o jeden w prawo)\n e.setAttribute(\n \"height\",\n smallBarHeight === 0 ? 0 : smallBarHeight - separation\n );\n e.setAttribute(\"y\", yStartingPoint);\n separation = numOf === 0 && separation === 0 ? 0 : 1.1;\n }\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 updateHealth() {\n if (prefallenState) { // If we are in the prefallen state, we don't lose our vitality\n return;\n }\n // Reduce player health\n playerHealth = playerHealth - 0.5;\n // Constrain the result to a sensible range\n playerHealth = constrain(playerHealth, 0, playerMaxHealth);\n // Check if the player is dead (0 health)\n if (playerHealth === 0) {\n // If so, the game is over\n gameOver = true;\n }\n}", "function setupBars(number,chartDims){\n\tvar i;\n\tvar padding=0.1; //percentage of white space around bars\n\t\n\tvar texture = new PIXI.RenderTexture(renderer, 10, 10);\n\tvar graphics = new PIXI.Graphics();\n\tgraphics.beginFill(0xFF3000);\n\tgraphics.drawRect(0, 0, 10, 10);\n\tgraphics.endFill();\n\ttexture.render(graphics);\n\t\n\tfor (i=0;i<number;i++){\n\t\tbars[i]= new PIXI.Sprite(texture); \n\t\tbardet[i]=new PIXI.Text(' ');\n\t\tstage.addChild(bars[i]);\n\t\tstage.addChild(bardet[i]);\n\t\t//console.log(i);\t\n\t\tbars[i].position.set(chartDims[0]+chartDims[2]*(i/number+1/number*padding),(chartDims[3]*0.9+chartDims[1]))\n\t\tbars[i].width=(chartDims[2]/number*(1.0-2.0*padding))\n\t\tbars[i].height=(chartDims[3]*0.1);\n\t}\n\n\t\n}", "update(){\n //background scrolling\n this.background.tilePositionY -= 1;\n\n //game functionality\n if(!this.gameOver){\n //entity updating\n this.player.update();\n this.textUpdate();\n\n //check to spawn boss\n if(!this.bossActive && this.killsUntilBoss <= this.player.bodyCount){\n this.boss = new SkeletonKnightBoss(\n this, //scene\n config.width/2, //x\n -325, //y\n 'enemies', //sprite\n 'mid_attack1', //start frame of anim\n this.bossLevel\n )\n this.enemyGroup.add(this.boss);\n }\n }\n }", "updatePlayerHp(newHP) {\r\n // Prevents the HP to go lower than 0\r\n this.playerHp = Math.max(newHP, 0);\r\n \r\n // If player health is equal 0 opponent wins\r\n if (this.playerHp === 0) {\r\n return 0;\r\n }\r\n \r\n // Update the player hp bar\r\n const barWidth = (this.playerHp / this.totalHp) * 100;\r\n this.playerHpElement.style.width = barWidth + '%';\r\n\r\n return 1;\r\n }", "function HealthBar(width, height, owner, offsetX, offsetY) {\n if (offsetX === void 0) { offsetX = 0; }\n if (offsetY === void 0) { offsetY = -50; }\n this._size = undefined;\n this._offset = undefined;\n this._centerOffset = new vector2D_2.default(0, 0);\n this._progressOffset = new vector2D_2.default(0, 0);\n /**\n * Whether or not the HitpointBar is visible.\n */\n this.visible = true;\n /**\n * Whether or not the HitPointBar should be horizontally centered relative to the owner's position.\n */\n this.center = true;\n this._size = new size_3.default(width, height);\n this._offset = new vector2D_2.default(offsetX, offsetY);\n this._owner = owner;\n this.base = new healthBarElement_1.HealthBarBase(color_11.default.white, color_11.default.white, 1, this);\n this.progress = new healthBarElement_1.HealthBarProgress(color_11.default.black, color_11.default.black, 0, this);\n this.base.transparency = 0.2;\n this.progress.transparency = 0.5;\n }", "function updateShotsOffGoal()\n{\n totalShotsOff = T1.shotsOffGoal + T2.shotsOffGoal;\n\n var t1_bar = Math.floor((T1.shotsOffGoal / totalShotsOff) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-shots-off-num\").innerHTML = \"<b>\" + T1.shotsOffGoal + \"</b>\";\n document.querySelector(\".t2-shots-off-num\").innerHTML = \"<b>\" + T2.shotsOffGoal + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-shots-off-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-shots-off-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "update() {\n // did player collide with enemy?\n for (let enemy of allEnemies) {\n // collision? from http://blog.sklambert.com/html5-canvas-game-2d-collision-detection/#d-collision-detection\n if (this.x < enemy.x + enemy.collisionWidth && this.x + this.collisionWidth > enemy.x && this.y < enemy.y + enemy.collisionHeight && this.y + this.collisionHeight > enemy.y) {\n // if yes change score and reset to start\n this.restart();\n hearts.reduceHearts();\n this.blink();\n }\n }\n // item collected?\n for (let item of allItems) {\n if (item != player) {\n if (this.x < item.x + item.collisionWidth && this.x + this.collisionWidth > item.x && this.y < item.y + item.collisionHeight && this.y + this.collisionHeight > item.y) { \n item.xPointShow = item.x;\n item.yPointShow = item.y;\n item.collision = true;\n item.add();\n item.disappear();\n } \n }\n }\n }", "function updateVerticalBar(sTodayStat)\n{\n let iStat = (today.local[sTodayStat] || 0);\n let iGoal = (goals[sTodayStat] || 0);\n let iPercent = Math.floor(iStat/iGoal*100);\n \n var el = document.getElementById(sTodayStat);\n var elBG = document.getElementById(\"background\");\n var iScreenHeight = elBG.getBBox().height;\n var iBarHeight = Math.floor(iPercent * (iScreenHeight/100));\n el.height = iBarHeight;\n el.y = iScreenHeight/2-iBarHeight/2;\n \n colourStat(el, iPercent);\n}", "update() {\r\n for (let enemy of allEnemies) {\r\n\r\n if (this.y === enemy.y && (enemy.x + enemy.step / 4 > this.x &&\r\n enemy.x < this.x + this.step / 4)) {\r\n this.reset();\r\n }\r\n\r\n if (this.y === 120) {\r\n console.log(\"Hi\");\r\n this.reset();\r\n\r\n };\r\n //Matthew Crawford's arcade game walkthrough was used to get a basic start on collision and enemy rendering\r\n\r\n //Shows when the player wins after level 3 has been reached\r\n\r\n if (this.y === 17) {\r\n this.reset();\r\n level++;\r\n if (level > 3) {\r\n $('h3').css(\"display\", \"block\").append('You have Won!');\r\n setTimeout(Result, 999);\r\n level = 1;\r\n }\r\n document.getElementById(\"myspan\").innerHTML = level;\r\n }\r\n }\r\n\r\n }", "function maxHealthUpdate() {\r\n hbIncrement = hbWidth/maxHealth; \r\n}", "function updateStats() {\n $(\"#fighterhealth\").text(\"HP:\\xa0\" + fighterHP);\n $(\"#defenderhealth\").text(\"HP:\\xa0\" + defenderHP);\n }", "function advanceTimers() {\n // Checks if the enemy timer has reached its max\n if (enemy.timer >= 100) {\n // flag the enemy can go and run their attack\n enemyCanGo = true;\n enemyAttackPlayer();\n }\n // if not, advance the timer\n if (!enemyCanGo) {\n // this should be done in one line? But we pin the width to 100 to prevent from status bar overflow (hidden- duh)\n enemy.timer += enemy.attackWaitInc;\n enemy.timer = (enemy.timer > 100) ? 100 : enemy.timer;\n }\n // Player is exactly the same\n if (player.timer >= 100) {\n playerCanGo = true;\n }\n if (!playerCanGo) {\n player.timer += player.attackWaitInc;\n player.timer = (player.timer > 100) ? 100 : player.timer;\n\n }\n // update status bars.\n $(\"#player-attack-progress\").css(\"width\", player.timer + \"%\");\n $(\"#enemy-attack-progress\").css(\"width\", enemy.timer + \"%\");\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}", "updateEnemies() {\n this.liveEnemies.forEach(enemy => {\n // If patrolling, just continue to edge of screen before turning around\n if (enemy.enemyAction === EnemyActions.Patrol) {\n //console.log(enemy);\n // These should be changed to not be hard coded eventually\n if (enemy.enemySprite.body.position.x < 50) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.x > 1850) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.y < 50) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n if (enemy.enemySprite.body.position.y > 1000) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n // check if we are near an object, if yes, try and guard it. Not sure if this is working - Disabling for now\n //console.log(this.isNearObject(enemy.enemySprite));\n if (null != null) {\n console.log(\"Is near an object\");\n enemy.enemySprite.body.velocity.y = 0;\n enemy.updateAction(EnemyActions.Guard, null);\n }\n // Otherwise, wait for attack cooldown before attacking the player\n else {\n if (enemy.attackCooldown === 0) {\n enemy.attackCooldown = Math.floor(Math.random() * 2000);\n enemy.updateAction(EnemyActions.Attack, this.level.player);\n }\n else {\n enemy.attackCooldown = enemy.attackCooldown - 1;\n }\n }\n }\n\n // Guard the item\n if (enemy.enemyAction === EnemyActions.Guard) {\n enemy.guard();\n }\n\n // Attack the player\n if (enemy.enemyAction === EnemyActions.Attack) {\n enemy.attack();\n }\n\n // check if animation needs to be flipped\n if (enemy.enemySprite.body.velocity.x < 0) {\n enemy.enemySprite.scale.x = -1;\n }\n else if (enemy.enemySprite.body.velocity.x > 0) enemy.enemySprite.scale.x = 1;\n });\n }", "function healthCheck() {\n for (var i = 0; i < partyMemberArray.length; i++) {\n if (partyMemberArray[i].hp < 1) {\n partyMemberArray[i].KO = true;\n partyMemberArray[i].hp = 0;\n if (fighter.KO) {\n $(\"#playerCharacter1\").animate({\n opacity: '0.5',\n });\n }\n if (whiteMage.KO) {\n $(\"#playerCharacter2\").animate({\n opacity: '0.5',\n });\n }\n if (blackMage.KO) {\n $(\"#playerCharacter3\").animate({\n opacity: '0.5',\n });\n }\n }\n }\n}", "update() {\n for (var i in Player.list) {\n this.takenByEnemy(Player.list[i]);\n }\n }", "function updateShotsOffGoal()\n{\n\tvar totalShotsOffGoal = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.shotsOffGoal += 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\ttotalShotsOffGoal = T1.shotsOffGoal + T2.shotsOffGoal;\n\n\t\tvar t1_bar = Math.floor((T1.shotsOffGoal / totalShotsOffGoal) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-shots-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-shots-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-shots-off-name\")[0].innerHTML = \"<b>Shots off Goal: \" + T1.shotsOffGoal + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.shotsOffGoal += 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\ttotalShotsOffGoal = T1.shotsOffGoal + T2.shotsOffGoal;\n\n\t\tvar t2_bar = Math.floor((T2.shotsOffGoal / totalShotsOffGoal) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-shots-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-shots-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-shots-off-name\")[0].innerHTML = \"<b>Shots off Goal: \" + T2.shotsOffGoal + \"</b>\";\n\t}\n}", "function parseHealthBar() {\n if (hbReady) {\n hbReady = false;\n drawHealthBar();\n setTimeout(setHBReady(), 250);\n }\n}", "function changeHP (who, amount) {\n\t// validate 'who'. must be either 'char', or 'mob'. default to character\n\tsubject = (who == \"mob\") ? \"mob\" : \"char\";\n\t// amount needs to be a number\n\tamount = (isNaN (parseInt (amount, 10))) ? 0 : parseInt (amount, 10);\n\t\n\t// don't let the health drop below zero\n\tif (amount < 0) amount = 0;\n\t\n\tgame_state[subject]['hp'] = amount;\n\t$('.'+subject+'_health').html (amount);\n\t\n\t// what percent is amount of the full health?\n\tpercent_health = (game_state[subject]['hp']/game_state[subject]['max_hp']) * 100;\n\t\n\t$('.'+subject+'_health_bar').animate ({width: percent_health+\"px\"}).css('overflow', 'visible');\n}", "function maxHealthUpdate() {\n hbIncrement = hbWidth/maxHealth; \n}", "updateHp(hp1, hp2){\n $(\"div#player span.health\").text(hp1);\n $(\"div#enemy span.health\").text(hp2);\n }", "function updateEndEnemies(enemyArr, currEnemy)\r\n{\r\n //if we shot the leftmost or rightmost enemy, update\r\n if(currEnemy == leftEnemy)\r\n {\r\n while(leftMostCol < 10){\r\n if(enemiesR3[leftMostCol].alive)\r\n {\r\n leftEnemy = enemiesR3[leftMostCol];\r\n break;\r\n }\r\n else if(enemiesR2[leftMostCol].alive)\r\n {\r\n leftEnemy = enemiesR2[leftMostCol];\r\n break;\r\n }\r\n else if(enemiesR1[leftMostCol].alive)\r\n {\r\n leftEnemy = enemiesR1[leftMostCol];\r\n break;\r\n }\r\n leftMostCol++;\r\n }\r\n }\r\n if(currEnemy == rightEnemy)\r\n {\r\n while(rightMostCol >= 0){\r\n if(enemiesR3[rightMostCol].alive)\r\n {\r\n rightEnemy = enemiesR3[rightMostCol];\r\n break;\r\n }\r\n else if(enemiesR2[rightMostCol].alive)\r\n {\r\n rightEnemy = enemiesR2[rightMostCol];\r\n break;\r\n }\r\n else if(enemiesR1[rightMostCol].alive)\r\n {\r\n rightEnemy = enemiesR1[rightMostCol];\r\n break;\r\n }\r\n rightMostCol--;\r\n }\r\n }\r\n}", "update(dt) {\n //Sets the speed of the enemy\n this.x = this.x + this.speed * dt;\n\n //Sets the column based on the location of the enemy\n if(this.x < 62) {\n this.col = 1;\n } else if(this.x < 163) {\n this.col = 2;\n } else if(this.x < 264) {\n this.col = 3;\n } else if(this.x < 365) {\n this.col = 4;\n } else if(this.x < 465) {\n this.col = 5;\n } else if(this.x < 510) {\n this.col = 7;\n }\n\n //Changes the column based on the location of the enemy\n switch(this.y) {\n case 48:\n this.row = 2;\n break;\n case 131:\n this.row = 3;\n break;\n case 214:\n this.row = 4;\n }\n\n //Monitors collisions by comparing the player's and the enemy's columns and rows\n for(const enemy of allEnemies) {\n if (this.col === player.col && this.row === player.row) {\n player.reset();\n allEnemies = [];\n }\n }\n }", "function parseHealthBar() {\r\n if (hbReady) {\r\n hbReady = false;\r\n drawHealthBar();\r\n setTimeout(setHBReady(), 250);\r\n }\r\n}", "function updateDisp()\n\t\t\t{\n// Updates the numbers and graphics for the 4 main stats\n\t\t\t\tdocument.querySelector(\".healthValue\").innerHTML = health;\n\t\t\t\tdocument.querySelector(\".healthBar\").style.right = (100 - health * 10) + \"%\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".hungerValue\").innerHTML = hunger;\n\t\t\t\tdocument.querySelector(\".hungerBar\").style.right = (100 - hunger * 10) + \"%\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".thirstValue\").innerHTML = thirst;\n\t\t\t\tdocument.querySelector(\".thirstBar\").style.right = (100 - thirst * 10) + \"%\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".staminaValue\").innerHTML = stamina;\n\t\t\t\tdocument.querySelector(\".staminaBar\").style.right = (100 - stamina * 10) + \"%\";\n// Updates the values of the inventory items\n\t\t\t\tdocument.querySelector(\".stoneBank\").innerHTML = stoneBank;\n\t\t\t\tdocument.querySelector(\".leafBank\").innerHTML = leafBank;\n\t\t\t\tdocument.querySelector(\".branchBank\").innerHTML = branchBank;\n\t\t\t\tdocument.querySelector(\".wheatSeedBank\").innerHTML = wheatSeedBank;\n\t\t\t\tdocument.querySelector(\".waterBank\").innerHTML = waterBank;\n\t\t\t\tdocument.querySelector(\".berryBank\").innerHTML = berryBank;\n\t\t\t\tdocument.querySelector(\".fungusBank\").innerHTML = fungusBank;\n\t\t\t\tdocument.querySelector(\".sharpStoneBank\").innerHTML = sharpStoneBank;\n\t\t\t\tdocument.querySelector(\".leafTarpBank\").innerHTML = leafTarpBank;\n\t\t\t\tdocument.querySelector(\".smoothBranchBank\").innerHTML = smoothBranchBank;\n\t\t\t\tdocument.querySelector(\".ropeBank\").innerHTML = ropeBank;\n// Updates various buttons' disabled status and inner text\n\t\t\t\tif (stoneBank >= 2)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sharpenStoneButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sharpenStoneButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (leafBank >= 5 && ropeBank >= 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sewLeavesButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sewLeavesButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (sharpStoneBank >= 1 && branchBank >= 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".smoothBranchButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".smoothBranchButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (branchBank >= 5 && leafBank >= 5)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".makeRopeButton\").disabled = false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".makeRopeButton\").disabled = true;\n\t\t\t\t}\n\t\t\t\tif (pickaxeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (pickaxeTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").innerHTML = \"Tin Pickaxe<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".pickaxeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (axeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (axeTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".axeButton\").innerHTML = \"Tin Axe<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".axeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (shovelTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (shovelTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".shovelButton\").innerHTML = \"Tin Shovel<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".shovelButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (hoeTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (hoeTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".hoeButton\").innerHTML = \"Tin Hoe<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".hoeButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (sickleTier == 0)\n\t\t\t\t{\n\t\t\t\t\tif (sharpStoneBank >= 1 && smoothBranchBank >= 1 && ropeBank >= 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (sickleTier == 1)\n\t\t\t\t{\n\t\t\t\t\tdocument.querySelector(\".sickleButton\").innerHTML = \"Tin Sickle<hr>Tin Ingot (1)<br>Wooden Handle (1)<br>Stone Peg (2)\";\n\t\t\t\t\tif (tinIngotBank >= 1 && woodHandleBank >= 1 && stonePegBank >= 2)\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdocument.querySelector(\".sickleButton\").disabled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdocument.querySelector(\".collectWater\").innerHTML = \"Collect Water (\" + waterTurns + \")\";\n\t\t\t\tdocument.querySelector(\".collectWater\").disabled = !waterTurns;\n\t\t\t\tdocument.querySelector(\".drinkWater\").innerHTML = \"Drink Water (\" + waterBank + \")\";\n\t\t\t\tdocument.querySelector(\".drinkWater\").disabled = !waterBank;\n\t\t\t\tdocument.querySelector(\".collectBerries\").innerHTML = \"Collect Berries (\" + berryTurns + \")\";\n\t\t\t\tdocument.querySelector(\".collectBerries\").disabled = !berryTurns;\n\t\t\t\tdocument.querySelector(\".eatBerries\").innerHTML = \"Eat Berries (\" + berryBank + \")\";\n\t\t\t\t\n\t\t\t\tdocument.querySelector(\".eatFungus\").innerHTML = \"Eat Fungus (\" + fungusBank + \")\";\n\t\t\t\tdocument.querySelector(\".eatFungus\").disabled = !fungusBank;\n\t\t\t\t\n// Checks if the player has died\n\t\t\t\tif (health <= 0)\n\t\t\t\t{\n\t\t\t\t\tdead();\n\t\t\t\t}\n\t\t\t}", "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 fightEnemy() {\r\n\tcurrHpPerc = Math.floor((currentHp / playerDetails.hp) * 100);\r\n\tget(\"player-hp\").style.width = currHpPerc + \"%\";\r\n\tlogArray = [ ]; //wipe log array\r\n\tstartCombat();\r\n}", "function updateShotsOnGoal()\n{\n totalShotsOn = T1.shotsOnGoal + T2.shotsOnGoal;\n\n var t1_bar = Math.floor((T1.shotsOnGoal / totalShotsOn) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-shots-on-num\").innerHTML = \"<b>\" + T1.shotsOnGoal + \"</b>\";\n document.querySelector(\".t2-shots-on-num\").innerHTML = \"<b>\" + T2.shotsOnGoal + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-shots-on-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-shots-on-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function Draw()\n{\n //Clear everything before drawing\n ctx.clearRect(0, 0, objCanvas.width, objCanvas.height);\n \n //Call handlers\n EnemyHandling();\n ProjectileHandling();\n PlayerHandling();\n \n //Draw enemies with their health bars\n arr_enemyObjects.forEach(function(element, index)\n {\n //Draw the object\n ctx.drawImage(element.objSprite, element.x, element.y);\n \n //Draw a health bar for the enemy\n //Start by drawing a black background\n ctx.fillStyle = \"#000000\";\n ctx.fillRect(element.x, element.y, element.objSprite.width, 3);\n //Calculate the length of the health bar according to the remaining health points\n let nbrHealthBarLength = element.intHealthPoints / element.intMaxHealth;\n //Then, draw the health bar\n ctx.fillStyle = \"#FF0000\";\n ctx.fillRect(element.x, element.y, element.objSprite.width * nbrHealthBarLength, 3);\n });\n \n //Draw projectiles\n arr_activeProjectiles.forEach(function(element, index)\n {\n ctx.drawImage(element.objSprite, element.x, element.y);\n });\n \n //Draw player\n ctx.drawImage(objPlayerSprite, intPlayerx, intPlayery);\n \n //Draw the player's score\n ctx.font = \"25px Arial\";\n ctx.fillStyle = \"#000000\";\n let strScoreDisplay = \"Score : \" + intPlayerScore;\n ctx.fillText(strScoreDisplay, (intLevelWidth - ctx.measureText(strScoreDisplay).width) / 2, 32);\n}", "energyDown(){\n this.energy = this.energy - 0.05;//decrease player's energy\n if(player.energy > 0)//if player has energy then show bar\n {\n EnergyBar.x = (EnergyBar.x-0.05);//decrease energy bar\n EnergyBar.setScale((player.energy/player.maxEnergy),1);//scale energy Bar\n energy = player.getEnergy();\n }\n else if(player.energy == 0)//else destroy bar\n {\n EnergyBar.destroy();\n energy = player.getEnergy();\n }\n }", "function updateMultiPlayerStatScreen(currTurn){\n console.log(\"updateMultiPlayerStatScreen\");\n\n //update the color of the strings\n statScreen.MultiPlayer.forEach(function(player, index){\n for (var attrString in player[\"AttributeStrings\"]){\n //ignore AttackRange attribute\n if(player[\"AttributeStrings\"].hasOwnProperty(attrString) && attrString != \"AttackRange\"){ \n player[\"AttributeStrings\"][attrString].setStyle({\n font: \"2em Arial\", \n fill: chooseColor(currTurn, index, attrString) \n });\n }\n }\n }); \n\n //update healthbars only if we're on the multiplayer stat screen\n multiGraphics.clear();\n if(statScreen.ShowAll){\n multiGraphics.beginFill(HEALTH_BAR_COLOR);\n var startX = GAME_WIDTH + 20;\n var MULTI_HEALTHBAR_HEIGHT = 10;\n var strings;\n for (var player in statScreen.MultiPlayer){\n strings = statScreen.MultiPlayer[player].AttributeStrings;\n statScreen.MultiPlayer[player].HealthBar = multiGraphics.drawRect(\n startX, \n strings.MovementSpeed.y + strings.MovementSpeed.height, \n calcHealthBarWidth(currTurn, player),\n MULTI_HEALTHBAR_HEIGHT);\n }\n\n multiGraphics.endFill();\n }\n}", "function updateAchievements() {\r\n //merchant ships\r\n //sloop achievements\r\n //handles unlock 1\r\n if(player.sloop.num >= 10 && unlocks.sloop.a1 != 1) {\r\n gameLog('Yer Sloops have become more profitable! (x2 to Sloop Income)');\r\n player.sloop.gain++;\r\n unlocks.sloop.a1 = 1;\r\n document.getElementById('sloopGain').innerHTML = player.sloop.income;\r\n };\r\n //handles unlock 2\r\n if(player.sloop.num >= 20 && unlocks.sloop.a2 != 1){\r\n gameLog('Yer Sloops have been upgraded! (x2 Sloop Income, 10% Sloop Price Reduction)');\r\n player.sloop.gain *= 2;\r\n player.sloop.price *= 0.90;\r\n unlocks.sloop.a2 = 1;\r\n document.getElementById('sloopGain').innerHTML = player.sloop.income;\r\n };\r\n //handles unlock 3\r\n if(player.sloop.num >= 30 && unlocks.sloop.a3 != 1){\r\n gameLog('Bigger hulls, better buildin\\' for yer Sloops! (X5 Sloop Income, +50 influence, 20% Sloop Price Reduction)');\r\n player.sloop.gain *= 5;\r\n player.influence += 50;\r\n player.sloop.price *= 0.80;\r\n unlocks.sloop.a3 = 1;\r\n document.getElementById('sloopGain').innerHTML = player.sloop.income;\r\n document.getElementById('influence').innerHTML = player.influence;\r\n };\r\n //caravel achievements\r\n //handles unlock 1\r\n if(player.caravel.num >= 5 && unlocks.caravel.a1 != 1){\r\n gameLog('Yer Caravels have become more efficient! (x3 to Caravel Income)');\r\n player.caravel.gain *= 3;\r\n unlocks.caravel.a1 = 1;\r\n document.getElementById('caraGain').innerHTML = player.caravel.income;\r\n };\r\n //handles unlock 2\r\n if(player.caravel.num >= 10 && unlocks.caravel.a2 != 1){\r\n gameLog('The Caravel hulls have been reduced in weight! (x2 to Caravel Income)');\r\n player.caravel.gain *= 2;\r\n unlocks.caravel.a2 = 1;\r\n document.getElementById('caraGain').innerHTML = player.caravel.income;\r\n };\r\n //handles unlock 3\r\n if(player.caravel.num >= 20 && unlocks.caravel.a3 != 1){\r\n gameLog('The Caravel hulls have been reduced in weight! (25% Caravel Price Reduction)');\r\n player.caravel.price *= 0.75;\r\n unlocks.caravel.a3 = 1;\r\n document.getElementById('caraCost').innerHTML = player.caravel.price;\r\n };\r\n //schooner achievements\r\n //handles unlock 1\r\n if(player.schooner.num >= 5 && unlocks.schooner.a1 != 1) {\r\n gameLog('Yer crews have become more experienced! (+5 to Schooner Income)');\r\n player.schooner.gain += 5;\r\n unlocks.schooner.a1 = 1;\r\n document.getElementById('schoGain').innerHTML = player.schooner.income;\r\n };\r\n //handles unlock 2\r\n if(player.schooner.num >= 10 && unlocks.schooner.a2 != 1) {\r\n gameLog('Yer fleet has grown big enough to attract influential merchants! (+7 to Schooner Income, +50 Influence)');\r\n player.schooner.gain += 7;\r\n player.influence += 50;\r\n unlocks.schooner.a2 = 1;\r\n document.getElementById('influence').innerHTML = player.influence;\r\n document.getElementById('schoGain').innerHTML = player.schooner.income;\r\n document.getElementById('schoCost').innerHTML = player.schooner.price;\r\n };\r\n //barquentine acheivements\r\n\r\n\r\n //military ships\r\n //gunboat achievements\r\n //handles unlock 1\r\n if(player.gunboat.num >= 5 && unlocks.gunboat.a1 != 1) {\r\n gameLog('Yer crews have gotten better at privateering, but they demand more wages, Cap\\'n. (+1 to Gunboat Income, x1.02 increase to Gunboat Price)');\r\n player.gunboat.gain++;\r\n player.gunboat.price *= 1.02;\r\n unlocks.gunboat.a1 = 1;\r\n document.getElementById('gunGain').innerHTML = player.gunboat.income;\r\n document.getElementById('gunCost').innerHTML = player.gunboat.price;\r\n };\r\n //handles unlock 2\r\n if(player.gunboat.num >= 15 && unlocks.gunboat.a2 != 1) {\r\n gameLog('The Gunboats have been updated for current times, Cap\\'n! (x3 increase to Gunboat Income)');\r\n player.gunboat.gain *= 3;\r\n unlocks.gunboat.a2 = 1;\r\n document.getElementById('gunGain').innerHTML = player.gunboat.income;\r\n };\r\n //handles unlock 3\r\n if(player.gunboat.num >= 25 && unlocks.gunboat.a3 != 1) {\r\n gameLog('Upgrades to the gunboats\\' sails make \\'em faster, Cap\\'n! (x2 increase to Gunboat Income)');\r\n player.gunboat.gain *= 2;\r\n unlocks.gunboat.a3 = 1;\r\n document.getElementById('gunGain').innerHTML = player.gunboat.income;\r\n };\r\n //brig achievements\r\n //handles unlock 1\r\n if(player.brig.num >= 5 && unlocks.brig.a1 != 1) {\r\n gameLog('Larger brigs have given ye more cannons! (+3 to Brig Income)');\r\n player.brig.gain += 3;\r\n unlocks.brig.a1 = 1;\r\n document.getElementById('brigGain').innerHTML = player.brig.income;\r\n };\r\n //handles unlock 2\r\n if(player.brig.num >= 10 && unlocks.brig.a2 != 1) {\r\n gameLog('Reinforced hulls can take more damage! (x2 to Brig Income)');\r\n player.brig.gain *= 2;\r\n unlocks.brig.a2 = 1;\r\n document.getElementById('brigGain').innerHTML = player.brig.income;\r\n };\r\n if(player.brig.num >= 20 && unlocks.brig.a3 != 1) {\r\n gameLog('Yer Brig hulls now require less materials! (35% Brig Price Reduction)');\r\n player.brig.price *= 0.65;\r\n unlocks.brig.a3 = 1;\r\n document.getElementById('brigCost').innerHTML = player.brig.price;\r\n };\r\n //frigate achievements\r\n //handles unlock 1\r\n if(player.frigate.num >= 10 && unlocks.frigate.a1 != 1) {\r\n gameLog('\\'Avin\\' more frigates in a formation makes them more effective! (x2 to Frigate Income)');\r\n player.frigate.gain *= 2;\r\n unlocks.frigate.a1 = 1;\r\n document.getElementById('frigGain').innerHTML = player.frigate.income;\r\n };\r\n //galleon achievements\r\n\r\n\r\n //building achievements\r\n //tavern achievements\r\n\r\n //mansion achievements\r\n\r\n //plantation achievements\r\n\r\n //fortress achievements\r\n\r\n\r\n}", "update(dt){\n //Handling collisions\n for(let enemy of allEnemies) {\n if (this.y >= enemy.y - 40 && this.y <= enemy.y + 40 && this.x >= enemy.x - 40 && this.x <= enemy.x + 40){\n this.reset();\n }\n }\n //handle winning\n if(this.y === -15){\n alert(\"you won! you escaped the enemy\");\n this.reset();\n }\n\n }", "function healthIndicators() {\n var mobs = Entity.getAll();\n\n for(var i = 0; i < mobs.length; i++) {\n\n\n var xq = Entity.getX(mobs[i]) - getPlayerX();\n\n var yq = Entity.getY(mobs[i]) - getPlayerY();\n\n var zq = Entity.getZ(mobs[i]) - getPlayerZ();\n\n\n\n if(xq * xq + yq * yq + zq * zq <= 40 * 40 && mobs[i] != getPlayerEnt()) {\n\n if(Entity.getEntityTypeId(mobs[i]) == 10) {\n Entity.setNameTag(mobs[i], nameColor + \"Chicken \" + healthColor + Entity.getHealth(mobs[i]) + \"/4\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 11) {\n Entity.setNameTag(mobs[i], nameColor + \"Cow \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 12) {\n Entity.setNameTag(mobs[i], nameColor + \"Pig \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 13) {\n Entity.setNameTag(mobs[i], nameColor + \"Sheep \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 14) {\n Entity.setNameTag(mobs[i], nameColor + \"Wolf \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 15) {\n Entity.setNameTag(mobs[i], nameColor + \"Villager \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 16) {\n Entity.setNameTag(mobs[i], nameColor + \"Mooshroom \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 17) {\n Entity.setNameTag(mobs[i], nameColor + \"Squid \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\nif(Entity.getEntityTypeId(mobs[i]) == 18) {\n Entity.setNameTag(mobs[i], nameColor + \"Rabbit \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 19) {\n Entity.setNameTag(mobs[i], nameColor + \"Bat \" + healthColor + Entity.getHealth(mobs[i]) + \"/6\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 20) {\n Entity.setNameTag(mobs[i], nameColor + \"Iron Golem \" + healthColor + Entity.getHealth(mobs[i]) + \"/100\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 21) {\n Entity.setNameTag(mobs[i], nameColor + \"Snow Golem \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 22) {\n Entity.setNameTag(mobs[i], nameColor + \"Ocelot \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 32) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 33) {\n Entity.setNameTag(mobs[i], nameColor + \"Creeper \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 34) {\n Entity.setNameTag(mobs[i], nameColor + \"Skeleton \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 35) {\n Entity.setNameTag(mobs[i], nameColor + \"Spider \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 36) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie Pigman \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 37) {\n Entity.setNameTag(mobs[i], nameColor + \"Slime \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 38) {\n Entity.setNameTag(mobs[i], nameColor + \"Enderman \" + healthColor + Entity.getHealth(mobs[i]) + \"/40\"); \n }\n if(Entity.getEntityTypeId(mobs[i]) == 39) {\n Entity.setNameTag(mobs[i], nameColor + \"Silverfish \" + healthColor + Entity.getHealth(mobs[i]) + \"/8\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 40) {\n Entity.setNameTag(mobs[i], nameColor + \"Cave Spider \" + healthColor + Entity.getHealth(mobs[i]) + \"/12\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 41) {\n Entity.setNameTag(mobs[i], nameColor + \"Ghast \" + healthColor + Entity.getHealth(mobs[i]) + \"/10\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 42) {\n Entity.setNameTag(mobs[i], nameColor + \"Magma Cube \" + healthColor + Entity.getHealth(mobs[i]) + \"/16\");\n }\n if(Entity.getEntityTypeId(mobs[i]) == 43) {\n Entity.setNameTag(mobs[i], nameColor + \"Blaze \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\");\n }\nif(Entity.getEntityTypeId(mobs[i]) == 44) {\n Entity.setNameTag(mobs[i], nameColor + \"Zombie Villager \" + healthColor + Entity.getHealth(mobs[i]) + \"/20\");\n }\nif(Entity.getEntityTypeId(mobs[i]) == 45) {\n Entity.setNameTag(mobs[i], nameColor + \"Witch \" + healthColor + Entity.getHealth(mobs[i]) + \"/26\");\n }\n }\n }\n}", "function updateBar(){\n\t\t\tdocument.getElementById('misc_progress').style.height = (60 + bars.length * 60) + \"px\";\n\t\t\tfor(var i = 0; i < bars.length; i++){\n\t\t\t\tif(bars[i].bar == \"\" && bars[i].div == \"\"){\n\t\t\t\t\tbars[i].div = document.createElement('div');\n\t\t\t\t\tbars[i].div.innerHTML = '<h4>' + bars[i].title + '</h4>'\n\t\t\t\t\tbars[i].div.id = 'bar' + i;\n\t\t\t\t\tbars[i].div.class = 'bar';\n\t\t\t\t\tdocument.getElementById('misc-progressbar').appendChild(bars[i].div);\n\t\t\t\t\tbars[i].bar = new ProgressBar.Line('#bar' + i, {\n\t\t\t\t\t\tstrokeWidth: 3,\n\t\t\t\t\t\teasing: 'easeInOut',\n\t\t\t\t\t\tduration: 1000,\n\t\t\t\t\t\tcolor: '#878787',\n\t\t\t\t\t\ttrailWidth: 1,\n\t\t\t\t\t\ttrailColor: '#999',\n\t\t\t\t\t\ttext:{\n\t\t\t\t\t\t\tstyle:{\n\t\t\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\t\t\tright: '5px',\n\t\t\t\t\t\t\t\ttop: '0px',\n\t\t\t\t\t\t\t\t'font-size': '18pt'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfrom: {color: '#EBD9FF'},\n\t\t\t\t\t\tto: {color: \"#A550FF\"},\n\t\t\t\t\t\tstep: function (state, bar){\n\t\t\t\t\t\t\tbar.path.setAttribute('stroke', state.color);\n\t\t\t\t\t\t\tbar.setText(Math.round(bar.value() * 1000) / 10 + \"%\");\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\tbars.forEach(function (obj){\n\t\t\t\tonenoteRequest('pages/' + obj.id + '/content', function (content, progressBar = obj.bar){\n\t\t\t\t\tvar parser = new DOMParser();\n\t\t\t\t\tvar dom = parser.parseFromString(content, 'text/html');\n\t\t\t\t\tprogressBar.animate(dom.querySelectorAll('[data-tag=\"to-do:completed\"]').length \n\t\t\t\t\t\t\t\t/ (dom.querySelectorAll('[data-tag=\"to-do:completed\"]').length + dom.querySelectorAll('[data-tag=\"to-do\"]').length));\n\t\t\t\t});\n\t\t\t});\n\t\t}", "update () {\n for(let enemy of allEnemies) {\n // CHECK IF A HIT - ADDED /2 SO HIT REGISTERS AT RIGHT TIME\n if(this.y === enemy.y && (enemy.x + enemy.upDown/2 > this.x && enemy.x < this.x + this.upDown/2)) {\n //console.log('HIT!');\n this.reset();\n }\n\n }\n // CHECK IF PLAYER WINS\n // DID PLAYER REACH END ROW\n // CHECK IF PLAYERS Y PROPERTY IS = THE TOP OF THE GRID 0 + THE CENTERING OFFSET OF 60px\n if(this.y === 60) {\n\n //console.log('win!!');\n this.winGame = true;\n\n }\n }", "function updateEnemies() {\n\tfor (let i = 0; i < enemies.length; i++) {\n\t\tlet xDir;\n\t\tif (enemies[i].enemyDxDir === 1) {\n\t\t\txDir = 1;\n\t\t} else {\n\t\t\txDir = -1;\n\t\t}\n\t\tenemies[i].enemyX += enemies[i].enemyDx * xDir;\n\t\tenemies[i].enemyY += enemies[i].enemyDy;\n\t\tif (\n\t\t\tenemies[i].enemyX < 0 ||\n\t\t\tenemies[i].enemyX > canvas.width ||\n\t\t\tenemies[i].enemyY > canvas.height ||\n\t\t\tenemies[i].enemyAlive === false\n\t\t) {\n\t\t\tenemies.splice(i, 1);\n\t\t}\n\t}\n}", "function updateThrowIns()\n{\n\tvar totalThrowIns = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.throwIns+= 1;\n\n\t\ttotalThrowIns = T1.throwIns + T2.throwIns;\n\n\t\tvar t1_bar = Math.floor((T1.throwIns / totalThrowIns) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-throws-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-throws-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-throws-name\")[0].innerHTML = \"<b>Throw-ins: \" + T1.throwIns + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.throwIns+= 1;\n\n\t\ttotalThrowIns = T1.throwIns + T2.throwIns;\n\n\t\tvar t2_bar = Math.floor((T2.throwIns / totalThrowIns) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-throws-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-throws-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-throws-name\")[0].innerHTML = \"<b>Throw-ins: \" + T2.throwIns + \"</b>\";\n\t}\n}", "function updateEnemySummary() {\n enemyMortgageSummary = []\n enemyPropertiesinPlaySummary = []\n enemyPropertiesinPlayColors = []\n enemyBasicRentSummary = []\n enemyU1Summary = []\n enemyU2Summary = []\n enemyU3Summary = []\n enemyU4Summary = []\n function getMortgages(obj){\n if(obj.inPlay == \"no\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var mortgageStatus = propertyCards.filter(getMortgages);\n $.each(mortgageStatus, function (){enemyMortgageSummary.push(this.name)})\n\n function getinPlay(obj){\n if(obj.inPlay == \"yes\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var inPlayStatus = propertyCards.filter(getinPlay);\n inPlayStatus.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(inPlayStatus, function (){enemyPropertiesinPlaySummary.push(this.name)})\n $.each(inPlayStatus, function (){enemyPropertiesinPlayColors.push(this.color)})\n\n\n function getBasicRent(obj){\n if(obj.rentStatus == \"basic\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var basicRentStatus = propertyCards.filter(getBasicRent);\n $.each(basicRentStatus, function (){enemyBasicRentSummary.push(this.name)})\n\n function getU1(obj){\n if(obj.rentStatus == \"upgrade1\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u1Status = propertyCards.filter(getU1);\n u1Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u1Status, function (){enemyU1Summary.push(this.name)})\n\n function getU2(obj){\n if(obj.rentStatus == \"upgrade2\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u2Status = propertyCards.filter(getU2);\n u2Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u2Status, function (){enemyU2Summary.push(this.name)})\n\n function getU3(obj){\n if(obj.rentStatus == \"upgrade3\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u3Status = propertyCards.filter(getU3);\n u3Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u3Status, function (){enemyU3Summary.push(this.name)})\n\n function getU4(obj){\n if(obj.rentStatus == \"upgrade4\" && obj.owned == \"enemy\"){\n return true;\n }\n }\n var u4Status = propertyCards.filter(getU4);\n u1Status.sort(function(a,b){if(a.color>b.color){return 1}})\n $.each(u4Status, function (){enemyU4Summary.push(this.name)})\n}", "function updateBar(yearIndex, data, barChartWidth, barChartHeight, YUpper, countryPlotList, sectorPlotList) {\n var keysList = Object.keys(data[yearIndex]);\n var countriesCount = countryPlotList.length;\n var sectorBarsCount = sectorPlotList.length;\n\n\n // Form data dictionary and a list of country names.\n var plotData = [];\n var countryNames = [];\n for (var i = 0; i < countryPlotList.length; i++) {\n key = countryPlotList[i];\n\n var countryName = data[yearIndex][key][\"Name\"];\n\n countryNames.push(countryName);\n\n for (var j = 0; j < sectorPlotList.length; j++) {\n var sectorKey = sectorPlotList[j];\n\n var valuesDict = {};\n valuesDict[\"country\"] = countryName;\n valuesDict[\"sectorKey\"] = sectorKey;\n valuesDict[\"sectorEmission\"] = data[yearIndex][key][sectorKey];\n valuesDict[\"countryIndex\"] = i;\n valuesDict[\"sectorIndex\"] = j;\n\n plotData.push(valuesDict);\n };\n };\n\n // Initialise tooltip.\n var barTip = d3.tip()\n .attr(\"class\", \"chartToolTip\");\n\n var barChart = d3.select(\".barChartTransform\");\n\n barChart.call(barTip);\n\n // Ordinal scale for the x-axis to display country names.\n var barXScale = d3.scale.ordinal()\n .domain(countryNames)\n .rangeRoundBands([0, barChartWidth], .1);\n\n // Linear scale to properly set the length of the bars.\n var barYScale = d3.scale.log()\n .domain([0.001, YUpper])\n .range([0, barChartHeight]);\n\n // Defines the x-axis. Placed at the bottom.\n var barXAxis = d3.svg.axis()\n .scale(barXScale)\n .orient(\"bottom\");\n\n // Defines the y-axis. Placed on the left.\n var barYAxis = d3.svg.axis()\n .scale(barYScale)\n .orient(\"left\");\n\n // Remove all old bars, the axes and the title.\n d3.selectAll(\".barRect\").remove();\n d3.selectAll(\".barAxis\").remove();\n d3.select(\"#barTitle\").remove();\n\n // Create chart title.\n var barTitle = barChart.append(\"text\")\n .attr(\"class\", \"title\")\n .attr(\"id\", \"barTitle\")\n .attr(\"x\", 20)\n .attr(\"y\", -10)\n .text(\n \"GHG emission per economic sector in the year \"\n + (parseInt(yearIndex) + 1970)\n );\n\n /**\n * Padding value definitions.\n * groupPadding defines the space before and after a group of bars.\n * rectPadding defines the space between individual bars.\n */\n var groupPadding = 2 + 5 * (6./countriesCount);\n var rectPadding = 1;\n\n // Set width of a group of bars to chart width divided by number of countries.\n var rectGroupWidth = barChartWidth / countriesCount;\n var rectWidth = (rectGroupWidth - 2 * groupPadding) / sectorBarsCount;\n\n barChart.selectAll(\".barRect\")\n .data(plotData)\n .enter()\n .append(\"rect\")\n .attr(\"class\", \"barRect\")\n\n // Sets x based on which country and sector is plotted.\n .attr(\"x\", function(d) {\n return (d[\"countryIndex\"] * rectGroupWidth + groupPadding) + d[\"sectorIndex\"] * rectWidth;\n })\n\n // Sets y based on the GHG emission. Set to 0 if emission is 0 or NaN.\n .attr(\"y\", function(d) {\n // Plot by scale if not 0, else set y to 0.\n var value = Math.abs(d[\"sectorEmission\"]);\n if (value != 0 && isNaN(value) != true) {\n return barChartHeight - barYScale(value);\n }\n else { return 0; }\n })\n\n // Sets height based on which country and sector is plotted.\n .attr(\"height\", function(d) {\n\n // Plot by scale if not 0 or NaN, else set height to 0.\n var value = Math.abs(d[\"sectorEmission\"]);\n if (value != 0 && isNaN(value) != true) { return barYScale(value); }\n else { return 0; }\n })\n\n .attr(\"width\", rectWidth - rectPadding)\n .style(\"fill\", function(d) { return sectorColour[d[\"sectorKey\"]]; })\n\n // Shows and hides the tooltip.\n .on(\"mouseover\", function(d) {\n barTip.html(\n \"<div class='chartToolTipText'>\"\n + \"<span class='tipTitle'>\" + d[\"country\"] + \"</span><br>\"\n + \"Sector: \" + d[\"sectorKey\"] + \"<br>\"\n + \"GHG emission: \" + d[\"sectorEmission\"] + \" kt CO2 equivalent </div>\"\n )\n barTip.show();\n })\n .on(\"mouseout\", barTip.hide);\n\n\n // Adds a g element for an X axis\n d3.select(\".barChartTransform\").append(\"g\")\n .attr(\"class\", \"barAxis\")\n .attr(\"id\", \"barXAxis\")\n .attr(\"transform\", \"translate(0,\" + barChartHeight + \")\")\n .call(barXAxis)\n .append(\"text\")\n .attr(\"class\", \"axisLabel\")\n .attr(\"x\", barChartWidth)\n .attr(\"y\", 30)\n .style(\"font\", \"11px sans-serif\")\n .style(\"text-anchor\", \"start\")\n .text(\"Country\");\n\n // Adds a g element for a Y axis\n d3.select(\".barChartTransform\").append(\"g\")\n .attr(\"class\", \"barAxis\")\n .call(barYAxis)\n .append(\"text\")\n .attr(\"transform\", \"rotate(-90)\")\n .attr(\"y\", -45)\n .attr(\"dy\", \".71em\")\n .style(\"font\", \"11px sans-serif\")\n .style(\"text-anchor\", \"end\")\n .text(\"GHG emission (kt CO2 equivalent)\");\n\n d3.select(\".barChartTransform\").select(\"#barXAxis\").selectAll(\"text\").style(\"text-anchor\", \"start\");\n}", "function renderLifeBarGraphics () {\n SI.game.Renderer.getScene().getContext().drawImage(lifeBarSpriteSheet, lifeBarSpriteInfo.framesCoords[ SI.res.ResourceLoader.getResources().game.properties.HUDLifeBarLife ], 0, lifeBarSpriteInfo.size, lifeBarSpriteInfo.size, lifeStartX, lifeBarY, lifeWidth, lifeBarSpriteInfo.size);\n \n SI.game.Renderer.getScene().getContext().drawImage(lifeBarSpriteSheet, lifeBarSpriteInfo.framesCoords[ SI.res.ResourceLoader.getResources().game.properties.HUDLifeBarLeft ], 0, lifeBarSpriteInfo.size, lifeBarSpriteInfo.size, lifeBarLeftX, lifeBarY, lifeBarSpriteInfo.size, lifeBarSpriteInfo.size);\n \n SI.game.Renderer.getScene().getContext().drawImage(lifeBarSpriteSheet, lifeBarSpriteInfo.framesCoords[ SI.res.ResourceLoader.getResources().game.properties.HUDLifeBarCenter ], 0, lifeBarSpriteInfo.size, lifeBarSpriteInfo.size, lifeBarCenterX, lifeBarY, lifeBarCenterWidth, lifeBarSpriteInfo.size);\n \n SI.game.Renderer.getScene().getContext().drawImage(lifeBarSpriteSheet, lifeBarSpriteInfo.framesCoords[ SI.res.ResourceLoader.getResources().game.properties.HUDLifeBarRight ], 0, lifeBarSpriteInfo.size, lifeBarSpriteInfo.size, lifeBarRightX, lifeBarY, lifeBarSpriteInfo.size, lifeBarSpriteInfo.size);\n }", "function respawnAliveEnemies(enemyArr)\r\n{\r\n HP--;\r\n if(HP <= 0){youLose();}\r\n else{\r\n HPBox.textContent = \"HP = \" + HP;\r\n for(i = 0; i < enemies.length; i++)\r\n {\r\n if(i<10)\r\n {\r\n enemyArr[i].y = 20;\r\n }\r\n else if(i>=10 && i <20)\r\n {\r\n enemyArr[i].y = 70;\r\n }\r\n else if(i>=20 && i < 30)\r\n {\r\n enemyArr[i].y = 120;\r\n }\r\n var iMod = i % 10;\r\n enemyArr[i].x = 42 + (54*iMod);\r\n enemyArr[i].direction = -1;\r\n enemyArr[i].speedy = (enemyArr[i].speedy+0.1);\r\n }\r\n }\r\n}", "updateOtherEnemiesWithCurrentInfo(){\n\t\tfor(var i = 0; i < this.enemies.length; i++){\t\n\t\t\tthis.enemies[i].position.x += this.enemies[i].velX;\n\t\t\tthis.enemies[i].position.y += this.enemies[i].velY;\n\t\t}\n\t}", "function updateChart(bars, n, colorScale){\n //position bars\n bars.attr(\"x\", function(d,i){\n return i * (chartInnerWidth / n) + leftPadding;\n })\n //size/resize bars\n .attr(\"height\", function(d, i){\n return 380 - yScale(parseFloat(d[expressed]));\n })\n .attr(\"y\", function(d,i){\n return yScale(parseFloat(d[expressed])) + topBottomPadding;\n })\n //color/recolor bars\n .style(\"fill\", function(d){\n return choropleth(d,colorScale);\n })\n //at the bottom of updateChart()...add text to chart title\n var chartTitle = d3.select(\".chartTitle\")\n .text(\"Volume in thousands of hectoliters\");\n\n }", "function updateEnemies() {\n\n if (allEnemies.length > 0) {\n for (var enemy = 0 ; enemy < allEnemies.length; enemy++) {\n allEnemies[enemy].move();\n allEnemies[enemy].updateFrequency();\n\n }\n\n }\n}", "function drawHealthState() \n {\n for (let index = 0; index < playerGameObjectsArray.length; index++) \n {\n if (playerGameObjectsArray[index].health >= 76) \n {\n playerGameObjectsArray[index].img = cannonImage;\n } \n if (playerGameObjectsArray[index].health >= 50 && playerGameObjectsArray[index].health <= 75) \n {\n playerGameObjectsArray[index].img = cannonImageDamaged1;\n }\n if (playerGameObjectsArray[index].health >= 1 && playerGameObjectsArray[index].health <= 49) \n {\n playerGameObjectsArray[index].img = cannonImageDamaged2;\n }\n if (playerGameObjectsArray[index].health == 0) \n {\n playerGameObjectsArray[index].img = cannonImageDestroyed;\n } \n\n }\n }", "function monsterbar() {\n var elem = document.getElementById(\"monsterbar\"); \n\tif (monsterhealth > 0) {\t\t\t\n\t\tvar mwidth = monsterhealth/monsterhp * 100;\n\t} else {\n\t\tvar mwidth = 0;\n\t}\n\telem.style.width = mwidth + '%';\n}", "function updateOffsides()\n{\n\tvar totalOffsides = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.offsides += 1;\n\n\t\ttotalOffsides = T1.offsides + T2.offsides;\n\n\t\tvar t1_bar = Math.floor((T1.offsides / totalOffsides) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-off-name\")[0].innerHTML = \"<b>Offsides: \" + T1.offsides + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.offsides += 1;\n\n\t\ttotalOffsides = T1.offsides + T2.offsides;\n\n\t\tvar t2_bar = Math.floor((T2.offsides / totalOffsides) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-off-name\")[0].innerHTML = \"<b>Offsides: \" + T2.offsides + \"</b>\";\n\t}\n}", "function moveBarHover(e){\n\t\t\t\te.preventDefault();\n\n\t\t\t\tvar pokeIndex = $(e.target).closest(\".poke.single\").index();\n\t\t\t\tvar selectorIndex = (pokeIndex == 0) ? 1 : 0;\n\t\t\t\tvar subject = pokeSelectors[pokeIndex].getPokemon();\n\t\t\t\tvar target = pokeSelectors[selectorIndex].getPokemon();\n\t\t\t\tvar moveIndex = $(e.target).closest(\".move-bars\").find(\".move-bar\").index($(e.target).closest(\".move-bar\"));\n\t\t\t\tvar move = subject.chargedMoves[moveIndex];\n\t\t\t\tvar effectiveness = target.typeEffectiveness[move.type];\n\n\t\t\t\tdisplayDamage = battle.calculateDamageByStats(subject, target, subject.getEffectiveStat(0, true), target.getEffectiveStat(1, true), effectiveness, move);\n\n\t\t\t\tpokeSelectors[selectorIndex].animateDamage(displayDamage)\n\t\t\t}", "function updateChart(bars, n, colorScale){\n //position bars\n bars.attr(\"x\", function(d, i){\n return i * (chartInnerWidth / n) + leftPadding;\n })\n //size/resize bars\n .attr(\"height\", function(d, i){\n return 463 - yScale(parseFloat(d[expressed]));\n })\n .attr(\"y\", function(d, i){\n return yScale(parseFloat(d[expressed])) + topBottomPadding;\n })\n //color/recolor bars\n .style(\"fill\", function(d){\n return choropleth(d, colorScale);\n });\n\n //add text to chart title\n var chartTitle = d3.select(\".chartTitle\")\n .text(\"Percent of \" + expressed);\n}", "function update(){\n//stuff to update\nbearer.update();\nshield.update();\n\n// update Backscatter Buster Shots\nfor(var index = 0; index < playerPro.length; index++){\n playerPro[index].update();\n\n // splice to remove projectile if dead\n if(playerPro[index].dead){\n playerPro.splice(index,1);\n }\n}\n\n// update enemies\nfor(var index = 0; index < enemies.length; index++){\n enemies[index].update();\n\n // splice to remove enemy if dead\n if(enemies[index].dead){\n enemies.splice(index,1);\n }\n}\n\n// update enemy projectiles\nfor (var index = 0; index < enemyPro.length; index++){\n enemyPro[index].update();\n\n // splice to remove projectile if dead\n if(enemyPro[index].dead){\n enemyPro.splice(index,1);\n }\n}\n}" ]
[ "0.7557436", "0.6387888", "0.61090773", "0.5945519", "0.5880743", "0.57560307", "0.5620557", "0.5547833", "0.55426073", "0.55151325", "0.55141973", "0.54880273", "0.54811215", "0.544954", "0.54156166", "0.5412472", "0.54001355", "0.53820807", "0.53725255", "0.5326626", "0.5306964", "0.5272357", "0.52396345", "0.5236196", "0.52109355", "0.519179", "0.51899695", "0.51814735", "0.51679534", "0.5158614", "0.5135316", "0.5135207", "0.51320446", "0.51272964", "0.51224786", "0.5109906", "0.5092629", "0.50920916", "0.5072966", "0.50557005", "0.50529593", "0.50368947", "0.50250685", "0.50159305", "0.5013613", "0.5002139", "0.49924472", "0.49817133", "0.49808285", "0.49794242", "0.4978234", "0.49625665", "0.49622706", "0.49542528", "0.49525848", "0.4946568", "0.49156526", "0.49145824", "0.49122572", "0.49042755", "0.49029246", "0.48937663", "0.48897094", "0.48851252", "0.4881954", "0.48763606", "0.4874702", "0.48695505", "0.4863326", "0.48579845", "0.4857388", "0.48520252", "0.48486346", "0.48468664", "0.48446375", "0.48365766", "0.48305398", "0.4828833", "0.48209798", "0.48155883", "0.4813224", "0.4809907", "0.47783142", "0.47763425", "0.4776014", "0.47691178", "0.47673997", "0.47673556", "0.47655016", "0.47637895", "0.47565064", "0.47413415", "0.47398818", "0.47354364", "0.47344425", "0.4732452", "0.47320837", "0.4730897", "0.47296235", "0.47148123" ]
0.66340005
1
updatePlayerBars: ========================================== fight: this function controls the actual battle portion
function fight () { document.querySelector(".message").innerHTML = "You attack " + currentVillain.name + " for " + mainHero.attack + " damage. " //reduces villains health currentVillain.health = currentVillain.health - mainHero.attack; //increases hero's attack power mainHero.attack = mainHero.attack + mainHero.baseAttack; console.log(currentVillain); console.log(mainHero); //this if statement will run if the villain hasn't died yet if (currentVillain.health > 0) { mainHero.health = mainHero.health - currentVillain.counter; $ (".message").append("<br>" + currentVillain.name + " counters for " + currentVillain.counter + " damage.") } //this will update each character's bars updatePlayerBars(mainHero,mainHero.healthClass,mainHero.attackClass); updateEnemyBars(currentVillain,currentVillain.healthClass,currentVillain.attackClass); //this if statement will run if the villain has died if (currentVillain.health <= 0) { attackTime = false; $ (".duelArea").empty(); if (fightersRemaining.length === 0) { gameOver = true; document.querySelector(".message").innerHTML = "You are victorious"; } } if (mainHero.health <= 0) { gameOver = true; console.log("sorry game over"); document.querySelector(".message").innerHTML = "Game Over" } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePlayerBars (fighterClass, fighterHealthClass, fighterAttackClass) {\n\tvar healthPercent;\n\tvar attackPercent;\n\n\thealthPercent = ((fighterClass.health * 100) / fighterClass.healthMax);\n\n\tattackPercent = ((fighterClass.attack * 100) / fighterClass.attackMax);\n\n\tconsole.log(\"player health percent: \" + healthPercent);\n\tconsole.log(\"player attack percent: \" + attackPercent);\n\n\n\t$ (\".\" + fighterHealthClass).css(\"width\",healthPercent + \"%\");\n\t$ (\".\" + fighterAttackClass).css(\"width\",attackPercent + \"%\");\n}", "function updateEnemyBars (fighterClass, fighterHealthClass, fighterCounterClass) {\n\tvar healthPercent;\n\tvar counterPercent;\n\n\thealthPercent = ((fighterClass.health * 100) / fighterClass.healthMax);\n\n\tcounterPercent = ((fighterClass.counter * 100) / fighterClass.counterMax);\n\n\tconsole.log(\"enemy health percent: \" + healthPercent);\n\tconsole.log(\"enemy counter percent: \" + counterPercent);\n\t\n\t//these commands update the bars in the character\n\t$ (\".\" + fighterHealthClass).css(\"width\",healthPercent + \"%\");\n\t$ (\".\" + fighterCounterClass).css(\"width\",counterPercent + \"%\");\n\n}", "update(){\n this.graphics.clear();\n for(let bar of this.healthBars){\n if(!bar.visible){\n continue;\n }\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.health/100);\n this.draw(bar);\n }\n for(let bar of this.progressBars){\n if(bar.track.state === \"closed\"){\n bar.visible = true;\n }\n else{\n bar.visible = false;\n }\n if(bar.visible){\n bar.updatePos();\n bar.outerWidth = bar.barWidth * (bar.track.tapCount/bar.track.maxTap);\n this.draw(bar);\n }\n }\n }", "function updateSinglePlayerHealthBar(currTurn){\n\n var HEALTH_BAR_X = GAME_WIDTH + 10;\n var HEALTH_BAR_Y = 100;\n var HEALTH_BAR_HEIGHT = 20;\n //Calculate the width of the bar as a percentage of the player's current health\n var healthBarWidth = calcHealthBarWidth(currTurn, statScreen.SinglePlayer.PlayerIndex);\n //redraw the health bar\n singleGraphics.beginFill(HEALTH_BAR_COLOR);\n statScreen.SinglePlayer.HealthBar.Bar = singleGraphics.drawRect(\n HEALTH_BAR_X, \n HEALTH_BAR_Y, \n healthBarWidth, \n HEALTH_BAR_HEIGHT);\n singleGraphics.endFill();\n}", "function updateBar() {\n\n // total points left in game\n let pointsAvailable = score + updateRemaining();\n\n let winningScore = (pointsAvailable%2 === 0) ?\n (pointsAvailable/2)+1 :\n Math.ceil(pointsAvailable/2);\n\n let pointsUntilWin = winningScore - score;\n let winningPosition = winningScore/maxPoints*100;\n\n //update CSS with new values:\n\n pointsBar.style.width = `${score/maxPoints*100}%`;\n remainingBar.style.width = `${updateRemaining()/maxPoints*100}%`;\n pointer.style.marginLeft = `${winningPosition}%`;\n\n untilWin.innerText = (pointsUntilWin > 0) ?\n `win in ${pointsUntilWin} points` :\n `win achieved`;\n\n if (pointsUntilWin < 0){\n untilWin.style.color = \"white\";\n }\n\n}", "function worldUpdate() {\r\n\t$('#distance').html(prettify(Game.world.distance));\r\n\t$('#zone').html(Game.zone);\r\n\r\n\t//enemy\r\n\t$('#enemyHealth').html(prettify(Game.enemy.health));\r\n\r\n\tvar enemyHealthBar = document.getElementById(\"enemyHealthBar\");\r\n\tvar hp = (Game.enemy.health / Game.enemy.totalhealth) * 100;\r\n\tenemyHealthBar.style.width = hp + '%';\r\n\r\n\tif (Game.enemy.health >= Game.enemy.totalhealth) Game.enemy.health = Game.enemy.totalhealth;\r\n\r\n\tif (Game.enemy.health <= 0) {\r\n\t\tenemyHealthBar.style.width = '0%';\r\n\t\tendFight();\r\n\t}\r\n}", "function updateBlockedShots()\n{\n totalBlock = T1.blockedShots + T2.blockedShots;\n\n var t1_bar = Math.floor((T1.blockedShots / totalBlock) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-block-shot-num\").innerHTML = \"<b>\" + T1.blockedShots + \"</b>\";\n document.querySelector(\".t2-block-shot-num\").innerHTML = \"<b>\" + T2.blockedShots + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-block-shot-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-block-shot-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function movePlayerBar(){\n\t\t\tvar position=texture.getPosition();\n\t\t\tvar y1=position.y;\n\t\t\tvar y2=position.y+size.height;\n\t\t\tvar y1_aux=(dir!=1?y1+speed:y1-speed);\n\t\t\tvar y2_aux=(dir!=1?y2+speed:y2-speed);\n\t\t\t\n\t\t\t//Comprobamos que la bola no rebasaria los limites verticales\n\t\t\tif(y1_aux<y_min || y2_aux>y_max){\n\t\t\t\ty1_aux=(y1_aux<y_min)?y_min:y_max-size.height;\n\t\t\t\tstopMove(dir);\n\t\t\t}\n\t\t\ttexture.move(x,y1_aux);\n\t\t\ttexture.fireOnChangeEvent();\n\t\t}", "function updateBarsFrom(owner){\n owner.cards.forEach(function(card){\n //barra de vida\n startedTweens++;\n card.lifeBar.lbl.text = card.life + '/' + card.maxLife;\n var newWidth = card.lifeBar.fullWidth * card.life / card.maxLife;\n var lifeTween = self.game.add.tween(card.lifeBar.mask).to({x: card.lifeBar.mask.originalX + (card.lifeBar.fullWidth - newWidth) * (card.lifeBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n lifeTween.onComplete.add(onTweenCompleted);\n //barra de defensa\n startedTweens++;\n card.defenseBar.lbl.text = card.defense + '/' + card.maxDefense;\n var newWidth = card.defenseBar.fullWidth * card.defense / card.maxDefense;\n var defenseTween = self.game.add.tween(card.defenseBar.mask).to({x: card.defenseBar.mask.originalX + (card.defenseBar.fullWidth - newWidth) * (card.defenseBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n defenseTween.onComplete.add(onTweenCompleted);\n //barra de magia\n startedTweens++;\n card.magicBar.lbl.text = card.magic + '/' + card.maxMagic;\n var newWidth = card.magicBar.fullWidth * card.magic / card.maxMagic;\n var magicTween = self.game.add.tween(card.magicBar.mask).to({x: card.magicBar.mask.originalX + (card.magicBar.fullWidth - newWidth) * (card.magicBar.anchor.x == 0 ? -1 : 1)}, 400, Phaser.Easing.Linear.None, true, 0);\n magicTween.onComplete.add(onTweenCompleted);\n\n if(card.magic == card.maxMagic){\n card.magicFrame.visible = true;\n }\n else {\n card.magicFrame.visible = false;\n }\n\n if(card.life == 0) {\n card.alpha = 0.5;\n } else {\n card.alpha = 1;\n }\n });\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 fight() { //declaring beginning of function\n\n //random formula is - Math.floor(Math.random() * (max - min) + min);\n var minDamage1 = players[0].damage * .5; //calculating the minimum amount of damage player 1 takes (the information from the object created in the players array)\n var minDamage2 = players[1].damage * .5; //calculating the minimum amount of damage player 2 takes (the information from the object created in the players array)\n var f1 = Math.floor(Math.random() * (players[0].damage - minDamage1) + minDamage1); //calculating the amount of damage done to player 1 by subtracting minimum damage from player damage (getting player damage from the object created in players array)\n var f2 = Math.floor(Math.random() * (players[1].damage - minDamage2) + minDamage2); //calculating the amount of damage done to player 2 by subtracting minimum damage from player damage (getting player damage from the object created in players array)\n\n //inflict damage\n players[0].health = players[0].health - f1; //subtract the amount of damage done from the player's \"initial health\", each round the \"initial health\" is changed to the result of this calculation (replacing the health key with the new amount of health for playerOne)\n players[1].health = players[1].health - f2; //subtract the amount of damage done from the player's \"initial health\", each round the \"initial health\" is changed to the result of this calculation (replacing the health key with the new amount of health for playerTwo)\n //console.log(players[0].health, players[1].health); //checking to see if correct math is done (to see why health is displayed as the same)\n\n //check for victor\n var result = winnerCheck(); //variable declared to check if there is a winner by using the winnerCheck() function\n console.log(result); //prints out to the console if there is a winner\n if (result === \"no winner\") //checks the variable result to see if it equals \"no winner\"\n { //if there is no winner, this block of code is ran\n round++; //round number increases\n document.getElementById('kabal').innerHTML = players[0].health; //changing HTML to player's current health\n document.getElementById('kratos').innerHTML = players[1].health; //changing HTML to player's current health\n document.getElementById('round').innerHTML = 'Round ' + round + ' is over!'; //changing HTML so it tells the user what round is done.\n\n\n } else { //if there is a winner, then this block of code is ran\n\n //console.log(document.getElementById('scores').innerHTML);\n document.getElementById('scores').innerHTML = result; //changing the innerHTML of the id scores to the result of winnerCheck() if there is a winner, or both die\n document.getElementById('scores').style.textAlign = 'center'; //centering the text of the result.\n document.getElementById('round').innerHTML = result;\n //alert(result); //an alert with the winner's name is sent to the user\n button.innerHTML = 'Done!';\n button.setAttribute('onclick', null);\n //break; // ends the game\n };\n\n }", "function barUpdate() {\n\t// changes the color of the background depending on the percent\n\tif (Math.abs(($bar.width()/$statusBar.width()) - percentCorrect) == 100 ) {\n\t\tcolorChange(2000);\n\t\t}\n\telse if (Math.abs(($bar.width()/$statusBar.width()) - percentCorrect) >= 30) {\n\t\tcolorChange(1500);\n\t\t}\n\telse {\n\t\tcolorChange(900);\n\t};\n}", "function updateAll() {\n //var marioElem = document.getElementById(\"mario\");\n if (damage > 0) {\n player.health -= damage;\n var fireElem = document.getElementById(\"fire\").attributes\n //document.getElementById(\"mario\").classlist.add(\"vader\")\n }\n\n //totalDamage();\n damage = 0;\n update.innerText = player.health.toString();\n playerName.innerText = player.name;\n displayHits.innerText = player.hits.toString();\n\n if (player.health < 30) {\n document.getElementById(\"player-panel\").classList.add(\"panel-danger\");\n healthBarElem.classList.add('progress-bar-danger');\n } else if (player.health > 30 && player.health < 60) {\n document.getElementById(\"player-panel\").classList.remove(\"panel-danger\");\n document.getElementById(\"player-panel\").classList.add(\"panel-warning\");\n healthBarElem.classList.remove('progress-bar-danger');\n healthBarElem.classList.add('progress-bar-warning');\n } else {\n document.getElementById(\"player-panel\").classList.remove(\"panel-danger\");\n document.getElementById(\"player-panel\").classList.remove(\"panel-warning\");\n document.getElementById(\"player-panel\").classList.add(\"panel-default\");\n healthBarElem.classList.remove('progress-bar-danger');\n healthBarElem.classList.remove('progress-bar-warning');\n healthBarElem.classList.add('progress-bar-success');\n\n\n }\n if (player.health <= 0) {\n termElem.src = 'img/boom-sm.png';\n player.health = 0;\n updateHealthBar();\n // disabled buttons come back after timeout\n disableButtons();\n debugger\n winnerElem.innerText = player.name + \" Wins! The Terminator was destroyed in \" + player.hits + \" hits!\";\n winnerElem.style.color = \"green\";\n clearInterval(interval);\n }\n updateHealthBar();\n\n}", "function updateShotsOffGoal()\n{\n totalShotsOff = T1.shotsOffGoal + T2.shotsOffGoal;\n\n var t1_bar = Math.floor((T1.shotsOffGoal / totalShotsOff) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-shots-off-num\").innerHTML = \"<b>\" + T1.shotsOffGoal + \"</b>\";\n document.querySelector(\".t2-shots-off-num\").innerHTML = \"<b>\" + T2.shotsOffGoal + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-shots-off-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-shots-off-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function animateBars() {\n\n\tuserRegisteredAmount();\n\tAmountofAdv();\n\t\n\tuserProgressBar();\n\tretailerProgressBar();\n\tadsProgressBar();\n\t\n}", "function updateShotsOnGoal()\n{\n totalShotsOn = T1.shotsOnGoal + T2.shotsOnGoal;\n\n var t1_bar = Math.floor((T1.shotsOnGoal / totalShotsOn) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-shots-on-num\").innerHTML = \"<b>\" + T1.shotsOnGoal + \"</b>\";\n document.querySelector(\".t2-shots-on-num\").innerHTML = \"<b>\" + T2.shotsOnGoal + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-shots-on-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-shots-on-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function updateHealthbar() {\n let redPos = redBar.components.position;\n redPos.width = (health - currHealth) / health * redPos.height * 4;\n\n let greenPos = greenBar.components.position;\n greenPos.width = greenPos.height * 4 - redPos.width;\n }", "function update() {\r\n game.physics.arcade.collide(player, layer);\r\n game.physics.arcade.collide(NPC, layer);\r\n game.physics.arcade.collide(layer2, cageKey);\r\n game.physics.arcade.collide(layer, cage);\r\n\r\n collision();\r\n\r\n movement();\r\n\r\n cropRect.width = healthBar.width * (player.health / healthOld);\r\n\r\n healthBar.updateCrop();\r\n\r\n healthOld = player.health;\r\n }", "function fighter(player) {\n var y = player.y - 1;\n\tvar x = player.x - 1;\n\n for(var idx = y; idx < y+3; idx++) {\n \tfor(var idx2 = x; idx2 < x+3; idx2++) {\n if(idx === player.y && idx2 === player.x) {\n } else {\n var area = mapArrays[idx][idx2];\n if(area.terrainType === \"monster\") {\n if(area.monsterType === \"super golem\") {\n currentEnemy = superGolem;\n } else if(area.monsterType === \"dragon\") {\n currentEnemy = dragon;\n } else if(area.monsterType === \"random\") {\n currentEnemy = getMonster();\n }\n combatStarter(currentEnemy);\n if(area.monsterType === \"dragon\") {\n userCommands = [\"attack\", \"potion\", \"equip\"];\n commandDisplayer();\n }\n placedMonsterCombat = true;\n currentEnemyY = area.y;\n currentEnemyX = area.x;\n break;\n }\n }\n }\n }\n}", "function fight (){\n\t//object variable to refence the current defenders stats\n\tvar defend = characters[defender];\n\n\t//object variable to refence the players characters stats\n\tvar player = characters[player_char];\n\n\t//change player's hp by the current defenders counter attack stat\n\tplayer[\"hp\"] -= defend[\"cnter_atk\"];\n\n\t//change the current defender hp based on the players attack stat\n\tdefend[\"hp\"] -= player[\"atk\"];\n\n\t//change the players attack stat by adding the players base attack to the grand total\n\tplayer[\"atk\"] += player[\"base_atk\"];\n\n\t//if the player hp is less then or equal to zero\n\tif (player[\"hp\"] <= 0){\n\t\t// remove the players icon image and replace it with a game over message\n\t\t$( \"div\" ).remove( \"#\"+ player_char);\n\t\t$(\"#your_char\")\n\t\t\t.html(\"<div id=\\\"defeat\\\"><p>You are Dead!</p></div>\");\n\t//else if the defender hp is less than or equal to zero\n\t}else if(defend[\"hp\"] <= 0){\n\t\t//increment number of victories\n\t\tnum_victories++;\n\t\t//if number of victories equal 3 than\n\t\tif (num_victories == 3){\n\t\t\t//remove the defender icon and display a victory message\n\t\t\t$( \"div\" ).remove( \"#\"+defender);\n\t\t\t$(\"#defender\")\n\t\t\t.html(\"<div id=\\\"victory\\\"><p>You Win!</p></div>\");\n\t\t//else remove the defender icon from the page\n\t\t}else{\n\t\t\t$( \"div\" ).remove( \"#\"+defender);\n\t\t}\n\t\t//set defender name to \"\" to allow the player to select the next defender\n\t\tdefender = \"\";\n\t}\n}", "function updateShotsOffGoal()\n{\n\tvar totalShotsOffGoal = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.shotsOffGoal += 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\ttotalShotsOffGoal = T1.shotsOffGoal + T2.shotsOffGoal;\n\n\t\tvar t1_bar = Math.floor((T1.shotsOffGoal / totalShotsOffGoal) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-shots-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-shots-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-shots-off-name\")[0].innerHTML = \"<b>Shots off Goal: \" + T1.shotsOffGoal + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.shotsOffGoal += 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\ttotalShotsOffGoal = T1.shotsOffGoal + T2.shotsOffGoal;\n\n\t\tvar t2_bar = Math.floor((T2.shotsOffGoal / totalShotsOffGoal) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-shots-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-shots-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-shots-off-name\")[0].innerHTML = \"<b>Shots off Goal: \" + T2.shotsOffGoal + \"</b>\";\n\t}\n}", "function updateShotsOnGoal()\n{\n\tvar totalShotsOnGoal = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.shotsOnGoal += 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\ttotalShotsOnGoal = T1.shotsOnGoal + T2.shotsOnGoal;\n\n\t\tvar t1_bar = Math.floor((T1.shotsOnGoal / totalShotsOnGoal) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-shots-on-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-shots-on-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-shots-on-name\")[0].innerHTML = \"<b>Shots on Goal: \" + T1.shotsOnGoal + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.shotsOnGoal += 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\ttotalShotsOnGoal = T1.shotsOnGoal + T2.shotsOnGoal;\n\n\t\tvar t2_bar = Math.floor((T2.shotsOnGoal / totalShotsOnGoal) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-shots-on-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-shots-on-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-shots-on-name\")[0].innerHTML = \"<b>Shots on Goal: \" + T2.shotsOnGoal + \"</b>\";\n\t}\n}", "function battleUpdates(data) {\n\t\t$(\"loading\").classList.add(\"hidden\");\n\t\t$(\"p1-turn-results\").innerText = \"Player 1 played \" + data.results[\"p1-move\"] +\n\t\t\t\t\t\t\t\t\t\t \" and \" + data.results[\"p1-result\"] + \"!\";\n\t\tif (data.results[\"p2-move\"] === null || data.results[\"p2-result\"] === null){\n\t\t\t$(\"p2-turn-results\").classList.add(\"hidden\");\n\t\t} else {\n\t\t\t$(\"p2-turn-results\").innerText = \"Player 2 played \" + data.results[\"p2-move\"] +\n\t\t\t\t\t\t\t\t\t\t \" and \" + data.results[\"p2-result\"] + \"!\";\n\t\t}\n\t\tlet p1Data = data.p1;\n\t\tlet p2Data = data.p2;\n\t\tgameID = data.guid;\n\t\tupdateBuffs(p1Data, \"#my-card \");\n\t\tupdateBuffs(p2Data, \"#their-card \");\n\t\tupdateHP(p1Data, \"#my-card \");\n\t\tupdateHP(p2Data, \"#their-card \");\n\t}", "function updateThrowIns()\n{\n\tvar totalThrowIns = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.throwIns+= 1;\n\n\t\ttotalThrowIns = T1.throwIns + T2.throwIns;\n\n\t\tvar t1_bar = Math.floor((T1.throwIns / totalThrowIns) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-throws-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-throws-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-throws-name\")[0].innerHTML = \"<b>Throw-ins: \" + T1.throwIns + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.throwIns+= 1;\n\n\t\ttotalThrowIns = T1.throwIns + T2.throwIns;\n\n\t\tvar t2_bar = Math.floor((T2.throwIns / totalThrowIns) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-throws-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-throws-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-throws-name\")[0].innerHTML = \"<b>Throw-ins: \" + T2.throwIns + \"</b>\";\n\t}\n}", "function resetDamage(colorsPlaying){\r\n\r\n //S17\r\n\t//since the damage map consists of squares we only need the starting center and an offset\r\n //this number is arbitrary, just trying to center each damage block cluster within damage bar\r\n\t//any changes here must also be reflected in setDamage()\r\n\tvar centerZ = mapSizeZ*.45588;\r\n\t//var centerZ = 1.5;\r\n\t//starting from left die of board, set right half of one damage block (half of 1/15 of board width)\r\n\tvar centerX = -mapSizeX/2 + mapSizeX/(15*2);\r\n\t//var centerX = -3.25;\r\n\r\n\t\t//if a piece is playing set it to the correct position in the zero square\r\n\t\tif(colorsPlaying == \"white\"){\r\n\t\t\toffsetX = .05;\r\n\t\t\toffsetZ = -.05;\r\n\t\t\twhiteDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying == \"yellow\"){\r\n\t\t\toffsetX = .05;\r\n\t\t\toffsetZ = 0.0;\r\n\t\t\tyellowDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying == \"orange\"){\r\n\t\t\toffsetX = .05;\r\n\t\t\toffsetZ = .05;\r\n\t\t\torangeDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying == \"green\"){\r\n\t\t\toffsetX = 0.0;\r\n\t\t\toffsetZ = -.05;\r\n\t\t\tgreenDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying == \"purple\"){\r\n\t\t\toffsetX = -.05;\r\n\t\t\toffsetZ = .05;\r\n\t\t\tpurpleDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying == \"red\"){\r\n\t\t\toffsetX = -.05;\r\n\t\t\toffsetZ = 0.0;\r\n\t\t\tredDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying == \"black\"){\r\n\t\t\toffsetX = -.05;\r\n\t\t\toffsetZ = -.05;\r\n\t\t\tblackDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying == \"blue\"){\r\n\t\t\toffsetX = 0.0;\r\n\t\t\toffsetZ = .05;\r\n\t\t\tblueDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\t//Find correct player based on color\r\n\t\tfor(var i = 1; i <= game.num_of_players; i++)\r\n\t\t{\r\n\t\t\tif(game.player_array[i].player_color == colorsPlaying)\r\n\t\t\t{\r\n\t\t\t\t\tgame.player_array[i].hp = 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\tgame.check_win_or_dead();\r\n}", "function updateFoulsReceived()\n{\n\tvar totalFolRec = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.foulsOn += 1;\n\n\t\ttotalFolRec = T1.foulsOn + T2.foulsOn;\n\n\t\tvar t1_bar = Math.floor((T1.foulsOn / totalFolRec) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-fol-rec-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-fol-rec-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-fol-rec-name\")[0].innerHTML = \"<b>Fouls Received: \" + T1.foulsOn + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.foulsOn += 1;\n\n\t\ttotalFolRec = T1.foulsOn + T2.foulsOn;\n\n\t\tvar t2_bar = Math.floor((T1.foulsOn / totalFolRec) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-fol-rec-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-fol-rec-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-fol-rec-name\")[0].innerHTML = \"<b>Fouls Received: \" + T2.foulsOn + \"</b>\";\n\t}\n}", "function fight() {\n //the HTML to tell the user what the names and healths of both fighters are at the beginning of the fight using array access notation and dot notation to access the values of the object keys.\n fighter1_txt.innerHTML = fighters[0].name + \":\" + fighters[0].health;\n fighter2_txt.innerHTML = fighters[1].name + \":\" + fighters[1].health;\n\n //determines the minimum damage each player will deal in a round and stores the results\n var minDamage1 = fighters[0].damage * .5;\n var minDamage2 = fighters[1].damage * .5;\n\t\t\t\n\t\t// this calculates the damage a player will deal in a round: random damage formula = Math.floor(Math.random() * (max - min) + min) || random damage formula === \"Round number to the nearest integer\"(\"Generate a random number between 0 and 1\" times (max damage that can be dealt - minimum damage that can be dealt) plus 10)\n var f1 = Math.floor(Math.random() * (fighters[0].damage - minDamage1) + minDamage1);\n var f2 = Math.floor(Math.random() * (fighters[1].damage - minDamage2) + minDamage2);\n\n //subtracts the damage value dealt in the round from each player and stores the new values for each player's health back into the objects' keys in the array. This is playerOneHealth-=f2 and playerTwoHealth-=f1 because each player is dealing damage to the other not to themselves.\n fighters[0].health -= f2;\n fighters[1].health -= f1;\n\t\t\t\n //reports to the console the current round in the fight\n console.log(\"~ Round \" + round + \" Results ~\");\n \n //reports to the console the player's name and their health after a round using array access notation and dot notation for the object.\n console.log(fighters[0].name + \": \" + fighters[0].health + \" | \" + fighters[1].name + \": \" + fighters[1].health);\n\n //checks for the victor of the fight by running the winnerCheck() function at the end of each round and stores the value that was output by the function into a variable\n var result = winnerCheck();\n \n //reports to the console the results of the round in the fight or the fight itself depending on the value of the variable.\n console.log(\"Verdict = \" + result);\n \n //once the fight starts, the HTML on the page prompting to start the fight changes to a title announcing the results of the round and overall fight.\n round_txt.innerHTML = \"ROUND #\" + round + \" Results:\";\n \n //the round is incremented by 1.\n round++;\n \n //if the result of the round is that neither player won -\n if (result === \"no winner\") { \n //the user is alerted of both players' healths at the end of the round by having the new values that have been stored be displayed dynamically on the page.\n fighter1_txt.innerHTML = \"<b>\" + fighters[0].name + \"</b>: <span style = 'color: #558151; text-shadow: 2px 0px #ccc;'>\" + fighters[0].health + \"</span>\";\n fighter2_txt.innerHTML = \"<b>\" + fighters[1].name + \"</b>: <span style = 'color: #558151; text-shadow: 2px 0px #ccc;'>\" + fighters[1].health + \"</span>\";\n //otherwise if there is a result other than \"no winner\" \n } else {\n //alert the user through the page of the result of the fight.\n fighter1_txt.innerHTML = \"<b><span style = 'color: #558151; text-shadow: 2px 0px #ccc;'>\" + result + \"</span></b>\";\n fighter2_txt.innerHTML = \"\";\n\t\t\t\t\n //this disables the button/event after the fight is over.\n button.removeEventListener(\"click\", fight, false);\n \n //this changes the text in the fight button to show the fight is done.\n document.querySelector('.buttonstyle').innerHTML = \"DONE!\";\n }\n }", "function updateBar(){\n var bar = $('#progress');\n\tif (variables.progress < 100){\n\t\tvariables.progress += 5;\n\t\tbar.width(variables.progress + '%');\n\t} else {\n\t\tvariables.progress = 0;\n\t\tvariables.videos += 1;\n\t\tbar.width(\"0%\");\n\t\tclearKeys();\n\t\tloadRound();\n\t}\n}", "function updateFoulsCommited()\n{\n totalFoulsComm = T1.foulsBy + T2.foulsBy;\n\n var t1_bar = Math.floor((T1.foulsBy / totalFoulsComm) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-foul-comm-num\").innerHTML = \"<b>\" + T1.foulsBy + \"</b>\";\n document.querySelector(\".t2-foul-comm-num\").innerHTML = \"<b>\" + T2.foulsBy + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-foul-comm-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-foul-comm-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function updateGoalAttempts()\n{\n totalGoalAttempts = T1.totalShots + T2.totalShots;\n\n var t1_bar = Math.floor((T1.totalShots / totalGoalAttempts) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-goal-att-num\").innerHTML = \"<b>\" + T1.totalShots + \"</b>\";\n document.querySelector(\".t2-goal-att-num\").innerHTML = \"<b>\" + T2.totalShots + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-goal-att-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-goal-att-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function fightEnemy() {\r\n\tcurrHpPerc = Math.floor((currentHp / playerDetails.hp) * 100);\r\n\tget(\"player-hp\").style.width = currHpPerc + \"%\";\r\n\tlogArray = [ ]; //wipe log array\r\n\tstartCombat();\r\n}", "function changeBars()\n{\n //if the mouse is on bottom left point...\n if(mouseX < x[0]+15+200 && mouseX > x[0]-15+200 && mouseY < y[0]+15+250 && mouseY > y[0]-15+250)\n {\n //if user is pressing the mouse...\n if(mouseIsPressed)\n {\n x[0]=mouseX-200;\n }\n }\n //if the mouse is on top left point...\n else if(mouseX < x[1]+15+200 && mouseX > x[1]-15+200 && mouseY < y[1]+15+250 && mouseY > y[1]-15+250)\n {\n //if user is pressing the mouse...\n if(mouseIsPressed)\n {\n x[1]=mouseX-200;\n //keeps the point above the fixed bar for the trig functions to work...\n if(mouseY <= y[0]+250)\n {\n y[1]=mouseY-250;\n }\n }\n }\n //if the mouse is on top right point...\n else if(mouseX < x[2]+15+200 && mouseX > x[2]-15+200 && mouseY < y[2]+15+250 && mouseY > y[2]-15+250)\n {\n //if user is pressing the mouse...\n if(mouseIsPressed)\n {\n x[2]=mouseX-200;\n y[2]=mouseY-250;\n }\n }\n //if the mouse is on bottom right point...\n else if(mouseX < x[3]+15+200 && mouseX > x[3]-15+200 && mouseY < y[3]+15+250 && mouseY > y[3]-15+250)\n {\n //if user is pressing the mouse...\n if(mouseIsPressed)\n {\n x[3]=mouseX-200;\n }\n }\n}", "function updateFoulsCommited()\n{\n\tvar totalFolComm = 0;\n\n\t//IF team 1 is in possession, foul is commited by team 2, therefore add info to team 2\n\tif(currTeam == 1) \n\t{\n\t\tT2.foulsBy += 1;\n\n\t\ttotalFolComm = T1.foulsBy + T2.foulsBy;\n\n\t\tvar t2_bar = Math.floor((T2.foulsBy / totalFolComm) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-fol-comm-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-fol-comm-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-fol-comm-name\")[0].innerHTML = \"<b>Fouls Commited: \" + T2.foulsBy + \"</b>\";\n\t}\n\t//IF team 2 is in possession, foul is commited by team 1, therefore add info to team 1\n\telse\n\t{\n\t\tT1.foulsBy += 1;\n\n\t\ttotalFolComm = T1.foulsBy + T2.foulsBy;\n\n\t\tvar t1_bar = Math.floor((T1.foulsBy / totalFolComm) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-fol-comm-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-fol-comm-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-fol-comm-name\")[0].innerHTML = \"<b>Fouls Commited: \" + T1.foulsBy + \"</b>\";\n\t}\n}", "function updateOffsides()\n{\n\tvar totalOffsides = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.offsides += 1;\n\n\t\ttotalOffsides = T1.offsides + T2.offsides;\n\n\t\tvar t1_bar = Math.floor((T1.offsides / totalOffsides) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-off-name\")[0].innerHTML = \"<b>Offsides: \" + T1.offsides + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.offsides += 1;\n\n\t\ttotalOffsides = T1.offsides + T2.offsides;\n\n\t\tvar t2_bar = Math.floor((T2.offsides / totalOffsides) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-off-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-off-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-off-name\")[0].innerHTML = \"<b>Offsides: \" + T2.offsides + \"</b>\";\n\t}\n}", "function updatebar(){\r\n \tif (width > 168){\r\n \t\tif (width < 220){\r\n \t\t\ttakeoff = 21\r\n \t\t\twidth = width - takeoff\r\n }else if (width < 350){\r\n takeoff = 42\r\n width = width - takeoff\r\n }else if (width < 400){\r\n \ttakeoff = 80\r\n \twidth = width - takeoff\r\n }else if (width < 500){\r\n \ttakeoff = 140\r\n \twidth = width - takeoff\r\n \r\n }\r\n document.getElementById('barcum').style.width = width + 'px'\r\n \t}else if (width < 168){\r\n \t\twidth = 168\r\n \t\tdocument.getElementById('barcum').style.width = width + 'px'\r\n \t\r\n\r\n }}", "function update (){\n\t//if its not gameover update food\n\tif (!pause && !gameOver){\n\t\tMAX_FOOD_LENGTH=player.width*0.8;\n\t\tMIN_FOOD_LENGTH = player.width * 0.05;\n\t\tfor (var i=0; i<allFood.length; i++){\n\t\t\tallFood[i].update();\n\t\t}\n\t\tfor(var i=0; i<allFood.length; i++){\n\t\t\tif(allFood[i].y>HEIGHT) allFood.splice(i, 1);\n\t\t}\t\t\n\t}\n\n\t//if playing update fish \n\tif(!pause && play && !gameOver){\n\t\tplayer.update();\n\t\tpause_icon.width=pause_icon.naturalWidth*0.1;\n\t\tpause_icon.height=pause_icon.naturalHeight*0.1;\n\t\tif(mouseX>0 && mouseX<pause_icon.width*0.1+40 && mouseY>0 && mouseY<pause_icon.height*0.1+40){\n\t\t\tpause_icon.width*=1.5;\n\t\t\tpause_icon.height*=1.5;\n\t\t}\n\t\tsoundOff_icon.width=soundOff_icon.naturalWidth*0.02;\n\t\tsoundOff_icon.height=soundOff_icon.naturalHeight*0.02;\n\t\tsoundOn_icon.width=soundOn_icon.naturalWidth*0.02;\n\t\tsoundOn_icon.height=soundOn_icon.naturalHeight*0.02;\n\t\t\n\t\tif(mouseX>pause_icon.width+25 && mouseX<pause_icon.width+soundOn_icon.width+30 && mouseY>0 && mouseY<soundOn_icon.height+20){\n\t\t\tif(mute){\n\t\t\t\tsoundOff_icon.width*=1.5;\n\t\t\t\tsoundOff_icon.height*=1.5;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tsoundOn_icon.width*=1.5;\n\t\t\t\tsoundOn_icon.height*=1.5;\n\t\t\t}\n\t\t}\n\t\tif(LEVEL_COUNT!=5 && score>LEVELS[LEVEL_COUNT]){\n\t\t\tDRAG+=0.01;\n\t\t\tdeleteAllFood();\n\t\t\tLEVEL_COUNT++;\n\t\t\tsetTimeout(function (){\n\t\t\t\tfor(var i=0; i<LEVEL_COUNT; i++) addFood();\n\t\t\t}, 10000);\n\t\t\t\n\t\t}\n\n\t}\n\telse if(!gameOver){\n\t\tmainMenu.update();\n\t}\n\t\n}", "function healthCheck() {\n for (var i = 0; i < partyMemberArray.length; i++) {\n if (partyMemberArray[i].hp < 1) {\n partyMemberArray[i].KO = true;\n partyMemberArray[i].hp = 0;\n if (fighter.KO) {\n $(\"#playerCharacter1\").animate({\n opacity: '0.5',\n });\n }\n if (whiteMage.KO) {\n $(\"#playerCharacter2\").animate({\n opacity: '0.5',\n });\n }\n if (blackMage.KO) {\n $(\"#playerCharacter3\").animate({\n opacity: '0.5',\n });\n }\n }\n }\n}", "function draw() {\r\n for (var index = 0; index < bar.length; index++) {\r\n\r\n ctx.fillStyle = barColor;\r\n ctx.clearRect(bar[index].x, bar[index].y, barWidth, bar[index].height);\r\n bar[index].y = getHeight(bar[index].height);\r\n bar[index].x = (index + index) * barPadding + (barWidth * index);\r\n\r\n if (mousePos.x >= bar[index].x - barWidth * 10 &&\r\n mousePos.x < bar[index].x + barWidth * 10 &&\r\n Math.abs(mousePos.y - maxBarHeight / 2) < 100) {\r\n bar[index].direction = -1;\r\n\r\n }\r\n\r\n if (bar[index].height < bar[index].buffHeight && bar[index].direction > 0) {\r\n bar[index].height += speed.grow;\r\n } else if (bar[index].direction > 0) {\r\n bar[index].direction = -1;\r\n }\r\n\r\n // If increasing grow it \r\n if (bar[index].height > bar[index].buffHeight / 1.25 && bar[index].direction < 0) {\r\n bar[index].height -= speed.shrink;\r\n } else if (bar[index].direction < 0) {\r\n bar[index].buffHeight = randomizeHeight(bar[index].x);\r\n bar[index].direction = 1;\r\n }\r\n\r\n ctx.fillRect(bar[index].x, bar[index].y, barWidth, bar[index].height);\r\n }\r\n\r\n var grd = ctx.createLinearGradient(146.000, 0.000, 154.000, 4000.000);\r\n /* var grd = ctx.createLinearGradient(146.000, 0.000, 154.000, 600.000);*/\r\n\r\n // Add colors\r\n grd.addColorStop(0.000, 'rgba(255, 255, 255, 0.000)');\r\n grd.addColorStop(1.000, 'rgba(0, 0, 0, 1.000)');\r\n\r\n // Fill with gradient\r\n ctx.fillStyle = grd;\r\n ctx.fillRect(0, 400, width, 400);\r\n\r\n }", "function syncHealthBar() {\n if (health <= 0) {\n hpBar.frame = hpBar.animations.frameTotal - 1;\n } else {\n let percentGone = (HP - health) / HP;\n let nextFrame = parseInt(hpBar.animations.frameTotal * percentGone);\n if (nextFrame >= 0 && nextFrame < hpBar.animations.frameTotal) {\n hpBar.frame = nextFrame;\n }\n }\n}", "updateBoard() {\r\n for (let tile in this.gameState.state) {\r\n if (this.gameState.state[tile] !== 0) {\r\n $(\"#\"+tile).html((this.gameState.state[tile] === 1) ? this.playerSymbols[0] : this.playerSymbols[1]);\r\n } else {\r\n $(\"#\"+tile).html(\"\");\r\n }\r\n }\r\n //Check for winner, otherwise check for no free spaces (tie)\r\n let winState = this.gameState.checkWin();\r\n if (winState.win) {\r\n this.winner(winState);\r\n } else if(this.gameState.freeSpaces().length === 0) {\r\n this.tie();\r\n }\r\n }", "function updateAchievements() {\r\n //merchant ships\r\n //sloop achievements\r\n //handles unlock 1\r\n if(player.sloop.num >= 10 && unlocks.sloop.a1 != 1) {\r\n gameLog('Yer Sloops have become more profitable! (x2 to Sloop Income)');\r\n player.sloop.gain++;\r\n unlocks.sloop.a1 = 1;\r\n document.getElementById('sloopGain').innerHTML = player.sloop.income;\r\n };\r\n //handles unlock 2\r\n if(player.sloop.num >= 20 && unlocks.sloop.a2 != 1){\r\n gameLog('Yer Sloops have been upgraded! (x2 Sloop Income, 10% Sloop Price Reduction)');\r\n player.sloop.gain *= 2;\r\n player.sloop.price *= 0.90;\r\n unlocks.sloop.a2 = 1;\r\n document.getElementById('sloopGain').innerHTML = player.sloop.income;\r\n };\r\n //handles unlock 3\r\n if(player.sloop.num >= 30 && unlocks.sloop.a3 != 1){\r\n gameLog('Bigger hulls, better buildin\\' for yer Sloops! (X5 Sloop Income, +50 influence, 20% Sloop Price Reduction)');\r\n player.sloop.gain *= 5;\r\n player.influence += 50;\r\n player.sloop.price *= 0.80;\r\n unlocks.sloop.a3 = 1;\r\n document.getElementById('sloopGain').innerHTML = player.sloop.income;\r\n document.getElementById('influence').innerHTML = player.influence;\r\n };\r\n //caravel achievements\r\n //handles unlock 1\r\n if(player.caravel.num >= 5 && unlocks.caravel.a1 != 1){\r\n gameLog('Yer Caravels have become more efficient! (x3 to Caravel Income)');\r\n player.caravel.gain *= 3;\r\n unlocks.caravel.a1 = 1;\r\n document.getElementById('caraGain').innerHTML = player.caravel.income;\r\n };\r\n //handles unlock 2\r\n if(player.caravel.num >= 10 && unlocks.caravel.a2 != 1){\r\n gameLog('The Caravel hulls have been reduced in weight! (x2 to Caravel Income)');\r\n player.caravel.gain *= 2;\r\n unlocks.caravel.a2 = 1;\r\n document.getElementById('caraGain').innerHTML = player.caravel.income;\r\n };\r\n //handles unlock 3\r\n if(player.caravel.num >= 20 && unlocks.caravel.a3 != 1){\r\n gameLog('The Caravel hulls have been reduced in weight! (25% Caravel Price Reduction)');\r\n player.caravel.price *= 0.75;\r\n unlocks.caravel.a3 = 1;\r\n document.getElementById('caraCost').innerHTML = player.caravel.price;\r\n };\r\n //schooner achievements\r\n //handles unlock 1\r\n if(player.schooner.num >= 5 && unlocks.schooner.a1 != 1) {\r\n gameLog('Yer crews have become more experienced! (+5 to Schooner Income)');\r\n player.schooner.gain += 5;\r\n unlocks.schooner.a1 = 1;\r\n document.getElementById('schoGain').innerHTML = player.schooner.income;\r\n };\r\n //handles unlock 2\r\n if(player.schooner.num >= 10 && unlocks.schooner.a2 != 1) {\r\n gameLog('Yer fleet has grown big enough to attract influential merchants! (+7 to Schooner Income, +50 Influence)');\r\n player.schooner.gain += 7;\r\n player.influence += 50;\r\n unlocks.schooner.a2 = 1;\r\n document.getElementById('influence').innerHTML = player.influence;\r\n document.getElementById('schoGain').innerHTML = player.schooner.income;\r\n document.getElementById('schoCost').innerHTML = player.schooner.price;\r\n };\r\n //barquentine acheivements\r\n\r\n\r\n //military ships\r\n //gunboat achievements\r\n //handles unlock 1\r\n if(player.gunboat.num >= 5 && unlocks.gunboat.a1 != 1) {\r\n gameLog('Yer crews have gotten better at privateering, but they demand more wages, Cap\\'n. (+1 to Gunboat Income, x1.02 increase to Gunboat Price)');\r\n player.gunboat.gain++;\r\n player.gunboat.price *= 1.02;\r\n unlocks.gunboat.a1 = 1;\r\n document.getElementById('gunGain').innerHTML = player.gunboat.income;\r\n document.getElementById('gunCost').innerHTML = player.gunboat.price;\r\n };\r\n //handles unlock 2\r\n if(player.gunboat.num >= 15 && unlocks.gunboat.a2 != 1) {\r\n gameLog('The Gunboats have been updated for current times, Cap\\'n! (x3 increase to Gunboat Income)');\r\n player.gunboat.gain *= 3;\r\n unlocks.gunboat.a2 = 1;\r\n document.getElementById('gunGain').innerHTML = player.gunboat.income;\r\n };\r\n //handles unlock 3\r\n if(player.gunboat.num >= 25 && unlocks.gunboat.a3 != 1) {\r\n gameLog('Upgrades to the gunboats\\' sails make \\'em faster, Cap\\'n! (x2 increase to Gunboat Income)');\r\n player.gunboat.gain *= 2;\r\n unlocks.gunboat.a3 = 1;\r\n document.getElementById('gunGain').innerHTML = player.gunboat.income;\r\n };\r\n //brig achievements\r\n //handles unlock 1\r\n if(player.brig.num >= 5 && unlocks.brig.a1 != 1) {\r\n gameLog('Larger brigs have given ye more cannons! (+3 to Brig Income)');\r\n player.brig.gain += 3;\r\n unlocks.brig.a1 = 1;\r\n document.getElementById('brigGain').innerHTML = player.brig.income;\r\n };\r\n //handles unlock 2\r\n if(player.brig.num >= 10 && unlocks.brig.a2 != 1) {\r\n gameLog('Reinforced hulls can take more damage! (x2 to Brig Income)');\r\n player.brig.gain *= 2;\r\n unlocks.brig.a2 = 1;\r\n document.getElementById('brigGain').innerHTML = player.brig.income;\r\n };\r\n if(player.brig.num >= 20 && unlocks.brig.a3 != 1) {\r\n gameLog('Yer Brig hulls now require less materials! (35% Brig Price Reduction)');\r\n player.brig.price *= 0.65;\r\n unlocks.brig.a3 = 1;\r\n document.getElementById('brigCost').innerHTML = player.brig.price;\r\n };\r\n //frigate achievements\r\n //handles unlock 1\r\n if(player.frigate.num >= 10 && unlocks.frigate.a1 != 1) {\r\n gameLog('\\'Avin\\' more frigates in a formation makes them more effective! (x2 to Frigate Income)');\r\n player.frigate.gain *= 2;\r\n unlocks.frigate.a1 = 1;\r\n document.getElementById('frigGain').innerHTML = player.frigate.income;\r\n };\r\n //galleon achievements\r\n\r\n\r\n //building achievements\r\n //tavern achievements\r\n\r\n //mansion achievements\r\n\r\n //plantation achievements\r\n\r\n //fortress achievements\r\n\r\n\r\n}", "function updateIncompletePasses()\n{\n totalIncPasses = T1.incompletePasses + T2.incompletePasses;\n\n var t1_bar = Math.floor((T1.incompletePasses / totalIncPasses) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-pass-inc-num\").innerHTML = \"<b>\" + T1.incompletePasses + \"</b>\";\n document.querySelector(\".t2-pass-inc-num\").innerHTML = \"<b>\" + T2.incompletePasses + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-pass-inc-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-pass-inc-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "update(){\n\t\tif(this.tick){\n\t\t\tthis.depleteBar(.00005);\n\t\t}\n\t}", "function doThings(){\n //gui.writePlayerLoc(\"Player loc: \" + tempPoint);\n gui.writePlayerLoc(\"Fought: \" + fought[xPosPlayer][yPosPlayer]);\n gui.writePlayerPos(\"Player pos: \" + xPosPlayer + \",\" + yPosPlayer);\n \n //a touch ticker, acts as a delay, so that events aren't constantly being fired\n touchTicker++;\n \n //loops through the city array to check if the player is in a city\n for(var i=0;i<cityArr.length;i++){\n if(xPosPlayer=== cityArr[i][0] && yPosPlayer === cityArr[i][1])\n {\n inCity = true;\n //break since we're in a city and need to fight, no use checking the rest\n break;\n }else{\n inCity = false;\n } \n }\n\n //check if the player is in a city\n if(inCity){\n gui.writeBattleStatus(\"In city\");\n gui.hideDebug();\n //check if the battle variable is null(has never been started)\n if(battle){\n //check if there is already a battle underway\n if(!battle.hasStarted()){\n //check if a battle can start\n if(battle.canStart()){\n //check if the player has already fought here\n if(fought[xPosPlayer][yPosPlayer]){\n \n }else{\n //make a new enemy\n enemy = new Enemy();\n //give the enemy random stats\n enemy.ranStats();\n //make a new battle\n battle = new Battle();\n //hide the overworld\n world.hideOverworld();\n //set the input as in a battle, so that the player does not move around in the overworld\n input.intoBattle();\n //start the battle\n battle.start();\n //pause the main music\n music.pause();\n //set the main music to 0(start)\n music.currentTime = 0;\n //play the battle music\n battleMusic.play();\n }\n }\n }\n }else{\n //check if the player has fought on the current tile\n if(fought[xPosPlayer][yPosPlayer]){\n \n }else{\n //make a new enemy\n enemy = new Enemy();\n //give the enemy random stats\n enemy.ranStats();\n //make a new battle\n battle = new Battle();\n //hide the overworld\n world.hideOverworld();\n //set the input as in a battle, so that the player does not move around in the overworld\n input.intoBattle();\n //start the battle\n battle.start();\n //pause the main music\n music.pause();\n //set the main music to 0(start)\n music.currentTime = 0;\n //play the battle music\n battleMusic.play();\n }\n }\n //check if the battle variable null\n if(battle){\n //check if the enemy is not undefined\n if(typeof enemy !== 'undefined'){\n //check if the enemy is dead\n if(enemy.isDead()){\n //set the current tile as fought\n fought[xPosPlayer][yPosPlayer] = true;\n //if a battle has been started\n if(battle.hasStarted()){\n //set the battle as ended\n battle.setEnded();\n //set the input as out of battle, to let the player move around\n input.outOfBattle();\n //set the main musi's time to 0(start)\n music.currentTime = 0;\n }\n //play the main music\n music.play();\n //pause the battle music\n battleMusic.pause();\n //set the battle music's time to 0\n battleMusic.currentTime = 0;\n //\n }else{\n //show the battle GUI\n battle.showGUI();\n //refresh the battle GUI's active button\n battle.refreshActiveBtn();\n //tick the player's action timer\n battle.tickTimer();\n //tick the enemy's action timer\n battle.tickEnemyTimer();\n //cycle through the enemies AI loop\n enemy.enemyLoop();\n }\n }\n }\n }else{\n }\n\n //check if the tick is higher than or equal to defined walk speed\n if(canWalkTick >= walkSpeed){\n //set walk to true\n walk = true;\n //console.log(\"can walk now\");\n }else{\n //set walk to false and increment the tick\n walk = false;\n canWalkTick++;\n }\n gui.writeWalkTick(\"Walk tick: \" + canWalkTick);\n\n//check if the mouse if down\n if(mouseDown){\n //do whatever the actions are\n input.doKeyActions();\n }else{\n //reset the direction boxes\n upBox.graphics.clear();\n leftBox.graphics.clear();\n downBox.graphics.clear();\n rightBox.graphics.clear();\n actionBox.graphics.clear();\n upBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n upBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n leftBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n leftBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n downBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n downBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n rightBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n rightBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n actionBox.graphics.beginFill(boxFillCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n actionBox.graphics.setStrokeStyle(boxStrokeTh, \"round\").beginStroke(boxStrokeCol).drawRoundRect(0,0,boxW,boxH,boxRound);\n //part of the reference for sprite sheets\n //would stop the sprite animtion\n //animation.stop();\n return;\n }\n}", "function fighting() {\n enemies.forEach((enemy, index_enemy) => {\n allies.forEach((ally, index_ally) => {\n if (enemies[index_enemy].combat && allies[index_ally].combat == true) {\n enemies[index_enemy].hp = enemies[index_enemy].hp - allies[index_ally].damage / 60;\n allies[index_ally].hp = allies[index_ally].hp - enemies[index_enemy].damage / 60;\n hit_sound.volume = 0.5;\n hit_sound.play();\n //console.log(\"Enemy HP: \" + enemies[index_enemy].hp);\n //console.log(\"Ally HP: \" + allies[index_ally].hp);\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").src = \"zombie_action2.png\";\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").src = \"adventurer_action2.png\";\n }\n if (enemies[index_enemy].hp < 0) {\n enemies.splice(index_enemy, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n points = points + 30;\n updatePoints();\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").remove();\n }\n if (allies[index_ally].hp < 0) {\n allies.splice(index_ally, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").remove();\n }\n\n });\n });\n // Laat ze doorlopen als combat voorbij is\n allies.forEach((ally, index_ally) => {\n allies[index_ally].combat = false;\n });\n enemies.forEach((enemy, index_enemy) => {\n enemies[index_enemy].combat = false;\n });\n\n}", "function updateMultiPlayerStatScreen(currTurn){\n console.log(\"updateMultiPlayerStatScreen\");\n\n //update the color of the strings\n statScreen.MultiPlayer.forEach(function(player, index){\n for (var attrString in player[\"AttributeStrings\"]){\n //ignore AttackRange attribute\n if(player[\"AttributeStrings\"].hasOwnProperty(attrString) && attrString != \"AttackRange\"){ \n player[\"AttributeStrings\"][attrString].setStyle({\n font: \"2em Arial\", \n fill: chooseColor(currTurn, index, attrString) \n });\n }\n }\n }); \n\n //update healthbars only if we're on the multiplayer stat screen\n multiGraphics.clear();\n if(statScreen.ShowAll){\n multiGraphics.beginFill(HEALTH_BAR_COLOR);\n var startX = GAME_WIDTH + 20;\n var MULTI_HEALTHBAR_HEIGHT = 10;\n var strings;\n for (var player in statScreen.MultiPlayer){\n strings = statScreen.MultiPlayer[player].AttributeStrings;\n statScreen.MultiPlayer[player].HealthBar = multiGraphics.drawRect(\n startX, \n strings.MovementSpeed.y + strings.MovementSpeed.height, \n calcHealthBarWidth(currTurn, player),\n MULTI_HEALTHBAR_HEIGHT);\n }\n\n multiGraphics.endFill();\n }\n}", "function updateFoulsReceived()\n{\n totalFoulsRec = T1.foulsOn + T2.foulsOn;\n\n var t1_bar = Math.floor((T1.foulsOn / totalFoulsRec) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-foul-rec-num\").innerHTML = \"<b>\" + T1.foulsOn + \"</b>\";\n document.querySelector(\".t2-foul-rec-num\").innerHTML = \"<b>\" + T2.foulsOn + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-foul-rec-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-foul-rec-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function updateBoard(){\n draw(levelMap);\n\n /*\n levelMap[player.getCurrentPosition().y][player.getCurrentPosition().x] = 1;\n levelMap[enemy.getCurrentPosition().y][enemy.getCurrentPosition().x] = 2;\n\n if(player.getCurrentPosition().y == levelMap.length - 1) player.setGoalReached(true);\n if(enemy.getCurrentPosition().y == 0) enemy.setGoalReached(true);\n\n draw(levelMap);\n\n //Clean the cells where the player was standed\n levelMap[player.getCurrentPosition().y][player.getCurrentPosition().x] = 0;\n levelMap[enemy.getCurrentPosition().y][enemy.getCurrentPosition().x] = 0;\n\n //Read the x and y positions of player and enemy to put them in the board\n if(!player.getGoalReached()){\n player.setCurrentPosition(player.getCurrentPosition().x,player.getCurrentPosition().y+1);\n }\n\n if(!enemy.getGoalReached()){\n enemy.setCurrentPosition(enemy.getCurrentPosition().x,enemy.getCurrentPosition().y-1);\n }\n */\n}", "function updateOffsides()\n{\n totalOffsides = T1.offsides + T2.offsides;\n\n var t1_bar = Math.floor((T1.offsides / totalOffsides) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-off-num\").innerHTML = \"<b>\" + T1.offsides + \"</b>\";\n document.querySelector(\".t2-off-num\").innerHTML = \"<b>\" + T2.offsides + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-off-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-off-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "update() {\n if (this.y > this.yFallBounds[this.phase]) {\n this.healthBar.updateHealth(-18);\n }\n const TICK = this.game.clockTick;\n this.time2 = this.timer.getTime();\n this.attackEnd = this.timer.getTime();\n this.bowTime += TICK;\n if (this.healthBar.isDead()) {\n this.dead = true;\n this.deadCount+= this.game.clockTick;\n if (this.deadCount > 1.5) {\n PARAMS.GAMEOVER = true;\n }\n }\n\n //-------------adjust constants to alter physics-----------\n //run\n let max_run = 200; //adjust for maximum run speed\n let acc_run = 300; //adjust for maximum acceleration\n const ACC_SPRINT = 600; //adjust for maximum sprint acc\n const MAX_SPRINT = 800 //adjust for maximum sprint\n\n //skids\n const DEC_SKID = 4000;\n const TURN_SKID = 50;\n //jump\n const JUMP_ACC = 600; //adjust for maximum jump acc\n const MAX_JUMP = 1000; //adjust for maximum jump height\n const DBL_JUMP_MOD = 100; //adjust for double jump boost\n //falling\n const MAX_FALL = 1000; //adjust for fall speed\n const STOP_FALL = 1575;\n //in air deceleration\n const AIR_DEC = 1;\n if (PARAMS.START && !PARAMS.PAUSE) {\n if (this.dead) {\n this.velocity.y = 0;\n this.velocity.x = 0;\n this.BB = new BoundingBox(0, 0, 0, 0);\n } else {\n // collision\n var that = this;\n this.game.entities.forEach(function (entity) {\n if (entity.BB && that.BB.collide(entity.BB)) {\n if (entity instanceof Arrow && !entity.isAssassin) {\n that.healthBar.updateHealth(-PARAMS.DIFFICULTY);\n ASSET_MANAGER.playAsset(\"./audio/arrow_impact_soft.mp3\")\n that.velocity.x *= .95;\n } else if (that.velocity.y > 0) { // falling\n if ((entity instanceof Land || entity instanceof FloatingLand || entity instanceof Bridge) // landing\n && (that.lastBB.bottom) <= entity.BB.top) { // was above last tick\n that.velocity.y = 0;\n that.y = entity.BB.top - that.BB.height;\n that.updateBB();\n }\n } else if (that.velocity.y < 0) { // jumping\n if (entity instanceof FloatingLand) {\n if (that.lastBB.top > entity.BB.bottom) {\n that.velocity.y *= -.2;\n that.y = that.lastBB.y;\n that.updateBB();\n }\n }\n }\n if ((entity instanceof CaveWall || entity instanceof Land || entity instanceof FloatingLand)\n && entity.BB.top - that.BB.bottom < -5) {\n if (that.BB.left < entity.BB.left) {\n that.x = entity.BB.left - (that.BB.width * 2) + 20;\n if (that.velocity.x > 0) {\n that.velocity.x *= -.2;\n }\n } else { //<-\n if (that.velocity.x < 0) {\n that.velocity.x *= -.2;\n }\n that.x = that.lastBB.left - 5;\n }\n } else if (entity instanceof HealthPotion) {\n if (!that.healthBar.isFull()) {\n that.healthBar.updateHealth(10);\n entity.drank = true;\n }\n } else if (entity instanceof Soul) {\n if (entity.isKey) {\n PARAMS.SOULS += entity.value;\n entity.consumed = true;\n that.isKeyed = true;\n } else {\n PARAMS.SOULS += entity.value;\n entity.consumed = true;\n }\n } else if (entity instanceof Portal) {\n if (that.isKeyed) {\n that.teleport = true;\n }\n } else if (entity instanceof IceArrow) {\n if (!that.hasIceArrow) {\n that.hasIceArrow = true;\n entity.consumed = true;\n }\n }\n\n }\n if (entity instanceof Dragon) {\n if (entity.BB && that.BB.collide(entity.BB)) {\n that.velocity.x *= -.9;\n if (that.facing === 0) {\n that.x -= 5;\n } else {\n that.x += 5;\n }\n }\n if (entity.ABB && that.BB.collide(entity.ABB)) {\n if (!that.hit) {\n switch (PARAMS.DIFFICULTY) {\n case PARAMS.EASY:\n that.healthBar.updateHealth(-1);\n break;\n case PARAMS.NORMAL:\n that.healthBar.updateHealth(-3);\n break;\n case PARAMS.HARD:\n that.healthBar.updateHealth(-7);\n break;\n }\n that.hit = true;\n ASSET_MANAGER.playAsset(\"./audio/dragon_hit.mp3\");\n }\n } else {\n that.hit = false;\n }\n }\n if ((entity instanceof ShadowWarrior || entity instanceof Knight || entity instanceof RedEye)\n && entity.BB && that.BB.collide(entity.BB)) {\n that.velocity.x *= .9;\n }\n if (entity.ABB && entity instanceof ShadowWarrior && that.BB.collide(entity.ABB)) {\n if (that.state !== 3) {\n that.healthBar.updateHealth(-(.5 + PARAMS.DIFFICULTY));\n ASSET_MANAGER.playAsset(\"./audio/sword_hit_player2.mp3\");\n }\n }\n if (entity.ABB && entity instanceof Knight && that.BB.collide(entity.ABB)) {\n if (that.state !== 3) {\n that.healthBar.updateHealth(-PARAMS.DIFFICULTY);\n ASSET_MANAGER.playAsset(\"./audio/sword_hit_player_knight.mp3\");\n }\n\n }\n\n });\n\n let yVel = Math.abs(this.velocity.y);\n //this physics will need a fine tuning;\n let attackLength = 0;\n if (this.game.One) {\n this.weapon = 0;\n attackLength = 380;\n this.weaponIcon.updateWeapon(0);\n }\n if (this.game.Two) {\n this.weapon = 1;\n attackLength = 450;\n this.weaponIcon.updateWeapon(1);\n }\n if (this.game.Three) {\n this.weapon = 2;\n attackLength = 750;\n this.weaponIcon.updateWeapon(2);\n }\n if (this.attackEnd - this.attackStart > attackLength) {\n this.attacking = false;\n } else {\n this.attacking = true;\n }\n if ((this.attackEnd - this.attackStart > attackLength - 200) && (this.attackEnd - this.attackStart < attackLength) &&\n this.state === 2) {\n this.attackWindow = true;\n } else {\n\n this.attackWindow = false;\n this.arrowFlag = true;\n }\n this.updateBB();\n if (!this.attacking) {\n if (!this.game.B) {\n this.jumpFlag = false;\n }\n if (this.game.right) {\n this.facing = 0;\n this.state = 1;\n } else if (this.game.left) {\n this.facing = 1;\n this.state = 1;\n } else if (this.game.A) {\n this.state = 2;\n if (yVel < 20) {\n this.velocity.x = 0;\n }\n this.bowTime = 0;\n this.attackStart = this.timer.getTime();\n }\n\n if (this.game.B) {\n this.state = 3;\n if (this.velocity.y > 500) this.state = 0;\n } else if (!this.game.A && !this.game.B && !this.game.right && !this.game.left) {\n this.state = 0;\n }\n if (this.game.C) {\n if (this.game.left || this.game.right) {\n this.state = 4;\n }\n acc_run = ACC_SPRINT;\n max_run = MAX_SPRINT;\n }\n if (this.game.A && this.game.B) {\n if (this.velocity.y > 200) this.state = 0;\n else this.state = 3;\n }\n if (this.game.B && this.game.C && (this.game.right || this.game.left)) {\n this.state = 0;\n }\n\n //if moving right and then face left, skid\n if (this.game.left && this.velocity.x > 0 && yVel < 20) {\n this.velocity.x -= TURN_SKID;\n }\n //if moving left ann then face right, skid\n if (this.game.right && this.velocity.x < 0 && yVel < 20) {\n this.velocity.x += TURN_SKID;\n }\n //if you unpress left and right while moving right\n if (!this.game.right && !this.game.left) {\n if (this.facing === 0) { //moving right\n if (this.velocity.x > 0 && yVel < 20) {\n this.velocity.x -= DEC_SKID * TICK;\n } else if (yVel < 20) {\n this.velocity.x = 0;\n } else if (this.velocity.x > 0) { //this is where you control horizontal deceleration when in air\n this.velocity.x -= AIR_DEC;\n }\n } else { //if you unpress left and right while moving left\n if (this.velocity.x < 0 && yVel < 20) {\n this.velocity.x += DEC_SKID * TICK;\n } else if (yVel < 20) {\n this.velocity.x = 0;\n } else if (this.velocity.x < 0) { //this is where you control horizontal deceleration when in air\n this.velocity.x += AIR_DEC;\n }\n }\n }\n //Run physics\n if (this.facing === 0) { //facing right\n if (this.game.right && !this.game.left) { //and pressing right.\n if (yVel < 10 && !this.game.B) { //makes sure you are on ground\n this.velocity.x += acc_run * TICK;\n }\n }\n } else if (this.facing === 1) { //facing left\n if (!this.game.right && this.game.left) { //and pressing left.\n if (yVel < 10 && !this.game.B) { //makes sure you are on ground\n this.velocity.x -= acc_run * TICK;\n }\n }\n }\n\n if (this.game.B) {\n let timeDiff = this.time2 - this.time1;\n if (this.velocity.y === 0) { // add double jump later\n this.time1 = this.timer.getTime();\n this.velocity.y -= JUMP_ACC;\n this.fallAcc = STOP_FALL;\n this.jumpFlag = true;\n } else if (!this.jumpFlag && timeDiff > 100 && timeDiff < 250) {\n this.velocity.y -= DBL_JUMP_MOD;\n this.fallAcc = STOP_FALL;\n }\n }\n if (this.velocity.y < 0) {\n this.state = 3;\n }\n }\n // max speed calculation\n if (this.velocity.x >= max_run) this.velocity.x = max_run;\n if (this.velocity.x <= -max_run) this.velocity.x = -max_run;\n // update position\n this.velocity.y += this.fallAcc * TICK;\n this.y += this.velocity.y * TICK * PARAMS.SCALE;\n if (this.velocity.y >= MAX_FALL) this.velocity.y = MAX_FALL;\n if (this.velocity.y <= -MAX_JUMP) this.velocity.y = -MAX_FALL;\n\n this.x += this.velocity.x * TICK * PARAMS.SCALE;\n if (this.teleport) {\n ASSET_MANAGER.playAsset(\"./audio/teleport.mp3\")\n PARAMS.SAVEDSOULS = PARAMS.SOULS;\n this.phase++;\n this.x = this.portalLocations[this.phase].x;\n this.y = this.portalLocations[this.phase].y;\n PARAMS.XSPAWN = this.x;\n PARAMS.YSPAWN = this.y;\n if (this.phase === 1) {\n this.game.phaseOneDone();\n }\n if (this.phase === 2) {\n ASSET_MANAGER.playAsset(\"./audio/growl.mp3\");\n this.game.phaseTwoDone();\n }\n this.velocity.x = 0;\n this.isKeyed = false;\n this.teleport = false;\n }\n this.updateBB(); //Update your bounding box every tick\n }\n }\n }", "function update(){\r\n if(gameUpdateObj.updating == true && timer==0) {\r\n var playerKey = Player+1\r\n boardState[gameUpdateObj.xPos][gameUpdateObj.yPos] = playerKey; //sets the colour to be drawed on the table\r\n if (gameUpdateObj.yPos > 0){boardState[gameUpdateObj.xPos][gameUpdateObj.yPos-1] = 0} //sets previous back to blank\r\n if (boardState[gameUpdateObj.xPos][gameUpdateObj.yPos+1] != 0){\r\n if (checkWin())\r\n gameState = states.end.won;\r\n if (checktie())\r\n gameState = states.end.tie\r\n Player = !Player; //Invert current Player\r\n gameUpdateObj.updating = false; //tells game that the drop animation is finished\r\n } else{\r\n gameUpdateObj.yPos += 1;\r\n timer = 10; //Sets the timer variable\r\n }\r\n }\r\n}", "function updateVolumeBar()\n {\n\n // get volume percentage as a whole number\n var volumePercentage = (getVolume() * 100).toFixed(0);\n\n // apply percentage to the width of volume bar\n // update text below bar to match percentage\n $(\".volume .volume-bar-percentage\").css({\"width\": volumePercentage + \"%\"});\n $(\".volume .volume-text strong\").text(volumePercentage+ \" %\");\n\n // set bar color\n if (getVolume() > 0.75)\n {\n $(\".volume\").removeClass(\"green yellow red\").addClass(\"green\");\n } else if (getVolume() > 0.25) {\n $(\".volume\").removeClass(\"green yellow red\").addClass(\"yellow\");\n } else {\n $(\".volume\").removeClass(\"green yellow red\").addClass(\"red\");\n }\n\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 death()\n{\t\n\n\tplayer.velocity.y = 20;\t\n\tfor(var i = 0; i < boundaries.length; i ++) boundaries.get(i).velocity.x = 0;\n\tfor(var i = 0; i < rocks.length; i ++) rocks.get(i).velocity.x = 0;\n\tif(player.bounce(rocks)) player.velocity.y = 0;\n\tdeathScreen();\n}", "function updateGoalAttempts()\n{\n\tvar totShots = 0;\n\n\tif(currTeam == 1) \n\t{\n\t\tT1.totalShots += 1;\n\n\t\ttotShots = T1.totalShots + T2.totalShots;\n\n\t\t//Step 1: Update total shots\n\t\tvar t1_bar = Math.floor((T1.totalShots / totShots) * 100);\n\t\tvar t2_bar = 100 - t1_bar;\n\n\t\tdocument.getElementsByClassName(\"t1-goal-att-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t2-goal-att-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t1-goal-att-name\")[0].innerHTML = \"<b>Goal Attempts: \" + T1.totalShots + \"</b>\";\n\t}\n\telse\n\t{\n\t\tT2.totalShots += 1;\n\n\t\ttotShots = T1.totalShots + T2.totalShots;\n\n\t\tvar t2_bar = Math.floor((T2.totalShots / totShots) * 100);\n\t\tvar t1_bar = 100 - t2_bar;\n\n\t\tdocument.getElementsByClassName(\"t2-goal-att-bar\")[0].style.width = t2_bar.toString() + \"%\";\n\t\tdocument.getElementsByClassName(\"t1-goal-att-bar\")[0].style.width = t1_bar.toString() + \"%\";\n\n\t\tdocument.getElementsByClassName(\"t2-goal-att-name\")[0].innerHTML = \"<b>Goal Attempts: \" + T2.totalShots + \"</b>\";\n\t}\t\n}", "function fight (){\n\t\t$(\"#fightButton\").on(\"click\", function(){\n\t\t\tdarkSide.health -= lightSide.currentAttack;\n\t\t\tlightSide.attackMod();\n\t\t\tlightSide.health -= darkSide.counterAttack;\n\t\t\tmakeChar(\"#lightSideDiv\", \"<div>\", lightSide, true)\n\t\t\tmakeChar(\"#darkSideDiv\", \"<div>\", darkSide, true)\n\n\t\t\t// $(\"#darkSideDiv\").attr(\"<p>\", darkSide.health);\n\t\t\tif (darkSide.health <= 0) {\n\t\t\t\tcounter--;\n\t\t\t\tif (counter === 0) {\n\t\t\t\t\talertBox(\"The force is strong with you - you win!\");\n\t\t\t\t}\n\t\n\t\t\t\telse {\n\t\t\t\t\tdarkSide = undefined;\n\t\t\t\t\t$(\"#darkSideDiv\").empty();\n\t\t\t\t\talertBox(\"You are victorious! Select another character to fight.\");\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif(lightSide.health <= 0){\n\t\t\t\talertBox(\"You are not a Jedi yet - GAME OVER.\");\n\t\t\t\t//Change button to \"play again\"\n\t\t\t}\n\t\t});\n\t}", "function setDamage(colorsPlaying){\r\n\r\n\t//since the damage map consists of squares we only need the starting center and an offset\r\n\t//this multiplier is arbitrary, just trying to center the damage blocks within each damage zone\r\n\tvar centerZ = mapSizeZ*.45588;\r\n\t//var centerZ = 1.5;\r\n\t//starting from left die of board, set right half of one damage block (half of 1/15 of board width)\r\n\tvar centerX = -mapSizeX/2 + mapSizeX/(15*2);\r\n\t/*var centerZ = 1.5;\r\n\tvar centerX = -3.25;\r\n\t*/\r\n\r\n\t//looks through an array to find all of the colors playing\r\n\tfor(i = 0; i < colorsPlaying.length; i++){\r\n\t\t//if a piece is playing set it to the correct position in the zero square\r\n\t\tif(colorsPlaying[i] == \"white\"){\r\n\t\t\toffsetX = .05;\r\n\t\t\toffsetZ = -.05;\r\n\t\t\twhiteDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying[i] == \"yellow\"){\r\n\t\t\toffsetX = .05;\r\n\t\t\toffsetZ = 0.0;\r\n\t\t\tyellowDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying[i] == \"orange\"){\r\n\t\t\toffsetX = .05;\r\n\t\t\toffsetZ = .05;\r\n\t\t\torangeDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying[i] == \"green\"){\r\n\t\t\toffsetX = 0.0;\r\n\t\t\toffsetZ = -.05;\r\n\t\t\tgreenDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying[i] == \"purple\"){\r\n\t\t\toffsetX = -.05;\r\n\t\t\toffsetZ = .05;\r\n\t\t\tpurpleDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying[i] == \"red\"){\r\n\t\t\toffsetX = -.05;\r\n\t\t\toffsetZ = 0.0;\r\n\t\t\tredDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying[i] == \"black\"){\r\n\t\t\toffsetX = -.05;\r\n\t\t\toffsetZ = -.05;\r\n\t\t\tblackDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\r\n\t\tif(colorsPlaying[i] == \"blue\"){\r\n\t\t\toffsetX = 0.0;\r\n\t\t\toffsetZ = .05;\r\n\t\t\tblueDamagePiece.position.set(centerX+offsetX,pieceVisible,centerZ+offsetZ);\r\n\t\t}\r\n\t}\r\n}", "function buyBarq() {\r\n if(player.gold.num >= player.barquentine.price && player.influence >= player.barquentine.infMin) {\r\n player.barquentine.num++;\r\n player.gold.num -= player.barquentine.price;\r\n player.influence += player.barquentine.influence;\r\n player.barquentine.income = player.barquentine.num * player.barquentine.gain;\r\n gameLog('A handsome vessel, perfect for bein\\' \"civil\".');\r\n } else {\r\n gameLog('Keep an eye on yer resources, Cap\\'n!')\r\n };\r\n player.barquentine.price = Math.floor(12550 * Math.pow(1.13, player.barquentine.num));\r\n document.getElementById('barqCost').innerHTML = player.barquentine.price;\r\n document.getElementById('barqNum').innerHTML = player.barquentine.num;\r\n document.getElementById('barqGain').innerHTML = player.barquentine.income;\r\n document.getElementById('barqInf').innerHTML = player.barquentine.influence;\r\n document.getElementById('gold').innerHTML = player.gold.num;\r\n document.getElementById('influence').innerHTML = player.influence;\r\n}", "function updateThrows()\n{\n totalThrows = T1.throwIns + T2.throwIns;\n\n var t1_bar = Math.floor((T1.throwIns / totalThrows) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-throws-num\").innerHTML = \"<b>\" + T1.throwIns + \"</b>\";\n document.querySelector(\".t2-throws-num\").innerHTML = \"<b>\" + T2.throwIns + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-throws-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-throws-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function fight(){\n console.log(\"FIGHT!\");\n\n\n //calculate amount of damage each player will inflict.\n var minimumDamageP1 = fighters[0].damage * .5;\n var minimumDamageP2 = fighters[1].damage * .5;\n var player1ActualDamage = Math.floor(Math.random()*(fighters[0].damage-minimumDamageP1)+minimumDamageP1);\n var player2ActualDamage = Math.floor(Math.random()*(fighters[1].damage-minimumDamageP2)+minimumDamageP2);\n\n //inflict damage\n\n\n var score = document.querySelector('#kabal p');\n scoreToString = String(fighters[0].health=fighters[0].health-player1ActualDamage);\n score.innerHTML = fighters[0].name+' : '+scoreToString;\n\n var score1 = document.querySelector('#kratos p');\n scoreToString1 = String(fighters[1].health=fighters[1].health-player2ActualDamage);\n score1.innerHTML = fighters[1].name+' : '+scoreToString1;\n\n console.log(fighters[0].name+\": \"+fighters[0].health + \" \" + fighters[1].name+\":\"+fighters[1].health);\n winnerCheck();\n round++;\n stringOfRound = String(round);\n var roundGet = document.querySelector('#round');\n roundGet.innerHTML = 'Round:'+stringOfRound+' FIGHT!';\n }", "function cypherOnUpdateBarAttributes(updateData) {\r\n const update = [\"bar1\", \"bar2\", \"bar3\"].some(b => {\r\n let bar = this.data[b];\r\n if (!bar)\r\n return false;\r\n\r\n return bar.attribute && hasProperty(updateData, \"data.\"+bar.attribute);\r\n });\r\n\r\n if (update)\r\n this.object.drawBars();\r\n }", "function setupBars(number,chartDims){\n\tvar i;\n\tvar padding=0.1; //percentage of white space around bars\n\t\n\tvar texture = new PIXI.RenderTexture(renderer, 10, 10);\n\tvar graphics = new PIXI.Graphics();\n\tgraphics.beginFill(0xFF3000);\n\tgraphics.drawRect(0, 0, 10, 10);\n\tgraphics.endFill();\n\ttexture.render(graphics);\n\t\n\tfor (i=0;i<number;i++){\n\t\tbars[i]= new PIXI.Sprite(texture); \n\t\tbardet[i]=new PIXI.Text(' ');\n\t\tstage.addChild(bars[i]);\n\t\tstage.addChild(bardet[i]);\n\t\t//console.log(i);\t\n\t\tbars[i].position.set(chartDims[0]+chartDims[2]*(i/number+1/number*padding),(chartDims[3]*0.9+chartDims[1]))\n\t\tbars[i].width=(chartDims[2]/number*(1.0-2.0*padding))\n\t\tbars[i].height=(chartDims[3]*0.1);\n\t}\n\n\t\n}", "function drawBars(start, end) {\r\n\r\n\t// Clear pervious unsorted bars\r\n\tctrl.clearRect(0, 0, 1000, 1500)\r\n\r\n\t// Styling of bars\r\n\tfor (let i = 0; i < len_of_arr; i++) {\r\n\r\n\t\t// Changing styles of bars\r\n\t\tctrl.fillStyle = \"blue\"\r\n\t\tctrl.shadowOffsetX = 2\r\n\t\t// ctrl.shadowColor = \"chocolate\";\r\n\t\t// ctrl.shadowBlur = 3;\r\n\t\t// ctrl.shadowOffsetY =5;\r\n\t\t\r\n\t\t\r\n\t\t// Size of rectangle of bars\r\n\t\tctrl.fillRect(25 * i, 300 - arr[i], 20, arr[i])\r\n\t\t\r\n\t\tif (visited[i]) {\r\n\t\t\tctrl.fillStyle = \"#006d13\"\r\n\t\t\tctrl.fillRect(25 * i, 300 - arr[i], 20, arr[i])\r\n\t\t\tctrl.shadowOffsetX = 2;\r\n\t\t}\r\n\t}\r\n\r\n\tfor (let i = start; i <= end; i++) {\r\n\t\tctrl.fillStyle = \"#e51e2a\";\r\n\t\tctrl.fillRect(25 * i, 300 - arr[i], 18, arr[i])\r\n\t\t// ctrl.fillStyle = \"#cdff6c\"\r\n\t\t// ctrl.fillRect(25 * i,300, 18, arr[i])\r\n\t\tvisited[i] = 1\r\n\t}\r\n}", "function script() {\nenterName();\n//Insérer son pseudo tant qu'il n'est pas initialisé\n//Récupérer le pseudo et initier un nouvel Player avec ce pseudo (newPlayer = Player)\n\n document.getElementById(\"goaventure\").addEventListener(\"click\", function() {\n document.getElementById(\"fightPlayer\").classList.remove(\"display\");\n document.getElementById(\"fightMonster\").classList.remove(\"display\");\n document.getElementById(\"playerBar\").classList.remove(\"display\");\n document.getElementById(\"monsterBar\").classList.remove(\"display\");\n battle();\n })\n //Afficher le design de la page principale\n \n//Log combat win ou loose avec affichage des boutons en conséquence\n document.getElementById(\"goshop\").addEventListener(\"click\", function() {\n document.getElementById('box').innerHTML = ''; // vider le chatbox\n document.getElementById(\"shop\").classList.remove(\"display\"); // afficher la boutique\n document.getElementById(\"leaveshop\").classList.remove(\"display\"); // afficher la boutique\n window.setTimeout(function() {\n document.getElementById(\"goshop\").classList.add(\"display\");\n },50);\n })\n//Cliquer sur le bouton aller a la boutique et ouvrir la boutique\n document.getElementById(\"leaveshop\").addEventListener(\"click\", function() {\n document.getElementById(\"inventory\").classList.remove(\"display\");\n window.setTimeout(function() {\n document.getElementById(\"shop\").classList.add(\"display\");\n document.getElementById(\"goaventure\").classList.remove(\"display\");\n document.getElementById(\"leaveshop\").classList.add(\"display\")\n },50);\n document.getElementById(\"nbItem1\").innerHTML = Player.inventory.strengthPotion;\n document.getElementById(\"nbItem2\").innerHTML = Player.inventory.agilityPotion;\n document.getElementById(\"nbItem3\").innerHTML = Player.inventory.staminaPotion;\n document.getElementById(\"nbItem4\").innerHTML = Player.inventory.hpPotion;\n })\n//Cliquer sur le bouton ouvrir l'inventaire, refermer la boutique et afficher partir à l'aventure puis cacher ouvrir l'inventaire\n document.getElementById(\"goaventure\").addEventListener(\"click\", function() {\n document.getElementById(\"leaveshop\").classList.add(\"display\");\n })\n}", "redrawBarsAndFrequencies() {\n this.barData.forEach(({ A: aCount, B: bCount }, i) => {\n this.drawBars(i, aCount, bCount, this.totalFrequencyDataCount)\n })\n\n let totalLightA = this.totalFrequencyData[LightTypes.A]\n let totalLightB = this.totalFrequencyData[LightTypes.B]\n\n this.drawFrequencies(totalLightA, totalLightB)\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 gameOverSong.play();\n }\n}", "function updateHealth() {\n // Reduce player health\n playerHealth = playerHealth - 0.5;\n // Constrain the result to a sensible range\n playerHealth = constrain(playerHealth, 0, playerMaxHealth);\n\n //When the shift button is pressed, player's health\n //will decrease faster, especially without the constrain\n if (keyIsDown(SHIFT)) {\n playerHealth = playerHealth - 2;\n }\n //When the sift button is released, the health\n //will decrease at it's normal rate\n else {\n playerHealth = playerHealth - 0.5;\n playerHealth = constrain(playerHealth, 0, playerMaxHealth);\n }\n\n // Check if the player is dead (0 health)\n if (playerHealth === 0) {\n // If so, the game is over\n gameOver = true;\n }\n}", "updatePlayerHp(newHP) {\r\n // Prevents the HP to go lower than 0\r\n this.playerHp = Math.max(newHP, 0);\r\n \r\n // If player health is equal 0 opponent wins\r\n if (this.playerHp === 0) {\r\n return 0;\r\n }\r\n \r\n // Update the player hp bar\r\n const barWidth = (this.playerHp / this.totalHp) * 100;\r\n this.playerHpElement.style.width = barWidth + '%';\r\n\r\n return 1;\r\n }", "function updateTimeBar(){\n\tvar redcode = Math.floor(Math.max(red, 0)).toString(16);\n\tvar greencode = Math.floor(Math.max(green, 0)).toString(16);\n\t\n\tbonusbar.style.background = \"#\" + redcode + greencode + \"00\";\n\tbonusbar.style.width = Math.max(Math.floor(timeBarLength), 0) + \"px\";\n\t\n}", "function fight() { //need a function calculating the fight\n console.log(\"In the fight function\"); //prints to console that the fight FN is\n //printing off\n alert(playerOneName + \":\" + playerOneHealth + \" *START* \" + playerTwoName + \":\" + playerTwoHealth);\n //alert for player to start of game\n for (var i = 0; i < 10; i++) { //formula for random number damage to hit player\n //Random formula is - Math.floor(random() * (max - min) + min);\n\n var minDamage1 = playerOneDmg * .5; //minimal dmg to player one\n var minDamage2 = playerTwoDmg * .5; //minimal dmg to player two\n var f1 = Math.floor(Math.random() * (playerOneDmg - minDamage1) + minDamage1); //dmg formula to players\n var f2 = Math.floor(Math.random() * (playerTwoDmg - minDamage2) + minDamage2); //each players health\n\n //console.log(f1);\n //console.log(f2);\n\n //inflict Damage\n playerOneHealth -= f1; //deducts the damage from players health\n playerTwoHealth -= f2; //deducts the damage from the players health\n\n // console.log(playerOneHealth);\n // console.log(playerTwoHealth);\n\n console.log(playerOneName + \":\" + playerOneHealth + \" \" + playerTwoName + \":\" + playerTwoHealth);\n //this will print out to console the player's\n //name and health with each round\n var results = winnerCheck(); //checking to see if we have a winner yet\n console.log(results); //printing to console results of winner check\n //calling winnerCheck FN\n if (results === \"no winner\"){ //if no winner alerting user to number of round\n //players health/name\n round++; //adds 1 to each sequential round\n alert(playerOneName + \":\" + playerOneHealth + \" *ROUND \" + round + \" OVER* \" + playerTwoName + \":\" + playerTwoHealth);\n //formats the alert for the user\n }else{ //offers a conditional\n alert(results); //alert with the winning results\n break; //ends the game.\n }\n\n }\n\n }", "function _updateBar(sel) {\n sel.each(function(dd) {\n var bar = d3.select(this).selectAll('.bar')\n .data(dd)\n\n // exit\n bar.exit().remove()\n\n // enter\n bar.enter().append('rect').attr('class', 'bar')\n\n // update\n var sumX = 0\n bar\n .attr('x', function(d) {\n var x = sumX\n sumX += scale(d.duration)\n return x\n })\n .attr('y', 0)\n .attr('width', function(d) {\n return scale(d.duration)\n })\n .attr('height', barHeight)\n .style('fill', function(d) {\n return color(d.actionType)\n })\n\n })\n }", "function fight(posNew, posOld) {\n\n if (posNew.x === posOld.x \n && posNew.y <= posOld.y + 1 && posNew.y >= posOld.y - 1 ||posNew.y === posOld.y \n && posNew.x <= posOld.x + 1 && posNew.x >= posOld.x - 1) {\n move = false;\n hover = false;\n fightingArea(); // Info.js (70) When the players fight, the board game is hidden\n scores = 0;\n fightPlayerOne(); // Info.js (110)\n fightPlayerTwo(); // Info.js (126)\n }\n}", "function setSatisfactionBarValue(){\n\n // only animate the bar if the satifaction value has changed\n if(satisfactionLastRate != satisfactionRate){\n satisfactionBar.animate(satisfactionRate);\n satisfactionLastRate = satisfactionRate;\n }\n\n if(satisfactionRate == 0)\n gameOver(\"fired\");\n}", "function Update() {\n\t//Reduce fill amount over 30 seconds\n\tHunger.fillAmount -= .3f / waitTime * Time.deltaTime;\n\tSleep.fillAmount -= .2f / waitTime * Time.deltaTime;\n\t//Currency\n\tMonies.text = \"Cash: \" + PlayerPrefs.GetInt(\"Money\");\n\tSkillPoints.text = \"SP: \" + PlayerPrefs.GetInt(\"sp\");\n\tHome.text = \"House: \" + PlayerPrefs.GetString(\"House\");\n\tBed.text = \"Bed: \" + PlayerPrefs.GetString(\"Bed\");\n\tJob.text = \"Job: \" + PlayerPrefs.GetString(\"Job\");\n\t\n\ttime.text = \"Time: \" + timed + \" : \" + timeh + \" : \" + timem;\n\t\n\tif (Hunger.fillAmount == 0) {\n\t\tPlayerPrefs.SetString(\"Death\", \"true\");\n\t}\n\tif (Sleep.fillAmount == 0) {\n\t\tPlayerPrefs.SetString(\"Death\", \"true\");\n\t}\n\tif (PlayerPrefs.GetString(\"Death\") == \"true\") {\n\t\tNews2.text = News.text;\n\t\tNews.text = \"You died and all your stats have restarted\";\n\t\tDebug.Log(\"User Died\");\n\t\tPlayerPrefs.DeleteAll();\n\t\tHunger.fillAmount = 1;\n\t\tSleep.fillAmount = 1;\n\t}\n\t\n\t//Bars\n\tPlayerPrefs.SetFloat(\"HUNGER\", Hunger.fillAmount);\n\tPlayerPrefs.SetFloat(\"ENERGY\", Sleep.fillAmount);\n}", "async battle_phase_combat() {\n if (!this.turns_actions.length) {\n this.battle_phase = battle_phases.ROUND_END;\n this.check_phases();\n return;\n }\n const action = this.turns_actions.pop();\n if (action.caster.has_permanent_status(permanent_status.DOWNED)) { //check whether this char is downed\n this.check_phases();\n return;\n }\n if (action.caster.is_paralyzed()) { //check whether this char is paralyzed\n if (action.caster.temporary_status.has(temporary_status.SLEEP)) {\n await this.battle_log.add(`${action.caster.name} is asleep!`);\n } else if (action.caster.temporary_status.has(temporary_status.STUN)) {\n await this.battle_log.add(`${action.caster.name} is paralyzed and cannot move!`);\n }\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (action.caster.fighter_type === fighter_types.ENEMY && !abilities_list[action.key_name].priority_move) { //reroll enemy ability\n Object.assign(action, EnemyAI.roll_action(action.caster, party_data.members, this.enemies_info.map(info => info.instance)));\n }\n let ability = abilities_list[action.key_name];\n let item_name = \"\";\n if (action.caster.fighter_type === fighter_types.ALLY && ability !== undefined && ability.can_switch_to_unleash) { //change the current ability to unleash ability from weapon\n if (action.caster.equip_slots.weapon && items_list[action.caster.equip_slots.weapon.key_name].unleash_ability) {\n const weapon = items_list[action.caster.equip_slots.weapon.key_name];\n if (Math.random() < weapon.unleash_rate) {\n item_name = weapon.name;\n action.key_name = weapon.unleash_ability;\n ability = abilities_list[weapon.unleash_ability];\n }\n }\n }\n if (ability === undefined) {\n await this.battle_log.add(`${action.key_name} ability key not registered.`);\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (action.caster.has_temporary_status(temporary_status.SEAL) && ability.ability_category === ability_categories.PSYNERGY) { //check if is possible to cast ability due to seal\n await this.battle_log.add(`But the Psynergy was blocked!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n }\n if (ability.pp_cost > action.caster.current_pp) { //check if char has enough pp to cast ability\n await this.battle_log.add(`... But doesn't have enough PP!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n } else {\n action.caster.current_pp -= ability.pp_cost;\n }\n let djinn_name = action.djinn_key_name ? djinni_list[action.djinn_key_name].name : undefined;\n await this.battle_log.add_ability(action.caster, ability, item_name, djinn_name);\n if (ability.ability_category === ability_categories.DJINN) {\n if (ability.effects.some(effect => effect.type === effect_types.SET_DJINN)) {\n djinni_list[action.djinn_key_name].set_status(djinn_status.SET, action.caster);\n } else {\n djinni_list[action.key_name].set_status(djinn_status.STANDBY, action.caster);\n }\n } else if (ability.ability_category === ability_categories.SUMMON) { //some summon checks\n const requirements = _.find(this.data.summons_db, {key_name: ability.key_name}).requirements;\n const standby_djinni = Djinn.get_standby_djinni(MainChar.get_active_players(MAX_CHARS_IN_BATTLE));\n const has_available_djinni = _.every(requirements, (requirement, element) => {\n return standby_djinni[element] >= requirement;\n });\n if (!has_available_djinni) { //check if is possible to cast a summon\n await this.battle_log.add(`${action.caster.name} summons ${ability.name} but`);\n await this.battle_log.add(`doesn't have enough standby Djinn!`);\n await this.wait_for_key();\n this.check_phases();\n return;\n } else { //set djinni used in this summon to recovery mode\n Djinn.set_to_recovery(MainChar.get_active_players(MAX_CHARS_IN_BATTLE), requirements);\n }\n }\n this.battle_menu.chars_status_window.update_chars_info();\n if (ability.type === ability_types.UTILITY) {\n await this.wait_for_key();\n }\n if (this.animation_manager.animation_available(ability.key_name)) {\n const caster_sprite = action.caster.fighter_type === fighter_types.ALLY ? this.allies_map_sprite[action.caster.key_name] : this.enemies_map_sprite[action.caster.key_name];\n const target_sprites = action.targets.map(info => info.target.sprite);\n const group_caster = action.caster.fighter_type === fighter_types.ALLY ? this.battle_stage.group_allies : this.battle_stage.group_enemies;\n const group_taker = action.caster.fighter_type === fighter_types.ALLY ? this.battle_stage.group_enemies : this.battle_stage.group_allies;\n await this.animation_manager.play(ability.key_name, caster_sprite, target_sprites, group_caster, group_taker, this.battle_stage);\n this.battle_stage.prevent_camera_angle_overflow();\n this.battle_stage.set_stage_default_position();\n } else {\n await this.battle_log.add(`Animation for ${ability.key_name} not available...`);\n await this.wait_for_key();\n }\n //apply ability damage\n if (![ability_types.UTILITY, ability_types.EFFECT_ONLY].includes(ability.type)) {\n await this.apply_damage(action, ability);\n }\n //apply ability effects\n for (let i = 0; i < ability.effects.length; ++i) {\n const effect = ability.effects[i];\n if (!effect_usages.ON_USE) continue;\n const end_turn = await this.apply_effects(action, ability, effect);\n if (end_turn) {\n this.battle_phase = battle_phases.ROUND_END;\n this.check_phases();\n return;\n }\n }\n //summon after cast power buff\n if (ability.ability_category === ability_categories.SUMMON) {\n const requirements = _.find(this.data.summons_db, {key_name: ability.key_name}).requirements;\n for (let i = 0; i < ordered_elements.length; ++i) {\n const element = ordered_elements[i];\n const power = BattleFormulas.summon_power(requirements[element]);\n if (power > 0) {\n action.caster.add_effect({\n type: \"power\",\n quantity: power,\n operator: \"plus\",\n attribute: element\n }, ability, true);\n await this.battle_log.add(`${action.caster.name}'s ${element_names[element]} Power rises by ${power.toString()}!`);\n await this.wait_for_key();\n }\n }\n }\n //check for poison damage\n const poison_status = action.caster.is_poisoned();\n if (poison_status) {\n let damage = BattleFormulas.battle_poison_damage(action.caster, poison_status);\n if (damage > action.caster.current_hp) {\n damage = action.caster.current_hp;\n }\n action.caster.current_hp = _.clamp(action.caster.current_hp - damage, 0, action.caster.max_hp);\n const poison_name = poison_status === permanent_status.POISON ? \"poison\" : \"venom\";\n await this.battle_log.add(`The ${poison_name} does ${damage.toString()} damage to ${action.caster.name}!`);\n this.battle_menu.chars_status_window.update_chars_info();\n await this.wait_for_key();\n await this.check_downed(action.caster);\n }\n if (action.caster.has_temporary_status(temporary_status.DEATH_CURSE)) {\n const this_effect = _.find(action.caster.effects, {\n status_key_name: temporary_status.DEATH_CURSE\n });\n if (action.caster.get_effect_turns_count(this_effect) === 1) {\n action.caster.current_hp = 0;\n action.caster.add_permanent_status(permanent_status.DOWNED);\n await this.battle_log.add(`The Grim Reaper calls out to ${action.caster.name}`);\n await this.wait_for_key();\n }\n }\n this.check_phases();\n }", "function loadBars() {\n\n\t\tif($('#section3').attr('finished') == 1) return true;\n\t\t\t$(\".progress-wrapp\").each(function(index){\n\t\t\t\t$(\".progress-wrapp\").eq(index).find(\".progress > span\").each(function(index2){\n\t\t\t\t\t$(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2).data(\"origWidth\", $(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2).width()).width(0);\n\t\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\t\t$(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2)\n\t\t\t\t\t\t\t\t.animate({\n\t\t\t\t\t\t\t\t\twidth: $(\".progress-wrapp\").eq(index).find(\".progress > span\").eq(index2).data(\"origWidth\")\n\t\t\t\t\t\t\t\t},\t1000);\n\t\t\t\t\t\t},index*600);\n\t\t\t\t});\t\t\t\n\t\t\t});\n\t\t$('#section3').attr('finished', 1);\n\t}", "function updateGUIStatusBar(nameOfBar, points, maxPoints, direction) {\n // check, if optional direction parameter is valid.\n if (!direction || !(direction >= 0 && direction < 4)) direction = 0;\n\n // get the bar and update it\n let statusBar = Engine.GetGUIObjectByName(nameOfBar);\n if (!statusBar) return;\n\n let healthSize = statusBar.size;\n let value = 100 * Math.max(0, Math.min(1, points / maxPoints));\n\n // inverse bar\n if (direction == 2 || direction == 3) value = 100 - value;\n\n if (direction == 0) healthSize.rright = value;\n else if (direction == 1) healthSize.rbottom = value;\n else if (direction == 2) healthSize.rleft = value;\n else if (direction == 3) healthSize.rtop = value;\n\n statusBar.size = healthSize;\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 drawGreyedBars(_block) {\n var womenPick = _block[0];\n var malePick = _block[1];\n console.log(womenPick);\n console.log(malePick);\n\n //Percentage Label\n var wSal = getSalaryForSexRace(womenPick.sex, womenPick.race);\n var mSal = getSalaryForSexRace(malePick.sex, malePick.race);\n\n var percentageToDisplay = Math.round((wSal / mSal) * 100);\n\n document.getElementById(\"percentSalary\").innerHTML = percentageToDisplay + \"%\";\n\n //Bars\n function greyOut(point) {\n var greyedOut = !(womenPick.sex == point.sex && womenPick.race == point.race) && !(malePick.sex == point.sex && malePick.race == point.race);\n return greyedOut;\n }\n\n //remove the ones no longer being used\n rects.exit()\n .transition()\n .duration(1000)\n .style(\"opacity\", 1)\n .remove();\n\n //update the bars\n rects\n .transition()\n .duration(1000)\n .attr('fill', function (d) {\n if (d.sex === 'Female') {\n return '#007F75'\n } else return '#FF7B5C';\n })\n .attr('opacity', function (d) {\n if (greyOut(d)) {\n return 0.4;\n } else {\n return 1.0;\n }\n });\n\n labelsContainerSex.selectAll('text')\n .transition()\n .duration(1000)\n .attr('opacity', function (d) {\n if (greyOut(d)) {\n return 0.4;\n } else {\n return 1.0;\n }\n });\n\n labelsContainerRace.selectAll('text')\n .transition()\n .duration(1000)\n .attr('opacity', function (d) {\n if (greyOut(d)) {\n return 0.4;\n } else {\n return 1.0;\n }\n });\n\n }", "function cypherTokenDrawBars() {\r\n if (!this.actor || this.data.displayBars === CONST.TOKEN_DISPLAY_MODES.NONE)\r\n return;\r\n\r\n [\"bar1\", \"bar2\", \"bar3\"].forEach((b, i) => {\r\n //0.8: when creating a new tokens, the bars property does not exist...\r\n if (!this.hasOwnProperty(\"bars\"))\r\n return;\r\n\r\n const bar = this.bars[b];\r\n const attr = this.getBarAttribute(b);\r\n\r\n if (!attr || attr.type !== \"bar\")\r\n return bar.visible = false;\r\n\r\n this._drawBar(i, bar, attr);\r\n bar.visible = true;\r\n });\r\n}", "function hungerDrain () {\r\n if (hungerBar.w > 0) {\r\n hungerBar.w -= hungerBar.speed;\r\n } else if (hungerBar.w <= 0) {\r\n stopGame();\r\n }\r\n}", "function updateCompletePasses()\n{\n totalComplPasses = T1.completedPasses + T2.completedPasses;\n\n var t1_bar = Math.floor((T1.completedPasses / totalComplPasses) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-pass-compl-num\").innerHTML = \"<b>\" + T1.completedPasses + \"</b>\";\n document.querySelector(\".t2-pass-compl-num\").innerHTML = \"<b>\" + T2.completedPasses + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-pass-compl-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-pass-compl-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\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 updateGKSaves()\n{\n totalSaves = T1.GKSaves + T2.GKSaves;\n\n var t1_bar = Math.floor((T1.GKSaves / totalSaves) * 100);\n var t2_bar = 100 - t1_bar;\n\n document.querySelector(\".t1-gk-save-num\").innerHTML = \"<b>\" + T1.GKSaves + \"</b>\";\n document.querySelector(\".t2-gk-save-num\").innerHTML = \"<b>\" + T2.GKSaves + \"</b>\";\n\n var bar1 = document.getElementsByClassName(\"t1-gk-save-bar\")[0].style;\n var bar2 = document.getElementsByClassName(\"t2-gk-save-bar\")[0].style;\n\n updateBarColor(t1_bar, t2_bar, bar1, bar2);\n\n bar1.width = t1_bar.toString() + \"%\";\n bar2.width = t2_bar.toString() + \"%\";\n}", "function update_progression_rewards(dialog) {\n // blink progression item icons for levels that drop multiple rewards\n if('progression_item_list' in dialog.user_data) {\n var progression_item_list = dialog.user_data['progression_item_list'];\n var period = dialog.data['widgets']['progression_rewards']['blink_period'];\n\n for(var i = 0; i < Math.min(progression_item_list.length, dialog.data['widgets']['progression_rewards']['array'][0]); i++) {\n var loot = progression_item_list[i]['loot'];\n\n // only change the item displayed if the level drops multiple items\n if(loot instanceof Array && loot.length > 1) {\n var index = (Math.floor(((client_time - dialog.user_data['anim_start'] + period/2)/period) % loot.length) + loot.length) % loot.length;\n var wname = SPUI.get_array_widget_name('progression_rewards', dialog.data['widgets']['progression_rewards']['array'], [i, 0]);\n ItemDisplay.display_item(dialog.widgets[wname], loot[index], {glow:true, hide_stack:true});\n }\n }\n }\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 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 barLength(whichbar, rating) {\n if (whichbar == \"crowdedness\") {\n switch (rating) {\n case 0.5:\n $(\".bar-5\").width(\"10%\");\n break;\n case 1:\n $(\".bar-5\").width(\"20%\");\n break;\n case 1.5:\n $(\".bar-5\").width(\"30%\");\n break;\n case 2:\n $(\".bar-5\").width(\"40%\");\n break;\n case 2.5:\n $(\".bar-5\").width(\"50%\");\n break;\n case 3:\n $(\".bar-5\").width(\"60%\");\n break;\n case 3.5:\n $(\".bar-5\").width(\"70%\");\n break;\n case 4:\n $(\".bar-5\").width(\"80%\");\n break;\n case 4.5:\n $(\".bar-5\").width(\"90%\");\n break;\n case 5:\n $(\".bar-5\").width(\"100%\");\n break;\n default:\n break;\n }\n } else if (whichbar == \"bathroom\") {\n switch (rating) {\n case 0.5:\n $(\".bar-4\").width(\"10%\");\n break;\n case 1:\n $(\".bar-4\").width(\"20%\");\n break;\n case 1.5:\n $(\".bar-4\").width(\"30%\");\n break;\n case 2:\n $(\".bar-4\").width(\"40%\");\n break;\n case 2.5:\n $(\".bar-4\").width(\"50%\");\n break;\n case 3:\n $(\".bar-4\").width(\"60%\");\n break;\n case 3.5:\n $(\".bar-4\").width(\"70%\");\n break;\n case 4:\n $(\".bar-4\").width(\"80%\");\n break;\n case 4.5:\n $(\".bar-4\").width(\"90%\");\n break;\n case 5:\n $(\".bar-4\").width(\"100%\");\n break;\n default:\n break;\n }\n } else if (whichbar == \"cleaness\") {\n switch (rating) {\n case 0.5:\n $(\".bar-3\").width(\"10%\");\n break;\n case 1:\n $(\".bar-3\").width(\"20%\");\n break;\n case 1.5:\n $(\".bar-3\").width(\"30%\");\n break;\n case 2:\n $(\".bar-3\").width(\"40%\");\n break;\n case 2.5:\n $(\".bar-3\").width(\"50%\");\n break;\n case 3:\n $(\".bar-3\").width(\"60%\");\n break;\n case 3.5:\n $(\".bar-3\").width(\"70%\");\n break;\n case 4:\n $(\".bar-3\").width(\"80%\");\n break;\n case 4.5:\n $(\".bar-3\").width(\"90%\");\n break;\n case 5:\n $(\".bar-3\").width(\"100%\");\n break;\n default:\n break;\n }\n } else if (whichbar == \"parking\") {\n switch (rating) {\n case 0.5:\n $(\".bar-2\").width(\"10%\");\n break;\n case 1:\n $(\".bar-2\").width(\"20%\");\n break;\n case 1.5:\n $(\".bar-2\").width(\"30%\");\n break;\n case 2:\n $(\".bar-2\").width(\"40%\");\n break;\n case 2.5:\n $(\".bar-2\").width(\"50%\");\n break;\n case 3:\n $(\".bar-2\").width(\"60%\");\n break;\n case 3.5:\n $(\".bar-2\").width(\"70%\");\n break;\n case 4:\n $(\".bar-2\").width(\"80%\");\n break;\n case 4.5:\n $(\".bar-2\").width(\"90%\");\n break;\n case 5:\n $(\".bar-2\").width(\"100%\");\n break;\n default:\n break;\n }\n }\n}", "function increaseHealth() \n{\n if(healthBarScript.healthWidth < 199) \n\t {\n\t healthBarScript.healthWidth = healthBarScript.healthWidth + 1;\n\t }\n}", "function updateBars(bars,n,colorScale, chart)\n {\n\n setScale(chart);\n\n var yScale = d3.scale.linear()\n .range([0, chartHeight]) \n .domain([0, scaleMax]); \n\n bars.attr(\"x\", function(d, i)\n {\n return (i * (chartInnerWidth / csvData.length)) + leftPadding;\n })\n .attr(\"height\", function(d)\n {\n return yScale(parseFloat(d[expressed]));\n })\n .attr(\"y\", function(d)\n {\n return (chartHeight - yScale(parseFloat(d[expressed]))) + topBottomPadding;\n })\n .style(\"fill\", function(d)\n {\n return colorScale(d[expressed]);\n })\n .on(\"mouseover\", function(d)\n {\n var nm = d.geography.split(' ');\n val = d[expressed];\n highlight(nm[0], val);\n })\n .on(\"mouseout\", function(d)\n {\n var nm = d.geography.split(' ');\n dehighlight(nm[0])\n })\n .on(\"mousemove\", moveLabel);\n }", "function updateStats() {\n $(\"#fighterhealth\").text(\"HP:\\xa0\" + fighterHP);\n $(\"#defenderhealth\").text(\"HP:\\xa0\" + defenderHP);\n }", "function updateBars() {\n const chartBars = document.querySelectorAll(\"#chart-bars g\");\n // Wykonanie na duzych slupkach\n for (let i = 0; i < chartBars.length; i++) {\n const bar = chartBars[i].children;\n // Wykonanie na malych slupkach w duzym slupku\n let yStartingPoint = 79.834364;\n let separation = 0; // Pierwszy odstep jest rowny 0, pozniej 1.1\n for (let rect = 0; rect < bar.length; rect++) {\n const e = bar[rect];\n const numOf = Number(e.getAttribute(\"data-value\")); // Odczytanie ilosci, np. numOfNumbers = 5\n const smallBarHeight = (gridMaxHeight / highestYLable) * numOf; // Wyliczenie jaka powinien miec maly slupek wysokosc\n yStartingPoint -= smallBarHeight; // Dostosowanie poczatkowego punktu w odniesieniu do wysokosci\n const x = parseFloat(e.getAttribute(\"x\"));\n e.setAttribute(\"x\", x + 26); // Przesuiecie starego slupka (o jeden w prawo)\n e.setAttribute(\n \"height\",\n smallBarHeight === 0 ? 0 : smallBarHeight - separation\n );\n e.setAttribute(\"y\", yStartingPoint);\n separation = numOf === 0 && separation === 0 ? 0 : 1.1;\n }\n }\n}", "function playerDrop(){\n player.pos.y++;\n //if block has reached bottom send it back up\n if(collide(arena, player)){\n player.pos.y--;\n merge(arena, player);\n playerReset();\n arenaSweep();\n updateScore();\n }\n dropCounter = 0;\n}", "finishedCombat (tSource, tDest, attackerLoss, defenderLoss) {\n /* show combat results ? */\n console.log(\n 'Combat results: attacking territory ' +\n tSource +\n 'lost ' +\n attackerLoss +\n ' units, defending territory ' +\n tDest +\n 'lost ' +\n defenderLoss +\n ' units.'\n )\n\n var tmpSource = tSource\n var tmpDest = tDest\n\n /* were are getting IDs from server, getting name strings of countries */\n tSource = THIS.getCountryNameById(tSource)\n tDest = THIS.getCountryNameById(tDest)\n\n var cSource = getContinentOf(tSource)\n var cDest = getContinentOf(tDest)\n\n /* Unhighlight the belligerents */\n GameWindow.unhighlightTerritory()\n\n /* apply losses */\n THIS.map[cSource][tSource].soldiers -= attackerLoss\n THIS.map[cDest][tDest].soldiers -= defenderLoss\n /* displaying loss(es) on map (using country IDs) */\n GameWindow.updateCountrySoldiersNumber(tmpSource)\n GameWindow.updateCountrySoldiersNumber(tmpDest)\n // Rest\n console.log('attackUnits = ' + THIS.attackUnits)\n var restAttack = THIS.attackUnits - attackerLoss\n console.log('restattack = ' + restAttack)\n\n var attackingPlayer = THIS.getPlayerById(THIS.map[cSource][tSource].player)\n var defendingPlayer = THIS.getPlayerById(THIS.map[cDest][tDest].player)\n\n var myPlayer = THIS.getMyPlayer()\n\n console.log(attackingPlayer)\n console.log(defendingPlayer)\n console.log(myPlayer)\n\n GameWindow.addServerMessage(\n 'LOSSES',\n attackingPlayer.displayName +\n ' lost ' +\n attackerLoss +\n ' units <br>' +\n defendingPlayer.displayName +\n ' lost ' +\n defenderLoss +\n ' units'\n )\n\n var dead = false\n /* if there are no more units on the territory */\n if (THIS.map[cDest][tDest].soldiers <= 0) {\n // is dead : replace dest soldiers by attackers soldiers\n dead = true\n\n if (attackingPlayer.id == myPlayer.id) {\n // We attacked\n GameWindow.addServerMessage('COMBAT', 'You conquered ' + tDest + ' !')\n } else if (defendingPlayer.id == myPlayer.id) {\n GameWindow.addServerMessage('COMBAT', 'You lost ' + tDest + \" :'(\")\n } else {\n GameWindow.addServerMessage(\n 'COMBAT',\n defendingPlayer.displayName + ' lost ' + tDest\n )\n }\n\n THIS.view.players[THIS.map[cDest][tDest].player].nbTerritories--\n\n /* updating local player territories number (NW UI) */\n if (localStorage.getItem('myId') == THIS.map[cDest][tDest].player) {\n THIS.view.localTerritories--\n }\n\n THIS.map[cDest][tDest].player = THIS.map[cSource][tSource].player\n THIS.map[cDest][tDest].soldiers = restAttack\n THIS.map[cSource][tSource].soldiers -= THIS.attackUnits\n\n console.log('Attacker territory after conquer : ')\n console.log(tSource)\n console.log(THIS.map[cSource][tSource].soldiers)\n console.log('Territory ' + tDest + ' is conquered by the attacker')\n\n /* change the color of a territory during the pre-phase */\n GameWindow.setCountryColor(\n SupportedColors[THIS.map[cSource][tSource].player],\n tmpDest\n )\n /* puts the soldier icon with the number area */\n GameWindow.updateSoldierColor(\n SupportedColors[THIS.map[cSource][tSource].player],\n tDest\n )\n THIS.view.players[THIS.map[cSource][tSource].player].nbTerritories++\n\n /* updating local player territories number (NW UI) */\n if (localStorage.getItem('myId') == THIS.map[cSource][tSource].player) {\n THIS.view.localTerritories++\n }\n\n GameWindow.updateCountrySoldiersNumber(tmpDest)\n GameWindow.updateCountrySoldiersNumber(tmpSource)\n } else {\n GameWindow.updateCountrySoldiersNumber(tmpDest)\n }\n\n // updating the ratio bar\n for (var i = 0; i < THIS.totalPlayers; i++) {\n GameWindow.updateRatioBar(i, THIS.playerList[i].nbTerritories)\n }\n\n if (!dead) {\n this.beginAttackPhase()\n } else {\n // Player can move soldiers\n if (attackingPlayer.id == myPlayer.id) {\n THIS.lastFortify.tSource = tSource\n THIS.lastFortify.tDest = tDest\n GameWindow.fortifyAfterConquering(tSource, tDest)\n }\n }\n }", "function initialisedBars(){\n for(let bar of progressBars){\n bar.style.width = 0 + \"%\";\n }\n}", "function battle(){\n \n if(playerOneAttack && playerTwoAttack){\n console.log(\"both player attacked\")\n playerOneAttack = null; \n playerTwoAttack = null;\n\n characterSelected[1].hp -= characterSelected[0].damage\n characterSelected[0].hp -= characterSelected[1].damage\n console.log( characterSelected);\n \n checkHp();\n \n \n } \n if(playerOneAttack && playerTwoBlock){\n console.log(\"player 1 attacked player 2 blocked\")\n playerOneAttack = null; \n playerTwoBlock = null; \n characterSelected[1].hp -=(characterSelected[0].damage - characterSelected[1].block)\n console.log(characterSelected)\n\n \n checkHp();\n } \n if(playerOneBlock && playerTwoAttack){\n console.log(\"player 1 blocked and p2 attacked\")\n playerOneBlock = null; \n playerTwoAttack = null;\n characterSelected[0].hp -=(characterSelected[1].damage - characterSelected[0].block)\n console.log(characterSelected)\n\n \n checkHp();\n }\n if(playerOneBlock&& playerTwoBlock){\n console.log(\"both players block\")\n playerOneBlock= null; \n playerTwoBlock = null;\n\n\n}}", "function monsterbar() {\n var elem = document.getElementById(\"monsterbar\"); \n\tif (monsterhealth > 0) {\t\t\t\n\t\tvar mwidth = monsterhealth/monsterhp * 100;\n\t} else {\n\t\tvar mwidth = 0;\n\t}\n\telem.style.width = mwidth + '%';\n}", "function updateBoard(player, approvedMove){\n let activeCell;\n for(let i = 1; i <= 100; i++){\n activeCell = document.getElementById(i);\n if(approvedMove[i]){\n activeCell.classList.remove('permission');\n }\n if(i === player.colIdWarrior){\n if (activeCell.className === 'knife') {\n activeCell.classList.remove('knife');\n activeCell.classList.add(player.weapon);\n player.weapon = 'knife';\n } else if (activeCell.className === 'star') {\n activeCell.classList.remove('star');\n activeCell.classList.add(player.weapon);\n player.weapon = 'star';\n } else if (activeCell.className === 'star2') {\n activeCell.classList.remove('star2');\n activeCell.classList.add(player.weapon);\n player.weapon = 'star2';\n } else if (activeCell.className === 'tool') {\n activeCell.classList.remove('tool');\n activeCell.classList.add(player.weapon);\n player.weapon = 'tool';\n } else if (activeCell.className === 'sword') {\n activeCell.classList.remove('sword');\n activeCell.classList.add(player.weapon);\n player.weapon = 'sword';\n } else {\n }\n\n activeCell.style.backgroundImage = `url('img/${player.img}.png'), url('img/${player.weapon}.png')`;\n }\n }\n }", "updateCowboys() {\n for (const cowboy of this.game.currentPlayer.cowboys) {\n if (cowboy.isDead || !cowboy.tile) {\n continue; // don't update dead dudes, they won't come back\n }\n if (cowboy.isDrunk) {\n if (cowboy.drunkDirection !== \"\") {\n // then they are not drunk because of a siesta, so move them\n const next = cowboy.tile.getNeighbor(cowboy.drunkDirection);\n if (!next) {\n throw new Error(`${this} somehow is trying to walk off the map!`);\n }\n if (next.isBalcony || next.cowboy || next.furnishing) { // then something is in the way\n if (next.cowboy) {\n next.cowboy.focus = 0;\n }\n if (next.isBalcony || next.furnishing) {\n cowboy.damage(1);\n if (cowboy.isDead) { // RIP he died from that\n continue; // don't update dead dudes, they won't come back\n }\n }\n }\n else { // the next tile is valid\n cowboy.tile.cowboy = undefined;\n cowboy.tile = next;\n next.cowboy = cowboy;\n if (next.bottle) {\n next.bottle.break();\n }\n }\n }\n cowboy.turnsBusy = Math.max(0, cowboy.turnsBusy - 1);\n cowboy.isDrunk = (cowboy.turnsBusy !== 0);\n cowboy.canMove = !cowboy.isDrunk;\n }\n else { // they are not drunk, so update them for use next turn\n if (cowboy.job === \"Sharpshooter\" && cowboy.canMove && cowboy.turnsBusy === 0) {\n // then the sharpshooter didn't move, so increase his focus\n cowboy.focus++;\n }\n cowboy.canMove = true;\n }\n cowboy.turnsBusy = Math.max(0, cowboy.turnsBusy - 1);\n if (cowboy.job === \"Brawler\") { // damage surroundings\n for (const neighbor of cowboy.tile.getNeighbors()) {\n if (neighbor.cowboy) { // if there is a cowboy, damage them\n neighbor.cowboy.damage(this.game.brawlerDamage);\n }\n if (neighbor.furnishing) { // if there is a furnishing, damage it\n neighbor.furnishing.damage(this.game.brawlerDamage);\n }\n }\n }\n }\n }", "function player_drop() {\n player.pos.y++;\n if (collide(arena, player)) {\n player.pos.y--;\n merge(arena, player);\n player_reset();\n arena_sweep();\n update_score();\n }\n drop_counter = 0;\n}" ]
[ "0.7634496", "0.734443", "0.6687563", "0.6455987", "0.62879467", "0.607514", "0.6048259", "0.60472596", "0.60327476", "0.5959533", "0.59420156", "0.59389675", "0.5932808", "0.592017", "0.59044844", "0.5893292", "0.58797926", "0.5877983", "0.5862519", "0.58483964", "0.5848204", "0.5833991", "0.58291674", "0.58185536", "0.5803507", "0.5797792", "0.5719245", "0.5718351", "0.5711918", "0.57079977", "0.56838226", "0.56748825", "0.56319976", "0.5597703", "0.55951554", "0.55811423", "0.5558836", "0.555592", "0.5543995", "0.5538144", "0.5536507", "0.5526651", "0.5525157", "0.5524124", "0.5524018", "0.55236155", "0.5522634", "0.55083406", "0.5507878", "0.5499595", "0.54986465", "0.5490903", "0.5489922", "0.5479985", "0.5470811", "0.54592746", "0.5453581", "0.5436916", "0.54341877", "0.5430941", "0.5430698", "0.54292923", "0.54279196", "0.54193413", "0.5415771", "0.54044443", "0.5402765", "0.5400548", "0.5394207", "0.53921705", "0.5391331", "0.53901863", "0.5387129", "0.5386352", "0.53774154", "0.5376104", "0.5370386", "0.53636193", "0.5361567", "0.53343874", "0.53313756", "0.5327391", "0.5324177", "0.5322524", "0.5321743", "0.5318132", "0.5316285", "0.5311836", "0.530574", "0.5298317", "0.5286917", "0.5284554", "0.52836007", "0.5283508", "0.5283354", "0.52825344", "0.5278842", "0.5277893", "0.5271249", "0.5261495" ]
0.5784504
26
fight: ================================================ duelMove: this function moves the clicked enemy into the duel zone
function duelMove (fighterClass) { var duelistLocation; attackTime = true; document.querySelector(".message").innerHTML = "Click on Attack to fight. With each attack your character will get stronger." //who villain: this section of code figures out who the chosen duelist is if ($ (fighterClass).attr("id") === "jar") { currentVillain = jar; console.log("current villain is: "); console.log(currentVillain); }; if ($ (fighterClass).attr("id") === "obi") { currentVillain = obi; console.log("current villain is: "); console.log(currentVillain); }; if ($ (fighterClass).attr("id") === "anakin") { currentVillain = anakin; console.log("current villain is: "); console.log(currentVillain); }; if ($ (fighterClass).attr("id") === "mace") { currentVillain = mace; console.log("current villain is: "); console.log(currentVillain); }; if ($ (fighterClass).attr("id") === "jango") { currentVillain = jango; console.log("current villain is: "); console.log(currentVillain); }; //who villain: ======================================= //update remaining: this section of code removes the chosen fighter from the array of fighters remaining for (var w = 0; w < fightersRemaining.length; w++) { if (fightersRemaining[w].id === $ (fighterClass).attr("id")) { fightersRemaining.splice(w,1); console.log("fighters remaining: "); console.log(fightersRemaining); } } //update remaining:=================================== //duel zone: this section of code moves the duelist to the duel zone console.log(fighterClass); $ (".duelArea").append(fighterClass); //duel zone:============================================== //move villains: this section of code will move all the villains where they're supposed to be if (fightersRemaining.length >= 1) { $ ("#enemy1").append(fightersRemaining[0].location); } if (fightersRemaining.length >= 2) { $ ("#enemy2").append(fightersRemaining[1].location); } if (fightersRemaining.length >= 3) { $ ("#enemy3").append(fightersRemaining[2].location); } if (fightersRemaining.length >= 4) { $ ("#enemy4").append(fightersRemaining[3].location); } //move villains: ====================================== }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function moveChar(){\n\t\t$(\".thumbnail\").on(\"click\", function(){\n\t\t\tvar parent = $(this).parent();\n\t\t\tvar selectedChar = $(this).attr(\"id\");\n\n\t\t\t//Moves the enemy character to the appropriate DIV, and adds the corresponding object to combatObj;\n\t\t\tif (lightSide && darkSide == undefined){\n\t\t\t\t$(this).appendTo(\"#darkSideDiv\");\n\t\t\t\tdarkSide = charObj[selectedChar];\n\t\t\t\t$(parent).remove();\n\t\t\t}\n\t\t\t//Moves the user's character to the appropriate DIV, and adds the corresponding object to combatObj;\n\t\t\tif (lightSide == undefined){\n\t\t\t\t$(this).appendTo(\"#lightSideDiv\");\n\t\t\t\tlightSide = charObj[selectedChar];\n\t\t\t\t$(parent).remove();\n\t\t\t\t$(\"#fightButton\").append(\"<button type='button' class='btn btn-danger btn-block'>Fight!</button>\");\n\t\t\t\treturn alertBox(\"Select an enemy to fight.\")\n\t\t\t}\n\t\t\t\n\t\t});\n\t}", "function moveEnemy(){\n var id = $(this).attr(\"data-name\");\n for (let i = 0; i < characters.length; i++){\n if(characters[i].name === id){\n enemy = characters[i];\n }\n }\n $(this).appendTo(\".enemy-area\");\n $(\".character\").off();\n $(this).removeClass(\"character\");\n $(this).addClass(\"enemy\");\n enemySelect = true;\n}", "function move() {\n var id = $(this).attr(\"data-name\");\n for (let i = 0; i < characters.length; i++){\n if(characters[i].name === id){\n player = characters[i];\n }\n }\n $(this).appendTo(\".player-area\");\n $(\".character\").off();\n $(this).removeClass(\"character\");\n $(this).addClass(\"player\");\n $(\".character\").css(\"background-color\", \"red\");\n $(\".character\").on(\"click\", moveEnemy);\n $(\".attack\").css(\"visibility\", \"visible\");\n $(\"h2\").text(\"Choose Your Enemy!\")\n}", "function moveCharForFight(name) {\n fighter2 = NAMES.indexOf(name);\n // put up the attack button\n var r = $('<input/>').attr({\n type: \"button\",\n id: \"attackBtn\",\n value: 'Attack!',\n style: \"display: flex; margin-top: 100px; margin-left: 20px; height: 40px;\",\n });\n $(\".picture-your\").append(r);\n makeRow(1, -1, fighter2, \"black\");\n $(warriors[fighter1].htmlId1).css(\"border-color\", \"white\"); // makeRow makes it black, so undo that\n $(warriors[fighter2].className2).remove(); // remove from the still to attack row\n if (defeated >= 2) { // none left to fight\n $(\"#defenders\").remove();\n } else {\n $(\"#defenders\").html(\"<span>Still Out There</span>\");\n $(\"#defenders\").visible(); // just in case\n }\n }", "function FightLocal() {\n \n this.go=function(command,data) {\n var hit;\n var parsed={};\n\n view2.pMessage.put(\"\");\n view2.eMessage.put(\"\");\n \n // player's strike\n if( global.isActive(\"A\") && command==\"cell\" && data ) {\n parsed = view2.parseGridId(data);\n if ( parsed.prefix != \"e\" ) return;\n hit=enemy.respond([parsed.row,parsed.col]);\n //alert(\">\"+hit);\n player.reflect(hit);\n view2.pStat.showStrikesHits(model.playerStat.strikes,model.playerStat.hits);\n displayResponce( hit, [parsed.row,parsed.col], view2.eBoard, model.enemyBasin, view2.eStat, model.enemyStat, view2.pMessage );// enemy.display\n if ( arbiter.checkout(hit) ) return;\n // fall-through\n }\n \n // LocalScript's strike\n if ( global.isActive(\"B\") && command==\"enemyStrike\" && data.length==2 ) {\n hit=player.respond(data);\n enemy.reflect(hit);\n view2.eStat.showStrikesHits(model.enemyStat.strikes,model.enemyStat.hits);\n displayResponce( hit, data, view2.pBoard, model.playerBasin, view2.pStat, model.playerStat, view2.eMessage );//player.display\n if (hit==\"n\")\n console.log( \"Enemy repeats itself on \"+data+\" that is \"+model.playerBasin.get(data[0],data[1]) );// this is not to happen\n if ( arbiter.checkout(hit) ) return;\n // fall-through\n }\n \n if ( global.getStage()!=\"finish\" ) { // some command out of order\n console.log( \"Out of order: player=\"+global.getActive()+\" command=\"+command+\" data=\"+data+\" stage=\"+global.getStage() );\n return;\n }\n // fall-through\n\n // fight finished\n displayElement(\"finish\");\n global.setState(\"finish\");\n if ( global.isActive(\"A\") ) {\n global.setWinner(\"A\");\n view2.pMessage.put('<span class=\"'+\"win\"+'\">YOU HAVE WON !');\n }\n else {\n global.setWinner(\"B\");\n view2.eMessage.put('<span class=\"'+\"lose\"+'\">ENEMY HAS WON !');\n }\n return; \n };\n}", "function fight(posNew, posOld) {\n\n if (posNew.x === posOld.x \n && posNew.y <= posOld.y + 1 && posNew.y >= posOld.y - 1 ||posNew.y === posOld.y \n && posNew.x <= posOld.x + 1 && posNew.x >= posOld.x - 1) {\n move = false;\n hover = false;\n fightingArea(); // Info.js (70) When the players fight, the board game is hidden\n scores = 0;\n fightPlayerOne(); // Info.js (110)\n fightPlayerTwo(); // Info.js (126)\n }\n}", "function attack(move, onlyenemy){\n\tvar encmov = moves[randomelement(encpok.moves)];\n\tvar moveused = moves[move];\n\tif(onlyenemy){\n\t\tencmov.use(encpok, monout, true);\n\t\tif(!checkforfaint(monout, encpok)) backtonormal();\n\t} else {\n\t\toutput(0, \"\");\n\t\tif(monout.spd >= encpok.spd){\n\t\t\tmoveused.use(monout, encpok, false);\n\t\t\tif(!checkforfaint(encpok, monout, true)){ \n\t\t\t\toutput(0, \"<br>\", 1);\n\t\t\t\tencmov.use(encpok, monout, true);\n\t\t\t\tif(!checkforfaint(monout, encpok, false)) backtonormal();\n\t\t\t}\n\t\t} else {\n\t\t\tencmov.use(encpok, monout, true);\n\t\t\tif(!checkforfaint(monout, encpok, false)){\n\t\t\t\toutput(0, \"<br>\", 1);\n\t\t\t\tmoveused.use(monout, encpok, false);\n\t\t\t\tif(!checkforfaint(encpok, monout, true)) backtonormal();\n\t\t\t}\n\t\t}\n\t}\n\tupdate(true);\n}", "enemyMovementFlow() {\n squares[this.enemyIndex].classList.remove('enemy')\n if (this.enemyShouldMove && !this.enemyHit) {\n // console.log('should move right')\n this.enemyIndex ++ // move right\n this.enemyMoveCount ++\n } else if (!this.enemyShouldMove && !this.enemyHit) {\n // console.log('should move left')\n this.enemyIndex -- // move left\n this.enemyMoveCount --\n }\n if (!this.enemyHit) squares[this.enemyIndex].classList.add('enemy')\n // console.log(this.enemyMoveCount)\n setTimeout(() => {\n this.dropLine()\n }, 250)\n }", "function TravelMove(nextMove) {\n\tif(gridArr[nextMove].encounter == \"combat\"){ // switch from travel to combat\n\t\tOPC.encounter = \"combat\";\n\t\tcombatRounds = 0;\n\t}\n\telse if(gridArr[nextMove].encounter == \"trap\") {\n\t\tOPC.encounter = \"trap\";\n\t}\n\tOPC.lastPos = OPC.currentPos;\n\tOPC.currentPos = nextMove;\n\tUpdateTileMap();\n}", "move(r, c, dr, dc) {\n this.remove(r+dr, c+dc); // kill middle soldier\n this.remove(r, c); // soldier hop start\n this.place(r+2*dr, c+2*dc); // soldier hop end\n }", "function movePlayer() {\n if (turn) {\n var playerX = selectedCharacter.moveAnimation.x;\n playerY = selectedCharacter.moveAnimation.y;\n } else {\n var playerX = enemyUnit.x;\n playerY = enemyUnit.y;\n selectedCharacter = enemyUnit;\n }\n \n destX = path[0][0],\n destY = path[0][1];\n\n\n var coefficientX = 0;\n var coefficientY = 0;\n\n\n if (playerX < destX && playerY < destY) {\n coefficientX = 1.0;\n coefficientY = 1.0;\n } else if (playerX > destX && playerY > destY) {\n coefficientX = -1.0;\n coefficientY = -1.0;\n } else if (playerX < destX && playerY > destY) {\n coefficientX = 1.0;\n coefficientY = -1.0;\n } else if (playerX > destX && playerY < destY) {\n coefficientX = -1.0;\n coefficientY = 1.0;\n } \n\n\n\n var stepX = coefficientX * MOVEMENT_STEP;\n var stepY = coefficientY * MOVEMENT_STEP / 2;\n\n\n selectedCharacter.moveAnimation.x += stepX;\n selectedCharacter.moveAnimation.y += stepY;\n selectedCharacter.hp_bar.x += stepX;\n selectedCharacter.hp_bar.y += stepY;\n\n draggable.x = draggable.x - stepX;\n draggable.y = draggable.y - stepY;\n for (var i = 0; i < selectedCharacter.buffs.length; i++) {\n selectedCharacter.buffs[i][3].x += stepX;\n selectedCharacter.buffs[i][3].y += stepY;\n }\n\n\n if ((playerX === destX) && (playerY === destY)) {\n\n path.splice(0,1);\n if (path.length == 0) {\n console.log(\"finish move\");\n\n selectedCharacter.x = selectedCharacter.moveAnimation.x;\n selectedCharacter.y = selectedCharacter.moveAnimation.y;\n draggable.removeChild(selectedCharacter.moveAnimation);\n draggable.addChild(selectedCharacter);\n \n addPointerNearPlayerAttack();\n //unit = movingUnit;\n //draggable.removeChild(selectedCharacter.moveAnimation);\n //draggable.addChild(selectedCharacter);\n sortIndices(selectedCharacter);\n movingPlayer = false;\n if (undo){\n selectedCharacter.canMove = 1;\n undo = false;\n } else {\n selectedCharacter.canMove = 0;\n }\n \n\n showActionMenuNextToPlayer(selectedCharacter);\n }\n }\n\n sortIndices(selectedCharacter);\n //stage.update();\n changed = true;\n}", "function turnBased() {\n newBoard.highlightMoves(newBoard.activePlayer.character);\n $('.col').click((event) => {\n if ($(event.target).hasClass('highlight')) {\n let currentPlayerCell = Number($(`#${newBoard.activePlayer.character}`).attr('cell'));\n newBoard.movePlayer(newBoard.activePlayer.character);\n $(event.target).addClass('player').attr('id', `${newBoard.activePlayer.character}`);\n let newPlayerCell = Number($(`#${newBoard.activePlayer.character}`).attr('cell'));\n collectWeapon(newBoard.activePlayer, currentPlayerCell, newPlayerCell);\n newBoard.switchPlayer();\n if (fightCondition(newPlayerCell) === true) {\n alert('The fight starts now');\n startFight(newBoard.activePlayer, newBoard.passivePlayer);\n }\n else {\n newBoard.highlightMoves(newBoard.activePlayer.character);\n }\n }\n })\n }", "function move(){\nctx.clearRect(0, 0, canvas.width, canvas.height);\nb++;\nly++;\nif (ly== 700) ly=0;\nif (b >= 700-obrad){\nobstacle(a2,b2-obrad);\nb2++;\nif (b > 700+obrad) {b2=0;b=obrad;}\n}\ndraw();\n}", "attack(enemy) {\n let d = dist(this.x, this.y, enemy.x, enemy.y);\n // if within range, no target acquired, not dead, and the enemy is alive\n // TARGET THE ENEMY\n if (d < 300 && this.targetId < 0 && !this.dead && !enemy.dead) {\n this.targetId = enemy.uniqueId;\n this.obtainedTarget = true;\n }\n let dx = enemy.x - this.x;\n let dy = enemy.y - this.y;\n let angle = atan2(dy, dx);\n\n if (this.targetId === enemy.uniqueId) {\n // get closer to the enemy\n if (d >= 150) {\n this.x += this.speed * cos(angle);\n this.y += this.speed * sin(angle);\n // also keep a distance from the enemy\n } else {\n this.x -= this.speed * cos(angle);\n this.y -= this.speed * sin(angle);\n }\n // if within range, FIRE\n if (d < 200 && !this.bulletFired && !this.dead) {\n this.bullet = new Bullet(this.x, this.y, enemy.x, enemy.y, this.playerId, this.uniqueId);\n this.bulletFired = true;\n this.attacking = true;\n Fire.play();\n } else {\n this.attacking = false;\n }\n if (this.bulletFired && !this.dead) {\n this.attacking = true;\n // if the enemy is not attacking, it will fight back\n if (!enemy.attacking) {\n enemy.targetId = this.uniqueId;\n }\n this.bullet.moveTo(enemy);\n if (this.bullet.dead) {\n this.bulletFired = false;\n this.bullet = null;\n }\n }\n if (enemy.dead) {\n // if the targeted enemy is tank / square XL\n // if the tank gets destroyed and this unit is close to it\n // the explosion kills this unit\n if (enemy.uniqueId === 100 && enemy.uniqueId === this.targetId && d < 100){\n this.health -= enemy.damage;\n }\n this.targetId = -1;\n this.obtainedTarget = false;\n this.attacking = false;\n }\n }\n // variation to the movement\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -0.05, 0.05);\n this.vy = map(noise(this.ty), 0, 1, -0.05, 0.05);\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.0001;\n this.ty += 0.0001;\n\n this.handleWrapping();\n }", "function act(){\n\t\tif(!lunging){\n\t\t\tturnToHero(.8);\n\t\t\tif(distanceToHero() < 4){\n\t\t\t\tmoveFromHero(1.5);\n\t\t\t\tif(angleToHero() < 2 || angleToHero() > 358) lunge(.5, .3, .8, 6, .5, .3);\n\t\t\t}else{\n\t\t\t\tmove(2);\n\t\t\t}\n\t\t}\n\t}", "function enemiesDrop(dir)\r\n{\r\n if(dir == \"l\"){\r\n for(var i = 0; i < 10; i++)\r\n {\r\n if(i == leftMostCol)\r\n {\r\n enemiesR3[i].x = 1;\r\n enemiesR2[i].x = 1;\r\n enemiesR1[i].x = 1;\r\n enemiesR3[i].direction = enemiesR3[i].direction * -1;\r\n enemiesR2[i].direction = enemiesR2[i].direction * -1;\r\n enemiesR1[i].direction = enemiesR1[i].direction * -1;\r\n enemiesR3[i].y += (enemyHeight/2);\r\n enemiesR2[i].y += (enemyHeight/2);\r\n enemiesR1[i].y += (enemyHeight/2);\r\n }\r\n else if(i > leftMostCol){\r\n enemiesR3[i].x = enemiesR3[i-1].x+54;\r\n enemiesR3[i].y += (enemyHeight/2);\r\n enemiesR3[i].direction = enemiesR3[i].direction * -1;\r\n enemiesR2[i].x = enemiesR2[i-1].x+54;\r\n enemiesR2[i].y += (enemyHeight/2);\r\n enemiesR2[i].direction = enemiesR2[i].direction * -1;\r\n enemiesR1[i].x = enemiesR1[i-1].x+54;\r\n enemiesR1[i].y += (enemyHeight/2);\r\n enemiesR1[i].direction = enemiesR1[i].direction * -1;\r\n }\r\n }\r\n }\r\n else if(dir == \"r\"){\r\n for(var i = 9; i >= 0; i--)\r\n {\r\n if(i == rightMostCol)\r\n {\r\n enemiesR3[i].x = canvas.width-enemyWidth-1;\r\n enemiesR2[i].x = canvas.width-enemyWidth-1;\r\n enemiesR1[i].x = canvas.width-enemyWidth-1;\r\n enemiesR3[i].direction = enemiesR3[i].direction * -1;\r\n enemiesR2[i].direction = enemiesR2[i].direction * -1;\r\n enemiesR1[i].direction = enemiesR1[i].direction * -1;\r\n enemiesR3[i].y += (enemyHeight/2);\r\n enemiesR2[i].y += (enemyHeight/2);\r\n enemiesR1[i].y += (enemyHeight/2);\r\n }\r\n else if(i < rightMostCol){\r\n enemiesR3[i].x = enemiesR3[i+1].x-54;\r\n enemiesR3[i].y += (enemyHeight/2);\r\n enemiesR3[i].direction = enemiesR3[i].direction * -1;\r\n enemiesR2[i].x = enemiesR2[i+1].x-54;\r\n enemiesR2[i].y += (enemyHeight/2);\r\n enemiesR2[i].direction = enemiesR2[i].direction * -1;\r\n enemiesR1[i].x = enemiesR1[i+1].x-54;\r\n enemiesR1[i].y += (enemyHeight/2);\r\n enemiesR1[i].direction = enemiesR1[i].direction * -1;\r\n }\r\n }\r\n }\r\n}", "function routeFrame(enemyFighter) {\n\n return 'flying';\n }", "drawSelf(theCanvas, user, theGame) {\n theCanvas.clearEnemy(this);\n this.playerInVicinity(user);\n if (!this.playerIsSeen) {\n let enemyDirection = this.direction % 4;\n if (enemyDirection === 0 && (this.id === 0 || this.id === 4)) {\n if (!theCanvas.detectLine(this.x, this.y + 35)) {\n this.y += 5;\n this.currDirection = \"S\";\n } else {\n if (this.id === 0) {\n this.direction += 2;\n } else {\n this.direction++;\n }\n }\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingDown[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n } else if (enemyDirection === 1 && (this.id === 5 || this.id === 4)) {\n if (!theCanvas.detectLine(this.x + 35, this.y)) {\n this.x += 5;\n this.currDirection = \"E\";\n } else {\n if (this.id === 5) {\n this.direction += 2;\n } else {\n this.direction++;\n }\n }\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingRight[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n } else if (enemyDirection === 2 && (this.id === 0 || this.id === 4)) {\n if (!theCanvas.detectLine(this.x, this.y - 15)) {\n this.y -= 5;\n this.currDirection = \"N\";\n } else {\n if (this.id === 0) {\n this.direction += 2;\n } else {\n this.direction++;\n }\n }\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingUp[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n } else if (enemyDirection === 3 && (this.id === 5 || this.id === 4)) {\n if (!theCanvas.detectLine(this.x - 15, this.y)) {\n this.x -= 5;\n this.currDirection = \"W\";\n } else {\n if (this.id === 5) {\n this.direction += 2;\n } else {\n this.direction++;\n }\n }\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingLeft[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n }\n\n //changes behavior of enemy once player is in distance\n } else {\n if (user.x === this.x || user.x === this.x + 5 || user.x === this.x - 5) {\n if(user.y > this.y){\n this.currDirection = 'S';\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingDown[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n }else{\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingUp[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n this.currDirection = 'N'\n }\n this.attackPlayer(user, theGame);\n \n } else if(user.y === this.y || user.y === this.y + 5 || user.y === this.y - 5){\n if(user.x > this.x){\n this.currDirection = 'E';\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingRight[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n }else{\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingLeft[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n this.currDirection = 'W'\n }\n this.attackPlayer(user, theGame);\n }else{\n if (user.x > this.x && !theCanvas.detectLine(this.x + 35, this.y) && !theCanvas.detectLine(this.x, this.y + 40) && !theCanvas.detectLine(this.x, this.y + 45)) {\n this.x += 5;\n this.currDirection = \"E\";\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingRight[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n } else if (\n user.y < this.y &&\n !theCanvas.detectLine(this.x, this.y - 15)\n ) {\n this.y -= 5;\n this.currDirection = \"N\";\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingUp[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n }else if (\n user.x < this.x &&\n !theCanvas.detectLine(this.x - 15, this.y)\n ) {\n this.x -= 5;\n this.currDirection = \"W\";\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingLeft[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n } else if (\n user.y > this.y &&\n !theCanvas.detectLine(this.x, this.y + 35) && !theCanvas.detectLine(this.x, this.y + 40) && !theCanvas.detectLine(this.x, this.y + 45)\n ) {\n this.y += 5;\n this.currDirection = \"S\";\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingDown[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n }else{\n let currIndexOfEnemy = this.indexOfImage % 4;\n let img = this.enemyMovingDown[currIndexOfEnemy];\n theCanvas.drawEnemy(img, this);\n }\n }\n }\n }", "function fighter(player) {\n var y = player.y - 1;\n\tvar x = player.x - 1;\n\n for(var idx = y; idx < y+3; idx++) {\n \tfor(var idx2 = x; idx2 < x+3; idx2++) {\n if(idx === player.y && idx2 === player.x) {\n } else {\n var area = mapArrays[idx][idx2];\n if(area.terrainType === \"monster\") {\n if(area.monsterType === \"super golem\") {\n currentEnemy = superGolem;\n } else if(area.monsterType === \"dragon\") {\n currentEnemy = dragon;\n } else if(area.monsterType === \"random\") {\n currentEnemy = getMonster();\n }\n combatStarter(currentEnemy);\n if(area.monsterType === \"dragon\") {\n userCommands = [\"attack\", \"potion\", \"equip\"];\n commandDisplayer();\n }\n placedMonsterCombat = true;\n currentEnemyY = area.y;\n currentEnemyX = area.x;\n break;\n }\n }\n }\n }\n}", "function canvasTurn() {\n /* Ensuring that object do not go over the canvas */\n if (this.x >= (canvas.width - this.width)) { //transporting enemy from the right side of canvas to left side.\n this.x = 0;\n }\n if (this.y >= (canvas.height - this.height)) { //transporting enemy from the botton side of canvas to up side.\n this.y = 0;\n }\n if (this.x < 0) { //transporting enemy from the left side of canvas to right side.\n this.x = canvas.width - this.width;\n }\n if (this.y < 0) { //transporting enemy from the up side of canvas to botton side.\n this.y = canvas.height - this.height;\n }\n}", "function enterFightMode(enemyType) {\n inFight = true;\n // Generate a random Pokemon\n var pokemonIndex = 0;\n if (enemyType === \"wild\") {\n pokemonIndex = (Math.round(Math.random() * 3) + 3);\n } else if (enemyType === \"trainer\") {\n pokemonIndex = Math.round(Math.random() * 6);\n }\n ranPokemon = instantiatePokemon(pokemonIndex, enemyType);\n\n // Load stats + images for both pokemon into DOM\n $(\"#enemy-pokemon-name\").text(ranPokemon.name.toUpperCase());\n $(\"#enemy-pokemon-health-bar\").css(\"width\", \"8.1vw\");\n $(\"#enemy-pokemon-level\").text(ranPokemon.level);\n $(\"#enemy-pokemon-image\").hide();\n $(\"#enemy-pokemon-image\").attr(\"src\", ranPokemon.frontImage);\n $(\"#friendly-pokemon-name\").text(myPokemon.name.toUpperCase());\n var healthBarWidth = 8.1 * (myPokemon.currentHP / myPokemon.maxHP);\n $(\"#friendly-pokemon-health-bar\").css(\"width\", healthBarWidth + \"vw\");\n $(\"#friendly-pokemon-level\").text(myPokemon.level);\n $(\"#friendly-pokemon-health-num\").html(myPokemon.currentHP + \" &nbsp; &nbsp; &nbsp; &nbsp;\" + myPokemon.maxHP);\n $(\"#friendly-pokemon-image\").attr(\"src\", myPokemon.backImage);\n $(\"#friendly-pokemon-image\").show();\n var attackMoveDivs = $(\"#move-options-text\").children();\n attackMoveDivs.each(function(index) {\n if (!isNaN(myPokemon.moves[index])) {\n this.innerText = pokeMoves[myPokemon.moves[index]].name;\n this.setAttribute(\"data-value\", myPokemon.moves[index]); \n } else {\n this.innerText = \"--\";\n this.setAttribute(\"data-value\", \"invalid\");\n }\n });\n if (enemyTrainer) {\n $(\"#battle-text\").text(\"Poketrainer \" + enemyTrainer.name + \" sent out \" + ranPokemon.name + \"!\");\n } else {\n $(\"#battle-text\").text(\"A wild \" + ranPokemon.name + \" appears!\");\n }\n $(\"#battle-options\").hide();\n $(\"#battle-text\").show();\n $(\"#battle-screen\").show(\"pulsate\");\n $(\"#enemy-pokemon-image\").show(\"slide\", { direction : \"right\", distance : 300 }, 800);\n $(document).off();\n $(document).on(\"keydown\", function(event) {\n // Keep arrows from moving page around\n if(event.keyCode && [32, 37, 38, 39, 40].indexOf(event.keyCode) > -1) {\n event.preventDefault();\n }\n\n if (event.keyCode === 65 || event.keyCode === 75) {\n turn = 0;\n takeTurn();\n }\n });\n $(document).on(\"click\", function(event) {\n if (event.target.id === \"a-button\" || event.target.id === \"b-button\") {\n turn = 0;\n takeTurn();\n }\n })\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}", "function choose_enemy() {\n\tvar plane_left_margin = 0;\n\tvar hp;\n\tif(distance % 700 == 0) {\n\t\tplane_left_margin = Math.floor(Math.random() * (751 - enemy_planes[5].width));\n\t\thp = create_enemy(plane_left_margin, enemy_planes, 5);\n\t\tvar rows = 0;\n\t\tclearInterval(hp.times);\n\t\thp.times = setInterval(function(){\n\t\t\tif (!pause_clicked) {\n\t\t\t\trows++;\n\t\t\t\tspecial_bullet(hp, 1);\n\t\t\t\tif (rows > 1 || dead || (hp.HP == 0) ){\n\t\t\t\t\tclearInterval(hp.times);\n\t\t\t\t}\n\t\t\t}\n\t\t},500);\n\t} \n\telse if(distance % 300 == 0) {\n\t\tplane_left_margin = Math.floor(Math.random() * (751 - enemy_planes[4].width));\n\t\tcreate_enemy(plane_left_margin, enemy_planes, 4)\n\t} \n\telse if(distance % 200 == 0) {\n\t\tplane_left_margin = Math.floor(Math.random() * (751 - enemy_planes[3].width));\n\t\tcreate_enemy(plane_left_margin, enemy_planes, 3)\n\t}\n\telse if(distance % 150 == 0) {\n\t\tplane_left_margin = Math.floor(Math.random() * (751 - enemy_planes[2].width));\n\t\tcreate_enemy(plane_left_margin, enemy_planes, 2)\n\t} \n\telse if(distance % 75 == 0) {\n\t\tplane_left_margin = Math.floor(Math.random() * (751 - enemy_planes[1].width));\n\t\tcreate_enemy(plane_left_margin, enemy_planes, 1)\n\t} \n\telse if(distance % 30 == 0) {\n\t\tplane_left_margin = Math.floor(Math.random() * (751 - enemy_planes[0].width));\n\t\tcreate_enemy(plane_left_margin, enemy_planes, 0);\n\t}\n}", "function monsterAttack(){\n\tif(rleft + mleft === 56){\n\t\t$('#monster').addClass('attack');\n\t}\n\tif(rleft + mleft === 76){\n\t\t$('#monster').css('left', 10+\"em\");\n\t\txleft = 10;\n\t}\n\tif(rleft + mleft === 96){\n\t\t$('#monster').css('left', 20+\"em\");\n\t\txleft = 20;\n\t}\n\tif(rleft + mleft === 116){\n\t\t$('#monster').css('left', 30+\"em\");\n\t\txleft = 30;\n\t}\n}", "function fighting() {\n enemies.forEach((enemy, index_enemy) => {\n allies.forEach((ally, index_ally) => {\n if (enemies[index_enemy].combat && allies[index_ally].combat == true) {\n enemies[index_enemy].hp = enemies[index_enemy].hp - allies[index_ally].damage / 60;\n allies[index_ally].hp = allies[index_ally].hp - enemies[index_enemy].damage / 60;\n hit_sound.volume = 0.5;\n hit_sound.play();\n //console.log(\"Enemy HP: \" + enemies[index_enemy].hp);\n //console.log(\"Ally HP: \" + allies[index_ally].hp);\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").src = \"zombie_action2.png\";\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").src = \"adventurer_action2.png\";\n }\n if (enemies[index_enemy].hp < 0) {\n enemies.splice(index_enemy, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n points = points + 30;\n updatePoints();\n document.querySelector(\"img.wizard[data-id='\" + enemy.id + \"']\").remove();\n }\n if (allies[index_ally].hp < 0) {\n allies.splice(index_ally, 1);\n death_sound.volume = 0.2;\n death_sound.play();\n document.querySelector(\"img.ally[data-id='\" + ally.id + \"']\").remove();\n }\n\n });\n });\n // Laat ze doorlopen als combat voorbij is\n allies.forEach((ally, index_ally) => {\n allies[index_ally].combat = false;\n });\n enemies.forEach((enemy, index_enemy) => {\n enemies[index_enemy].combat = false;\n });\n\n}", "move() {\r\n this.y = this.y + Enemy.v;\r\n }", "function Attack()\n{\n\tvar speedTowardsPlayer = moveSpeed;\n\t\n\t//if enemy is on the right side of the player move left\n\tif(player.transform.position.x < transform.position.x)\n\t{\n\t\tfacingLeft = true;\n\t\tspeedTowardsPlayer = -speedTowardsPlayer;\n\t\trenderer.material.mainTexture = mainTextures[curFrame]; // Get the current animation frame\n\t}\n\t//if enemy is on the left side of the player move right\n\telse\n\t{\n\t\tfacingLeft = false;\n\t\trenderer.material.mainTexture = altTextures[curFrame]; // Get the current animation frame\n\t}\n\t\t\n\trigidbody.velocity = Vector3(speedTowardsPlayer, rigidbody.velocity.y, 0); // Move to the left\n}", "function move() {\n\t\tmovePiece(this);\n\t}", "function chooseEnemy() {\n\n \n $(this).detach().appendTo(\"#their-fighter-row\");\n\n $(this).addClass(\"currentEnemy\")\n\n $(document).off(\"click\", \"#combat-zone .enemy\", chooseEnemy);\n\n \n }", "dragonCatchPlayer(delta, hero){\n // subtract (= difference vector)\n\t\tlet dx = hero.x - this.x;\n\t\tlet dy = hero.y - this.y;\n\t\n\t\t// normalize (= direction vector)\n\t\t// (a direction vector has a length of 1)\n\t\tlet length = Math.sqrt(dx * dx + dy * dy);\n\t\tif (length) {\n\t\tdx /= length;\n\t\tdy /= length;\n\t\t}\n\t\t\n\t\tlet dX1 = this.x;\n\t\tlet dY1 = this.y;\n\t\n\t\t// move\n\t\t// delta is the elapsed time in seconds\n\t\t// SPEED is the speed in units per second (UPS)\n\t\tthis.x += dx * delta * this.speed;\n\t\tthis.y += dy * delta * this.speed;\n\t\n\t\t//Dragon movment \n\t\tif (dY1 > this.y) { // this holding up\n\t\t\tthis.frameY = 3;\n\t\t\tthis.moving = true;\n\t\t}\n\t\tif (dY1 < this.y) { // this holding down\n\t\t\tthis.frameY = 0;\n\t\t\tthis.moving = true;\n\t\t}\n\t\tif (dX1 > this.x) { // this holding left\n this.frameY = 1;\n\t\t\tthis.moving = true;\n\t\t}\n\t\tif (dX1 < this.X) { // this holding right\n\t\t\tthis.frameY = 2;\n\t\t\tthis.moving = true;\n\t\t}\n\n }", "autoMovement(du) {\n if (this.isDead) return;\n\n const diffX = this.knight.x - this.x;\n\n let collidesWithKnight = this.collidesWithKnight();\n\n //Follow\n if(Math.abs(diffX) > this.walkSpeed * du && !collidesWithKnight) {\n //Move x direction\n if( diffX > 0) {\n this.isIdle = false;\n this.dirX = 1;\n this.x += this.walkSpeed*du;\n }else {\n this.isIdle = false;\n this.dirX = -1;\n this.x -= this.walkSpeed*du;\n }\n }\n // If knight is hit\n if(collidesWithKnight) {\n this.isIdle = false;\n this.isAttacking = true;\n this.knight.health.depleteLifePoints();\n }\n }", "function fight (){\n\t\t$(\"#fightButton\").on(\"click\", function(){\n\t\t\tdarkSide.health -= lightSide.currentAttack;\n\t\t\tlightSide.attackMod();\n\t\t\tlightSide.health -= darkSide.counterAttack;\n\t\t\tmakeChar(\"#lightSideDiv\", \"<div>\", lightSide, true)\n\t\t\tmakeChar(\"#darkSideDiv\", \"<div>\", darkSide, true)\n\n\t\t\t// $(\"#darkSideDiv\").attr(\"<p>\", darkSide.health);\n\t\t\tif (darkSide.health <= 0) {\n\t\t\t\tcounter--;\n\t\t\t\tif (counter === 0) {\n\t\t\t\t\talertBox(\"The force is strong with you - you win!\");\n\t\t\t\t}\n\t\n\t\t\t\telse {\n\t\t\t\t\tdarkSide = undefined;\n\t\t\t\t\t$(\"#darkSideDiv\").empty();\n\t\t\t\t\talertBox(\"You are victorious! Select another character to fight.\");\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif(lightSide.health <= 0){\n\t\t\t\talertBox(\"You are not a Jedi yet - GAME OVER.\");\n\t\t\t\t//Change button to \"play again\"\n\t\t\t}\n\t\t});\n\t}", "function enemyFire() {\r\n const [col, row] = enemyFireLocation();\r\n //miss\r\n if (board[col+row] === '~') {\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).addClass(\"miss\")\r\n //hit\r\n } else {\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).removeClass(\"placed\")\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).removeClass(\"place\")\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).addClass(\"hit\")\r\n //adds adjacent squares as next targets\r\n addTargets([col, row]);\r\n }\r\n //add letter from board class onto table\r\n $(\".playerBoard\").find(`.${row}`).find(`.${col}`).text(board[col+row]);\r\n }", "moveSpaceInvadersEnemies() {\n /*\n Van de izquierda a derecha\n mientras que la esquina derecha del enemigo de la derecha no colisione con el límite de la derecha\n sumas a x\n bajan\n sumas una fila a y \n van de derecha a izquierda\n mientras que la esquina izquierda del enemigo de la izquierda no colisione con el límite de la izquierda\n restas a x\n bajan\n sumas una fila a y \n REPITE hasta que un enemigo de la fila inferior colisione con player\n */\n\n this.spaceInvadersEnemiesShootsTimerId = setInterval(() => {\n /*\n Elegimos una columna aleatoria\n El último enemigo de esa columna \n Dispara\n\n 0 1 2 3\n ceil(rand*4) => [1, 4] -1 => [0, 3]\n */\n let shootColumn = Math.ceil(Math.random() * game.model.siEnemiesPerRow) - 1;\n let lastEnemy;\n for (let i = 0; i < game.model.siEnemies.length; i++) {\n let enemy = game.model.siEnemies[i][shootColumn];\n if (enemy && enemy.elem.style.display !== \"none\") {\n lastEnemy = enemy;\n } else {\n continue;\n }\n }\n\n if (lastEnemy)\n lastEnemy.shoot();\n }, 1500);\n\n for (let i = 0; i < game.model.siEnemies.length; i++) {\n for (let j = 0; j < game.model.siEnemies[i].length; j++) {\n let enemy = game.model.siEnemies[i][j];\n enemy.collisionable = true;\n enemy.elem.style.display = \"inline\";\n enemy.moveEnemyLeftToRight();\n }\n }\n }", "function RunAI(enemy) {\n\t//attack AI\n\tif (enemy.attackAI == 'calm') {\n\t\tif (enemy.weapon.type == 'charger' && menu == false) {\n\t\t\tif (enemy.charge < enemy.weapon.max_charge) {\n\t\t\t\tenemy.charge += 0.5;\n\t\t\t}\n\n\t\t\tenemy.cooldown -= 1;\n\t\t\t//console.log(enemy.cooldown);\n\n\t\t\tif ((enemy.direction == 'DOWN' && (X == enemy.pos.x || X == enemy.pos.x - 1) && Y >= enemy.pos.y) || (enemy.direction == 'LEFT' && (Y == enemy.pos.y || Y == enemy.pos.y - 1) && X <= enemy.pos.x) || (enemy.direction == 'UP' && (X == enemy.pos.x || enemy.pos.x + 1) && Y <= enemy.pos.y) || (enemy.direction == 'RIGHT' && (Y == enemy.pos.y || Y == enemy.pos.y + 1) && X >= enemy.pos.x)) {\n\t\t\t\tif (menu == false && textBox == undefined && enemy.weapon != undefined && enemy.cooldown <= 0) {\n\t\t\t\t\tlet xx = enemy.pos.x;\n\t\t\t\t\tlet yy = enemy.pos.y;\n\n\t\t\t\t\tlet x;\n\t\t\t\t\tlet y;\n\t\t\t\t\tif (enemy.direction == 'UP') {\n\t\t\t\t\t\tx = xx;\n\t\t\t\t\t\ty = yy - 2;\n\t\t\t\t\t} else if (enemy.direction == 'DOWN') {\n\t\t\t\t\t\tx = xx - 1;\n\t\t\t\t\t\ty = yy;\n\t\t\t\t\t} else if (enemy.direction == 'RIGHT') {\n\t\t\t\t\t\tx = xx + 1;\n\t\t\t\t\t\ty = yy;\n\t\t\t\t\t} else if (enemy.direction == 'LEFT') {\n\t\t\t\t\t\tx = xx - 2;\n\t\t\t\t\t\ty = yy - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet data = {\n\t\t\t\t\t\tdmg: enemy.charge + enemy.weapon.dmg,\n\t\t\t\t\t\tid: enemy.id,\n\t\t\t\t\t\tdirection: enemy.direction,\n\t\t\t\t\t\tpos: {\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y,\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttype: 'bullet',\n\t\t\t\t\t}\n\n\t\t\t\t\tentities.push(data);\n\t\t\t\t\t//socket.emit('attack', data);\n\t\t\t\t\tcharge = 0;\n\t\t\t\t\tenemy.cooldown = 100;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t//movement AI\n\tif (enemy.moveAI == 'stationary') {\n\t\tif (enemy.timer <= 0) {\n\t\t\tlet num = Random(4);\n\t\t\tif ((num == 0 && enemy.preset == undefined) || enemy.preset == 'LEFT') {\n\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((Y == enemy.pos.y || Y == enemy.pos.y - 1 || Y == enemy.pos.y + 1) && X <= enemy.pos.x) {\n\t\t\t\t\tenemy.preset = 'LEFT';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if ((num == 1 && enemy.preset == undefined) || enemy.preset == 'DOWN') {\n\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((X == enemy.pos.x || X == enemy.pos.x - 1 || X == enemy.pos.x + 1) && Y >= enemy.pos.y) {\n\t\t\t\t\tenemy.preset = 'DOWN';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if ((num == 2 && enemy.preset == undefined) || enemy.preset == 'RIGHT') {\n\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((Y == enemy.pos.y || Y == enemy.pos.y - 1 || Y == enemy.pos.y + 1) && X >= enemy.pos.x) {\n\t\t\t\t\tenemy.preset = 'RIGHT';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if ((num == 3 && enemy.preset == undefined) || enemy.preset == 'UP') {\n\t\t\t\tenemy.direction = 'UP';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((X == enemy.pos.x || X == enemy.pos.x - 1 || X == enemy.pos.x + 1) && Y <= enemy.pos.y) {\n\t\t\t\t\tenemy.preset = 'UP';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if (enemy.preset != undefined) {\n\t\t\t\tswitch (enemy.preset) {\n\t\t\t\t\tcase 'UP':\n\t\t\t\t\t\tenemy.direction = 'UP';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'DOWN':\n\t\t\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'LEFT':\n\t\t\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'RIGHT':\n\t\t\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tenemy.preset = undefined;\n\t\t\t}\n\t\t\t//console.log(num);\n\t\t}\n\t\tenemy.timer -= 1;\n\t}\n\n\tif (enemy.moveAI == 'basic') {\n\t\tx = enemy.pos.x + 2;\n\t\ty = enemy.pos.y + 2;\n\n\t\tlet z = X;\n\t\tlet w = Y;\n\t\tconsole.log(`you: ${z}, ${w}`);\n\t\tconsole.log(`them: ${x}, ${y}`);\n\n\t\tif(x < z){\n\t\t\tif(y < w){\n\t\t\t\tif(y + 8 > x){\n\t\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\t}else if(y < x){\n\t\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\t}\n\t\t\t}else if(y > w){\n\t\t\t\tif(y - 8 < x){\n\t\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\t}else if(y > x){\n\t\t\t\t\tenemy.direction = 'UP';\n\t\t\t\t}\n\t\t\t}\n\t\t}else if(x > z){\n\t\t\tif(y < w){\n\t\t\t\tif(y > x){\n\t\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\t}else if(y < x){\n\t\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\t}\n\t\t\t}else if(y > w){\n\t\t\t\tif(y < x){\n\t\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\t}else if(y > x){\n\t\t\t\t\tenemy.direction = 'UP';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function farm() {\n var lowest_health = lowest_health_partymember();\n\n //If we have a target to heal, heal them. Otherwise attack a target.\n if (lowest_health != null && lowest_health.health_ratio < 0.8) {\n if (distance_to_point(lowest_health.real_x, lowest_health.real_y) < character.range) {\n heal(lowest_health);\n } else {\n move_to_target(lowest_health);\n }\n } else {\n let player = get_player(\"Sozaw\");\n if (player != null) {\n var target = get_target_of(player);\n }\n if (target != null && is_monster(target)) {\n if (player != null && target != null && target.s.cursed == undefined && in_attack_range(target)) {\n if (target.hp > 6000) {\n curse(target)\n }\n }\n if (distance_to_point(target.real_x, target.real_y) < character.range) {\n if (can_attack(target)) {\n attack(target);\n }\n }\n } else {\n let player = get_player(\"Sozaw\");\n if (player != null && distance_to_point(player.real_x, player.real_y) > 300) {\n ask_location(\"Sozaw\")\n }\n if (player != null && distance_to_point(player.real_x, player.real_y) < 300) {\n stop(move)\n move(\n character.x + ((player.x - character.x) - 20),\n character.y + ((player.y - character.y) - 20));\n }\n else {\n if (player == null && !smart.moving) {\n ask_location(\"Sozaw\")\n }\n }\n }\n }\n}", "enemyAttack () {\r\n // declaring variables\r\n let hitRow = 0;\r\n let hitCol = 0;\r\n let $selector; \r\n // Check if the last hit of enemy is on a ship, if it is not call the\r\n // the random atack, else, try to find the rest of the ship.\r\n if (!this.lastEnemyHit.hitted) {\r\n this.enemyRandomAttack ();\r\n }\r\n else {\r\n // Loop to find the rest of the ship\r\n while (true) \r\n {\r\n // Set col and the row to the last enemy hit\r\n hitRow = this.lastEnemyHit.row;\r\n hitCol = this.lastEnemyHit.col;\r\n \r\n // If the test col of lastEnemyhit is true, test for the columns.\r\n // else test for the rows\r\n if (this.lastEnemyHit.testCol == true) {\r\n // if colIncrease from lastEnemyHit is true, text next cols\r\n // else test cols in the \r\n // decresing order.\r\n if (this.lastEnemyHit.colIncrease == true) {\r\n // if the last hitted col is equal the map size set the \r\n // colIncrease to false to test the cols in the \r\n // decresing order.\r\n if (hitCol == MAP_SIZE) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false\r\n };\r\n continue;\r\n }\r\n // increase the col to test the next \r\n hitCol ++;\r\n // Select the next \r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n // test if the next is already hitted.\r\n // Else set increaseCol To false to test the cols in the \r\n // decresing order.\r\n \r\n if (!this.map.isCellHitted($selector)) {\r\n // Check if the enemy hitted the ship, and if it does,\r\n // just keep going.\r\n // Else change to check to test the previous cols\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n };\r\n } \r\n \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false\r\n };\r\n }\r\n break;\r\n }\r\n\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n colIncrease:false,\r\n };\r\n }\r\n }\r\n // Does the same logic of the cols, but decreasing the colums.\r\n else {\r\n if (hitCol == 1) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n testRow: true,\r\n testCol: false\r\n };\r\n continue;\r\n }\r\n hitCol--;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n \r\n // If the enemy find something already hitted or\r\n // empty, next time he will try the colums,\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n };\r\n } \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol,\r\n testRow: true,\r\n testCol: false\r\n };\r\n this.lastEnemyHit.col++;\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n col: hitCol\r\n };\r\n }\r\n }\r\n }\r\n // Does the same logic from the cols to the rows, with a fell changes\r\n // in the next commets\r\n else if (this.lastEnemyHit.testRow == true) {\r\n if (this.lastEnemyHit.rowIncrease == true) {\r\n if (hitRow == MAP_SIZE) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n rowIncrease:false\r\n };\r\n continue;\r\n }\r\n // Increase the rows \r\n hitRow ++;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n // Work the same as the cols increasing.\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n } \r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n rowIncrease:false\r\n };\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n }\r\n }\r\n else {\r\n if (hitRow <= 1) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n hitted: false,\r\n testRow: false,\r\n testCol: true,\r\n rowIncrease: true,\r\n colIncrease: true\r\n };\r\n break;\r\n }\r\n hitRow--;\r\n $selector = $(`.droppable-player[data-row=\"${hitRow}\"][data-col=\"${hitCol}\"]`);\r\n if (!this.map.isCellHitted($selector)) {\r\n if (this.isEnemyHittedShip(hitRow, hitCol, $selector)) {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n } \r\n // reset everything if the enemy not find the boat\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n hitted: false,\r\n testRow: false,\r\n testCol: true,\r\n rowIncrease: true,\r\n colIncrease: true\r\n };\r\n }\r\n break;\r\n }\r\n else {\r\n this.lastEnemyHit = {\r\n ...this.lastEnemyHit,\r\n row: hitRow,\r\n };\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n this.map.checkVictoryCondition(this.playerShips);\r\n }", "fight() {\n this.inFight = true;\n this.fightTween = game.add.tween(this);\n // Small delay to allow the player to finish his movement, -1 for looping\n this.fightTween.to({}, Phaser.Timer.SECOND, null, false, 150, -1);\n this.fightTween.onStart.add(function fightAction() { this.fightAction(); }, this);\n this.fightTween.onLoop.add(function fightAction() { this.fightAction(); }, this);\n this.fightTween.start();\n }", "function gm_attack(direction, pow1id, pow2id, zid, room, opponent_team, card1, normal_attack, underdog, tiebreaker, bribe, ambush) { /* (ttt.up, ) */\r\n\tlet spiked = false;\r\n\tlet reach_target = false;\r\n\tlet target_team = null;\r\n\t//if (direction(zid)>=0)\r\n\t\t//console.log(\"0/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\tif (direction(zid)>=0 && room.game.board[direction(zid)][0]!=\"\") { /* has card */\r\n\t\t//console.log(\"1/2 gm_attack: \",direction(zid),\" \",room.game.board[direction(zid)][0]);\r\n\t\tlet target_card_id = null;\r\n\t\tlet target_zone_id = null;\r\n\t\tif (room.game.board[direction(zid)][2]===opponent_team) { /* is enemy card */\r\n\t\t\ttarget_card_id = parseInt(room.game.board[direction(zid)][1])-1;\r\n\t\t\ttarget_zone_id = direction(zid);\r\n\t\t\tif (room.game.board[direction(zid)][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t} else {\r\n\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t}\r\n\t\t} else \r\n\t\tif (room.game.board[direction(zid)][2]===(opponent_team===\"X\"?\"O\":\"X\")) { /* is allied card */\r\n\t\t\tif ((card1[4]===6 || card1[5]===6) && direction(direction(zid))>=0 && room.game.board[direction(direction(zid))][2]===opponent_team) { // [R]each\r\n\t\t\t\ttarget_card_id = parseInt(room.game.board[direction(direction(zid))][1])-1;\r\n\t\t\t\ttarget_zone_id = direction(direction(zid));\r\n\t\t\t\treach_target = true;\r\n\t\t\t\tif (room.game.board[direction(direction(zid))][0]===opponent_team) { /* whose deck is it from? */\r\n\t\t\t\t\ttarget_team = opponent_team;\r\n\t\t\t\t} else {\r\n\t\t\t\t\ttarget_team = (opponent_team===\"X\"?\"O\":\"X\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (target_card_id!=null) {\r\n\t\t\t//console.log(\"2/2 gm_attack: \",card2);\r\n\t\t\tlet card2 = null; \r\n\t\t\tif (room.game.players[0].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[0].deck[target_card_id]; \r\n\t\t\t}\r\n\t\t\telse if (room.game.players[1].team===target_team) { \r\n\t\t\t\tcard2 = room.game.players[1].deck[target_card_id];\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconsole.log(\"\\n{we should never get here #1}\\n\");\r\n\t\t\t}\r\n\t\t\tif (card2!=null) { /* we are gm_attacking this card */\r\n\t\t\t\tlet has_chain = (card2[4]==7 || card2[5]==7);\r\n\t\t\t\tlet pow1 = card1[pow1id];\r\n\t\t\t\tlet pow2 = card2[pow2id];\r\n\t\t\t\tlet cost1 = card1[0]+card1[1]+card1[2]+card1[3];\r\n\t\t\t\tlet cost2 = card2[0]+card2[1]+card2[2]+card2[3];\r\n\t\t\t\tif (pow1>pow2) { /* [N]ormal gm_attack */\r\n\t\t\t\t\tnormal_attack[0]+=1;\r\n\t\t\t\t\tnormal_attack[1]+=pow2;\r\n\t\t\t\t\tnormal_attack[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2 && cost1<cost2) { /* [U]nderdog */\r\n\t\t\t\t\tunderdog[0]+=1;\r\n\t\t\t\t\tunderdog[1]+=pow2;\r\n\t\t\t\t\tunderdog[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (pow1===pow2) { /* [T]iebreaker */\r\n\t\t\t\t\ttiebreaker[0]+=1;\r\n\t\t\t\t\ttiebreaker[1]+=pow2;\r\n\t\t\t\t\ttiebreaker[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (cost1===cost2) { /* [B]ribe */\r\n\t\t\t\t\tbribe[0]+=1;\r\n\t\t\t\t\tbribe[1]+=pow2;\r\n\t\t\t\t\tbribe[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif (true) { /* [A]mbush */\r\n\t\t\t\t\tambush[0]+=1;\r\n\t\t\t\t\tambush[1]+=pow2;\r\n\t\t\t\t\tambush[2].push([target_card_id+1,target_zone_id+1,target_team,has_chain]);\r\n\t\t\t\t}\r\n\t\t\t\tif((card2[4]===9 || card2[5]===9) && reach_target===false && pow1<pow2) {\r\n\t\t\t\t\tspiked = true;\r\n\t\t\t\t}\r\n\t\t\t\treturn spiked;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn spiked;\r\n}", "updateFighterAction(f1) {\n\n // if no input applied and we were running, switch to idle\n let inputApplied = game.inputsApplied.indexOf(f1.playerId) >= 0;\n if (!inputApplied && f1.action === Fighter.ACTIONS.RUN)\n f1.action = Fighter.ACTIONS.IDLE;\n\n // end-of-action handling\n if (f1.progress === 0) {\n f1.progress = 99;\n\n // end of dying sequence\n if (f1.action === Fighter.ACTIONS.DIE) {\n game.removeObjectFromWorld(f1);\n return;\n }\n\n // if no input applied on this turn, switch to idle\n if (!inputApplied && f1.action === Fighter.ACTIONS.FIGHT)\n f1.action = Fighter.ACTIONS.IDLE;\n }\n }", "function fight() {\n\n if (readyToFight && isGameActive) {\n console.log(\"AI Fighter\");\n console.log(aiPlayer);\n console.log(\"Human Fighter\");\n console.log(humanPlayer);\n\n // Human attack AI\n aiPlayer.healthPoint -= humanPlayer.currentAttackPoint;\n\n // AI attacks human\n humanPlayer.healthPoint -= aiPlayer.counterAttackPoints;\n\n //Human power increase by baseAttachPoint\n humanPlayer.currentAttackPoint += humanPlayer.baseAttackPoint;\n\n // update the interface\n $(\"#ptext\" + humanPlayer.id).html(\"HP: \" + humanPlayer.healthPoint);\n $(\"#ptext\" + aiPlayer.id).html(\"HP: \" + aiPlayer.healthPoint);\n\n // check if the human is still alive\n if (humanPlayer.healthPoint <= 0) {\n humanPlayer.isAlive = false;\n gameOverMessage(humanPlayer.isAlive);\n }\n\n // check if the AI is alive\n if (aiPlayer.healthPoint <= 0) {\n\n aiPlayer.isAlive = false;\n readyToFight = false;\n isAIPlayerSelected = false;\n\n // the current AI is dead, ask the user to select the next one\n var msg = aiPlayer.characterName + \" is dead. Select the next enemy!\";\n $(\"#instructions-3\").html(msg);\n $(\"#ptext\" + aiPlayer.id).html(msg);\n setGameInfo(msg);\n } else{\n setGameInfo(\"\");\n\n }\n }\n\n // Check if there are any enemies left. if none, then send the win message if you are still alive\n var numberOFEnemiesRemaining = numberOFEnemiesRemainingToFight();\n if (numberOFEnemiesRemaining <= 0 && humanPlayer.isAlive) {\n gameOverMessage(humanPlayer.isAlive);\n }\n\n\n \n}", "function move_enemy()\n{\t\t\t\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\tenemies[i]['position'][0] += 2;\n\t\t\tenemies[i]['position'][1] += 2;\n\t\t\tenemies[i]['direction'] = 'downright';\n\n\t\t} \n\t\telse if (player['position'][0] < enemies[i]['position'][0] && player['position'][1] < enemies[i]['position'][1])\n\t\t{\n\t\t\tenemies[i]['position'][0] -= 2;\n\t\t\tenemies[i]['position'][1] -= 2;\n\t\t\tenemies[i]['direction'] = 'upleft';\n\t\t}\n\t\telse if (player['position'][0] > enemies[i]['position'][0] && player['position'][1] < enemies[i]['position'][1])\n\t\t{\n\t\t\tenemies[i]['position'][0] += 2;\n\t\t\tenemies[i]['position'][1] -= 2;\n\t\t\tenemies[i]['direction'] = 'upright';\n\t\t}\n\t\telse if (player['position'][0] < enemies[i]['position'][0] && player['position'][1] > enemies[i]['position'][1])\n\t\t{\n\t\t\tenemies[i]['position'][0] -= 2;\n\t\t\tenemies[i]['position'][1] += 2;\n\t\t\tenemies[i]['direction'] = 'downleft';\n\t\t}\n\t else if (player['position'][0] > enemies[i]['position'][0])\n\t\t{\n\t\t\tenemies[i]['position'][0] += 2;\n\t\t\tenemies[i]['direction'] = 'right';\n\t\t} \n\t\telse if (player['position'][0] < enemies[i]['position'][0])\n\t\t{\n\t\t\tenemies[i]['position'][0] -= 2;\n\t\t\tenemies[i]['direction'] = 'left';\n\t\t}\n\t\telse if (player['position'][1] > enemies[i]['position'][1])\n\t\t{\n\t\t\tenemies[i]['position'][1] += 2;\n\t\t\tenemies[i]['direction'] = 'down';\n\t\t}\n\t\telse if (player['position'][1] < enemies[i]['position'][1])\n\t\t{\n\t\t\tenemies[i]['position'][1] -= 2;\n\t\t\tenemies[i]['direction'] = 'up';\n\t\t}\n\t}\n}", "function killPlayer1(player, hazard) {\n\t\t\tif (invincible == false) {\n\t\t\t\tthis.player.body.x = 300;\n\t\t\t\tthis.player.body.y = 2525;\n\t\t\t}\n\t\t}", "attackTarget(attack) {\n _gameService.attackTarget(attack)\n draw()\n }", "move() {\n const skier = Players.getInstance(\"skier\").getPlayer(\"skier\");\n this.direction = skier.direction;\n if (!this.eating) {\n if (skier.checkIfSkierStopped()) {\n this.y += this.speed;\n this.distance_gained_on_stop += this.speed;\n this.checkIfRhinoHitsSkier(skier);\n } else {\n this.y = skier.y - Constants.RHINO_SKIER_DISTANCE;\n this.y += this.distance_gained_on_stop;\n this.x = skier.x;\n }\n }\n }", "updateDinoAction(f1) {\n\n // Dinos keep walking\n if (f1.action === Fighter.ACTIONS.RUN)\n f1.position.x += game.walkSpeed * f1.direction;\n\n // end-of-action handling\n if (f1.progress === 0) {\n f1.progress = 99;\n\n // end of dying sequence\n if (f1.action === Fighter.ACTIONS.DIE) {\n\n // Dino fighters come back to life\n if (f1.isDino) {\n let f = game.addFighter(0);\n f.isDino = true;\n f.direction = 1;\n }\n game.removeObjectFromWorld(f1);\n return;\n }\n\n // choose direction and action\n if (Math.random() > 0.7) f1.direction *= -1;\n let nextAction = Math.floor(Object.values(Fighter.ACTIONS).length * Math.random());\n if (nextAction !== Fighter.ACTIONS.DIE && nextAction !== Fighter.ACTIONS.FIGHT)\n f1.action = nextAction;\n if (nextAction === Fighter.ACTIONS.JUMP && f1.velocity.length() === 0)\n f1.velocity.y = game.jumpSpeed;\n }\n }", "function killPlayer2(player, hazard) {\n\t\t\tif (invincible == false) {\n\t\t\t\tthis.player.body.x = 3910;\n\t\t\t\tthis.player.body.y = 2165;\n\t\t\t}\n\t\t}", "flee(){ \n if (this.isDead === false) {\n cells[this.position].classList.remove(this.classname)\n this.deathOfEither()\n const x = this.position % width\n const y = Math.floor(this.position / width)\n \n if (playerPosition > this.position && playerPosition - this.position < width) {\n if (x < width - 1 && !cells[this.position - 1].classList.contains('maze')){ \n this.position = this.position - 1\n } else this.moveRandom()\n } else if (playerPosition > this.position){\n if (y < width - 1 && !cells[this.position - width].classList.contains('maze')) {\n this.position = this.position - width\n } else this.moveRandom()\n } else if (playerPosition < this.position && this.position - playerPosition < width) {\n if (x > 0 && !cells[this.position + 1].classList.contains('maze')) {\n this.position = this.position + 1 \n } else this.moveRandom()\n } else if (playerPosition < this.position) {\n if (x < width - 1 && !cells[this.position + width].classList.contains('maze'))\n {this.position = this.position + width\n } else this.moveRandom()\n }\n if (!gameOver && !this.isDead){\n cells[this.position].classList.add(this.classname)}\n } \n }", "function moveEnemy1() {\n posX = parseInt($(\"#enemy1\").css(\"left\"));\n $(\"#enemy1\").css(\"left\", posX - vel);\n $(\"#enemy1\").css(\"top\", posY);\n\n if (posX <= 0) {\n posY = parseInt(Math.random() * 334);\n $(\"#enemy1\").css(\"left\", 634);\n $(\"#enemy1\").css(\"top\", posY);\n }\n }", "function makeMove() {\n if(turn == \"player\" && gameStatus == \"ongoing\" && playerFirstMove == true){\n playerPosition = \"p\"+(1+rollValue);\n var toGo = document.getElementsByClassName(playerPosition);\n $(toGo).attr(\"id\",\"user\");\n playerFirstMove = false\n cardOptions();\n turn = \"enemy\";\n begin.textContent=\"Roll dice for enemy move\";\n }else if(turn == \"player\" && gameStatus == \"ongoing\") {\n $(\"#user\").removeAttr(\"id\");\n playerPosition = parseInt(playerPosition.substr(1));\n if((playerPosition+rollValue)>40){\n playerPosition = \"p\"+((playerPosition+rollValue)-40);\n playerCash += 200;\n playerUpdate(\"You passed go! Collect $200\")\n updateCash();\n }else{\n playerPosition = \"p\"+(playerPosition+rollValue);\n }\n var toGo = document.getElementsByClassName(playerPosition);\n $(toGo).attr(\"id\",\"user\")\n cardOptions();\n turn = \"enemy\";\n begin.textContent=\"Roll dice for enemy move\";\n }else if(turn == \"enemy\" && gameStatus == \"ongoing\" && enemyFirstMove == true) {\n enemyPosition = \"p\"+(1+rollValue);\n var toGo = document.getElementsByClassName(enemyPosition);\n $(toGo).attr(\"id\",\"enemy\");\n enemyFirstMove = false\n cardOptions();\n executeEnemyStrategies();\n turn = \"player\";\n begin.textContent=\"Your roll\";\n }else if(turn == \"enemy\" && gameStatus == \"ongoing\") {\n $(\"#enemy\").removeAttr(\"id\");\n enemyPosition = parseInt(enemyPosition.substr(1));\n if((enemyPosition+rollValue)>40){\n enemyOfferOptions()\n enemyPosition = \"p\"+((enemyPosition+rollValue)-40);\n enemyCash += 200\n updateCash();\n enemyUpdate(\"Enemy passed go! Collect $200\")\n }else{\n enemyPosition = \"p\"+(enemyPosition+rollValue);\n }\n var toGo = document.getElementsByClassName(enemyPosition);\n $(toGo).attr(\"id\",\"enemy\")\n cardOptions();\n executeEnemyStrategies();\n turn = \"player\";\n begin.textContent=\"Your roll\";\n }\n}", "moveEnemyDown() {\n const nextCanvasRowY = game.getYOfCanvasRow(this.canvasRow + 1);\n this.moveDownToTarget(nextCanvasRowY);\n }", "function fight (){\n\t//object variable to refence the current defenders stats\n\tvar defend = characters[defender];\n\n\t//object variable to refence the players characters stats\n\tvar player = characters[player_char];\n\n\t//change player's hp by the current defenders counter attack stat\n\tplayer[\"hp\"] -= defend[\"cnter_atk\"];\n\n\t//change the current defender hp based on the players attack stat\n\tdefend[\"hp\"] -= player[\"atk\"];\n\n\t//change the players attack stat by adding the players base attack to the grand total\n\tplayer[\"atk\"] += player[\"base_atk\"];\n\n\t//if the player hp is less then or equal to zero\n\tif (player[\"hp\"] <= 0){\n\t\t// remove the players icon image and replace it with a game over message\n\t\t$( \"div\" ).remove( \"#\"+ player_char);\n\t\t$(\"#your_char\")\n\t\t\t.html(\"<div id=\\\"defeat\\\"><p>You are Dead!</p></div>\");\n\t//else if the defender hp is less than or equal to zero\n\t}else if(defend[\"hp\"] <= 0){\n\t\t//increment number of victories\n\t\tnum_victories++;\n\t\t//if number of victories equal 3 than\n\t\tif (num_victories == 3){\n\t\t\t//remove the defender icon and display a victory message\n\t\t\t$( \"div\" ).remove( \"#\"+defender);\n\t\t\t$(\"#defender\")\n\t\t\t.html(\"<div id=\\\"victory\\\"><p>You Win!</p></div>\");\n\t\t//else remove the defender icon from the page\n\t\t}else{\n\t\t\t$( \"div\" ).remove( \"#\"+defender);\n\t\t}\n\t\t//set defender name to \"\" to allow the player to select the next defender\n\t\tdefender = \"\";\n\t}\n}", "troll_swing(x, y) {\n var space = this.board().space(x, y);\n var nearby_dwarfs = space.neighbours.filter(neighbour => neighbour.is_dwarf());\n nearby_dwarfs.forEach(dwarf => {\n this.game.report('piece_taken', Object.assign(dwarf, {side: 'd'}));\n this.game.remove_piece(dwarf);\n });\n }", "function moveDown(){\n undraw()\n currentPosition += width\n // gameOver()\n draw()\n freeze()\n }", "function victoryMove(){\n \n if (win!= 'won'){ // keep victory message of screen until a win has been achived \n for(i=0;i<winning.length;i++){\n var p=1\n forceMove(winning[i],p+100,-800,5);\n p=p+100;\n }\n forceMove(boxPlayAgain,100,-900,6) \n } else{ // // move victory message to the screen \n var p=100;\n var s= 100; \n for(i=0;i<winning.length;i++){\n forceMove(winning[i],p,he-500,5);\n p=p+110;\n }\n for(i=0;i<nameToSpell.length;i++){\n forceMove(nameToSpell[i],s,he-300,5);\n s=s+110;\n }\n forceMove(boxPlayAgain,200,he-700,5)\n } \n}", "function dodgeEnemies()\r\n{\r\n /* Change the players turn */\r\n isPlayersTurn = false ;\r\n\r\n /* If its random go do random hit */\r\n if(isRandom)\r\n {\r\n var rNum = getRandomNumber();\r\n var x = Math.floor(rNum/10) ;\r\n var y = rNum%10 ;\r\n if(checkIfMessileDropped(x,y,isPlayersTurn))\r\n {\r\n /* if messile was already dropped there then i'll try again */\r\n dodgeEnemies();\r\n }\r\n else\r\n {\r\n var isHit = checkHitOrMiss(x,y,isPlayersTurn) ;\r\n /*I'll now check if its a hit.. If miss then go random again. */\r\n if(isHit)\r\n {\r\n // Drop the bomb since it is a HIT. \r\n // This will only be a first hit.. so never vessel sinks\r\n board1[x][y] = 0 ;\r\n\r\n // Next time dont go on random shots.\r\n isRandom = false ;\r\n\r\n // Create proximity for the next attack\r\n establishProximity(x,y) ;\r\n \r\n /* Put this as the base of order*/\r\n order = [[x,y]] ;\r\n\r\n /* Safety purpose got order is false */\r\n gotOrder = false; \r\n\r\n // Say fire in the hole\r\n statusMessage = \"Fire in the hole.\" ;\r\n updateStatusMessage(statusMessage, 2) ;\r\n }\r\n /* I missed it. */\r\n else\r\n {\r\n // Its a miss.. still update..and go merry on random ..\r\n board1[x][y] = 0 ;\r\n // alert(\"Its a miss\") ;\r\n // emptyStatusMessage(2) ;\r\n }\r\n /* Update the arena. If hit, then red else cross. */\r\n updateArena(isHit, isPlayersTurn, x, y );\r\n }\r\n }\r\n else\r\n {\r\n if(gotOrder)\r\n {\r\n var orderLastIndex = order.length - 1;\r\n var dx = order[orderLastIndex][0] - order[orderLastIndex -1 ][0] ;\r\n var dy = order[orderLastIndex][1] - order[orderLastIndex -1 ][1] ;\r\n \r\n if(dx == 0 && dy == 0 )\r\n {\r\n /* Coding flaw .. */\r\n isRandom = true;\r\n\r\n dodgeEnemies();\r\n return ; \r\n }\r\n /* xy is the next \"predicted\" target. If xy doesn't exist in board?*/\r\n x = order[orderLastIndex][0] + dx;\r\n y = order[orderLastIndex][1] + dy;\r\n if(x<0 || x>9 || y<0 || y>9 || checkIfMessileDropped(x,y,isPlayersTurn))\r\n {\r\n /* The order point is invalid. Increase the proximity and run again */\r\n proximityIndex++ ;\r\n\r\n /* Now, since the predicted is not present/already hit then\r\n * declare order is lost. and revert back the order to base element. */\r\n gotOrder = false ;\r\n \r\n /* Order has now the base element only. */\r\n order = [order[0]];\r\n \r\n /* Next point comes in recursion */\r\n dodgeEnemies();\r\n }\r\n /* Prediction point is un touched */\r\n else\r\n {\r\n /* Check if the prediction hits */\r\n isHit = checkHitOrMiss(x,y,isPlayersTurn) ;\r\n if(isHit)\r\n {\r\n /* hit mein bhi update the board */\r\n board1[x][y] = 0 ;\r\n \r\n statusMessage = \"Fire in the hole\";\r\n updateStatusMessage(statusMessage, 2) ;\r\n \r\n var sunk = checkIfVesselSunk(x,y,isPlayersTurn) ;\r\n if(sunk)\r\n {\r\n statusMessage = \"Enemy desroyed our \"+sunk;\r\n updateStatusMessage(statusMessage, 1) ;\r\n \r\n /* Vessel is sunk. Our prediction completed. Go back to random mode. */\r\n isRandom = true ; \r\n }\r\n else\r\n {\r\n /* our prediction resulted in a hit but didn't sink up the ship.\r\n * So, add it to the successfull order lists */\r\n order.push([x,y]);\r\n }\r\n }\r\n /* Missed the prediction shot. prediction is wrong.*/\r\n else\r\n {\r\n /* Miss mein bhi update the board */\r\n board1[x][y] = 0 ;\r\n\r\n /* Next element of proximity array will be my next target. */\r\n proximityIndex++ ;\r\n\r\n /* I haven't found order of ship yet. */\r\n gotOrder = false ;\r\n\r\n /* Order has now the base element only. */\r\n order = [order[0]];\r\n }\r\n /* Hit ho ya miss.. update the arena.. */\r\n updateArena(isHit, isPlayersTurn, x, y );\r\n }\r\n }\r\n else\r\n {\r\n x = proximitiy[proximityIndex][0] ;\r\n y = proximitiy[proximityIndex][1] ;\r\n\r\n /* Check if the point is outside the boundaries */\r\n /* Or by some random shot we already touched this [x,y] */\r\n if(x<0 || x>9 || y<0 || y>9 || checkIfMessileDropped(x,y,isPlayersTurn))\r\n {\r\n /* The proximity point is invalid. Move on to next point. */\r\n proximityIndex++ ;\r\n \r\n /* Next point comes in recursion */\r\n dodgeEnemies();\r\n }\r\n isHit = checkHitOrMiss(x,y,isPlayersTurn) ;\r\n if(isHit)\r\n {\r\n \r\n statusMessage = \"Fire in the hole\";\r\n updateStatusMessage(statusMessage, 2) ;\r\n\r\n board1[x][y] = 0 ;\r\n sunk = checkIfVesselSunk(x,y,isPlayersTurn) ; \r\n if(sunk)\r\n {\r\n // alert(\"Vessel destroyed \") ;\r\n /* Vessel has sunk */\r\n statusMessage = \"Enemy desroyed our \"+sunk;\r\n updateStatusMessage(statusMessage, 1) ;\r\n\r\n /* check if game over. */\r\n if(checkIfGameOver(isPlayersTurn))\r\n {\r\n statusMessage = \"I win.. \" ;\r\n isGameEnded = true ;\r\n updateStatusMessage(statusMessage, 2) ;\r\n return ; \r\n }\r\n else\r\n {\r\n /* Vessel sunk but game is not over. So, go back to random mode. */\r\n isRandom = true ;\r\n }\r\n }\r\n /*Vessel is not sunk and it's a hit => I've got the order. */\r\n else\r\n {\r\n /* Hit pe hit.. => order is known. */\r\n gotOrder = true ;\r\n \r\n /* Order will now have the order of successfull hits. */\r\n order.push(proximitiy[proximityIndex]);\r\n } \r\n }\r\n /* Missed from the proximity shot. => go for the next shot of proximity*/\r\n else\r\n {\r\n /* Miss mein bhi update the board */\r\n board1[x][y] = 0 ;\r\n \r\n /* Next element of proximity array will be my next target. */\r\n proximityIndex++ ;\r\n\r\n /* I haven't found order of ship yet. */\r\n gotOrder = false ;\r\n }\r\n \r\n /* Hit ho ya miss.. update the arena.. */ \r\n updateArena(isHit, isPlayersTurn, x, y ); \r\n }\r\n /**/\r\n }\r\n}", "function moveEnemy(){\n\n\tif(enemy1.x>759){\n\t\tenemy1.animations.play('left');\n\t\tenemy1.body.velocity.x=-120;\n\t}\n\telse if(enemy1.x<405){\n\t\tenemy1.animations.play('right');\n\t\tenemy1.body.velocity.x=120\n\t}\n}", "move(from, fromIx, fromCount, to, toIx) {\n let evdata = {\n success: false,\n from: from, \n fromIx: fromIx,\n fromCount: fromCount,\n to: to,\n toIx: toIx\n };\n if (!this.canMove(from, fromIx, fromCount, to, toIx)) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n let card = false;\n let dest = false;\n if (from == 'w') {\n card = this.waste.pop();\n } \n else if (from == 'f') {\n card = this.foundations[fromIx - 1].pop();\n }\n else if (from == 't') {\n let t = this.tableau[fromIx - 1];\n card = t.slice(t.length - fromCount);\n t.length = t.length - fromCount;\n }\n if (to == 't') {\n dest = this.tableau[toIx - 1];\n }\n else if (to == 'f') {\n dest = this.foundations[toIx - 1];\n }\n if (!card || !dest) {\n //this._event(Game.EV.MOVE, evdata); \n return false;\n }\n if (Array.isArray(card)) {\n card.forEach((c) => { \n dest.push(c); \n });\n }\n else {\n dest.push(card);\n }\n evdata.success = true;\n this._event(Game.EV.MOVE, evdata); \n if (from == 't') {\n let last = this.tableau[fromIx - 1].last();\n this._event(Game.EV.REVEAL, {\n tableau: fromIx,\n card: last\n });\n }\n return true;\n }", "function chooseEnemy(enemy) {\n // revealing the attack button\n $(\"#attack\").show();\n // appending the clicked character to #fightsection div\n $(enemy).appendTo(\"#fightsection\");\n // creating a chosenEnemy variable & getting its index based on which character was clicked\n chosenEnemy = characters.findIndex(x => x.id == event.target.offsetParent.attributes[1].nodeValue);\n // subtracting the of the number of enemies left to fight\n enemiesAvailable--;\n isEnemyChosen = true;\n }", "function endTurn()\n\t{\n\t\tunit.movePoints = type.move;\n\n\t\tupdate();\n\t}", "move() {\n let xDiff = this.xTarget - this.x + 5; // Blumenmitte\n let yDiff = this.yTarget - this.y;\n if (Math.abs(xDiff) < 1 && Math.abs(yDiff) < 1)\n this.setRandomFlowerPosition();\n else {\n this.x += xDiff * this.speed;\n this.y += yDiff * this.speed;\n }\n }", "function mmove(aa, bb, cc, dd) {\n if ((cc == player.x) && (dd == player.y)) {\n hitplayer(aa, bb);\n return;\n }\n\n var item = itemAt(cc, dd);\n var monster = player.level.monsters[aa][bb];\n\n player.level.monsters[cc][dd] = monster;\n\n if (item.matches(OPIT) || item.matches(OTRAPDOOR)) {\n switch (monster.arg) {\n case BAT:\n case EYE:\n case SPIRITNAGA:\n case PLATINUMDRAGON:\n case WRAITH:\n case VAMPIRE:\n case SILVERDRAGON:\n case POLTERGEIST:\n case DEMONLORD:\n case DEMONLORD + 1:\n case DEMONLORD + 2:\n case DEMONLORD + 3:\n case DEMONLORD + 4:\n case DEMONLORD + 5:\n case DEMONLORD + 6:\n case DEMONPRINCE:\n break;\n\n default:\n player.level.monsters[cc][dd] = null; /* fell in a pit or trapdoor */\n };\n }\n\n if (item.matches(OANNIHILATION)) {\n if (monster.arg >= DEMONLORD + 3) /* demons dispel spheres */ {\n cursors();\n updateLog(`The ${monster} dispels the sphere!`);\n rmsphere(cc, dd); /* delete the sphere */\n } else {\n player.level.monsters[cc][dd] = null;\n setItem(cc, dd, OEMPTY);\n }\n }\n\n monster.awake = true;\n player.level.monsters[aa][bb] = null;\n\n if (monster.matches(LEPRECHAUN) && (item.matches(OGOLDPILE) || item.isGem())) {\n player.level.items[cc][dd] = OEMPTY; /* leprechaun takes gold */\n }\n\n if (monster.matches(TROLL)) { /* if a troll regenerate him */\n if ((gtime & 1) == 0)\n if (monsterlist[monster.arg].hitpoints > monster.hitpoints) monster.hitpoints++;\n }\n\n var what;\n var flag = 0; /* set to 1 if monster hit by arrow trap */\n if (item.matches(OTRAPARROW)) /* arrow hits monster */ {\n what = `An arrow`;\n if ((monster.hitpoints -= rnd(10) + level) <= 0) {\n player.level.monsters[cc][dd] = null;\n flag = 2;\n } else flag = 1;\n }\n if (item.matches(ODARTRAP)) /* dart hits monster */ {\n what = `A dart`;\n if ((monster.hitpoints -= rnd(6)) <= 0) {\n player.level.monsters[cc][dd] = null;\n flag = 2;\n } else flag = 1;\n }\n if (item.matches(OTELEPORTER)) /* monster hits teleport trap */ {\n flag = 3;\n fillmonst(monster.arg);\n player.level.monsters[cc][dd] = null;\n }\n if (player.BLINDCOUNT) return; /* if blind don't show where monsters are */\n\n if (player.level.know[cc][dd] & HAVESEEN) {\n if (flag) {\n cursors();\n beep();\n }\n switch (flag) {\n case 1:\n updateLog(`${what} hits the ${monster}`);\n break;\n case 2:\n updateLog(`${what} hits and kills the ${monster}`);\n break;\n case 3:\n updateLog(`The ${monster} gets teleported`);\n break;\n };\n }\n\n if (player.level.know[aa][bb] & HAVESEEN) show1cell(aa, bb);\n if (player.level.know[cc][dd] & HAVESEEN) show1cell(cc, dd);\n\n}", "function checkEnemyForFightAllDirections() {\n checkEnemyForFight('x', dataCells.endPlayerDataX - 1, 'y', dataCells.endPlayerDataY);\n checkEnemyForFight('x', dataCells.endPlayerDataX + 1, 'y', dataCells.endPlayerDataY);\n checkEnemyForFight('y', dataCells.endPlayerDataY - 1, 'x', dataCells.endPlayerDataX);\n checkEnemyForFight('y', dataCells.endPlayerDataY + 1, 'x', dataCells.endPlayerDataX);\n}", "move() {\n var me = this.localDonutRender;\n if (me == null) {\n return;\n }\n var direction = {\n x: this.heading.x - me.donutData.x,\n y: this.heading.y - me.donutData.y\n };\n this.client.emit('move', { pid: this.playerId, rid: this.roomId, dir: direction });\n }", "function player_move(dir) {\n player.pos.x += dir;\n if (collide(arena, player)) {\n player.pos.x -= dir;\n }\n}", "function move()\n{\n\tif (player.direction == MOVE_NONE)\n\t{\n \tplayer.moving = false;\n\t\t//console.log(\"y: \" + ((player.y-20)/40));\n\t\t//console.log(\"x: \" + ((player.x-20)/40));\n \treturn;\n \t}\n \tplayer.moving = true;\n \t//console.log(\"move\");\n \n\tif (player.direction == MOVE_LEFT)\n\t{\n \tif(player.angle != -90)\n\t\t{\n\t\t\tplayer.angle = -90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y-1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y -=1;\n\t\t\tvar newX = player.position.x - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n \t}\n\tif (player.direction == MOVE_RIGHT)\n\t{\n \tif(player.angle != 90)\n\t\t{\n\t\t\tplayer.angle = 90;\n\t\t}\n\t\tif(map[playerPos.x][playerPos.y+1].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.y+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newX = player.position.x + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: newX, y: player.position.y}, 250).call(move);\n\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_UP)\n\t{\n\t if(player.angle != 0)\n\t\t{\n\t\t\tplayer.angle = 0;\n\t\t}\n\t\tif(map[playerPos.x-1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x-=1;\n\t\t\tvar newy = player.position.y - 40;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tcreatejs.Tween.get(player).to({y: newy}, 250).call(move);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n \tif (player.direction == MOVE_DOWN)\n\t{\n\t if(player.angle != 180)\n\t\t{\n\t\t\tplayer.angle = 180;\n\t\t}\n\t\tif(map[playerPos.x+1][playerPos.y].walkable)\n\t\t{\n\t\t\tplayer.moving = true;\n\t\t\tplayerPos.x+=1;\n\t\t\tcheckCharms(playerPos.x, playerPos.y);\n\t\t\tvar newy = player.position.y + 40;\n\t\t\tcreatejs.Tween.get(player).to({x: player.position.x, y: newy}, 250).call(move);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tPIXI.sound.play('wrongWay');\n\t\t\tplayer.direction = MOVE_NONE;\n\t\t\tmove();\n\t\t}\n\t}\n}", "attack(forwardSteps,rightSteps,damage,type = null,statuses = null){\r\n let attackX = this.x;\r\n let attackY = this.y;\r\n switch (this.direction) {\r\n case 0: attackY -= forwardSteps;\r\n attackX += rightSteps;\r\n break;\r\n case 90: attackX += forwardSteps;\r\n attackY += rightSteps;\r\n break;\r\n case 180: attackY += forwardSteps;\r\n attackX -= rightSteps;\r\n break;\r\n case 270: attackX -= forwardSteps;\r\n attackY -= rightSteps;\r\n break;\r\n }\r\n let attackedTile = this.field.getTile(attackX, attackY);\r\n if(attackedTile) attackedTile.attacked(damage,type,statuses);\r\n }", "static wonderingFightBack(/*Unit*/ unit, /*Grid*/ grid, /*Unit*/ theHero, /*Array<Unit>*/ allies) {\n\n /*Hex[]*/\n let possibleMoves = grid.getMovableHexes(unit, 1);\n\n if (possibleMoves.length) {\n\n //If Helene is near, most likely attack!\n for (let hex of possibleMoves) {\n if (hex.content === theHero) {\n if (Math.random() > 0.36) {\n grid.goTo(hex, unit);\n return;\n }\n }\n }\n\n //maybe do nothing?\n if (Math.random() > 0.50) {\n return;\n }\n\n //else lets get rolling\n let randomMove = possibleMoves[Math.floor(Math.random() * possibleMoves.length)];\n if (randomMove.content && allies.indexOf(randomMove.content) !== -1) {\n //maybe do nothing?\n if (Math.random() > 0.50) {\n return;\n }\n //lets give him a chance, or else! (rerandom - perhaps we will not kick an ally!)\n return possibleMoves[Math.floor(Math.random() * possibleMoves.length)];\n\n }\n return randomMove;\n\n }\n }", "updateEnemies() {\n this.liveEnemies.forEach(enemy => {\n // If patrolling, just continue to edge of screen before turning around\n if (enemy.enemyAction === EnemyActions.Patrol) {\n //console.log(enemy);\n // These should be changed to not be hard coded eventually\n if (enemy.enemySprite.body.position.x < 50) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.x > 1850) {\n enemy.enemySprite.body.velocity.x = -1 * enemy.enemySprite.body.velocity.x;\n }\n if (enemy.enemySprite.body.position.y < 50) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n if (enemy.enemySprite.body.position.y > 1000) {\n enemy.enemySprite.body.velocity.y = -1 * enemy.enemySprite.body.velocity.y;\n }\n // check if we are near an object, if yes, try and guard it. Not sure if this is working - Disabling for now\n //console.log(this.isNearObject(enemy.enemySprite));\n if (null != null) {\n console.log(\"Is near an object\");\n enemy.enemySprite.body.velocity.y = 0;\n enemy.updateAction(EnemyActions.Guard, null);\n }\n // Otherwise, wait for attack cooldown before attacking the player\n else {\n if (enemy.attackCooldown === 0) {\n enemy.attackCooldown = Math.floor(Math.random() * 2000);\n enemy.updateAction(EnemyActions.Attack, this.level.player);\n }\n else {\n enemy.attackCooldown = enemy.attackCooldown - 1;\n }\n }\n }\n\n // Guard the item\n if (enemy.enemyAction === EnemyActions.Guard) {\n enemy.guard();\n }\n\n // Attack the player\n if (enemy.enemyAction === EnemyActions.Attack) {\n enemy.attack();\n }\n\n // check if animation needs to be flipped\n if (enemy.enemySprite.body.velocity.x < 0) {\n enemy.enemySprite.scale.x = -1;\n }\n else if (enemy.enemySprite.body.velocity.x > 0) enemy.enemySprite.scale.x = 1;\n });\n }", "function oppAttack() {\n oppMoveNames = Object.keys(currentOppPokemon.moves);\n do {\n let moveName = oppMoveNames[Math.ceil(Math.random() * 4)];\n oppMove = currentOppPokemon.moves[moveName];\n } while (oppMove.pp == 0)\n\n setTimeout(function () {\n attack(oppMove, currentOppPokemon, currentPlayerPokemon);\n if (currentOppPokemon.fainted == false) {\n setTimeout(function () { menu() }, 3000);\n }\n }, 3000);\n}", "function makeMovement(event){\n\tvar x = event.clientX - canvas.offsetLeft;\n\tvar y = event.clientY - canvas.offsetTop;\n\tvar col = Math.floor(y / pieceSize) ;\n\tvar row = Math.floor(x / pieceSize) ;\n\t// Check if it's turn of IA or Player;\n\tif (turn==0){\n\t\tplay(row,col);\n\t}\n\tif (turn==1){\n\t\tvar pos = minMax(MINMAX_DEPTH,INIT_MINMAX_FLAG,pieces,validPlays);\n\t\tplay(pos[0],pos[1]);\n\t}\n}", "function drop() {\nif(move(down)==false){\nif(active.pivot.r < 1) {\n setTimeout(gameEnd,100);\n }\n checkLines();\n setTimeout(spawnPiece,100);\n\n}\n}", "function fightLoop() {\n if(fightHandler.endFight === \" \") {\n fightHandler.chooseAction();\n \n fightLoop2();\n \n function fightLoop2() {\n if(fightHandler.actionChosen) {\n fightHandler.chooseTarget();\n \n fightLoop3();\n \n function fightLoop3() {\n if(fightHandler.targetChosen) {\n fightHandler.determineAction();\n fightHandler.checkEnd();\n fightHandler.endTurn();\n setTimeout(fightLoop, 0);\n } else {\n setTimeout(fightLoop3, 0);\n }\n }\n } else {\n setTimeout(fightLoop2, 0);\n }\n };\n } else {\n fightHandler.determineEnd();\n }\n}", "function playerMoving() {\n console.log('playerMoving')\n $squares.removeClass('drake-player1')\n $squares.eq(playerPosition).addClass('drake-player1')\n }", "function move(e) {\n switch (e.event.code) {\n case 'Numpad1':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowDown':\n if (\n player.detectCollision(\n player.sprite.x,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad3':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y + player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.sprite.y += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowLeft':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowRight':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad7':\n if (\n player.detectCollision(\n player.sprite.x - player.tile_size.w,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x -= player.tile_size.w;\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'ArrowUp':\n if (\n player.detectCollision(\n player.sprite.x,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n case 'Numpad9':\n if (\n player.detectCollision(\n player.sprite.x + player.tile_size.w,\n player.sprite.y - player.tile_size.w\n ) == 2 &&\n !player.disableControl\n ) {\n player.sprite.x += player.tile_size.w;\n player.sprite.y -= player.tile_size.w;\n player.doStep();\n }\n break;\n }\n }", "function move(e) {\n var newX;\n var newY;\n var movingAllowed;\n e = e || window.event;\n \n switch (e.keyCode) {\n case 38: // arrow up key\n newX = current_x;\n newY = current_y - 3;\n break;\n case 37: // arrow left key\n newX = current_x - 3;\n newY = current_y;\n break;\n case 40: // arrow down key\n newX = current_x;\n newY = current_y + 3;\n break;\n case 39: // arrow right key\n newX = current_x + 3;\n newY = current_y;\n break;\n }\n\n can_Move = canMoveTo(newX, newY);\n if (can_Move === 1) { // 1 means no collision with black, can move\n drawRectangle(newX, newY, \"purple\");\n current_x = newX;\n current_y = newY;\n }\n else if (can_Move === 2) { // rectangle has met the goal.\n round_counter++;\n if(round_counter >= level.length){\n clearInterval(intervalVar);\n make_Screen_White(0, 0, canvas.width, canvas.height);\n context.font = \"20px Arial\";\n context.fillStyle = \"blue\";\n context.textAlign = \"center\";\n context.textBaseline = \"middle\";\n context.fillText(\"Goal!\", canvas.width / 2, canvas.height / 2);\n window.removeEventListener(\"keydown\", move, true);\n }else{\n init();\n }\n }\n }", "dealDamage() {\n let d = dist(this.x, this.y, player.x, player.y);\n if (\n d < this.size / 2 &&\n this.mapX === player.mapX &&\n this.mapY === player.mapY\n ) {\n // if the player touches the projectile, deal damage to them and destroy the projectile to prevent repeating damage\n player.healthTarget -= this.damage;\n sounds.spiritHit.play();\n this.die();\n }\n }", "function MOVE(e){\n\n\t/////////Player 1///////////////\n\tplayer1.move(e);\n\n}", "function move() {\r\n\t\r\n}", "moveTheseusButton(id){\n\t\tif(this.isTheseusTurn()){\n\t\t\tif(!this.wallCheck(this.props.G.theseusPos,id,1)){\n\t\t\t\tthis.props.G.cells[this.props.G.theseusPos].scent = id;\n\t\t\t\tthis.props.moves.moveTheseus(id);\n\t\t\t\tif(!this.doesTheseusSeeMinotaur()){\n\t\t\t\t\tthis.props.G.cells[this.props.G.minotaurPos].setDisplay(null);\n\t\t\t\t}\n\t\t\t\tthis.updateFogOfWar();\n\t\t\t\tif(this.doesTheseusSeeExit()){\n\t\t\t\t\tthis.props.G.cells[this.props.G.exitPos].setDisplay(exitSym);\n\t\t\t\t}\n\t\t\t\tthis.props.events.endTurn();\n\t\t\t}\n\t\t}\n\t}", "attack(youHero) {\n if (this.name === ennemies[0].name) {\n if (Math.floor(Math.random() * Math.floor(9)) / 10 <= this.accuracy) {\n \n console.log(\n youHero.name +\n \" got hit with an alien Z * mizzle, their health is down to\"\n );\n console.log((youHero.hull += -7)); /// had it set to this . mizzle but somehting was not working with it or the random number so I hard coded it... sorry\n defeat(youHero); /// like above -_- but did you die?\n } else {\n console.log(this.name + \" can not hit the side of a barn\"); /// so you know who next target is when they appear but miss\n console.log(\n \"Ha! those aliens shoot like stormtroopers \" +\n youHero.name +\n \"took no damage. Hull power = \" +\n youHero.hull\n ); /// you know they missed\n defeat(youHero); /// no damage awesome but return to your move with this\n }\n } else {\n console.log(\"dead aliens can't shoot\"); // not sure how they would but just in case if simulating in console log with pre typed functions...\n //return to your move\n defeat(youHero);\n }\n }", "function ducksFly() {\n\tvar canvas = document.getElementById(\"game\");\n\n\tfor (i=0; i < ducks.length; i++) {\n\t\tducks[i].targetY = canvas.height/2;\n\t\tducks[i].targetX = -5*duckSize;\n\t}\n}", "function movementChar () {\n player.movement();\n enemy.movement();\n }", "function playerMove(dir) {\n player.pos.x += dir;\n if(colide(arena, player)) {\n player.pos.x -= dir;\n }\n}", "function doMove(path) {\n path = path.concat()\n var transition = c.cx.map.transitions.nest({\n type: 'combatMove',\n combat: c.combat._parentKey,\n creature: c.creature._parentKey,\n path: path.splice(0, 1),\n })\n transition.collect()\n if (c.state.calculate('creature_flying').updateIfNeeded().get('value')) {\n path = [path.pop()] // just straight to the destination\n }\n var prev = []\n c.combat.walkImpassable(c.creature, function (o) { prev.push(o) })\n // Hop from one cell to another, causing side effects along the way.\n // The common transition smoothes it out for user's UI.\n for (var spot; spot = path.shift(); ) {\n c.creature.assignResp({x: spot[0], y: spot[1]}, transition.options(transition.get('path').length - 1))\n transition.getSet('path', function (cur) {\n return cur.concat([spot])\n })\n transition.collect()\n var cur = []\n c.combat.walkImpassable(c.creature, function (o) { cur.push(o) })\n var txBreak = c.combat.fire('triggerSpotEffects', [c.creature, cur, prev])\n prev = cur\n if (c.combat.get('interactiveCreature') != c.creature) {\n // Land mine, quicksands, etc.\n spot = true\n break\n }\n if (txBreak && path.length) {\n transition.set('ticks', transition.get('path').length)\n transition.collectFinal()\n transition = c.cx.map.transitions.nest({\n type: 'combatMove',\n combat: c.combat._parentKey,\n creature: c.creature._parentKey,\n path: [spot],\n })\n transition.collect()\n }\n }\n transition.set('ticks', transition.get('path').length)\n transition.collectFinal()\n return spot === true\n }", "move() {\n if(difficulty === 1){\n this.speed = 5;\n if(random() < 0.1 &&\n stealer.pos.x + stealer.size / 6 > this.x - this.w / 2){\n this.vy = this.speed;\n }\n }\n else if(difficulty === 2 || difficulty === 4){\n this.speed = 10;\n if(random() < 0.1 &&\n stealer.pos.x + stealer.size / 6 > this.x - this.w / 2){\n this.vy = this.speed;\n }\n }\n else if(difficulty === 3){\n this.speed = 15;\n if(random() < 0.1 &&\n stealer.pos.x + stealer.size / 6 > this.x - this.w / 2){\n this.vy = this.speed;\n }\n }\n this.y += this.vy;\n }", "function moveChar(thisChar, type){\r\n\t\t\r\n\tswitch(type){\r\n\t\tcase 1:\r\n\t\t//random\r\n\t\tif(!thisChar.canMove){\r\n\t\t\tthisChar.dirX = thisChar.dirX*-1;\r\n\t\t\tthisChar.dirY = thisChar.dirY*-1;\r\n\t\t}\r\n\t\tif(timer == 0){\r\n\t\t\ttimer = Math.floor(Math.random() * (300-200+1) + 200);\r\n\t\t\tif(isMoving){\r\n\t\t\t\tnewDirX = randomDir();\r\n\t\t\t\tnewDirY = randomDir();\r\n\t\t\t\twhile(newDirX == 0 && newDirY == 0){\r\n\t\t\t\t\tnewDirX = randomDir();\r\n\t\t\t\t\tnewDirY = randomDir();\r\n\t\t\t\t}\r\n\t\t\t\tthisChar.dirX = newDirX;\r\n\t\t\t\tthisChar.dirY = newDirY;\r\n\t\t\t\tisMoving = !isMoving;\r\n\t\t\t}else{\r\n\t\t\t\tthisChar.dirX = 0;\r\n\t\t\t\tthisChar.dirY = 0;\r\n\t\t\t\tisMoving = !isMoving;\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\ttimer--;\r\n\t\t}\t\t\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tcase 2:\r\n\t\t//Follow\r\n\t\tnewDirX = (player.x + (player.w/2)) - (thisChar.x + (thisChar.w/2));\r\n\t\tnewDirY = (player.y + (player.h/2)) - (thisChar.y + (thisChar.h/2));\r\n\t\t//There should be an easier way to do this. Preferable in previous 2 lines. But, whatever.\r\n\t\tif(newDirX > 50 || newDirX < -50){\r\n\t\t\tif(newDirX < 0){\r\n\t\t\t\tnewDirX = -1;\r\n\t\t\t}else if(newDirX > 0){\r\n\t\t\t\tnewDirX = 1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirX = newDirX;\r\n\t\t}else{\r\n\t\t\tthisChar.dirX = 0;\r\n\t\t}\r\n\t\t\r\n\t\tif(newDirY > 50 || newDirY < -50){\r\n\t\t\tif(newDirY < 0){\r\n\t\t\t\tnewDirY = -1;\r\n\t\t\t}else if(newDirY > 0){\r\n\t\t\t\tnewDirY = 1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirY = newDirY;\r\n\t\t}else{\r\n\t\t\tthisChar.dirY = 0;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tcase 3:\r\n\t\t//flee\r\n\t\tnewDirX = (player.x + (player.w/2)) - (thisChar.x + (thisChar.w/2));\r\n\t\tnewDirY = (player.y + (player.h/2)) - (thisChar.y + (thisChar.h/2));\r\n\t\t//There should be an easier way to do this. Preferable in previous 2 lines. But, whatever.\r\n\t\tif(newDirX < 75 && newDirX > -75){\r\n\t\t\tif(newDirX < 0){\r\n\t\t\t\tnewDirX = 1;\r\n\t\t\t}else if(newDirX > 0){\r\n\t\t\t\tnewDirX = -1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirX = newDirX;\r\n\t\t}else{\r\n\t\t\tthisChar.dirX = 0;\r\n\t\t}\r\n\t\t\r\n\t\tif(newDirY < 75 && newDirY > -75){\r\n\t\t\tif(newDirY < 0){\r\n\t\t\t\tnewDirY = 1;\r\n\t\t\t}else if(newDirY > 0){\r\n\t\t\t\tnewDirY = -1;\r\n\t\t\t}\r\n\t\t\tthisChar.dirY = newDirY;\r\n\t\t}else{\r\n\t\t\tthisChar.dirY = 0;\r\n\t\t}\r\n\t\tbreak;\r\n\t\t\r\n\t\t\r\n\t\tdefault:\r\n\t\t//still\r\n\t\tthisChar.dirX = 0;\r\n\t\tthisChar.dirY = 0;\r\n\t}\r\n}", "function moveUp() {\n myGamePiece.speedY -= movementSpeed;\n restrictPlayer();\n}", "function move(e){\n // obstacles(player.x, player.y);\n if (e.keyCode === 37){\n if(player.noMove(player.x-1, player.y)) {\n if(obstacles(player.x-1, player.y)){\n player.x -= 1;\n console.log('moved one spot to what you believe to be left');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be the left.\";\n }\n }\n } \n if (e.keyCode === 39){\n if(player.noMove(player.x+1, player.y)) {\n if(obstacles(player.x+1, player.y)){\n player.x += 1;\n console.log('moved one spot to what you believe to be right');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be the right.\";\n }\n }\n } \n if (e.keyCode === 38){\n if(player.noMove(player.x, player.y-1)){\n if(obstacles(player.x, player.y-1)){\n player.y -= 1;\n console.log('moved one spot to what you believe to be top');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be up.\";\n }\n }\n } \n if (e.keyCode === 40){\n if(player.noMove(player.x, player.y+1)){\n if(obstacles(player.x, player.y+1)){\n player.y += 1;\n console.log('moved one spot to what you believe to be down');\n document.getElementById('idOutputText').innerHTML = \"moved one spot to what you believe to be down.\";\n }\n }\n }\n }", "move() {\n // Set velocity via noise()\n this.vx = map(noise(this.tx), 0, 1, -this.speed, this.speed);\n this.vy = map(noise(this.ty), 0, 1, -this.speed, this.speed);\n\n if (this.x + this.vx < 0 + this.size / 2 || this.x + this.vx > width - this.size / 2) {\n this.vx = -this.vx;\n }\n\n if (this.y + this.vy < 0 + this.size || this.y + this.vy > cockpitVerticalMask - this.size) {\n //this.speed = -this.speed;\n this.vy = -this.vy;\n }\n\n // Update position\n this.x += this.vx;\n this.y += this.vy;\n // Update time properties\n this.tx += 0.01;\n this.ty += 0.01;\n //increases enemy's size every frame,\n this.size += this.speed / 10;\n //constrain enemies on screen\n this.x = constrain(this.x, 0, width);\n this.y = constrain(this.y, 0, height * 75 / 100);\n }", "function flee() {\n\t\tisfleeing = true;\n\t\tmakesAMove();\n\t}", "function hunt() {\n\n //Do nothing every fourth step.\n if (steps % 4 == 0) {\n yZombiePos += 0;\n xZombiePos += 0;\n }\n\n //Make the Zombie match the x-axis before trying to match the player's y-axis.\n else if (xZombiePos !== xPosition) {\n\n if (xZombiePos < xPosition) {\n xZombiePos += 1;\n }\n\n else if (xZombiePos > xPosition) {\n xZombiePos -= 1;\n }\n }\n\n //If the x-axis is matched start matching y-Axis.\n else if (xZombiePos == xPosition && yZombiePos !== yPosition) {\n\n if (yZombiePos < yPosition) {\n yZombiePos += 1;\n }\n\n else if (yZombiePos > yPosition) {\n yZombiePos -= 1;\n }\n }\n \n\n}", "update(dt) {\n // You should multiply any movement by the dt parameter\n // which will ensure the game runs at the same speed for\n // all computers.\n this.x += this.speed * dt;\n if (this.x > 550) {\n // moves enemy back to left side of screen when they reach the right\n this.x = -120;\n // random # sets/changes row enemy is in each time they reach the right side of the screen\n let random = Math.floor((Math.random() * 4) + 1);\n if (random < 2) {\n this.y = 60;\n }\n else if (random >= 2 && random < 3) {\n this.y = 143;\n }\n else {\n this.y = 226;\n }\n }\n }", "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 movePlayer(){\n\tif(!this.canMove || game.physics.arcade.isPaused || flags['winState'])\n\t\treturn;\n\n//\tif(player.body.touching.down)\n\t\tthis.body.velocity.x = 0;\n//\telse{\n\t\tif(player.body.touching.right)\n\t\t\tthis.timeOfTouchRightWall = game.time.now;\n\t\tif(player.body.touching.left)\n\t\t\tthis.timeOfTouchLeftWall = game.time.now;\n//\t}\n\n\t// Al presionar una tecla, el jugador se mueve y se activa una animacion\n\tif(keyboard.leftKey()){\n\t\t// Mover a la izquierda\n\t\tif(game.time.now - this.timeOfTouchRightWall < 500){\n\t\t\tthis.body.velocity.y = -this.speed;\n\t\t\tthis.setVelocity(-1, true);\n\t\t}\n\t\telse\n\t\t\tthis.setVelocity(-1, false);\n\n\t\tthis.playAnimations('left');\n\t\tif(!this.is_attacking) \n\t\t\tthis.attack.changeAttackOrientation('left', this);\n\t}\n\telse if(keyboard.rightKey()){\n\t\t// Mover a la derecha\n\t\tif(game.time.now - this.timeOfTouchLeftWall < 500){\n\t\t\tthis.body.velocity.y = -this.speed;\n\t\t\tthis.setVelocity(1, true);\n\t\t}\n\t\telse\n\t\t\tthis.setVelocity(1, false);\n\t\t\n\t\tthis.playAnimations(\"right\");\n\t\tif(!this.is_attacking) \n\t\t\tthis.attack.changeAttackOrientation('right', this);\n\t} \n\t\n\tif(keyboard.upKey()){\n\t\tif (player.body.touching.down){\n\t\t\tthis.body.velocity.y = -this.speed;\n\t\t\tif(this.speed != this.highSpeed)\n\t\t\t\tthis.body.velocity.y = -this.speed * 1.5;\n\t\t}\n\t\tthis.playAnimations('back');\n\t\tif(!this.is_attacking) \n\t\t\tthis.attack.changeAttackOrientation('back', this);\n\t} // abajo\n\telse if(keyboard.downKey()){\n//\t\tthis.body.velocity.y = this.speed;\n\t\tthis.playAnimations('front');\n\t\tif(!this.is_attacking) \n\t\t\tthis.attack.changeAttackOrientation('front', this);\n\t\tif(this.body.touching.down)\n\t\t\tthis.timeToDownPlatform = game.time.now;\n\t}\n\t\n\n\t// Permanecer quieto\n\tif(!this.is_attacking &&\n\t\t!keyboard.upKey() &&\n\t\t!keyboard.downKey() &&\n\t\t!keyboard.leftKey() &&\n\t\t!keyboard.rightKey()){\n\t\tthis.animations.stop();\n\t}\n\t\n}", "function pawnMove(currentSpace, nextSpace, player, target, pieceWillBeHere, pieceWillNotBeHere) {\n var x1 = currentSpace[0].charCodeAt(),\n x2 = nextSpace[0].charCodeAt(),\n y1 = currentSpace[1],\n y2 = nextSpace[1];\n if(player.getSide() === \"evil\")\n evilPawn(x1, x2, y1, y2, target, pieceWillBeHere, pieceWillNotBeHere);\n else //color is blue\n goodPawn(x1, x2, y1, y2, target, pieceWillBeHere, pieceWillNotBeHere);\n}", "function draw() { \n\n const imgField = new Image();\n imgField.src = \"./images/field.png\"; \n ctx.drawImage(imgField, 0, 0, W, H);\n player.draw();\n goal.draw();\n printScore();\n printLives();\n drawGoal();\n printMissedBalls() \n win();\n cone.draw()\n\n\n \n\n /*\n __ ___ \n ___/ /__ / _/__ ___ ___ ___ \n/ _ / -_) _/ -_) _ \\(_-</ -_)\n\\_,_/\\__/_/ \\__/_//_/___/\\__/ \n \n */ \n\n if (frames % 100 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n // if (frames % 100 === 0) {\n // const obstacle = new Character2(ctx)\n // defense.push(obstacle) \n // }\n if (frames % 50 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n if (frames % 50 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n if (frames % 200 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n \n \n \n defense.forEach(element => {\n element.draw();\n element.y += 5; \n });\n\n /*\n __ __ \n ___ / / ___ / /_\n (_-</ _ \\/ _ \\/ __/\n/___/_//_/\\___/\\__/ \n \n */ \n \n ballsAvailables.forEach(element => \n {element.draw();\n element.y -= 5;\n });\n\n\n\n /* __ \n ___ ____ ___ _/ /__\n / _ `/ _ \\/ _ `/ (_-<\n \\_, /\\___/\\_,_/_/___/\n/___/ \n*/\n\n function drawGoal (){\n goal.draw()\n\n if (goal.dir === 1 && goal.x > W - goal.w) {\n goal.dir = -1;\n }\n if (goal.dir === -1 && goal.x < 0) {\n goal.dir = 1;\n }\n\n goal.x += goal.dir;\n \n\n }\n \n /* \n __ ____ \n / / ___ _/ / /__\n / _ \\/ _ `/ / (_-<\n/_.__/\\_,_/_/_/___/\n */\n \n function addBall1(){\n while (ball1.length < 1){\n let newBall = new Ball();\n ball1.push(newBall)\n }\n }\n\n function addBall2(){\n while (ball2.length < 1){\n let newBall = new Ball();\n ball2.push(newBall)\n }\n }\n addBall1()\n addBall2()\n\n ball1.forEach(element => {\n element.draw();\n });\n \n ball2.forEach(element => {\n element.draw();\n });\n\n\n /* \n _____ _____ _ \n / ___/__ / / (_)__ (_)__ ___ ___\n/ /__/ _ \\/ / / (_-</ / _ \\/ _ \\(_-<\n\\___/\\___/_/_/_/___/_/\\___/_//_/___/\n \n */\n\n for (obstacle of defense) {\n if (obstacle.hits(player)) {\n // console.log('crashed', defense);\n chances -= 1\n defenderSound.play();\n player.x = (W/12) * 11;\n player.y = H - 100;\n player.dir = 'up';\n }\n }\n\n for (newBall of ball1) {\n if (newBall.hits(player)) {\n // console.log('ball +1', obstacle);\n ballsAvailables.push(shooting);\n ball1.splice(0,1)\n player.dir = 'up';\n shotSound2.play();\n }\n }\n for (newBall of ball2) {\n if (newBall.hits(player)) {\n // console.log('ball2 +1', obstacle);\n ballsAvailables.push(shooting);\n ball2.pop()\n player.dir = 'up';\n shotSound.play();\n }\n }\n\n\n for (shooting of ballsAvailables) {\n if (shooting.hitsGoal(goal)) {\n // console.log('goooooal', goal);\n scores +=1;\n console.log(scores);\n golSound.play();\n ballsAvailables.pop();\n $gol.style.visibility = \"visible\";\n $noGol.style.visibility = \"hidden\";\n }\n }\n\n\n\n for (shooting of ballsAvailables) {\n if (shooting.y === 5) {\n missed +=1;\n missSound.play();\n $gol.style.visibility = \"hidden\";\n $noGol.style.visibility = \"visible\";\n }\n }\n\n /* \n ________ __ _______ ____ _ _________ \n / ___/ _ | / |/ / __/ / __ \\ | / / __/ _ \\\n/ (_ / __ |/ /|_/ / _/ / /_/ / |/ / _// , _/\n\\___/_/ |_/_/ /_/___/ \\____/|___/___/_/|_| \n \n */\n\n if (chances === 0) {\n gameover = true;\n\n }\n if (missed === 8) {\n gameover = true;\n }\n\n if (scores === 25) {\n winner = true;\n }\n /* \n __ __ \n / /__ _ _____ / /__\n / / -_) |/ / -_) (_-<\n/_/\\__/|___/\\__/_/___/\n \n */\n\n if (scores >= 5) {\n goal.w = 180\n if (frames % 100 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n } \n \n if (scores >= 10) {\n goal.w = 135\n if (frames % 200 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n } \n \n if (scores >= 15) {\n goal.w = 90\n if (frames % 50 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n } \n \n if (scores >= 20) {\n goal.w = 45\n if (frames % 150 === 0) {\n const obstacle = new Character2(ctx)\n defense.push(obstacle) \n }\n }\n}", "fightEm(){\n // this.character.reposition(320-50,288);\n // this.character2.reposition(320+50,288,576,0);\n // this.character.makeRandomChar();\n // this.character2.makeRandomChar();\n // this.character.reposition(320-50,450);\n // this.character2.reposition(320+50,450,576,0);\n // this.character.makeRandomChar();\n // this.character2.makeRandomChar();\n this.winScreen.visible=false;\n this.loseScreen.visible=false;\n\n if(!this.battleActive){\n\n this.buildBackground();\n this.character.reposition(320-50,475);\n this.character2.reposition(320+50,475,576,0);\n\n this.character2.flipIt();\n\n\n this.character.makeRandomChar(0,0,0);\n\n\n this.character2.makeRandomChar(1,1,1);\n this.battleActive= true;\n this.battleMode();\n }\n\n }", "function moveDamage(color, damageAdded){\r\n\r\n\t//variable to hold which piece should be moved based on dice roll\r\n\tvar damage = whiteDamagePiece;\r\n\r\n\t//sets the correct piece based on color passed\r\n\tif(color == \"white\"){\r\n\t\tdamage = whiteDamagePiece;\r\n\t}\r\n\r\n\tif(color == \"yellow\"){\r\n\t\tdamage = yellowDamagePiece;\r\n\t}\r\n\r\n\tif(color == \"orange\"){\r\n\t\tdamage = orangeDamagePiece;\r\n\t}\r\n\r\n\tif(color == \"green\"){\r\n\t\tdamage = greenDamagePiece;\r\n\t}\r\n\r\n\tif(color == \"purple\"){\r\n\t\tdamage = purpleDamagePiece;\r\n\t}\r\n\r\n\tif(color == \"red\"){\r\n\t\tdamage = redDamagePiece;\r\n\t}\r\n\r\n\tif(color == \"black\"){\r\n\t\tdamage = blackDamagePiece;\r\n\t}\r\n\r\n\tif(color == \"blue\"){\r\n\t\tdamage = blueDamagePiece;\r\n\t}\r\n\r\n\t// pink to be implemented with 9th player option\r\n\r\n\t//Find correct player based on color\r\n\tfor(var i = 1; i <= game.num_of_players; i++)\r\n\t{\r\n\t\tif(game.player_array[i].player_color == color)\r\n\t\t{\r\n\t\t\tif(((game.player_array[i].hp + damageAdded) > 0) && ((game.player_array[i].hp + damageAdded) < game.player_array[i].character.hp))\r\n\t\t\t{\r\n\t\t\t\tgame.player_array[i].hp = game.player_array[i].hp + damageAdded;\r\n\t\t\t\tdamage.position.x = damage.position.x + (damageAdded*damageMeterSpaceSize); //.33\r\n\r\n\t\t\t}\r\n\t\t\telse if((game.player_array[i].hp + damageAdded) >= game.player_array[i].character.hp)\r\n\t\t\t{\r\n\t\t\t\tplayerDied(color);\r\n\t\t\t\tgame.player_array[i].hp = game.player_array[i].character.hp\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tgame.player_array[i].hp = 0;\r\n\t\t\t\tresetDamage(color);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tgame.check_win_or_dead();\r\n\t//the center of every square on the damage map is .33 away so we can move each piece the correct number of squares\r\n\t//by incrementing the x-coordinate by the damage take *.33\r\n\t//damage.position.x = damage.position.x + (damageAdded*.33);\r\n\r\n\r\n}", "move() {\n if (this.crashed) {\n return;\n }\n if (this.direction == 1) {\n this.y -= settings.step;\n }\n else if (this.direction == 2) {\n this.x += settings.step;\n }\n else if (this.direction == 3) {\n this.y += settings.step;\n }\n else if (this.direction == 4) {\n this.x -= settings.step;\n }\n }" ]
[ "0.62309426", "0.6194085", "0.61904204", "0.61862403", "0.615828", "0.6148708", "0.61429715", "0.60981095", "0.6059894", "0.6038212", "0.6012762", "0.6006209", "0.5988625", "0.5966156", "0.59660256", "0.59634364", "0.5920754", "0.59007365", "0.5900642", "0.58951914", "0.58929515", "0.5889021", "0.58777803", "0.5873874", "0.5858228", "0.5855083", "0.58479947", "0.5846474", "0.584571", "0.5838429", "0.58358073", "0.5828598", "0.5815926", "0.5812534", "0.5801023", "0.5796414", "0.57959944", "0.5783642", "0.577405", "0.57666266", "0.57583654", "0.57576555", "0.5757572", "0.5745749", "0.5742093", "0.57353264", "0.57234085", "0.5720658", "0.57199186", "0.57193005", "0.5719139", "0.571177", "0.57087755", "0.5703131", "0.5698441", "0.56984234", "0.5697113", "0.569569", "0.56869113", "0.56811416", "0.5680557", "0.56707025", "0.566673", "0.5654366", "0.5654102", "0.5649991", "0.5649494", "0.56444424", "0.56438315", "0.5640156", "0.5633698", "0.56334186", "0.56319237", "0.5631911", "0.56316674", "0.5623174", "0.56191", "0.5613661", "0.560448", "0.5602867", "0.560275", "0.5595299", "0.55827403", "0.5581791", "0.55793685", "0.55785", "0.5578054", "0.5575911", "0.55710787", "0.5569623", "0.5565572", "0.5565527", "0.5562486", "0.55623335", "0.55623037", "0.55592597", "0.5558707", "0.55582935", "0.5554972", "0.55526924" ]
0.73192215
0
set random landing position / /preload function
function preload(){ //player image this.load.atlas('player','././media/players/player1/playerSprite.png','././media/players/player1/playerAtlas.json'); //enemy image this.load.atlas('enemy','././media/players/enemy1/enemySprite.png','././media/players/enemy1/enemyAtlas.json'); //map files this.load.tilemapTiledJSON('map1a','./maps/map'+mapNumber+'.json'); this.load.image('wall','./media/walls/wall1.jpg'); //ground files this.load.image('ground','./media/grounds/ground1.png'); this.load.tilemapTiledJSON('ground','./maps/ground1.json'); //sounds this.load.audio('walkSound','././media/sounds/walking.mp3',{instances:1}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setLandingPosition(){\n landingPosition.x = Math.floor(Math.random() * (landingLimitCoordinates.right - landingLimitCoordinates.left + 1) + landingLimitCoordinates.left);\n landingPosition.y = Math.floor(Math.random() * (landingLimitCoordinates.down - landingLimitCoordinates.up + 1) + landingLimitCoordinates.up);\n}", "function setLoc() {\n xLoc = random(60, width - 60);\n yLoc = random(60, height - 60);\n}", "setRandomSpawnPoint() {\n // leer\n }", "function init()\t\t\t\t\t\t\t\t\t\t\t\t\r\n{\r\n\trandom_position();\r\n\tinit_ball();\r\n\ttimeleft=10;\r\n\tgoal_counter=0;\r\n\t\r\n}", "drip() {\n this.y += this.fallSpeed;\n if (this.y > height) {\n this.y = 0;\n this.x = random(width);\n }\n }", "function random() {\n random1 = Math.floor((Math.random() * startupX.length));\n random2 = Math.floor((Math.random() * startupY.length));\n\n}", "function startingPositionZombie() {\n\n yZombiePos = Math.floor(Math.random() * 7);\n xZombiePos = Math.floor(Math.random() * 7);;\n}", "function land(){\n // if(hero.yVel < -.4){ cloud.init(hero.x,hero.y);}\n hero.jumped = false;\n hero.onGround = true;\n hero.wasOnGround = true;\n hero.yVel = 0;\n hero.jumpHold = hero.jumpHoldMax;\n hero.canDoubleJump = false;\n hero.haveDoubleJumped = false;\n}", "function changeLoc() {\n swap(locs, 0, floor(random(1, numlocs)));\n}", "function getRandomLocation() {\n\n}", "move(){\n this.x=this.x+random(-3,3)\n this.y=this.y+random(-3,3)\n }", "function Start () \n{ \nvar position_start = Vector3( Random.Range(-7,5),Random.Range(-4,4) , 0); // random number generator\ntransform.position = position_start;\nRandomColor();\n\n}", "start() {\n\t\tif (this.ball.vel.x === 0 && this.ball.vel.y === 0) {\n\t\t\t// randomize the direction of the ball\n\t\t\tthis.ball.vel.x = 300 * (Math.random() > .5 ? 1 : -1); // if what is returned by math.random is more than .5 then mult by 1 otherwise if less than. mult by -1\n\t\t\tthis.ball.vel.y = 300 * (Math.random() * 2 - 1); // tweaks the y value so it changes the speed up or down just a little bit\n\t\t\tthis.ball.vel.len = 200;\n\t\t}\n\t}", "move() {\n this.x = this.x + random(-10,10);\n this.y = this.y + random(-10,10);\n }", "update() {\n this.z -= 300/tempo;\n if (this.z < 1) {\n this.x = random(-width/1.5, width/1.5);\n this.y = random(-height/1.5, height/1.5);\n this.z = random(width);\n this.pz = this.z;\n }\n }", "function updateTorch()\r\n{\r\n let min = 0; \r\n let max = torchLocations.length;\r\n\r\n let num = Math.floor(Math.random() * (max - min) + min);\r\n if (num == handle.loc)\r\n {\r\n num = (num + 1) % (max);\r\n }\r\n\r\n console.log(num);\r\n \r\n collision++;\r\n timeLeft += 10;\r\n handle.loc = num;\r\n handle.position.x = torchLocations[num][0];\r\n handle.position.z = torchLocations[num][1];\r\n\r\n}", "function glider() {\n let h = parseInt(Math.random() * (height - 3));\n let w = parseInt(Math.random() * (width - 3));\n field[h][w + 1] = true;\n field[h + 1][w + 2] = true\n field[h + 2][w + 2] = true\n field[h + 2][w + 1] = true\n field[h + 2][w] = true;\n draw();\n }", "function BallStartPosition()\n {\n var randomNum = Math.floor(Math.random()*2)\n if(randomNum == 0)\n {\n ball.speedX = -ball.speedX;\n ball.speedY = -ball.speedY;\n }\n if(randomNum == 1)\n {\n ball.speedX = Math.abs(ball.speedX);\n ball.speedY = Math.abs(ball.speedY);\n }\n console.log(randomNum);\n }", "function resetDirection() {\n posX = random(trueFalse);\n posY = random(trueFalse);\n w = 0;\n z = 0;\n}", "move() {\n this.x = this.x + random(-2, 2);\n this.y = this.y + random(-2, 2);\n }", "start(){\n \t// si la balle est au centre (après le reset)\n\t\tif (this.ball.mouv.x === 0 && this.ball.mouv.y === 0){\n\t\t\t // balle bouge vars la gauche (joueur 1) lorsque la partie reprend\n\t\t\t this.ball.mouv.x = - 300,\n\t\t\t // 1 chance sur deux que la balle se dirige vers le bas ou vers le haut \n this.ball.mouv.y = 300 * (Math.random() > .5 ? 1 : - 1);\n // vitesse lente à chaque reprise de la partie \n this.ball.mouv.len = 300;\n }\n\t\n\t}", "place() { \n\n //decides the random direction of the spot\n var randomDirection = floor(random(0,4));\n\n //alter this placement & direction based on the direction\n if(randomDirection === 0) { //east\n this.x = 0;\n this.y = (floor(random(0,3)) * (platformSize + 10) + HEIGHT/2 - movement);\n this.direction = 0;\n } else if(randomDirection === 1) { //west\n this.x = WIDTH;\n this.y = (floor(random(0,3)) * (platformSize + 10) + HEIGHT/2 - movement);\n this.direction = 1;\n } else if(randomDirection === 2) { //south\n this.x = (floor(random(0,3)) * (platformSize + 10) + WIDTH/2 - movement);\n this.y = 0;\n this.direction = 2;\n } else if(randomDirection === 3) { //north\n this.x = (floor(random(0,3)) * (platformSize + 10) + WIDTH/2 - movement);\n this.y = HEIGHT;\n this.direction = 3;\n }\n }", "function startBall () {\n\tlet direction = 1; \n\ttopPositionOfBall = startTopPositionOfBall;\n\tleftPositionOfBall = startLeftPositionOfBall;\n\n\t//50% change of starting in either direction (right of left)\n\tif (Math.random() < 0.5){\n\t\tdirection = 1;\n\t} else {\n\t\tdirection = -1;\n\t}//else\n\n\n\ttopSpeedOfBall = Math.random() * 2 + 3; //3-4\n\tleftSpeedOfBall = direction * (Math.random() * 2 + 3); \n\n\toriginalTopSpeedOfBall = topSpeedOfBall;\n\toriginalLeftSpeedOfBall = leftSpeedOfBall;\n\n}//startBall", "move() {\n\t\tthis.x = this.x + random(-2, 2);\n\t\tthis.y = this.y + random(-2, 2);\n\t\tthis.width = this.width + random(-3, 3);\n\t\tthis.height = this.height + random(-3, 3);\n\t}", "start () {\n if (this.ball.velocity.x === 0 && this.ball.velocity.x === 0) {\n this.ball.velocity.x = 3 * (Math.random() > .5 ? 1 : -1);\n this.ball.velocity.y = 3 * (Math.random() * 2 - 1);\n this.ball.velocity.len = 3;\n }\n }", "move() {\n var dirx = Math.random() > 0.5 ? 1 : -1;\n var diry = Math.random() > 0.5 ? 1 : -1;\n var L = int((Math.random() * 20));\n var L2 = int((Math.random() * 20));\n this.endx = this.posx + (L * dirx);\n this.endy = this.posy + (L2 * diry);\n }", "function position() {\n var x = Math.random() * $(window).width();\n var y = Math.random() * $(window).height();\n $('#downstairs').offset({\n // position: 'absolute',\n top: y,\n left: x\n });\n}", "function initPositionSerpent() {\n xSerp = Math.trunc(Math.random()*nombreBlockParWidth)*tailleSerp;\n ySerp = Math.trunc(Math.random()*nombreBlockParHeight)*tailleSerp;\n }", "spawn() {\n this.x = getRandomInt(0, 25) * this.grid;\n this.y = getRandomInt(0, 25) * this.grid;\n }", "move() {\r\n this.x += Math.random() * 4 - 2;\r\n this.y += Math.random() * 4 - 2;\r\n }", "move() {\r\n this.x += Math.random() * 4 - 2;\r\n this.y += Math.random() * 4 - 2;\r\n }", "resetPosition() {\n this.x = this.posX[Math.floor(Math.random() * this.posX.length)];\n this.y = this.posY[Math.floor(Math.random() * this.posY.length)];\n }", "constructor() {\n this.positions = {\n x: Math.floor(Math.random() * Math.floor(window.innerWidth - 100)),\n y: Math.floor(Math.random() * Math.floor(window.innerHeight - 100))\n };\n this.identityNumber;\n this.isDead = false;\n }", "function fishingRod() {\n var randomizeWidth3 = Math.floor(Math.random() * ($(window).width() - $(\"#rod\").width()));\n $(\"#rod\").offset({\n left: randomizeWidth3\n }).css({\n \"top\": \"-360px\"\n });\n $(\"#rod\").animate({\n top: 100\n }, 1000)\n}", "function setSpawnPoints()\r\n{\r\n let g = new THREE.BoxGeometry(8, 20, 2);\r\n let tex = new THREE.TextureLoader().load('./resources/cornentrance.jpg');\r\n let m = new THREE.MeshBasicMaterial({map:tex})\r\n endPoint = new THREE.Mesh(g, m);\r\n scene.add(endPoint);\r\n\r\n // // Non random exit location.\r\n endPoint.position.z = 20;\r\n endPoint.type = \"end\";\r\n p.push(endPoint);\r\n\r\n // Comment below out for a known exit testing\r\n let min = 0;\r\n let max = exitLocations.length;\r\n let num = Math.floor(Math.random() * (max - min) + min);\r\n endPoint.position.x = exitLocations[num][0];\r\n endPoint.position.z = exitLocations[num][1];\r\n\r\n // The last 4 spawn locations of the 7 (3-6) need to be rotated 90 L or R\r\n if (num >= 3)\r\n {\r\n endPoint.rotateY(Math.PI / 2); \r\n }\r\n\r\n\r\n \r\n // Rotates the head into any desired angle -> randomize for an extra challenge?\r\n head.position.x = -18;\r\n head.position.z = 15;\r\n head.rotateY(Math.PI); \r\n head.material.opacity = 0.5;\r\n head.material.transparent = true;\r\n}", "maybePlanet(){\n\t\tlet randnum = random(2000);\n\t\tif (randnum < 1){\n\t\t\tthis.makePlanet(random(width - 300));\n\t\t}\n\t}", "function randomGhost() {\n $('#ghost').css(\"left\",(Math.floor(Math.random() * 15+1))*64);\n $('#ghost').css(\"top\",(Math.floor(Math.random() * 7+1))*64);\n $('#ghost').toggleClass('hidden');\n}", "reset() {\r\n this.x = wid/2;\r\n this.y = hei/2;\r\n lastHit = '-';\r\n let angle = random(-PI, PI);\r\n if ([0].includes(angle)){\r\n \tthis.reset();\r\n }\r\n this.xspeed = 5 * Math.cos(angle*angle);\r\n this.yspeed = 5 * Math.sin(angle*angle);\r\n \r\n if (random(1) < 0.5) {\r\n this.xspeed *= -1;\r\n }\r\n if (random(1) < 0.5) {\r\n this.yspeed *= -1;\r\n }\r\n }", "function randomLocation(){\n var max = 400;\n var min = 0;\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}", "move() {\n\n\t\tthis.x += random(-5, 5);\n\t\tthis.y += random(-5, 5);\n\n\t}", "function pickLocation() {\n var cols = floor(width/scl);\n var rows = floor(height/scl);\n food = createVector(floor(random(1,cols-1)), floor(random(1,rows-1)));\n food.mult(scl);\n}", "generateRandom() {\n const { x, y } = this.getRandomPixelCoordinate();\n this.create('hero', x, y);\n }", "reset() {\n //spawns it at the middle of the sketch\n this.x = width / 2;\n this.y = height / 2;\n //allows the ball to pop up at a random speed and angle when it has been generated\n let angle = random(-PI / 4, PI / 4);\n this.ballvx = 5 * Math.cos(angle);\n this.ballvy = 5 * Math.sin(angle);\n\n if (random(1) < 0.5) {\n this.ballvx *= -1;\n }\n }", "function pickLocation(){\n var cols = floor(width/scl);\n var rows = floor(height/scl);\n food = createVector(floor(random(cols)), floor(random(rows)));\n food.mult(scl);\n}", "function randomSetup(fleet) {\n\tif (fleet.currentShip >= fleet.numOfShips) return;\n\t\n\tvar orien = Math.floor((Math.random() * 10) + 1);\n\tvar length = fleet.ships[fleet.currentShip].length;\n\t\n\tif (orien < 6) {\n\t\tvar shipOffset = 11 - fleet.ships[fleet.currentShip].length; \n\t\tvar horiz = Math.floor((Math.random() * shipOffset) + 1);\n\t\tvar vert = Math.floor(Math.random() * 9);\n\t\tvar randNum = parseInt(String(vert) + String(horiz));\n\t\tif (fleet == npcFleet) checkOverlap(randNum, length, \"horz\", fleet);\n\t\telse setShip(randNum, fleet.ships[fleet.currentShip], \"horz\", fleet, \"random\");\n\t} else {\n\t\tvar shipOffset = 110 - (fleet.ships[fleet.currentShip].length * 10);\n\t\tvar randNum = Math.floor((Math.random() * shipOffset) + 1);\n\t\n\t\tif (fleet == npcFleet) checkOverlap(randNum, length, \"vert\", fleet); \n\t\telse setShip(randNum, fleet.ships[fleet.currentShip], \"vert\", fleet, \"random\");\n\t}\n}", "function randomCoordinates(startingLength, scale) {\n var x = Math.floor(Math.random() * loadingVisWidth) + 1;\n var y = Math.floor(Math.random() * loadingVisHeight) + 1;\n\n // Ensure that coordinates will not position image outside of visualization bounds, even after transition\n while (x > loadingVisWidth - (startingLength + 0.5 * scale) || x < (0.5 * scale) || y < (0.5 * scale) || y > loadingVisHeight - (startingLength + 0.5 * scale)) {\n x = Math.floor(Math.random() * loadingVisWidth) + 1;\n y = Math.floor(Math.random() * loadingVisHeight) + 1;\n }\n\n return { x: x, y: y };\n\n\n\n}", "move() {\n this.x += random(-5, 5);\n this.y += random(-5, 5);\n }", "spawnNewGameObjectAtStart(type) {\n\t\tlet xy = this.getRandomCoordinateAtStart();\n\t\tthis.spawnNewGameObject(type, xy.x, xy.y);\n\t}", "function ballStart() \n {\n ball.xPos = 400;\n ball.yPos = 230;\n ball.speedY = 5 + 5 * Math.random();\n ball.speedX = 5 + 5 * Math.random();\n\n changedirection = true * Math.random;\n }", "reset()\n\t{\n\t\tthis.x = width/2;\n\t\tthis.y = height/2;\n\t\tlet angle = random(-PI/4, PI/4);\n\t\tthis.xspeed = 5 * Math.cos(angle);\n\t\tthis.yspeed = 5 * Math.sin(angle);\n\n\t\tif (random(1) < 0.5)\n\t\t{\n\t\t\tthis.xspeed *= -1;\n\t\t}\n\t}", "function determineStartingPlayer()\n{\n // @TODO: Random laten bepalen welke speler aan de beurt is of mag beginnen\n \n}", "async land(game, data) {\n\t\tthis._jump_time = -1;\n\t}", "async land(game, data) {\n\t\tthis._jump_time = -1;\n\t}", "function move_lady() {\n lady.x = (Math.random() * (canvas.width));\n lady.y = Math.floor((Math.random() * 485));\n ladyx = lady.x;\n\tladyy = lady.y;\n\tdraw_lady();\n}", "function randomPos(a) {\n a.style.top = `${getRange(100)}%`;\n a.style.right = `${getRange(100)}%`;\n a.style.left = `${getRange(100)}%`;\n a.style.bottom = `${getRange(100)}%`;\n }", "function Start()\n{\n\tif (Enabled)\n\t{\n\t\ttransform.localPosition = Vector3(Random.Range(-1,2),Random.Range(-1,2),Random.Range(-1,2));\n\t\tif(transform.localPosition.x == 0)\n\t\t{\n\t\t\txT = false;\n\t\t}\n\t\tif(transform.localPosition.y == 0)\n\t\t{\n\t\t\tyT = false;\n\t\t}\n\t\tif(transform.localPosition.z == 0)\n\t\t{\n\t\t\tzT = true;\n\t\t}\n\t}\n\t\n\t/*prevDest = transform.localPosition;\n\tnexDest = Vector3(Random.Range(0,2),0,Random.Range(0,2));\n\tdestDif = nexDest - prevDest;\n\t*/\n}", "function setFish1() {\n fish1.x = random(tlx - (1 / 3) * padding, trx + (1 / 3) * padding);\n fish1.y = random(trry - (1 / 3) * padding, bry + (1 / 3) * padding);\n fish1.size = random(40, 85);\n}", "function setGoal() {\n goal = Math.floor(Math.random() * 102) + 19;\n}", "setBallPosition(minPosition, maxPosition){\n\n\t\tthis.ball= Math.floor(Math.random()* (maxPosition -minPosition+1);\n\n\t\n\t}", "function randStart() {\n return Math.random() - .5;\n}", "function setPositions() {\n diceOnePosition = getRandomNum();\n diceTwoPosition = getRandomNum();\n}", "function setMeshRandomPos(mesh) {\n mesh.position.x = getRandomIntInclusive(-20, 20);\n mesh.position.y = getRandomIntInclusive(-10, 10);\n mesh.position.z = getRandomIntInclusive(-20, 20);\n}", "function locRnd() {\n return (Math.random() - 0.5) / 50;\n}", "reset() {\n this.x = (floor(random(0, 20))) * this.size;\n this.y = (floor(random(0, 10))) * this.size;\n\n }", "function pickLocForPellet() {\n\tvar cols = floor(windowWidth/s.sWidth);\n\tvar rows = floor(windowHeight/s.sHeight);\n\tpelletPosition =createVector(floor (random(cols)), floor(random(rows)));\n\tpelletPosition.x = constrain (pelletPosition.x * s.sWidth, 20, windowWidth-s.sWidth-60);\n\tpelletPosition.y = constrain (pelletPosition.y * s.sHeight, 20, windowWidth-s.sHeight-20);\n}", "function setNew() {\n curPos = 4\n rndT = nextRnd\n nextRnd = Math.floor(Math.random()*tetrominoes.length)\n curT = tetrominoes[rndT][curRot]\n }", "reset() {\n this.x = width / 2;\n this.y = height / 2;\n this.xdir = random(-5, 5);\n this.ydir = random(-5, 5);\n }", "function randomPosition ()\n{\n\treturn { \"x\": Math.ceil(Math.random() * CANVAS_WIDTH), \"y\": Math.ceil(Math.random() * CANVAS_HEIGHT) };\n}", "constructor(){\n this.x = random(0, width); //x-coordinate is randomized\n this.y = random(0, -height/2);//y-coordinate is randomized as well\n }", "reset() {\n // Random position\n this.x = random(0, width);\n this.y = random(0, height);\n this.visibility = 255; // reset visibility\n\n }", "function randomLane() {\r\n\tvar currentWidth=window.innerWidth;\r\n\tif(currentWidth>800){\r\n\t\tvar lanes = [\"32%\", \"47%\", \"60%\"];\r\n\t\treturn lanes[Math.floor(Math.random() * 3)];\r\n\t}\r\n\telse{\r\n\t\tvar lanes = [\"5%\", \"40%\", \"78%\"];\r\n\t\treturn lanes[Math.floor(Math.random() * 3)];\r\n\t}\r\n}", "function rndLandColor() {\n return 'rgb(' + colorsLand[Math.floor(Math.random() * 5999) + 1] + ')';\n }", "move() {\n this.y = this.y +this.fallSpeed;\n if(this.y>height+100){\n \n this.y = -100;\n\n this.x = random(width);\n }\n \n }", "function assignNewPosition() {\n\tvar pos = {};\n\tdo {\n\t\tpos.x = Math.floor(Math.random() * gridW);\n\t\tpos.y = Math.floor(Math.random() * gridH);\n\t} while (filledPositions[pos.x][pos.y]);\n\t\n\tfilledPositions[pos.x][pos.y] = true;\n\t\n\tpos.x=pos.x*40+30+Math.floor(Math.random()*26-13);\n\tpos.y=pos.y*40+30+Math.floor(Math.random()*26-13);\n\t\n\treturn pos;\n}", "function random_position()\t\t\t\t\t\t\t\t\r\n{\r\n\tgate_pos=document.getElementById(\"gate\");\t\t\t\t//getting gate\r\n\tobj_out=document.getElementById(\"field\");\t\t\t\t//getting field\r\n\tvar y = obj_out.offsetHeight-gate_pos.clientHeight;\t\t//vertical variable inside the field height range\r\n\tvar x = obj_out.offsetWidth-gate_pos.clientWidth;\t\t//horizontal variable inside the field width range\r\n\tvar randomX = Math.ceil((Math.random()*x)/10)*10;\t\t//random horizontal position in multiply of 10\r\n\tvar randomY = Math.ceil((Math.random()*y)/10)*10;\t\t//random vertical position in multiply of 10\r\n\t\r\n\tgate_pos.style.left=randomX+'px';\t\t\t\t\t\t\t//attribution of hor.pos.\r\n\tgate_pos.style.top=randomY+'px';\t\t\t\t\t\t\t//attribution of vert.pos.\r\n\tgate_pos.style.position= \"absolute\";\t\t\t\t\t\t//reset position value\r\n\tgate_pos_hor=parseInt(gate_pos.style.left);\t\t\t\t\t//gate margin left in pixels\r\n\tgate_pos_ver=parseInt(gate_pos.style.top);\t\t\t\t\t//gate margin top in pixels\r\n\tgate_pos_hor+=40;\r\n\tgate_pos_ver+=40;\r\n\tdocument.getElementById(\"goal_counter\").innerHTML=\"Score: \"+goal_counter+\"\";\r\n}", "function gener(){\r\n posX = length*Math.floor(8*Math.random());\r\n}", "function goalBoxSpawn() {\n var randomX = Math.floor( Math.random() * ( window.innerWidth - 2 * boxWidth ) / boxWidth );\n var randomY = Math.floor( Math.random() * ( window.innerHeight - 2 * boxHeight ) / boxHeight );\n\n goalBox.position.x = boxWidth * randomX;\n goalBox.position.y = boxHeight * randomY;\n}", "async loadAt(x,y,z,angle) {\n this.group = new BABYLON.TransformNode('Portal:'+this.name);\n this.group.position = new BABYLON.Vector3(x,y,z);\n this.group.rotationQuaternion = new BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y,angle);\n\n if (this.shadowGenerator) {\n var clone = VRSPACEUI.portal.clone();\n clone.parent = this.group;\n var meshes = clone.getChildMeshes();\n for ( var i = 0; i < meshes.length; i++ ) {\n this.shadowGenerator.getShadowMap().renderList.push(meshes[i]);\n }\n } else {\n VRSPACEUI.copyMesh(VRSPACEUI.portal, this.group);\n }\n\n var plane = BABYLON.Mesh.CreatePlane(\"PortalEntrance:\"+this.name, 1.60, this.scene);\n plane.parent = this.group;\n plane.position = new BABYLON.Vector3(0,1.32,0);\n this.pointerTracker = (e) => {\n if(e.type == BABYLON.PointerEventTypes.POINTERDOWN){\n var p = e.pickInfo;\n if ( p.pickedMesh == plane ) {\n if ( this.isEnabled ) {\n console.log(\"Entering \"+this.name);\n this.enter();\n } else {\n console.log(\"Not entering \"+this.name+\" - disabled\");\n }\n }\n }\n };\n this.scene.onPointerObservable.add(this.pointerTracker);\n\n this.material = new BABYLON.StandardMaterial(this.name+\"-noise\", this.scene);\n plane.material = this.material;\n\n this.material.disableLighting = true;\n this.material.backFaceCulling = false;\n var noiseTexture = new BABYLON.NoiseProceduralTexture(this.name+\"-perlin\", 256, this.scene);\n this.material.lightmapTexture = noiseTexture;\n noiseTexture.octaves = 4;\n noiseTexture.persistence = 1.2;\n noiseTexture.animationSpeedFactor = 2;\n plane.visibility = 0.85;\n this.textures.push( noiseTexture );\n\n this.title = BABYLON.MeshBuilder.CreatePlane(\"Text:\"+this.name, {height:2,width:4}, this.scene);\n this.title.parent = this.group;\n this.title.position = new BABYLON.Vector3(0,2.5,0);\n this.title.isVisible = this.alwaysShowTitle;\n\n var titleTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh(this.title, 256,256);\n this.materials.push(this.title.material);\n \n this.titleText = new BABYLON.GUI.TextBlock();\n this.titleText.color = \"white\";\n this.showTitle();\n\n titleTexture.addControl(this.titleText);\n //this.controls.push(titleText); // CHECKME doesn's seem required\n this.textures.push(titleTexture);\n \n this.attachSound();\n \n return this;\n }", "function defineShootingStarPosition(){\n document.querySelector('.star').style.left = Math.floor((Math.random() * 1500) + 1) + 'px';\n document.querySelector('.star').style.top = Math.floor((Math.random() * 300) + 1)+ 'px';\n setTimeout(defineShootingStarPosition, 1000);\n}", "function pickLocForFood() {\n\tvar cols = floor(windowWidth/s.sWidth);\n\tvar rows = floor(windowHeight/s.sHeight);\n\tfoodPosition =createVector(floor (random(cols)), floor(random(rows)));\n\tfoodPosition.x = constrain (foodPosition.x * s.sWidth, 20, windowWidth-s.sWidth-60);\n\tfoodPosition.y = constrain (foodPosition.y * s.sHeight, 20, windowWidth-s.sHeight-20);\n}", "function pickLocation(){\n var cols = floor (width/scl);\n var rows = floor (height/scl);\n //Floor to be whole numbers.\n food = createVector(floor(random(cols)), floor(random(rows)));\n food.mult(scl);\n}", "function pickPos(){\r\n return Math.floor((Math.random()*300)+100) + \"px\";\r\n}", "constructor(height, width) {\n this.x = random(-width/1.5, width/1.5);\n this.y = random(-height/1.5, height/1.5);\n this.z = random(width);\n this.pz = this.z;\n\n }", "function randomObjectsPosition(){\n scope.css3dObjects.forEach(function(obj){\n if(!obj)return;\n var x=(random()*2-1)*scope.screenInfo.zoneWidth;\n var y=(random()*2-1)*scope.screenInfo.zoneHeight;\n if(x>scope.screenInfo.zoneWidth/2)x+=scope.screenInfo.zoneWidth;\n if(x<scope.screenInfo.zoneWidth/2)x-=scope.screenInfo.zoneWidth;\n if(y>scope.screenInfo.zoneHeight/2)y+=scope.screenInfo.zoneHeight;\n if(y<scope.screenInfo.zoneHeight/2)y-=scope.screenInfo.zoneHeight;\n obj.position.x=x;\n obj.position.y=y;\n });\n }", "getRandomCoordinateAtStart() {\n\t\tlet space = 80, width = window.innerWidth, height = this.gameHeight;\n\t\tlet searching = true, attempts = 0, maxAttempts = 10, xy;\n\n\t\twhile (searching && attempts < maxAttempts) {\n\t\t\txy = getRandomCoordinateAtStartHelper(this.util.randomInt);\n\t\t\tif (!this.isLocationOccupiedByGameObject(xy, this.util.getDistanceBetweenPoints)) {\n\t\t\t\tsearching = false;\n\t\t\t\tbreak;\n\t\t\t} else {\n\t\t\t\tattempts++;\n\t\t\t}\n\t\t}\n\t\treturn xy;\n\n\t\tfunction getRandomCoordinateAtStartHelper(randomIntFunc) {\n\t\t\treturn { x: randomIntFunc(-width * 3 / 4, width * 3 / 4), y: randomIntFunc(-height / 3 - space, height) };\n\t\t}\n\t}", "function randomizeMovement() {\n environment.edgeType = 1;\n selection = 0;\n}", "function Start () {\n\tsetSpawnPositions();\n}", "function positionEntityRandomly(entity) {\n\n entity.x = generateRandomNumber(0, WIDTH);\n entity.y = generateRandomNumber(0, HEIGHT);\n\n }", "constructor() {\n this.x = random(0, windowWidth);\n this.y = random(0, windowHeight);\n this.r = random(0, 2.5);\n this.xSpeed = random(-0.1, 0.5);\n this.ySpeed = random(-0.1, 0.5);\n }", "function startRandomGame() {\n\n}", "function init() {\r\n can = document.getElementById(\"mx-login-bg-animate\");\r\n ctx = can.getContext(\"2d\");\r\n width = $('body').width();\r\n height = $('body').height();\r\n\r\n for (x = 0; x < numPoints; x++) {\r\n var newPoint = new Point();\r\n newPoint._size = (Math.random() * (3 - 0.5) + 0.5).toFixed(2);\r\n newPoint._x = (Math.random() * width).toFixed(0);\r\n newPoint._y = (Math.random() * height).toFixed(0);\r\n newPoint._direction = (Math.random() * 360).toFixed(2);\r\n newPoint._velocity = (Math.random() * (4 - 0.1) + 0.2).toFixed(2);\r\n newPoint._randomization = (Math.random() * (10 - 0) + 0).toFixed(2);\r\n aPoints.push(newPoint);\r\n }\r\n\r\n animate();\r\n }", "function startBall(){\r\n\tlet direction = 1;\r\n\ttopPositionOfBall = startTopPositionOfBall;\r\n\tleftPositionOfBall = startLeftPositionOfBall;\r\n\t\r\n\t//50% chance of starting in either direction (right or left)\r\n\tif(Math.random() < 0.5){\r\n\t\tdirection = 1;\r\n\t} else {\r\n\t\tdirection = -1;\r\n\t}//else\r\n\t\t\r\n\ttopSpeedOfBall = Math.random() * speedRange + speedMin; \r\n\t\r\n\tif(checkScore()){\r\n\tspeedMin += 2;\r\n\tlevels++;\r\n\t}//if\r\n\t\r\n\tleftSpeedOfBall = direction * (Math.random() * speedRange + speedMin);\r\n\t\r\n\t\r\n\t\r\n}//startBall", "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}", "constructor() {\n this.x = p.random(0, window.innerWidth);\n this.y = p.random(0, window.innerHeight);\n this.r = p.random(10, 100);\n this.xSpeed = p.random(-2, 2);\n this.ySpeed = p.random(-1, 1.5);\n }", "function randPlace(image) {\n var temp = getRandomInt(0, gw - image.width);\n image.style.left = temp + \"px\";\n temp = getRandomInt(0, gh - image.height);\n image.style.top = temp + \"px\";\n}", "bhv_flank() {\n if (this.bhv_time == 1) {\n console.log(\"flank\");\n this.dash_dist = Math.abs(this.pos[0] - playerInstance.pos[0]);\n }\n this.accel = this.dash_dist * 0.03;\n\n\n if (this.bhv_time >= 17) {\n this.behavior = this.bhv_normal;\n this.bhv_time = Math.floor( 31 + Math.random() * 10 );\n }\n }", "function resetstar(a) {\n a.x = (Rnd() * width - (width * 0.5)) * warpZ;\n a.y = (Rnd() * height - (height * 0.5)) * warpZ;\n a.z = warpZ;\n a.px = 0;\n a.py = 0;\n }", "function randomPosition() {\n var random = Math.floor(Math.random() * 10);\n return random;\n}", "function randomOffset() {\r\n\r\n\t\treturn ( Math.random() - 0.5 ) * 2 * 1e-6;\r\n\r\n\t}", "getRandomDirection(){\n this.setDirection(Math.floor(Math.random() * 4));\n }", "function positionFood() {\n food.x = random(0,width);\n food.y = random(0,height);\n food.vx = random(-food.maxSpeed,food.maxSpeed);\n food.vy = random(-food.maxSpeed,food.maxSpeed);\n}" ]
[ "0.8184856", "0.6989794", "0.6848632", "0.66023177", "0.6522307", "0.6510295", "0.64572453", "0.6455885", "0.64536107", "0.6445708", "0.63958424", "0.6394101", "0.63374877", "0.6290366", "0.62876713", "0.6285816", "0.6257695", "0.6254049", "0.6234463", "0.62185955", "0.6210223", "0.6209898", "0.6208715", "0.62031853", "0.6192674", "0.61834484", "0.6174153", "0.6139546", "0.6130408", "0.60603213", "0.60603213", "0.6056911", "0.6056163", "0.60534716", "0.6042619", "0.60408545", "0.60356593", "0.6030203", "0.6027332", "0.6020958", "0.6018548", "0.601579", "0.6014431", "0.6013469", "0.6011714", "0.6011418", "0.60067993", "0.6000504", "0.5998163", "0.5989372", "0.59836775", "0.5979711", "0.5979711", "0.59775585", "0.59746104", "0.59738237", "0.59724396", "0.5972038", "0.59689385", "0.5965023", "0.5964126", "0.5962796", "0.596173", "0.59524935", "0.5947038", "0.59447086", "0.5942456", "0.59301937", "0.59294176", "0.5929282", "0.5927101", "0.59202427", "0.59158367", "0.5912351", "0.5911077", "0.590163", "0.58974504", "0.58954275", "0.5889231", "0.588626", "0.58742654", "0.5860683", "0.58536184", "0.58447075", "0.58334684", "0.5832805", "0.5830464", "0.5829303", "0.5828142", "0.58243656", "0.58096796", "0.58054894", "0.5802058", "0.5797111", "0.5794198", "0.57909214", "0.5785731", "0.5785657", "0.57818973", "0.57808334", "0.5779292" ]
0.0
-1
function for getting the data from the server
function getData(page) { $('table tbody').empty() $.ajax({ 'url': 'http://localhost:8080/H2HBABBA1625/dummyServlet', 'type': 'GET', 'data': { page: page }, 'datatype': 'json' }).then(data => { data = JSON.parse(data) var tr = $('table tbody') data.map(item => { markup = `<tr id="trow"> <td class='row-value'><input type="checkbox" name="checkbox" id="mark" onclick="makeAvailable(this)"></td> <td hidden>${item.key}</td> <td class="row-value">${item.name_customer}</td> <td class="row-value">${item.cust_number}</td> <td class="row-value">${item.invoice_id}</td> <td class="row-value">${item.total_open_amount}</td> <td class="row-value">${item.clear_date}</td> <td class="row-value">${item.due_in_date}</td> <td class="row-value">${item.note}</td> </tr>` tr.append(markup) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_data() {}", "getData(){}", "function getDataFromServer() {\n console.log('get server data')\n $.get('http://localhost:3000/getdata', function(result) {\n // console.log(result)\n\n result = JSON.parse(result)\n\n var carsData = result.cars.data\n var crime = result.crime.data\n var park = result.park.data\n var constructions = result.constructions.data\n var uv = result.uv.data\n var airquality = result.airquality.data\n\n // console.log(\"carsData: \" + carsData)\n\n // Draw all on map\n drawCarDataOnMap(carsData, map)\n drawConstructionSiteOnMap(constructions, map)\n drawCrimeSiteOnMap(crime, map)\n\n // Add to grid system\n for (var i = 0; i < constructions.length; i++) {\n addConstructionSiteToGrid(constructions[i])\n };\n\n for (var i = 0; i < crime.length; i++) {\n addCrimeSiteToGrid(crime[i])\n };\n\n for (var i = 0; i < carsData.length; i++) {\n addCarsDataToGridLine(carsData[i])\n };\n\n // console.log(JSON.stringify(grid))\n\n\n // UV\n $('#uv_data').html(\"UV指數:\" + getUV(uv))\n\n $('#aq_data').html('空氣品質:' + getAirQuality(airquality))\n\n })\n}", "GetData() {}", "static async getData() {\n const url = 'http://cparkchallenge.herokuapp.com/report/:lat/:long';\n\n return await fetch(url)\n .then(dataFromServer => dataFromServer.json());\n }", "function getData() {\n if(app.connected) {\n // prepare thingspeak URL\n // set up a thingspeak channel and change the write key below\n var key = 'IKYH9WWZLG5TVYF2'\n var urlTS = 'https://api.thingspeak.com/update?api_key=' + key + '&field1=' + app.heartRate;\n // make the AJAX call\n $.ajax({\n url: urlTS,\n type: \"GET\",\n dataType: \"json\",\n success: onDataReceived,\n error: onError\n });\n }\n\t}", "function requestServerData()\n {\n sendCommand(\"JSON.stringify(Module_GetLastDataNative('\" + pageInstance.aliases.join(\"','\") + \"'));\", handleServerData);\n }", "function getData (url){\t\r\n\tvar xmlhttp = new XMLHttpRequest(); // a http object to execute the request.\r\n\txmlhttp.open(\"POST\",url,false); // We define the kind of request.\r\n\txmlhttp.send(); // The request is sent to the server side.\t\r\n\treturn xmlhttp.responseText ; // We return the server response.\r\n}", "function getData(){\r\n\r\n \r\n //url of the site where the info comes from\r\n const Launches_URL = \"https://api.spacexdata.com/v2/launches/all\";\r\n \r\n let url = Launches_URL;\r\n\r\n \r\n \r\n \r\n //calling the method that will look through the retrieved info\r\n $.ajax({\r\n dataType: \"json\",\r\n url: url,\r\n data: null,\r\n success: jsonLoaded\r\n });\r\n\t}", "function getData() {\n let name = qs(\"select\").value;\n let url = URL_BASE + name + \"/\";\n fetch(url)\n .then(checkStatus)\n .then(response => response.json())\n .then(genData)\n .catch(handleError);\n }", "function get_page_data() {\n socket.emit('get_page_data', {data: ''});\n //call server to tell we want all data, so we can fill the ui (normally done once on full page load/refresh)\n}", "function getData() {\n\t\t\tvar deferred = $.Deferred();\n\t\t\t// get RPC results\n\t\t\tRactiveRPC.testDataAsync({\n\t\t\t\tonsuccess: function(results) {\n\t\t\t\t\tdeferred.resolve(results);\n\t\t\t\t},\n\t\t\t\tonerror: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\tontimeout: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\ttimeout: 2000,\n\t\t\t\tparams: [1,2]\n\t\t\t});\t\n\t\t\t\n\t\t\treturn deferred.promise();\n\t\t}", "function ajxGetRawData() {\n var getURL, timestamp, username, password;\n username = window.localStorage.getItem(\"loginname\");\n password = window.localStorage.getItem(\"password\");\n setEarliestTimestamp();\n timestamp = window.localStorage.getItem(\"earliestTimestamp\");\n\n getURL = \"http://thm-chat.appspot.com/oop/messages?since=\" + timestamp;\n getURL += \"&user=\" + username;\n getURL += \"&password=\" + password;\n\n $.ajax({\n type: 'get',\n url: getURL,\n success: function (response) {\n parseRawData(response);\n }\n });\n}", "function getData (cb) {\n let url = known_data_instances[Math.floor(Math.random() * known_data_instances.length)]\n\n console.log(url)\n // Do something with the requests\n // request(url, {json: true}, (err, res, data) => {\n // if (err) return cb(err)\n\n // cb(null, data)\n // })\n}", "function getData() {\n const apiName = 'sbrestapi';\n const path = '/alerts';\n const myInit = {\n // OPTIONAL\n headers: {}, // OPTIONAL\n };\n\n return API.get(apiName, path, myInit).catch(err => {\n console.log('There has been a problem with your fetch operation: ' + err);\n throw err;\n });\n}", "function getData(requestUrl) {\n \n\n}", "function getData() {\n console.log(data)\n }", "getAll() {\n return this.getDataFromServer(this.path);\n }", "async function getData() {\n let daten = new FormData(document.forms[0]);\n query = new URLSearchParams(daten);\n // url = \"https://gissose2021.herokuapp.com\"; //herokuapnpm p link einfügen als url variable \n url = \"http://localhost:8100\";\n url += \"/getData\";\n url = url + \"?\" + query.toString(); //Url in String umwandeln\n let response = await fetch(url); //auf url warten\n let responseText = await response.text(); //json okject erstellen\n serverResponse.innerHTML = responseText;\n }", "function getData() {\n setSpinner(true);\n var url = config.baseUrl + \"AircraftList.json?lat=\" + userPosition.coords.latitude + \"&lng=\" + userPosition.coords.longitude + \"&fDstL=0&fDstU=\" + config.range;\n httpGetAsync(url, onSuccessGetData, onErrorGetData)\n }", "function getData() {\n openWebEocSession();\n var data = new XMLHttpRequest();\n data.open('GET', baseURL + boardURL, true);\n data.onload = function () {\n if (this.status == 200) {\n let allData = JSON.parse(this.responseText);\n populateAllVariables(allData);\n }\n }\n data.send();\n\n\n}", "function getData(){\n $.get(\"../getDeskItems.php\", function(data, status){\n if(status === 'success'){\n postData(data);\n }\n else{\n //TODO: Add failover\n console.log(\"Request Failed!\");\n }\n })\n }", "function getDataFromServer() {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(data);\n }, 2000);\n });\n}", "function getData(url,callBack){\n\t\tvar xmlHttp = new XMLHttpRequest();\n\t\txmlHttp.onreadystatechange = function(){\n\t\t\t if (xmlHttp.readyState==4 && xmlHttp.status==200){\n\t\t\t \tif(callBack){\n\t\t\t\t \tcallBack(xmlHttp.responseText);\n\t\t\t \t}\n\t\t\t }\n\t\t};\n\t\txmlHttp.open(\"GET\",url + \"?dc=_\" + Math.random(),true);\n\t\t//xmlHttp.setRequestHeader(\"Access-Control-Allow-Origin\",\"*\");\n\t\txmlHttp.send();\n\t}", "function getFromLocal() {\n resetData();\n\n // Connect to internal server and get data from it\n $.ajax({\n\n // Get from the server the function 'listUsers' result.\n url: \"http://localhost:8080/\",\n type: \"GET\",\n\n // If the call to the function \"get\" from the URl is succeful, put the data from the local server\n success: function(server_response) {\n\n // If there is response from the server, put the server response into the parameter id 'data'\n if (server_response != \"\") {\n $(\"#data\").append(server_response);\n }\n\n // If there is not response from the server, put \"not OK\" into the parameter id 'data'\n else {\n alert('Not OK');\n }\n }\n });\n}", "function grab_data(data){\n try {\n if (http_req.readyState === XMLHttpRequest.DONE) {\n if (http_req.status === 200) {\n // parse responseText\n db_verguenza = JSON.parse(http_req.responseText)\n } else {\n console.log(\"status problem\");\n }\n }\n } catch (e) {\n console.log(\"Ups! Something's wrong D:\\n\" +e);\n }\n // display data after getting it\n display_data();\n}", "function getData() {\n\t\t\tvar deferred = $.Deferred();\n\t\t\t// get RPC results\n\t\t\tRactiveRPC.tab2dataAsync({\n\t\t\t\tonsuccess: function(results) {\n\t\t\t\t\tdeferred.resolve(results);\n\t\t\t\t},\n\t\t\t\tonerror: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\tontimeout: function(error) {\n\t\t\t\t\tdeferred.reject(error);\t\n\t\t\t\t},\n\t\t\t\ttimeout: 2000,\n\t\t\t\tparams: [1,2]\n\t\t\t});\t\n\t\t\t\n\t\t\treturn deferred.promise();\n\t\t}", "function requestData(){\n\tloadJSON(\"https://dweet.io/get/dweets/for/money-tracker\", gotData);\n}", "function getData (){\n var carData = JSON.parse(this.responseText).cars;\n carInfo(carData);\n }", "function testGet(sender) {\n return http.get({\n // host: 'jsonplaceholder.typicode.com',\n // path: '/posts'\n\t \n\t host: 'api.myjson.com',\n path: '/bins/2gmu8'\n },\n\n function(response) {\n // Continuously update stream with data\n var body = '';\n response.on('data', function(d) {\n body += d;\n });\n \n response.on('end', function() {\n\t\t//console.log(body[0].fName)\n\t\tconsole.log(body)\n\t\t//console.log(body.no)\n\t\tget_object = JSON.stringify(body)\n\t\t//var print = body[0].fName // ERROR : undifined \n\t\tvar print = body.fName\n\t\tconsole.log(print)\n\t\tsendTextMessage(sender, get_object)\n\t\tsendTextMessage(sender, body)\n\t\t//sendTextMessage(sender, print) ERROR : Invalid data\n // Data reception is done, do whatever with it!\n var parsed = JSON.parse(body);\n \n });\n \n });\n}", "function receiveData(){\n return $http.get('/download');\n }", "function rawData() {\n if(request.readyState == 4 && request.status == 200) {\n const data = JSON.parse(request.responseText);\n resolve(data);\n } else if(request.readyState == 4) {\n reject(\"Data error: Unable to fetch data\");\n }\n }", "function request()\n\t{\n\t\tvar xhttp = new XMLHttpRequest();\n\t\txhttp.onreadystatechange = function() {\n\t\t if (this.readyState == 4 && this.status == 200)\n\t\t {\n\t\t \tvar data = JSON.parse(this.responseText);\n\t\t \tdata = sortData(data);\n\t\t \tfor (let i = 0; i < data.length; i++)\n\t\t \t{\n\t\t\t \tlet name = data[i].title;\n\t\t\t \tlet channelUrl = \"https://www.youtube.com/channel/\" +\n\t\t\t \t\t\t\t\t data[i].userId;\n\t\t\t \tlet imgUrl = data[i].avatar;\n\t\t\t \tlet subCount = formatSubCount(data[i].subCount);\n\t\t\t \tcreateEntry(name, channelUrl, imgUrl, subCount);\n\t\t \t}\n\n\t\t \t// hiding loader and displaying the result\n\t\t \tvar loader = document.getElementById(\"loading\");\n\t\t \tloader.parentElement.removeChild(loader);\n\t\t \tvar entries = document.getElementById(\"entries\");\n\t\t \tentries.hidden = false;\n\t\t }\n\t\t};\n\t\txhttp.open(\"GET\", \"server.php\", true);\n\t\txhttp.setRequestHeader(\"Content-Type\",\n\t\t\t\"application/x-www-form-urlencoded\");\n\t\txhttp.send();\n\t}", "function retrieveUniData(request,response)\n{\n\t//set response header\n var headers = {};\n headers[\"Access-Control-Allow-Origin\"] = \"*\"; //for cross enviroment request\n headers[\"Access-Control-Allow-Methods\"] = \"POST, GET, PUT, DELETE, OPTIONS\";//methods allowed to responce\n headers[\"Access-Control-Allow-Credentials\"] = false;\n headers[\"Access-Control-Max-Age\"] = \"86400\"; // 24 hours\n headers[\"Access-Control-Allow-Headers\"] = \"X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept\"; //type of headers\n //answer\n headers[\"Content-Type\"] = \"application/JSON\";//format response\n\tif(typeof request.query.uni != \"undefined\")\n\t{\n\t\tdata.getUni(request.query.uni, function(data)\n\t\t\t\t{\n\t\t\t\t\tif(data.error === \"error\")\n\t\t\t\t\t\tresponse.writeHead(500, headers);\n\t\t\t\t\telse\n\t\t\t\t\t\tresponse.writeHead(200, headers);\n\t\t\t\t\tresponse.end(JSON.stringify(data));\n\t\t\t\t});\n\t}\n\telse\n\t{\n\t\tresponse.writeHead(406, headers);\n\t\tresponse.end(JSON.stringify({}));\n\t}\n}", "function getInstanceData()\r\n {\r\n return $http({\r\n method: 'GET',\r\n url:\"base/data/instance.json\",\r\n headers: {'Content-Type': 'application/x-www-form-urlencoded'}\r\n })\r\n .then(function(response) {\r\n\r\n return response.data;\r\n })\r\n .catch(function(error) {\r\n\r\n throw error;\r\n });\r\n }", "function getData () {\n return requestService.getTop()\n .then(response => {\n return parser.parseBody(response);\n })\n}", "function getServerData(data){\n kas_eina=data.kas_eina;\n kur_piesti_x_ir_o[0]=data.xo0;\n kur_piesti_x_ir_o[1]=data.xo1;\n kur_piesti_x_ir_o[2]=data.xo2;\n kur_piesti_x_ir_o[3]=data.xo3;\n kur_piesti_x_ir_o[4]=data.xo4;\n kur_piesti_x_ir_o[5]=data.xo5;\n kur_piesti_x_ir_o[6]=data.xo6;\n kur_piesti_x_ir_o[7]=data.xo7;\n kur_piesti_x_ir_o[8]=data.xo8;\n turn_text_color=data.turn_text_color;\n end_card_text_size=data.end_card_text_size;\n turn_count=data.turn_count;\n which_player=data.which_player;\n end_rezult=data.end_rezult;\n thetimeleft=data.thetimeleft;\n}", "getDatas() {\n return JSON.parse(this.getBody()).result;\n }", "getData () {\n }", "function GetData() {\n\tif (socket.readyState = 1) {\n\t\tsocket.send(\"GetData?Page=Example2\");\n\t}\n}", "function getApiData(req,res){\r\n res.send(projectData);// send the response that was stored on our dataArray\r\n}", "function doGet()\n{\n return getParsedDataDisplay();\n}", "function get_engine_data(input, callback){\n\tconst options = {\n\t url: \"http://ec2-35-163-184-27.us-west-2.compute.amazonaws.com:8080/Engine/new\",\n\t method: 'POST',\n\t headers: {\n\t\t 'Accept': 'application/json',\n\t\t 'Accept-Charset': 'utf-8',\n\t\t 'User-Agent': 'SJA-Engine'\n\t\t },\n\t body: JSON.stringify(input)\n\t};\n setting = request(options, (error, res, body) =>{\n \t//Wait for the respond from j-easy engine\n\t\tif(error){\n\t\t\tconsole.error(error);\n\t\t\treturn;\n\t\t}\n\t\t//setting = body;\n\t \tcallback(body);\n\t\t//console.log(\"==Repond content:\\n\" + setting);\n \t});\n\n}", "function getData() {\r\n\tvar apiURL = HAM.config.apiBaseURL + \r\n\t\t\t\"/object?apikey=\" + HAM.config.apiKey + \r\n\t\t\t\"&s=random&color=any&size=1&q=dimensions:*&fields=title,people,culture,dated,dimensions,colors,imagepermissionlevel,primaryimageurl\";\r\n\r\n\tvar xmlrequest = new XMLHttpRequest();\r\n\r\n\txmlrequest.onreadystatechange = function() {\r\n\t\tif (this.readyState == 4) {\r\n\t\t\tif (this.status == 200) {\r\n\t\t\t\tcurrent = JSON.parse(this.responseText);\r\n\t\t\t\tprocessData(current);\r\n\t\t\t} else {\r\n\t\t\t\tdone = true;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\t\t\r\n\txmlrequest.open(\"GET\", apiURL, true);\r\n\txmlrequest.send();\r\n\r\n\txmlrequest = null;\r\n\tapiURL = null;\r\n}", "function getData(type, cb) {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n cb(JSON.parse(this.responseText));\n }\n };\n\n xhr.open(\"GET\", baseURL + type + \"&app_id=\" + API_APP + \"&app_key=\" + API_KEY + \"&to=24\");\n xhr.send();\n}", "function getData(){\r\n url = URL_COMMON + \"/current_config/\";\r\n fetch(url).then( response => response.json())\r\n .then( data => {\r\n console.log(data);\r\n appendData(data);\r\n })\r\n .catch( err => {\r\n console.log('error: ' + err);\r\n });\r\n\r\n}", "function myData() {\n retrun;\n}", "function getResponseData() {\n\tconnection.query('SELECT * FROM departments', function(err, res) {\n\t\tif (err) throw err;\n\t\texecutiveInputs(res);\n\t})\n}", "function getData(){\t\r\nvar data;\r\nvar jsonurl = './tnow.json';\r\n$.ajax({\r\n\ttype: \"GET\",\r\n\turl: jsonurl,\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Daten-Stream url\r\n\tdata: data,\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Variable für json Container\r\n\tasync: true,\t\t\t\t\t\t\r\n\tdataType: \"json\",\r\n\tsuccess: function(data){\t\t\t\t\t\t\t\t\t\t// nur ausführen wenn getJson (hier ajax) erfolgreich war sonst zu error:\t\r\n\tlogger('get ./tnow.json');\r\n\tcelsius = data.temperature_record;\r\n\tgrenze();\r\n\t},\r\n\t//error: function(){alert('Der Server antwortet nicht!'); schalter = \"error\";}\r\n\t});\t\r\n}", "function getData(req, res, next) {\n res.send(req.data);\n}", "function getLobbyData(){}", "function getData(type){\n url=\"./scripts/store_data.php\";\n callback = \"getdata\";\n parameters = \"filename=\"+document.getElementById(\"filename\").value;\n parameters += \"&access_token=\"+document.getElementById(\"token\").value;\n \n if(type==\"post\"){\n // Get all the parameters\n parameters += \"&type=post&url=\"+document.getElementById(\"post_url\").value;\n parameters += \"&parameters=\"+document.getElementById(\"post_parameters\").value;\n } else if(type==\"get\"){\n // Get all the parameters\n parameters += \"&type=get&url=\"+document.getElementById(\"get_url\").value;\n } else {\n alert(\"Error\");\n }\n \n // Send the request to the server script\n connectPOST(url,parameters,callback);\n \n return false;\n}", "function get_data(){\r\n\t\tvar xhr = new XMLHttpRequest();\r\n\t\txhr.open('GET', 'http://localhost:5001/list', true);\r\n\t\txhr.send(null);\r\n\r\n\t\txhr.onreadystatechange = function() {\r\n\t\t\tif (xhr.readyState == 4 && xhr.status == 200) {\r\n\t\t\t\tmakeTable(xhr.responseText);\r\n\t\t\t\t$(\".table > tbody > tr\").attr(\"style\", \"cursor: pointer\");\r\n\t\t\t\t$(\".table > tbody > tr\").click(function() {\r\n\t\t\t\t\tvar hash = $(this).find('td:first').text();\r\n\t\t\t\t\tmake_details_window(hash);\r\n\t\t\t\t});\t\t\t\r\n\t\t\t}\r\n\t\t\telse if (xhr.status != 200) {\t\r\n\t\t\t\tdocument.write(\"GET request for JSON data failed!\");\r\n\t\t\t\tdocument.close();\r\n\t\t\t}\r\n\t\t};\r\n\t}", "getdata() {\n return Observable.create((observer) => {\n socket.on('res', (data) => {\n observer.next(data);\n });\n });\n }", "async function retreiveData() {\n data = await getPost();\n }", "function loadData(){\n // Request Endpoint\n var endpoint = '/network/'+network_id;\n // Use .ajax() to make an HTTP request from JS\n $.ajax({\n type: 'GET',\n url: endpoint,\n dataType: \"json\",\n success: function(response_data) {\n // Called when successful\n //console.log(\"Network Info\");\n //console.log(data);\n parseNetworkData( response_data );\n },\n error: function(e) {\n // Called when there is an error\n console.log(e.message);\n }\n });\n}", "function getData(url, range) { \r\n\t\t\r\n\t\t\tif (url !== \"\") { \r\n\r\n\t\t\t\tvar xhr = new XMLHttpRequest(); // Set up xhr request \r\n\t\t\t\txhr.open(\"GET\", url, true); // Open the request \r\n\t\t\t\txhr.responseType = \"text\"; // Set the type of response expected \r\n\r\n\r\n\t\t\t\t// If there's a range set, create a request header to limit to that range \r\n\r\n\t\t\t\tif (range !== undefined && range !== null && range.length > 0) \r\n\t\t\t\t{ \r\n\t\t\t\t\txhr.setRequestHeader(\"Range\", \"bytes=0-100000000000\");\r\n\t\t\t\t} \r\n\t\t\t\txhr.send(); \t\t\t// Asynchronously wait for the data to return \r\n\t\t\t\txhr.onreadystatechange = function () \r\n\t\t\t\t{ \r\n\t\t\t\t\t\tif (xhr.readyState == xhr.DONE)\r\n\r\n\t\t\t\t\t\t{ \r\n\t\t\t\t\t\t\t//reponse ajax\r\n\t\t\t\t\t\t\tvar tempoutput = xhr.response; \r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\ttraitementReponse(tempoutput);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t} \r\n\t\t\t\t} // Report errors if they happen \r\n\t\t\t\txhr.addEventListener(\"error\", function (e) \r\n\t\t\t\t\t{ \r\n\t\t\t\t\t\tconsole(\"Error: \" + e + \" Could not load url.\"); \r\n\t\t\t\t\t}, false); \r\n\t\t\t\t} \r\n\t\t}", "async function gettingData() {\n let response = await fetch(url);\n let data = await response.json();\n console.log(data);\n }", "function getData(data) {\n return data;\n}", "function senGuiData()\n{\n\tvar datasend={\n\t\tevent:\"guidata\"\n\t}\n\tqueryDataGet(\"php/api_process.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(res);\n\t});\n\tqueryDataPost(\"php/api_process_post.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(\"Post:\"+res);\n\t});\n}", "async getDataFromServer()\n {\n throw Error(\"Cannot call this function from a base class\");\n }", "function gotData(data){\n console.log(data);\n}", "function getExData(name,sDate,eDate)\n{\n\tvar xhttp = new XMLHttpRequest();\n xhttp.onload = function() {\n\t\tif (this.readyState == 4 && this.status == 200) {\n\n\t\t\t//the list of names from the http request\n\t\t\tvar res = this.responseText;\n\t\t\t//alert(res);\n\t\t\tupdate_graphs(res);\n\t\t\tdocument.getElementById(\"loader_his\").style.display = \"none\";\n\t\t\tdocument.getElementById(\"loader_ste\").style.display = \"none\";\n\t\t\tdocument.getElementById(\"loader_tre\").style.display = \"none\";\n\t\t\treturn res;\n\n\t\t\t\t//document.getElementById(\"loader\").style.display = \"none\";\t\n\t\t}\n\t\telse\t\n\t\t{\n\t\t\t//alert(\"request status not returned yet\");\n\t\t\t//alert(this.status);\n\t\t\t//alert(this.readyState);\n\t\t}\n };\n\n\t//replace spaces with + in http query parameters\n\tmod_name = name.replace(' ','+');\n\n\t//configure http request\n\tvar url = \"/exercise_data?name=\"+mod_name+\"&sDate=\"+sDate+\"&eDate=\"+eDate;\n\t//alert(url);\n\n xhttp.open('GET', url, true/*asynchronous*/);\n //xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n\t//send http request with post data as string\n xhttp.send(url);\n}", "function get_from_server(url, callback) {\n var request = kiwiServer.request(\"GET\", url , {\"host\": SERVER_ADDR});\n var result= \"\";\n request.addListener('response', function (response) {\n response.setBodyEncoding(\"utf8\");\n response.addListener(\"data\", function (chunk) {\n result += chunk;\n });\n response.addListener(\"end\", function (chunk) {\n callback(null, result, response);\n });\n });\n request.close();\n}", "async function getData(){\n\tlet full = baseURL+city.value+apiKey;\n\tconst request = await fetch(full);\n\ttry{\n\t\tconst gotData = await request.json();\t\t\n\t\treturn gotData;\n\t}\n\tcatch(error){\n\t\tconsole.log('error' + error)\n\t}\n}", "function loadData() {\n var jsonRovereto = httpGet(\"https://os.smartcommunitylab.it/core.mobility/bikesharing/rovereto\");\n dataRovereto = JSON.parse(jsonRovereto);\n var jsonPergine = httpGet(\"https://os.smartcommunitylab.it/core.mobility/bikesharing/pergine_valsugana\");\n dataPergine = JSON.parse(jsonPergine);\n var jsonTrento = httpGet(\"https://os.smartcommunitylab.it/core.mobility/bikesharing/trento\");\n dataTrento = JSON.parse(jsonTrento);\n //console.log(dataTrento);\n}", "async getServerData() {\n return await fetch(API + '/v1/servers')\n .then((response) => response.json())\n .then((data) => {\n return data.data[0];\n });\n }", "async function getWeatherDataFromServer () {\n const response = await fetch('/WeatherDataFromDb')\n const responseJSON = await response.json()\n console.log('The compleate weather data from server is: ', responseJSON)\n return responseJSON\n }", "_request( url){\r\n\t\treturn fetch( url)\t//response = what we get from fetch = json with server response \r\n\t\t\t.then( ( response) => {\r\n\t\t\t\tif( response.status !== 200) {\r\n\t\t\t\t\tconsole.log('Request returned with code: ' + response.status);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\treturn response.json().then( ( data) => {\r\n\t\t\t\t\treturn data;\r\n\t\t\t\t});\r\n\t\t\t}).catch(( err) => {\r\n\t\t\t\tconsole.log('Fetch Error :-S', err);\r\n\t\t\t});\r\n\t}", "function getData() {\n $.ajax({\n url: `https://xn--pss23c41retm.tw/api/item/reservation`,\n type: \"GET\",\n success: function (result) {\n console.log(result);\n render(result);\n },\n error: function (error) {\n console.log(\"error:\", error);\n $(`#itemrecord`).html(`<h4 class=\"red-text text-darken-2\">伺服器發生錯誤,請稍後再試</h4>`);\n }\n });\n }", "static dataGET() {\n return new Promise(\n async (resolve) => {\n try {\n resolve(Service.successResponse(''));\n } catch (e) {\n resolve(Service.rejectResponse(\n e.message || 'Invalid input',\n e.status || 405,\n ));\n }\n },\n );\n }", "function getData(req, res) {\n res.send(projectData);\n}", "function getFromLocalFile() {\n resetData();\n\n // Connect to internal server and get data from it\n $.ajax({\n\n // Get from the server the function 'listUsers' result.\n url: \"http://localhost:8080/listUsers\",\n type: \"GET\",\n\n // If the call to the function \"get\" from the URl is succeful, put the data from the local server\n success: function(server_response) {\n\n // If there is response from the server, put the server response into the parameter id 'data'\n if (server_response != \"\") {\n $(\"#data\").append(server_response);\n }\n\n // If there is not response from the server, put \"not OK\" into the parameter id 'data'\n else {\n alert('Not OK');\n }\n }\n });\n}", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\t\t\tupdateCallback(newData);\n\t\t}", "function getData(data) {\n return data;\n}", "function getData(query) {\n\t//divAdd(query);\n showLoadDiv('UDBrain ');\n\n\tGM_xmlhttpRequest({\n\t\tmethod: 'GET',\n\t\turl: 'http://udbrains.kimihia.org.nz:50609/udb?'+query,\n\t\tonload: function(xhr) {\n\t\t\tremoveLoadDiv();\n\n\t\t\t//divAdd(xhr.responseText);\n\t\t\tif(xhr.responseText.match(/Error:/))\n\t\t\t\talert(xhr.responseText);\n\n\t\t\tvar arr = xhr.responseText.split('|');\n\t\t\tfor(var i=1; i < arr.length; i++) {\n\t\t\t\tinsertData(arr[i] +':-1:-1:-1:-1');\n\t\t\t}\n\t\t}\n\t});\n}", "function ReceiveData()\n{\n\tlet receiveCarData = {};\n\treceiveCarData['fromGUI'] = \"yeppers\";\n\treceiveCarData['carID'] = $carID;\n\n\tAjaxRequest('./webservice.php', 'POST', receiveCarData, 'json', UpdateSelfData, Fail);\n\n\tlet fetchSentData = {};\n\tfetchSentData['action'] = \"GetCarDrives\";\n\tfetchSentData['fromGUI'] = \"yeppers\";\n\tfetchSentData['carID'] = $carID;\n\n\tAjaxRequest('./webservice.php', 'POST', fetchSentData, 'json', UpdateCarData, Fail);\n}", "function getData(callback) {\r\n $.ajax({\r\n type: \"get\",\r\n url: \"/core/dataparser.py\",\r\n dataType: \"json\",\r\n success: callback,\r\n error: function(request, status, error) {\r\n alert(status);\r\n }\r\n });\r\n}", "function getData(query, callBack) {\n \n // creating ajax request\n var xhtr = new XMLHttpRequest();\n xhtr.onreadystatechange = function () {\n if (this.readyState === 4 && this.status === 200) {\n var result = JSON.parse(this.responseText);\n // call to callback function which is passed to getData function\n callBack(result);\n }\n }\n\n xhtr.open('GET', 'http://localhost:3333/api/' + query, true);\n xhtr.send(); \n }", "function getData() {\n\t\t// Set data values\n\t\t$(\"label\").html(\"Auto Refresh <span class='subtle'>- every \" + REFRESH_RATE/1000 + \" seconds</span>\");\n\t\treturn $.getJSON(SEPTA_URL, dataOptions, displayData);\n\t}", "function fetchData() {\n queryType=document.querySelector('#queryType').value;\n itemID=document.querySelector('#itemID').value;\n getFromSWAPI(queryType, itemID)\n}", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\n\t\t\t// I'm calling updateCallback to tell it I've got new data for it to munch on.\n\t\t\tupdateCallback(newData);\n\t\t}", "function retriveData() {\r\n jqueryNoConflict.getJSON(dataSource, renderLocationScreen);\r\n }", "function getFromExternal() {\n resetData();\n\n // Connect to external server and get data from it\n $.ajax({\n url: \"https://reststop.randomhouse.com/resources/authors/3446/\",\n type: \"GET\",\n\n // If the call to the function \"get\" from the URl is succeful, put the data from the server\n success: function(server_response) {\n\n // If there is response from the server, put the server response into the parameter id 'data'\n if (server_response != \"\") {\n $(\"#data\").append($(server_response.children[0].innerHTML).text());\n }\n\n // If there is not response from the server, put \"not OK\" into the parameter id 'data'\n else {\n alert('Not OK');\n }\n }\n });\n}", "function makeDataRequest(){ \n\tDatahttpRequest = new XMLHttpRequest(); \n\tDatahttpRequest.onreadystatechange = Datacallback; \n\tDatahttpRequest.open('GET', 'http://192.168.1.1/cgi-bin/TrackerV1Codes/GPSAltData.py');\n\tDatahttpRequest.send(); \n}", "function RequestLoadGeneralData() {\n\n}", "function getHistoricalRecCount() {\n\n\tdojo\n\t\t\t.xhrGet({\n\t\t\t\t// The following URL must match the destination\n\t\t\t\t// url:\n\t\t\t\t// \"http://webcomponentdemo13.alpha.vmforce.com/getHistoricalRecCount\",\n\t\t\t\t// url :\n\t\t\t\t// \"http://localhost:28093/webcomponent/getHistoricalRecCount\",\n\t\t\t\turl : \"http://localhost:28093/webcomponent/getHistoricalRecCount\",\n\t\t\t\t//url : \"http://mdmoncloud.alpha.vmforce.com/getHistoricalRecCount\",\n\t\t\t\thandleAs : \"text\",\n\t\t\t\ttimeout : 5000, // Time in milliseconds\n\n\t\t\t\t// The LOAD function will be called on a successful response.\n\t\t\t\tload : function(response, ioArgs) { //\n\t\t\t\t\tserverResponse = response;\n\t\t\t\t\t// alert(\"serverResponse \"+serverResponse);\n\t\t\t\t\tstatArray = serverResponse.split(\"|\");\n\t\t\t\t\t// alert(\"statArray \"+statArray);\n\t\t\t\t\tnumberOfRecPropcessed1 = statArray[0];\n\t\t\t\t\tnumberOfRecPropcessed2 = statArray[1];\n\t\t\t\t\tnumberOfRecPropcessed3 = statArray[2];\n\t\t\t\t\tnumberOfRecPropcessed4 = statArray[3];\n\t\t\t\t\treturn response; // \n\t\t\t\t},\n\n\t\t\t\t// The ERROR function will be called in an error case.\n\t\t\t\terror : function(response, ioArgs) { // \n\t\t\t\t\tconsole.error(\"HTTP status code: \", ioArgs.xhr.status); //\n\t\t\t\t\tdojo.byId(\"replace\").innerHTML = 'Loading the ressource from the server has failed'; // \n\t\t\t\t\treturn response; // \n\t\t\t\t},\n\n\t\t\t\t// Here you put the parameters to the server side program\n\t\t\t\t// We send two hard-coded parameters\n\t\t\t\tcontent : {\n\t\t\t\t\tname : \"lars\",\n\t\t\t\t\turl : \"testing\"\n\t\t\t\t}\n\t\t\t});\n\n}", "function retrieveData(){\ntrainsDatabase.on(\"value\", getData, error); \n}", "static async getRawProductData(req, res) {\n const { redis } = init()\n const data = await redis.get(\"raw_product_data\")\n\n res.setHeader(\"Access-Control-Allow-Origin\", \"*\")\n res.json({\n status: 200,\n data: JSON.parse(data),\n })\n }", "function httpData(r, type) {\r\n\r\n //get the content-type header;\r\n\tvar ct = r.getResponseHeader(\"content-type\");\r\n\r\n\t//if no default type was provided determine if some form of xml was returned from the server;\r\n\tvar data = !type && ct && ct.indexOf(\"xml\") >= 0;\r\n\r\n\t//get the xml document object if xml was returned from the server, otherwise return the text contents;\r\n\tdata = type == \"xml\" || data ? r.responseXML : r.responseText;\r\n\r\n\t//if the specified type is \"script\", execute the returned text response as if it were javascript;\r\n\tif (type == \"script\") {\r\n\t eval.call(window, data);\r\n\t}\r\n\r\n\t//return the response data (either an xml document or a text string);\r\n\treturn data;\r\n }", "function getData() {\n animate();\n \n var url = window.API.getAPIUrl(\"comps\");\n \n //url += \"?env=development\"; //When needed the development branch, for lab.fermat.org\n\n window.API.getCompsUser(function (list){ \n\n window.loadMap(function() {\n\n window.tileManager.JsonTile(function() {\n\n window.preLoad(function() {\n\n window.tileManager.fillTable(list);\n TWEEN.removeAll();\n window.logo.stopFade();\n window.helper.hide('welcome', 1000, true);\n init();\n\n });\n });\n });\n });\n\n \n//Use when you don't want to connect to server\n/*setTimeout(function(){\n var l = JSON.parse(testData);\n \n window.preLoad(function() {\n \n window.tileManager.JsonTile(function() {\n \n window.loadMap(function() {\n tileManager.fillTable(l);\n\n TWEEN.removeAll();\n logo.stopFade();\n init();\n });\n })\n });\n\n }, 6000);*/\n}", "function getData() {\n animate();\n \n var url = window.API.getAPIUrl(\"comps\");\n \n //url += \"?env=development\"; //When needed the development branch, for lab.fermat.org\n\n window.API.getCompsUser(function (list){ \n\n window.loadMap(function() {\n\n window.tileManager.JsonTile(function() {\n\n window.preLoad(function() {\n\n window.tileManager.fillTable(list);\n TWEEN.removeAll();\n window.logo.stopFade();\n window.helper.hide('welcome', 1000, true);\n init();\n\n });\n });\n });\n });\n\n \n//Use when you don't want to connect to server\n/*setTimeout(function(){\n var l = JSON.parse(testData);\n \n window.preLoad(function() {\n \n window.tileManager.JsonTile(function() {\n \n window.loadMap(function() {\n tileManager.fillTable(l);\n\n TWEEN.removeAll();\n logo.stopFade();\n init();\n });\n })\n });\n\n }, 6000);*/\n}", "function GetDataForWijk(){\n var url = config.api.url + \"wijk?id=\" + $scope.wijkId;\n $http({\n url: url,\n method: 'GET'\n }).success(function(data, status, headers, config) {\n $scope.wijkName = data.wijk_naam; \n $scope.wijkTotal = data.aantal_huishoudens; \n $scope.wijkTarget = data.target; \n $scope.wijkDuration = data.actie_duur_dagen; \n console.log(\"WijkData load succesfull\");\n }).error(function(data, status, headers, config) {\n console.log(\"WijkData load failed\");\n });\n }", "function getData () {\n $.get(\"/get-articles\", function(data, status){\n return recievedData = JSON.parse(data);\n });\n}", "function GetData()\n{\n var http = new XMLHttpRequest()\n http.open(\"GET\",\"http://localhost:3002/getdata\", true)\n\n http.onreadystatechange = function () {\n if (http.readyState == 4 && http.status == 200)\n {\n console.log(\"Response received\")\n var xml = (new DOMParser()).parseFromString(http.response,'text/html')\n var temp = xml.getElementsByTagName(\"San_Pham\");\n var cafe = [];tea = [];frap=[];creme=[];\n for(var i = 0;i<temp.length;i++)\n { \n switch (temp[i].getElementsByTagName(\"Loai_SP\")[0].getAttribute(\"Ma_Loai\"))\n {\n case \"CAFE\":\n cafe.push(temp[i]);\n break;\n case \"TEA\":\n tea.push(temp[i]);\n break;\n case \"FRAPBLENDED\":\n frap.push(temp[i]);\n break;\n case \"FRAPCREAM\":\n creme.push(temp[i]);\n break;\n }\n }\n data.push(cafe);\n data.push(tea);\n data.push(frap);\n data.push(creme);\n loadAll(data);\n }\n else\n if (http.status == 404)\n {\n console.log(\"Can't read file from server\")\n }\n }\n\n http.send()\n}", "function GetAllDefectiveDamaged() {\n try {\n \n var data = {};\n var ds = {};\n ds = GetDataFromServer(\"DefectiveorDamaged/GetAllDefectiveDamaged/\", data);\n \n if (ds != '') {\n ds = JSON.parse(ds);\n }\n if (ds.Result == \"OK\") {\n \n return ds.Records;\n }\n if (ds.Result == \"ERROR\") {\n alert(ds.Message);\n }\n }\n catch (e) {\n notyAlert('error', e.message);\n }\n}", "getData() {\n \n}", "function getdata() {\n\n var url = `/data`;\n\n d3.json(url).then(function(xx) {\n\n data = []\n // xx.slice(s, e)\n globaldata = xx;\n unfiltered = xx;\n actual = [], minute = []\n \n makedata();\n})\n}", "function getReq() {\n\txmlhttp=GetXmlHttpObject();\n\n if (xmlhttp==null){\n \t\talert (\"Your browser does not support Ajax HTTP\");\n \t\treturn;\n \t}\n var url = \"/gmplaces/getdata\";\n xmlhttp.open(\"GET\", url, true);\n xmlhttp.onreadystatechange = function() {\n \t\tif (xmlhttp.readyState == 4) {\n \t\tif(xmlhttp.status == 200) {\n \t\t\tparseRequest();\n \t}\n \t\t}\n\t};\n xmlhttp.send(null);\n}", "function GetEmployeeDataServer()\n{\n makeServiceCall(\"GET\", site_properties.server_url, true)\n .then(responseText => {\n employeePayrollList = JSON.parse(responseText);\n ProcessResponse();\n })\n .catch(error => {\n console.log(\"GET Error Status: \" + JSON.stringify(error));\n employeePayrollList = [];\n ProcessResponse();\n });\n}", "function sendInfo(){\n\t\tvar xHttp = new XMLHttpRequest();\n\n\t\txHttp.onreadystatechange = function(){\n\t\t\tif(this.readyState == 4 && this.status == 200 ){\n\t\t\t\tdocument.getElementById('demo3').innerHTML = this.response;\n\t\t\t\tconsole.log(xHttp.statusText);\n\t\t\t}\n\t\t};\n\n\t\txHttp.open('GET','storeData.html?fname=soni&lname=saw',true);\n\n\t\txHttp.send();\n\t}" ]
[ "0.7574397", "0.73690146", "0.70125574", "0.69753534", "0.6917842", "0.68787664", "0.67791325", "0.6740077", "0.67112106", "0.6692892", "0.6654997", "0.6628924", "0.6593224", "0.6525021", "0.6505014", "0.648939", "0.6486086", "0.6475663", "0.6474108", "0.6449944", "0.644685", "0.6445371", "0.6442211", "0.6427087", "0.6392221", "0.6380444", "0.6358515", "0.6349907", "0.6332586", "0.63285536", "0.6328492", "0.63159966", "0.62962353", "0.6283667", "0.6275022", "0.6270186", "0.6269898", "0.6268555", "0.6267408", "0.62669665", "0.6266579", "0.62455446", "0.6242833", "0.6235515", "0.6233587", "0.62308556", "0.6227879", "0.6225626", "0.6217294", "0.62162715", "0.6211686", "0.62095445", "0.6200542", "0.61994314", "0.61966544", "0.61956954", "0.6186964", "0.6183813", "0.61802936", "0.61746454", "0.6174146", "0.6170889", "0.61552554", "0.6155013", "0.61541116", "0.6152256", "0.6144015", "0.6121604", "0.6120759", "0.6112432", "0.61114395", "0.6106809", "0.61057484", "0.6103047", "0.6100729", "0.6099805", "0.6099616", "0.60987973", "0.609733", "0.6096295", "0.6094734", "0.6092769", "0.6083144", "0.6072539", "0.607121", "0.60652274", "0.6064972", "0.60626423", "0.605681", "0.6055611", "0.6050055", "0.6050055", "0.6048176", "0.6032944", "0.60315686", "0.603148", "0.6027385", "0.6026966", "0.6024381", "0.6024187", "0.6022271" ]
0.0
-1
Function to reset the stopwatch
function reset() { clearInterval(interval); ms = s = m = h = 0; document.getElementById("display").innerHTML = "00:00:00:00"; document.getElementById("startStop").innerHTML = "Start"; document.getElementById('lapText').innerHTML = ""; status = "stopped"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stopwatchReset() {\r\n if (stopwatchStatus === 'started' || stopwatchStatus === 'paused') {\r\n window.clearInterval(interval)\r\n seconds = 0\r\n minutes = 0\r\n hours = 0\r\n\r\n document.querySelector('#counter').innerHTML = '00:00:00'\r\n stopwatchStatus = 'paused'\r\n }\r\n}", "function stopwatchReset(){\n event.preventDefault()\n console.log('reset!')\n\n stopwatchRunning = false\n clearInterval(intervalId) \n stopwatchTime.innerHTML = formatTime(0)\n\n // deletes the lapList array items\n laps.length = 0\n \n // clears the lap list\n lapList.innerHTML = \"\"\n}", "function Stopwatch() {\n this.reset();\n}", "function resetTimer() {\r\n \r\n if(!timerControl) {\r\n initTime = 0;\r\n stopTime = 0;\r\n totalPassedTime = 0;\r\n lapInitialTimer = 0;\r\n stopwatch.innerText = formatTimer(totalPassedTime);\r\n resetLapsHistory();\r\n \r\n // clear local storage\r\n localStorage.clear();\r\n }\r\n}", "function reset() {\n stop();\n pauseTimePassed = 0;\n functionsToCallOnReset.forEach(f => f());\n }", "reset() {\n this.stop();\n $(this._timerElemjQuery).text(\"00\");\n this._start = null;\n this._duration = 0;\n }", "reset() {\n this.stop();\n $(this._timerElemjQuery).text(\"00\");\n this._start = null;\n this._duration = 0;\n }", "function resetTimer() {\n stepCount = 0;\n startTime = (new Date()).getTime();\n}", "function resetTimers() {\n startTime = new Date;\n startTime.setHours(0);\n startTime.setMinutes(0);\n startTime.setSeconds(0);\n startTime.setMilliseconds(0);\n \n stopTime = new Date;\n stopTime.setHours(config.timer.hour);\n stopTime.setMinutes(config.timer.minute);\n stopTime.setSeconds(0);\n stopTime.setMilliseconds(0);\n }", "function reset()\r\n{\r\n hours = 0, minutes = 0, seconds = 0, milliseconds = 0;\r\n hrs.innerHTML = hours;\r\n mins.innerHTML = minutes;\r\n secs.innerHTML = seconds;\r\n millisecs.innerHTML = milliseconds;\r\n stop();\r\n}", "function reset() {\n clearInterval(interval);\n able_start_button();\n able_stop_button();\n $.post(\n '/server/index.php',\n { action : 'timer_reset' }\n );\n sedonds = 0;\n ss.html('00');\n mm.html('00');\n hh.html('00');\n }", "function resetTimer() {\n\tstopTimer();\n\ttimeStart = true;\n\ttime = 0;\n\tdisplayTimer();\n}", "function reset(){\n clearTimeout(stopper);\n stopper = setInterval(timer, 10000);\n }", "function resetTime () {\nstopClock();\ntimerOff = true;\ntime = 0;\ncountTime();\n}", "function stopwatchReset(event) {\r\n clearInterval(intervalId);\r\n stopwatchTime.innerHTML = formatTime(\"0\");\r\n lapList.innerHTML = \"\";\r\n while (laps.length > 0) {\r\n laps.pop();\r\n }\r\n}", "function reset() {\n setSeconds(duration);\n setRunning(false);\n }", "function reset () {\n stopTimerAndResetCounters();\n setParamsAndStartTimer(currentParams);\n dispatchEvent('reset', eventData);\n }", "resetTimer() {\n this.timeSelected = 0;\n this.completeElapsed = 0;\n this.complete = false;\n }", "function Reset() {\n Set_Minutes(Reset_Val)\n Set_Seconds(0)\n}", "function reset(){\n\n window.clearInterval(interval);\n seconds = 0;\n minutes = 0;\n hours = 0;\n document.getElementById(\"display\").innerHTML = \"00:00:00\";\n document.getElementById(\"startStop\").innerHTML = \"Start\";\n\n}", "resetTimer() {\n // reset to initial state\n this.toggleButton.classList.remove(`running`);\n this.toggleButton.classList.remove(`paused`);\n this.toggleButton.classList.add(`initial-state`);\n\n // reset time variables\n this.startTime = 0;\n this.timeElapsed = 0;\n this.pausedTime = 0;\n this.unpausedTime = 0;\n this.pauseIncrement = 0;\n this.totalPausedTimeArray.length = 0;\n this.totalPausedTime = 0;\n this.seconds = 0;\n this.minutes = 0;\n\n // reset ui content\n this.toggleButton.textContent = `Start`;\n this.content = `0:00.00`;\n }", "function resetTimer(which) {\n if (typeof which !== \"undefined\") {\n if (which != 0) {\n which.pause();\n }\n which = 0;\n }\n}", "function resetClockAndTime() {\n stopTimer();\n clockOff = true;\n hour = 0;\n minutes = 0;\n seconds = 0;\n displayTime();\n}", "resetTimer() {\n clearInterval(this._timer);\n this._seconds = 0;\n this._setTimerContext();\n this.startTimer();\n }", "function resetTimer(){\n clearInterval(timerInterval);\n timerInterval = null;\n startButton.attr('disabled', false);\n minutes.text('00');\n seconds.text('08');\n itsTimeFor.text('Time to do some work!');\n }", "function resetTimer() {\r\n clearInterval(timer.clearTime);\r\n timer.seconds = 0;\r\n timer.minutes = 0;\r\n $(\".timer\").text(\"0:00\");\r\n\r\n timer.clearTime = setInterval(startTimer, 1000);\r\n}", "function resetTimer() {\n $(\"#timer\").html = '00:00';\n stoptime = true;\n sec = 0;\n min = 0;\n}", "function resetTimer(){\n clearInterval(tInterval);\n difference = 0;\n}", "function resetTimer() {\n app.second = 0;\n app.minute = 0;\n app.hour = 0;\n clearInterval(app.interval);\n app.timer.innerHTML = \"0:00\";\n}", "function resetTimer() {\r\n stopTimer();\r\n resetUI();\r\n timerTime = 0;\r\n seconds.innerText = '00';\r\n minutes.innerText = '00';\r\n}", "function resetIt() {\n clearInterval(timeInterval);\n clearInterval(timeIntervalBreak);\n timerLength = 25;\n breakLength = 5;\n msConvert = timerLength * 60000;\n msConvertBreak = breakLength * 60000;\n $(\".timer-length\").text(timerLength);\n $(\".break-length\").text(breakLength);\n $(\".countdown\").text(\"25:00\");\n $( \"#start-stop\" ).removeClass( \"stop\" ).addClass( \"start\" );\n $(\"#start-stop\").text(\"start\");\n $(\"#start-stop-cd\").removeClass(\"stop-countdown\");\n startStop = false;\n $(\".break-countdown\").hide();\n $(\".start-countdown\").show();\n $(\".minus2\").show();\n $(\".plus2\").show();\n }", "function resetTimer(){\n\n time = 31;\n }", "function resetTimer () {\n window.clearInterval(timerIntervalId);\n timerIntervalId = null;\n window.clearInterval(pageTitleIntervallId);\n pageTitleIntervallId = null;\n timerStartFinishTimestamp = null;\n timerPauseTimestamp = null;\n timeobject = {\n hours: '00',\n minutes: '00',\n seconds: '00',\n milliseconds: '00'\n };\n printTimedisplayFromTimestamp(0);\n startPauseButton.innerHTML = 'Start';\n if (getActiveMode() == 'countdown') {\n startPauseButton.setAttribute('onclick', 'startCountdown();');\n dialpad.classList.remove('hide');\n updatePageTitle('Countdown');\n } else if (getActiveMode() == 'stopwatch') {\n startPauseButton.setAttribute('onclick', 'startStopwatch();');\n lapContainer.classList.add('hide');\n updatePageTitle('Stopwatch');\n lapLog.innerHTML = \"\";\n };\n}", "reset() {\n this.timer = 500;\n this.interval = 0;\n }", "function resetTimer () {\n timerRunning = false;\n clearInterval(clockInterval);\n clearInterval(wpmInterval);\n}", "function resetTimer(){\r\n clearInterval(timeInterval);\r\n playBtn.style.display='block';\r\n pauseBtn.style.display='none';\r\n clear(timeFace, '00:00:00');\r\n elapsedTime = 0;\r\n}", "function reset() {\n Consts.stockTime = 0;\n Consts.currStatus = Status.stopped;\n clearInterval(incrementSecondMethod);\n $('#statusToggle').val('Start');\n}", "function reset() {\n\n window.clearInterval(interval);\n seconds =0;\n minutes =0;\n hours =0;\n document.getElementById(\"display\").innerHTML =\"00:00:00\"\n document.getElementById(\"startStop\").innerHTML = \"start\"\n\n}", "resetTimer(){\r\n this.timerRunning = false;\r\n this.remainingTime = 1500;\r\n TimerUI.updateTimeDisplay(this.remainingTime);\r\n }", "static reset() {\n updateTimeouts.forEach(clearTimeout);\n updateTimeouts = [];\n improvedTimestampsInitted = false;\n improvedTimestamps = [];\n }", "function resetTimer() {\n // set the time value for zero\n $timer.value = 0;\n // set the DOM text for a empty string\n $text.innerHTML = '';\n stopTimer();\n }", "function timerReset() {\n clearInterval(timercycle);\n minutes = seconds = 0;\n $(\".timer\").text(\"00:00\");\n timercycle = setInterval(timerUpdate, 1000);\n}", "reset() {\n\t\tthis.stop();\n\n\t\tthis.ticks = 0;\n\t\tthis.interval = 0;\n\t\tthis.node.innerText = \"00:00:00\";\n\t}", "function resetTimer(){\n currentTime = startingTime;\n \n \n if(statusStart){\n timerFunc(currentTime);\n }\n else{\n displayTimeFormat(currentTime);\n }\n}", "function reset() {\n breakLength = 5;\n sessionLength = 25;\n breakDuration.innerHTML = breakLength;\n sessionDuration.innerHTML = sessionLength;\n sessionTiming.innerHTML = sessionLength;\n if(isPaused == false) {\n document.getElementById(\"pauseBtn\").innerHTML = \"Pause\";\n isPaused = true;\n }\n clearInterval(x);\n x = false;\n}", "reset() {\n this.elapsedTime = 0;\n }", "reset() {\n this.timer = 5000;\n this.interval = 0;\n }", "function reset() {\n setSeconds(0);\n setIsActive(false);\n }", "function resetTimer() {\n\tclearTimeout(timer);\n\tdocument.querySelector('.timer').innerText = secondsElapsed;\n}", "function resetWatch(){\n drawWatch();\n countDown.value = countDown.default;\n timerCanvas.addEventListener('click', mainLoop, false);\n}", "function resetClockAndTime() {\n\tstopClock();\n\tclockOff = true;\n\ttime = 0;\n\tdisplayTime();\n}", "function resetButton() {\n if (status == \"started\" || status == \"stopped\") {\n window.clearInterval(interval)\n seconds = 0;\n minutes = 0;\n hours = 0;\n document.getElementById(\"display-time\").innerHTML = \"00:00:00\"\n status = \"stopped\"\n }\n}", "function clearStopwatchTimer() {\n if (updateTimeIntervalId !== null) {\n clearInterval(updateTimeIntervalId);\n updateTimeIntervalId = null;\n }\n}", "reset() {\n this.running = false;\n window.cancelAnimationFrame(this.frameReq);\n clearTimeout(this.timeout);\n this.els.seconds.textContent = this.duration / 1000;\n this.els.ticker.style.height = null;\n this.els.definition.textContent = ''; \n this.els.rhymes.textContent = ''; \n this.element.classList.remove('countdown--ended');\n }", "function reset() {\n time = 0;\n lap = 1;\n\n $(\"#display\").text(\"00:00\");\n}", "function reset () {\n clearInterval(INTERVAL)\n miliNum = 0\n secNum = 0\n minNum = 0\n milisec.innerHTML = '00'\n sec.innerHTML = '00'\n min.innerHTML = '00'\n button.innerHTML = \"START\"\n}", "function reset() {\n document.querySelector(\".infinity-type-area\").disabled = true;\n document.querySelector(\".start\").disabled = false;\n document.querySelector(\".start\").style.backgroundColor =\n \"var(--primary-color)\";\n document.querySelector(\".start\").style.cursor = \"pointer\";\n document.querySelector(\".infinity-type-area\").style.borderColor = \"#A1A1AA\";\n clearInterval(clocking);\n document.querySelector(\".infinity-min\").innerText = \"00\";\n document.querySelector(\".infinity-sec\").innerText = \"00\";\n min = 0;\n sec = 0;\n document.querySelector(\".infinity-type-area\").value = \"\";\n document.querySelector(\"#timer-wpm-inf\").innerText = \"0\";\n document.querySelector(\"#timer-cpm-inf\").innerText = \"0\";\n document.querySelector(\"#timer-accuracy-inf\").innerText = \"0\";\n document.querySelector(\".infinity-user-type\").innerText = samples[random];\n}", "function reset() {\n\nstart();\n\n}", "function resetTimer() {\n clearInterval(liveTimer);\n }", "function resetWatch() {\n resetDown();\n resetUp();\n}", "function reset() {\n if (currentTimer == \"Session\") {\n sessionSeconds = tempoarySessionSeconds;\n seconds_left = sessionSeconds;\n } else if (currentTimer == \"Long Break\") {\n longBreakSeconds = tempoaryLongBreakSeconds;\n seconds_left = longBreakSeconds;\n } else {\n shortBreakSeconds = tempoaryShortBreakSeconds;\n seconds_left = shortBreakSeconds;\n }\n seconds_left += 1;\n clearInterval(interval);\n intervalManager(true, doTheInterval); // for setInterval\n\n\n}", "function resetTimer(){\n const timerValue = document.querySelector(\".timerCount\");\n time = 0;\n timerValue.textContent = time;\n paused=false;\n //setTimeout(timer,1000);\n}", "reset(){\n this.stop()\n this.setState({clock: 0})\n }", "_resetStartSecond(second) {\n this._stopTimer();\n\n this.setState({\n nowSecond: second,\n startSecond: second\n });\n }", "resetTimer() {\n this.stopTimer();\n console.log(\"resetTimer() called, timer instance restarts from 0.\");\n this.mElapsedTime = 0;\n this.notifyTimerObservers(this.mElapsedTime);\n const handler = function () {\n this.mElapsedTime++;\n this.notifyTimerObservers(this.mElapsedTime);\n }\n this.mElapsedTime = 0;\n mTimerIntervalId = window.setInterval(handler.bind(this), 1000);\n }", "function reset(){\n timerStarted = false;\n sessionInProgress = true;\n minutes = sessionMinutes;\n seconds = sessionSeconds;\n document.getElementById(\"start-button\").innerHTML = \"Start\";\n writeTime();\n \n}", "resetSW() {\r\n this.hmsElapsed = [];\r\n clearInterval(this.interval);\r\n this.view.playerInfo([\"00\", \"00\", \"00\", \"0\"].join(\":\"));\r\n }", "function reset() {\n clearInterval(intervalID);\n document.getElementById('toggle').value = \"Start\";\n document.getElementById(\"days\").innerHTML = 0;\n document.getElementById(\"hours\").innerHTML = 0;\n document.getElementById(\"minutes\").innerHTML = 0;\n document.getElementById(\"seconds\").innerHTML = 0;\n}", "function clearTimer() {\n stopTimer();\n seconds = 0; \n minutes = 0;\n timerStatus = false;\n let resetTime = document.querySelector('.timer');\n resetTime.innerHTML = '00:00';\n }", "function resetClock() {\r\n centiSec = 0;\r\n sec = 0;\r\n secSaved = 0;\r\n gameIsStarted = false;\r\n clearInterval(ticking);\r\n ticking = null;\r\n secHtml.innerText = 0;\r\n centiSecHtml.innerText = \"00\";\r\n}", "function reset (){\n \n clearInterval(interval); // making sure there is no interval running in the background\n interval = null; // clear resource\n timer=[0,0,0,0];\n timerRunning=false; //allows us to start timer again\n textBox.value=\"\";\n theTimer.innerHTML = \"00:00:00\";\n textBoder.style.borderColor = \"gray\";\n \n \n \n }", "function reset() {\n time = 30;\n // DONE: Change the \"display\" div to \"00:00.\"\n $(\".timer\").text(\"00:00\");\n }", "function restartTimer(){\r\n clearInterval(aux)\r\n hourTimer = 0;\r\n minutesTimer = 0;\r\n secondsTimer = 0;\r\n document.getElementById(\"timer\").innerHTML = \"00:00:00\"\r\n document.getElementById(\"startButton\").disabled = false\r\n}", "function resetTimer() {\n if( cancelTimer ) {\n cancelTimer();\n cancelTimer = null;\n }\n if( start && Date.now() - start > maxWait ) {\n if(!runScheduledForNextTick){\n runScheduledForNextTick = true;\n utils.compile(runNow);\n }\n }\n else {\n if( !start ) { start = Date.now(); }\n cancelTimer = utils.wait(runNow, wait);\n }\n }", "function resetTimer() {\n if( cancelTimer ) {\n cancelTimer();\n cancelTimer = null;\n }\n if( start && Date.now() - start > maxWait ) {\n if(!runScheduledForNextTick){\n runScheduledForNextTick = true;\n utils.compile(runNow);\n }\n }\n else {\n if( !start ) { start = Date.now(); }\n cancelTimer = utils.wait(runNow, wait);\n }\n }", "function resetTimer() {\n document.getElementById(\"start\").disabled = false;\n document.getElementById(\"minutes\").innerHTML = \"25\";\n document.getElementById(\"seconds\").innerHTML = \"00\";\n document.getElementById(\"status\").innerHTML = \"Work Time\";\n document.getElementById(\"statusIcon\").innerHTML = defaultHTML;\n //sessionCount = 1;\n work = true;\n timerMinutes = 25;\n timerSeconds = 0;\n clearInterval(timerInterval);\n //document.getElementById(\"status\").innerHTML = \"Work Time\";\n}//END reset", "reset() {\n show(cacheDOM.setButton);\n hide(cacheDOM.setDisplay, cacheDOM.snoozeButton, cacheDOM.stopButton);\n this.alarm.hours = 0;\n this.alarm.minutes = 0;\n this.alarm.isSet = false;\n }", "function Stopwatch() {}", "function resetTimer() {\n clearInterval(interval);\n THETIMER.innerHTML = \"0\";\n timer = 0;\n timerRunning = false;\n}", "resetTimer_() {\n clearTimeout(this.timer);\n this.timer = 0;\n }", "function clearTimer() {\n clearInterval(currentTime);\n $('.current-time').html('00:00');\n $('.current-song').html('Stopped');\n elapsedSeconds = 0;\n }", "function resetTimerBreak() {\n resetElement = document.getElementById('timer').innerText = \"5:00\";\n breakMinutes = 5;\n breakSeconds = 00;\n}", "function reset() {\n time = 120;\n gameRun = false;\n }", "handleReset() {\n relaxingFive.currentTime = 0;\n relaxingTen.currentTime = 0;\n console.log(\"Reset\");\n\n if (this.state.buttonActive === \"pomodoro\" || this.state.buttonActive === \"\") {\n this.setState({\n interval: 25 * 60,\n timerRunning: false,\n resetTimer: true,\n })\n clearInterval(this.timer)\n } else if (this.state.buttonActive === \"shortBreak\") {\n this.setState({\n interval: 5 * 60,\n timerRunning: false,\n resetTimer: true,\n })\n clearInterval(this.timer)\n relaxingFive.pause();\n } else if (this.state.buttonActive === \"longBreak\") {\n this.setState({\n interval: 10 * 60,\n timerRunning: false,\n resetTimer: true,\n })\n clearInterval(this.timer)\n relaxingTen.pause();\n }\n }", "reset() {\n if (this.props.isPlaying || this.props.isStop) { // only reset if playing or resume\n\n this.props.setIsPlaying(false);\n this.props.setIsStop(false);\n this.props.setPlayType('session');\n this.props.setTimer({\n minutes: this.props.session_length,\n seconds: 0,\n percentage: 0\n });\n\n window.clearInterval(this.timerRef);\n }\n }", "function resetTimer(){\n clearInterval(interval);\n intervalTimer();\n}", "resetInterval()\n {\n this.incrementTimeDur = 60000;\n clearInterval(this.secChange);\n this.secChange = setInterval(this.timeIncrement, this.incrementTimeDur);\n }", "reset() {\n this.interval = 1000;\n }", "function timeReset() {\n setTimeout(resetAll, 2000);\n}", "function stopWatch () {\n seconds++\n if (seconds <= 9) {\n secondsDisplay.textContent = `0${seconds}`\n }\n if (seconds > 9) {\n secondsDisplay.textContent = `${seconds}`\n }\n if (seconds > 59) {\n minutes++\n seconds = 0\n minutesDisplay.textContent = `0${minutes}`\n secondsDisplay.textContent = `0${seconds}`\n }\n }", "function stopWatch() {\n var startAt = 0;\n var lapTime = 0;\n\n var now = function() {\n return (new Date()).getTime();\n };\n\n this.start = function() {\n startAt = startAt ? startAt : now();\n };\n this.stop = function() {\n lapTime = startAt ? lapTime + now()-startAt : lapTime;\n startAt = 0;\n };\n this.reset = function() {\n lapTime = startAt = 0;\n };\n this.time = function() {\n var t = lapTime + (startAt?now() - startAt:0);\n var h = m = s = ms = 0;\n h = (t/(60*60*1000))|0;\n t = t % (60*60*1000);\n m = (t/(60*1000))|0;\n t = t % (60*1000);\n s = (t/1000)|0;\n ms = t%1000;\n return m+':'+s+':'+ms;\n };\n}", "function resetTimer () {\n if (isMarch == true) {\n clearInterval(control);\n isMarch = false;\n }\n acumularTime = 0;\n timer.innerHTML = \"00 : 00 : 00\";\n}", "function reset(){\n trainName = \"\";\n destination = \"\";\n startTime = \"\";\n frequency = 0;\n}", "reset() {\n\t\tthis.startTime = null;\n\t\tthis.endTime = null;\n\t}", "function resetValues() {\n curr_time.textContent = \"00:00\";\n tot_duration.textContent = \"00:00\";\n seek_slider.value = 0;\n}", "function reset() {\n clearInterval(timeId);\n timeId = true;\n let newTime = parseInt(document.getElementsByClassName(\"time active\")[0].textContent) * 60;\n document.querySelector(\"#timer\").textContent = secondToStringConversion(newTime);\n let currentStatus = document.querySelector(\".inProgress\");\n currentStatus.style.cssText = 'background-color: rgb(214, 214, 214)';\n}", "function stopWatch() {\n\t//First Check is RunningTimer is true or Flase\n\n\tif (runningTimer == true) {\n\t\tmicroSec++;\n\t\tif (microSec == 100) {\n\t\t\tseconds++;\n\t\t\tmicroSec = 0;\n\t\t}\n\n\t\tif (seconds == 60) {\n\t\t\tminutes++;\n\t\t\tseconds = 0;\n\t\t}\n\n\t\tif (minutes == 60) {\n\t\t\thour++;\n\t\t\tminutes = 0;\n\t\t\tseconds = 0;\n\t\t}\n\n\t\tdocument.getElementById('hr').innerHTML = hour;\n\t\tdocument.getElementById('min').innerHTML = minutes;\n\t\tdocument.getElementById('sec').innerHTML = seconds;\n\t\tdocument.getElementById('msec').innerHTML = microSec;\n\t\tsetTimeout(stopWatch, 10);\n\t}\n}", "function resetCall () {\n resetTimer();\n resetDocument();\n resetAnalysis();\n}", "function resetTimer() {\n inactiveTime = 0;\n}", "onResetClick ()\n {\n // cancel current interval\n clearInterval(this.interval);\n this.interval = null;\n\n // go back to the beginning of the first step\n this.setState({\n step: 0,\n hours: DURATIONS.get(CICLE[0]).hours,\n minutes: DURATIONS.get(CICLE[0]).minutes,\n seconds: DURATIONS.get(CICLE[0]).seconds\n });\n }" ]
[ "0.8263317", "0.78868407", "0.7865366", "0.7789778", "0.7786781", "0.7780326", "0.7780326", "0.7737294", "0.76871645", "0.7678454", "0.7571207", "0.7552051", "0.75146556", "0.7504237", "0.75001234", "0.74798685", "0.74745613", "0.74435246", "0.7404202", "0.7386709", "0.73847353", "0.7355706", "0.7334593", "0.7328528", "0.73078173", "0.7305755", "0.7301453", "0.7295863", "0.7287455", "0.72818446", "0.72757107", "0.7257634", "0.72419965", "0.72279555", "0.72094953", "0.7204915", "0.72036535", "0.71974593", "0.719608", "0.7168375", "0.7166946", "0.7160915", "0.7143472", "0.7141969", "0.71262556", "0.7125457", "0.708536", "0.7083451", "0.70534503", "0.70518255", "0.703615", "0.7032656", "0.7017594", "0.7014482", "0.69895846", "0.6975519", "0.6939682", "0.692718", "0.6923502", "0.6914977", "0.69004357", "0.6895377", "0.68846846", "0.687783", "0.68754935", "0.6870507", "0.68605953", "0.68586606", "0.6839279", "0.68285173", "0.6817027", "0.6814422", "0.68037397", "0.6789062", "0.6789062", "0.6788543", "0.67845625", "0.6776436", "0.67670757", "0.67384934", "0.67369884", "0.6727343", "0.67271006", "0.67247576", "0.6710313", "0.6692086", "0.6683538", "0.66696775", "0.66660655", "0.6658628", "0.66488653", "0.66476613", "0.6629733", "0.6625598", "0.6608535", "0.65977615", "0.6594758", "0.6591376", "0.6584009", "0.65814734" ]
0.72891444
28
Function to display laps
function lap() { document.getElementById('lapText').innerHTML += `<p>${displayHours}:${displayMinutes}:${displaySeconds}:${displayMilliseconds}</p>`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "displayLasers(){\n for(let i = 0; i < lasers.length; i++){\n let laser = lasers[i];\n laser.move();\n laser.display();\n laser.laserTouch();\n }\n }", "show() {\n strokeWeight(2);\n fill(224, 65, 65);\n rect(this.x, this.y, this.w, this.h);\n\n // if the used job rectangle covers the text with the lane number \n // redraw the same text over everythin \n if (this.x + this.w > 35) {\n strokeWeight(.5);\n fill(0);\n text(`Lane ${this.lane + 1}`, lanes[this.lane].x + (.06 * lanes[this.lane].w), lanes[this.lane].y + (.5 * lanes[this.lane].h) + 3);\n }\n\n\n // Display the amount of space that is remaining in the lane \n strokeWeight(.5);\n fill(0);\n text(`Space Remaining: ${lanes[this.lane].remaining}`, lanes[this.lane].x + (.75 * lanes[this.lane].w), lanes[this.lane].y + (.5 * lanes[this.lane].h) + 3);\n }", "show() {\n stroke(0);\n strokeWeight(this.stroke);\n noFill();\n rect(this.x, this.y, this.w, this.h);\n\n strokeWeight(1);\n textSize(12);\n text(`Lane: ${this.ID}`, this.x + (.06 * this.w), this.y + (.5 * this.h) + 3);\n\n // if no jobs are in the lane it displays the full length of the lane \n // otherwise each new job added updates the display to show the \n // amount of space remaining \n if (this.jobs.length == 0) {\n textSize(12);\n text(`Lane Length: ${lane_lens}`, this.x + (.75 * this.w), this.y + (.5 * this.h) + 3);\n }\n }", "displayLives() {\r\n console.log(`\\nLives left: ${this.lives}`);\r\n }", "function displayLapTimes(mins, secs, mils) {\n let html = `\n <div class=\"lap\">\n <span class=\"lap-minutes\">${mins}</span>:<span class=\"lap-seconds\">${secs}</span>:<span class=\"lap-miliseconds\">${mils}</span>\n </div>\n `;\n\n lapContainer.insertAdjacentHTML(\"beforeend\", html);\n}", "function renderLives(){\r\n lives.innerHTML = \"<p>Levens: \" + levens + \"</p>\";\r\n \r\n }", "drawLives(){\n\t\tfor (let i = 0; i<this.lives; i++){\n\t\t\tpush();\n\t\t\ttranslate(width-30 - 20*i, height-30);\n\t\t\tnoStroke();\n\t\t\tfill(255,0,0);\n\t\t\ttriangle(-10, 0, 10,0, 0, 14);\n\t\t\tarc(-5, 0, 10, 12, PI, TAU);\n\t\t\tarc(5, 0, 10, 12, PI, TAU);\n\t\t\tpop();\n\t\t}\n\t}", "function showLazers(){\n document.getElementById('lazers').innerHTML = \"\";\n for(var x = 0; x < lazers.length ; x++){\n document.getElementById('lazers').innerHTML += `<div class='lazer' style='left:${lazers[x].left}px; top:${lazers[x].top}px'></div>`;\n }\n}", "function drawLanes() {\r\n\tfill(80);\r\n\trect(0, 0, 5, height);\r\n\trect(55, 0, 5, height);\r\n\trect(110, 0, 5, height);\r\n\trect(165, 0, 5, height);\r\n\trect(220, 0, 5, height);\r\n}", "function stopwatchLap(event) {\r\n event.preventDefault();\r\n let printLapList = document.getElementById(\"lapList\");\r\n laps.push(formatTime(rawTime));\r\n lapList.innerHTML = \"\";\r\n for (var i = 0; i < laps.length; i++) {\r\n lapNumber = i + 1;\r\n nameList = \"<li>\" + \"Lap \"+ lapNumber + \" time is \" + laps[i] + \"</li>\";\r\n document.getElementById(\"lapList\").innerHTML += nameList;\r\n }\r\n}", "function drawLives(){\n for (i=0; i<lives; i++){\n graphics.drawImage(spaceship, 5+(i*35), 35, 25,25);\n }\n }", "function updateLPS(){\n\tdocument.getElementById('lps').innerHTML = 'LPS: ' + nf.format(lps);\n\tdocument.getElementById('followerLPS').innerHTML = followerLPS;\n\tdocument.getElementById('FansLPS').innerHTML = FansLPS;\n\tdocument.getElementById('paparazzisLPS').innerHTML = paparazzisLPS;\n\tdocument.getElementById('stalkersLPS').innerHTML = stalkersLPS;\n\tdocument.getElementById('lunaticsLPS').innerHTML = lunaticsLPS;\n\tdocument.getElementById('botLPS').innerHTML = botLPS;\n}", "function printBrickLayer(title , tiles){\r\n // String of whole output\r\n let output = ` ${title} <br>`;\r\n \r\n for (let y = 0; y < dimensions.height ; y++) {\r\n\r\n // String of output row\r\n let line = \"\";\r\n\r\n for (let x = 0; x < dimensions.width ; x++) {\r\n \r\n let brick = tiles[ x + (dimensions.width * y)];\r\n let outputTile = (brick > 9) ? brick.toString() : \"0\" + brick.toString();\r\n line += ` ${outputTile}`;\r\n }\r\n output += line + \"<br>\";\r\n } \r\n // DOM element\r\n let element = document.getElementById(\"output\");\r\n element.innerHTML += output + \"<br><br>\";\r\n}", "function drawLives(){\n let startX = game.width*.75;\n\n graphics.lineStyle(2, 0xffffff);\n points = [0,-12,-8,12,-6,10,6,10,8,12,0,-12];\n for(let i = 0; i < lives; i++){\n var x = startX+i*20;\n for(let j = 0; j < points.length; j+=2){\n if(j==0)\n graphics.moveTo(x+points[j],infoY+points[j+1]);\n else\n graphics.lineTo(x+points[j],infoY+points[j+1]);\n }\n }\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 drawLanes() {\n // make sure the canvas is the correct size and clear it\n lanes.resize(timelineController.width + margin.left + margin.right);\n lanes.ctx.clearRect(0, 0, lanes.canvas.width, lanes.canvas.height);\n\n lanes.ctx.strokeStyle = 'lightgray';\n lanes.ctx.textAlign = 'end';\n lanes.ctx.textBaseline = 'middle';\n lanes.ctx.font = '10px sans-serif';\n\n // draw lanes for each worker\n var laneHeight = 0.8 * y(1);\n for (var i = 0; i < laneDefs.length; i++) {\n var laneDef = laneDefs[i];\n var yPos = y(i + 0.5);\n var dy = 0;\n\n for (var pathIndex = 0; pathIndex < laneDef.length; pathIndex++) {\n var pathDef = laneDef[pathIndex];\n pathDef.scale.range([laneHeight, 0]);\n\n // draw labels right-aligned to the left of each lane\n if ('text' in pathDef) {\n lanes.ctx.fillStyle = pathDef.color;\n lanes.ctx.fillText(\n pathDef.text,\n margin.left - margin.right, yPos + dy,\n margin.left - 10);\n\n dy += 10;\n }\n }\n }\n }", "function drawLives () {\n ctx.font = '16px Arial';\n ctx.fillStyle = 'white';\n ctx.fillText ('Lives: ' + store.state.lives, canvas.width - 65, 20);\n}", "function executeDisplay(list_lats_longs){\n //Resets slideshow back to first screen\n slideIndex = 0;\n speedIndex = 0;\n playing = true;\n //get the speed limits\n var speedlims = getSpeedLimits(list_lats_longs);\n //make the slideshow with street views and speedlimtits\n makePreview(list_lats_longs, speedlims);\n}", "function drawPlayerLives() {\n imageMode(CENTER);\n noStroke();\n fill(livesColor, 255, 100);\n textSize(22);\n textAlign(RIGHT);\n text(\"LIVES:\", width / 2 - 100, height - 20);\n let livesX = width / 2 - 70;\n for (let i = 0; i < playerLives; i++) {\n image(playerImage, livesX, height - 20, 25, 25);\n livesX = livesX + 50;\n }\n //if the player has no more extra lives, turn text red\n if (playerLives < 2) {\n livesColor = 0;\n } else {\n livesColor = 120;\n }\n}", "function drawLives() {\n\t// count and display lives left\n\tctx.fillStyle = \"white\";\n\tctx.font = \"30px Arial\";\n\tctx.fillText(\"LIVES: \" + (lives), canvas.width-150, 525);\n}", "function addLap() {\n lapNumber++;\n var myLapDetails =\n \"<div class='lap'> <div class='laptimeTitle'> Lap\" +\n lapNumber +\n \"</div>\" +\n \"<div class='laptime'>\" +\n \"<span>\" +\n format(lapMinutes) +\n \"</span>\" +\n \":<span>\" +\n format(lapSeconds) +\n \"</span>\" +\n \":<span>\" +\n format(lapCentiseconds) +\n \"</span>\";\n \"</div>\" + \"</div>\";\n\n // \"<div>\" + \"<div>\" + \"Lap\" + lapNumber;\n // (\"</div>\");\n // \"<div>\" + \"<span>\" + format(lapMinutes) + \"</span>\";\n // \":<span>\" + format(lapSeconds) + \"</span>\";\n // \":<span>\" + format(lapCentiseconds) + \"</span>\";\n // (\"</div>\");\n // (\"</div>\");\n $(myLapDetails).prependTo(\"#laps\");\n }", "function addLap(){\n lapNumber++;\n var myLapDetails =\n '<div class=\"lap\">'+\n '<div class=\"laptimetitle\">'+\n 'Lap'+ lapNumber +\n '</div>'+\n '<div class=\"laptime\">'+\n '<span>'+ format(lapMin) +'</span>'+\n ':<span>'+ format(lapSec) +'</span>'+\n ':<span>'+ format(lapCentsec) +'</span>'+\n '</div>'+\n '</div>';\n $(myLapDetails).prependTo(\"#laps\");\n }", "function drawLamps() {\n\n let firstRow = \"QWERTYUIOP\"; // order of letters in the first row of lamps\n let secondRow = \"ASDFGHJKL\"; // order of letters in the second row of lamps\n let thirdRow = \"ZXCVBNM\"; // order of letters in the third row of lamps\n\n // draw first row\n for (let index = 0; index < firstRow.length; index++) {\n\n // draw lamp\n if (onLamp == firstRow[index]) {\n\n fill(lampOnColour[0], lampOnColour[1], lampOnColour[2]);\n\n } else {\n\n fill(lampOffColour[0], lampOffColour[1], lampOffColour[2]);\n\n }\n\n circle(width / 20 + index * width / 10, 180, 50);\n fill(0);\n textSize(32);\n text(firstRow[index], width / 20 + index * width / 10, 193);\n\n }\n\n // draw second row\n for (let index = 0; index < secondRow.length; index++) {\n\n // draw lamp\n if (onLamp == secondRow[index]) {\n\n fill(lampOnColour[0], lampOnColour[1], lampOnColour[2]);\n\n } else {\n\n fill(lampOffColour[0], lampOffColour[1], lampOffColour[2]);\n\n }\n\n circle(width / 10 + index * width / 10, 340, 50);\n fill(0);\n textSize(32);\n text(secondRow[index], width / 10 + index * width / 10, 353);\n\n }\n\n // draw third row\n for (let index = 0; index < thirdRow.length; index++) {\n\n // draw lamp\n if (onLamp == thirdRow[index]) {\n\n fill(lampOnColour[0], lampOnColour[1], lampOnColour[2]);\n\n } else {\n\n fill(lampOffColour[0], lampOffColour[1], lampOffColour[2]);\n\n }\n\n circle(width / 5 + index * width / 10, 500, 50);\n fill(0);\n textSize(32);\n text(thirdRow[index], width / 5 + index * width / 10, 513);\n\n }\n}", "function display(ll) {\n console.log(JSON.stringify(ll));\n}", "function drawLives() {\n ctx.font = \"16px Arial\";\n ctx.fillText(\"Lives: \"+lives, canvas.width-65, 20);\n }", "function stopwatchLap(){\n event.preventDefault()\n console.log('lap!')\n\n // console.log(stopwatchTime.innerHTML)\n // if the lap is clicked before starting the stopwatch or when the stopwatch\n // is reset do not display the laplist\n if (stopwatchTime.innerHTML == formatTime(0)){\n lapList.innerHTML = \"\"\n }\n else {\n laps.push(stopwatchTime.innerHTML) // adds the lap time to an array\n\n // displays the laps recorded in the lap array\n lapList.innerHTML = \"\" // clears the lap list to begin with\n for (i=0; i<laps.length; i++){\n var liLap = document.createElement(\"li\")\n liLap.innerHTML = laps[i]\n lapList.appendChild(liLap)\n }\n }\n}", "function displayLives(){\n document.getElementById('lives').innerHTML = 'Lives: '+ lives;\n}", "function addLap() {\n lapNumber++;\n var myLap = \n '<div class=\"lapre\">'+\n '<div class=\"laptimetitle\">'+\n 'LAP'+ lapNumber +\n '</div>'+\n '<div class=\"laptimes\">'+\n '<span>'+ format(lapMinutes) +'</span>'+\n ':<span>'+ format(lapSeconds) +'</span>'+\n ':<span>'+ format(lapMiliseconds) +'</span>'+\n '</div>'+\n\n '</div>';\n $(myLap).prependTo(\"#laprecord\");\n}", "function displayPunchLine() {\n\tpunchline.style.display = 'block';\n\tpunchline.classList.add('bubble');\n\tpunchline.innerHTML = jokeArray[0].punchline;\n\tpunchlineBtn.classList.add('hidden');\n}", "function lapHistory(lapsData) { \r\n\r\n let fastest = Math.min(...lapsData);\r\n let slowest = Math.max(...lapsData);\r\n\r\n lapTimesList.innerHTML = lapsData\r\n .map((lap) => {\r\n if (lap === fastest) {\r\n return (`<li class=\"fastest\">${formatTimer(lap)}</li>`)\r\n } else if (lap === slowest) {\r\n return (`<li class=\"slowest\">${formatTimer(lap)}</li>`)\r\n } else {\r\n return (`<li>${formatTimer(lap)}</li>`)\r\n } \r\n }).join(\"\")\r\n}", "function displayInfo() {\n\tctx.fillStyle = '#FFFFFF';\n\tctx.font = '16px Times New Roman';\n\tfor (var i = 0; i < lives; i++) {\n\t\tctx.drawImage(player.ship, 800 + (i*20), 90, 15, 20);\n\t\tctx.fillText(\"Lives: \", 750, 100);\n\t}\n\tctx.fillText(\"Level: \" + level, 750, 130);\n\tctx.fillText(\"Score: \" + score, 750, 160);\n\tctx.fillText(\"Controls\", 750, 240);\n\tctx.fillText(\"Arrow keys to move\", 750, 270);\n\tctx.fillText(\"Space to shoot\", 750, 300);\n\tctx.fillText(\"W to warp\", 750, 330);\n\treturn;\n}", "function printInfos(snakeLength, speed, rownum) {\n process.stdout.write('\\x1B[?25h');\n cursor.bold();\n cursor.goto(1, rownum).write(\"Points:\\t\" + (parseInt(snakeLength) - 1));\n cursor.goto(1, rownum + 1).write(\"SnakeLength:\\t\" + snakeLength);\n cursor.goto(1, rownum + 2).write(\"Speed:\\t\" + speed);\n cursor.reset();\n process.stdout.write('\\x1B[?25l');\n}", "function logCurrentLap () {\n if (timerStartFinishTimestamp && !timerPauseTimestamp) {\n lapContainer.classList.remove('hide');\n var listNode = document.createElement('li');\n listNode.innerHTML = getTimeString(Date.now() - timerStartFinishTimestamp);\n lapLog.appendChild(listNode);\n lapListWrapper.scrollTop = lapListWrapper.scrollHeight;\n };\n}", "function displayPaddle(paddle) {\n rect(paddle.x,paddle.y,paddle.w,paddle.h);\n}", "function displayEndLap(timeLeft) {\n milisecDisplay(timeLeft, 'Результат круга: ');\n addResultsLap(display);\n }", "function showLives() {\n var lifeMsg;\n // gLivesCount = num;\n // var elLife = document.querySelector('.life');\n if (gLivesCount === 1) lifeMsg = `${gLivesCount} LIFE LEFT `;\n else if (!gLivesCount) lifeMsg = `NO MORE LIVES `;\n else lifeMsg = `${gLivesCount} LIVES LEFT `;\n\n if (gNumOfHintsLeft === 1) lifeMsg += `| 1 HINT LEFT`\n else if (!gNumOfHintsLeft) lifeMsg += `| NO MORE HINTS`\n else lifeMsg += `| ${gNumOfHintsLeft} HINTS LEFT`\n return lifeMsg;\n}", "function _display(){\n\t\t\t$(levelID).html(level);\n\t\t\t$(pointsID).html(points);\n\t\t\t$(linesID).html(lines);\n\t\t}", "display() {\n\t\tvar alpha = 255;\n\t\tif (this.hover()) {\n\t\t\talpha = 150;\n\t\t} else {\n\t\t\talpha = 255;\n\t\t}\n\t\t// stroke(255);\n\t\t// for (var i = 1; i < interval - 1; i++) {\n\t\t// \tline(0,0, width, 0);\n\t\t// }\n\t\tnoStroke();\n\t\tfill(this.col, alpha);\n\t\tellipseMode(CENTER);\n\t\tellipse(this.x, this.y, this.size, this.size);\n\t\tfill(150, alpha);\n\t\trectMode(CENTER);\n\t\trect(this.x, this.y, this.size/4, this.size/4);\n\t}", "function drawLives()\n{\n for(var i = 0; i < lives; i++)\n { \n stroke(0);\n strokeWeight(1);\n fill(255,200,0);\n ellipse(width - 120 + i * 30, 35, 30);\n fill(185,200,50);\n ellipse(width - 120 + i * 30 - 5, 35,10);\n ellipse(width - 120 + i * 30 + 5, 35, 10);\n }\n text(\"lives: \" + lives, 20,60);\n}", "display() {\n p.stroke(0);\n p.bassMap = p.map(p.bass, 0, 255, 20, 500);\n p.bassStrokeWeight = p.map(p.bass, 0, 255, 0, 10);\n p.noFill();\n p.strokeWeight(p.bassStrokeWeight);\n p.stroke(p.strokeColor);\n p.ellipse(this.location.x, this.location.y, p.bassMap, p.bassMap);\n }", "function getLights(result) {\n resultDiv.html(\"<hr/>\" + result);\n}", "function DisplayBoard() {\n\tconsole.log(\"Turn \"+(TotalEmptyPegs-1))\n\tlet spacer = \" \"\n\tfor (var i = 0; i < board.length; i++) {\n\t\tlet text = \"\"\n\t\tfor (var y = 0; y < board[i].length; y++) {\n\t\t\tif(board[i][y].isFilled) { text+=\" X\" }\n\t\t\telse text+=\" O\"\n\t\t\t\n\t\t\tspacer = spacer.substring(0, spacer.length - 1);\n\t\t}\n\t\tconsole.log(spacer+text)\n\t}\n\t\n}", "function displayBoards() {\n displayGameBoard();\n displayPlayerBoard();\n displayExpeditions();\n}", "display() {\n console.log('head:', this.head)\n console.log('[ ')\n this.displayHelper(this.head)\n console.log(' ]')\n console.log('tail:', this.tail)\n }", "displayLabMarker() {\n // add markers\n var d4svMarker = L.marker([40.10250, -88.23425]).addTo(this.map);\n\n d4svMarker.bindPopup(\"<b>D</b>4<b>SV</b><br>Research lab\").openPopup();\n }", "function display() {\n lcd.clear();\n lcd.cursor(0, 0).print(displayDate());\n lcd.cursor(1, 0).print(displayMeasure());\n }", "function display_tip() {\n if (pause_on_tile === true) {\n g.paused = true;\n }\n\n show_description(g.progress); //description.js\n\n g.progress = g.progress + 1;\n}", "function drawLives() {\r\n ctx.font = \"30px Courier\"; /* indico el tamaño de letra y el tipo de letra */\r\n ctx.fillStyle = \"#000\"; /* indico el color de la letra */\r\n ctx.fillText(\"Vidas: \"+lives, canvas.width -160, 30); /*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * indico el texto a\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * imprimir\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t */\r\n}", "function drawLabel() {\n p.text(`Trials: ${p.props.playedGames}/${p.props.countOfGames}`, 20, p.wrapper.offsetHeight-20);\n }", "function drawLives() {\n ctx.font = \"30px Courier\"; /* indico el tamaño de letra y el tipo de letra*/\n ctx.fillStyle = \"#000\"; /* indico el color de la letra*/\n ctx.fillText(\"Vidas: \"+lives, canvas.width -160, 30); /* indico el texto a imprimir*/\n}", "function addLap(){\n lapNum++ ;\n var lapDetails = '<div class = \"lap\">' +\n\n '<div class = \"laptimetitle\">' + 'Lap ' + lapNum +'</div>' +\n '<div class = \"laptime\">' + '<span>' + format(lapMinutes)+ '</span>' +\n ':<span>'+ format(lapSec) + '</span>'+ ':<span>'+ format(lapCentiSec)+ '</span>'+ '</div>' +\n \n '</div>';\n $(lapDetails).prependTo('#laps')\n }", "function showPrintingDiagnostics() {\n showPrintingCropMarks();\n showPrintingDescription();\n showPrintingRulers();\n}", "function LView() { }", "function LView() { }", "display(){\n\n push();\n // stylize this limb\n strokeWeight(1);\n stroke(45, 175);\n\n // vary fill values\n let redFill = cos(radians(frameCount/0.8));\n\n if(this.legOverlap) {\n this.greenFill = 30+cos(radians(frameCount*8 ))*25;\n redFill = 185+cos(radians(frameCount*3))*30;\n }\n else {\n this.greenFill = 200+cos(radians(frameCount*8 ))*45;\n redFill = 30+cos(radians(frameCount*3))*25;\n }\n\n // give arms and legs a different fill\n if(this.flip===1){\n if(this.xflip===1) fill(this.greenFill, redFill, 23);\n if(this.xflip===-1) fill(23, redFill, this.greenFill);\n }\n if(this.flip===-1) fill(redFill, 25, this.greenFill);\n\n // apply thigh rotation\n rotateZ(this.xflip*radians(this.thigh.angle2));\n rotateX(this.flip*this.thigh.angle - radians(dude.back.leanForward));\n rotateY(this.direction*PI - 2* this.xflip*dude.hipMove);\n translate(0, -this.thigh.length/2, 0);\n\n // draw thigh\n box(10, this.thigh.length, 10);\n\n // apply knee rotation\n translate(0, -this.thigh.length/2, 0)\n rotateX(this.knee.angle);\n // rotate this limb to match hip motion\n rotateZ(radians(-3*dude.hipMove));\n translate(0, this.thigh.length/2, 0);\n\n // draw knee\n box(10, this.thigh.length, 10);\n pop();\n }", "display() {\n\t\t\t\tthis.nurbsPlane.display();\n\t\t}", "function logPlanets() {\n console.log(\"Here is the list of planets:\");\n console.log(planets);\n console.log(\"---- ---- ---- ----\");\n }", "function logPlanets() {\n console.log(\"Here is the list of planets:\");\n console.log(planets);\n console.log(\"---- ---- ---- ----\");\n }", "function logPlanets() {\n console.log(\"Here is the list of planets:\");\n console.log(planets);\n console.log(\"---- ---- ---- ----\");\n }", "function logPlanets() {\n console.log(\"Here is the list of planets:\");\n console.log(planets);\n console.log(\"---- ---- ---- ----\");\n }", "function lives() {\n showLives.innerHTML = \"You have \" + guessesLeft + \" lives\";\n }", "showShops() {\n this.api.getData()\n .then(data => {\n const result = data.responseJSON.results;\n // Muestra los pines en el Mapa\n this.showPins(result);\n } )\n }", "function addLap() {\n lap++;\n // When lap reaches the total number of laps: stop the timer, reset the start button.\n if (lap === totalLaps) { //ok\n alert(\"Workout Finished. Congrats!!\")\n workoutOver();\n console.log(`Seconds: ${seconds}, Minutes: ${minutes}, Laps: ${lap}. Total laps: ${totalLaps}`);\n } // While lap is <= to the total number of laps, set seconds to the next array item's value. \n else {\n seconds = workoutArray[lap][1] + 1; // +1 is needed to make sure the next lap starts with actual value. Ideas to fix?\n minutes = workoutArray[lap][0];\n }\n }", "function laneToLanes(lane){return lane;}", "function laneToLanes(lane){return lane;}", "function addLilyPad() {\n const r = rnd(10, 10);\n const c = {\n p: vec(rnd(20, 80), -r),\n r,\n a: rnd(PI * 2),\n v: rnds(0.03, 0.08),\n l: 2,\n next: undefined,\n };\n if (lastLilyPad != null) {\n lastLilyPad.next = c;\n }\n if (playersLilyPad == null) {\n playersLilyPad = c;\n }\n // makes the color of the lilypad that the player is on\n // a different shade of green\n color (\"green\");\n char(\"a\", playersLilyPad.p);\n // pushed new lilypad to the list\n lastLilyPad = c;\n lilypads.push(c);\n}", "function showLives(){\n if(livesCounter == 3){\n image(heartLivesImg, 50, 65, 25,25);\n image(heartLivesImg, 80, 65, 25,25);\n image(heartLivesImg, 110, 65, 25,25);\n }\n else if (livesCounter == 2){\n image(heartLivesImg, 50, 65, 25,25);\n image(heartLivesImg, 80, 65, 25,25);\n }\n else if(livesCounter == 1){\n image(heartLivesImg, 50, 65, 25,25);\n }\n else if(livesCounter == 0) {\n image(transparentImg, 50, 65, 25,25);\n }\n}", "function displayComputer(computer) {\r return computer.cpu+ \" \" + computer.screenSize;\r}", "function display_toys() {\n \n }// displays toys in the interface", "function showSolution(time, glyphPictures, level) {\n\n let ol = $(\"<ol>\");\n let li;\n\n ol.html(\"Solution : \");\n\n for (let i = 0; i < level; i++) {\n li = $(\"<li>\");\n ol.append(li);\n }\n\n $(\"#glyphGame\").prepend(ol);\n\n for (let i = 1; i <= level; i++) {\n let item = glyphPictures.filter(function () {\n return $(this).data(\"order\") == i;\n });\n\n ol.children().eq(i - 1).html(item.data(\"name\"));\n }\n\n setTimeout(function () {\n ol.remove();\n }, time);\n }", "function displayLiffData() {\n document.getElementById('browserLanguage').textContent = liff.getLanguage();\n document.getElementById('sdkVersion').textContent = liff.getVersion();\n document.getElementById('lineVersion').textContent = liff.getLineVersion();\n document.getElementById('isInClient').textContent = liff.isInClient();\n document.getElementById('isLoggedIn').textContent = liff.isLoggedIn();\n document.getElementById('deviceOS').textContent = liff.getOS();\n}", "function displayLives(){\n\t\tvar showLives = document.getElementById(\"guessesLeft\");\n\t\tshowLives.innerHTML = \"You have \" + lives + \" guesses remaining\";\n\t\tif (lives < 1) {\n\t\t\talert(\"Game Over! Refresh the page the replay.\");\n\t\t\t$(\"#imagePlace\").html(\"<img src=\\\"assets/images/youLose.png\\\" style=\\\"height:250px;\\\">\");\n\t\t\t$(\"#displayWins\").html(\"Try again, loser.\");\n\n\t\t}\n\t}", "function drawLeds() {\r\n noFill();\r\n stroke(\"black\");\r\n const numRows = 16\r\n for (let i = 21; i < 108; i++) {\r\n for (let j = 0; j <= 15; j++) {\r\n const espace = separation//separation*15\r\n\r\n let x = (espace * j / 15) * b// convertimos los numeros del 0 al 15 a una escala de 0 a 0.2*15=3\r\n rect(i * noteSeparation + offsetHorizontal,\r\n - x * a + offsetVertical,\r\n noteWidth,\r\n -10);\r\n }\r\n }\r\n}", "function tiro1() {\n displays();\n}", "function logPlanets() \n{\n console.log('Here is the list of planets:');\n console.log(planets);\n}", "function display() {\n\tstroke(255);\n\tstrokeWeight(4);\n\tfill(200, 0, 200);\n\tellipse(ballX, ballY, 24, 24);\n}", "function displayScene() {\n var para = document.querySelector (\"#descrip\");\n para.textContent = \"You are in the \" + player.currLoc.name + \"-\" + \"\\n\" + \n player.currLoc.description + \".\" + \"\\n\" +\n \"The items you can take are: \" + player.currLoc.items \n}", "function printPageLabOpen(lab) {\n if ( $.cookie(\"topo\") == undefined ) $.cookie(\"topo\", 'light');\n var html = '<div id=\"lab-sidebar\"><ul></ul></div><div id=\"lab-viewport\" data-path=\"' + lab + '\"></div>';\n $('#body').html(html);\n // Print topology\n $.when(printLabTopology(),getPictures()).done( function (rc,pic) {\n if ((ROLE == 'admin' || ROLE == 'editor') && LOCK == 0 ) {\n $('#lab-sidebar ul').append('<li class=\"action-labobjectadd-li\"><a class=\"action-labobjectadd\" href=\"javascript:void(0)\" title=\"' + MESSAGES[56] + '\"><i class=\"glyphicon glyphicon-plus\"></i></a></li>');\n }\n $('#lab-sidebar ul').append('<li class=\"action-nodesget-li\"><a class=\"action-nodesget\" href=\"javascript:void(0)\" title=\"' + MESSAGES[62] + '\"><i class=\"glyphicon glyphicon-hdd\"></i></a></li>');\n $('#lab-sidebar ul').append('<li><a class=\"action-networksget\" href=\"javascript:void(0)\" title=\"' + MESSAGES[61] + '\"><i class=\"glyphicon glyphicon-transfer\"></i></a></li>');\n $('#lab-sidebar ul').append('<li><a class=\"action-configsget\" href=\"javascript:void(0)\" title=\"' + MESSAGES[58] + '\"><i class=\"glyphicon glyphicon-align-left\"></i></a></li>');\n $('#lab-sidebar ul').append('<li class=\"action-picturesget-li\"><a class=\"action-picturesget\" href=\"javascript:void(0)\" title=\"' + MESSAGES[59] + '\"><i class=\"glyphicon glyphicon-picture\"></i></a></li>');\n if ( Object.keys(pic) < 1 ) {\n $('.action-picturesget-li').addClass('hidden');\n }\n\n $('#lab-sidebar ul').append('<li><a class=\"action-textobjectsget\" href=\"javascript:void(0)\" title=\"' + MESSAGES[150] + '\"><i class=\"glyphicon glyphicon-text-background\"></i></a></li>');\n $('#lab-sidebar ul').append('<li><a class=\"action-moreactions\" href=\"javascript:void(0)\" title=\"' + MESSAGES[125] + '\"><i class=\"glyphicon glyphicon-th\"></i></a></li>');\n $('#lab-sidebar ul').append('<li><a class=\"action-labtopologyrefresh\" href=\"javascript:void(0)\" title=\"' + MESSAGES[57] + '\"><i class=\"glyphicon glyphicon-refresh\"></i></a></li>');\n $('#lab-sidebar ul').append('<li class=\"plus-minus-slider\"><i class=\"fa fa-minus\"></i><div class=\"col-md-2 glyphicon glyphicon-zoom-in sidemenu-zoom\"></div><div id=\"zoomslide\" class=\"col-md-5\"></div><div class=\"col-md-5\"></div><i class=\"fa fa-plus\"></i><br></li>');\n $('#zoomslide').slider({value:100,min:10,max:200,step:10,slide:zoomlab});\n //$('#lab-sidebar ul').append('<li><a class=\"action-freeselect\" href=\"javascript:void(0)\" title=\"' + MESSAGES[151] + '\"><i class=\"glyphicon glyphicon-check\"></i></a></li>');\n $('#lab-sidebar ul').append('<li><a class=\"action-status\" href=\"javascript:void(0)\" title=\"' + MESSAGES[13] + '\"><i class=\"glyphicon glyphicon-info-sign\"></i></a></li>');\n $('#lab-sidebar ul').append('<li><a class=\"action-labbodyget\" href=\"javascript:void(0)\" title=\"' + MESSAGES[64] + '\"><i class=\"glyphicon glyphicon-list-alt\"></i></a></li>');\n $('#lab-sidebar ul').append('<li><a class=\"action-lock-lab\" href=\"javascript:void(0)\" title=\"' + MESSAGES[166] + '\"><i class=\"glyphicon glyphicon-ok-circle\"></i></a></li>');\n if ( $.cookie(\"topo\") == 'dark' ) {\n $('#lab-sidebar ul').append('<li><a class=\"action-lightmode\" href=\"javascript:void(0)\" title=\"' + MESSAGES[236] + '\"><i class=\"fas fa-sun\"></i></a></li>');\n } else {\n $('#lab-sidebar ul').append('<li><a class=\"action-nightmode\" href=\"javascript:void(0)\" title=\"' + MESSAGES[235] + '\"><i class=\"fas fa-moon\"></i></a></li>');\n }\n $('#lab-sidebar ul').append('<div id=\"action-labclose\"><li><a class=\"action-labclose\" href=\"javascript:void(0)\" title=\"' + MESSAGES[60] + '\"><i class=\"glyphicon glyphicon-off\"></i></a></li></div>');\n $('#lab-sidebar ul').append('<li><a class=\"action-logout\" href=\"javascript:void(0)\" title=\"' + MESSAGES[14] + '\"><i class=\"glyphicon glyphicon-log-out\"></i></a></li>');\n $('#lab-sidebar ul a').each(function () {\n var t = $(this).attr(\"title\");\n $(this).append(t);\n\n\n })\n if ( LOCK == 1 ) {\n lab_topology.setDraggable($('.node_frame, .network_frame, .customShape'), false);\n $('.customShape').resizable('disable');\n }\n })\n}", "display() {\n\t\tfill(this.col);\n\t\tstroke(255);\n\t\t// for (var i = 1; i < meter - 1; i++) {\n\t\t// \tline(0,0, width, 0);\n\t\t// }\n\t\tnoStroke();\n\t\tellipseMode(CENTER);\n\t\tellipse(this.x, this.y, this.size, this.size);\n\t}", "function goToLaplides(){\n\t\tif(visitedLap===0){\n\t\t\tvisitedLap=1;\n\t\t\t// artifacts=1;\n\t\t\tgamePrompt(\"You enter orbit around Laplides. Looking down at the planet, you see signs of atomic war and realize there is no option but to turn around.\",beginTravel);\n\t\t}else{\n\t\t\tgamePrompt([\"You've already been here!\",\"Where to next?\"],beginTravel);\n\t\t}\n}", "function ListofPlants(array) {\n\t//var theList = document.getElementById(\"#list\").innerHTML;\n\tfor(i=0; i<array.length; i++){\n\t\t//console.log(array[i]);\n\t\t//document.write(array[i]);\n\t\t$(\"#target ul\").append('<li onmouseover = display(id) id = ' + array[i] + '>' + array[i] + '</li>');\n }\n}", "function display()\r\n{\r\n\t// the objective of this function is to display the 'screen'\r\n\t// this is in the form of a table\r\n\t// it is in the form of a table because then it can be enhanced by css\r\n\t// the whole output is in form of a string because then it can be easily imposed on html\r\n\t/*\r\n\t ^ the negative and positive signs are kept\r\n\t | like this because that's the way the computer\r\n\t | -y (i) prints the frame\r\n\t | the flow is always towards the positive\r\n\t | +x (j) i and j represent the axes in the loops\r\n\t o------------>\r\n\t*/\r\n\tvar output = \"<table id='display_table'>\"; // this is what becomes the output at the end of the program\r\n\tfor(var i=0; i<y_resolution; i++)\r\n\t{\r\n\t\tvar current_row_output = \"<tr>\"; // this will become the output of the i'th row\r\n\t\tfor(var j=0; j<x_resolution; j++)\r\n\t\t{\r\n\t\t\tvar flag = \"empty\"; // this holds if the particular cell is taken or not, if yes, who ?\r\n\r\n\t\t\t/* COLOR CODING\r\n\t\t\t the user's bat is of color skyblue\r\n\t\t\t the computer's bat is of color seagreen\r\n\t\t\t the ball is white\r\n\t\t\t the background is transparent\r\n\t\t\t*/\r\n\r\n\t\t\t// now we need to decide the content of this table described\r\n\t\t\tif(i>user_bat_top && i<= user_bat_bottom && j>= 0 && j< bat_protrusion)\r\n\t\t\t{\r\n\t\t\t\t// this defines the location for the user's bat\r\n\t\t\t\t// need to define as a rectangle with side of bat_protrusion\r\n\t\t\t\tflag = \"user\";\r\n\t\t\t}\r\n\t\t\tif(i>computer_bat_top && i<= computer_bat_bottom && j>= (x_resolution-bat_protrusion) && j<=x_resolution)\r\n\t\t\t{\r\n\t\t\t\t// this defines the location for the computer's bat\r\n\t\t\t\t// need to define as a rectangle with side of bat_protrusion\r\n\t\t\t\tflag = \"computer\";\r\n\t\t\t}\r\n\t\t\tlocateball(); // helps in identifying the dimensional limits of the ball\r\n\t\t\tif(i>=ball_geometry_top && i<=ball_geometry_bottom && j>=ball_geometry_left && j<=ball_geometry_right)\r\n\t\t\t{\r\n\t\t\t\t// this defines the location for the ball\r\n\t\t\t\tflag = \"ball\";\r\n\t\t\t}\r\n\t\t\t// now we need to prepare the current row of the table\r\n\t\t\tif(flag == \"user\")\r\n\t\t\t{\r\n\t\t\t\tcurrent_row_output = current_row_output + \"<td id='gametab' style='background-color: skyblue'></td>\";\r\n\t\t\t}\r\n\t\t\tif(flag == \"computer\")\r\n\t\t\t{\r\n\t\t\t\tcurrent_row_output = current_row_output + \"<td id='gametab' style='background-color: seagreen'></td>\";\r\n\t\t\t}\r\n\t\t\tif(flag == \"ball\")\r\n\t\t\t{\r\n\t\t\t\tcurrent_row_output = current_row_output + \"<td id='gametab' style='background-color: white'></td>\";\r\n\t\t\t}\r\n\t\t\tif(flag == \"empty\")\r\n\t\t\t{\r\n\t\t\t\tcurrent_row_output = current_row_output + \"<td id='gametab' style='background-color: transparent'></td>\";\r\n\t\t\t}\r\n\t\t}\r\n\t\t// we need to end the current row and add it to the final output\r\n\t\tcurrent_row_output = current_row_output + \"</tr>\";\r\n\t\toutput = output + current_row_output;\r\n\t}\r\n\t// here we finish the output and write it on the screen\r\n\toutput = output + \"</table>\"; // this ends the table\r\n\tdocument.getElementById(\"videobox\").innerHTML = output;\r\n\r\n\tuser_navigate_allow = true; // to allow further movement of the bats\r\n\tcomputer_navigate_allow = true; // to allow further movement of the bats\r\n\r\n\t// we need to print the message\r\n\tdocument.getElementById(\"message\").innerHTML = message;\r\n\r\n\t// now is the implementation of artificial intelligence for the computer's bat\r\n\tblock_ball();\r\n}", "function draw_lamp(gl, n, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, red, green, blue, alpha, u_BoxColor){\r\n let lamp_base = () => {\r\n drawBox(gl, n, 4, 4, 4, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, red, green, blue, alpha, u_BoxColor);\r\n };\r\n let lamp_stand_draw = () => {\r\n drawBox(gl, n, 1, 4, 1, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, 0.15, 0.15, 0.15, 1, u_BoxColor);\r\n };\r\n let lamp_light_draw = () => {\r\n drawBox(gl, n, 4, 1, 4, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, 0.98, 0.93, 0.64, alpha, u_BoxColor);\r\n };\r\n let shade_l1_draw = () => {\r\n drawBox(gl, n, 5, 1, 5, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, 0, 0.81, 0.82, alpha, u_BoxColor);\r\n };\r\n let shade_l2_draw = () => {\r\n drawBox(gl, n, 4, 1, 4, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, 0, 0.81, 0.82, alpha, u_BoxColor);\r\n };\r\n let shade_l3_draw = () => {\r\n drawBox(gl, n, 3, 1, 3, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, 0, 0.81, 0.82, alpha, u_BoxColor);\r\n };\r\n let shade_l4_draw = () => {\r\n drawBox(gl, n, 2, 1, 2, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, 0, 0.81, 0.82, alpha, u_BoxColor);\r\n };\r\n let shade_l5_draw = () => {\r\n drawBox(gl, n, 1, 1, 1, viewProjMatrix, u_MvpMatrix, u_NormalMatrix, 0, 0.81, 0.82, alpha, u_BoxColor);\r\n };\r\n\r\n \r\n lamp.setDraw(lamp_base);\r\n lamp_stand.setDraw(lamp_stand_draw);\r\n lamp_light.setDraw(lamp_light_draw);\r\n shade_l1.setDraw(shade_l1_draw);\r\n shade_l2.setDraw(shade_l2_draw);\r\n shade_l3.setDraw(shade_l3_draw);\r\n shade_l4.setDraw(shade_l4_draw);\r\n shade_l5.setDraw(shade_l5_draw);\r\n}", "display() {\n p.strokeWeight(p.strokeWidth);\n if (p.shapeMode == false) {\n p.ellipse(this.location.x, this.location.y, this.radius, this.radius);\n }\n if (p.lines) {\n p.line(p.w / 2, p.h / 2, this.location.x, this.location.y);\n }\n p.fill(255);\n }", "function printLives(text){\n document.getElementById(\"outputError\").innerText =text + \" - Lives: \" + lives;\n}", "function displayHaloData() {\n\n for (var i = 0; i < TimePeriods.length; i++) {\n\n for (var j = 0; j < TimePeriods[i].length; j++) {\n\n\n var id = TimePeriods[i][j];\n console.log(i, id)\n // Set Halo Line Visibility\n if (HaloLines[id]){\n // console.log(\"\\tdisplaying Halo line?\", i, id, config.showPaths, EPOCH_HEAD, EPOCH_TAIL)\n HaloLines[id].visible = (i >= EPOCH_HEAD && i < EPOCH_TAIL)? config.showPaths : false;\n }\n // Set Halo Spheres Visibility\n HaloSpheres[id].visible = (i >= EPOCH_HEAD && i <= EPOCH_TAIL)? config.showHalos : false;\n if (curTarget && HaloSpheres[id].position !== curTarget.object.position){\n HaloSpheres[id].material.color.set(colorKey(i));\n HaloSpheres[id].material.opacity = 0.2;\n }\n }\n }\n\n}", "function displayPlanner() {\n for (var i = 9; i < 18; i++) {\n createTimeBlock(i);\n }\n displayActivities();\n}", "function showRiseOverRun() {\n // draw rise and run lines\n if (riseRunDisplay && pt1.pinned && pt2.pinned && plane.getContext) {\n drawRiseRunLines();\n // change slope label to demonstrate rise/run slope calculation\n let rise = (pt2.y - pt1.y).toFixed(2);\n let run = (pt2.x - pt1.x).toFixed(2);\n let html = 'm=<span class=\"riseRun\">'\n + rise + '</span>/<span class=\"riseRun\">' + run + '</span>';\n if (document.getElementById(\"slopeLabel\").innerHTML != html) {\n document.getElementById(\"slopeLabel\").innerHTML = html;\n }\n // display labels for rise and run\n }\n}", "display() {\n push();\n noStroke();\n // The trail becomes its extended body\n push();\n for (let i = 0; i < this.trail.length; i++) {\n imageMode(CENTER);\n image(this.trailImage, this.trail[i].x, this.trail[i].y, this.radius * 2, this.radius * 2);\n }\n pop();\n // Centering image for precise collision\n imageMode(CENTER);\n image(this.image, this.x, this.y, this.radius * 2, this.radius * 2);\n pop();\n }", "function updateLives(){\n\t\tdocument.getElementById(\"lives\").innerHTML = \"Lives Remaining: \" + lives;\n\t}", "function showTiles() {\n\tvar tiles = getTiles();\n\tvar formHTML = \"<ul>\";\n\tfor (var i = 0; i < tiles.length; i++)\n\t{\n\t\tformHTML = formHTML + '<li>' + tiles[i].title + '</li>';\n\t}\n\tformHTML = formHTML + \"</ul>\";\n\t$( \"div#tilesList\" ).html(formHTML);\n}", "setupLivesDisplay() {\n if (!gameState.livesDisplay) { // If it doesn't exist, make it.\n gameState.livesDisplay = [gameState.lives - 1];\n } else { // Otherwise, clear the lives display array.\n for (let i = 0; i < gameState.livesDisplay.length; i++) {\n gameState.livesDisplay[i].destroy();;\n }\n }\n // Now, create the amount of sprites required (number of lives, minus the one being played)\n for (let i = 0; i < gameState.lives - 1; i++) { \n gameState.livesDisplay[i] = this.add.sprite(gameState.INIT_X + (i * 32) + 2, 3 * gameState.CENTER_Y / 2, 'life').setOrigin(0.5);\n }\n }", "function LView() {}", "function LView() {}", "function LView() {}", "function showPlan(plan) {\n removeCurrentPlanLayers();\n\n var planBounds = new L.LatLngBounds();\n function extendPlanBounds(latlng) { planBounds.extend(latlng) }\n\n for (var i = 0; i < plan.length; i++) {\n var step = plan[i]\n , type = step.type\n , gml = step.gml;\n if (type === undefined) continue;\n\n var latlng, layer = null;\n\n if (type == 'StartWalking' || type == 'FinishWalking') {\n latlng = getLatLngFromGmlPoint(gml);\n // TODO Este marker debería ser un chaboncito caminando =D\n layer = new L.Marker(latlng);\n extendPlanBounds(latlng);\n }\n else if (type == 'Board') {\n latlng = getLatLngFromGmlPoint(gml);\n var markerIcon = getMarkerIconForService(step.service);\n // TODO Este marker debería usar el markerIcon =D\n layer = new L.Marker(latlng);\n extendPlanBounds(latlng);\n }\n else if (type == 'Bus' || type == 'SubWay' || type == 'Street') {\n // TODO add path style\n // var pathStyle = getPathStyleForType(type);\n\n var latLngList = getLatLngListFromGml(gml);\n layer = new L.Polyline(latLngList, {color: 'red'});\n latLngList.forEach(extendPlanBounds);\n }\n else if (type == 'SubWayConnection') {\n // TODO do this\n // Code stolen from usig.MapaInteractivo.min.js\n// if (H.type == \"SubWayConnection\") {\n// switch (H.service_to) {\n// case\"Línea A\":\n// H.gml[1] = H.gml[1].replace(\"connection\", \"subwayA\");\n// break;\n// case\"Línea B\":\n// H.gml[1] = H.gml[1].replace(\"connection\", \"subwayB\");\n// break;\n// case\"Línea C\":\n// H.gml[1] = H.gml[1].replace(\"connection\", \"subwayC\");\n// break;\n// case\"Línea D\":\n// H.gml[1] = H.gml[1].replace(\"connection\", \"subwayD\");\n// break;\n// case\"Línea E\":\n// H.gml[1] = H.gml[1].replace(\"connection\", \"subwayE\");\n// break;\n// case\"Línea H\":\n// H.gml[1] = H.gml[1].replace(\"connection\", \"subwayH\");\n// break\n// }\n// G.addMarker(H.gml[1]);\n// G.addEdges(H.gml)\n// }\n }\n\n if (layer) {\n map.addLayer(layer);\n currentPlanLayers.push(layer);\n }\n } // for\n\n // Fits the plan on the map =D\n// map.fitBounds(planBounds);\n }", "display() {\r\n\t\tvar pointA=this.rope.bodyA.position\r\n\t\tvar pointB=this.rope.bodyB.position\r\n\t\t\r\n\t\t\tstrokeWeight(2);\r\n\t\t\t\r\n\t\t\tline(300,100,ball1.position.x,ball1.position.y);\r\n\t\t\tline(350,100,ball2.position.x,ball2.position.y);\r\n\t\t\tline(400,100,ball3.position.x,ball3.position.y);\r\n\t\t\tline(450,100,ball4.position.x,ball4.position.y);\r\n\t\t\tline(500,100,ball5.position.x,ball5.position.y);\r\n\t\t\t}", "function showTrainArea(map, x, y) {\n let previewSize = 6 / 2;\n for (let j = Math.max(0, y - previewSize); j < Math.min(map.map.length - 1, y + previewSize); j++) {\n let line = \"\";\n for (let i = Math.max(0, x - previewSize); i < Math.min(x + previewSize, map.map[j].length); i++) {\n if (map.oldTrains.hasOwnProperty(i + ',' + j)) {\n line += map.oldTrains[i + ',' + j].direction === \"^\" ? \"⬆️\" :\n map.oldTrains[i + ',' + j].direction === \"v\" ? \"⬇️\" :\n map.oldTrains[i + ',' + j].direction === \"<\" ? \"️⬅️ \" :\n map.oldTrains[i + ',' + j].direction === \">\" ? \"➡️ \" : \"\"\n ;\n } else {\n line += map.map[j][i] === '-' ? \"➖️\" :\n map.map[j][i] === '|' ? \"⏸ \" :\n map.map[j][i] === '\\\\' ? '↖ ️' : //'⇘' :\n map.map[j][i] === '/' ? '↙ ️' : //'⇗' :\n map.map[j][i] === '+' ? '➕' : '⬛️';\n }\n }\n console.log(line);\n }\n console.log(\"collisioin situation:\");\n for (let j = Math.max(0, y - previewSize); j < Math.min(map.map.length - 1, y + previewSize); j++) {\n let line = \"\";\n for (let i = Math.max(0, x - previewSize); i < Math.min(x + previewSize, map.map[j].length); i++) {\n if (map.trains.hasOwnProperty(i + ',' + j)) {\n line += map.trains[i + ',' + j].direction === \"^\" || map.trains[i + ',' + j].direction === \"v\" ? \"🚆\" : \"🚋\";\n\n } else {\n line += map.map[j][i] === '-' ? \"➖️\" :\n map.map[j][i] === '|' ? \"⏸ \" :\n map.map[j][i] === '\\\\' ? '↖ ️' : //'⇘' :\n map.map[j][i] === '/' ? '↙ ️' : //'⇗' :\n map.map[j][i] === '+' ? '➕' : '⬛️';\n }\n }\n console.log(line);\n }\n}", "function display() {\n wrapEdges();\n background(255);\n textSize(12);\n textStyle(NORMAL);\n\n if (showarrows) {\n textSize(20);\n strokeWeight(0);\n fill(255, 0, 0);\n text(\"Velocity\", 0.8 * width, 0.8 * height + 75);\n /*\n fill(0,0,255);\n text(\"Force\",0.8*width,0.8*height+50);\n fill(204,0,204);\n text(\"Acceleration\",0.8*width,0.8*height+75);\n */\n }\n\n strokeWeight(10);\n var tri_width = 7;\n if (showarrows) {\n var x_line = 5;\n var y_line = 5;\n var line_len = 100;\n drawLine(x_line, y_line, x_line, y_line + line_len);\n drawLine(x_line, y_line, x_line + line_len, y_line);\n fill(0);\n drawTriangle(x_line - tri_width / 2, y_line + line_len, x_line + tri_width / 2, y_line + line_len, x_line, y_line + line_len + 10);\n drawTriangle(x_line + line_len, y_line - tri_width / 2, x_line + line_len, y_line + tri_width / 2, x_line + line_len + 10, y_line);\n strokeWeight(0);\n drawText(\"+x\", x_line + line_len + 15, y_line);\n drawText(\"+y\", x_line, y_line + line_len + 15);\n }\n\n\n if (iterations % 5 == 1) {\n append(xhistory, x);\n append(yhistory, y);\n }\n\n iterations += 1;\n\n if (keyIsPressed) {\n isrunning = true;\n }\n\n MaxLength = 50;\n if (xhistory.length > MaxLength) {\n xhistory = subset(xhistory, xhistory.length - MaxLength, xhistory.length);\n yhistory = subset(yhistory, yhistory.length - MaxLength, yhistory.length);\n }\n\n fill(0, 0, 0); //If more text is written elsewhere make sure the default is black\n stroke(0, 0, 0); // If more lines are drawn elsewhere make sure the default is black\n strokeWeight(0);\n\n textSize(20);\n strokeWeight(1);\n drawText(\"Click this screen first!\", 0.35 * width, 0.8 * height);\n drawText(\"then move the arrow keys!\", 0.32 * width, 0.75 * height);\n}", "function Lives(){\n\t\t\n\t\t\tfor(var i = 0; i < p2lives; i ++){\n\t\t\n\t\t\t\tctx.fillStyle='red';\n\t\t\t\tctx.fillRect(p2livesx[i] , 20, 15, 4);\n\t\t\t\t//the cannon\n\t\t\t\tctx.fillRect(p2livesx[i] + 6, 12, 2, 10);\n\n\t\t\t}\n\t\t\t\n\t\t\tfor(var i = 0; i < p1lives; i ++){\n\t\t\n\t\t\t\tctx.fillStyle = 'green';\n\t\t\t\tctx.fillRect(p1livesx[i] , 460, 15, 4);\n\t\t\t\t//the cannon\n\t\t\t\tctx.fillRect(p1livesx[i] + 6 , 454, 2, 10);\n\n\t\t\t}\n\t\t\n\t\t\n\t\t}" ]
[ "0.65363187", "0.64915174", "0.63877255", "0.63381916", "0.62199974", "0.6102788", "0.6068716", "0.594185", "0.5940676", "0.5936964", "0.58874375", "0.5881841", "0.58234876", "0.5788378", "0.5774092", "0.57665384", "0.57591915", "0.57575434", "0.5748277", "0.5740207", "0.57249177", "0.5677379", "0.56674576", "0.5657726", "0.5648851", "0.56448704", "0.5629211", "0.56210804", "0.5609274", "0.5601113", "0.5593302", "0.5589745", "0.55740994", "0.5529965", "0.5507069", "0.5477706", "0.5477212", "0.54709405", "0.5466524", "0.5461191", "0.5456822", "0.54529196", "0.54484713", "0.54454666", "0.54392403", "0.54265875", "0.53989965", "0.5388767", "0.5384895", "0.53825545", "0.5372555", "0.5367663", "0.5362838", "0.5362838", "0.53569806", "0.5348692", "0.5334464", "0.5334464", "0.5334464", "0.5334464", "0.5329061", "0.53167754", "0.5314435", "0.5311923", "0.5311923", "0.5310473", "0.53016627", "0.5298692", "0.52971387", "0.5296087", "0.5289614", "0.52830696", "0.5276222", "0.52747774", "0.5269581", "0.5256478", "0.52561396", "0.52471566", "0.52359366", "0.5234067", "0.52308077", "0.5224781", "0.5224362", "0.52193373", "0.52176434", "0.5216528", "0.52160424", "0.5212604", "0.5212088", "0.5211746", "0.51975715", "0.5195756", "0.5191082", "0.5191082", "0.5191082", "0.51904213", "0.51895833", "0.5187062", "0.5186219", "0.518458" ]
0.66444856
0
Twitter Web Intent Button
function twitterButtonMeta() { if (quoteText.innerText !== "") { const webURL = `https://twitter.com/intent/tweet?text=${quoteText.innerText} - ${quoteAuthor.innerText}`; window.open(webURL, "_blank"); } else { alert("Tweet Data is not yet populated, try again later!"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function twitterButton() {\n var s = s_gi(s_account);\n s.eVar2 = 'Twitter';\n s.events = 'event12';\n s.trackExternalLinks = false;\n s.linkTrackVars = 'eVar2,events';\n s.linkTrackEvents = 'event12';\n s.tl(this, 'o', s.eVar2);\n}", "function tweet() {\n\ttweetBtn.setAttribute(\"href\", \"https://twitter.com/intent/tweet?text=\" + encodeURIComponent(quoteEl.innerHTML + \" \\n\\n-- \" + authorEl.innerHTML))\n\ttweetBtn.style.display = ''\n}", "function tweet() {\n window.open(\"https://twitter.com/intent/tweet?text= \" + randomQuote + \" - \" + randomTitle);\n }", "function sendTweet() { \nwindow.open(\"https://twitter.com/intent/tweet?text=\" + currentQuote + \" \" + currentAuthor);\n \n}", "function tweet() {\n\n openURL('https://twitter.com/intent/tweet?hashtags=quotes&text='\n + encodeURIComponent('\"' + currentQuote + '\" -' + currentAuthor));\n\n /* todo:\n 1. add full twitter api for tweeting a quote without having to use twitter gui\n */\n\n }", "function postTweet() {\n /*preparing href link for twitter button*/\n var quot = 'https://twitter.com/intent/tweet?text='+ quoteList[index].quote + \" \"+quoteList[index].author;\n $(\".btn-twitter\").attr(\"href\", quot);\n }", "function tweet() {\n window.open('https://twitter.com/intent/tweet?hashtags= freecodecamp&text=' + encodeURIComponent(quotes[prevNum][\"quote\"] + ' -' + (quotes[prevNum][\"author\"])));\n}", "function twitter(type){\r\n jQuery('#sonnyGif').attr('onclick', 'analytics(\"twitter_share\")').click();\r\n var hashtag = 'kindnessApp';\r\n if(type == 'finished'){ // compassion challenge finished\r\n var msg = 'I%20finished%20the%2010%20day%20compassion%20challenge!%20That\\'s%2010%20acts%20of%20kindness%20in%2010%20days!%20Try%20it%20now';\r\n }\r\n else{ // pulling kindness from cal view\r\n msg = jQuery('.taskDetail'+ type +' .kindnessTxt').text();\r\n msg = encodeURIComponent(msg);\r\n }\r\n var url = 'http%3A%2F%2Fmrmoonhead.com';\r\n var mrmoonhead = 'mr_moonhead';\r\n var tweet = '?hashtags='+hashtag+'&original_referer=https%3A%2F%2Fdev.twitter.com%2Fweb%2Ftweet-button&ref_src=twsrc%5Etfw&related=twitterapi%2Ctwitter&text=' + msg + '&tw_p=tweetbutton&url=' + url;\r\n \r\n var url = \"https://twitter.com/intent/tweet\" + tweet;\r\n window.open(url, '_blank'); \r\n }", "shareButton(type){\n var str = \"Wow, ik heb zojuist \" + this.score + \" punten van 260 gescoord in \" + this.time + \" op een te gekke memory game!\";\n if(type == \"tweet\"){\n window.open(\"https://twitter.com/intent/tweet?text=\" + encodeURI(str));\n }\n \n }", "function TweetThis() {\n var text = $(\"#text\").text() + $(\"#author\").text();\n window.open(\"https://twitter.com/intent/tweet?text=\" + encodeURIComponent(text));\n}", "tweetButton(evnt, org) {\n let base = '<a class=\"button share\" target=\"_blank\" rel=\"noopener\" href=\"http://twitter.com/home?status=MESSAGE\">Share</a>';\n let msg = `Check out this event by ${org.twitterHandle ? '@' + org.twitterHandle : org.name} - ${evnt.title} `;\n if (msg.length >=106) {\n msg = msg.slice(0, 102);\n msg += '...';\n }\n msg += `https://community-events-pwa.herokuapp.com/event/${evnt.id} #GatherSW`;\n msg = encodeURIComponent(msg);\n return base.replace('MESSAGE', msg);\n }", "function tweet(){\r\n var author = $(\"#content\").text();\r\n var quote = $(\"#author\").text();\r\n window.open(\"https://twitter.com/intent/tweet?text=\"+quote+\" \"+author+\"&hashtags=FamousQuotes\");\r\n}", "function updateTweet(string) {\n var tweetButton = document.getElementById('tweet');\n tweetButton.setAttribute('href', 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(string));\n}", "function tweetQuote() {\n\t\t\twindow.open(`https://twitter.com/intent/tweet?text=${data.quoteText}`);\n\t\t}", "function tweetQuote() {\n\tconst quotee = quote.innerText;\n\tconst authorr = author.innerText;\n\tconst twitterUrl = `https://twitter.com/intent/tweet?text=${quotee} - ${authorr}`;\n\twindow.open(twitterUrl, '_blank')\n}", "function tweetQuote() {\r\n const quote = quoteText.innerText;\r\n const author = authorText.innerText;\r\n const twitterUrl = `https://twitter.com/intent/tweet?text=\"${quote}\"-${author}`;\r\n window.open(twitterUrl, \"_blank\");\r\n }", "function twitterSharer(){\r\n\t'use strict';\r\n\twindow.open( 'http://twitter.com/intent/tweet?text='+jQuery(\"h1.entry-title\").text() +' '+window.location, \r\n\t\t\"twitterWindow\", \r\n\t\t\"width=650,height=350\" );\r\n\treturn false;\r\n}", "function buttonClick() {\n const textbox = document.getElementById(\"message\")\n const value = textbox.value\n const turl = \"https://twitter.com/search?q=\" + value + \"&src=typed_query\"\n open( turl, \"_blank\");\n}", "function tweet(url){\n\n var encoded = encodeURIComponent(url);\n var fullUrl = 'https://twitter.com/share?text=' + encoded;\n\n window.open(fullUrl, 'Twitter', 'width=575,height=400');\n return false;\n }", "function tweetQuote() {\n var tweetUrl = ' https://twitter.com/intent/tweet?text=' + encodeURIComponent(generatedQuote);\n window.open(tweetUrl);\n}", "function twitterLink(URL) {\n const twitterLink = document.querySelector('#twitter-share');\n twitterLink.href = `https://twitter.com/intent/tweet?text=He%20creado%20esta%20tarjeta%20tan%20GUAY%20con%20Awesome%20Profile%20Cards:%0A;hashtags=Adalab, AwesomeProfileCards, promo Idelisa Equipo 2 LAS MEJORES :) ${URL}`;\n}", "function sendTwitter(\n/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\n /**\n * The event object. */\n event\n)\n/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/\n{\n if (event) {\n event.preventDefault();\n }\n alert('Sending message to Twitter will be coming soon.');\n app.log(2, 'Sending message to Twitter: Not yet implemented');\n closeWindow();\n}", "function sendTweet() {\n var tweet = quote.text + \"\\n - \" + quote.author;\n console.log(tweet.slice(0, 136) + '...');\n tweet.length < 141 ? twtLink = 'https://twitter.com/home?status=' + encodeURIComponent(tweet) : twtLink = 'https://twitter.com/home?status=' + encodeURIComponent(tweet.slice(0, 137) + '...');\n\n window.open(twtLink, '_blank');\n}", "handleTweet(){\n\n let url = this.state.quote + ' - ' + this.state.author;\n url += '&hashtags=freeCodeCamp';\n //url = url.replace(' ', '%20');\n url = 'https://twitter.com/intent/tweet?text=' + url;\n \n url = encodeURI(url);\n\n var win = window.open(url, '_blank');\n if (win) {\n //Browser has allowed it to be opened\n \n win.focus();\n } else {\n //Browser has blocked it\n alert('Please allow popups for this website in order to Tweet quotes');\n }\n }", "function template_tw_share(urlObject, dataText) {\n\tvar intentRegex = /twitter\\.com(\\:\\d{2,4})?\\/intent\\/(\\w+)/,\n windowOptions = 'scrollbars=yes,resizable=yes,toolbar=no,location=yes',\n width = 550,\n height = 420,\n winHeight = screen.height,\n winWidth = screen.width;\n\t \n\tleft = Math.round((winWidth / 2) - (width / 2));\n\ttop = 0;\n\n\tif (winHeight > height) {\n\t\ttop = Math.round((winHeight / 2) - (height / 2));\n\t}\n\n\twindow.open(\"https://twitter.com/share?text=\"+dataText+\"&url=http://www.explorainmuebles.com/\"+urlObject, 'intent', windowOptions + ',width=' + width + ',height=' + height + ',left=' + left + ',top=' + top);\n}", "function tweetArticle(itemUrl) {\n const twitterUrl = `https://twitter.com/intent/tweet?text=${itemUrl}`\n window.open(twitterUrl, '_blank')\n}", "function fill_twitter_prompt() {\n $(\"p.hidden3\").hide();\n $(\"p.hidden6\").show();\n var prompt_para = document.getElementById ('tprompt');\n var name1 = $('#name1').val();\n var name2 = $('#name2').val();\n if (name2 != '') {\n name2 = ' and @' + name2;\n }\n var textvalue = os.replace(/#/g, '%23') + ' @' + name1 + name2 + ' ' + cs.replace(/#/g, '%23') + ' %23BizUnited ' + ' %23PassItOn ' + 'www.uschamber.com/bizunited';\n prompt_para.innerHTML = textvalue;\n window.open('https://twitter.com/intent/tweet?text=' + textvalue + '&source=clicktotweet&related=clicktotweet', '', 'resizable=no,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=700,height=300');\n return false;\n }", "function tweetString(string){\n var newString = string.split(' ').join('%20');\n $(\".twitter-share-button\").attr('href', 'https://twitter.com/intent/tweet?text='+newString+' -http://bargeruns.github.io/fridge-words'+'&hashtags=fridgewords');\n}", "function authorizeTwitter() {\n var callbackUrl = window.location.origin + \"/social-media-service/twitter/callback\";\n offerService.post(\"/social-media-service/twitter/authorize\", { 'callbackUrl' : callbackUrl});\n }", "function sendMessage(target, page, title) {\n if ('twitter' === target) {\n document.location.href = `https://twitter.com/intent/tweet?original_referer=${encodeURI(page)}&text=${encodeURI(title) + ' @DevMindFr'}&tw_p=tweetbutton&url=${encodeURI(page)}`;\n }\n else if ('linkedin' === target) {\n document.location.href = `https://www.linkedin.com/shareArticle?mini=true&url=${encodeURI(page)}&text=${encodeURI(title)}`;\n }\n }", "function tweetQuote() {\n var tweetLink = \"http://twitter.com/home?status=\" + ($(\".quotetext\").html()).slice(3, -7) + $(\".author\").html();\n window.open(tweetLink, \"_blank\");\n}", "postTweet(){\n\n rl.question('Have a tweet in mind?: ', (answer) => {\n twi.post('statuses/update', { status: answer }, function(err, data, response) {\n console.log(data)\n });\n rl.close();\n });\n }", "handleShareQuote() {\n // retrieve the text and author from state, include them in the tweet to be shared\n let text = this.state.quote.text;\n let author = this.state.quote.author;\n\n let tweet = `\"${text}\" - ${author} `;\n \n var url = `https://twitter.com/intent/tweet?hashtags=wisdom&text=${tweet}`;\n window.open(url);\n\n }", "function myFunction(data){\r\n\t//alert(\"You just clicked me!! selection is: \"+selectedText.selectionText);\r\n\tswitch(data.menuItemId){\r\n\t\tcase 'selection' :\r\n\t\tchrome.windows.create({url: \"https://twitter.com/intent/tweet?text=\"+encodeURIComponent(data.selectionText), type: \"panel\" }); // panel removes all the unwanted data like URL and other info\r\n\t\tbreak;\r\n\t\tcase 'link':\r\n\t\tchrome.windows.create({url: \"https://twitter.com/intent/tweet?url=\"+encodeURIComponent(data.linkUrl), type: \"panel\" });\r\n\t\tbreak;\r\n\t\tcase 'image':\r\n\t\tchrome.windows.create({url: \"https://twitter.com/intent/tweet?url=\"+encodeURIComponent(data.srcUrl), type: \"panel\" });\r\n\t\tbreak;\r\n\t\tcase 'page':\r\n\t\tchrome.windows.create({url: \"https://twitter.com/intent/tweet?text=\"+encodeURIComponent(tab.pageUrl)+\"&url\"+(data.pageUrl), type: \"panel\" });\r\n\t\tbreak;\r\n\t}\r\n\r\n// we can also use tabs.create but we are using window to show the tweet in a new window\r\n//\tchrome.tabs.create({url: \"https://twitter.com/intent/tweet?text=\"+selectedText.selectionText})\r\n\r\n}", "function open_url(name, id) {\nwindow.open('https://twitter.com/'+ name + '/status/' + id, '_blank');\n}", "function onClick(data, tab) {\n switch (data.menuItemId) {\n case \"selection\":\n chrome.windows.create({\n url: \"https://twitter.com/share?text=\" + encodeURIComponent(data.selectionText), type: \"panel\"\n });\n break;\n case \"link\":\n chrome.windows.create({\n url: \"https://twitter.com/share?url=\" + encodeURIComponent(data.linkUrl), type: \"panel\"\n });\n break;\n case \"image\":\n chrome.windows.create({\n url: \"https://twitter.com/share?url=\" + encodeURIComponent(data.srcUrl), type: \"panel\"\n });\n break;\n case \"page\":\n chrome.windows.create({\n url: \"https://twitter.com/share?text=\" + encodeURIComponent(tab.title)\n + \"&url=\" + data.pageUrl, type: \"panel\"\n });\n break;\n }\n}", "function generateTweetableUrl(text, url, handleName) {\r\n\r\n var tweetableText = \"https://twitter.com/intent/tweet?url=\" + url + \"&via=\" + handleName + \"&text=\" +\r\n encodeURIComponent(\r\n text);\r\n\r\n\r\n return tweetableText;\r\n}", "function twitterSuccessShare(title){\nvar title = encodeURIComponent(title)\nvar url = window.location.href;\n \n var accessToken = \"263e96a9d0ed9adf248346cffb51acde1edcb490\";\n\n var params = {\n\t\t\t\"long_url\": url,\t\t\t\n\t\t\t\"group_guid\": \"Bd2jeFNJyhx\",\n\t\t\t\"domain\": \"bitly.com\"\t\t\n };\n\n $.ajax({\n url: \"https://api-ssl.bitly.com/v4/shorten\",\n cache: false,\n dataType: \"json\",\n method: \"POST\",\n contentType: \"application/json\",\n beforeSend: function (xhr) {\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + accessToken);\n },\n data: JSON.stringify(params)\n \t\t\t\t\t}).done(function(data) {\n\t\t\t\t\t\t//alert(\"1\");\n url = String(data.link);\n\n \t var twitterUrl = 'https://twitter.com/intent/tweet?url='.concat(url)+'&text='+title;\n \tvar width=500, height=500;\n\t\t\t\t\t\tvar left = (window.screen.width / 2) - ((width / 2) + 10);\n \t\t\t\t\tvar top = (window.screen.height / 2) - ((height / 2) + 50);\n \t\t\t\t\t var popUp = window.open(twitterUrl,'popupwindow','scrollbars=no,width='+ width +',height='+ height +',top='+ top +', left='+ left +'');\n \t\t\t\t\t\t //popUp.focus();\n\n\n \t\t}).fail(function(data) {\n \t\t\t\t\tconsole.log(data);\n \t\t\t\t\t});\n\treturn false;\n}", "function clickHandler() {\n addTweet(tweetInput);\n setTweetInput(\"\");\n }", "function buildTwitterButton () {\n try {\n \t$(\".twitter-share-button[data-twttr-rendered!=true]\").each(function(){\n\t\t\ttwttr.widgets.load(this.parentNode);\n\t\t});\n } catch (ex) {\n twitterTimeout = setTimeout(buildTwitterButton, 50);\n }\n}", "function init() {\n let postUrl = encodeURI(document.location.href);\n let postTitle = encodeURI(\"Hi everyone, please check this out.\");\n facebookBtn.setAttribute(\"href\", `https://www.facebook.com/sharer.php?u=${postUrl}`);\n twitterBtn.setAttribute(\"href\", `https://twitter.com/share?url=${postUrl}&text=${postTitle}`);\n}", "function tweetJoke() {\n\tvar joke = $('#output').text();\n\tvar tweetURL = \"https://twitter.com/intent/tweet?text=\";\n\n\t//Reduce size of tweet to 140 characters if longer\n\tif (joke.length > 140) {\n\t\tvar truncJoke = joke.substring(0, 137) + '...';\n\t\ttweetURL += truncJoke;\n\t} else {\n\t\ttweetURL += joke;\n\t}\n\t//Open tweet window\n\twindow.open(tweetURL);\n}", "function tweetIt(txt) {\n\n\tvar tweet = {\n\t\tstatus: txt\n\t}\n\tT.post('statuses/update', tweet, tweeted);\n\n}", "function onShareButtonTouched(e){\n\tvar Social = require(\"dk.napp.social\");\n\t\t\n\tSocial.activityView({\n\t text: media.link + \" via @getinstagrid\",\n\t\tview: $.shareButton,\n\t removeIcons:\"sms,copy\"\n\t});\n\t\n\t// The example below, shows how to add \"custom ones\"\n\t// Social.activityView({\n// \t text: media.link + \" via @getinstagrid\",\n// \t\tview: $.shareButton,\n// \t //removeIcons:\"print,sms,copy,contact,camera,mail\"\n// \t},[\n// \t {\n// \t title:\"Custom Share\",\n// \t type:\"hello.world\",\n// \t image:\"pin.png\"\n// \t },\n// \t {\n// \t title:\"Open in Safari\",\n// \t type:\"open.safari\",\n// \t image:\"safari.png\"\n// \t }\n// \t]);\n\t\n\tSocial.addEventListener(\"complete\", function(e){\n\t\tTi.API.info(\"complete: \" + e.success);\n\n\t\tif (e.platform == \"activityView\" || e.platform == \"activityPopover\") {\n\t\t\tswitch (e.activity) {\n\t\t\t\tcase Social.ACTIVITY_TWITTER:\n\t\t\t\t\tTi.API.info(\"User is shared on Twitter\");\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase Social.ACTIVITY_CUSTOM:\n\t\t\t\t\tTi.API.info(\"This is a customActivity: \" + JSON.stringify(e));\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t});\n}", "function socialShare(s){\n console.log(s);\n // Twitter API\n twitterButton.addEventListener('click',function(){\n sharingText = {\n 'score' : `${s}`,\n 'text' : `I scored in TypeR test ! Check out typer and test your typing speed !`\n }\n tweet.setAttribute('href', `https://twitter.com/intent/tweet?text=Check%20out%20TypeR%20!%20My%20typing%20speed%20is%20${sharingText.score}WPM.`);\n })\n // Facebook API\n fbBtn.addEventListener('click',function(){\n fbPost.setAttribute('href', `https://www.facebook.com/sharer/sharer.php?u=&quote=Check out typer ! My typing speed is ${s} WPM`);\n })\n}", "function share_link() {\n let postUrl = encodeURI(document.location.href)\n let postTitle = encodeURI('Hi, please click here to join the meeting: ')\n facebookBtn.setAttribute(\n 'href',\n `https://www.facebook.com/sharer.php?u=${postUrl}`\n )\n linkedinBtn.setAttribute(\n 'href',\n `https://www.linkedin.com/shareArticle?url=${postUrl}&title=${postTitle}`\n )\n whatsappBtn.setAttribute(\n 'href',\n `https://wa.me/?text=${postTitle} ${postUrl}`\n )\n}", "function addButton(){\n \t\t$(window).load(function(){\n \t\t\tvar $href = $(\"#single-tweet-feed\").find(\".user a\").attr(\"href\");\n \t\t\t$('#single-tweet-feed ul').append('<a href=\"'+$href+'\" class=\"twitter-link button\">View more on twitter</a>');\n \t\t\t$('#single-tweet-feed').find(\"a\").attr(\"target\",\"_blank\");\n \t\t});\n \t}", "function twitText() {\r\n var s, url;\r\n s = encodeURIComponent(\"#なとりすと\");\r\n url = document.location.href;\r\n\r\n if (s != \"\") {\r\n if (s.length > 140) {\r\n \t //文字数制限\r\n\t\t alert(\"テキストが140字を超えています\");\r\n\t } else {\r\n\t\t //投稿画面を開く\r\n\t\t url = \"http://twitter.com/share?text=\" + s;\r\n\t\t window.open(url,\"_system\",\"width=600,height=300\");\r\n }\r\n }\r\n}", "function tweet(message){\n\n\t}", "function updateTwitterStatus()\r\n{\r\n var client = aa.oAuthClient;\r\n var oauthProviderCode = 'TWITTER';\r\n var url = 'https://api.twitter.com/1/statuses/update.tpsdjb';\r\n var params = client.initPostParameters();\r\n params.put('status', 'This is a message sent from V360!');\r\n var scriptResult = client.post(oauthProviderCode, url, params);\r\n if (scriptResult.getSuccess())\r\n {\r\n aa.print(\"Success: \" + scriptResult.getOutput());\r\n }\r\n else\r\n {\r\n aa.print(\"Failure: \" + scriptResult.getErrorMessage());\r\n }\r\n}", "function tweetChange(quoteIdx) {\n var tweetArr = quoteArr[quoteIdx].slice(0);\n var tweetStr = \"\";\n // Add \" -\" at index 1 of quote array and join to tweetStr\n tweetArr.splice(1, 0, \" -\");\n tweetStr = tweetArr.join(\"\");\n //create tweet url\n document.getElementById(\"tweet-link\").href =\n \"https://twitter.com/intent/tweet?text=\" + encodeURIComponent(tweetStr);\n}", "function tooter() {\n\n const toot = {\n status: generate()\n }\n\n // Post that tweet!\n M.post('statuses', toot, (err, data) => {\n if (err) {\n console.log(err);\n } else {\n console.log(data.content);\n }\n });\n}", "function tweets () {\n\n\n\n}", "function clickTweet(d) {\n\n\t// Remove results from old click\n\tclickView();\n\n\t// Get tweet\n\tvar tweet = d3.select(this)\n\n\t// Set tweet to clicked\n\ttweet.classed(\"clicked\", true);\n\n\t// Get tweet div\n\t// Cannot do d3.select because twttr doesn't handle D3 selections\n\tvar tweetDiv = document.getElementById(\"tweet\");\n\n\t// Display tweet\n twttr.widgets.createTweet(d.CurrentTwID, tweetDiv)\n}", "function twitterSuccessStoriesShare(url, title){\n\tvar external = \"http://\";\n var secureExternal = \"https://\";\n var res = url.match(external)||url.match(secureExternal);\n if(res==null){\n var domain=window.origin;\n url=domain.concat(url);\n }\n \n var accessToken = \"263e96a9d0ed9adf248346cffb51acde1edcb490\";\n\n var params = {\n\t\t\t\"long_url\": url,\t\t\t\n\t\t\t\"group_guid\": \"Bd2jeFNJyhx\",\n\t\t\t\"domain\": \"bitly.com\"\t\t\n };\n\n $.ajax({\n url: \"https://api-ssl.bitly.com/v4/shorten\",\n cache: false,\n dataType: \"json\",\n method: \"POST\",\n contentType: \"application/json\",\n beforeSend: function (xhr) {\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + accessToken);\n },\n data: JSON.stringify(params)\n \t\t\t\t\t}).done(function(data) {\n\t\t\t\t\t\t//alert(\"1\");\n url = String(data.link);\n\n \t var twitterUrl = 'https://twitter.com/intent/tweet?url='.concat(url)+'&text='+title;\n \tvar width=500, height=500;\n\t\t\t\t\t\tvar left = (window.screen.width / 2) - ((width / 2) + 10);\n \t\t\t\t\tvar top = (window.screen.height / 2) - ((height / 2) + 50);\n \t\t\t\t\t var popUp = window.open(twitterUrl,'popupwindow','scrollbars=no,width='+ width +',height='+ height +',top='+ top +', left='+ left +'');\n \t\t\t\t\t\t //popUp.focus();\n\n\n \t\t}).fail(function(data) {\n \t\t\t\t\tconsole.log(data);\n \t\t\t\t\t});\n\treturn false;\n}", "function twitterEmbed() {\n //following converts html from Twitter embed into jquery to build on the fly so not hardcoded into html\n $(\"<a class=twitter-timeline href=https://twitter.com/jessimagallon?ref_src=twsrc%5Etfw>\").append(\"Tweets by jessimagallon\").append(\n $(\"<script async src=https://platform.twitter.com/widgets.js charset=utf-8>\")\n ).appendTo(\"#twitter-list\");\n}", "function twitterCommand() {\n var params = { screen_name: 'projectproject4' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n log(\"my-tweets was run and returned the following informtion: \")\n if (!error) {\n for (i = 0; i < 20 && i < tweets.length; i++) {\n console.log(\"-----------------------------------------------\" +\n \"\\nTweet #\" + (i + 1) +\n \"\\nTweeted at: \" + tweets[i].created_at+\n \"\\n\"+tweets[i].text);\n log( \n \"\\nTweet #\" + (i + 1) +\n \"\\nTweeted at: \" + tweets[i].created_at+\n \"\\n Tweet Conent:\" + tweets[i].text+\n \"\\n------------------------------------------------------------\"\n\n );\n };\n }\n });\n\n}", "function showTweet(){\n\t\t$( \".tweet\" ).each(function( index ) {\n\t\t\tvar tweet = $(this)[0];\n\t\t\tvar id = $(this).data(\"tweet\");\n\n\t\t\ttwttr.widgets.createTweet(\n\t\t\t id, tweet, \n\t\t\t\t{\n\t\t\t\t\tconversation : 'none', // or all\n\t\t\t\t\tcards : 'visible', // or visible \n\t\t\t\t\t//linkColor : '#900', // default is blue\n\t\t\t\t\ttheme : 'light' // or dark\n\t\t\t\t})\n\n\t\t});\n\n\t}", "function followed(eventMsg) {\n \tvar name = eventMsg.source.screen_name;\n \ttweetWelcome(name);\n }", "function getFacebookButtonTour(){\r\n\tvar buttonHTML = \"<a data-role=button data-theme='a' href='https://www.facebook.com/dialog/feed?app_id=367025673393589&\";\r\n\t\tbuttonHTML += \"link=https://developers.facebook.com/docs/reference/dialogs/&picture=http://trophyhunterfb.s3-website-eu-west-1.amazonaws.com/TrophyHunter/\";\r\n\t\tbuttonHTML += tourBadge;\r\n\t\tbuttonHTML += \"&name=Trophy Hunter&caption=\" + tourName;\r\n\t\tbuttonHTML += \"Badge&description=I just got a Bagde in Trophy Hunter, join me!\"\r\n\t\t//buttonHTML += \"&redirect_uri=https://powerful-depths-8756.herokuapp.com/'>Post on FB Wall</a> </center>\"\r\n\t\tbuttonHTML += \"&redirect_uri=https://www.facebook.com/'>Post on FB Wall</a>\"\r\n\treturn buttonHTML;\r\n}", "function infosysFoundationTwitterSuccessShare(url, title){\n\n var external = \"http://\";\n var secureExternal = \"https://\";\n var res = url.match(external)||url.match(secureExternal);\n if(res==null){\n var domain=window.origin;\n url=domain.concat(url);\n }\n var accessToken = \"263e96a9d0ed9adf248346cffb51acde1edcb490\";\n\n var params = {\n\t\t\t\"long_url\": url,\t\t\t\n\t\t\t\"group_guid\": \"Bd2jeFNJyhx\",\n\t\t\t\"domain\": \"bitly.com\"\t\t\n };\n\n $.ajax({\n url: \"https://api-ssl.bitly.com/v4/shorten\",\n cache: false,\n dataType: \"json\",\n method: \"POST\",\n contentType: \"application/json\",\n beforeSend: function (xhr) {\n xhr.setRequestHeader(\"Authorization\", \"Bearer \" + accessToken);\n },\n data: JSON.stringify(params)\n \t\t\t\t\t}).done(function(data) {\n\t\t\t\t\t\t//alert(\"1\");\n url = String(data.link);\n\n \t var twitterUrl = 'https://twitter.com/intent/tweet?url='.concat(url)+'&text='+title;\n \t\t\t\t\t var popUp = window.open(twitterUrl,'popupwindow','scrollbars=yes,width=500,height=600');\n\n\n \t\t}).fail(function(data) {\n \t\t\t\t\tconsole.log(data);\n \t\t\t\t\t});\n\treturn false;\n}", "function respondToTweet(event) {\n // sanitise tweet text by removing punctuation and converting to lowercase\n var text = event.text;\n text = text.toLowerCase().replace(/[.,\\/#!$%\\^&\\*;:{}=\\-_`~()?]/g, '');\n\n oscClient.send('/update', text, event.user.profile_link_color, function (err) {\n if (err) {\n console.error(new Error(err));\n }\n else {\n // leave a second so oF has time to do its thang\n setTimeout(function() {sendReply(event)}, 1000);\n }\n });\n}", "function Tweet(content) {\n T.post('statuses/update', { status: content }, function (err, reply) {\n if (err)\n Log(\"error: \" + err);\n else\n Log(\"reply: \" + reply);\n });\n}", "function tweetIt(txt) {\n\n\tvar tweet = {\n\t\tstatus: txt\n\t}\n\n\t//Makes the bot account post a status update.\n\tT.post('statuses/update', tweet, tweeted);\n\n\t//Nested function that logs strings to the console. Makes it easier to see\n\t//if the bot works or not\n\tfunction tweeted(err, data, response) {\n\t\tif (err) {\n\t\t\tconsole.log(\"Error posting tweet respone - MESSAGE\");\n\t\t} else {\n\t\t\tconsole.log(\"Citizen participation noticed - MESSAGE\");\n\t\t}\n\t}\n}", "function useIntent() {\n\n tryWebkitApproach();\n // window.location = g_intent;\n }", "fbShareButtonClick() {\n\n\t\tconst quoteMessage= \n\t\t\t(this.state.request) ?\n\t\t\t\t`Fuckinator fuckinated my fucking text from \"${this.state.request}\" to: \"${this.state.response}\"`: null;\n\n\t\twindow.FB.ui({\n\t\t\tmethod: 'share',\n\t\t\thref: 'http://fuckinator.herokuapp.com/',\n\t\t\thashtag: '#fuckinator',\n\t\t\tmobile_iframe: true,\n\t\t\tquote: quoteMessage,\n\t\t}, res => {});\n\t}", "function makeTweet(mytweet) {\r\n\r\n console.log('Atttempting Tweet...');\r\n // .post takes an object as input\r\n var tweet = {\r\n status: mytweet\r\n\r\n };\r\n // if (tweet.status) {\r\n console.log(\"posting......\");\r\n console.log(\"status to be posted: \" + tweet.status);\r\n T.post('statuses/update', tweet, tweeted);\r\n // }\r\n\r\n function tweeted(err, data, response) {\r\n if (err) {\r\n console.log('something went wrong');\r\n console.log(data);\r\n urls = [];\r\n }\r\n else {\r\n console.log('Tweet successful');\r\n //console.log(data);\r\n prev_tweet = data.text;\r\n }\r\n }\r\n}", "function confirmTweet(user, name, id) {\r\n\taxios.post('https://slack.com/api/chat.postMessage', qs.stringify({\r\n\t\ttoken: process.env.SLACK_ACCESS_TOKEN,\r\n\t\tchannel: user,\r\n\t\ttext: 'Tweet sent! \\n https://twitter.com/' + name + '/status/' + id\r\n }));\r\n}", "function facebookShare(type){ \r\n jQuery('#sonnyGif').attr('onclick', 'analytics(\"facebook_share\")').click();\r\n if(type == 'finished'){\r\n var msg = 'I finished the 10 day compassion challenge! That\\'s 5 acts of kindness in 5 days! Try it now';\r\n }\r\n else{\r\n msg = jQuery('.taskDetail'+ type +' .kindnessTxt').text();\r\n }\r\n FB.ui({\r\n quote: msg,\r\n hashtag: '#kindness',\r\n method: 'share',\r\n mobile_iframe: true,\r\n href: 'http://thekindnessapp.com',\r\n }, function(response){});\r\n }", "function social_share(network)\n{\n var intent;\n switch (network)\n {\n case 'diaspora':\n intent = 'https://sharetodiaspora.github.io/?title=Look%20at%20this%20OpenBeerMap!&url=';\n break;\n case 'twitter':\n intent = 'https://twitter.com/intent/tweet?text=Look%20at%20this%20OpenBeerMap!&hashtags=openbeermap,beer,osm&url='\n break;\n case 'facebook':\n intent = 'https://www.facebook.com/sharer/sharer.php?p[url]=';\n break;\n default:\n return false;\n }\n window.location.assign(intent + document.URL);\n}", "function twitterCall() {\n\nvar twitterQuestion = [\n {\n type: 'input',\n name: 'twitterHandleInput',\n message: \"Input the Twitter Handle of the user's tweets to display\"\n }\n]\n\nfunction displayTweets() {\n inquirer.prompt(twitterQuestion).then(function(answers) {\n var twitterClient = new twitter( {\n consumer_key: twitterKeys.consumer_key,\n consumer_secret: twitterKeys.consumer_secret,\n access_token_key: twitterKeys.access_token_key,\n access_token_secret: twitterKeys.access_token_secret,\n })\n var twitterHandle = answers.twitterHandleInput;\n params = {screen_name: twitterHandle};\n twitterClient.get('statuses/user_timeline/', params, function(error, data, response) {\n\n if (!error) {\n for(var i = 0; i < data.length; i++) {\n var twitterResults =\n\t\t\t\t\t\"@\" + data[i].user.screen_name + \": \" +\n\t\t\t\t\tdata[i].text + \"\\r\\n\" +\n\t\t\t\t\tdata[i].created_at + \"\\r\\n\" +\n\t\t\t\t\t\"------------------------------ \" + i + \" ------------------------------\" + \"\\r\\n\";\n\t\t\t\t\tconsole.log(twitterResults);\n console.log(params);\n }\n } else {\n console.log(\"Error :\" + error);\n return;\n }\n\n })\n })\n }\n displayTweets()\n}", "function changeTweetLink(quote, title) {\n $('#tweet-container').html(\"\");\n twttr.widgets.createShareButton(\n '/',\n document.getElementById(\"tweet-container\"),\n {\n text: shortenTweet(quote, title),\n }\n );\n}", "function twitter(){\n\t\tvar client = new Twitter({\n\t\t\tconsumer_key: '',\n\t\t\tconsumer_secret:'',\n\t\t\taccess_token_key:'', \n\t\t\taccess_token_secret:''\n\t\t});\n\t\tvar params = {screen_name: 'Dov Vah Kiin', count: 20};\n\t\t\n\t\t// console.log('retrieving tweets');\n\n\t\tclient.get('statuses/user_timeline', function(error, tweets, response){\n\t\t\t// console.log('back from request');\n\t\t // if(input === 'my-tweets'){\n\t\t \tif(error){\n\t\t\t\tconsole.log(error);\n\t\t\t\treturn;\n\t\t\t}\n\t\tconsole.log(tweets[0].text);\n\t\t \tfor(var i = 0; i < tweets.length; i++){\n\t\t\t\tconsole.log('===My Tweets ===');\n\t\t\t\tconsole.log(tweets[i].text);\n\t\t\t} \n\n\t\t // }\t\t\n\t\t});\n\t\t// twitter();\n\t}", "function viewHandler2 () {\n var storageKey = msg.storageKey + \"_TwitterScrapper_Tweets\";\n\n /* Set Profile by obtaining tweetAuthor, tweetHandle, tweetId and tweet fields */\n function setProfile (elem) {\n var tweetAuthor = elem.getAttribute(\"data-name\"); // Get tweetAuthor\n var tweetHandle = elem.getAttribute(\"data-screen-name\"); // Get tweetHandle\n var tweetId = elem.getAttribute(\"data-tweet-id\"); // Get tweetId\n var tweetDate = elem.children[1].children[0].children[1].children[0].getAttribute(\"title\"); // Get tweetDate\n var text = elem.querySelectorAll(\".tweet-text\");\n var retweetedAuthor = \"\", retweetedHandle = \"\";\n text = Array.from(text);\n var tweetText = \"\", retweetedText = \"\";\n if (elem.getAttribute(\"data-retweet-id\") == undefined) {\n // Tweet is original\n tweetText = text[0].textContent;\n }\n else {\n retweetedAuthor = tweetAuthor;\n retweetedHandle = tweetHandle;\n tweetHandle = elem.getElementsByClassName(\"js-retweet-text\")[0].children[0].getAttribute(\"href\");\n tweetHandle = \"@\" + tweetHandle.slice(1);\n tweetAuthor = elem.getElementsByClassName(\"js-retweet-text\")[0].children[0].children[0].textContent;\n // Tweet is part of a retweet\n try {\n // User has retweeted with a text\n tweetText = text[0].textContent;\n retweetedText = text[1].textContent\n } catch (e) {\n if (e) {\n // User has retweeted without any original text\n tweetText = \"\";\n retweetedText = text[0].textContent;\n }\n }\n }\n // Profile\n var profile = {\"tweetText\": tweetText,\n \"retweetedText\": retweetedText,\n \"tweetDate\": tweetDate,\n \"tweetAuthor\": tweetAuthor + \" \" + retweetedAuthor,\n \"tweetHandle\": tweetHandle + \" \" + retweetedHandle,\n \"tweetId\": tweetId};\n return profile;\n }\n var targetNode = document.getElementById(\"stream-items-id\");\n var tweetsData = [];\n var dataStorage = [];\n var sendData = false;\n chrome.storage.local.get([storageKey], function (result) {\n if (result[storageKey] == undefined) {\n var tweets = document.getElementsByClassName(\"tweet\");\n var tweetsSize = tweets.length; // Count the number of tweets\n console.log(\"Traversing tweets\");\n for (var i=0; i<tweetsSize; i++){\n var profile = setProfile(tweets[i]);\n if (!dataStorage.includes(JSON.stringify(profile))) {\n // Tweet is not yet processed\n dataStorage.push(JSON.stringify(profile));\n tweetsData.push(profile);\n }\n }\n chrome.storage.local.set({[storageKey]: JSON.stringify(dataStorage)}, function () {\n console.log(\"Updating storage\");\n sendData = true;\n });\n }\n else {\n console.log(\"Waiting for changes\");\n // Observe if nodes are added to the list\n const mutationConfig = {childList: true};\n const mutationCallback = function (mutationList, observer) {\n if (mutationList.length > 0) {\n // Changes in the number of tweets\n console.log(\"Mutation detected\");\n var dataStorage = JSON.parse(result[storageKey]);\n var tweetsData = [];\n for (var i=0; i<mutationList.length; i++) {\n if (mutationList[i].type == \"childList\") {\n // Check through the new tweets that are added\n var addedNodes = mutationList[i].addedNodes;\n for (var j=0; j<addedNodes.length; j++) {\n var tweet = addedNodes[j].children[0];\n var profile = setProfile(tweet);\n dataStorage.push(JSON.stringify(profile));\n tweetsData.push(profile);\n }\n // Check through the tweets that are removed\n var removedNodes = mutationList[i].removedNodes;\n for (var j=0; j<removedNodes.length; j++) {\n var tweet = removedNodes[j].children[0];\n var profile = setProfile(tweet);\n dataStorage = removeElement(dataStorage, JSON.stringify(profile));\n tweetsData = removeElement(tweetsData, profile);\n }\n }\n }\n chrome.storage.local.set({[storageKey]: JSON.stringify(dataStorage)}, function () {\n console.log(\"Updating storage\");\n sendData = true;\n });\n }\n }\n const observer = new MutationObserver(mutationCallback);\n observer.observe(targetNode, mutationConfig);\n }\n });\n var awaitData = setInterval(function() {\n if (sendData) {\n sendResponse(tweetsData);\n clearInterval(awaitData);\n }\n }, 100);\n }", "function speakTweet(currentElement)\r\n{\r\n var compStr = \"\", tempStr = \"\";\r\n var realnameA = new Array();\r\n realnameA = getElementsByClassName(currentElement.elem,\"img\",\"photo fn\");\r\n compStr += realnameA[0].getAttribute(\"alt\");\r\n\r\n usernameA = new Array();\r\n usernameA = getElementsByClassName(currentElement.elem,\"a\",\"tweet-url screen-name\");\r\n compStr += \" with twitter name \" + usernameA[0].innerHTML + \" says. \";\r\n\r\n // Replace URLs\r\n var hrefArray = currentElement.elem.getElementsByTagName('a');\r\n var j=0;\r\n for(var i=0; i<hrefArray.length;i++)\r\n {\r\n if(hrefArray[i].className == \"tweet-url web\") \r\n {\r\n j++;\r\n var replStr = \"; Link\"+j+\";\";\r\n hrefArray[i].innerHTML = replStr;\r\n }\r\n }\r\n // end of Replace URLs\r\n\r\n messageA = new Array();\r\n usernameA = getElementsByClassName(currentElement.elem,\"span\",\"entry-content\");\r\n tempStr = removeHTMLTags(usernameA[0].innerHTML);\r\n compStr += tempStr;\r\n compStr = compStr.replace(/[!#^(){}\\[\\]\\\\<>\\|]/gi,\"\");\r\n\t\r\n\t axsTweet.axsLensObj.view(currentElement.elem);\r\n currentElement.elem.scrollIntoView(true);\r\n axsTweet.axsJAXObj.speakTextViaNode(compStr);\r\n}", "function myTweets(action) {\n if (action == undefined) { action = \"\"; } //setting action to be to be a defualt account, but the user can also pass in any other account\n var params = { screen_name: action };\n client.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n for (var i = 0; i < tweets.length; i++) {\n console.log(tweets[i].created_at + \" \" + tweets[i].text);\n }\n }\n });\n}", "function tweet(text){\n\tvar tweet = {\n\t\tstatus: text\n\t}\n\n\tT.post('statuses/update', tweet, tweeted);\n\n\tfunction tweeted(err, data, response){\n\t\tif(err){\n\t\t\tconsole.log(err);\n\t\t} \n\t\telse {\n\t\t\tconsole.log(\"It worked!\");\n\t\t}\n\t}\n}", "tweet(status) {\n return this.post({\n path: '/statuses/update',\n params: {\n status,\n }\n });\n }", "function share(action){\r\n\tvar loc = location.href\r\n\tloc = loc.substring(0, loc.lastIndexOf(\"/\") + 1);\r\n\tvar title = shareTitle.replace(\"[SCORE]\", playerData.newScore);\r\n\tvar text = shareTitle.replace(\"[SCORE]\", playerData.newScore);\r\n\tvar shareurl = '';\r\n\t\r\n\tif( action == 'twitter' ) {\r\n\t\tshareurl = 'https://twitter.com/intent/tweet?url='+loc+'&text='+text;\r\n\t}else if( action == 'facebook' ){\r\n\t\tshareurl = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(loc+'share.php?desc='+text+'&title='+title+'&url='+loc+'&thumb='+loc+'share.jpg');\r\n\t}else if( action == 'google' ){\r\n\t\tshareurl = 'https://plus.google.com/share?url='+loc;\r\n\t}\r\n\t\r\n\twindow.open(shareurl);\r\n}", "function twitterCallback2(twitters) {\n var statusHTML = [];\n for (var i=0; i<twitters.length; i++){\n var username = twitters[i].user.screen_name;\n var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\\:\\/\\/[^\"\\s\\<\\>]*[^.,;'\">\\:\\s\\<\\>\\)\\]\\!])/g, function(url) {\n return '<a href=\"'+url+'\">'+url+'</a>';\n }).replace(/\\B@([_a-z0-9]+)/ig, function(reply) {\n return reply.charAt(0)+'<a href=\"http://twitter.com/'+reply.substring(1)+'\">'+reply.substring(1)+'</a>';\n });\nstatusHTML.push('<div style=\"width:330px\"><div style=\"float:left;width:30px;\"></div><div style=\"float:left;width:300px;\"><p id=\"tweet_text\">“'+status+'” – <small>'+relative_time(twitters[i].created_at)+'</small></p></div></div><div style=\"clear:both;\"></div><hr color=\"#6192b9\" size=\"1\" width=\"100%\">');\n }\n$('.loading').fadeOut(750, function() {\n $('#latest_tweet').append($(statusHTML.join('')).hide().fadeIn(750));\n});\n}", "function tweet(content) {\n params = {\n status: content\n }\n T.post('statuses/update', params, postTweet);\n}", "onLearnMore_() {\n chrome.send('oauthEnrollOnLearnMore');\n }", "function postTweet(screen_name, id, status){\n\tconsole.log(id);\n\tconsole.log(status);\n\t$.ajax({\n\t\ttype: 'POST',\n\t\tdataType: 'json',\n\t\turl: 'twitter/tweet/',\n\t\tdata: {\"id\":id, \"status\":status},\n\t\tsuccess: function(data){\n\t\t\tconsole.log(\"Posted successfully\")\n\t\t\tusedIds = [];\n\t\t\tupdateMentionTweets();\n\t\t},\n\t\terror: function(data){\n\t\t\tconsole.log(\"Could not post tweet :(\");\n\t\t}\n\t});\n}", "function twitterCallback2(twitters) {\n var statusHTML = [];\n for (var i=0; i<twitters.length; i++){\n var username = twitters[i].user.screen_name;\n var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\\:\\/\\/[^\"\\s\\<\\>]*[^.,;'\">\\:\\s\\<\\>\\)\\]\\!])/g, function(url) {\n return '<a href=\"'+url+'\">'+url+'</a>';\n }).replace(/\\B@([_a-z0-9]+)/ig, function(reply) {\n return reply.charAt(0)+'<a href=\"http://twitter.com/'+reply.substring(1)+'\">'+reply.substring(1)+'</a>';\n });\n statusHTML.push('<li>'+status+' <a href=\"http://twitter.com/'+username+'/statuses/'+twitters[i].id+'\">'+relative_time(twitters[i].created_at)+'</a></li>');\n }\n document.getElementById('twitter_update_list').innerHTML = statusHTML.join('');\n}", "function auth() {\n if (twitter.length === 0) return;\n window.location = venmo + twitter;\n }", "function myTweets(){\nvar params = {screen_name: 'YunkerGrant'};\nconsole.log(\"\\n========= Tweets of '\"+ params.screen_name +\"' ======\");\nclient.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n for(i=0; i < tweets.length; i++){\n console.log(\"Tweet #\"+[i+1]+\": \"+tweets[i].text);\n } console.log(\"\\n\");\n};\n});\n}", "function tweet(statusMsg, screen_name, status_id){\n\tconsole.log('Sending tweet to: ' + screen_name);\n\tconsole.log('In response to:' + status_id);\n\tvar msg = statusMsg;\n\tvar status_id_response = status_id;\n\tif (screen_name != null){\n\t\tmsg = '@' + screen_name + ' ' + statusMsg;\n\t}\n\tconsole.log('Tweet:' + msg);\n\tTwitter.post('statuses/update', {\n\t\tstatus: msg,\n\t\tin_reply_to_status_id: status_id_response\n\t\t}, function(err, response) {\n\t\t\t// if there was an error while tweeting\n\t\t\tif (err) {\n\t\t\t\tconsole.log('Something went wrong while TWEETING...');\n\t\t\t\tconsole.log('screen_name: '+screen_name+\" msg: \"+msg);\n\t\t\t\tconsole.log(err);\n\t\t\t}\n\t\t\telse if (response) {\n\t\t\t\tconsole.log('Tweeted!!!');\n\t\t\t\t//console.log(response)\n\t\t\t}\n\t});\n}", "function twitterCommand() {\n\tvar client = new Twitter({\n\t\t\tconsumer_key: key.twitterKeys.consumer_key,\n\t\t\tconsumer_secret: key.twitterKeys.consumer_secret,\n\t\t\taccess_token_key: key.twitterKeys.access_token_key,\n\t\t\taccess_token_secret: key.twitterKeys.access_token_secret, \n\t});\n\tvar inputUser = process.argv[3];\n\tif(!inputUser) {\n\t\tvar accountName = \"georgelopez\";\n\t}\n\tvar params = {screen_name: accountName, count: 20};\n\tclient.get(\"statuses/user_timeline/\", params, function(error, data, response) {\n\t\tconsole.log('@' + accountName + \" Tweets: \");\n\t\tif (!error) {\n\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\tvar twitterInfo = \n\t\t\t\"---------\" + (i+1) + \"---------\" + \"\\r\\n\" +\n\t\t\t\"@\" + data[i].user.screen_name + \": \" + \n\t\t\tdata[i].text + \"\\r\\n\" + \n\t\t\tdata[i].created_at + \"\\r\\n\"; \n\t\t\tconsole.log(twitterInfo);\n\t\t\tlog(twitterInfo);\t\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log('This Error Occurred: ' + error)\n\t\t\treturn;\n\t\t}\n\t});\n}", "function runTwitter() {\n var params = { screen_name: 'sltrib' };\n client.get('statuses/user_timeline', params, function (error, tweets, response) {\n if (!error) {\n tweets.forEach(function (element) {\n console.log(\"\\n=================================\\n\" + element.created_at);\n console.log(element.text);\n });\n }\n });\n}", "function init(){\n\tvar verificar_btn= $(\".main-button\");\n\tverificar_btn.addEventListener(\"click\",extraerTweet);\n\t\n}", "function twitter (){\n console.log(\"twitter started\");\n var client = new Twitter(keys.twitter);\n\n var params = {screen_name: 'aronskelton'};\n client.get('statuses/user_timeline', params, function(error, tweets, response) {\n if (!error) {\n console.log(tweets);\n }\n });\n}", "function followed(eventMsg) {\n var name = eventMsg.source.name;\n var screenName = eventMsg.source.screen_Name;\n tweetIt('.@' + screenName + 'Thanks for follow!');\n}", "function BOT_onIntent() {\r\n\tif(!BOT_theReqAction) return(BOT_reqSay(false,\"WARNING\",\"NEEDACTION\"));\r\n\tvar ta = [BOT_theReqTopic,BOT_theReqAction]; \r\n\tBOT_del(BOT_theUserTopicId,\"intention\",\"VAL\",ta);\r\n\tBOT_add(BOT_theUserTopicId,\"intention\",\"VAL\",ta);\r\n\tBOT_reqSay(true,\"NONE\",\"TAKEINTENTION\",BOT_theReqAction);\r\n}", "function tweetit(){\n\n\tvar rand = Math.floor(Math.random()*42)\n\n\tvar tweet = {\n\n\t\tstatus: 'now it is gonna be random: ' + rand +' #machinetweet'\n\n\t}\n\n\tT.post('statuses/update', tweet, tweeted )\n\n\tfunction tweeted(err, data, response){\n\t\tif (err) {\n\t\t\tconsole.log(\"something went wrong\")\n\t\t} else {\n\t\t\tconsole.log(\"it worked\")\n\t\t}\n\t\t \n\t}\n}", "function tweetEvent(eventMsg){\n\t\t\t\t\t//eventMsg is data from tweet (location, source screen name, text,) ..turn into JSON string \n\n//anytime someone sends a tweet to me i send a tweet back to them\n\tvar replyto = eventMsg.in_reply_to_screen_name;\n\tvar text = eventMsg.text;\n\tvar from = eventMsg.user.screen_name;\n\t\n\tconsole.log(replyto + '' + from);\n\n//if user mentions me (the bot) in their tweet, tweet this message \n\tif(replyto === 'tatiturin'){\n\t\tvar newTweet = '@' +from + 'wasssaap' ;\n\t\ttweetIt(newTweet);\n\t}\n\n}", "function followed(eventMsg){ //thank follower via reply tweet\r\n\tconsole.log(\"New Follower! \\n replying...\");\r\n\t// var name= eventMsg.source.name;\r\n\tvar screenName= eventMsg.source.screen_name;\r\n\ttweetIt('@' + screenName + ' thanks for the follow!');\r\n}", "function initSocialSharingWidget() {\n var widget = $('#tesla-social-widget');\n var type = null;\n var url = null;\n var message = null;\n var page = document.URL;\n var width = 550\n var height = 450;\n if (widget.length !== 0) {\n widget.find('a').each(function() {\n type = $(this).attr('class');\n switch (type) {\n case 'facebook':\n url = 'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(page);\n break;\n case 'twitter':\n message = $(this).find('span').text();\n url = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(message) + '&url=' + encodeURIComponent(page) + '&via=' + encodeURIComponent('TeslaMotors') + '&related=' + encodeURIComponent('TeslaMotors,elonmusk');\n break;\n case 'google':\n url = 'https://plus.google.com/share?url=' + encodeURIComponent(page);\n break;\n }\n if (url !== null) {\n $(this).attr('href', url);\n }\n });\n widget.on('click', 'a', function(e) {\n e.preventDefault();\n window.open($(this).attr('href'), '_blank', 'width=' + width + ', height=' + height);\n });\n }\n}", "function socialShareButtonClicked(sharePageUrl)\n\t{\n\t // var sharePageUrl=\"http://accounts.icharts.net/portal/app?page=TeamChartDetail&sp=\"+chartId+\"&service=external\";\n\t\tSTTAFFUNC.cw(this, {id:'2011051151697', link: sharePageUrl, title: document.title });\n\t}", "function getQuote(){\n $.getJSON(quoteApi, function(json) {\n var output;\n var quoteText = $(json[0].content).text();\n var quoteAuthor = json[0].title;\n\n // Encode JSON output for Twitter URL\n var encodedText = encodeURIComponent(quoteText);\n var encodedAut = encodeURIComponent(quoteAuthor);\n var tweetUrl = \"https://twitter.com/intent/tweet?text=\" + encodedText + \"%20-%20\" + encodedAut;\n\n //console.log(tweetUrl);\n output = '<p>' + quoteText + '</p>';\n output += '<p class=\"quote\">- ' + quoteAuthor + '</p>';\n document.getElementById('quote-box').innerHTML = output;\n $(\".twitter-share-button\").attr(\"href\", tweetUrl);\n });\n }", "function socialClick(share){\r\n\tvar link = share.getAttribute(\"data-dash-href\");\r\n\twindow.open(link);\r\n}" ]
[ "0.7833138", "0.7645366", "0.76122415", "0.74459475", "0.742791", "0.73824614", "0.7353404", "0.7316075", "0.72729176", "0.7201847", "0.71545804", "0.7149022", "0.7009498", "0.68645614", "0.6812119", "0.676809", "0.6756128", "0.67309827", "0.6709654", "0.6700267", "0.6676779", "0.66754186", "0.6640927", "0.65130234", "0.64213187", "0.63978016", "0.6391256", "0.6388944", "0.63717085", "0.6324063", "0.63024014", "0.62331975", "0.61937225", "0.61923385", "0.6179165", "0.6103945", "0.61036617", "0.6097601", "0.6092836", "0.60521877", "0.60463345", "0.60337377", "0.60279125", "0.6022125", "0.6015262", "0.60123765", "0.60122496", "0.5975719", "0.596514", "0.5961959", "0.5929701", "0.5916838", "0.5903546", "0.59001106", "0.58901286", "0.58781284", "0.5840454", "0.5826908", "0.5818276", "0.58028793", "0.5800327", "0.5798694", "0.578045", "0.5776516", "0.5748516", "0.5746631", "0.570336", "0.56892884", "0.56683445", "0.5663085", "0.56389", "0.5630752", "0.56236905", "0.5622158", "0.5594167", "0.5578506", "0.55734646", "0.5563307", "0.5535509", "0.5529531", "0.5528276", "0.5527247", "0.5518473", "0.55172294", "0.5509643", "0.5504133", "0.55033904", "0.5498896", "0.54975736", "0.5493563", "0.54930156", "0.54880834", "0.54838145", "0.5482581", "0.5479631", "0.5478495", "0.54735583", "0.5455807", "0.54517704", "0.5401614" ]
0.7174491
10
input: filePath of excel file callback(records) records is array of arrays
function read_excel_file(filePath, callback){ excelParser.parse({ inFile: filePath, worksheet: 1, skipEmpty: false, },function(err, records){ if (err) console.error(err); typeof callback === 'function' && callback(records); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleExFile(e) {\n document.getElementById('excel').blur();\n\n\tNAME_LIST = [];\n\tvar files = e.target.files, f = files[0];\n console.log(excel.files[0].name.split('.').pop());\n\n\tif(!excelTypeCheck(excel.files[0])) {\n \treturn;\n \t}\n\n\tvar reader = new FileReader();\n\treader.onload = function(e) {\n\t\tvar data = e.target.result;\n\t\tif(!rABS) data = new Uint8Array(data);\n\t\tvar workbook = XLSX.read(data, {type: rABS ? 'binary' : 'array'});\n\t\tNAME_LIST = readNames(workbook);\n\t\tconsole.log(NAME_LIST);\n\t\t\n\t\t/* DO SOMETHING WITH workbook HERE */\n\t};\n\tif(rABS) reader.readAsBinaryString(f); else reader.readAsArrayBuffer(f);\n}", "function getArrayFromXlsx(req, res, next) {\n\n var file = req.files.file;\n\n // Tên file\n var originalFilename = file.name;\n console.log(\"Ten file vua up: \" + originalFilename)\n // File type\n var fileType = file.type.split('/')[1];\n\n // File size\n var fileSize = file.size;\n // Đường dẫn lưu ảnh\n var pathUpload = __dirname + '/xlsx/' + originalFilename;\n\n // START READ XLSX DATA\n //doc du lieu tu xlsx dua ve object\n var workbook = XLSX.readFile(file.path);\n var sheet_name_list = workbook.SheetNames;\n var data = [];\n sheet_name_list.forEach(function (y) {\n var worksheet = workbook.Sheets[y];\n var headers = {};\n\n for (z in worksheet) {\n if (z[0] === '!') continue;\n //parse out the column, row, and value\n var tt = 0;\n for (var i = 0; i < z.length; i++) {\n if (!isNaN(z[i])) {\n tt = i;\n break;\n }\n }\n ;\n var col = z.substring(0, tt);\n var row = parseInt(z.substring(tt));\n var value = worksheet[z].v;\n\n //store header names\n if (row == 1 && value) {\n headers[col] = value;\n continue;\n }\n\n if (!data[row]) data[row] = {};\n data[row][headers[col]] = value;\n }\n\n //drop those first two rows which are empty\n data.shift();\n data.shift();\n });\n\n return next(data);\n}", "function handleFileSelect(evt) {\n // Get the file\n var files = evt.target.files; // FileList object\n\n // Call the parse method\n var xl2json = new ExcelToJSON();\n xl2json.parseExcel(files[0]);\n}", "function xlxsReadCallback(jsonArray) {\n if (jsonArray == null) {\n tmpThis.$alert('导入文件格式不符合要求!', '错误', {\n confirmButtonText: '确定'\n });\n return null;\n }\n // Callback method when the gist id in the arrary are fully updated:\n function idUpdatedCallback() {\n // Update progress bar text:\n tmpThis.fileInputProgressText = \"开始上传数据到服务器,请稍后...\"\n // Insert json array to server:\n tmpThis.insertAllDataIntoServer(jsonArray);\n }\n // Get all Gist IDs:\n var newArray = updateGistIdOfDataArray(jsonArray, 0, idUpdatedCallback);\n\n }", "function ImportFile() { \n var excelUrl = \"table_of_dates.xlsx\"; \n\n var oReq = new XMLHttpRequest(); \n oReq.open('get', excelUrl, true); \n oReq.responseType = 'blob'; \n oReq.onload = function () { \n var blob = oReq.response; \n excelIO.open(blob, LoadSpread, function (message) { \n console.log(message); \n }); \n }; \n oReq.send(null); \n}", "function handleInputFile(e) {\n var files = e.target.files, f = files[0];\n inputName = f.name;\n var reader = new FileReader();\n reader.onload = function(e) {\n var data = e.target.result;\n if(!rABS) data = new Uint8Array(data);\n var workbook = XLSX.read(data, {type: rABS ? 'binary' : 'array'});\n \tvar sheet = workbook.Sheets[Object.keys(workbook.Sheets)[0]];\n \t//console.log(sheet);\n \ttable = sheet2arr(sheet);\n \tmaxRow = table.length;\n\tmaxCol = table[0].length;\n\ttableRow = 0;\n\ttableCol = -1;\n\tnewTable = new Array(maxRow).fill(0).map(() => new Array(maxCol).fill(\"\"));\n\tnewTable[0] = table[0];\n\toutwb = XLSX.utils.book_new();\n\toutwb.SheetNames.push(\"Sheet1\");\n\n /* DO SOMETHING WITH workbook HERE */\n };\n if(rABS) reader.readAsBinaryString(f); else reader.readAsArrayBuffer(f);\n}", "function getFileTextData(fileName){\n\t\n const result = excelToJson({\n\tsourceFile: fileName,\n/*\tsheets: [\n\t{\n\t\tname: 'BirthDay',\n\t range: 'A4:C5'\n\t}],\n\tcolumnToKey: {\n\t\tA: 'EmployeeCode',\n\t\tB: 'EmployeeName',\n\t\tC: 'DateOfBirth'\n\t}\n\t*/\n\t//sourceFile: data\t\n});\n\nconsole.log(\"File Parsed Successfully\");\nconsole.log(result);\n\t\t\nreturn result;\n\n}", "function getFileData(file, callback) {\n var data = [];\n var reader = new FileReader();\n\n reader.onload = function(event) {\n var csv = Papa.parse(event.target.result);\n csvData = csv.data;\n var headerRow = csvData[0];\n for (var i = 1; i < csvData.length; i++) {\n var rowData = {};\n for (var j = 0; j < csvData[i].length; j++) {\n rowData[headerRow[j]] = csvData[i][j];\n }\n data.push(rowData);\n }\n callback(data);\n };\n\n reader.onerror = function() {\n alert('Unable to read ' + file.fileName);\n };\n\n reader.readAsText(file);\n}", "function readFlowFiles($flow, callback) {\n\n var fileQueue = $flow.files;\n var filenames;\n var startTime = new Date().getTime();\n\n if (!(fileQueue instanceof Array)) {\n fileQueue = [fileQueue];\n }\n\n if (fileQueue.length > 0) { // if we still have files left\n\n filenames = _.pluck(fileQueue, 'name');\n\n async.eachSeries(fileQueue, function(file, next) {\n\n //var file = fileQueue.shift(); // remove first from queue and store in file\n var filename = file.name;\n\n file = file.file; // get blob from flowfile\n\n reader.onloadend = function(e) {\n\n var data = e.target.result; // binary\n var headers;\n var READER = XLSX;; // XLSX/XLS keep variable generic for reuse\n var wb;\n var ws;\n var errorMsg = 'Not a readable <em>.xlsx</em> file. Please make sure your workbook is saved as an <em>Excel</em> file with a single template worksheet.';\n var processSheet = function(wb) {\n // Good to go\n ws = wb.Sheets[_.keys(wb.Sheets)[0]];\n delete wb; // free up memory\n\n // Trim the headers\n if (typeof _.getByPath(ws, 'A1.v') === 'string') {\n ws.A1.v = ws.A1.v.trim();\n }\n if (typeof _.getByPath(ws, 'A1.w') === 'string') {\n ws.A1.w = ws.A1.w.trim();\n }\n\n return READER.utils.sheet_to_json(ws);\n };\n\n try {\n wb = READER.read(data, {\n type: 'binary'\n });\n ws = processSheet(wb);\n } catch (exception) {\n // XLSX doesn't throw a very informative exception\n try {\n READER = XLS;\n wb = READER.read(data, {\n type: 'binary'\n });\n ws = processSheet(wb);\n } catch (exception) {\n\n errorMsg =\n typeof exception === 'string' ? exception : exception.message;\n\n try {\n\n data = Papa.parse(data);\n headers = data.data.shift();\n\n if (!data.errors.length) {\n\n // @TODO should we async this for large files?...\n ws = _.map(data.data, function(row) {\n return _.object(headers, row);\n });\n\n } else {\n throw new Error('Errors parsing CSV string.');\n }\n } catch (exception) {\n\n errorMsg =\n typeof exception === 'string' ? exception : exception.message;\n }\n }\n }\n\n if (!ws) {\n alertify.notify(\n errorMsg,\n ' bubble-popover bubble-danger',\n 0\n );\n return; // cancel the operation\n }\n\n if (typeof callback !== 'undefined') {\n\n // args\n callback({\n ws: ws,\n filename: filename,\n READER: READER,\n next: next\n });\n\n } else {\n next();\n }\n\n // readFlowFiles(callback); // start next file\n };\n\n reader.readAsBinaryString(file);\n\n }, function() {\n\n $flow.cancel();\n\n alertify.alert(\n '<ul><h5>Finished processing the following files:</h5><li>'\n + filenames.join('</li><li>')\n + '</li></ul>'\n );\n\n });\n }\n }", "handleSheet(workbook, extentions){\n var sheetJS = ( extentions === 'xls' ? XLS : XLSX );\n\n /* Get worksheet */\n for(var id in workbook.SheetNames) {\n var workSheetName = workbook.SheetNames[id];\n var worksheet = workbook.Sheets[workSheetName];\n\n var headers = [];\n var range = null;\n\n if(worksheet['!ref']){\n range = sheetJS.utils.decode_range(worksheet['!ref']);\n } else {\n continue;\n }\n \n if(range) {\n var C, R = range.s.r; /* start in the first row */\n \n /* walk every column in the range */\n for(C = range.s.c; C <= range.e.c; ++C) {\n var cell = worksheet[sheetJS.utils.encode_cell({c:C, r:R})] /* find the cell in the first row */\n\n if(cell && cell.t) {\n var hdr = sheetJS.utils.format_cell(cell);\n headers.push(hdr);\n }\n }\n } else {\n continue;\n }\n\n //console.log(headers);\n\n /*-----\n Check required field header\n -----*/\n var validFields = false;\n for (var i in officerInfo){\n if(headers.includes(officerInfo[i])){\n validFields = true;\n } else {\n this.setState({\n loadding: false,\n error: true,\n message: \"Thiếu hoặc sai tên trường: \" + officerInfo[i]\n });\n\n validFields = false;\n break;\n }\n }\n\n if(validFields) {\n this.setState({\n error: false,\n message: ''\n })\n\n this.handleSheetData(worksheet, sheetJS);\n } else {\n return;\n }\n }\n }", "function parseExcel(filename) {\n var workbook = new Excel.Workbook();\n\n var autotask;\n var list =[]\n workbook.xlsx.readFile(filename)\n .then(function() {\n\n var worksheet = workbook.getWorksheet(1);\n\n var i;\n for(i=2;i<=worksheet.rowCount;i++) {\n autotask = new AutoTask(\n worksheet.getRow(i).getCell(1).value,\n worksheet.getRow(i).getCell(2).value,\n worksheet.getRow(i).getCell(4).value,\n worksheet.getRow(i).getCell(5).value,\n )\n list.push(autotask);\n }\n }).then(function () {\n console.log(\"Parse Complete\")\n appDatabase.pushData(list)\n }).then(function () {\n console.log(\"Finished\")\n })\n\n}", "load(req, res){\r\n\t\t\tlet \tfile \t\t= \treq.files.file\r\n\t\t\t, \t\txlsxData \t= \txlsx.parse(file.path)\r\n\t\t\t,\t\tresult\t\t=\t[]\r\n\r\n\t\t\t//Contruimos el formato del json deseado desde las librerias y cabeceras\r\n\t\t\tfor(let i in xlsxData){\r\n\t\t\t\tlet \tlib\t\t\t= \txlsxData[i]\r\n\t\t\t\t,\t\trow \t\t= \tlib.data[0]\r\n\t\t\t\t,\t\trowFormat \t= \t{}\r\n\t\t\t\t, \t\trowHeads\t= \t[]\r\n\t\t\t\t\r\n\t\t\t\trowFormat.id \t= i\r\n\t\t\t\trowFormat.lib \t= lib.name\r\n\r\n\t\t\t\tfor(let i in row){\r\n\t\t\t\t\tlet value \t\t= row[i]\r\n\t\t\t\t\t,\trowFormat \t= {}\r\n\r\n\t\t\t\t\trowFormat.row \t= value\r\n\t\t\t\t\trowFormat.id\t= i\r\n\r\n\t\t\t\t\trowHeads.push(rowFormat)\r\n\t\t\t\t}\r\n\t\t\t\trowFormat.data \t= rowHeads\r\n\t\t\t\tresult.push(rowFormat)\r\n\t\t\t}\r\n\r\n\t\t\t//Agregamos los valores de los campos al nuevo formato\r\n\t\t\tfor(let i in result){\r\n\t\t\t\tlet lib = result[i]\r\n\t\t\t\tfor(let i in lib.data){\r\n\t\t\t\t\t\r\n\t\t\t\t\tlet data\t\t= lib.data[i]\r\n\t\t\t\t\t, \txlsxDataRow = xlsxData[lib.id].data\r\n\r\n\t\t\t\t\tif(!result[lib.id].data[data.id]) continue;\r\n\t\t\t\t\tresult[lib.id].data[data.id].column = []\r\n\t\t\t\t\tfor(let i in xlsxDataRow){\r\n\t\t\t\t\t\tif(i == 0) continue;\r\n\t\t\t\t\t\tlet xlsxRow = xlsxDataRow[i]\r\n\t\t\t\t\t\tresult[lib.id].data[data.id].column.push( (xlsxRow[data.id])?xlsxRow[data.id]:null )\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tres.status(200).send({status:'success', file:result})\r\n\t\t}", "function readFile(files) {\n\n var i, f;\n for (i = 0; i !== files.length; ++i) {\n f = files[i];\n var reader = new FileReader();\n\n reader.onload = function (e) {\n var data = e.target.result;\n\n var wb, arr = false;\n var readtype = {type: rABS ? 'binary' : 'base64'};\n if (!rABS) {\n arr = fixData(data);\n data = btoa(arr);\n }\n\n function doit() {\n try {\n opts.on.workstart();\n\n wb = XLSX.read(data, readtype);\n opts.on.workend(processWB(wb, 'XLSX'));\n } catch (e) {\n opts.errors.failed(e);\n }\n }\n\n if (e.target.result.length > 500000) {\n opts.errors.large(e.target.result.length, function (e) {\n if (e) {\n doit();\n }\n });\n } else {\n doit();\n }\n };\n if (rABS) {\n reader.readAsBinaryString(f);\n } else {\n reader.readAsArrayBuffer(f);\n }\n }\n }", "function handleFile(filePath) \n{\n\n\t$(document).ready(function () {\n\t\t$.ajax({\n\t\t\ttype: \"GET\",\n\t\t\turl: filePath,\n\t\t\tdataType: \"csv\",\n\t\t\tsuccess: function (data) { processData(data); }\n\t\t});\n\t});\n}", "read(file) {\n var workbook = XLSX.readFile(file);\n var sheet_name_list = workbook.SheetNames;\n var data = {};\n var letters = [];\n var moduleShortNameArray = [];\n sheet_name_list.forEach(function(y) {\n var worksheet = workbook.Sheets[y];\n var headers = [];\n\n var column = 0;\n var enc_addr = XLSX.utils.encode_cell;\n var dec_range = XLSX.utils.decode_range;\n var range = dec_range(worksheet['!ref']);\n\n while (worksheet[enc_addr({c: column, r: 0})]) {\n headers.push((worksheet[enc_addr({c: column, r: 0})].v).replace(/ +/g, \"\"));\n column++\n }\n\n for (var R = range.s.r +1; R <= range.e.r; ++R) {\n\n var record = [];\n\n data['row'+R] = {};\n for (var C = range.s.c; C <= headers.length-1; ++C) {\n let cell_address = enc_addr({c: C, r: R});\n let cell = worksheet[cell_address];\n\n if (cell && typeof cell.v !== 'undefined') {\n var header = headers[R-1];\n var value = cell.v;\n record.push(value);\n headers.map((header, index) => {\n data[\"row\"+R][header] = record[index];\n })\n }\n }\n moduleShortNameArray.push(record[0].split('_').pop());\n letters.push(record[0].charAt(0));\n\n }\n });\n\n this.uniqueRows = this.reducerFilter([], letters);\n this.uniqueModuleShortName = this.reducerFilter([], moduleShortNameArray);\n this.filterData(data);\n }", "function readFile(files) {\n\n var i, f;\n for (i = 0; i !== files.length; ++i) {\n f = files[i];\n var reader = new FileReader();\n reader.onload = function (e) {\n var data = e.target.result;\n\n var wb, arr = false;\n var readtype = {type: rABS ? 'binary' : 'base64'};\n if (!rABS) {\n arr = fixData(data);\n data = btoa(arr);\n }\n\n function doit() {\n try {\n opts.on.workstart();\n\n wb = XLSX.read(data, readtype);\n opts.on.workend(processWB(wb));\n } catch (e) {\n opts.errors.failed(e);\n }\n }\n\n if (e.target.result.length > 5000000) {\n opts.errors.large(e.target.result.length, function (e) {\n if (e) {\n doit();\n }\n });\n } else {\n doit();\n }\n };\n if (rABS) {\n reader.readAsBinaryString(f);\n } else {\n reader.readAsArrayBuffer(f);\n }\n }\n }", "read() {\n const {\n input,\n sheetname,\n schema,\n hasHeader = true,\n lowerCaseHeaders,\n onRecord,\n onCell,\n onError,\n useMemoryForItems, // useful when no onRecord handler and no output provided\n backwards\n } = this.options;\n\n console.log(\"Reading Excel file...\", input);\n\n const eventNames = [...DEFAULT_EVENTS];\n if (typeof onCell === \"function\") eventNames.push(\"cell\");\n\n this._rowsProcessed = 0;\n this._hasRecord = false;\n this._createOutStream();\n this._writeHeader();\n this._sheetReaderInstance = { _startRow: 0 };\n\n FastXlsxReader.iterate(\n input,\n sheetname,\n (eventName, data, rowIndex, colIndex) => {\n if (eventName === 'start') {\n this._createOutStream();\n this._writeHeader();\n // the 'start' event's third param (after the 'this' arg) is the sheet reader instance\n this._sheetReaderInstance = data || this._sheetReaderInstance;\n } else {\n this._handleCallbackEvent(eventName, data, rowIndex, colIndex, schema, hasHeader,\n lowerCaseHeaders, onRecord, onError, useMemoryForItems);\n }\n },\n eventNames,\n this, // thisArg for the callback\n backwards\n );\n }", "function excelReader(filePath, sheetName) {\n // player workbook\n let wb = xlsx.readFile(filePath);\n // get data from a particular sheet in that wb\n let excelData = wb.Sheets[sheetName];\n // sheet to json \n let ans = xlsx.utils.sheet_to_json(excelData);\n return ans;\n}", "function process_spreadsheet() {\n var file = document.getElementById('docpicker')\n var viewer = document.getElementById('spreadsheet_output')\n file.addEventListener('change', importFile);\n\n function importFile(evt) {\n var f = evt.target.files[0];\n\n if (f) {\n var r = new FileReader();\n r.onload = e => {\n var contents = processExcel(e.target.result);\n }\n r.readAsBinaryString(f);\n } else {\n console.log(\"Failed to load file\");\n }\n }\n\n function processExcel(data) {\n var workbook = XLSX.read(data, {\n type: 'binary'\n });\n\n var firstSheet = workbook.SheetNames[0];\n var data = to_json(workbook);\n return data\n };\n\n function to_json(workbook) {\n newDataset.resetData();\n var result = {};\n workbook.SheetNames.forEach(function(sheetName) {\n var roa = XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], {\n header: 1\n });\n if (roa.length) result[sheetName] = roa;\n });\n newSpreadsheet.setSpreadsheet(result);\n var tx_counter = 0;\n for (i = 0; i < newSpreadsheet.getSpreadsheet()[\"Sheet1\"].length; i++) {\n if (newSpreadsheet.getSpreadsheet()[\"Sheet1\"][i][1] != undefined && newSpreadsheet.getSpreadsheet()[\"Sheet1\"][i][1] != \"undefined\") {\n accountAddress = newSpreadsheet.getSpreadsheet()[\"Sheet1\"][i][1].toString();\n if (web3.utils.isAddress(accountAddress)) {\n var tempAmountinWei = parseInt(newSpreadsheet.getSpreadsheet()[\"Sheet1\"][i][2], 10);\n var amountAsBN = new web3.utils.BN(tempAmountinWei.toString());\n if (web3.utils.toBN(amountAsBN).gt(web3.utils.toBN('0')) && web3.utils.toBN(amountAsBN).lt(web3.utils.toBN('1000000000000000000000'))) {\n var row = [accountAddress, amountAsBN.toString()];\n newDataset.addRowToDataset(row);\n tx_counter = tx_counter + 1;\n row = [];\n } else {\n document.getElementById(\"spreadsheet_output\").innerHTML = \"ERROR!: Account Address of \" + accountAddress + \"is going to receive more than 1000 network tokens (this prototype application does not support amounts that high)\";\n }\n }\n }\n }\n document.getElementById(\"spreadsheet_output\").innerHTML = JSON.stringify(newDataset.getDataset(), 2, 2);\n };\n}", "function handleFiles(files) {\n sheet = document.getElementById(\"sheet\").fabric;\n file = files[0];\n var reader = new FileReader();\n reader.onload = function() {\n var dataURL = reader.result;\n // load it into the canvas\n var img = new Image();\n img.onload = function() {\n var fabricImage = new fabric.Image(img);\n sheet.add(fabricImage);\n };\n img.src = dataURL;\n };\n reader.readAsDataURL(file);\n}", "function ImportExcelCsvPingabankTest() {}", "function get_json_data(file_path_to_load_xls) {\n \"use strict\"\n\n var file_path = \"/media/static/documents/\";\n var file_to_load_xls = file_path_to_load_xls.split(/.*[\\/|\\\\]/)[1];\n var file_to_load_json = file_to_load_xls.split('.').slice(0, -1).join('.') + \".json\";\n var file_to_load_json_full = file_path + file_to_load_json;\n\n var call_results = $.ajax({\n type:'GET',\n url:file_to_load_json_full,\n success: function(data) {\n table_load(data);\n },\n error : function(xhr,errmsg,err) {\n console.log(\"error message\");\n console.log(xhr.status + \": \" + xhr.responseText); // provide a bit more info about the error to the console\n }\n });\n\n}", "function filePicked(oEvent) {\r\n\t// Get The File From The Input\r\n\tvar oFile = oEvent.target.files[0];\r\n\tvar sFilename = oFile.name;\r\n\tif (!oFile) {\r\n\t\talert(\"Failed to load file\");\r\n \t} else if (/.xml\\$/.test(sFilename)) { // vérifie que le nom du fichier se termine par .xml\r\n\t\tloadXml(oFile);\r\n \t} else if (/.xls\\$/.test(sFilename)) {\r\n\t\t// Create A File Reader HTML5\r\n\t\tvar reader = new FileReader();\r\n\r\n\t\t// Ready The Event For When A File Gets Selected\r\n\t\treader.onload = function(e) {\r\n\t\t\tvar data = e.target.result;\r\n\t\t\tvar cfb = XLSX.read(data, {type: 'binary'}); // conversion \r\n\t\t\tcfb.SheetNames.forEach(function conv(sheetName) {\r\n\t\t\t\t// Obtain The Current Row As CSV\r\n\t\t\t\tvar csvData = XLS.utils.make_csv(cfb.Sheets[sheetName]); \r\n\t\t\t\tvar data=XLS.utils.make_csv(cfb.Sheets[sheetName]); //// conversion xls /xlsx / ods -> csv \r\n\t\t\t\tvar employee_data = data.split(/\\r?\\n|\\r/);\r\n\t\t\t\tlet table_data = '<table class=\"table table-bordered table-striped\">'; // affichage\r\n\t\t\t\tfor(var count = 0; count<employee_data.length; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar cell_data = employee_data[count].split(\",\");\r\n\t\t\t\t\ttable_data += '<tr>';\r\n\t\t\t\t\tfor(var cell_count=0; cell_count<cell_data.length; cell_count++) // affichage\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(count === 0)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ttable_data += '<th>'+cell_data[cell_count]+'</th>';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\ttable_data += '<td>'+cell_data[cell_count]+'</td>';\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttable_data += '</tr>';\r\n\t\t\t\t}\r\n\t\t\t\ttable_data += '</table>'; // table_data : la conversion csv-> tableau html \r\n\t\t\t\t//console.log(table_data); //// test html \r\n\t\t\t\tdocument.getElementById('DataBlock').innerHTML +=table_data; // affichage \r\n\r\n\t\t\t\tcsvData = csvData.split('\\n').map(row => row.trim()); //// conversion csv-> xml \r\n\t\t\t\tlet headings = csvData[1].split(',').map(row => row.trim());\r\n\t\t\t\tfor (z=0 ;z<headings.length;z++){ // pour eliminer les espace et les caractere specieux des balise \r\n\t\t\t\t\t\tfor (h=0;h<headings[z].length;h++){\r\n\t\t\t\t\t\theadings[z]=headings[z].replace(' ','');// pour les balise ou il y a faute de frappe avec deux espace \r\n\t\t\t\t\t\theadings[z]=headings[z].replace('/','');\r\n\t\t\t\t\t\theadings[z]=headings[z].replace(\"'\",\"\");\r\n\t\t\t\t\t\theadings[z]=headings[z].replace('°','');\r\n\t\t\t\t\t\theadings[z]=headings[z].replace('.','');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar xml = ``;\r\n\t\t\t\txml=\"<?xml version=\"+\"1.0\"+\" encoding=\"+\"ISO-8859-1\"+\" ?>\\n\"; \r\n\t\t\t\tfor(let i = 2; i < csvData.length; i++) {\r\n\t\t\t\tlet details = csvData[i].split(',').map(row => row.trim());\r\n\t\t\t\txml += \"<productData>\\n\";\r\n\r\n\t\t\t\tfor(let j = 0; j < headings.length; j++) {\r\n\t\t\t\t\tif (headings[j] !== \"\"){ // condition pour regler le probleme de dimension du tableau \r\n\t\t\t\txml += `<${headings[j]}>${details[j]}</${headings[j]}>`;\r\n\t\t\t\t\t}\r\n\t\t\t\t};\t\t\t\t\t\t\t\t\r\n\t\t\t\txml += \"\\n</productData>\\n\"; // xml : le fichier xml \r\n\r\n\t\t\t\t};\r\n\r\n\t\t\t\t/*\r\n\t\t\t\t//Function to download data to a file\r\n\t\t\t\tfunction download(data, filename, type) {\r\n\t\t\t\t\tvar file = new Blob([data], {type: type});\r\n\t\t\t\t\tif (window.navigator.msSaveOrOpenBlob) // IE10+\r\n\t\t\t\t\t\twindow.navigator.msSaveOrOpenBlob(file, filename);\r\n\t\t\t\t\telse { // Others\r\n\t\t\t\t\t\tvar a = document.createElement(\"a\"),\r\n\t\t\t\t\t\t\t\turl = URL.createObjectURL(file);\r\n\t\t\t\t\t\ta.href = url;\r\n\t\t\t\t\t\ta.download = filename;\r\n\t\t\t\t\t\tdocument.body.appendChild(a);\r\n\t\t\t\t\t\ta.click();\r\n\t\t\t\t\t\tsetTimeout(function() {\r\n\t\t\t\t\t\t\tdocument.body.removeChild(a);\r\n\t\t\t\t\t\t\twindow.URL.revokeObjectURL(url); \r\n\t\t\t\t\t\t}, 0); \r\n\t\t\t\t\t}\r\n\t\t\t\t}*/\r\n\r\n\t\t\t}\r\n\t\t\t);\r\n\r\n\r\n\r\n\t\t/*//creation de la liste de fragments :\r\n\t\tlignes = readXml(xml);\r\n\r\n\t\tattributs = getXmlAttributes(lignes[0]);\r\n\t\tcreateObjects(attributs,lignes,Objects); //liste de la liste des valeurs de chaque fragment\r\n\r\n\t\tconsole.log(Objects[0][1]);\t*/\r\n\t\t}\r\n\t// Tell JS To Start Reading The File.. You could delay this if desired\r\n\treader.readAsBinaryString(oFile);\r\n\t}\r\n}", "function readSingleFile(e) {\n // IF WE SELECTED THE FILE FROM BUTTON THEN HANDLE THIS WAY\n if(e.type == \"change\"){\n var file = e.target.files[0];\n if (!file) {\n return;\n }\n }\n else // ELSE, IT MUST BE FROM DRAG AND DROP, HANDLE THIS WAY\n {\n var file = e.dataTransfer.files[0];\n if(!file) {\n return;\n }\n }\n // CHECK IF THE FILE IS OF TYPE XLSX\n if(validateFileType(file)){\n var dragarea = document.getElementById('drag-and-drop');\n dragarea.classList.add('dropped');\n var reader = new FileReader();\n\n reader.readAsBinaryString(file);\n\n reader.onload = function(e) {\n var contents = e.target.result;\n loadExcel(contents);\n document.getElementById('small-hint').innerHTML = \"(\" + file.name + \")\";\n };\n }\n}", "excelImport(data){\nreturn this.post(Config.API_URL + Constant.REFFERAL_EXCELIMPORT, data);\n}", "function findFile(workbook) {\n /*function will be to wait for file upload and confirm it is there before\n calling convert file **move csvworkbook variable when I do adjust.*/\nconvertFile(workbook)\n}", "function loadCSV()\r\n{\r\n\r\n\tvar invoiceLines='';\r\n\r\n\t// load the CSV from the audit record\r\n\tinvoiceCSV = auditRec.getFieldValue('custrecord_payload');\r\n\tinvoiceCSV = UNencodeCSV(invoiceCSV);\r\n\r\n\t// this code only deals with the invoice files\r\n\tinvoiceLines = invoiceCSV.split('\\n');\r\n\r\n\t//=============================================\r\n\t// get the details from the CSV structure\r\n\t//=============================================\r\n\tfor (var i = 0; i < invoiceLines.length; i++)\r\n\t{\r\n\r\n\t\tinvoiceLines[i] = invoiceLines[i].replace(', ',' '); \r\n\t\tnlapiLogExecution('DEBUG', 'invline', invoiceLines[i]);\r\n\t\tinvoiceSplit = invoiceLines[i].split(',');\r\n\t\t\r\n\t\tif (invoiceSplit.length > 5)\r\n\t\t{\r\n\t\t\tgetInvoiceHeaderDetails();\r\n\t\t\tgetInvoiceLineDetails();\r\n\t\t}\r\n\t}\r\n\r\n\r\n}", "HandleDocumentDownloadFile(evt, row) {\n debugger;\n //var filePath = row.original[\"HBL#\"];\n }", "function readFile (evt) {\r\n var files = evt.target.files;\r\n var file = files[0]; \r\n Papa.parse(file, {\r\n \tcomplete: function(results) {\r\n \t\tlog(results);\r\n \t}\r\n }, config);\r\n }", "function record_data(e,fileUrl) {\n try {\n /*var doc = SpreadsheetApp.openById(SCRIPT_PROP.getProperty(\"key\"));*/\n var doc = SpreadsheetApp.openById(\"1bNVGpo7CWdONGoNS6WRQ58wfOTxGsQBBRxD0ZBFfNmM\");\n var sheet = doc.getSheets()[0];\n \n /*var sheet = doc.getSheetByName(\"responses\"); // select the responses sheet, MAKE SURE YOU HAVE A SHEET NAMED responses*/\n Logger.log(\"hello\");\n var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];\n \n var nextRow = sheet.getLastRow()+1; // get next row\n var row = [ new Date() ]; // first element in the row should always be a timestamp\n // loop through the header columns\n Logger.log(\"are we getting here row\" + row);\n for (var i = 1; i < headers.length; i++) { // start at 1 to avoid Timestamp column\n \n if(headers[i].length > 0 && headers[i] == \"resume\") {\n row.push(fileUrl); // add data to row\n }\n else if(headers[i].length > 0) {\n row.push(e.parameter[headers[i]]); // add data to row\n }\n }\n // more efficient to set values as [][] array than individually\n sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);\n Logger.log(row);\n }\n catch(error) {\n Logger.log(e);\n }\n finally {\n return;\n }\n\n}", "function purchaseExcelReport(data_record_po) {\n\n}", "function ProcessExcel(data) {\n //Read the Excel File data.\n var workbook = XLSX.read(data, {\n type: 'binary'\n });\n\n //Fetch the name of First Sheet.\n var firstSheet = workbook.SheetNames[0];\n\n //Read all rows from First Sheet into an JSON array.\n var excelRows = XLSX.utils.sheet_to_row_object_array(workbook.Sheets[firstSheet]);\n\n //Create a HTML Table element.\n var table = $(\"<table />\");\n table[0].border = \"1\";\n\n //Add the header row.\n var row = $(table[0].insertRow(-1));\n\n //Add the header cells.\n var headerCell = $(\"<th />\");\n headerCell.html(\"Name\");\n row.append(headerCell);\n\n var headerCell = $(\"<th />\");\n headerCell.html(\"Marks\");\n row.append(headerCell);\n\n var headerCell = $(\"<th />\");\n headerCell.html(\"Result\");\n row.append(headerCell);\n\n //Add the data rows from Excel file.\n for (var i = 0; i < excelRows.length; i++) {\n //Add the data row.\n var row = $(table[0].insertRow(-1));\n\n //Add the data cells.\n var cell = $(\"<td />\");\n\n cell = $(\"<td />\");\n cell.html(excelRows[i].Name);\n row.append(cell);\n\n cell = $(\"<td />\");\n cell.html(excelRows[i].Marks);\n row.append(cell);\n\n cell = $(\"<td />\");\n cell.html(excelRows[i].Result);\n row.append(cell);\n }\n\n var dvExcel = $(\"#dvExcel\");\n dvExcel.html(\"\");\n dvExcel.append(table);\n\n }", "function parseExcel(filename) {\n // Reading the file\n var workbook = XLSX.readFile(\"./input_files/\" + filename);\n\n // Excel file\n var firstSheet = workbook.SheetNames[0];\n // Worksheet from file\n var worksheet = workbook.Sheets[firstSheet];\n\n // Output file as JSON\n var outputJson = Utils.removeDiacritics(JSON.stringify(XLSX.utils.sheet_to_row_object_array(worksheet), null, 2));\n\n // Check if user wants to write into a JSON file\n if (args[1]) {\n Utils.writeToJson(baseName, outputJson);\n } else {\n console.log(outputJson);\n }\n}", "readSingleFile(ev) {\n //Retrieve the first (and only!) File from the FileList object\n if(this.has_csv) {\n this.headTableTarget.innerHTML = ``\n this.bodyTableTarget.innerHTML = ``\n } \n var f = ev.target.files[0];\n if (f) {\n var r = new FileReader();\n const this_controller = this\n r.onload = function (e) {\n var contents = e.target.result;\n this_controller.csv = contents\n this_controller.has_csv = true\n this_controller.csvToTable(this_controller.csv)\n }\n r.readAsText(f)\n } else {\n alert(\"Failed to load file\");\n }\n }", "function upload(evt) \n{\n //alert('upload action');\n if (!browserSupportFileUpload()) \n {\n alert('The File APIs are not fully supported in this browser!');\n } \n else \n {\n var data = null;\n var file = evt.target.files[0];\n var reader = new FileReader();\n reader.readAsText(file);\n reader.onload = function(event) {\n var csvData = event.target.result;\n data = $.csv.toArrays(csvData);\n if (data && data.length > 0) {\n var summaryContext = false;\n var itemContext = false;\n\n //alert('Imported -' + data.length + '- rows successfully from '+ file.name);\n if(file.name.includes(\"SummaryReport\"))\n {\n \n var html = generateTable(data);\n incrementstatus(data);\n tasksBySizeChart(data);\n tasksByTimeChart(data);\n \n setupgraph1(data);\n $('#result2').empty();\n $('#result2').html(html);\n \n //average throughput\n $('#throughput').html(generateAvgThroughput(data))\n $('#filesStatus').html(generateFilesStatus(data));\n\n summaryContext = true;\n }\n if(file.name.includes(\"ItemReport\"))\n {\n var html = generateTable(data)\n incrementstatusItemReport(data);\n setupitemReport(data);\n itemsByStatusAndType(data);\n $('#result2').empty();\n $('#result2').html(html);\n\n itemContext = true;\n }\n \n setPageContext(summaryContext, itemContext);\n \n \n ;\n } else {\n alert('No data to import!');\n }\n };\n reader.onerror = function() {\n alert('Unable to read ' + file.fileName);\n };\n }\n \n}", "getRowData(csvFile, startLineNumber) {\n if (!startLineNumber) {\n startLineNumber = 1;\n }\n var rowData = [];\n for (var i = startLineNumber; i < csvFile.length; i++) {\n rowData.push(csvFile[i]);\n }\n return rowData;\n }", "getCellValues() {\n var table = this.tableCsvTarget\n var lines = [];\n for (var r = 1, n = table.rows.length; r < n; r++) {\n // console.log(\"line\")\n var line = [];\n for (var c = 0, m = table.rows[r].cells.length - 3; c < m; c++) {\n line.push(this.tableHeaders[c].replace(/(\\r\\n|\\n|\\r)/gm, \"\") + \": \" + table.rows[r].cells[c+1].innerText);\n // line.push(table.rows[r].cells[c].innerText);\n }\n lines.push(line);\n }\n this.saveCsv({ upload: lines })\n }", "handleUploadFileResponseValue(event){ \n this.totalRec = (this.totalRec.length == 1 && this.totalRec[0].folderSetup == true) ? [...event.detail.fileRecord] : [...event.detail.fileRecord,...this.totalRec];\n this.searchBar = this.totalRec;\n this.recordList = this.searchBar;\n this.recordToDisplay= this.recordList;\n this.setRecordsToDisplay();\n refreshApex( this.recordToDisplay);\n this.uploadFileModal=event.detail.modal;\n }", "static readFile(callback) {\n DBHelper.fetchFile((error, data) => {\n if(error) {\n callback(error, null);\n }\n else {\n let reader = new FileReader();\n reader.readAsText(data);\n reader.onload = (event) => {\n let csv = event.target.result;\n let results = DBHelper.convertToJson(csv);\n callback(null, results);\n }\n reader.onerror = (event) => {\n if(event.target.error.name == \"NotReadableError\") {\n callback(`File cannot be read`, null);\n }\n }\n }\n });\n }", "parseFile() {\n this.setState({ showSpecial: false });\n if (Object.keys(this.state.file).length === 0 && this.state.file.constructor === Object) {\n this.setState({ errorMessage: 'File input cannot be empty!' });\n return;\n }\n Papa.parse(this.state.file, {\n header: true,\n dynamicTyping: true,\n complete: (results) => {\n const emptyArray = [];\n const partialArray = [];\n results.data.map((object, index) => {\n if (object.email !== undefined) {\n emptyArray.push(object.email.replace(/\\s+/g, ''));\n if (index < 10) {\n partialArray.push(object.email.replace(/\\s+/g, ''));\n }\n }\n return ('');\n },\n );\n this.setState({\n csvData: emptyArray,\n send: true,\n showContainer: true,\n });\n },\n });\n }", "function importExcelData2MySQL(filePath){\n\n var sql='DELETE FROM student';\n db.query(sql, function (err, data, fields) {\n if (err) {\n console.log(err);\n }\n });\n\n var deferred = q.defer();\n\treadXlsxFile(filePath).then((rows) => {\n\t\t// `rows` is an array of rows\n\t\t// each row being an array of cells.\t \n\t\tconsole.log(rows);\n\t\n\t\t// Remove Header ROW\n\t\trows.shift();\n\t \n\t\t// Open the MySQL connection\n\t\tdb.connect((error) => {\n\t\t\tif (error) {\n console.error(error);\n\t\t\t} else {\n\t\t\t\tlet query = 'INSERT INTO Student (Name, RollNo, Class) VALUES ?';\n\t\t\t\tdb.query(query, [rows], (error, response) => {\n console.log(error || response);\n \n if (error) {\n //throw err; \n deferred.reject(error);\n }\n else {\n //console.log(rows); \n deferred.resolve(rows);\n }\n });\n console.log(\"yehi pe hu mai\");\n\t\t\t}\n\t\t});\n })\n return deferred.promise;\n}", "function process( filename, mimetype, cb ) {\n // assume the file exists on the disk.\n var realMimetype = normalizeMimetype( filename, mimetype );\n if ( realMimetype == 'application/xlsx' ) {\n // convert it into csv\n var shortid = require( 'shortid' );\n var csvFilename = path.join( os.tmpdir(), shortid.generate() );\n fs.readFile( filename, 'binary', function( err, buffer ) {\n\tif ( err ) return cb( err );\n\ttry {\n\t var XLSX = require( 'xlsx' );\n var workbook = XLSX.read( buffer, {type:\"binary\"} );\n var sheet_name_list = workbook.SheetNames;\n var csv = XLSX.utils.sheet_to_csv( workbook.Sheets[sheet_name_list[0]] );\n\t fs.writeFile( csvFilename, csv, function( err ) {\n\t if ( err ) return cb( err );\n\t processCSV( csvFilename, cb );\n\t });\n\t} catch( err ) {\n\t app.log.error( err );\n\t return cb( new Error( 'XXCould not convert an xlsx to a csv: ' + err.message ) );\n\t}\n });\n }\n else if ( realMimetype == 'text/csv' ) {\n processCSV( filename, cb );\n }\n else {\n cb( new Error( 'Unsupported mimetype: ' + realMimetype ) );\n }\n }", "function upload(evt) {\n if (!browserSupportFileUpload()) {\n alert(\"The File APIs are not fully supported in this browser!\");\n } else {\n var data = null;\n var file = evt.target.files[0];\n var reader = new FileReader();\n reader.readAsText(file);\n reader.onload = function(event) {\n var csvData = event.target.result;\n data = $.csv.toArrays(csvData);\n if (data && data.length > 0) {\n printOutData(data);\n // console.log(JSON.stringify(data));\n } else {\n alert(\"No data to import!\");\n }\n };\n reader.onerror = function() {\n alert(\"Unable to read \" + file.fileName);\n };\n }\n }", "function handlePracticeFiles(e) {\n var files = e.target.files;\n var f = files[0];\n var reader = new FileReader();\n reader.onload = function (e) {\n // @ts-ignore\n var data = new Uint8Array(e.target.result);\n var workbook;\n workbook = read(data, { type: 'array' });\n var worksheet = workbook.Sheets[workbook.SheetNames[0]];\n var schedule = utils.sheet_to_json(worksheet, { range: 4 });\n var formattedSchedule = {};\n var matchNumber = 0;\n var errorMatches = [];\n var errorMessage = \"\";\n var innerSchedule = [];\n schedule.forEach((match) => {\n var scheduleKeys = Object.keys(match);\n scheduleKeys.forEach((key) => {\n match[key] = match[key].toString();\n })\n\n if (scheduleKeys.length < 8) {\n if (match[\"Description\"].includes(\"Practice\")) {\n errorMatches.push(match);\n }\n }\n })\n\n if (errorMatches.length > 0) {\n errorMessage = \"Your Practice Schedule has missing data from the following match\" + ((errorMatches.length > 1) ? \"es:\" : \":\") + \"</br>\";\n errorMatches.forEach((match) => {\n errorMessage += match[\"Description\"] + \"</br>\"\n })\n errorMessage += \"Please adjust the match details and reload.</br>\"\n toast.error(errorMessage);\n } else {\n innerSchedule = schedule.map((match) => {\n var matchTime = moment(match?.Time, \"ddd h:mm A\").format();\n if (match[\"Red 1\"]) {\n matchNumber++;\n var tempRow = {\n \"description\": match?.Description,\n \"tournamentLevel\": \"Practice\",\n \"matchNumber\": matchNumber,\n \"startTime\": matchTime,\n \"actualStartTime\": null,\n \"postResultTime\": null,\n \"scoreRedFinal\": null,\n \"scoreRedFoul\": null,\n \"scoreRedAuto\": null,\n \"scoreBlueFinal\": null,\n \"scoreBlueFoul\": null,\n \"scoreBlueAuto\": null,\n \"teams\": [{\n \"teamNumber\": parseInt(removeSurrogate(match[\"Red 1\"])),\n \"station\": \"Red1\",\n \"surrogate\": (match[\"Red 1\"].toString().includes(\"*\")) ? !0 : !1,\n \"dq\": !1\n }, {\n \"teamNumber\": parseInt(removeSurrogate(match[\"Red 2\"])),\n \"station\": \"Red2\",\n \"surrogate\": (match[\"Red 2\"].toString().includes(\"*\")) ? !0 : !1,\n \"dq\": !1\n }, {\n \"teamNumber\": parseInt(removeSurrogate(match[\"Red 3\"])),\n \"station\": \"Red3\",\n \"surrogate\": (match[\"Red 3\"].toString().includes(\"*\")) ? !0 : !1,\n \"dq\": !1\n }, {\n \"teamNumber\": parseInt(removeSurrogate(match[\"Blue 1\"])),\n \"station\": \"Blue1\",\n \"surrogate\": (match[\"Blue 1\"].toString().includes(\"*\")) ? !0 : !1,\n \"dq\": !1\n }, {\n \"teamNumber\": parseInt(removeSurrogate(match[\"Blue 2\"])),\n \"station\": \"Blue2\",\n \"surrogate\": (match[\"Blue 2\"].toString().includes(\"*\")) ? !0 : !1,\n \"dq\": !1\n }, {\n \"teamNumber\": parseInt(removeSurrogate(match[\"Blue 3\"])),\n \"station\": \"Blue3\",\n \"surrogate\": (match[\"Blue 3\"].toString().includes(\"*\")) ? !0 : !1,\n \"dq\": !1\n }]\n };\n }\n return (tempRow);\n })\n\n formattedSchedule.schedule = _.filter(innerSchedule, \"description\");\n setPracticeSchedule(formattedSchedule);\n toast.success(`Your have successfully loaded your Practice Schedule.`)\n clearFileInput(\"BackupFiles\");\n document.getElementById(\"BackupFiles\").addEventListener('change', handlePracticeFiles);\n }\n };\n reader.readAsArrayBuffer(f);\n\n\n }", "function uploadFile (ev, file) {\n // when function is called after choosing xsl/xslx sheet\n if (!file) {\n processFile(ev, $scope.uploadedFile);\n return;\n }\n\n $scope.uploadedFile = file;\n // If CSV file is uploaded, processing it immediately\n if (file.name.split('.').pop().toLowerCase() === 'csv') {\n processFile(ev, file);\n return;\n }\n\n $scope.uploadedFile.sheet = 0;\n // Parsing the xsl/xslx file to get the list of sheets in it\n var reader = new FileReader();\n reader.onload = function(e) {\n var workbook = XLSX.read(e.target.result, {\n type: 'binary'\n });\n\n // if there are more than 1 sheet, updating the view with options to choose which sheet to upload\n if (workbook.SheetNames.length > 1) {\n $scope.sheets = workbook.SheetNames;\n $scope.$apply(); // explicitly telling Angular to update the view\n } else {\n processFile(ev, $scope.uploadedFile);\n }\n };\n reader.readAsBinaryString(file);\n }", "function handleUpload(event) {\n let file = event.target.files[0];\n if(file.name.includes(\".xlsx\")) {\n readXlsxFile(event.target.files[0], {schema:xlsxSchema}).then((excelData) => {\n setSpreedSheetData(excelData.rows);\n });\n setSelectedFile(event.target.files[0]);\n } else if (file.name.includes(\".csv\")) {\n let reader = new FileReader();\n reader.onload = function (e) {\n let json = JSON.parse(csvToJSON(e.target.result));\n setSpreedSheetData(json);\n };\n reader.readAsBinaryString(file);\n setSelectedFile(event.target.files[0]);\n } else {\n setSelectedFile({ name: \"un-supported format\"});\n }\n }", "_excelUpload_Post_(req, res) {\n if (!req.files) {\n return res.status(500).send({msg: 'file is not found'});\n }\n //__check if files not there__\n if (\n !req.files.csv &&\n (!req.files.textSheet || req.body.textSheetDate !== '') &&\n (!req.files.varSheet || req.body.varSheetDate !== '')\n )\n return res.status(500).send({msg: 'Not all data found'});\n else {\n let returnedData = {};\n returnedData['response_code'] = 0;\n returnedData['response_message'] = 'Success';\n logMessage(Info, JSON.stringify(returnedData));\n res.send(200, returnedData); // Return Res\n }\n flag = 0;\n errFlag = 0;\n let fileNames = [];\n fileNames = ['TextResponseDataStructure_', 'VariablesAndDefinitionsTable_'];\n let currentDate = new Date().toISOString().slice(0, 19);\n console.log(Object.keys(req.files.csv));\n // accessing the file\n const myFile = req.files.csv; // mv() method places the file inside public directory\n myFile.mv(\n `${path.join(__dirname, '..', ExelSaveLocation)}/DataStructure.csv`,\n function(err) {\n if (err) {\n console.log(err);\n return res.status(500).send({msg: 'Error occured'});\n }\n issuePhpCommand(0, fileNames[1] + currentDate);\n issuePhpCommand(3, fileNames[1] + currentDate);\n //__check file or history file for text sheet and var sheet__\n if (req.files.textSheet && req.files.varSheet) {\n //__Move files to wright places__\n moveRecievedFiles(\n req.files.textSheet,\n 0,\n currentDate,\n issuePhpCommand,\n );\n moveRecievedFiles(\n req.files.varSheet,\n 1,\n currentDate,\n issuePhpCommand,\n );\n } else if (req.files.textSheet && !req.files.varSheet) {\n moveRecievedFiles(\n req.files.textSheet,\n 0,\n currentDate,\n issuePhpCommand,\n );\n issuePhpCommand(2, fileNames[1] + req.body.varSheetDate);\n } else if (!req.files.textSheet && req.files.varSheet) {\n issuePhpCommand(1, fileNames[0] + req.body.textSheetDate);\n moveRecievedFiles(\n req.files.varSheet,\n 1,\n currentDate,\n issuePhpCommand,\n );\n } else if (!req.files.textSheet && !req.files.varSheet) {\n issuePhpCommand(1, fileNames[0] + req.body.textSheetDate);\n issuePhpCommand(2, fileNames[1] + req.body.varSheetDate);\n }\n let myInterval = setInterval(() => {\n if (flag === 4) {\n clearInterval(myInterval);\n if (errFlag < 0) {\n console.log('Error before procedure');\n } else {\n flag = 0;\n console.log('start procedurer..');\n //__run procedure__\n Model._start_data_processing_()\n .then(result => {\n // Check Error\n if (result.errno) throw result.sqlMessage;\n\n //__Run mailing script__\n })\n .catch(error => {\n logMessage(logError, error);\n // res.send(500, returnedData); // Return Res\n });\n }\n }\n }, 1000);\n // returing the response with file path and name\n // return res.status(200).send({\n // name: myFile.name,\n // path: `${ExelSaveLocation}/${myFile.name}`,\n // });\n },\n );\n }", "function ajaxExcelUpload()\n{ \n var attachmentFileName = document.getElementById('file').value; \n if(attachmentFileName.length==0){\n document.getElementById('resultMessage').innerHTML = \"<font color=red>Please upload File.</font>\";\n }\n else { \n $.ajaxFileUpload({ \n url:'ajaxExcelUpload.action', \n secureuri:false,//false\n fileElementId:'file',//id <input type=\"file\" id=\"file\" name=\"file\" />\n dataType: 'json',// json\n success: function(data,status){ \n var displaymessage = \"<font color=red>Please try again later</font>\"; \n // alert(data);\n if(data.indexOf(\"uploaded\")>0){ \n //if(data==\"uploaded\"){ \n displaymessage = \"<font color=green>Uploaded Successfully.</font>\";\n } \n if(data.indexOf(\"Error\")>0){ \n //if(data==\"Error\"){ \n displaymessage = \"<font color=red>Internal Error!, Please try again later.</font>\"\n } //if(data==\"Exceded\"){ \n if(data.indexOf(\"Exceded\")>0){ \n displaymessage = \"<font color=red>Max records exceded.Please upload less than 1500 .</font>\"\n } \n if(data.indexOf(\"InvalidFormat\")>0){ \n //if(data==\"InvalidFormat\"){ \n displaymessage = \"<font color=red>Please upoload excelsheet with specified header fileds.</font>\"\n } \n document.getElementById('resultMessage').innerHTML = displaymessage; \n },\n error: function(e){ \n document.getElementById('resultMessage').innerHTML = \"<font color=red>Please try again later</font>\"; \n }\n }); \n }\n //}\t\n return false;\n}", "function handleDrop(e) {\n e.stopPropagation();\n e.preventDefault();\n var files = e.dataTransfer.files;\n var i,f;\n for (i = 0; i != files.length; ++i) {\n f = files[i];\n var reader = new FileReader();\n var name = f.name;\n reader.onload = function(e) {\n var data = e.target.result;\n\n var workbook;\n if(rABS) {\n /* if binary string, read with type 'binary' */\n workbook = XLSX.read(data, {type: 'binary'});\n } else {\n /* if array buffer, convert to base64 */\n var arr = fixdata(data);\n workbook = XLSX.read(btoa(arr), {type: 'base64'});\n }\n let sheets = []\n for (let i in workbook.Sheets){\n sheets.push(workbook.Sheets[i])\n }\n const worksheet = XLSX.utils\n .sheet_to_json(\n sheets[0]\n )\n for (let row of worksheet){\n if (!people.map(person => person.Name.toLowerCase()).includes(row.Name.toLowerCase())){\n people.push(row)\n people[people.length -1].inFiles = [name];\n people[people.length -1].linkedTo = [];\n }else {\n let existing = people.find(person => person.Name.toLowerCase() === row.Name.toLowerCase())\n Object.assign(existing,row)\n if (!existing.inFiles.includes(name)){\n existing.inFiles.push(name);\n }\n \n }\n }\n for (let person of people){\n let lowerName = person.Name.toLowerCase()\n for (let p of people){\n let matches = \n Object.entries(p)\n .map((value)=>{\n let result = {match:false}\n if (value[0] != 'Name'){\n if (typeof(value[1])===\"string\"){\n \n result.match = value[1].toLowerCase().includes(lowerName)\n result.field = value[0];\n result.text = value[1];\n }\n }\n return result;\n }\n )\n\n for (let match of matches){\n if (match.match === true && person.Name != p.Name)\n {\n let linkTo = {name:p.Name, match:{field:match.field, text:match.text}}\n let linkFrom = {name:person.Name, match:{field:match.field, text:match.text}}\n\n let gotAlready = person.linkedTo.map( m => { return (m.name == linkTo.name && match.text == linkTo.match.text && match.field == linkTo.match.field)})\n let gotAlreadyFrom = p.linkedTo.map( m => { return (m.name == linkFrom.name && match.text == linkFrom.match.text && match.field == linkFrom.match.field)})\n if (!gotAlready.includes(true)) person.linkedTo.push(linkTo)\n if (!gotAlreadyFrom.includes(true) ) p.linkedTo.push(linkFrom)\n }\n }\n }\n }\n updateStats();\n updateFiles(name); \n };\n if(rABS) reader.readAsBinaryString(f);\n else reader.readAsArrayBuffer(f);\n }\n}", "function doit(type, fn, dl) {\n tableChanged = false;\n editEnabled = true;\n $('#xportxlsx').prop(\"disabled\", true);\n $('#xportxlsx').css(\"background-color\", \"#6c757d\");\n $('#xportxlsx').css(\"border-color\", \"#6c757d\");\n setEdit();\n //var data = XLSX.write(workbook, {bookType:type, bookSST:true, type: 'base64'});\n var data = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});\n var fd = new FormData();\n fd.append('excelFile', new File([data], 'sheetjs.xlsx'));\n fetch(urlUsed + \"/uploadFile\", {method: \"POST\", body: fd}).then(function(res) {\n if(res.status === 200){\n $(\"#upload-success\").modal(\"show\");\n } else {\n alert(\"Error al guardar fichero\");\n }\n }).catch(function(error) {\n alert(\"Error en la conexión al servidor\");\n });\n}", "function upload_excel(filename) {\n xlsxFile(filename).then((rows) => {\n\n rows.splice(0, 1); // for remove headers in excel file\n\n // inserting into mysql\n con.query(\"insert into products(PRDT_NAME, PRDT_TYPE, PRDT_PRICE) VALUES ? on duplicate key update PRDT_NAME=VALUES(PRDT_NAME), PRDT_TYPE=VALUES(PRDT_TYPE), PRDT_PRICE=VALUES(PRDT_PRICE)\", [rows], function (error, results, fields) {\n if (error) return false;\n return true\n\n });\n })\n\n}", "function parseFile(req, res, next){\n var filePath = req.files.file.path;\n console.log(filePath);\n function onNewRecord(record){\n console.log(record)\n }\n\n function onError(error){\n console.log(error)\n }\n\n function done(linesRead){\n res.send(200, linesRead)\n }\n\n var columns = true; \n parseCSVFile(filePath, columns, onNewRecord, onError, done);\n\n}", "function getRecord() {\n var sheet = SpreadsheetApp.getActiveSheet();\n var data = sheet.getDataRange().getValues();\n var headers = data[0];\n var rowNum = sheet.getActiveCell().getRow();\n if (rowNum > data.length) return [];\n var record = [];\n for (var col=0;col<headers.length;col++) {\n record.push(data[rowNum-1][col]);\n }\n return record;\n}", "_packageUploadedEnrollmentValues(thisObj, worksheet, columnInfo) {\n var result = {success: false, data: null};\n \n var enrollments = [];\n worksheet.eachRow({includeEmpty: true}, function(row, rowNumber) {\n var student = row.getCell(columnInfo[thisObj.colEnrollment_Student]).value;\n student = thisObj._formatEnrollmentStudentName(student);\n \n var term = row.getCell(columnInfo[thisObj.colEnrollment_Term]).value;\n var section = row.getCell(columnInfo[thisObj.colEnrollment_Section]).value;\n\n if (student != thisObj.colEnrollment_Student) {\n enrollments.push({\n \"student\": student,\n \"term\": term,\n \"section\": section,\n \"startdate\": thisObj._formatDate(row.getCell(columnInfo[thisObj.colEnrollment_StartDate]).value),\n \"enddate\": thisObj._formatDate(row.getCell(columnInfo[thisObj.colEnrollment_EndDate]).value),\n \"email\": row.getCell(columnInfo[thisObj.colEnrollment_Email]).value,\n \"affiliation\": row.getCell(columnInfo[thisObj.colEnrollment_Affiliation]).value\n });\n }\n });\n \n result.success = true;\n result.data = {\n \"enrollments\": enrollments\n };\n \n return result;\n }", "getCellValues() {\n var table = this.tableCsvTarget\n var lines = [];\n for (var r = 1, n = table.rows.length; r < n; r++) {\n var line = [];\n for (var c = 0, m = table.rows[r].cells.length - 3; c < m; c++) {\n line.push(this.tableHeaders[c].replace(/(\\r\\n|\\n|\\r)/gm, \"\") + \": \" + table.rows[r].cells[c+1].innerText);\n // line.push(table.rows[r].cells[c].innerText);\n }\n lines.push(line);\n }\n this.saveCsv({ upload: lines })\n }", "async function f() {\n await conn.connect();\n\n var wb = XLSX.utils.book_new();\n\n async function book_append_table(wb, name,sheet, where) {\n var string= \"SELECT tmp.* FROM sigra_view.v_geral,geo_din.loteamento, \" +name+ \" as tmp \"+\n \"where tmp.cod_coleta=sigra_view.v_geral.cod_coleta and sigra_view.v_geral.cod_coleta=geo_din.loteamento.cod_coleta and\" +\n \"( geo_din.loteamento.cod_sipra='MG0313000' or geo_din.loteamento.cod_sipra='MG0383000' or geo_din.loteamento.cod_sipra='MG0112000' or geo_din.loteamento.cod_sipra='MG0116000' ) \"+where+' '\n //console.log(string)\n var r_f = await conn.query(string );\n var r=[];\n var numeric=[]\n r_f.fields.forEach((elem)=>{\n //console.log(elem)\n if(elem.dataTypeID==1700)\n numeric.push(elem)\n })\n //console.log(numeric)\n if(r_f.rows.length>0){\n r_f.rows.forEach((json)=>{\n numeric.forEach((key)=>{\n json[key.name]=parseFloat(json[key.name])\n })\n })\n //console.log(r_f.rows)\n r=r_f.rows;\n }else{\n var tmp={}\n r_f.fields.forEach((elem)=>{\n tmp[elem.name]='';\n })\n r.push(tmp)\n }\n var ws = XLSX.utils.json_to_sheet(r);\n XLSX.utils.book_append_sheet(wb, ws, sheet);\n }\n async function processArray(wb,array) {\n for(let i in array){\n console.log(array[i].name)\n await book_append_table(wb, array[i].view,array[i].name,array[i].where);\n }\n }\n //await book_append_table(wb, options[0].view,options[0].name);\n await processArray(wb,options)\n XLSX.writeFile(wb, \"sigra.xlsx\");\n console.log(\"finish\")\n}", "function parseExcelFile(excel_path) {\n // Checking for excel path\n if (excel_path === null || excel_path === '') {\n throw new Error('Excel file path is null or epty');\n }\n var workbook = XLSX.readFile(excel_path);\n var sheet_name_list = workbook.SheetNames;\n var data = XLSX.utils.sheet_to_json(workbook.Sheets[sheet_name_list[0]]);\n return data;\n}", "function loadSamplesFileToDataframe(filePath) {\n var fieldSampleEntries = [];\n for (var field of $(\"#form-add-a-sample\")\n .children()\n .find(\".samples-form-entry\")) {\n fieldSampleEntries.push(field.name.toLowerCase());\n }\n client.invoke(\n \"api_convert_subjects_samples_file_to_df\",\n \"samples\",\n filePath,\n fieldSampleEntries,\n (error, res) => {\n if (error) {\n log.error(error);\n console.error(error);\n var emessage = userError(error);\n Swal.fire({\n title: \"Couldn't load existing samples.xlsx file\",\n text: emessage,\n icon: \"error\",\n heightAuto: false,\n backdrop: \"rgba(0,0,0, 0.4)\",\n });\n } else {\n // res is a dataframe, now we load it into our samplesTableData in order to populate the UI\n if (res.length > 1) {\n samplesTableData = transformImportedExcelFile(\"samples\", res);\n ipcRenderer.send(\n \"track-event\",\n \"Success\",\n \"Prepare Metadata - Create samples.xlsx - Load existing samples.xlsx file\",\n samplesTableData\n );\n loadDataFrametoUISamples();\n } else {\n ipcRenderer.send(\n \"track-event\",\n \"Error\",\n \"Prepare Metadata - Create samples.xlsx - Load existing samples.xlsx file\",\n samplesTableData\n );\n Swal.fire({\n title: \"Couldn't load existing samples.xlsx file\",\n text: \"Please make sure there is at least one sample in the samples.xlsx file.\",\n icon: \"error\",\n heightAuto: false,\n backdrop: \"rgba(0,0,0, 0.4)\",\n });\n }\n }\n }\n );\n}", "function readFromASpreadSheetWithFileDetail(item, selected, callback, user){\n if (item.mimeType == \"application/vnd.google-apps.spreadsheet\") {\n \n var targetFileId = item.id;\n \n var auth = {\n type: 'Bearer',\n value: gapi.oauth2Client.credentials.access_token\n };\n var my_sheet = new googleSpreadsheetNew(targetFileId, auth);\n\n my_sheet.getInfo( function( err, sheet_info ){\n if (err) {\n callback(err, []);\n } else {\n // console.log(sheet_info);\n // console.log( sheet_info.title + ' is loaded' );\n sheet_info.worksheets[0].getRows( function( err, rows ){\n if (err) {\n callback(err, []);\n }else {\n var studentInfo = [];\n var excludedFileds = [\"_xml\", \"name\", \"id\", \"title\", \"content\", \"_links\", \"save\", \"del\"];\n\n for (var i = 0; i < rows.length; i++) {\n // hardcoded\n var row = rows[i];\n var student = {};\n student.id = row.id;\n student.name = row.name;\n var data = {};\n for (key in row){\n if (excludedFileds.indexOf(key) == -1) {\n data[key] = row[key];\n };\n }\n student.data = data;\n studentInfo.push(student);\n };\n callback(null, selected, studentInfo, user);\n }\n });\n }\n });\n\n\n\n\n\n\n // var targetFileId = item.id;\n\n // console.log(\"trying to reading spreadsheet \" + item.title);\n\n // googleSpreadsheet.load({\n // debug: true,\n // spreadsheetId: targetFileId,\n // worksheetName: 'Sheet1',\n // accessToken : {\n // type: 'Bearer',\n // token: gapi.oauth2Client.credentials.access_token\n // }\n // }, function sheetReady(err, spreadsheet) {\n // if(err) {\n // var message = \"error when loading the spreadsheet\";\n // callback(message, []);\n // } else {\n // spreadsheet.receive(function(err, rows, info) {\n // // console.log(JSON.stringify(spreadsheet));\n // if(err){\n // var message = \"error while reading spreadsheet\";\n // callback(message, []);\n // }else {\n // var numOfRows = info.totalRows;\n // var studentInfo = [];\n\n // if (numOfRows <= 0) {\n // var message = \"first row of spreadsheet \" + item.title + \" is not initialised\";\n // callback(message, []);\n\n\n // } else {\n // var fieldNames = [];\n // for (key in rows['1']){\n // fieldNames.push(rows['1'][key]);\n // }\n\n\n // for (var i = 2; i < numOfRows+1; i++) {\n // var index = '' + i;\n // var curStudent = rows[index];\n // console.log(curStudent);\n\n // var curRow = {};\n // // var curRow = [];\n // var fieldCount = 0;\n // for (index2 in curStudent) {\n // curRow[fieldNames[fieldCount]] = curStudent[index2];\n // fieldCount++;\n // // curRow.push(curStudent[index2]);\n // };\n\n // var curInfo = {name:curStudent['1'] , id:curStudent['2'], data:curRow }\n // studentInfo.push(curInfo);\n // };\n\n // console.log(\"finish reading spreadsheet \" + item.title);\n // callback(null, selected, studentInfo);\n // }\n // } \n // });\n // }\n\n // }\n // );\n\n } else {\n var message = \"unknown type error of student detail file: \" + res.mimeType;\n callback(message, []);\n }\n}", "function getSheetTargetData(sheet_name) {\n var wb = xlsx.readFile(path_target);\n var listSheetNames = wb.SheetNames;\n console.log('all sheetName is ...', listSheetNames);\n // list_sheet_name.forEach(function(sheet_name) {\n // get sheet \n var wsheet = wb.Sheets[sheet_name];\n // console.log('wsheet ...', wsheet);cls\n // get data 1.name 2.row and col\n var range_str = wsheet['!ref'];\n var cell_range = analysisCell(range_str);\n\n var col = 3; // row = 3\n for (var row = 0; row < cell_range.c; row++) {\n var xy = xlsx.utils.encode_cell({ r: row, c: col });\n // console.log('xy ...',xy);\n var cell = wsheet[xy];\n // console.log('cell row ...',cell)\n if (cell && cell.v) { // if have value than add to list\n var item_tar = { \"val\": cell.v, \"row\": row, \"col\": col };\n data_target.push(item_tar);\n }\n }\n}", "function saveDataToSheet(records)\n{\n //START - command to clear the data in the Spreadsheet\n ClearCells();\n //END - command to clear the data in the Spreadsheet \n \n var spreadsheet = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1WG-gZMZuRni403_fskzHYnqW8qm0AxqeUwfnRyOw3Cc/edit#gid=0');\n var sheet = spreadsheet.getSheetByName(\"Sheet1\");\n for(var r=0;r<records.length;r++)\n {\n sheet.appendRow([records[r].OrderId,records[r].Quantity,records[r].Product, records[r].Destination,records[r].CustomerEmail ]);\n }\n \n}", "function getValuesFromFile(fileName, callbackFn) {\n\t\tfileName = fileName || 'data/images.json';\n\t\thttp.get(fileName).success(function (dataObj) {\n\t\t\tif (dataObj instanceof Array) {\n\t\t\t\tif (dataObj.length > 0) {\n\t\t\t\t\tconsole.log(\"FILE RETRIEVED : \", dataObj.length);\n\t\t\t\t\tcallbackFn(dataObj);\n\t\t\t\t}\n\t\t\t}\n\t\t}).error(function (err) {\n\t\t\tconsole.log(\"ERROR >> \", err);\n\t\t});\n\t}", "function upload(evt) {\n \tif (!browserSupportFileUpload()) {\n\t alert('The File APIs are not fully supported in this browser!');\n } else {\n \tconsole.log('.CSV');\n var data = null;\n var file = evt.target.files[0];\n var reader = new FileReader();\n reader.readAsText(file);\n reader.onload = function(event) {\n \ttry{\n\t var csvData = event.target.result;\n\t console.log(csvData);\n\t data = $.csv.toArrays(csvData);\n\t if (data && data.length > 0) {\n\t \tconsole.log(data[0]);\n\t \tconsole.log(data[1]);\n\t \n\t ANIM.Success('fa-building', 'Se encontraron ' + data.length + ' registros.');\n\t //alert('Imported -' + data.length + '- rows successfully!');\n\t \n\t $('#tablaDatosMSV tbody tr').remove();\n\t\t \t$.each(data, function (i, value) {\n\t\t \t\t\tdata[i] = data[i] + '\\n';\n\t\t \t\t\t$.each(value, function(j, val){\n\t\t \t\t\t\t//console.log(val);\n\t\t \t\t\t\tif(val.trim() == ''){\n\t\t \t\t\t\t\tdata[i][j] = msv_Alta[j].def;\n\t\t \t\t\t\t\tconsole.log(value[j] + '...');\n\t\t \t\t\t\t\tvalue[j] = msv_Alta[j].def;\n\t\t \t\t\t\t\t//value[j] = 'msv_Alta[j].def';\n\t\t \t\t\t\t\tconsole.log(value[j] + '...2');\t\n\t\t \t\t\t\t}\n\t\t \t\t\t\t\n\t\t \t\t\t});\n\t\t \t\t\t\n\t\t \t\t\tif(i > 0)\n\t\t \t\t\t$('#tablaDatosMSV tbody').append($(getRowFragmentMSV(value)).fadeIn(0));\t \t\t\t\n\t\t \t\t\t\t\n\t\t \t\t});\n\t\t \t\t\n\t\t \t\tmsv_Alta_data = data;\n\t \t\t \t\t\n\t\t \t\t\t \t\t\n\t\t \t\tvar tableFixed = $('#tablaDatosMSV').dataTable({\n\t\t\t\t \t\tretrieve: true,\n\t\t\t\t \t\tdestroy: true,\n\t\t\t\t\t\tinfo: false,\n\t\t\t\t\t\tpageLength: 10,\n\t\t\t\t\t\t//paging: false\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\t$(\"#btnMASIVO\").click();\n\t\t\t\t\t//new $.fn.dataTable.FixedHeader( tableFixed );\t \n \t}\n\t \n \telse {\n \talert('No data to import!');\n \t}\n \t}\n \tcatch(ex){\n \t\tANIM.Error('Error Cargar los Recoridos.');\n \t}\n };\n reader.onerror = function() {\n \tconsole.log(':/ .CSV');\n alert('Unable to read ' + file.fileName);\n };\n }\n }", "function readTextFile(address_of_cell)\r\n{\r\nif(typeof require !== 'undefined') XLSX = require('xlsx');\r\nvar workbook = XLSX.readFile('users.xlsx');\r\nvar first_sheet_name = workbook.SheetNames[0];\r\nvar worksheet = workbook.Sheets[first_sheet_name];\r\nvar desired_cell = worksheet[address_of_cell];\r\nvar desired_value = desired_cell.v;\r\nreturn desired_value;\r\n}", "function fileReader(dataset, callback) {\r\n\r\n var files =fs.readdirSync('./data/sets/'+dataset);\r\n\r\n //for(var i = 0;i< files.length;i++){\r\n proccessFile(dataset, 0,files,callback)\r\n}", "function upload(evt) {\r\n\tif (!browserSupportFileUpload()) {\r\n\t\talert('The File APIs are not fully supported in this browser!');\r\n\t\t} else {\r\n\t\t\tvar csvArrData = null;\r\n\t\t\tvar file = evt.target.files[0];\t\t\t\t\t\t\r\n\t\t\tvar reader = new FileReader();\r\n\t\t\treader.readAsText(file);\r\n\t\t\treader.onload = function(event) {\r\n\t\t\t\tvar csvData = event.target.result;\r\n\t\t\t\tcsvArrData = $.csv.toArrays(csvData);\t\t\t\t\t\t\r\n\t\t\t\tif (csvArrData && csvArrData.length > 0) {\r\n\t\t\t\t\t//alert('Imported -' + csvArrData.length + '- rows successfully!');\r\n\t\t\t\t\tPrepareHistData(csvArrData);\r\n\t\t\t\t\tgetDataByInterval(120);\r\n\t\t\t\t\tgetDataByInterval(240);\r\n\t\t\t\t\tgetDataByInterval(480);\r\n\t\t\t\t\tdisplayTradeAnalytics();\r\n\t\t\t\t\tEnableLoadedState(true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\talert('No data to import!');\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\treader.onerror = function() {\r\n\t\t\t\talert('Unable to read ' + file.fileName);\r\n\t\t\t};\r\n\t}\r\n}", "function validar_formato_xls(sender){\n\n var validExts = new Array(\".xlsx\", \".xls\");\n var fileExt = sender.value;\n fileExt = fileExt.substring(fileExt.lastIndexOf('.'));\n if (validExts.indexOf(fileExt) < 0) {\n //mensaje\n swal(\"Formato invalido \" ,\"Los formatos admitidos son: xls, xlsx !!\",\"warning\");\n //null el input file\n $(\"#\"+sender.id).val(null);\n }\n else return true;\n\n }//end function validar_formato", "function upload_csv(evt)\n{\n var data=null;\n var file=evt.target.files[0];\n var reader= new FileReader();\n reader.readAsText(file);\n reader.onload = function(event)\n {\n var csvData = event.target.result;\n var data = parse_csv(csvData);\n if (data && data.length > 0)\n {\n $(\"#csv_file_output\").append(\"Imported \" + data.length + \" rows successfully!<br />\");\n display_csv(data);\n var processed_data = process_for_histogram(data);\n //TODO: Show for general\n show_histogram(processed_data[1]); //0th index holds the primary key\n }\n else\n {\n $(\"#csv_file_output\").append(\"No data to import!<br />\");\n }\n }\n reader.onerror = function()\n {\n $(\"#csv_file_output\").append(\"Unable to read \" + file.fileName + \"<br />\");\n }\n}", "async function writeDataToExcel(pathname, fileInfos) {\n let wb = new xl.Workbook();\n\n let ws = wb.addWorksheet('Index');\n let deviceInfo = '';\n // Add first two headers\n ws.cell(1, 1).string('Workloads');\n ws.cell(1, 2).string('CaseId');\n let resultList = [];\n for (const fileInfo of fileInfos) {\n let results = {};\n for (let workload in fileInfo) {\n let resultFilePath = fileInfo[workload];\n \n if (!fs.existsSync(resultFilePath)) {\n return Promise.reject(`${resultFilePath} does not exist, failed to write to Excel!`);\n }\n let rawData = await fsPromises.readFile(resultFilePath, 'utf-8');\n results[workload] = JSON.parse(rawData);\n }\n resultList.push(results);\n }\n\n let workloadCol = [];\n let caseIdCol = [];\n let scoreCols = [];\n let once = true;\n // Loop through all results of chrome flags\n for (let i=0; i < resultList.length; i++) {\n let secondOnce = true;\n let scoreCol = [];\n // Loop through results of workloads in one round\n for (let workload in resultList[i]) {\n let workloadResult = resultList[i][workload];\n // Since we combined one round of test result with multiple workloads into one column,\n // so only need to add header name once here.\n if (secondOnce) {\n let flagName = workloadResult['chrome_flags'];\n // Add header name for each chrome flag\n console.log(flagName)\n ws.cell(1, 3 + i).string(flagName.join(\",\"));\n }\n for (let key in workloadResult['test_result']) {\n // for (let subCase in workloadResult['test_result']) {\n if (once) {\n workloadCol.push(workload);\n caseIdCol.push(key);\n }\n scoreCol.push(workloadResult['test_result'][key]);\n }\n secondOnce = false;\n }\n scoreCols.push(scoreCol);\n once = false;\n }\n\n // Insert workload name column and case id column\n for (let i=0; i<workloadCol.length; i++) {\n ws.cell(2+i, 1).string(workloadCol[i]);\n ws.cell(2+i, 2).string(caseIdCol[i]);\n }\n\n // Insert score columns\n for (let i=0; i<scoreCols.length; i++) {\n for(let j=0; j<scoreCols[i].length; j++) {\n ws.cell(2+j, 3+i).string(scoreCols[i][j]);\n }\n }\n await wb.write(pathname);\n console.log(`************Excel generation at: ${pathname}*****************`);\n\n return Promise.resolve();\n}", "function createEmployeeRecords(arrOfArrays){\n return arrOfArrays.map(createEmployeeRecord)\n}", "function loadZipCodeCSV(files)\r\n{\r\n\t// Load up a FileReader to get the CSV\r\n\tvar reader = new FileReader();\r\n\treader.onload = function (event)\r\n\t{\r\n\t\tzipCodeCSVstring = event.target.result;\r\n\t\toutputDivString += \"&nbsp&nbspCSV Loaded!<br />\";\r\n\t\t$('#outputDiv').html(outputDivString);\r\n\t};\r\n\treader.onerror = function () { alert('Unable to read ' + file.fileName); };\r\n\treader.readAsText(files[0]);\r\n\r\n\t//Load all possible US ZipCodes from file\r\n\tloadMarkerZipCodes();\r\n\r\n\t//Initialize next step\r\n\t$('#step1').hide();\r\n\t$('#step2').show();\r\n}", "function upload(evt) {\n if (!browserSupportFileUpload()) {\n alert('The File APIs are not fully supported in this browser!');\n }\n else {\n var data = null;\n var file = evt.target.files[0];\n var reader = new FileReader();\n reader.readAsText(file);\n reader.onload = function(event) {\n var csvData = event.target.result;\n data = $.csv.toObjects(csvData.replace(/\"/g, ''));\n if (data && data.length > 0) {\n // here we're checking if the file is a people file or group file\n if (JSON.stringify(Object.keys(data[0])) === JSON.stringify(getPersonSchema())) {\n // save to database\n addPeople(data);\n //$('#people-table').dynatable({ dataset: { records: data }});\n $('#people-table').show();\n }\n else if(JSON.stringify(Object.keys(data[0])) === JSON.stringify(getGroupSchema())) {\n // save to database\n addGroups(data)\n }\n else {\n showError('The file format is invalid!');\n }\n }\n else {\n showError('No data to import!');\n $('#people-table').hide();\n }\n };\n reader.onerror = function() {\n showError('Unable to read ' + file.fileName);\n };\n }\n }", "function excelTypeCheck(file) {\n if(['xlsx','xls'].indexOf(file.name.split('.').pop()) == -1) {\n document.getElementById(\"process_status\").style.color = \"red\";\n document.getElementById('process_status').innerHTML = \"Error: Excel document must be XLS or XLSX file.\";\n return false;\n }\n return true;\n}", "function Xlsx() {\n }", "function loadSubjectsFileToDataframe(filePath) {\n var fieldSubjectEntries = [];\n for (var field of $(\"#form-add-a-subject\")\n .children()\n .find(\".subjects-form-entry\")) {\n fieldSubjectEntries.push(field.name.toLowerCase());\n }\n client.invoke(\n \"api_convert_subjects_samples_file_to_df\",\n \"subjects\",\n filePath,\n fieldSubjectEntries,\n (error, res) => {\n if (error) {\n log.error(error);\n console.error(error);\n var emessage = userError(error);\n Swal.fire({\n title: \"Couldn't load existing subjects.xlsx file\",\n text: emessage,\n icon: \"error\",\n heightAuto: false,\n backdrop: \"rgba(0,0,0, 0.4)\",\n });\n } else {\n // res is a dataframe, now we load it into our subjectsTableData in order to populate the UI\n if (res.length > 1) {\n subjectsTableData = transformImportedExcelFile(\"subjects\", res);\n loadDataFrametoUI();\n ipcRenderer.send(\n \"track-event\",\n \"Success\",\n \"Prepare Metadata - Create subjects.xlsx - Load existing subjects.xlsx file\",\n \"\"\n );\n } else {\n ipcRenderer.send(\n \"track-event\",\n \"Error\",\n \"Prepare Metadata - Create subjects.xlsx - Load existing subjects.xlsx file\",\n error\n );\n\n Swal.fire({\n title: \"Couldn't load existing subjects.xlsx file\",\n text: \"Please make sure there is at least one subject in the subjects.xlsx file.\",\n icon: \"error\",\n heightAuto: false,\n backdrop: \"rgba(0,0,0, 0.4)\",\n });\n }\n }\n }\n );\n}", "handleImportClick() {\n console.log('Entered handleImportClick....');\n axios.get('data/getGSheet', {\n params: {\n googleSheetID: this.state.googleSheetID\n }\n })\n\n .then((res) => {\n let data = res.data.map((row) => {\n return [...row];\n });\n this.setState({\n spreadSheetData: data\n }, () => { console.log(data)});\n this.convertSpreadSheetDataToArrayOfObjects();\n })\n .catch(() => {\n console.log(\"Error!!!\");\n });\n }", "loadCSV(e) {\n var vm = this\n if (window.FileReader) {\n var reader = new FileReader();\n reader.readAsText(e.target.files[0]);\n // Handle errors load\n reader.onload = function(event) {\n var csv = event.target.result;\n vm.parse_csv = vm.csvJSON(csv)\n };\n }\n }", "function handleFile(file) {\n // Check for the various File API support.\n if (window.FileReader) {\n // FileReader are supported.\n var reader = new FileReader();\n reader.onload = loadHandler;\n reader.onerror = errorHandler;\n reader.readAsText(file)\n } else {\n alert('FileReader is not supported in this browser, so your uploaded user dataset cannot be read.');\n }\n }", "function fileReadSucess(fileArray,fileName){\n //if the read operation completes\n //create and object containing the file array and the file name\n //then add that object to the attachedFileData array\n var fileData = {\n fileString:fileArray.target.result,\n fileName: fileName\n }\n attachedFileData.push(fileData);\n console.log(attachedFileData);\n}", "function uploadDealcsv() { }", "function ImportXML2Json(req,res,callback){ \n\t\tvar path=req.file.path; \n\t\tvar exceltojson=\"\"; \n\t\tvar json;\n\t\t//recognize if it xls or xlsx\n\t\tif(req.file.originalname.split('.')[req.file.originalname.split('.').length-1] === 'xlsx'){\n exceltojson = xlsxtojson;\n } else {\n exceltojson = xlstojson;\n }\n try {\n exceltojson({\n input: path,\n output: null, //since we don't need output.json\n lowerCaseHeaders:true //since we don't need output.json \n }, function(err,result){\n \t//Delete the file we dont need i\n \tfs.unlink(path, (err) => {\n\t\t\t\t\t if (err) callback(res.json({error_code:1,err_desc:err, data: null}),null);\n\t\t\t\t\t console.log('successfully deleted');\n\t\t\t\t\t});\n\t\t\t\t\t//Now we continue\n if(err) {\n \tconsole.log(err);\n callback({error_code:1,err_desc:err, data: null},null);\n } \n //now saave the data\n \tvar json = SetCampaignJSON(result,req.query.idSite); \n \tcallback(null,json);\n \n });\n } catch (e){\n \tcallback({error_code:1,err_desc:\"Corupted excel file\"},null); \n }\n\n}", "function processFileList(param) {\n // called by processRetrieveComplete\n\n var dataType = (param.data_tp == undefined) ? \"SrmOpenSrc\" : param.data_tp; // Set File Data Type\n var objID = (param.obj_id == undefined) ? \"grdData_FileA\" : param.obj_id; // Set File Data Type\n\n var args = {\n source: {\n type: \"INLINE\",\n argument: [\n { name: \"arg_data_tp\", value: dataType },\n { name: \"arg_data_key\", value: (param.data_key == undefined ? \"%\" : param.data_key) },\n { name: \"arg_data_seq\", value: (param.data_seq == undefined ? 0 : param.data_seq) },\n { name: \"arg_sub_key\", value: (param.data_subkey == undefined ? \"%\" : param.data_subkey) },\n { name: \"arg_sub_seq\", value: (param.data_subseq == undefined ? 0 : param.data_subseq) },\n { name: \"arg_use_yn\", value: (param.use_yn == undefined ? \"%\" : param.use_yn) }\n ]\n },\n target: [{ type: \"GRID\", id: objID, select: true }],\n key: param.key\n };\n gw_com_module.objRetrieve(args);\n\n}", "handleRowAction(event){ \n let actionName = event.detail.action.name; \n let row = event.detail.row; \n let tempName;\n let ext;\n this.selectedFolder=row.Id;\n if(actionName == undefined){\n var obj = { label: row.name, name: row.Id, id: row.Id};\n tempName = row.name.split('.');\n ext = tempName[(tempName.length-1)];\n if(ext != 'txt' && ext != 'ppt' && ext !='docx' && ext != 'csv' && ext!= 'pptx' && ext!= 'exe' && ext != 'zip' && ext!= 'esp' && ext != 'xlsx' && ext != 'xls' && ext != 'tif' && ext != 'tiff' && ext != 'png' && ext != 'jpeg' && ext != 'jpg' && ext != 'gif' && ext != 'html' && ext != 'pdf'){\n this.myBreadcrumbs.push(obj);\n }\n this.showDataTableSpinner = true;\n } \n if(row != null && ext != 'txt' && ext != 'ppt' && ext != 'docx' && ext != 'csv' && ext!= 'pptx' && ext!= 'exe' && ext != 'zip' && ext!= 'esp' && ext != 'xlsx' && ext != 'xls' && ext != 'tif' && ext != 'tiff' && ext != 'png' && ext != 'jpeg' && ext != 'jpg' && ext != 'gif' && ext != 'html' && ext != 'pdf'){\n getAllFiles({ \n selectedFolderId : row.Id\n }).then(result=>{\n if(actionName != undefined){\n switch(actionName){ \n case 'open_sp':\n refreshApex(this.recordToDisplay)\n window.open(row.webUrl);\n break;\n case 'edit':\n this.reNameModel = true;\n this.renamedvalue = row.name;\n this.renamefolderId=row.Id;\n break;\n case 'download': \n if(row.downloadURL != null) {\n window.open(row.downloadURL);\n }else{\n this.dispatchEvent(new ShowToastEvent({title: 'Info!',message: 'Folders cannot be downloaded',variant: 'info'}),);\n }\n break;\n case 'delete':\n this.deleteModel = true;\n this.deletefolderId =row.Id;\n this.deleteFoldername = row.name;\n break;\n }\n }else{\n if(this.recordList != ''){\n this.recordList = '';\n this.recordList = result;\n this.searchBar = this.recordList;\n this.recordToDisplay.push(result);\n this.totalRec = result; \n this.setRecordsToDisplay();\n refreshApex(this.recordToDisplay);\n }\n }\n this.showDataTableSpinner = false;\n }).catch(error=>{\n console.log('There is an error in HandleRowAction method');\n });\n }else{\n this.showDataTableSpinner = false;\n }\n }", "'change .upload-csv'(event, template) {\n var count = 0;\n Papa.parse( event.target.files[0], {\n header: true,\n complete(results, file) {\n results.data.forEach(function(data) {\n addStudent(template, data.Username);\n });\n },\n error(error, file){\n console.log(error);\n }\n });\n }", "loadFile() {\n this.csvReader.readFromFile(this.file).then((result) => this.process(result));\n }", "function handleFiles1(files) {\n if (window.FileReader) {\n getAsText1(files[0]);\n } else {\n alert('FileReader are not supported in this browser.');\n }\n}", "function applyUnitData(file,row,headers,sheet,firstHeaderColumn) {\n \n var fileId = file.getId();\n var tableContent = tableContents(fileId,headers[0]); // returns object [][] of table contents\n var fileUrl = file.getUrl();\n var fileName = file.getName();\n var fileModDate = file.getLastUpdated();\n \n sheet.getRange(row+1, firstHeaderColumn,1,tableContent[0].length).setValues(tableContent); //sets unit data or row\n sheet.getRange(row+1, 2, 1).setValue(fileUrl); //sets file url NOTE make sure corresponds to correct heading\n sheet.getRange(row+1, 3, 1).setValue(fileName); //sets file id NOTE make sure corresponds to correct heading\n sheet.getRange(row+1, 4, 1).setValue(fileModDate); //sets file id NOTE make sure corresponds to correct heading\n\n}", "function parse_ExternSheet(blob, length, opts) {\n\tif(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);\n\tvar o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);\n\twhile(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));\n\t\t// [iSupBook, itabFirst, itabLast];\n\tvar oo = [];\n\treturn o;\n}", "function parse_ExternSheet(blob, length, opts) {\n\tif(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);\n\tvar o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);\n\twhile(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));\n\t\t// [iSupBook, itabFirst, itabLast];\n\tvar oo = [];\n\treturn o;\n}", "function parse_ExternSheet(blob, length, opts) {\n\tif(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);\n\tvar o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);\n\twhile(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));\n\t\t// [iSupBook, itabFirst, itabLast];\n\tvar oo = [];\n\treturn o;\n}", "function parse_ExternSheet(blob, length, opts) {\n\tif(opts.biff < 8) return parse_BIFF5ExternSheet(blob, length, opts);\n\tvar o = [], target = blob.l + length, len = blob.read_shift(opts.biff > 8 ? 4 : 2);\n\twhile(len-- !== 0) o.push(parse_XTI(blob, opts.biff > 8 ? 12 : 6, opts));\n\t\t// [iSupBook, itabFirst, itabLast];\n\tvar oo = [];\n\treturn o;\n}", "loadTableFromCSVFile(seperator){\n var seperator = this.csvSeperator;\n var firstLine = [];\n\n var indexTime = -1;\n var indexLow = -1;\n var indexHigh = -1;\n var indexOpen = -1;\n var indexClose = -1;\n var indexVolume = -1;\n\n var loadedIntervalls = [];\n\n fs.readFileSync(this.csvFilePath).toString().split('\\n').forEach(function (line) { \n \n var lineArray = line.split(seperator);\n\n if (firstLine.length == 0){\n\n indexTime = lineArray.indexOf(\"time\");\n indexLow = lineArray.indexOf(\"low\");\n indexHigh = lineArray.indexOf(\"high\");\n indexOpen = lineArray.indexOf(\"open\");\n indexClose = lineArray.indexOf(\"close\");\n indexVolume = lineArray.indexOf(\"volume\");\n\n //check availability needed gdax columns\n if ((indexTime != -1) && (indexLow != -1) && (indexHigh != -1) && (indexOpen != -1) && (indexClose != -1) && (indexVolume != -1) ){\n //continue\n firstLine = lineArray;\n }else{\n throw new Error(\"First line of csv needs to contain: time, low, high, open, close, volume. Additional columns are possible but will not be loaded!\");\n }\n \n }else{\n //add row by row to the TradeTable json object\n if (lineArray.length >=6){\n loadedIntervalls.push({ index: loadedIntervalls.length ,\n time: Number(lineArray[indexTime]), \n low: Number(lineArray[indexLow]), \n high: Number(lineArray[indexHigh]), \n open: Number(lineArray[indexOpen]), \n close: Number(lineArray[indexClose]), \n volume: Number(lineArray[indexVolume])});\n }\n\n \n }\n\n })\n\n this.data.intervalls = loadedIntervalls;\n }", "readSingleFile(ev) {\n // verifica se existe arquivo carregado na pagina\n if(this.hasCsvOnPage) {\n // controle para esvaziar o header gerado de arquivo anteriormente carregado\n this.headerTableTarget.innerHTML = ``\n \n // controle para esvaziar a tabela gerada de arquivo anteriormente carregado \n this.bodyTableTarget.innerHTML = `` \n } \n\n // insercao do arquivo em uma variavel local file\n var file = ev.target.files[0];\n\n // verifica se existe arquivo\n if (file) { \n // leitura do arquivo carregado na pagina atraves da funcao do JS\n var readedFile = new FileReader() \n var controller = this \n\n readedFile.onload = function (e) {\n // inserir o conteudo do arquivo carreado em uma variavel global da pagina\n controller.csv = e.target.result\n // controlar se existe arquivo carregado na pagina \n controller.hasCsvOnPage = true \n // funcao que inicia o processo de quebrar o arquivo e inserir em uma tabela html\n controller.csvToTable(controller.csv) \n }\n\n // necessario no script encontrado na internet\n readedFile.readAsText(file) \n } else {\n // falha na leitura do arquivo\n console.log(\"Falha ao ler o arquivo\") \n }\n }", "function readcsv(callback) {\n return $(document).ready(function() {\n $.ajax( {\n type: \"GET\",\n url: csv ,\n dataType: \"text\",\n success: function(data) { callback(data)}\n });\n });\n}", "function readenhancer() {\n var f = document.getElementById('enhancer').files[0];\n\n $.mobile.loading().show();\n\n if (f) {\n if(f.name.match(\".csv\") || f.name.match(\".txt\")){\n\n getenhancer(f);\n }\n else{alert(\"input format error\")}\n\n } else {\n alert(\"Failed to load file\");\n }\n\n}", "function recordInDB_file_modified(file, str) {\n if (file.search(\"select-27.csv\") == -1) return;\n readFileToArr('./modelt-az-report-repository/' + file, function (file_content) {\n var updated_file_content = file_content[0].join(\",\") + \"\\n\\n\";\n //console.log(\"\\n\\n*********************************\\n\" + updated_file_content + \"***************************************\\n\\n\");\n var lines = str.split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n (function (i) {\n if (lines[i].substring(0, 2) == \"@@\") {\n for (var k = i + 1; k < lines.length; k++) {\n (function (k) {\n //console.log(\"\\n\" + lines[k] + \"\\n\");\n if (lines[k][0] == \"+\" || lines[k][0] == \"-\") {\n var line_content = lines[k].split(\",\");\n if (line_content.length == 11 && line_content[3] != \"------\") {\n var customer_id = line_content[0].substring(1, line_content[0].length);\n var customer_code = line_content[1];\n var customer_name = line_content[2];\n var env_id = line_content[3];\n var env_code = line_content[4];\n var env_name = line_content[5];\n var deployment_id = line_content[6];\n var failed_deployment = line_content[7];\n var deployment_started = line_content[8];\n var time_queried = line_content[9];\n var already_running_in_minutes = line_content[10];\n\n var contentStr = {\n ChangedFile: file,\n ChangeType: {$ne: \"Delete\"},\n CustomerID: customer_id,\n EnvID: env_id,\n DeploymentID: deployment_id,\n };\n\n //console.log(contentStr);\n const link = getModelTLink(file, deployment_id);\n // SUB\n // -: update DB\n if (lines[k][0] == \"+\") {\n updated_file_content = updated_file_content + \"-\" + lines[k].substring(1, lines[k].length) + \"\\n\" + link + \"\\n\";\n\n MongoClient.connect(DB_CONN_STR, {\n useNewUrlParser: true,\n useUnifiedTopology: true\n }, function (err, db) {\n if (err) console.log(err);\n console.log(Date() + \"\\nDatabase Connected! ---- TO DELETE A LINE IN FILE\\n\");\n var dbo = db.db(\"sap-cx\");\n var collection = dbo.collection(\"CCv2LongRunningDeployment\");\n collection.updateOne(\n contentStr, {\n $set: {\n ChangeType: \"Delete\",\n DeleteTime: Date()\n }\n }, function (err, result) {\n if (err) console.log(err);\n //console.log(result);\n });\n db.close();\n });\n }\n // ADD\n // +: insert / update DB\n else if (lines[k][0] == \"-\") {\n // notification email content by line\n updated_file_content = updated_file_content + \"+\" + lines[k].substring(1, lines[k].length) + \"\\n\" + link + \"\\n\";\n // INSERT\n var document = {\n DBTime: Date(),\n ChangedFile: file,\n ChangeType: \"Insert\",\n CustomerID: customer_id,\n CustomerCode: customer_code,\n CustomerName: customer_name,\n EnvID: env_id,\n EnvCode: env_code,\n EnvName: env_name,\n DeploymentID: deployment_id,\n FailedDeployment: failed_deployment,\n DeploymentStarted: deployment_started,\n TimeQueried: time_queried,\n AlreadyRunningInMinutes: already_running_in_minutes,\n Link: link,\n DeleteTime: \"/\"\n };\n MongoClient.connect(DB_CONN_STR, {\n useNewUrlParser: true,\n useUnifiedTopology: true\n }, function (err, db) {\n if (err) console.log(err);\n console.log(Date() + \"\\nDatabase Connected! ---- TO INSERT A FILE LINE\\n\");\n var dbo = db.db(\"sap-cx\");\n var collection = dbo.collection(\"CCv2LongRunningDeployment\");\n collection.insertOne(document, function (err, result) {\n if (err) console.log(err);\n //console.log(result);\n db.close();\n });\n });\n }\n }\n }\n })(k);\n }\n }\n })(i);\n }\n // send notification email\n sendNotificationEmail(file, 2, updated_file_content);\n });\n}", "function fc_UploadFile_Validar(idUpload) { \n var file = document.getElementById(idUpload); \n var fileName=file.value; \n\n fileName = fileName.slice(fileName.lastIndexOf(\"\\\\\") + 1); \n tipoError = -1;\n if ( fileName.length > 0 )\n {\n var ext = (fileName.toLowerCase().substring(fileName.lastIndexOf(\".\")))\n var listado = new Array(\".xls\",\".csv\");\n var ok = false;\n for (var i = 0; i < listado.length; i++){\n if (listado [i] == ext) { \n ok = true;\n break; \n }\n } \n if(ok){ \n tipoError = 0;\n }else{\n tipoError = 2;\n }\n }\n else\n { \n tipoError = 1; \n }\n return tipoError; \n}", "load() {\n this.completed = false;\n this.rendered = false;\n\n // Resets variables on load\n this.raw = [];\n this.header = [];\n this.selected = [];\n if (this.chart instanceof Chart) this.chart.destroy();\n\n let readRange = {};\n if (this.fileReadRange != null) readRange = this.getNumColsFromA1(this.fileReadRange);\n console.log(`Will read ${ readRange.numCols > 0 ? 'first ' + readRange.numCols : 'all'} columns and ${ readRange.numRows > 0 ? 'first ' + readRange.numRows : 'all'} rows.`);\n this.fileReadRange = readRange.col + (readRange.numRows > 0 ? readRange.numRows : '');\n \n const selectedFile = document.getElementById('myfile').files[0];\n console.log(selectedFile.name);\n this.fileName = selectedFile.name;\n Papa.parse(selectedFile, {\n skipEmptyLines: true,\n preview: readRange.numRows > 0 ? readRange.numRows : 0,\n complete: (results) => {\n console.log('Finished:', results.data);\n this.raw = results.data;\n this.limitColumns(readRange.numCols > 0 ? readRange.numCols : 0);\n this.header = Array.from(this.raw[0]); // problem: duplicated / null headers\n this.header.shift();\n this.refreshPreview();\n this.completed = true;\n console.log(this.completed);\n }\n });\n }", "function loadMarkerZipCodes()\r\n{\r\n\t$.ajax({\r\n\t\turl: \"us-zip-codes.txt\", success: function (result)\r\n\t\t{\r\n\t\t\tmarkerZipCodeString = \"\" + result;\r\n\t\t\tmarkerZipCodeArray = $.csv.toArrays(markerZipCodeString);\r\n\t\t}\r\n\t});\r\n}", "function sheet_from_array_of_arrays(data, opts) {\n var ws = {};\n var range = {\n s: {\n c: 10000000,\n r: 10000000\n },\n e: {\n c: 0,\n r: 0\n }\n };\n for (var R = 0; R != data.length; ++R) {\n for (var C = 0; C != data[R].length; ++C) {\n if (range.s.r > R) range.s.r = R;\n if (range.s.c > C) range.s.c = C;\n if (range.e.r < R) range.e.r = R;\n if (range.e.c < C) range.e.c = C;\n var cellData = data[R][C];\n var cell;\n var cell_ref = XLSX.utils.encode_cell({\n c: C,\n r: R\n });\n if (_.str.startsWith(cellData, \"=\")) {\n //TODO: update xlsx lib when updated with this feature:\n //now formula only works since I edited the current module code (node_modules/xlsx/xlsx.js) andd added this feature:\n // https://github.com/christocracy/js-xlsx/commit/45f9e0198c10086f03dac000c09f24fe18bbd5d8\n //details: https://github.com/SheetJS/js-xlsx/pull/103\n cell = {\n //f: _.str.strRight(cellData, '='),\n f: cellData,\n t: 'n'\n };\n } else {\n cell = {\n v: cellData\n };\n if (cell.v === null) continue;\n\n\n if (typeof cell.v === 'number') cell.t = 'n';\n else if (typeof cell.v === 'boolean') cell.t = 'b';\n else if (cell.v instanceof Date) {\n cell.t = 'n';\n cell.z = XLSX.SSF._table[14];\n cell.v = datenum(cell.v);\n } else cell.t = 's';\n }\n\n ws[cell_ref] = cell;\n }\n }\n if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);\n return ws;\n}" ]
[ "0.6457858", "0.6455349", "0.62296724", "0.6148661", "0.61139506", "0.60943913", "0.6035607", "0.58760744", "0.5739597", "0.57332444", "0.5687886", "0.5684987", "0.56793606", "0.5673345", "0.56569004", "0.56158", "0.55913126", "0.5586192", "0.556271", "0.5533437", "0.55055904", "0.5476099", "0.54718375", "0.5471047", "0.5464901", "0.54220116", "0.5418219", "0.54040056", "0.53978634", "0.5394086", "0.53934133", "0.5383516", "0.53704727", "0.5342077", "0.5336062", "0.5331169", "0.5318014", "0.5308076", "0.5295139", "0.52719814", "0.52643204", "0.5262551", "0.5259953", "0.52498686", "0.5243227", "0.52281547", "0.5221641", "0.5203578", "0.51762563", "0.5172513", "0.51628953", "0.5155314", "0.51379406", "0.51211333", "0.51121116", "0.51100576", "0.5089133", "0.50764096", "0.50571454", "0.5047499", "0.5046174", "0.50429463", "0.50339186", "0.5026433", "0.5018748", "0.5015437", "0.50092655", "0.5006971", "0.49897218", "0.4985786", "0.49718612", "0.49583185", "0.49559548", "0.49479872", "0.4946104", "0.49449214", "0.49378008", "0.493236", "0.49305698", "0.49248597", "0.49208686", "0.49206725", "0.49184388", "0.49165708", "0.4910527", "0.48966396", "0.4895452", "0.48879564", "0.48879564", "0.48879564", "0.48879564", "0.48849976", "0.48849937", "0.48825812", "0.48767525", "0.48682725", "0.4866079", "0.4864613", "0.48556975", "0.4854118" ]
0.7073651
0
this function excutes sql used by createDobTable()
function do_some_SQL (client, sql, callback) { client.connect(function(err){ if (err) { return console.error('could not connect to postgres', err); } client.query(sql, function(err, result){ if (err) { return console.error('query error', err) } //this disconnects from the database // client.end(); typeof callback === 'function' && callback(result); }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeCreateTable() {\n\n var keyStr = '';\n var keyCol = '';\n\n var ddl = 'DROP TABLE IF EXISTS ' + gTblName + ';'\n\n ddl += newLine;\n\n // var ddl = 'CREATE TABLE ' + gTblNameUpper + ' (' + newLine;\n ddl += 'CREATE TABLE ' + gTblName + ' (' + newLine;\n\n for (var i = 1; i < gValuesOfRange.length; i++) {\n\n /** set common var in column range*/\n if (!setCommonVar(i)) {\n return '';\n }\n\n if (cPhysicalNameOfColumn == '') {\n break;\n }\n\n ddl += cPhysicalNameOfColumnUpper;\n if (cTypeVal.toUpperCase() == TIMESTAMP) {\n ddl += ' TIMESTAMP(6)';\n } else if (cTypeVal.toUpperCase() == DATETIME) {\n ddl += ' DATETIME';\n } else if (cSizeVal != '') {\n ddl += ' ' + cTypeVal + '(' + cSizeVal + ')';\n } else {\n ddl += ' ' + cTypeVal;\n }\n\n if (cDefaultVal != '') {\n ddl += ' DEFAULT ' + cDefaultVal;\n }\n if (isNotNull) {\n ddl += ' NOT NULL';\n }\n\n // Browser.msgBox(cRemark);\n\n if (cRemark.indexOf('主キー') > -1 && (cRemark.indexOf('自動連番') > -1 || cRemark.indexOf('連番') > -1)) {\n ddl += ' AUTO_INCREMENT';\n }\n\n if (cRemark.indexOf('主キー') > -1) {\n if (keyCol != '') {\n keyCol += ', ' + cPhysicalNameOfColumn;\n } else {\n keyCol = cPhysicalNameOfColumn;\n }\n }\n\n if (cLogicalNameOfColumn != '') {\n ddl += ' COMMENT ' + \"'\" + cLogicalNameOfColumn + \"'\";\n }\n\n\n if (!cIsLastRow) {\n ddl += ',';\n }\n\n ddl += newLine;\n }\n\n if (keyCol != '') {\n keyStr = ', PRIMARY KEY (' + keyCol + ')';\n ddl += keyStr;\n }\n\n ddl += ')';\n\n\n if (gTblNameLogic != '') {\n ddl += ' COMMENT = ' + \"'\" + gTblNameLogic + \"'\";\n }\n\n ddl += ';';\n\n return ddl;\n}", "function CustomSQLDo() {\n}", "function createDBTable($data) {\n \n var arr = [];\n var s = \"&nbsp;&nbsp;&nbsp;\";\n var x = \"\", n = \"\";\n var $o;\n var $r; \n var t = 0;\n var f = \"\";\n var y = \"\";\n\n var dbName = $.trim($dbName.val());\n \n for (var i = 0; i < $data.objects.arr.length; i++) {\n $o = $data.objects.arr[i];\n\n //Class Name (or Object name) --- this should represent the table\n n = $o.name.replace(/[^\\w\\s]/gi, '').replace(/\\s/g, '_').toLowerCase();\n x = $o.tableName;\n arr.push(`CREATE TABLE ${x} (`);\n\n for (var j = 0; j < $o.records.length; j++) {\n console.log($r);\n $r = $o.records[j];\n t = $r.typeID;\n f = $r.name.toUpperCase();\n\n if (t == 1 && f == \"ID\") {\n arr.push(s + \"ID INT NOT NULL PRIMARY KEY IDENTITY(1,1),\");\n }\n else {\n\n y = \"\";\n if ($r.ref.active) {\n y = \" REFERENCES \" + $(\".object[data-num='\" + $r.ref.cls + \"']\").find(\".object-name\").attr(\"data-sqltable\") + \" (\" + $(\".object[data-num='\" + $r.ref.cls + \"']\").find(\".object-table-record[data-row='\" + $r.ref.field + \"']\").attr(\"data-sqlfield\") + \") ON DELETE CASCADE \";\n }\n\n switch (t) {\n case 0:\n arr.push(s + f + \" NVARCHAR(255) NULL\" + y + \",\");\n break;\n case 1:\n arr.push(s + f + \" INT NOT NULL \" + ( (y.length == 0) ? \"DEFAULT \" + $r.def : y) + \",\");\n break;\n case 2:\n arr.push(s + f + \" DECIMAL(18,6) NOT NULL \" + ( (y.length == 0) ? \"DEFAULT \" + $r.def : y) + \",\");\n break;\n case 3:\n arr.push(s + f + \" TINYINT NOT NULL \" + ( (y.length == 0) ? \"DEFAULT \" + $r.def : y) + \",\");\n break;\n case 4:\n arr.push(s + f + \" DATETIME2 NOT NULL DEFAULT GETDATE()\" + y + \",\");\n break;\n case 5:\n case 6:\n case 7:\n default: \n }\n }\n }\n\n var _s = arr[arr.length - 1].slice(0,-1); \n arr[arr.length-1] = _s; \n arr.push(\");\");\n arr.push(\"\");\n }\n \t\n\t\treturn arr;\n\t}", "function crearNuevaBD(tx){ \n tx.executeSql('DROP TABLE IF EXISTS qr');\t\n\ttx.executeSql(sqlQr);\t\t\n}", "createQuery(columns, ifNot) {\n const sql = `create table ${this.tableName()} (${columns.sql.join(', ')})`;\n this.pushQuery({\n // catch \"name is already used by an existing object\" for workaround for \"if not exists\"\n sql: ifNot ? utils.wrapSqlWithCatch(sql, -955) : sql,\n bindings: columns.bindings\n });\n if (this.single.comment) this.comment(this.single.comment);\n }", "function insertSQL(table, obj) {\r\n // your code here\r\n let tableColumns = '(';\r\n let values = '(';\r\n for(var key in obj){\r\n tableColumns += String(key) + ',';\r\n values += String(obj[key]) + ',';\r\n }\r\n tableColumns -= ',';\r\n values -= ',';\r\n let statement = 'insert into ' + table + tableColumns +') values' + values + ')' ;\r\n statement += table;\r\n return statement;\r\n}", "function details_sql_generate(mytable,mytable_sql){\n\t\tsql = \"INSERT INTO \"+mytable_sql+\"(\";\n\t\ttam_col_temp=0;\n\t\t//creamos la primera concatenacion la cual es los campos a evaluar\n\t\tmytable.find(\"tr:eq(1) td\").each(function(i){\n\t\t\tif(jQuery(this).find(\">\").attr(\"colbd\")){\n\t\t\t\tcolbd = jQuery(this).find(\">\").attr(\"colbd\");\n\t\t\t\ttam_col_temp++;\n\t\t\t\tif(tam_col_temp==1){\n\t\t\t\t\tsql+=colbd;\n\t\t\t\t}else{\n\t\t\t\t\tsql+=\",\"+colbd;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tsql+=\")\";\n\t\t\n\n\t\tmytable.find(\"tr\").each(function(j){\n\t\t\t//este if se debe por que en la transaccion esta la cabecera y la fila a \n\t\t\tif(j>=2){\n\t\t\t\tif(j<3){\n\t\t\t\t\tsql+=\"VALUES(\";\n\t\t\t\t}else{\n\t\t\t\t\tsql+=\",VALUES(\"\n\t\t\t\t}\n\t\t\t\tjQuery(this).find('td').each(function(k){\n\t\t\t\t\tif(jQuery(this).find(\">\").attr(\"colbd\")){\n\t\t\t\t\t\tif(k==0){\n\t\t\t\t\t\t\tsql+=\"'\"+jQuery(this).find('>').val()+\"'\";\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tsql+=\",'\"+jQuery(this).find('>').val()+\"'\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tsql+=\")\";\n\t\t\t\tsql+\"\\n\";\n\t\t\t}\n\t\t});\n\t\talert(sql);\n\t\t//ahora guardaremos los valores\n\n\t}", "function CreateDatabaseQuery() {}", "function CreateTableQuery() \n{\nthis.columns = [];\nthis.constraints = [];\n}", "function format_sql_string(tablename, columns, data) {\n\tfor(datacolumn in data) { //check that all data columns are in table description\n\t\tif(columns.indexOf(datacolumn) == -1){\n\t\t\treturn -1;\n\t\t}\n\t}\n\tfor(columnname in columns) { //check that all data columns are in table description\n\t\tif(!(columns[columnname] in data)){\n\t\t\treturn -1;\n\t\t}\n\t}\n\t\n\tcolumnstr = \"(\";\n\tdatastr = \"VALUES(\";\n\tfor (columnname in data){\n\t\tcolumnstr += columnname + \", \";\n\t\tif(data[columnname] == \"now()\")\n\t\t \tdatastr += \"now(), \";\n\t\telse\n\t\t\tdatastr += \"'\" + data[columnname] + \"', \";\n\t}\n\tcolumnstr = columnstr.substring(0, columnstr.length - 2) + \") \";\n\tdatastr = datastr.substring(0, datastr.length - 2) + \");\";\n\tstr = \"insert into \" + tablename + columnstr + datastr;\n\treturn str;\n\t\n}", "function translateSql(ob) {\n var arr = [];\n for (var key in ob) {\n var value = ob[key];\n if (Object.hasOwnProperty.call(ob, key)) {\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n return arr.toString();\n }", "function objToSql(ob) {\n\tvar arr = [];\n\n\tfor (var key in ob){\n\t\tarr.push(key + \"=\" + ob[key]);\n\t}\n\treturn arr.toString();\n}", "function populateTable(tx,dynamicColumnValues) {\r\n //tx.executeSql('DROP TABLE IF EXISTS '+ dynamicColumnValues[1]);\r\n \r\n var query = 'CREATE TABLE IF NOT EXISTS ' + dynamicColumnValues[1] +' (';\r\n \r\n for(var i = 3; i < dynamicColumnValues.length; i++)\r\n {\r\n \tquery = query + dynamicColumnValues[i];\r\n \t\r\n \tif(i != (dynamicColumnValues.length - 1 ))\r\n \t\tquery = query + ',';\r\n }\r\n query = query + ')';\r\n \r\n console.log(query);\r\n \r\n tx.executeSql( query );\r\n}", "function objToSql(ob) {\n\tvar arr = [];\n\n\tfor (var key in ob) {\n\t\tarr.push(key + \"=\" + ob[key]);\n\t}\n\n\treturn arr.toString();\n}", "getTableName() {}", "function gen_sql(input_args) {\n //\n var sql = '';\n var valid = false;\n var args = {\n 'cmd' : false,\n 'table' : false,\n 'cols' : false,\n 'vals' : false,\n 'where' : false\n }\n //\n // updating default args with input args\n input_args = JSON.parse(JSON.stringify(input_args));\n for (var prop in input_args) {\n args[prop] = input_args[prop]\n if (Array.isArray(args[prop])) { if (args[prop].length == 0) { args[prop] = false;}}\n }\n //\n // checking for primary required arguments\n if (!(args.cmd)) { console.log(\"Function gen_sql requires a command to be provided\"); return;}\n if (!(args.table)) { console.log(\"Function gen_sql requires a table to be provided\"); return;}\n //\n // checking command specific arguments\n if (args.cmd == 'SELECT') {\n valid = true;\n if (!(args.cols)) {args.cols = ['*'];}\n sql = 'SELECT ';\n }\n else if (args.cmd == 'INSERT') {\n valid = true;\n if (!(args.cols)) { console.log(\"No columns provided for INSERT command.\"); valid = false;}\n if (!(args.vals)) { console.log(\"No values provided for the INSERT command.\"); valid = false;}\n sql = 'INSERT INTO `'+args.table+'`';\n }\n else if (args.cmd == 'UPDATE') {\n valid = true;\n if (!(args.cols)) { console.log(\"No columns provided for UPDATE command.\"); valid = false;}\n if (!(args.vals)) { console.log(\"No values provided for the UPDATE command.\"); valid = false;}\n if (!(args.where)) { console.log(\"No where array provided for the UPDATE command.\"); valid = false;}\n sql = 'UPDATE `'+args.table+'` SET ';\n }\n else if (args.cmd == 'DELETE') {\n valid = true;\n if (!(args.where)) { console.log(\"No where array provided for the DELETE command.\"); valid = false;}\n sql = 'DELETE FROM `'+args.table+'` '\n }\n else {\n console.log('Invalid command provided for gen SQL function: '+args.cmd);\n }\n if (valid == false) { return;}\n //\n // modifying values to fit commands\n for (var i = 0; i < args.cols.length; i++) {\n if (args.cols[i] == '*') { continue;}\n if (args.cols[i].match(/\\./)) { continue;}\n if (args.cols[i].match(/\\(.*\\)/)) { continue;}\n args.cols[i] = '`'+args.cols[i]+'`';\n }\n for (var i = 0; i < args.vals.length; i++) {\n if ((args.vals[i]+'').match(/\\(.*?\\)/)) { continue;}\n else if (typeof(args.vals[i]) == 'string') {args.vals[i] = \"'\"+args.vals[i]+\"'\";}\n }\n if (args.where) {\n for (var i = 0; i < args.where.length; i++) {\n if (!(args.where[i][0].match(/\\./))) {\n args.where[i][0] = '`'+args.where[i][0]+'`';\n }\n args.where[i][2] = \"'\"+args.where[i][2]+\"'\";\n }\n }\n if (args.cmd == 'UPDATE') {\n for (var i = 0; i < args.cols.length; i++) {\n args.cols[i] = args.cols[i]+'='+args.vals[i];\n }\n args.vals = false;\n }\n //\n // adding cols and vals to sql statements\n if (args.cmd == 'INSERT') {sql += '(';}\n if (args.cols) { sql += args.cols.join(',');}\n if (args.cmd == 'INSERT') {\n sql += ') VALUES('+args.vals.join(',')+')';\n }\n if (args.cmd == 'SELECT') { sql += ' FROM `'+args.table+'` '}\n //\n // adding inner join logic\n if (args.inner_join) {\n for (var i = 0; i < args.inner_join.length; i++) {\n sql += 'INNER JOIN '+args.inner_join[i][0]+' ON '+args.inner_join[i][1]+'='+args.inner_join[i][2]+' ';\n }\n }\n //\n // adding where clause\n if (args.where) {\n sql += ' WHERE '+args.where[0].join(' ');\n for (var i = 1; i < args.where.length; i++) {\n sql += ' AND '+args.where[i].join(' ');\n }\n }\n //\n // adding order by clauses\n if (args.order_by) {\n var col = args.order_by[0][0];\n if (!(col.match(/\\./))) { col = '`'+col+'`';}\n sql += ' ORDER BY '+col+' '+args.order_by[0][1];\n for (var i = 1; i < args.order_by.length; i++) {\n col = args.order_by[i][0];\n if (!(col.match(/\\./))) {col = '`'+col+'`';}\n sql += ', '+col+' '+args.order_by[i][1];\n }\n }\n //\n // adding in group by clause\n if (args.group_by) { sql += 'GROUP BY '+args.group_by;}\n //\n // adding in limit clause\n if (args.limit) { sql += ' LIMIT '+args.limit.splice(0,2).join();}\n //\n return(sql)\n}", "function buildTable(){\n\n}", "function objToSql(ob) {\n\tvar arr = [];\n\n\tfor (var key in ob) {\n\t\tif (ob.hasOwnProperty(key)) {\n\t\t\tarr.push(key + '=' + ob[key]);\n\t\t}\n\t}\n\n\treturn arr.toString();\n}", "static getPatientBookingByDoctorIdSQL(did) {\n let sql = `SELECT PATIENTS.* FROM PATIENTS JOIN DOCTORPATIENTRELATION ON PATIENTS.PatientID = DOCTORPATIENTRELATION.PatientID WHERE DOCTORPATIENTRELATION.DoctorID=${did}`;\n console.log(sql);\n return sql;\n }", "getCreateTableQuery(model_name) {\n return null;\n }", "async prepareSql(sql) {\n if (this.config.forInsert) {\n return sql;\n }\n\n if (this.config.forFetch && this.options.fields) {\n const columns = this.getColumns(this.options.fields);\n const method = this.options.distinct ? 'distinct' : 'select';\n\n sql[method](columns);\n }\n\n Object.entries(this.options).forEach(([option, values]) => {\n if (!values) {\n return;\n }\n\n if (option === 'forUpdate') {\n return sql.forUpdate();\n }\n\n if (option === 'noWait') {\n return sql.noWait();\n }\n\n if (!isArray(values) || !values.length) {\n return;\n }\n\n values.forEach((value) => {\n switch (option) {\n case 'of':\n return sql.of(this.quote(value));\n\n case 'where':\n return this.prepareWhere(sql, value);\n\n case 'having':\n return this.prepareHaving(sql, value);\n\n case 'groupBy':\n return this.prepareGroupBy(sql, value);\n\n case 'orderBy':\n return this.prepareOrderBy(sql, value);\n }\n });\n });\n\n return sql;\n }", "function SBRecordsetPHP_getSQLForRecordsetBindings()\r\n\r\n{\r\n\r\n var sqlParams = new Array();\r\n\r\n var sql = this.getDatabaseCall(sqlParams);\r\n\r\n\r\n\r\n // To keep the fix minimized, we do it for simple SQL Statement only.\r\n\r\n\r\n\r\n var sqlObj = new SQLStatement(sql); \r\n\r\n\r\n\r\n var tempSQL = sqlObj.getStatementForMMDB(); \r\n\r\n if (tempSQL) {\r\n\r\n sql = tempSQL;\r\n\r\n }\r\n\r\n\r\n\r\n// sql = this.replaceParamsWithVals(sql, sqlParams);\r\n\r\n return sql;\r\n\r\n}", "selectQuery() {\n return `select * from ${this.tablename('select')}`;\n }", "function transactionTable() { }", "function crearTablaAscensorItemsPreliminar(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_items_preliminar(k_coditem_preli, o_descripcion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function createInsertSQL(allowedKeys, optionalKeys, table, data)\r\n{\r\n validate(data, allowedKeys, optionalKeys);\r\n\r\n const entryID = uuidv4();\r\n console.log(`Creating insert statement with ID: ${entryID}`)\r\n console.log(Object.entries(data).map((e) => `\"${e[0]}\" = \"${e[1]}\"`));\r\n const query = `INSERT INTO ${table} (id, ${Object.keys(data).map(mysql.escapeId).join(\", \")}) VALUES (${mysql.escape(entryID)}, ${Object.values(data).map((v) => `${mysql.escape(v)}`).join(\", \")}); `;\r\n console.log(`QUERY:`)\r\n console.log(\"\\x1b[32m%s\\x1b[0m\", query);\r\n return query;\r\n}", "static createInsert(queryObject){\n let prototype = 'INSERT INTO ' + queryObject.structure.table;\n if(queryObject.structure.insertColumns.length>0){\n prototype += '( '\n for(let i = 0; i < queryObject.structure.insertColumns.length; i++){\n prototype += queryObject.structure.insertColumns[i]\n if(i!=queryObject.structure.insertColumns.length-1){\n prototype+= ', '\n }\n else{\n prototype+= ' '\n }\n }\n prototype += ') '\n }\n else{\n prototype += ' '\n }\n prototype += 'VALUES'\n let queryString = [];\n for(let i = 0; i < queryObject.structure.insertValues.length; i++){\n let values = '( ';\n for(let j = 0; j < queryObject.structure.insertValues[i].length; j++){\n if(typeof(queryObject.structure.insertValues[i][j])==typeof(\"\")){\n values += \"'\"+queryObject.structure.insertValues[i][j]+\"'\";\n } else if(queryObject.structure.insertValues[i][j].isDate){\n values += `TO_DATE( '${queryObject.structure.insertValues[i][j].date}', '${queryObject.structure.insertValues[i][j].format}')`;\n } \n else{\n values += Query.checkForBooleans(queryObject.structure.insertValues[i][j]);\n }\n if(j!=queryObject.structure.insertValues[i].length-1){\n values+= ', '\n }\n else{\n values+= ' '\n }\n }\n values += ') ';\n queryString.push(prototype+values+(queryObject.structure.returnId?\"RETURN id INTO :id\":\"\"));\n }\n return queryString[0];\n }", "function crearTablaAscensorValoresIniciales(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_iniciales (k_codusuario,k_codinspeccion,n_cliente,n_equipo,n_empresamto,o_tipoaccion,v_capacperson,v_capacpeso,v_paradas,f_fecha,v_codigo,o_consecutivoinsp,ultimo_mto,inicio_servicio,ultima_inspeccion,h_hora,o_tipo_informe)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores iniciales...Espere\");\n console.log('transaction creada ok');\n });\n}", "function objToSql(ob) {\n const arr = []\n\n for(var key in ob) {\n arr.push(key + '=' + ob[key])\n }\n return arr.toString()\n}", "function jsonToSQL(jsonObj) {\n\n let sql = '';\n\n /**\n * Uses mysql.escape to sanitize given values\n * @param value\n * @returns {*}\n */\n\n let sanitizeValue = function (value) {\n\n if (mysql.escape(value) === '' + value) {\n return value;\n } else {\n return mysql.escape(value).slice(1,-1);\n }\n\n };\n\n /**\n * Adds conditions to a given sql statement\n * @param conditions\n * @param sql\n * @returns {*}\n */\n\n let addConditions = function (conditions, sql) {\n\n // add conditions if any\n\n if (conditions !== undefined) {\n\n // conditions need to be added\n\n sql += ' WHERE ';\n\n conditions.forEach(function (condition) {\n\n if (condition.hasOwnProperty('binaryOperator')) {\n sql += sanitizeValue(condition.binaryOperator) + ' ';\n } else {\n sql += sanitizeValue(condition.column) + ' ' + sanitizeValue(condition.compareOperator) + ' '\n + (typeof(condition.compareValue) === 'string' && condition.compareValue[0] !== '(' ?\n \"'\" + sanitizeValue(condition.compareValue) + \"'\"\n : sanitizeValue(condition.compareValue)) + ' ';\n }\n });\n }\n\n return sql;\n };\n\n switch (jsonObj.queryType) {\n\n case 'SELECT':\n sql += 'SELECT ';\n\n // add tables fields\n\n //console.log(jsonObj.selectQueryFields.tableFields);\n\n jsonObj.selectQueryFields.columns.forEach(function (value) {\n sql += sanitizeValue(value) + ', ';\n });\n\n // add table name\n\n sql = sql.slice(0, -2) + ' FROM ' + sanitizeValue(jsonObj.tableName) + ' ';\n\n // add conditions if any\n\n sql = addConditions(jsonObj.selectQueryFields.conditions, sql);\n\n sql += ';';\n\n break;\n\n case 'INSERT':\n sql += 'INSERT INTO ' + sanitizeValue(jsonObj.tableName) + (\n jsonObj.hasOwnProperty(\"insertQueryColumns\")? '(' + jsonObj.insertQueryColumns.toString() + ')':''\n ) + ' VALUES(';\n\n // insert values into query\n\n jsonObj.insertQueryValues.forEach(function (value) {\n\n if (value == null)\n sql += 'NULL,';\n else\n sql += (typeof(value) === 'string'? '\"' + sanitizeValue(value) + '\"': sanitizeValue(value)) + ',';\n });\n\n if (jsonObj.tableName === 'recycling_logs')\n // add the NOW() function to calculate date and time for the recycling log\n sql += 'NOW()';\n else\n sql = sql.slice(0, -1);\n\n sql += ');';\n break;\n\n case 'DELETE':\n\n sql += 'DELETE FROM ' + sanitizeValue(jsonObj.tableName) + ' ';\n\n sql = addConditions(jsonObj.deleteQueryFields.conditions, sql);\n\n sql += ';';\n\n break;\n\n case 'UPDATE':\n sql += 'UPDATE ' + sanitizeValue(jsonObj.tableName) + ' SET ';\n\n // add column names and new values\n\n _.zip(jsonObj.updateQueryFields.columns, jsonObj.updateQueryFields.values).forEach(\n function (pair) {\n sql += sanitizeValue(pair[0]) + ' = ' + (typeof(sanitizeValue(pair[1])) === 'string'? \"'\" + sanitizeValue(pair[1]) + \"'\": sanitizeValue(pair[1])) + ', ';\n }\n );\n\n sql = sql.slice(0, -2);\n\n // add conditions if any\n\n sql = addConditions(jsonObj.updateQueryFields.conditions, sql);\n\n sql += ';';\n\n console.log(sql);\n\n break;\n\n }\n\n\n return sql;\n }", "function crearTablaAscensorValoresPreliminar(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_preliminar (k_codusuario,k_codinspeccion,k_coditem_preli,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores preliminares...Espere\");\n console.log('transaction creada ok');\n });\n}", "function makeQuery(do_command, table_name, name, value, amount){\r\n\r\n\tvar sql_query = '';\t\t\t\t// To be used as a function variable. Holds sql command.\r\n\r\n\r\n\r\n\tif(do_command == 'INSERT'){\r\n\r\n\t\tif(amount >= 5){\r\n\t\t\tsql_query = 'UPDATE ' + table_name;\r\n\t\t} else if( amount < 5) {\r\n\t\t\tsql_query = 'INSERT INTO ' + table_name;\r\n\t\t}\r\n\r\n\t\tif (sql_query == 'INSERT INTO ' + table_name){\r\n\r\n\t\t}\r\n\r\n\t\tsql_query = sql_query + ' SET';\r\n\r\n\t\tfor (var i in name){\r\n\t\t\tif (i > 0){\r\n\t\t\t\tsql_query = sql_query + ',';\r\n\t\t\t}\r\n\t\t\t\tsql_query = sql_query + ' ' + name[i] + '=' + '\\''+ value[i] + '\\'';\r\n\t\t}\r\n\r\n\r\n\t} else {\r\n\r\n\t\tsql_query = 'SELECT ';\r\n\r\n\t\tfor (var i in name){\r\n\t\t\tif (i > 0){\r\n\t\t\t\tsql_query = sql_query + ',';\r\n\t\t\t}\r\n\t\t\t\tsql_query = sql_query + ' ' + name[i];\r\n\t\t\t}\r\n\t\t\tsql_query = sql_query + ' FROM ' + table_name;\r\n\t\t}\r\n\treturn sql_query;\r\n}", "function objToSql(ob) {\n var arr = [];\n\n for (var key in ob) {\n if (Object.hasOwnProperty.call(ob, key)) {\n arr.push(key + \"=\" + ob[key]);\n }\n }\n\n return arr.toString();\n}", "function objectsToSQL(obj) {\n //empty array\n let arg = [];\n for (var key in obj) {\n var value = obj[key];\n // First if statement\n if (Object.hasOwnProperty.call(obj, key)) {\n if (typeof value === 'string' && value.indexOf(' ') >= 0) {\n value = '\"' + value + '\"';\n }\n // pushing to arg array\n arg.push(key + '=' + value);\n }\n }\n return arg.toString();\n}", "function translateToSQL(ob) {\n let arr = [];\n for (let key in ob) {\n let value = ob[key];\n if (Object.hasOwnProperty.call(ob, key)) {\n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n return arr.toString();\n}", "function createTableRecord(tx) {\n\t\n\t console.log(\"Entering createTableRecord\");\n\t \n\t var sqlStr = 'CREATE TABLE IF NOT EXISTS records (type TEXT, date DATE)';\n\t console.log(sqlStr);\n\t \n\t tx.executeSql(sqlStr, [], onSqlSuccess, onSqlError);\n\t console.log(\"Leaving createTableRecord\");\n\t}", "function fCidadeF10(opc,codCdd,foco,topo,objeto){\r\n let clsStr = new concatStr();\r\n clsStr.concat(\"SELECT A.CDD_CODIGO AS CODIGO,A.CDD_NOME AS DESCRICAO\" );\r\n clsStr.concat(\" ,A.CDD_CODEST AS UF\" ); \r\n clsStr.concat(\" FROM CIDADE A\" );\r\n \r\n let tblCdd = \"tblCdd\";\r\n let tamColNome = \"29em\";\r\n if( typeof objeto === 'object' ){\r\n for (var key in objeto) {\r\n switch( key ){\r\n case \"ativo\":\r\n clsStr.concat( \" {AND} (A.CDD_ATIVO='\"+objeto[key]+\"')\",true); \r\n break; \r\n case \"codcdd\":\r\n clsStr.concat( \" {WHERE} (A.CDD_CODIGO='\"+objeto[key]+\"')\",true); \r\n break; \r\n case \"tamColNome\": \r\n tamColNome=objeto[key]; \r\n break; \r\n case \"tbl\": \r\n tblCdd=objeto[key];\r\n break; \r\n case \"where\": \r\n clsStr.concat(objeto[key],true); \r\n break; \r\n }; \r\n }; \r\n };\r\n sql=clsStr.fim();\r\n console.log(sql);\r\n // \r\n if( opc == 0 ){ \r\n //////////////////////////////////////////////////////////////////////////////\r\n // localStorage eh o arquivo .php onde estao os select/insert/update/delete //\r\n //////////////////////////////////////////////////////////////////////////////\r\n var bdCdd=new clsBancoDados(localStorage.getItem('lsPathPhp'));\r\n bdCdd.Assoc=false;\r\n bdCdd.select( sql );\r\n if( bdCdd.retorno=='OK'){\r\n var jsCddF10={\r\n \"titulo\":[\r\n {\"id\":0 ,\"labelCol\":\"OPC\" ,\"tipo\":\"chk\" ,\"tamGrd\":\"3em\" ,\"fieldType\":\"chk\"} \r\n ,{\"id\":1 ,\"labelCol\":\"CODIGO\" ,\"tipo\":\"edt\" ,\"tamGrd\":\"6em\" ,\"fieldType\":\"str\",\"ordenaColuna\":\"S\",\"align\":\"center\"}\r\n ,{\"id\":2 ,\"labelCol\":\"DESCRICAO\" ,\"tipo\":\"edt\" ,\"tamGrd\":tamColNome ,\"fieldType\":\"str\",\"ordenaColuna\":\"S\"}\r\n ,{\"id\":3 ,\"labelCol\":\"UF\" ,\"tipo\":\"edt\" ,\"tamGrd\":\"2em\" ,\"fieldType\":\"str\",\"ordenaColuna\":\"N\"} \r\n ]\r\n ,\"registros\" : bdCdd.dados // Recebe um Json vindo da classe clsBancoDados\r\n ,\"opcRegSeek\" : true // Opção para numero registros/botão/procurar \r\n ,\"checarTags\" : \"N\" // Somente em tempo de desenvolvimento(olha as pricipais tags)\r\n ,\"tbl\" : tblCdd // Nome da table\r\n ,\"div\" : \"cdd\"\r\n ,\"prefixo\" : \"Cdd\" // Prefixo para elementos do HTML em jsTable2017.js\r\n ,\"tabelaBD\" : \"MODELO\" // Nome da tabela no banco de dados \r\n ,\"width\" : \"52em\" // Tamanho da table\r\n ,\"height\" : \"39em\" // Altura da table\r\n ,\"indiceTable\" : \"DESCRICAO\" // Indice inicial da table\r\n };\r\n if( objCddF10 === undefined ){ \r\n objCddF10 = new clsTable2017(\"objCddF10\");\r\n objCddF10.tblF10 = true;\r\n if( (foco != undefined) && (foco != \"null\") ){\r\n objCddF10.focoF10=foco; \r\n };\r\n }; \r\n var html = objCddF10.montarHtmlCE2017(jsCddF10);\r\n var ajudaF10 = new clsMensagem('Ajuda',topo);\r\n ajudaF10.divHeight= '410px'; /* Altura container geral*/\r\n ajudaF10.divWidth = '54em';\r\n ajudaF10.tagH2 = false;\r\n ajudaF10.mensagem = html;\r\n ajudaF10.Show('ajudaCdd');\r\n document.getElementById('tblCdd').rows[0].cells[2].click();\r\n delete(ajudaF10);\r\n delete(objCddF10);\r\n };\r\n }; \r\n if( opc == 1 ){\r\n var bdCdd=new clsBancoDados(localStorage.getItem(\"lsPathPhp\"));\r\n bdCdd.Assoc=true;\r\n bdCdd.select( sql );\r\n return bdCdd.dados;\r\n }; \r\n}", "function crearTablaEscalerasItemsPreliminar(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE escaleras_items_preliminar(k_coditem, o_descripcion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function SBRecordsetPHP_getSQLForRecordsetBindings()\r\n{\r\n var sqlParams = new Array();\r\n var sql = this.getDatabaseCall(sqlParams);\r\n\r\n\r\n // To keep the fix minimized, we do it for simple SQL Statement only.\r\n\r\n var sqlObj = new SQLStatement(sql); \r\n var tempSQL = sqlObj.getStatementForMMDB(); \r\n\r\n\t/*\r\n if (tempSQL)\r\n {\r\n sql = tempSQL;\r\n }\r\n else\r\n {\r\n\t\tsql = this.replaceParamsWithVals(sql, sqlParams);\r\n }\r\n */\r\n\tsql = this.replaceParamsWithVals(sql, sqlParams);\r\n\r\n return sql;\r\n}", "function crearTablaAuditoriaInspeccionesEscaleras(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE auditoria_inspecciones_escaleras (k_codusuario,k_codinspeccion,o_consecutivoinsp,o_estado_envio,o_revision,v_item_nocumple,k_codcliente,k_codinforme,k_codusuario_modifica,o_actualizar_inspeccion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores auditoria...Espere\");\n console.log('transaction creada ok');\n });\n}", "function drawDynamicTable() {\n try {\n var tableSortingColumns = [\n { orderable: false },null, null, null, null, null, null, null,\n ];\n var tableFilteringColumns = [\n { type: \"null\" },{ type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" },\n ];\n\n var tableColumnDefs = [\n\n ];\n //select tblletter.id as 'AutoCodeHide', tblletter.title as 'عنوان الخطاب ',tblletter.details as 'تفاصيل الخطاب', tbldepartmen.name as 'صادر من',to_d.name as 'صادر الي',tblUsers.User_Name as 'الراسل', 1 as ' تعديل /حذف' from tblletter inner join tbldepartmen on tblletter.from_dep=tbldepartmen.id inner join tbldepartmen to_d on to_d.id=tblletter.to_dep inner join tblUsers on tblletter.add_by=tblUsers.id where tblletter.type=2 and ISNUll(tblletter.deleted,0)=0\n var initialSortingColumn = 0;\n loadDynamicTable('out_outside_letters', \"AutoCodeHide\", tableColumnDefs, tableFilteringColumns, tableSortingColumns, initialSortingColumn, \"Form\");\n } catch (err) {\n alert(err);\n }\n}", "insertQuery(table, valueHash, modelAttributes, options) {\n options = options || {};\n _.defaults(options, this.options);\n\n const modelAttributeMap = {};\n const fields = [];\n const values = [];\n let query;\n let valueQuery = '<%= tmpTable %>INSERT<%= ignoreDuplicates %> INTO <%= table %> (<%= attributes %>)<%= output %> VALUES (<%= values %>)';\n let emptyQuery = '<%= tmpTable %>INSERT<%= ignoreDuplicates %> INTO <%= table %><%= output %>';\n let outputFragment;\n let identityWrapperRequired = false;\n let tmpTable = ''; //tmpTable declaration for trigger\n\n if (modelAttributes) {\n _.each(modelAttributes, (attribute, key) => {\n modelAttributeMap[key] = attribute;\n if (attribute.field) {\n modelAttributeMap[attribute.field] = attribute;\n }\n });\n }\n\n if (this._dialect.supports['DEFAULT VALUES']) {\n emptyQuery += ' DEFAULT VALUES';\n } else if (this._dialect.supports['VALUES ()']) {\n emptyQuery += ' VALUES ()';\n }\n\n if (this._dialect.supports.returnValues && options.returning) {\n if (this._dialect.supports.returnValues.returning) {\n valueQuery += ' RETURNING *';\n emptyQuery += ' RETURNING *';\n } else if (this._dialect.supports.returnValues.output) {\n outputFragment = ' OUTPUT INSERTED.*';\n\n //To capture output rows when there is a trigger on MSSQL DB\n if (modelAttributes && options.hasTrigger && this._dialect.supports.tmpTableTrigger) {\n\n let tmpColumns = '';\n let outputColumns = '';\n tmpTable = 'declare @tmp table (<%= columns %>); ';\n\n for (const modelKey in modelAttributes) {\n const attribute = modelAttributes[modelKey];\n if (!(attribute.type instanceof DataTypes.VIRTUAL)) {\n if (tmpColumns.length > 0) {\n tmpColumns += ',';\n outputColumns += ',';\n }\n\n tmpColumns += this.quoteIdentifier(attribute.field) + ' ' + attribute.type.toSql();\n outputColumns += 'INSERTED.' + this.quoteIdentifier(attribute.field);\n }\n }\n\n const replacement = {\n columns: tmpColumns\n };\n\n tmpTable = _.template(tmpTable)(replacement).trim();\n outputFragment = ' OUTPUT ' + outputColumns + ' into @tmp';\n const selectFromTmp = ';select * from @tmp';\n\n valueQuery += selectFromTmp;\n emptyQuery += selectFromTmp;\n }\n }\n }\n\n if (this._dialect.supports.EXCEPTION && options.exception) {\n // Mostly for internal use, so we expect the user to know what he's doing!\n // pg_temp functions are private per connection, so we never risk this function interfering with another one.\n if (semver.gte(this.sequelize.options.databaseVersion, '9.2.0')) {\n // >= 9.2 - Use a UUID but prefix with 'func_' (numbers first not allowed)\n const delimiter = '$func_' + uuid.v4().replace(/-/g, '') + '$';\n\n options.exception = 'WHEN unique_violation THEN GET STACKED DIAGNOSTICS sequelize_caught_exception = PG_EXCEPTION_DETAIL;';\n valueQuery = 'CREATE OR REPLACE FUNCTION pg_temp.testfunc(OUT response <%= table %>, OUT sequelize_caught_exception text) RETURNS RECORD AS ' + delimiter +\n ' BEGIN ' + valueQuery + ' INTO response; EXCEPTION ' + options.exception + ' END ' + delimiter +\n ' LANGUAGE plpgsql; SELECT (testfunc.response).*, testfunc.sequelize_caught_exception FROM pg_temp.testfunc(); DROP FUNCTION IF EXISTS pg_temp.testfunc()';\n } else {\n options.exception = 'WHEN unique_violation THEN NULL;';\n valueQuery = 'CREATE OR REPLACE FUNCTION pg_temp.testfunc() RETURNS SETOF <%= table %> AS $body$ BEGIN RETURN QUERY ' + valueQuery + '; EXCEPTION ' + options.exception + ' END; $body$ LANGUAGE plpgsql; SELECT * FROM pg_temp.testfunc(); DROP FUNCTION IF EXISTS pg_temp.testfunc();';\n }\n }\n\n if (this._dialect.supports['ON DUPLICATE KEY'] && options.onDuplicate) {\n valueQuery += ' ON DUPLICATE KEY ' + options.onDuplicate;\n emptyQuery += ' ON DUPLICATE KEY ' + options.onDuplicate;\n }\n\n valueHash = Utils.removeNullValuesFromHash(valueHash, this.options.omitNull);\n for (const key in valueHash) {\n if (valueHash.hasOwnProperty(key)) {\n const value = valueHash[key];\n fields.push(this.quoteIdentifier(key));\n\n // SERIALS' can't be NULL in postgresql, use DEFAULT where supported\n if (modelAttributeMap && modelAttributeMap[key] && modelAttributeMap[key].autoIncrement === true && !value) {\n if (!this._dialect.supports.autoIncrement.defaultValue) {\n fields.splice(-1, 1);\n } else if (this._dialect.supports.DEFAULT) {\n values.push('DEFAULT');\n } else {\n values.push(this.escape(null));\n }\n } else {\n if (modelAttributeMap && modelAttributeMap[key] && modelAttributeMap[key].autoIncrement === true) {\n identityWrapperRequired = true;\n }\n\n values.push(this.escape(value, modelAttributeMap && modelAttributeMap[key] || undefined, { context: 'INSERT' }));\n }\n }\n }\n\n const replacements = {\n ignoreDuplicates: options.ignoreDuplicates ? this._dialect.supports.IGNORE : '',\n table: this.quoteTable(table),\n attributes: fields.join(','),\n output: outputFragment,\n values: values.join(','),\n tmpTable\n };\n\n query = (replacements.attributes.length ? valueQuery : emptyQuery) + ';';\n if (identityWrapperRequired && this._dialect.supports.autoIncrement.identityInsert) {\n query = [\n 'SET IDENTITY_INSERT', this.quoteTable(table), 'ON;',\n query,\n 'SET IDENTITY_INSERT', this.quoteTable(table), 'OFF;'\n ].join(' ');\n }\n\n return _.template(query)(replacements);\n }", "function crearTablaAuditoriaInspeccionesAscensores(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE auditoria_inspecciones_ascensores (k_codusuario,k_codinspeccion,o_consecutivoinsp,o_estado_envio,o_revision,v_item_nocumple,k_codcliente,k_codinforme,k_codusuario_modifica,o_actualizar_inspeccion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores auditoria...Espere\");\n console.log('transaction creada ok');\n });\n}", "function createDepartmentTable() {\n var sql = `CREATE TABLE departments (\n id INTEGER AUTO_INCREMENT PRIMARY KEY,\n department_name VARCHAR(30) NOT NULL\n ); \n `\n queryReturn(sql, `${sql.split(' ')[2]} table created.`)\n}", "function crearTablaEscalerasValoresPreliminar(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE escaleras_valores_preliminar (k_codusuario,k_codinspeccion,k_coditem_preli,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores preliminares...Espere\");\n console.log('transaction creada ok');\n });\n}", "constructor(dbi,tableName,ddlComplete,status,yadamuLogger) {\n super({objectMode: true},dbi,tableName,ddlComplete,status,yadamuLogger)\n }", "function updatedb_sql(){\n\n}", "async createInTable (columns, table, conditions, escaped) {\n return this.client.query(`INSERT INTO ${table} (${columns}) VALUES (${conditions})`, escaped)\n }", "function crearTablaAscensorItemsProteccion(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_items_proteccion(k_coditem, o_descripcion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function crearTablaAscensorValoresPozo(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_pozo (k_codusuario,k_codinspeccion,k_coditem,n_calificacion,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores pozo...Espere\");\n console.log('transaction creada ok');\n });\n}", "function crearTablaAscensorItemsPozo(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_items_pozo(k_coditem_pozo, v_item, o_descripcion, v_clasificacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function crearTablaAscensorValoresAudios(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_audios (k_codusuario,k_codinspeccion,n_audio,n_directorio,o_estado_envio)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function buildSQLString (parsedQueryObject, cb) {\n\n try {\n\n let toSelect = _.uniq(_.concat(parsedQueryObject.categoryNames, \n parsedQueryObject.fields, \n alwaysSelected).filter(k => k))\n\n // If a category is no specified\n let wherePredicates = _.defaults(parsedQueryObject.categoryPredicates, defaultCategoryPredicates)\n\n\n // If no geography codes are provided, we default to returning the data for all the states.\n if (!wherePredicates.geography) {\n return cb(new Error('One or more geography codes must be specified.'))\n }\n\n parsedQueryObject.sqlStatement = \n 'SELECT ' + toSelect.join(', ') + '\\n' +\n 'FROM ' + parsedQueryObject.tableName + '\\n' + \n 'WHERE ' + \n _.map(wherePredicates, (reqCategoryValues, categoryName) => {\n\n // The client specified requested values for the category.\n if (reqCategoryValues && reqCategoryValues.length) {\n // For geographies, we do a prefix match\n // This allows us to get all the metro-level data for a state, for example.\n if (categoryName === 'geography') {\n // For prefix matching, we remove the zero padding if it exists.\n // Because some state fips codes start with zero, we must take care \n // not to remove the leading zeroes of the padded fips code... thus the `{2,5}`.\n let codes = reqCategoryValues.map(code => code.replace(/^0{2,5}/, ''))\n return '(' + codes.map(code => `(geography = '${code}')`).join(' OR ') + ')'\n }\n\n if (categoryName === 'industry') {\n let codes = reqCategoryValues.map(code => code.replace(/^0{3}/, ''))\n return '(' + codes.map(code => `(industry = '${code}')`).join(' OR ') + ')'\n }\n\n // Years and quarters are numeric data types in the table.\n if (categoryName === 'quarter') {\n let quarters = reqCategoryValues.map(i => parseInt(i))\n\n return '(' + quarters.map(qtr => `(quarter = ${qtr})`).join(' OR ') + ')'\n }\n\n // Years and quarters are numeric data types in the table.\n if (categoryName === 'year') {\n\n let years = reqCategoryValues.map(year => parseInt(year)).sort()\n\n if (years.length === 2) {\n return `(year BETWEEN ${years[0]} AND ${years[1]})`\n }\n\n return '(' + years.map(val => `(year = ${val})`).join(' OR ') + ')'\n }\n\n // Not a special case\n return '(' + reqCategoryValues.map(val => `(${categoryName} = '${val.toUpperCase()}')`).join(' OR ') + ')'\n\n } else {\n // No requested values for the category that were requested.\n // In this case, if the category has a default value that represents\n // the sum across all members of the category, we exclude that value from the result.\n return (_.includes(alwaysSelected, categoryName)) ? '' :\n '(' + `${categoryName} <> '${categoryVariableDefaults[categoryName]}'` + ')'\n }\n\n\n }).filter(s=>s).join(' AND \\n') + \n ';'\n\n return cb(null, parsedQueryObject)\n } catch (err) {\n return cb(err)\n }\n}", "function crearTablaAscensorItemsCabina(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_items_cabina (k_coditem_cabina, v_item, o_descripcion, v_clasificacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function constructInsertQuery( p_table, p_data ){\n // The # of properties there are in the object\n var len = getObjLength( p_data ); \n // Keeping track of object's size\n var keyCount = 0; \n // strings that will have the column field names and values\n var col_string = \"\";\n var val_string = \"\";\n\n var sql = \"INSERT INTO \" + p_table;\n for( key in p_data ){\n col_string += key;\n \n val_string += (key != \"the_geom\") ? \"'\":\"\";\n\n for( var i=0; i < p_data[key].length; i++ ){\n val_string += p_data[key][i]; \n if( p_data[key].length > 1 && i < p_data[key].length-1 ){\n val_string += \", \"; \n }\n }\n val_string += (key != \"the_geom\") ? \"'\":\"\";\n\n keyCount++; \n if(keyCount < len){\n col_string += \", \";\n val_string += \", \";\n } \n }\n sql += \" (\" + col_string + \") VALUES (\" + val_string + \")\";\n return sql;\n}", "function tableToQuery({ name, columns, keys: { primary, foreign = [] }, unique = [] }) {\n const formatted = [];\n\n // format columns\n for (const column in columns) {\n formatted.push(`${column} ${columns[column]}`);\n }\n\n // format primary keys\n if (primary) {\n formatted.push(`PRIMARY KEY (${primary})`);\n }\n\n // format foreign keys\n for (const { col, ref, more = '' } of foreign) {\n formatted.push(`FOREIGN KEY (${col}) REFERENCES ${ref} ${more}`);\n }\n\n // format unique constraints\n for (const cols of unique) {\n formatted.push(`UNIQUE (${cols.join(',')})`);\n }\n\n // put it all together\n return `CREATE TABLE ${name} (${formatted.join(', ')})`;\n}", "function objToSql(ob) {\n // empty array just like the question marks function\n let arr = [];\n // this will loop through keys then push the key/value as a string into the array\n for (var key in ob) {\n let value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if a string with spaces then add quotes \n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n // adding a single quote to either side of the value\n value = \"'\" + value + \"'\";\n }\n // push key=value to the end of the array\n arr.push(key + \"=\" + value);\n };\n };\n // then turn the array of strings into one string with commas in between each value\n return arr.toString();\n }", "function objToSql(ob) {\n var arr = [];\n\n // loop through the keys and push the key/value as a string int arr\n for (var key in ob) {\n arr.push(key + \"=\" + ob[key]);\n}\n\n return arr.toString();\n}", "function makeSqlScriptInsertSampleData() {\n\n var insertData = 'INSERT INTO ' + gTblNameUpper + ' VALUES (' + newLine;\n\n for (var i = 1; i < gValuesOfRange.length; i++) {\n\n /** set common var in column range*/\n if (!setCommonVar(i)) {\n return '';\n }\n\n if (cPhysicalNameOfColumn == '') {\n break;\n }\n\n insertData += makeDataSample(cTypeVal, cSizeVal, cLogicalNameOfColumn);\n if (!cIsLastRow) {\n insertData += ',';\n }\n insertData += newLine;\n }\n\n insertData += ');';\n\n return insertData;\n}", "toSQL() {\n return this.knexQuery.toSQL();\n }", "function ObjectToSql(obj){\n let arr = [];\n for(var key in obj)\n {\n var value = obj[key];\n //check to skip hidden properties \n if(Object.hasOwnProperty.call(obj,key)){\n //if the value is a string with spaces , add quotations to the entire string\n if(typeof value === \"string\" && value.indexOf(\" \") >= 0)\n {\n value = \"'\"+value+\"'\";\n }\n }\n arr.push(key+\"=\"+value);\n }\n return arr.toString();\n}", "function makeAlterTable() {\n\n var ddl = 'ALTER TABLE ' + gTblNameUpper + ' ADD (' + newLine;\n\n for (var i = 1; i < gValuesOfRange.length; i++) {\n\n /** set common var in column range*/\n if (!setCommonVar(i)) {\n return '';\n }\n\n if (cPhysicalNameOfColumn == '') {\n break;\n }\n\n ddl += cPhysicalNameOfColumnUpper;\n if (cTypeVal.toUpperCase() == TIMESTAMP) {\n ddl += ' TIMESTAMP(6)';\n } else {\n ddl += ' ' + cTypeVal + '(' + cSizeVal + ')';\n }\n\n if (cDefaultVal != '') {\n ddl += ' DEFAULT ' + cDefaultVal;\n }\n if (isNotNull) {\n ddl += ' NOT NULL';\n }\n if (!cIsLastRow) {\n ddl += ',';\n }\n\n ddl += newLine;\n }\n\n ddl += ');';\n\n return ddl;\n}", "function crearTablaAscensorValoresMaquinas(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_maquinas (k_codusuario,k_codinspeccion,k_coditem,n_calificacion,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores maquinas...Espere\");\n console.log('transaction creada ok');\n });\n}", "function setupTableForResponseAndMarks(tx){\n console.log(\"before execute sql for ResponseAndMarks Database\");\n tx.executeSql(\"CREATE TABLE IF NOT EXISTS responseandmark(row_id INTEGER PRIMARY KEY,teacher_id INTEGER,student_id INTEGER,lesson_id INTEGER,\\\n exercise_id INTEGER,response,scoremark INTEGER,comment)\");\n}", "function crearTablaAscensorValoresCabina(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_cabina (k_codusuario,k_codinspeccion,k_coditem,n_calificacion,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores cabina...Espere\");\n console.log('transaction creada ok');\n });\n}", "selectOneQuery() {\n return `select * from ${this.tablename('selectOne')} where id = $1`;\n }", "function create_table(name, example_data, unique_keys = [], connection, callback) {\n let create_query = 'CREATE TABLE ' + name + ' '\n const keys = Object.keys(example_data)\n let cols = []\n\n for (k of keys) {\n let col_string = k\n if (typeof example_data[k] === 'number') {\n if (example_data[k] > 0) { \n col_string = col_string.concat(' VARCHAR(' + example_data[k] + ') ')\n }\n else {\n col_string = col_string.concat(' BIGINT ')\n }\n } else {\n col_string = col_string.concat(' VARCHAR(500) ')\n }\n cols.push(col_string)\n }\n\n if (unique_keys.length > 0) {\n cols.push('UNIQUE ' + bracket(unique_keys))\n }\n\n create_query = create_query.concat(bracket(cols))\n\n\n\n connection.query(create_query, callback)\n}", "function initSQL()\n{\n\tvar sql = '';\n\n\tsql += 'DECLARE @IDSCRIPT AS INTEGER\\n\\n'\n\tsql += 'DECLARE @SQLString AS NVARCHAR(MAX)\\n\\n'\n\n\tif(app == 'PUCC'){\n\t\tsql += 'USE eUmbrella\\n'\n\t}\n\telse if(app == 'APCRED')\n\t{\n\t\tsql += 'USE ucContractManager\\n'\n\t}\n\n\tsql += 'BEGIN TRY \\n\\n';\n\n\tif(transactions == 1){\n\t\tsql += '\tBEGIN TRAN \\n\\n';\n\t}\n\t\n\treturn sql;\n}", "function objToSql(ob) {\n const arr = [];\n\n// loop keys & push key-value to array\nfor (const key in ob) {\n const value = ob[key];\n\n if(Object.hasOwnProperty.call(ob, key)) {\n\n if(typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n arr.push(key + \"=\" + value);\n }\n }\n//convert arrays to single string\n return arr.toString();\n}", "function crearTablaAscensorItemsMaquinas(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_items_maquinas(k_coditem_maquinas, v_item, o_descripcion, v_clasificacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function gen_crud_info ( rv, op, table_name, req_params, func, file, line ) {\n\t'use strict';\n\tvar __FUNCTION__ = \"gen_crud_info\";\n\n\tvar w, tp, s_where;\n\tvar i, mx, com, com1, com2, where, column_name, i_pk, i_p1;\n\n\t// ------------------------------------------------------------ New Params ------------------------------------------------------------\n\t// really move this to *crud*lib*\n\n\tvar count = \t( req_params.count ) ? req_params.count : \"\";\t\t// # of rows to return\n\tvar offset = \t( req_params.offset ) ? req_params.offset : \"\";\t\t// offset from beginning of data set\n\n\tvar sort = \t\t( req_params.sort ) ? req_params.sort : \"\";\t\t// sort order\n\n\tvar query = \t( req_params.query ) ? req_params.query : \"\";\t\t// take specified columns and do a LIKE\n\tvar where = \t( req_params.where ) ? req_params.where : \"\";\t\t// convert parse tree into where clause\n\n\tvar appkey = \t( req_params.appkey ) ? req_params.appkey : \"\";\t\t// Ignored for the moment\n\n\tif ( $debug$.showQuery ) {\n\t\tconsole.log ( \"Query setup is:\\nFile: \"+ \".1.gen_crud_lib.m4.js\" +\" Function:\"+ __FUNCTION__ + \" Line: \"+ 138 );\n\t\tconsole.log ( \" \"+ \" count=\"+count +\" offset=\"+offset +\" sort=\"+sort +\" query=\"+query +\" where=\"+where +\" appkey=\"+appkey );\n\t}\n\n\t// This should be all the rv{hash} components\n\n\trv.delete_pk_where = \"\";\t\t\t// where ... for delete statment\n\trv.error = false;\t\t\t\t\t// return error messages \n\trv.insert_col_names = \"\";\t\t\t// names of columns to use in, \"insert into TABLE ( insert_col_names ) ...\"\n\trv.insert_col_no_s = \"\";\t\t\t// column number for data to bind to insert, \"insert into ... values ( $1, $2, ... )\"\n\trv.limit = \"\";\t\t\t\t\t\t// xyzzy - can you limit $1\n\trv.log_comment = \"\";\t\t\t\t// comment so you can find stmt in PostfreSQL log file\n\trv.offset = \"\";\t\t\t\t\t\t// xyzzy - can you offset $1\n\trv.order_by_clause = \"\";\t\t\t// order by clause\n\trv.select_projected_cols = \"\";\t\t// select PROJECTED_COLS ...\n\trv.select_stmt = \"\";\t\t\t\t// the select template\n\trv.select_where_by_pk = \"\";\t\t\t// where clause for select when selecting by the PK of the table\n\trv.table_column_info = \"\";\n\trv.table_name = \"\";\t\t\t\t\t// name of the table being selected from\n\trv.table_tp = \"\";\n\trv.update_pk_where = \"\";\n\trv.update_set = \"\";\n\trv.where_clause = \"\";\n\n\t// ------------------------------------------------------------ End Params ------------------------------------------------------------\n\tdn.init();\n\trv.table_name = table_name;\n\ttp = find_table ( table_name, model );\n\trv.error = false;\n\tif ( tp < 0 ) {\n\t\t// xyzzy3 - return error - don't know how or what yet\n\t\trv.error = new restify.InvalidArgumentError(\"Error (1892): The specified table is not available.\");\n\t}\n\trv.table_tp = tp;\n\trv.table_column_info = model.tables[tp];\n\trv.log_comment = \"/* { File: \\\"\"+file+\"\\\", Func:\\\"\"+func+\"\\\", LineNo:\\\"\"+line+\"\\\" } */\";\t// Xyzzy - consider adding Server:#####\n\n\t// inserts\n\tif ( op === \"insert\" ) {\n\t\trv.insert_col_names = \"\";\n\t\trv.insert_col_no_s = \"\";\n\t\tcom = \" \";\n\t\tfor ( i = 0, mx = model.tables[tp].columns.length; i < mx; i++ ) {\n\t\t\tcolumn_name = model.tables[tp].columns[i].column_name;\n\t\t\trv.insert_col_names = rv.insert_col_names + com + \"\\\"\" + column_name + \"\\\"\";\n\t\t\ti_p1 = '$' + dn.get_dollar_no ( req_params, column_name );\n\t\t\trv.insert_col_no_s = rv.insert_col_no_s + com + i_p1;\n\t\t\tcom = \",\";\n\t\t}\n\t}\n\n\t// updates\n\tif ( op === \"update\" ) {\n\t\trv.update_set = \"\";\n\t\trv.update_pk_where = \"\";\n\t\trv.insert_col_names = \"\";\n\t\trv.insert_col_no_s = \"\";\n\t\trv.where_clause = \"\";\n//xyzzy - do stuff\n\n\t\tcom1 = \" \";\n\t\tcom = \" \";\n\t\twhere = \" where \";\n\t\tfor ( i = 0, mx = model.tables[tp].columns.length; i < mx; i++ ) {\n\t\t\tcolumn_name = model.tables[tp].columns[i].column_name;\n\t\t\trv.insert_col_names = rv.insert_col_names + com1 + \"\\\"\" + column_name + \"\\\"\";\n\t\t\ti_p1 = '$' + dn.get_dollar_no ( req_params, column_name );\n\t\t\trv.insert_col_no_s = rv.insert_col_no_s + com1 + i_p1;\n\t\t\tcom1 = \",\";\n\t\t\tif ( typeof model.tables[tp].columns[i].primary_key === \"string\" && model.tables[tp].columns[i].primary_key === \"yes\" ) {\n\t\t\t\ti_pk = '$' + dn.get_dollar_no( req_params, column_name );\n\t\t\t\trv.update_pk_where = rv.update_pk_where + where + \"\\\"\"+ column_name + \"\\\" = \" + i_pk;\n\t\t\t\twhere = \" and \";\n\t\t\t} else {\n\t\t\t\ti_p1 = '$' + dn.get_dollar_no( req_params, column_name );\n\t\t\t\trv.update_set = rv.update_set + com + \"\\\"\"+ column_name + \"\\\" = \" + i_p1;\n\t\t\t\tcom = \",\";\n\t\t\t}\n\t\t}\n\t}\n\t\n\t// deletes\n\tif ( op === \"delete\" ) {\n\t\trv.delete_pk_where = \"\";\n\t\trv.where_clause = \"\";\n//xyzzy - do stuff\n\t\twhere = \" where \";\n\t\tfor ( i = 0, mx = model.tables[tp].columns.length; i < mx; i++ ) {\n\t\t\tcolumn_name = model.tables[tp].columns[i].column_name;\n\t\t\tif ( typeof model.tables[tp].columns[i].primary_key === \"string\" && model.tables[tp].columns[i].primary_key === \"yes\" ) {\n\t\t\t\ti_pk = '$' + dn.get_dollar_no( req_params, column_name );\n\t\t\t\trv.delete_pk_where = rv.delete_pk_where + where + \"\\\"\"+ column_name + \"\\\" = \" + i_pk;\n\t\t\t\twhere = \" and \";\n\t\t\t} \n\t\t}\n\t}\n\n\t// selects\n\tif ( op === \"select\" ) {\n\t\trv.select_projected_cols = \"\";\n\t\trv.where_clause = \"\";\n\t\trv.order_by_clause = \"\";\n\t\trv.limit = \"\";\n\t\trv.offset = \"\";\n\n\t\tcom = \" \";\n\t\tfor ( i = 0, mx = model.tables[tp].columns.length; i < mx; i++ ) {\n\t\t\tcolumn_name = model.tables[tp].columns[i].column_name;\n\t\t\trv.select_projected_cols = rv.select_projected_cols + com + \"\\\"\" + column_name + \"\\\"\";\n\t\t\tcom = \",\";\n\t\t}\n\n\t\t// Limit set of rows returned.\n\t\tif ( count != \"\" && offset != \"\" )\n\t\t{\n\t\t\trv.limit = \" limit \"+count;\n\t\t\trv.offset = \" offset \"+offset;\n\t\t}\n\t\tif ( count != \"\" && offset == \"\" )\n\t\t{\n\t\t\trv.limit = \" limit \"+count;\n\t\t\trv.offset = \"\";\n\t\t}\n\n\t\t// order the data set returned\n\t\tif ( sort != \"\" )\n\t\t{\n\t\t\trv.order_by_clause = \" order by \";\n\t\t\t// xyzzy - validate column names\n\t\t\t// xyzzy - put into order by clause\n\t\t\trv.order_by_clause = rv.order_by_clause + sort;\n\t\t}\n\n\t\tif ( debug4x ) {\n\t\t\tconsole.log ( \">>>>>>>>>>>>>>> query=\"+JSON.stringify(query) );\n\t\t}\n\n\t\t// use the pattern match query on the default column\n\t\tif ( query != \"\" && where != \"\" )\n\t\t{\n\t\t\t// xyzzy - get both query and where to work together\n\t\t\trv.error = new restify.InvalidArgumentError(\"can not specify both a query and a where parameter at the same time.\");\n\t\t}\n\t\telse if ( query != \"\" )\n\t\t{\n// xyzzy\n\t\t\tif ( typeof model.tables[tp].default_query_column != \"undefined\" ) {\n\t\t\t\trv.where_clause = ts0 ( \" where \\\"%{query_column_name%}\\\" like '%{query%}'\"\n\t\t\t\t\t, { \"query_column_name\": model.tables[tp].default_query_column, query: '%'+SQLEncodeNQ(query)+'%' } );\n\t\t\t} else {\n\t\t\t\trv.error = new restify.InvalidArgumentError(\"default_query_column is not specified in the model for this table.\");\n\t\t\t}\n\t\t\t// xyzzy - log this for statistical purposes and optimization - think pattent\n\t\t}\n\t\t// do a full where clause - convert parse tree into code.\n\t\telse if ( where != \"\" )\n\t\t{\n\t\t\t// xyzzy - log this \"where\" for statistical purposes and optimization - think pattent\n\t\t\t// xyzzy - shoud bind to data using $ var's instead of inline?\n\t\t\twhere = JSON.parse ( where );\n\t\t\ts_where = \"where \";\n\t\t\tw = \"\";\n\t\t\tgen_where_clause_error = 0;\n\t\t\tgen_where_clause_error_msg = \"\";\n\t\t\t\n\t\t\tif ( debug4x ) {\n\t\t\t\tconsole.log ( \"where.length = \" +where.length );\n\t\t\t}\n\n\t\t\tfor ( i = 0; i < where.length; i++ ) {\n\t\t\t\tw = w + s_where + \"(\" + gen_where_clause ( tp, where[i] ) + \" ) \";\n\t\t\t\tif ( debug4x ) {\n\t\t\t\t\tconsole.log ( \"w = \" +w );\n\t\t\t\t}\n\t\t\t\ts_where = \" and \";\n\t\t\t}\n\t\t\trv.where_clause = w;\n\t\t\tif ( debug4x ) {\n\t\t\t\tconsole.log ( \"rv.where_clause = \" +rv.where_clause );\n\t\t\t}\n\t\t\tif ( gen_where_clause_error ) {\n\t\t\t\trv.error = new restify.InvalidArgumentError( gen_where_clause_error_msg );\n\t\t\t}\n\t\t}\n\n\t}\n\tif ( op === \"select-pk\" ) {\n\t\trv.select_projected_cols = \"\";\n\t\twhere = \" where \";\n\t\trv.select_where_by_pk = \"\";\t\t\t\t// generate a 1 row return PK \n\t\tcom = \" \";\n\t\tfor ( i = 0, mx = model.tables[tp].columns.length; i < mx; i++ ) {\n\t\t\tcolumn_name = model.tables[tp].columns[i].column_name;\n\t\t\trv.select_projected_cols = rv.select_projected_cols + com + \"\\\"\"+ column_name + \"\\\"\";\n\t\t\tcom = \",\";\n\t\t\tif ( typeof model.tables[tp].columns[i].primary_key === \"string\" && model.tables[tp].columns[i].primary_key === \"yes\" ) {\n\t\t\t\ti_pk = '$' + dn.get_dollar_no( req_params, column_name );\n\t\t\t\trv.select_where_by_pk = rv.select_where_by_pk + where + \"\\\"\"+ column_name + \"\\\" = \" + i_pk;\n\t\t\t\twhere = \" and \";\n\t\t\t} \n\t\t}\n\t}\n\t// predef\n\tif ( op === \"predef\" ) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Predefined queries (Read only views, limited to select, etc.)\n\t\tif ( typeof model.tables[tp].select !== \"undefined\" ) {\t\t\t\t\t\t// If select is defined for this predef\n\t\t\tvar cur_select = model.tables[tp].select;\n\t\t\tvar ts_hash = { \"log_comment\": '%{log_comment%}' };\t\t\t\t\t\t// to replace log_comment with itself.\n\t\t\trv.select_stmt = model.tables[tp].select;\t\t\t\t\t\t\t\t// just in case we don't pass through for\n\t\t\tif ( typeof model.tables[tp].columns !== \"undefined\" ) {\t\t\t\t// if columns are defined for this\n\t\t\t\tfor ( i = 0, mx = model.tables[tp].columns.length; i < mx; i++ ) {\t// iterate over them\n\t\t\t\t\tcolumn_name = model.tables[tp].columns[i].column_name;\t\t\t// for each column_name\n\t\t\t\t\tvar re = new RegExp(\"%{\"+column_name+\"%}\");\t\t\t\t\t\t// Let's see if it is in the select statment\n\t\t\t\t\tif ( re.test( cur_select ) ) {\n\t\t\t\t\t\tvar s = dn.get_dollar_no ( req_params, column_name );\t\t// Ok found it - pull from data\n\t\t\t\t\t\tts_hash[ column_name ] = '$'+s;\t\t\t\t\t\t\t\t// convert it to a dollar-no positional parameter\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\trv.select_stmt = ts0 ( cur_select, ts_hash );\t\t\t\t\t\t// Put in all the $1..$N's - replating ${log_comment%} with itself\n\t\t\t}\n\t\t}\n\t}\n\n\tdebug_2(\".1.gen_crud_lib.m4.js\",__FUNCTION__,360,\"\\ncrud_info:\"+JSON.stringify ( rv )+\"\\n\\n\");\n\n\tif ( $debug$.showQuery ) {\n\t\tconsole.log ( \"Query info is:\\nFile: \"+ \".1.gen_crud_lib.m4.js\" +\" Function:\"+ __FUNCTION__ + \" Line: \"+ 363 + \" \" + JSON.stringify ( rv, null, 2 ) + \"\\n\\n\" );\n\t}\n\n\treturn rv;\n}", "function genCode1(objType,appEnv,rowData,r1,h){var columns=Object.keys(rowData);var pgm=Object(_optCode__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(objType,appEnv);console.log('in here');var caslStatements=\"\\n\\n\\n\\n\\taction table.loadTable /\\n\\t\\tcasOut={\\n\\t\\tname=\\\"QUANTILES_PREDICTION\\\",\\n\\t\\treplace=TRUE}\\n\\t\\tcaslib='\".concat(appEnv.INPUTLIBNAME,\"'\\n\\t\\tpath=\\\"QUANTILES_PREDICTION.sashdat\\\";\\n\\n\\n\\taction table.update /\\n\\t\\t\\t table= {\\n\\t\\t\\t\\t\\t\\tcaslib = '\").concat(appEnv.INPUTLIBNAME,\"'\\n\\t\\t\\t\\t\\t\\tname = 'QUANTILES_PREDICTION'\\n\\t\\t\\t\\t\\t\\twhere = \\\"Days=-1\\\"\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t set={\\n\\t\\t\\t {var=\\\"Prediction\\\", value='\").concat(r1,\"'}\\n\\t\\t\\t\\t\\t\\t{var=\\\"Months\\\", value='\").concat(h,\"/30'}\\n\\n\\t\\t\\t };\\n\\n\\t\\t\\t\\t\\taction table.save /\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tcaslib='\").concat(appEnv.INPUTLIBNAME,\"'\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tname='QUANTILES_PREDICTION'\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\ttable ={\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tcaslib = '\").concat(appEnv.INPUTLIBNAME,\"'\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\tname = 'QUANTILES_PREDICTION'\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\treplace=TRUE;\\n\\n\\n\\n\\trun;\\n\\n\\t\");return caslStatements;}", "function crearTablaEscalerasValoresIniciales(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE escaleras_valores_iniciales (k_codusuario,k_codinspeccion,n_cliente,n_equipo,n_empresamto,v_velocidad,o_tipo_equipo,v_inclinacion,v_ancho_paso,f_fecha,ultimo_mto,inicio_servicio,ultima_inspeccion,v_codigo,o_consecutivoinsp,h_hora,o_tipo_informe)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores iniciales...Espere\");\n console.log('transaction creada ok');\n });\n}", "function crearTablaAscensorValoresFotografias(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_fotografias (k_codusuario,k_codinspeccion,k_coditem,n_fotografia,n_directorio,o_estado_envio)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function crearTablaInformeValoresAudios(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE informe_valores_audios (k_codusuario,k_codinforme,n_audio,n_directorio,o_estado_envio)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function createSQL(term) {\n return \"select A,B,C,D,E,F,M,L,V,W,G,H,I,J,K,X,Q,R,S,T where (A like '%\" + term + \"%') or (B like '\" + term + \"') or (lower(C) like lower('%\" + term + \"%')) or (lower(D) like lower('%\" + term + \"%')) or (lower(E) like lower('%\" + term + \"%')) or (F like '%\" + term + \"%') or (lower(O) like lower('%\" + term + \"%')) order by A desc, B asc\";\n}", "static get tableName() {\n return '' + PREFIX + 'loss_of_consciousness';\n }", "function manipulate () {\n console.log(\"beginning data manipulation\");\n\n var sql = \"alter table carto.bg add column geonum bigint; update carto.bg set geonum = ('1' || geoid)::bigint; alter table carto.bg add column state integer; update carto.bg set state=statefp::integer; alter table carto.bg add column county integer; update carto.bg set county=countyfp::integer; alter table carto.bg rename column name to geoname; alter table carto.bg rename column tractce to tract; alter table carto.bg rename column blkgrpce to bg; alter table carto.bg drop column statefp; alter table carto.bg drop column countyfp; CREATE INDEX carto_bg_geoid ON carto.bg USING btree (geoid); CREATE UNIQUE INDEX carto_bg_geonum_idx ON carto.bg USING btree (geonum); CREATE INDEX carto_bg_state_idx ON carto.bg USING btree (state); CREATE INDEX bg_geom_gist ON carto.bg USING gist (geom);\" +\n\n \"alter table carto.county add column geonum bigint; update carto.county set geonum = ('1' || geoid)::bigint; alter table carto.county rename column name to geoname; alter table carto.county add column state integer; update carto.county set state=statefp::integer; alter table carto.county add column county integer; update carto.county set county=countyfp::integer; alter table carto.county drop column statefp; alter table carto.county drop column countyfp; CREATE INDEX carto_county_geoid ON carto.county USING btree (geoid); CREATE UNIQUE INDEX carto_county_geonum_idx ON carto.county USING btree (geonum); CREATE INDEX carto_county_state_idx ON carto.county USING btree (state); CREATE INDEX county_geom_gist ON carto.county USING gist (geom);\" +\n\n \"alter table carto.place add column geonum bigint; update carto.place set geonum = ('1' || geoid)::bigint; alter table carto.place rename column name to geoname; alter table carto.place add column state integer; update carto.place set state=statefp::integer; alter table carto.place add column place integer; update carto.place set place=placefp::integer; alter table carto.place drop column statefp; alter table carto.place drop column placefp; CREATE INDEX carto_place_geoid ON carto.place USING btree (geoid); CREATE UNIQUE INDEX carto_place_geonum_idx ON carto.place USING btree (geonum); CREATE INDEX carto_place_state_idx ON carto.place USING btree (state); CREATE INDEX place_geom_gist ON carto.place USING gist (geom);\" +\n\n \"alter table carto.state add column geonum bigint; update carto.state set geonum = ('1' || geoid)::bigint; alter table carto.state rename column name to geoname; alter table carto.state add column state integer; update carto.state set state=statefp::integer; alter table carto.state rename column stusps to abbrev; alter table carto.state drop column statefp; CREATE INDEX carto_state_geoid ON carto.state USING btree (geoid); CREATE UNIQUE INDEX carto_state_geonum_idx ON carto.state USING btree (geonum); CREATE INDEX carto_state_state_idx ON carto.state USING btree (state); CREATE INDEX state_geom_gist ON carto.state USING gist (geom);\" +\n\n \"alter table carto.tract add column geonum bigint; update carto.tract set geonum = ('1' || geoid)::bigint; alter table carto.tract rename column name to geoname; alter table carto.tract add column state integer; update carto.tract set state=statefp::integer; alter table carto.tract add column county integer; update carto.tract set county=countyfp::integer; alter table carto.tract rename column tractce to tract; alter table carto.tract drop column statefp; alter table carto.tract drop column countyfp; CREATE INDEX carto_tract_geoid ON carto.tract USING btree (geoid); CREATE UNIQUE INDEX carto_tract_geonum_idx ON carto.tract USING btree (geonum); CREATE INDEX carto_tract_state_idx ON carto.tract USING btree (state); CREATE INDEX tract_geom_gist ON carto.tract USING gist (geom);\" +\n\n \"alter table tiger.county add column geonum bigint; update tiger.county set geonum = ('1' || geoid)::bigint; alter table tiger.county rename column name to geoname; alter table tiger.county add column state integer; update tiger.county set state=statefp::integer; alter table tiger.county add column county integer; update tiger.county set county=countyfp::integer; alter table tiger.county drop column statefp; alter table tiger.county drop column countyfp; CREATE INDEX county_geom_gist ON tiger.county USING gist (geom); CREATE INDEX tiger_county_geoid ON tiger.county USING btree (geoid); CREATE UNIQUE INDEX tiger_county_geonum_idx ON tiger.county USING btree (geonum); CREATE INDEX tiger_county_state_idx ON tiger.county USING btree (state);\" +\n\n \"alter table tiger.place add column geonum bigint; update tiger.place set geonum = ('1' || geoid)::bigint; alter table tiger.place rename column namelsad to geoname; alter table tiger.place rename column name to geoname_simple; alter table tiger.place add column state integer; update tiger.place set state=statefp::integer; alter table tiger.place add column place integer; update tiger.place set place=placefp::integer; alter table tiger.place drop column statefp; alter table tiger.place drop column placefp; CREATE INDEX place_geom_gist ON tiger.place USING gist (geom); CREATE INDEX tiger_place_geoid ON tiger.place USING btree (geoid); CREATE UNIQUE INDEX tiger_place_geonum_idx ON tiger.place USING btree (geonum); CREATE INDEX tiger_place_state_idx ON tiger.place USING btree (state);\" +\n\n \"alter table tiger.state add column geonum bigint; update tiger.state set geonum = ('1' || geoid)::bigint; alter table tiger.state rename column name to geoname; alter table tiger.state add column state integer; update tiger.state set state=statefp::integer; alter table tiger.state rename column stusps to abbrev; CREATE INDEX state_geom_gist ON tiger.state USING gist (geom); CREATE INDEX tiger_state_geoid ON tiger.state USING btree (geoid); CREATE UNIQUE INDEX tiger_state_geonum_idx ON tiger.state USING btree (geonum); CREATE INDEX tiger_state_state_idx ON tiger.state USING btree (state);\" +\n\n \"alter table tiger.tract add column geonum bigint; update tiger.tract set geonum = ('1' || geoid)::bigint; alter table tiger.tract rename column namelsad to geoname; alter table tiger.tract rename column name to simple_name; alter table tiger.tract add column state integer; update tiger.tract set state=statefp::integer; alter table tiger.tract add column county integer; update tiger.tract set county=countyfp::integer; alter table tiger.tract rename column tractce to tract; alter table tiger.tract drop column statefp; alter table tiger.tract drop column countyfp; CREATE INDEX tiger_tract_geoid ON tiger.tract USING btree (geoid); CREATE UNIQUE INDEX tiger_tract_geonum_idx ON tiger.tract USING btree (geonum); CREATE INDEX tiger_tract_state_idx ON tiger.tract USING btree (state); CREATE INDEX tract_geom_gist ON tiger.tract USING gist (geom);\" +\n\n \"alter table tiger.bg add column geonum bigint; update tiger.bg set geonum = ('1' || geoid)::bigint; alter table tiger.bg add column state integer; update tiger.bg set state=statefp::integer; alter table tiger.bg add column county integer; update tiger.bg set county=countyfp::integer; alter table tiger.bg rename column namelsad to geoname; alter table tiger.bg rename column tractce to tract; alter table tiger.bg rename column blkgrpce to bg; alter table tiger.bg drop column statefp; alter table tiger.bg drop column countyfp; CREATE INDEX bg_geom_gist ON tiger.bg USING gist (geom); CREATE INDEX tiger_bg_geoid ON tiger.bg USING btree (geoid); CREATE UNIQUE INDEX tiger_bg_geonum_idx ON tiger.bg USING btree (geonum); CREATE INDEX tiger_bg_state_idx ON tiger.bg USING btree (state);\";\n \n client.connect();\n\n var newquery = client.query(sql);\n\n newquery.on(\"end\", function () {\n client.end();\n console.log(\"end manipulation\");\n cleanup();\n });\n\n\n}", "function iniciarTablaHistorial(tx) {\n\ttx.executeSql('CREATE TABLE IF NOT EXISTS Historial (IDUsuario, CuentaDesde, CuentaHasta, Monto, FechaHora)');\n}", "function crearTablaEscalerasItemsDefectos(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE escaleras_items_defectos(k_coditem_escaleras, o_descripcion, v_clasificacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function GenerateTableData_2(paramsObj) {\n var operationsAtFront = (paramsObj.operationsAtFront === undefined || paramsObj.operationsAtFront === null || paramsObj.operationsAtFront === \"\" || paramsObj.operationsAtFront === false) ? false : true;\n var startNumber = (paramsObj.startNumber === undefined || paramsObj.startNumber === null || paramsObj.startNumber === \"\") ? 0 : paramsObj.startNumber;\n var endNumber = (paramsObj.endNumber === undefined || paramsObj.endNumber === null || paramsObj.endNumber === \"\") ? Intern_ArrayOfValues.length : (paramsObj.endNumber > Intern_ArrayOfValues.length ? Intern_ArrayOfValues.length : paramsObj.endNumber);\n\n //debugger;\n\n var ret = \"\";\n var tempRet = \"\";\n var display;\n var i;\n\n var minVal, maxVal, maxLength;\n var includeEditText;\n var style;\n for (var i = startNumber; i < endNumber; i++){\n //$.each(Intern_ArrayOfValues, function (index, value) {\n $.each(Intern_TableFieldIDs, function (index1, value1) {\n\n //debugger;\n\n //*%* Note: Ludovick - ToDelete\n // BEGIN\n if (Intern_ArrTableFieldDesc[i] !== undefined && Intern_ArrTableFieldDesc[i] !== null) {\n if (Intern_ArrTableFieldDesc[i][value1] !== undefined && Intern_ArrTableFieldDesc[i][value1] !== null) {\n if (Intern_ArrTableFieldDesc[i][value1].Template !== undefined && Intern_ArrTableFieldDesc[i][value1].Template !== null) {\n display = Intern_ArrTableFieldDesc[i][value1].Template.replace(/\\*%dataColName%\\*/g, value1)\n .replace(/\\*%dataRowNum%\\*/g, i).replace(/\\*%dataValue%\\*/g, Intern_ArrayOfValues[i][value1]);\n }\n else if (Intern_ArrTableFieldDesc[i][value1].CellEditable !== undefined && Intern_ArrTableFieldDesc[i][value1].CellEditable !== null && Intern_ArrTableFieldDesc[i][value1].CellEditable === true) {\n if (Intern_ArrTableFieldDesc[i][value1].Type === \"number\") {\n minVal = (Intern_ArrTableFieldDesc[i][value1].minVal !== undefined && Intern_ArrTableFieldDesc[i][value1].minVal !== null && Intern_ArrTableFieldDesc[i][value1].minVal !== \"\") ? 'min=\"' + Intern_ArrTableFieldDesc[i][value1].minVal + '\"' : \"\";\n maxVal = (Intern_ArrTableFieldDesc[i][value1].maxVal !== undefined && Intern_ArrTableFieldDesc[i][value1].maxVal !== null && Intern_ArrTableFieldDesc[i][value1].maxVal !== \"\") ? 'max=\"' + Intern_ArrTableFieldDesc[i][value1].maxVal + '\"' : \"\";\n includeEditText = (Intern_ArrTableFieldDesc[i][value1].IncludeEditText !== undefined && Intern_ArrTableFieldDesc[i][value1].IncludeEditText !== null)\n ? ((Intern_ArrTableFieldDesc[i][value1].IncludeEditText !== \"\") ? '<a class=\"clsLink\" id=\"' + Intern_InstanceName + 'lnkEditCell_' + i + '\" >' + Intern_ArrTableFieldDesc[i][value1].IncludeEditText + '</a>' : '<span class=\"glyphicon glyphicon-edit\"></span>')\n : \"\";\n if (Setting_UseInputBoxForEditable)\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"number\" >'\n + '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"number\" ' + minVal + ' ' + maxVal + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n //+ '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"number\" ng-change=InputFieldChanged() ' + minVal + ' ' + maxVal + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n + includeEditText //'<span class=\"glyphicon glyphicon-edit\"></span>'\n + '</td>';\n else\n display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"number\" ' + minVal + ' ' + maxVal + '>' + Intern_ArrayOfValues[i][value1] + '</td>'; \n \n }\n else if (Intern_ArrTableFieldDesc[i][value1].Type === \"text\") {\n maxLength = (Intern_ArrTableFieldDesc[i][value1].maxLength !== undefined && Intern_ArrTableFieldDesc[i][value1].maxLength !== null && Intern_ArrTableFieldDesc[i][value1].maxLength !== \"\") ? 'maxlength=\"' + Intern_ArrTableFieldDesc[i][value1].maxLength + '\"' : \"\";\n includeEditText = (Intern_ArrTableFieldDesc[i][value1].IncludeEditText !== undefined && Intern_ArrTableFieldDesc[i][value1].IncludeEditText !== null)\n ? ((Intern_ArrTableFieldDesc[i][value1].IncludeEditText !== \"\") ? '<a class=\"clsLink\" id=\"' + Intern_InstanceName + 'lnkEditCell_' + i + '\" >' + Intern_ArrTableFieldDesc[i][value1].IncludeEditText + '</a>' : '<span class=\"glyphicon glyphicon-edit\"></span>')\n : \"\";\n if (Setting_UseInputBoxForEditable)\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"text\" >'\n + '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"text\" ' + maxLength + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n //+ '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"text\" ng-change=InputFieldChanged() ' + maxLength + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n + includeEditText //'<span class=\"glyphicon glyphicon-edit\"></span>'\n + '</td>';\n else\n display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"text\" ' + maxLength + '>' + Intern_ArrayOfValues[i][value1] + '</td>';\n \n //display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"text\" ' + maxLength + '>' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n else {\n display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n }\n else {\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n }\n else {\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n }\n else if (Intern_TableFieldDesc[value1] !== undefined && Intern_TableFieldDesc[value1] !== null) {\n if (Intern_TableFieldDesc[value1].Template !== undefined && Intern_TableFieldDesc[value1].Template !== null) {\n display = Intern_TableFieldDesc[value1].Template.replace(/\\*%dataColName%\\*/g, value1)\n .replace(/\\*%dataRowNum%\\*/g, i).replace(/\\*%dataValue%\\*/g, Intern_ArrayOfValues[i][value1]);\n }\n else if(Intern_TableFieldDesc[value1].CellEditable !== undefined && Intern_TableFieldDesc[value1].CellEditable !== null && Intern_TableFieldDesc[value1].CellEditable === true) {\n if (Intern_TableFieldDesc[value1].Type === \"number\") {\n minVal = (Intern_TableFieldDesc[value1].minVal !== undefined && Intern_TableFieldDesc[value1].minVal !== null && Intern_TableFieldDesc[value1].minVal !== \"\") ? 'min=\"' + Intern_TableFieldDesc[value1].minVal + '\"' : \"\";\n maxVal = (Intern_TableFieldDesc[value1].maxVal !== undefined && Intern_TableFieldDesc[value1].maxVal !== null && Intern_TableFieldDesc[value1].maxVal !== \"\") ? 'max=\"' + Intern_TableFieldDesc[value1].maxVal + '\"' : \"\";\n includeEditText = (Intern_TableFieldDesc[value1].IncludeEditText !== undefined && Intern_TableFieldDesc[value1].IncludeEditText !== null)\n ? ((Intern_TableFieldDesc[value1].IncludeEditText !== \"\") ? '<a class=\"clsLink\" id=\"' + Intern_InstanceName + 'lnkEditCell_' + i + '\" >' + Intern_TableFieldDesc[value1].IncludeEditText + '</a>' : '<span class=\"glyphicon glyphicon-edit\"></span>')\n : \"\";\n if (Setting_UseInputBoxForEditable) {\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"number\" >'\n + '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"number\" ' + minVal + ' ' + maxVal + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n //+ '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"number\" ng-change=InputFieldChanged() ' + minVal + ' ' + maxVal + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n + includeEditText //'<span class=\"glyphicon glyphicon-edit\"></span>'\n + '</td>';\n\n //display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"number\" ' + minVal + ' ' + maxVal + '><input type=\"number\" value=\"' + Intern_ArrayOfValues[i][value1] + '\" /></td>';\n }\n else\n display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"number\" ' + minVal + ' ' + maxVal + '>' + Intern_ArrayOfValues[i][value1] + '</td>';\n \n }\n else if (Intern_TableFieldDesc[value1].Type === \"text\") {\n maxLength = (Intern_TableFieldDesc[value1].maxLength !== undefined && Intern_TableFieldDesc[value1].maxLength !== null && Intern_TableFieldDesc[value1].maxLength !== \"\") ? 'maxlength=\"' + Intern_TableFieldDesc[value1].maxLength + '\"' : \"\";\n includeEditText = (Intern_TableFieldDesc[value1].IncludeEditText !== undefined && Intern_TableFieldDesc[value1].IncludeEditText !== null)\n ? ((Intern_TableFieldDesc[value1].IncludeEditText !== \"\") ? '<a class=\"clsLink\" id=\"' + Intern_InstanceName + 'lnkEditCell_' + i + '\" >' + Intern_TableFieldDesc[value1].IncludeEditText + '</a>' : '<span class=\"glyphicon glyphicon-edit\"></span>')\n : \"\";\n if (Setting_UseInputBoxForEditable)\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"text\" >'\n + '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"text\" ' + maxLength + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n //+ '<input class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" type=\"text\" ng-change=InputFieldChanged() ' + maxLength + ' value=\"' + Intern_ArrayOfValues[i][value1] + '\" />'\n + includeEditText //'<span class=\"glyphicon glyphicon-edit\"></span>'\n + '</td>';\n else\n display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"text\" ' + maxLength + '>' + Intern_ArrayOfValues[i][value1] + '</td>';\n\n //display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\" dataType=\"text\" ' + maxLength + '>' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n else {\n display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n }\n else {\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n }\n else if (Utilities_StringInArrayBinarySearch(value1, Intern_EditableFieldIDs)) {\n if(Setting_UseNgBlur) \n display = '<td contenteditable ng-blur=\"TableFieldChanged($event)\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n else\n display = '<td contenteditable class=\"cellEditable\" dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n else {\n display = '<td dataColName=\"' + value1 + '\" dataRowNum=\"' + i + '\">' + Intern_ArrayOfValues[i][value1] + '</td>';\n }\n // END\n\n\n\n //display = '<td>' + Intern_ArrayOfValues[i][value1] + '</td>';\n tempRet = tempRet + display;\n });\n\n //debugger;\n\n style = \"\";\n if (Intern_ArrayOfValues[i] !== undefined && Intern_ArrayOfValues[i] !== null && Intern_ArrayOfValues[i] !== '')\n style = (Intern_ArrayOfValues[i].style === undefined || Intern_ArrayOfValues[i].style === null || Intern_ArrayOfValues[i].style === '') ? '' : 'style=\"' + Intern_ArrayOfValues[i].style + '\"';\n if (Intern_ArrayOfValues[i].paramRowMetaData_AddOperations === undefined || Intern_ArrayOfValues[i].paramRowMetaData_AddOperations === null \n || Intern_ArrayOfValues[i].paramRowMetaData_AddOperations === \"\" || Intern_ArrayOfValues[i].paramRowMetaData_AddOperations === true) {\n if (operationsAtFront) {\n tempRet = '<tr id=\"' + Intern_InstanceName + 'tableRow_' + i + '\" ' + style + ' >' + AddOperations(i) + tempRet;\n }\n else {\n tempRet = '<tr id=\"' + Intern_InstanceName + 'tableRow_' + i + '\" ' + style + ' >' + tempRet + AddOperations(i);\n }\n tempRet = tempRet + '</tr>';\n }\n else {\n if (AddOperations(i) === \"\")\n tempRet = '<tr id=\"' + Intern_InstanceName + 'tableRow_' + i + '\" ' + style + ' >' + tempRet + '</tr>';\n else\n tempRet = '<tr id=\"' + Intern_InstanceName + 'tableRow_' + i + '\" ' + style + ' >' + tempRet + '<td></td></tr>';\n }\n\n if (Setting_AddToTop)\n ret = tempRet + ret;\n else\n ret = ret + tempRet;\n tempRet = \"\";\n }\n\n /*\n $.each(Intern_ArrayOfValues, function (index, value) {\n $.each(Intern_TableFieldIDs, function (index1, value1) {\n display = '<td>' + value[value1] + '</td>';\n tempRet = tempRet + display;\n });\n if (operationsAtFront) {\n tempRet = '<tr id=\"' + Intern_InstanceName + 'tableRow_' + index + '\">' + AddOperations(index) + tempRet;\n }\n else {\n tempRet = '<tr id=\"' + Intern_InstanceName + 'tableRow_' + index + '\">' + tempRet + AddOperations(index);\n }\n tempRet = tempRet + '</tr>';\n\n if (Setting_AddToTop)\n ret = tempRet + ret;\n else\n ret = ret + tempRet;\n tempRet = \"\";\n });\n */\n return ret;\n }", "function crearTablaInforme(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE informe (k_codinforme,v_consecutivoinforme,k_codusuario,f_informe)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores informe...Espere\");\n console.log('transaction creada ok');\n });\n}", "function crearTablaAuditoriaInspeccionesPuertas(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE auditoria_inspecciones_puertas (k_codusuario,k_codinspeccion,o_consecutivoinsp,o_estado_envio,o_revision,v_item_nocumple,k_codcliente,k_codinforme,k_codusuario_modifica,o_actualizar_inspeccion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores auditoria...Espere\");\n console.log('transaction creada ok');\n });\n}", "function initDB(){\n try{\n db.executeSimpleSQL('create table if not exists ParameterValues (componentName varchar(100), conf text, desc varchar(1000), '+\n ' Tags varchar(100), usage int(10), DownVotes int(10), UpVotes int(10), date datetime DEFAULT current_timestamp ,'+\n ' primary key(componentName, conf) );');\n db.executeSimpleSQL('create table if not exists CompCo ( srcComp varchar(1000), conf text, desc varchar(1000), '+\n ' Tags varchar(256), UpVotes int(20), usage int(20), DownVotes int(20), date Timestamp DEFAULT current_timestamp,'+\n ' primary key(srcComp, conf) ); ');\n db.executeSimpleSQL('create table if not exists MultiCompCo ' +\n '(srcComp varchar(1000), conf text, desc varchar(1000), Tags varchar(100), ' +\n 'UpVotes int(10), DownVotes int(10), usage int(10), date datetime DEFAULT current_timestamp, primary key(srcComp, conf) ) '); \n }catch(e){\n logE(e);\n }\n fill4DEMO();\n}", "function objToSql(ob) {\n let arr = [];\n\n // loop through the keys and push the key/value as a string int arr\n for (let key in ob) {\n let value = ob[key];\n // check to skip hidden properties\n if (Object.hasOwnProperty.call(ob, key)) {\n // if string with spaces, add quotations \n if (typeof value === \"string\" && value.indexOf(\" \") >= 0) {\n value = \"'\" + value + \"'\";\n }\n\n arr.push(key + \"=\" + value);\n }\n }\n\n // translate array of strings to a single string\n return arr.toString();\n}", "function crearTablaAscensorItemsElementos(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_items_elementos(k_coditem, o_descripcion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function crearTablaPuertasItemsPreliminar(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE puertas_items_preliminar(k_coditem, o_descripcion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n console.log('transaction creada ok');\n });\n}", "function generaSP_SQL(sp) {\n\t\t\tsp=sp.replace(/call/gi,'');\n\t var index = sp.indexOf('(');\n\t var virtualSP = 'virtual_sp' + sp.substring(index);\n\t var nuevoSP = eval('(' + virtualSP + ')');\n\t nuevoSP.name = sp.substring(0,index);\n\t return nuevoSP;\n\t\t}", "function insertvalues(tx,dynamicTableValues) {\r\n \r\n\tvar query = 'INSERT INTO ' + dynamicTableValues[0] +' VALUES(';\r\n \r\n for(var i = 1; i < dynamicTableValues.length; i++)\r\n {\r\n \t//query = query + \"'\" + dynamicTableValues[i] + \"'\" ;\r\n \tquery = query + '\"' + dynamicTableValues[i] + '\"' ; \r\n \t\r\n \tif(i != (dynamicTableValues.length - 1 ))\r\n \t\tquery = query + ',';\r\n }\r\n query = query + ')';\r\n \r\n console.log(query);\r\n \r\n tx.executeSql( query );\r\n}", "function tableView(container,doc) \r\n{\r\n var numRows; // assigned in click, includes header\r\n var numCols; // assigned at bottom of click\r\n var activeSingleQuery = null;\r\n var autoCompArray = [];\r\n var entryArray = [];\r\n var qps; // assigned in onBinding\r\n var kb = tabulator.kb;\r\n\r\n thisTable = this; // fixes a problem with calling this.container\r\n this.document=null;\r\n if(doc)\r\n this.document=doc;\r\n else\r\n this.document=document;\r\n \r\n // The necessary vars for a View\r\n this.name=\"Table\"; //Display name of this view.\r\n this.queryStates=[]; //All Queries currently in this view.\r\n this.container=container; //HTML DOM parent node for this view.\r\n this.container.setAttribute('ondblclick','tableDoubleClick(event)');\r\n \r\n /*****************************************************\r\n drawQuery \r\n ******************************************************/\r\n this.drawQuery = function (q)\r\n {\r\n var i, td, th, j, v;\r\n var t = thisTable.document.createElement('table');\r\n var tr = thisTable.document.createElement('tr');\r\n var nv = q.vars.length;\r\n \r\n this.onBinding = function (bindings) {\r\n var i, tr, td;\r\n //tabulator.log.info('making a row w/ bindings ' + bindings);\r\n tr = thisTable.document.createElement('tr');\r\n t.appendChild(tr);\r\n numStats = q.pat.statements.length; // Added\r\n qps = q.pat.statements;\r\n for (i=0; i<nv; i++) {\r\n var v = q.vars[i];\r\n var val = bindings[v];\r\n tabulator.log.msg('Variable '+v+'->'+val)\r\n // generate the subj and pred for each tdNode \r\n for (j = 0; j<numStats; j++) {\r\n var stat = q.pat.statements[j];\r\n // statClone = <s> <p> ?* .\r\n var statClone = new tabulator.rdf.Statement(stat.subject, stat.predicate, stat.object);\r\n if (statClone.object == v) {\r\n statClone.object = bindings[v];\r\n var sSubj = statClone.subject.toString();\r\n if (sSubj[0] == '?') { \r\n // statClone = ?* <p> <o> .\r\n statClone.subject = bindings[statClone.subject];\r\n }\r\n break;\r\n }\r\n }\r\n tabulator.log.msg('looking for statement in store to attach to node ' + statClone);\r\n var st = kb.anyStatementMatching(statClone.subject, statClone.predicate, statClone.object);\r\n if (!st) {tabulator.log.warn(\"Tableview: no statement {\"+\r\n statClone.subject+statClone.predicate+statClone.object+\"} from bindings: \"+bindings);}\r\n else if (!st.why) {tabulator.log.warn(\"Unknown provenence for {\"+st.subject+st.predicate+st.object+\"}\");}\r\n tr.appendChild(matrixTD(val, st));\r\n } //for each query var, make a row\r\n } // onBinding\r\n\r\n t.appendChild(tr);\r\n t.setAttribute('class', 'results sortable'); //needed to make sortable\r\n t.setAttribute('id', 'tabulated_data'); \r\n \r\n tabulator.Util.emptyNode(thisTable.container).appendChild(t); // See results as we go\r\n\r\n for (i=0; i<nv; i++) { // create the header\r\n v = q.vars[i];\r\n tabulator.log.debug(\"table header cell for \" + v + ': '+v.label)\r\n text = document.createTextNode(v.label)\r\n th = thisTable.document.createElement('th');\r\n th.appendChild(text);\r\n tr.appendChild(th);\r\n }\r\n \r\n kb.query(q, this.onBinding); // pulling in the results of the query\r\n activeSingleQuery = q;\r\n this.queryStates[q.id]=1;\r\n \r\n drawExport();\r\n drawAddRow();\r\n sortables_init();\r\n \r\n // table edit\r\n t.addEventListener('click', click, false);\r\n numCols = nv;\r\n \r\n // auto completion array\r\n entryArray = tabulator.lb.entry;\r\n for (i = 0; i<tabulator.lb.entry.length; i++) {\r\n autoCompArray.push(entryArray[i][0].toString());\r\n entryArray = entryArray.slice(0);\r\n }\r\n } //drawQuery\r\n\r\n function drawExport () {\r\n var form= thisTable.document.createElement('form');\r\n var but = thisTable.document.createElement('input');\r\n form.setAttribute('textAlign','right');\r\n but.setAttribute('type','button');\r\n but.setAttribute('id','exportButton');\r\n but.addEventListener('click',exportTable,true);\r\n but.setAttribute('value','Export to HTML');\r\n form.appendChild(but);\r\n thisTable.container.appendChild(form);\r\n }\r\n\r\n this.undrawQuery = function(q) {\r\n if(q===activeSingleQuery) \r\n {\r\n this.queryStates[q.id]=0;\r\n activeSingleQuery=null;\r\n tabulator.Util.emptyNode(this.container);\r\n }\r\n }\r\n\r\n this.addQuery = function(q) {\r\n this.queryStates[q.id]=0;\r\n }\r\n\r\n this.removeQuery = function (q) {\r\n this.undrawQuery(q);\r\n delete this.queryStates[q.id];\r\n return;\r\n }\r\n\r\n this.clearView = function () {\r\n this.undrawQuery(activeSingleQuery);\r\n activeSingleQuery=null;\r\n tabulator.Util.emptyNode(this.container);\r\n }\r\n \r\n /*****************************************************\r\n Table Editing\r\n ******************************************************/\r\n var selTD;\r\n var inputObj;\r\n var sparqlUpdate;\r\n \r\n function clearSelected(node) {\r\n if (!node) {return;}\r\n var a = document.getElementById('focus');\r\n if (a != null) { a.parentNode.removeChild(a); };\r\n var t = document.getElementById('tabulated_data');\r\n t.removeEventListener('keypress', keyHandler, false);\r\n node.style.backgroundColor = 'white';\r\n }\r\n \r\n function clickSecond(e) {\r\n selTD.removeEventListener('click', clickSecond, false); \r\n if (e.target == selTD) {\r\n clearSelected(selTD);\r\n onEdit();\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n }\r\n \r\n function setSelected(node) {\r\n if (!node) {return;}\r\n if (node.tagName != \"TD\") {return;}\r\n var a = document.createElement('a');\r\n a.setAttribute('id', 'focus');\r\n node.appendChild(a);\r\n a.focus();\r\n var t = document.getElementById('tabulated_data');\r\n t.addEventListener('keypress', keyHandler, false);\r\n node.style.backgroundColor = \"#8F3\";\r\n \r\n selTD = node;\r\n selTD.addEventListener('click', clickSecond, false);\r\n }\r\n \r\n function click(e) {\r\n if (selTD != null) clearSelected(selTD);\r\n var node = e.target;\r\n if (node.firstChild && node.firstChild.tagName == \"INPUT\") return;\r\n setSelected(node);\r\n var t = document.getElementById('tabulated_data');\r\n numRows = t.childNodes.length;\r\n }\r\n \r\n function getRowIndex(node) { \r\n var trNode = node.parentNode;\r\n var rowArray = trNode.parentNode.childNodes;\r\n var rowArrayLength = trNode.parentNode.childNodes.length;\r\n for (i = 1; i<rowArrayLength; i++) {\r\n if (rowArray[i].innerHTML == trNode.innerHTML) return i;\r\n }\r\n }\r\n \r\n function getTDNode(iRow, iCol) {\r\n var t = document.getElementById('tabulated_data');\r\n //return t.rows[iRow].cells[iCol]; // relies on tbody\r\n return t.childNodes[iRow].childNodes[iCol];\r\n }\r\n \r\n function keyHandler(e) {\r\n var oldRow = getRowIndex(selTD); //includes header\r\n var oldCol = selTD.cellIndex;\r\n var t = document.getElementById('tabulated_data');\r\n clearSelected(selTD);\r\n if (e.keyCode == 35) { //end\r\n addRow();\r\n }\r\n if (e.keyCode==13) { //enter\r\n onEdit();\r\n }\r\n if(e.keyCode==37) { //left\r\n newRow = oldRow;\r\n newCol = (oldCol>0)?(oldCol-1):oldCol;\r\n var newNode = getTDNode(newRow, newCol);\r\n setSelected(newNode);\r\n }\r\n if (e.keyCode==38) { //up\r\n newRow = (oldRow>1)?(oldRow-1):oldRow;\r\n newCol = oldCol;\r\n var newNode = getTDNode(newRow, newCol)\r\n setSelected(newNode);\r\n newNode.scrollIntoView(false); // ...\r\n }\r\n if (e.keyCode==39) { //right\r\n newRow = oldRow;\r\n newCol = (oldCol<numCols-1)?(oldCol+1):oldCol;\r\n var newNode = getTDNode(newRow, newCol);\r\n setSelected(newNode);\r\n }\r\n if (e.keyCode==40) { //down\r\n newRow = (oldRow<numRows-1)?(oldRow+1):oldRow;\r\n newCol = oldCol;\r\n var newNode = getTDNode(newRow, newCol);\r\n setSelected(newNode);\r\n newNode.scrollIntoView(false);\r\n }\r\n if (e.shiftKey && e.keyCode == 9) { //shift+tab\r\n newRow = oldRow;\r\n newCol = (oldCol>0)?(oldCol-1):oldCol;\r\n if (oldCol == 0) {\r\n newRow = oldRow-1;\r\n newCol = numCols-1;\r\n }\r\n if (oldRow==1) {newRow=1;}\r\n if (oldRow==1 && oldCol==0) {newRow=1; newCol = 0;}\r\n \r\n var newNode = getTDNode(newRow, newCol);\r\n setSelected(newNode);\r\n e.stopPropagation();\r\n e.preventDefault();\r\n return;\r\n }\r\n if (e.keyCode == 9) { // tab\r\n newRow = oldRow;\r\n newCol = (oldCol<numCols-1)?(oldCol+1):oldCol;\r\n if (oldCol == numCols-1) {\r\n newRow = oldRow+1;\r\n newCol = 0;\r\n }\r\n if (oldRow == numRows-1) {newRow = numRows-1;}\r\n if (oldRow == numRows-1 && oldCol == numCols-1) \r\n {newRow = numRows-1; newCol = numCols-1}\r\n \r\n var newNode = getTDNode(newRow, newCol);\r\n setSelected(newNode);\r\n }\r\n e.stopPropagation();\r\n e.preventDefault();\r\n } //keyHandler\r\n \r\n function onEdit() {\r\n if ((selTD.getAttribute('autocomp') == undefined) && \r\n (selTD.getAttribute('type') == 'sym')) {\r\n setSelected(selTD); return; \r\n }\r\n if (!selTD.editable && (selTD.getAttribute('type') == 'sym')) {return;}\r\n if (selTD.getAttribute('type') == 'bnode') {\r\n setSelected(selTD); return;\r\n }\r\n \r\n var t = document.getElementById('tabulated_data');\r\n var oldTxt = selTD.innerHTML;\r\n inputObj = document.createElement('input');\r\n inputObj.type = \"text\";\r\n inputObj.style.width = \"99%\";\r\n inputObj.value = oldTxt;\r\n \r\n // replace old text with input box\r\n if (!oldTxt)\r\n inputObj.value = ' '; // ????\r\n if (selTD.firstChild) { // selTD = <td> text </td>\r\n selTD.replaceChild(inputObj, selTD.firstChild);\r\n inputObj.select();\r\n } else { // selTD = <td />\r\n var parent = selTD.parentNode;\r\n var newTD = thisTable.document.createElement('TD');\r\n parent.replaceChild(newTD, selTD);\r\n newTD.appendChild(inputObj);\r\n }\r\n \r\n // make autocomplete input or just regular input\r\n if (selTD.getAttribute('autocomp') == 'true') {\r\n autoSuggest(inputObj, autoCompArray);\r\n }\r\n inputObj.addEventListener (\"blur\", inputObjBlur, false);\r\n inputObj.addEventListener (\"keypress\", inputObjKeyPress, false);\r\n } //onEdit\r\n \r\n function inputObjBlur(e) { \r\n // no re-editing of symbols for now\r\n document.getElementById(\"autosuggest\").style.display = 'none';\r\n newText = inputObj.value;\r\n selTD.setAttribute('about', newText);\r\n if (newText != '') {\r\n selTD.innerHTML = newText;\r\n }\r\n else {\r\n selTD.innerHTML = '---';\r\n }\r\n setSelected(selTD);\r\n e.stopPropagation();\r\n e.preventDefault();\r\n \r\n // sparql update\r\n if (!selTD.stat) {saveAddRowText(newText); return;};\r\n tabulator.log.msg('sparql update with stat: ' + selTD.stat);\r\n tabulator.log.msg('new object will be: ' + kb.literal(newText, ''));\r\n if (tabulator.isExtension) {sparqlUpdate = sparql.update_statement(selTD.stat);}\r\n else {sparqlUpdate = new sparql(kb).update_statement(selTD.stat);}\r\n // TODO: DEFINE ERROR CALLBACK\r\n //selTD.stat.object = kb.literal(newText, '');\r\n sparqlUpdate.set_object(kb.literal(newText, ''), function(uri,success,error_body) {\r\n if (success) {\r\n //kb.add(selTD.stat.subject, selTD.stat.predicate, selTD.stat.object, selTD.stat.why)\r\n tabulator.log.msg('sparql update success');\r\n var newStatement = kb.add(selTD.stat.subject, selTD.stat.predicate, kb.literal(newText, ''), selTD.stat.why);\r\n kb.remove(selTD.stat);\r\n selTD.stat = newStatement;\r\n }\r\n });\r\n }\r\n\r\n function inputObjKeyPress(e) {\r\n if (e.keyCode == 13) { //enter\r\n inputObjBlur(e);\r\n }\r\n } //***************** End Table Editing *****************//\r\n \r\n /******************************************************\r\n Add Row\r\n *******************************************************/\r\n // node type checking\r\n function literalRC (row, col) {\r\n var t = thisTable.document.getElementById('tabulated_data'); \r\n var tdNode = t.childNodes[row].childNodes[col];\r\n if (tdNode.getAttribute('type') =='lit') return true;\r\n } \r\n\r\n function bnodeRC (row, col) {\r\n var t = thisTable.document.getElementById('tabulated_data');\r\n var tdNode = t.childNodes[row].childNodes[col];\r\n if (tdNode.getAttribute('type') =='bnode') return true;\r\n }\r\n\r\n function symbolRC(row, col) {\r\n var t = thisTable.document.getElementById('tabulated_data');\r\n var tdNode = t.childNodes[row].childNodes[col];\r\n if (tdNode.getAttribute('type') == 'sym') return true;\r\n } // end note type checking\r\n \r\n // td creation for each type\r\n function createLiteralTD() {\r\n tabulator.log.msg('creating literalTD for addRow');\r\n var td = thisTable.document.createElement(\"TD\");\r\n td.setAttribute('type', 'lit');\r\n td.innerHTML = '---';\r\n return td;\r\n }\r\n \r\n function createSymbolTD() {\r\n tabulator.log.msg('creating symbolTD for addRow');\r\n var td = thisTable.document.createElement(\"TD\");\r\n td.editable=true;\r\n td.setAttribute('type', 'sym');\r\n td.setAttribute('style', 'color:#4444ff');\r\n td.innerHTML = \"---\";\r\n td.setAttribute('autocomp', 'true');\r\n return td;\r\n }\r\n\r\n function createBNodeTD() {\r\n var td = thisTable.document.createElement('TD');\r\n td.setAttribute('type', 'bnode');\r\n td.setAttribute('style', 'color:#4444ff');\r\n td.innerHTML = \"...\";\r\n bnode = kb.bnode();\r\n tabulator.log.msg('creating bnodeTD for addRow: ' + bnode.toNT());\r\n td.setAttribute('o', bnode.toNT());\r\n return td;\r\n } //end td creation\r\n \r\n function drawAddRow () {\r\n var form = thisTable.document.createElement('form');\r\n var but = thisTable.document.createElement('input');\r\n form.setAttribute('textAlign','right');\r\n but.setAttribute('type','button');\r\n but.setAttribute('id','addRowButton');\r\n but.addEventListener('click',addRow,true);\r\n but.setAttribute('value','+');\r\n form.appendChild(but);\r\n thisTable.container.appendChild(form);\r\n }\r\n \r\n // use kb.sym for symbols\r\n // use kb.bnode for blank nodes\r\n // use kb.literal for literal nodes \r\n function addRow () {\r\n var td; var tr = thisTable.document.createElement('tr');\r\n var t = thisTable.document.getElementById('tabulated_data');\r\n // create the td nodes for the new row\r\n // for each td node add the object variable like ?v0\r\n for (var i=0; i<numCols; i++) {\r\n if (symbolRC (1, i)) {\r\n td = createSymbolTD();\r\n td.v = qps[i].object;\r\n tabulator.log.msg('FOR COLUMN '+i+' v IS '+td.v);\r\n }\r\n else if (literalRC(1, i)) {\r\n td = createLiteralTD(); \r\n td.v = qps[i].object\r\n tabulator.log.msg('FOR COLUMN '+i+' v IS '+td.v);\r\n }\r\n else if (bnodeRC(1, i)) {\r\n td = createBNodeTD();\r\n td.v = qps[i].object\r\n tabulator.log.msg('FOR COLUMN '+i+' v IS '+td.v);\r\n }\r\n else {tabulator.log.warn('addRow problem')} \r\n tr.appendChild(td);\r\n }\r\n t.appendChild(tr);\r\n // highlight the td in the first column of the new row\r\n numRows = t.childNodes.length;\r\n clearSelected(selTD);\r\n newRow = numRows-1;\r\n newCol = 0;\r\n selTD = getTDNode(newRow, newCol); // first td of the row\r\n setSelected(selTD);\r\n // clone the qps array and attach a pointer to the clone on the first td of the row\r\n tabulator.log.msg('CREATING A CLONE OF QPS: ' + qps);\r\n var qpsClone = [];\r\n for (var i = 0; i<qps.length; i++) {\r\n var stat = qps[i];\r\n var newStat = new tabulator.rdf.Statement(stat.subject, stat.predicate, stat.object, stat.why);\r\n qpsClone[i] = newStat;\r\n }\r\n selTD.qpsClone = qpsClone; // remember that right now selTD is the first td of the row, qpsClone is not a 100% clone\r\n } //addRow\r\n \r\n function saveAddRowText(newText) {\r\n var td = selTD; // need to use this in case the user switches to a new TD in the middle of the autosuggest process\r\n td.editable=false;\r\n var type = td.getAttribute('type');\r\n // get the qps which is stored on the first cell of the row\r\n var qpsc = getTDNode(getRowIndex(td), 0).qpsClone;\r\n var row = getRowIndex(td);\r\n \r\n function validate() { // make sure the user has made a selection\r\n for (var i = 0; i<autoCompArray.length; i++) {\r\n if (newText == autoCompArray[i]) {\r\n return true;\r\n } \r\n }\r\n return false;\r\n }\r\n if (validate() == false && type == 'sym') {\r\n alert('Please make a selection');\r\n td.innerHTML = '---'; clearSelected(td); setSelected(selTD);\r\n return;\r\n }\r\n \r\n function getMatchingSym(text) {\r\n for (var i=0; i<autoCompArray.length; i++) {\r\n if (newText==autoCompArray[i]) {\r\n return entryArray[i][1];\r\n }\r\n }\r\n tabulator.log.warn('no matching sym');\r\n }\r\n \r\n var rowNum = getRowIndex(td);\r\n // fill in the query pattern based on the newText\r\n for (var i = 0; i<numCols; i++) {\r\n tabulator.log.msg('FILLING IN VARIABLE: ' + td.v);\r\n tabulator.log.msg('CURRENT STATEMENT IS: ' + qpsc[i]);\r\n if (qpsc[i].subject === td.v) { // subj is a variable\r\n if (type == 'sym') {qpsc[i].subject = getMatchingSym(newText);}\r\n if (type == 'lit') {qpsc[i].subject = kb.literal(newText, '');}\r\n if (type == 'bnode') {qpsc[i].subject = kb.bnode();}\r\n tabulator.log.msg('NEW QPSC IS: ' + qpsc);\r\n }\r\n if (qpsc[i].object === td.v) { // obj is a variable\r\n // TODO: DOUBLE QUERY PROBLEM IS PROBABLY HERE\r\n if (type == 'sym') {qpsc[i].object = getMatchingSym(newText);}\r\n if (type == 'lit') {qpsc[i].object = kb.literal(newText, '');}\r\n if (type == 'bnode') {qpsc[i].object = kb.bnode();}\r\n tabulator.log.msg('NEW QPSC IS: ' + qpsc);\r\n }\r\n }\r\n \r\n // check if all the variables in the query pattern have been filled out\r\n var qpscComplete = true; \r\n for (var i = 0; i<numCols; i++) {\r\n if (qpsc[i].subject.toString()[0]=='?') {qpscComplete = false;}\r\n if (qpsc[i].object.toString()[0]=='?') {qpscComplete = false;}\r\n }\r\n \r\n // if all the variables in the query pattern have been filled out, then attach stat pointers to each node, add the stat to the store, and perform the sparql update\r\n if (qpscComplete == true) {\r\n tabulator.log.msg('qpsc has been filled out: ' + qpsc);\r\n for (var i = 0; i<numCols; i++) {\r\n tabulator.log.msg('looking for statement in store: ' + qpsc[i]);\r\n var st = kb.anyStatementMatching(qpsc[i].subject, qpsc[i].predicate, qpsc[i].object); // existing statement for symbols\r\n if (!st) { // brand new statement for literals\r\n tabulator.log.msg('statement not found, making new statement');\r\n var why = qpsc[0].subject;\r\n st = new tabulator.rdf.Statement(qpsc[i].subject, qpsc[i].predicate, qpsc[i].object, why);\r\n //kb.add(st.subject, st.predicate, st.object, st.why);\r\n }\r\n var td = getTDNode(row, i);\r\n td.stat = st; \r\n \r\n // sparql update; for each cell in the completed row, send the value of the stat pointer\r\n tabulator.log.msg('sparql update with stat: ' + td.stat);\r\n if (tabulator.isExtension) {sparqlUpdate = sparql}\r\n else {sparqlUpdate = new sparql(kb)}\r\n // TODO: DEFINE ERROR CALLBACK\r\n sparqlUpdate.insert_statement(td.stat, function(uri,success,error_body) {\r\n if (success) {\r\n tabulator.log.msg('sparql update success');\r\n var newStatement = kb.add(td.stat.subject, td.stat.predicate, td.stat.object, td.stat.why);\r\n td.stat = newStatement;\r\n tabulator.log.msg('sparql update with '+newStatement);\r\n } \r\n });\r\n }\r\n }\r\n } // saveAddRowText\r\n\r\n /******************************************************\r\n Autosuggest box\r\n *******************************************************/\r\n // mostly copied from http://gadgetopia.com/post/3773\r\n function autoSuggest(elem, suggestions)\r\n {\r\n //Arrow to store a subset of eligible suggestions that match the user's input\r\n var eligible = new Array();\r\n //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted.\r\n var highlighted = -1;\r\n //A div to use to create the dropdown.\r\n var div = document.getElementById(\"autosuggest\");\r\n //Do you want to remember what keycode means what? Me neither.\r\n var TAB = 9;\r\n var ESC = 27;\r\n var KEYUP = 38;\r\n var KEYDN = 40;\r\n var ENTER = 13;\r\n\r\n /********************************************************\r\n onkeyup event handler for the input elem.\r\n Enter key = use the highlighted suggestion, if there is one.\r\n Esc key = get rid of the autosuggest dropdown\r\n Up/down arrows = Move the highlight up and down in the suggestions.\r\n ********************************************************/\r\n elem.onkeyup = function(ev)\r\n {\r\n var key = getKeyCode(ev);\r\n\r\n switch(key)\r\n {\r\n case ENTER:\r\n useSuggestion();\r\n hideDiv();\r\n break;\r\n\r\n case ESC:\r\n hideDiv();\r\n break;\r\n\r\n case KEYUP:\r\n if (highlighted > 0)\r\n {\r\n highlighted--;\r\n }\r\n changeHighlight(key);\r\n break;\r\n\r\n case KEYDN:\r\n if (highlighted < (eligible.length - 1))\r\n {\r\n highlighted++;\r\n }\r\n changeHighlight(key);\r\n \r\n case 16: break;\r\n\r\n default:\r\n if (elem.value.length > 0) {\r\n getEligible();\r\n createDiv();\r\n positionDiv();\r\n showDiv();\r\n }\r\n else {\r\n hideDiv();\r\n }\r\n }\r\n };\r\n\r\n /********************************************************\r\n Insert the highlighted suggestion into the input box, and \r\n remove the suggestion dropdown.\r\n ********************************************************/\r\n useSuggestion = function() \r\n { // This is where I can move the onblur stuff\r\n if (highlighted > -1) {\r\n elem.value = eligible[highlighted];\r\n hideDiv();\r\n \r\n setTimeout(\"document.getElementById('\" + elem.id + \"').focus()\",0);\r\n }\r\n };\r\n\r\n /********************************************************\r\n Display the dropdown. Pretty straightforward.\r\n ********************************************************/\r\n showDiv = function()\r\n {\r\n div.style.display = 'block';\r\n };\r\n\r\n /********************************************************\r\n Hide the dropdown and clear any highlight.\r\n ********************************************************/\r\n hideDiv = function()\r\n {\r\n div.style.display = 'none';\r\n highlighted = -1;\r\n };\r\n\r\n /********************************************************\r\n Modify the HTML in the dropdown to move the highlight.\r\n ********************************************************/\r\n changeHighlight = function()\r\n {\r\n var lis = div.getElementsByTagName('LI');\r\n for (i in lis) {\r\n var li = lis[i];\r\n if (highlighted == i) {\r\n li.className = \"selected\";\r\n elem.value = li.firstChild.innerHTML;\r\n }\r\n else {\r\n if (!li) return; // fixes a bug involving \"li has no properties\"\r\n li.className = \"\";\r\n }\r\n }\r\n };\r\n\r\n /********************************************************\r\n Position the dropdown div below the input text field.\r\n ********************************************************/\r\n positionDiv = function()\r\n {\r\n var el = elem;\r\n var x = 0;\r\n var y = el.offsetHeight;\r\n\r\n //Walk up the DOM and add up all of the offset positions.\r\n while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') {\r\n x += el.offsetLeft;\r\n y += el.offsetTop;\r\n el = el.offsetParent;\r\n }\r\n\r\n x += el.offsetLeft;\r\n y += el.offsetTop;\r\n\r\n div.style.left = x + 'px';\r\n div.style.top = y + 'px';\r\n };\r\n\r\n /********************************************************\r\n Build the HTML for the dropdown div\r\n ********************************************************/\r\n createDiv = function()\r\n {\r\n var ul = document.createElement('ul');\r\n\r\n //Create an array of LI's for the words.\r\n for (i in eligible) {\r\n var word = eligible[i];\r\n\r\n var li = document.createElement('li');\r\n var a = document.createElement('a');\r\n a.href=\"javascript:false\";\r\n a.innerHTML = word;\r\n li.appendChild(a);\r\n\r\n if (highlighted == i) {\r\n li.className = \"selected\";\r\n }\r\n\r\n ul.appendChild(li);\r\n }\r\n\r\n div.replaceChild(ul,div.childNodes[0]);\r\n\r\n /********************************************************\r\n mouseover handler for the dropdown ul\r\n move the highlighted suggestion with the mouse\r\n ********************************************************/\r\n ul.onmouseover = function(ev)\r\n {\r\n //Walk up from target until you find the LI.\r\n var target = getEventSource(ev);\r\n while (target.parentNode && target.tagName.toUpperCase() != 'LI')\r\n {\r\n target = target.parentNode;\r\n }\r\n \r\n var lis = div.getElementsByTagName('LI');\r\n \r\n\r\n for (i in lis)\r\n {\r\n var li = lis[i];\r\n if(li == target)\r\n {\r\n highlighted = i;\r\n break;\r\n }\r\n }\r\n changeHighlight();\r\n \r\n };\r\n\r\n /********************************************************\r\n click handler for the dropdown ul\r\n insert the clicked suggestion into the input\r\n ********************************************************/\r\n ul.onclick = function(ev)\r\n {\r\n \r\n useSuggestion();\r\n hideDiv();\r\n cancelEvent(ev);\r\n return false;\r\n };\r\n div.className=\"suggestion_list\";\r\n div.style.position = 'absolute';\r\n }; // createDiv\r\n\r\n /********************************************************\r\n determine which of the suggestions matches the input\r\n ********************************************************/\r\n getEligible = function()\r\n {\r\n eligible = new Array();\r\n for (i in suggestions) \r\n {\r\n var suggestion = suggestions[i];\r\n \r\n if(suggestion.toLowerCase().indexOf(elem.value.toLowerCase()) == \"0\")\r\n {\r\n eligible[eligible.length]=suggestion;\r\n }\r\n }\r\n };\r\n \r\n getKeyCode = function(ev) {\r\n if(ev) { return ev.keyCode;}\r\n };\r\n\r\n getEventSource = function(ev) {\r\n if(ev) { return ev.target; }\r\n };\r\n\r\n cancelEvent = function(ev) {\r\n if(ev) { ev.preventDefault(); ev.stopPropagation(); }\r\n }\r\n } // autosuggest\r\n \r\n //document.write('<div id=\"autosuggest\"><ul></ul></div>');\r\n var div = document.createElement('div');\r\n div.setAttribute('id','autosuggest');\r\n document.body.appendChild(div);\r\n div.appendChild(document.createElement('ul'));\r\n} // tableView", "function crearTablaPuertasValoresPreliminar(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE puertas_valores_preliminar (k_codusuario,k_codinspeccion,k_coditem_preli,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores preliminares...Espere\");\n console.log('transaction creada ok');\n });\n}", "function crearTablaAscensorValoresFoso(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_foso (k_codusuario,k_codinspeccion,k_coditem,n_calificacion,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores foso...Espere\");\n console.log('transaction creada ok');\n });\n}", "function getCreateTableQuery(table) {\n\n curModel = model[table]\n curFields = curModel.fields\n curPrimaryKey = curModel.primaryKey\n curUnique = curModel.unique\n\n fieldsArr = []\n if (curPrimaryKey && curPrimaryKey == \"id\") fieldsArr.push(\"id INT NOT NULL AUTO_INCREMENT\")\n for (field in curFields) {\n if (field != \"id\") {\n type = curFields[field]\n sqlType = sqlTypes[type]\n curFieldStr = `${field} ${sqlType}`\n fieldsArr.push(curFieldStr)\n }\n }\n fieldsArr.push(\"createdAt datetime\")\n fieldsArr.push(\"updatedAt datetime\")\n if (curPrimaryKey) fieldsArr.push(`PRIMARY KEY (${curPrimaryKey})`)\n else if (curUnique) fieldsArr.push(`UNIQUE (${curUnique.join()})`)\n fieldsStr = fieldsArr.join(\", \")\n\n query = `CREATE TABLE ${table} (${fieldsStr});`\n return(query)\n}", "function crearTablaEscalerasValoresDefectos(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE escaleras_valores_defectos (k_codusuario,k_codinspeccion,k_coditem,n_calificacion,v_calificacion,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores defectos...Espere\");\n console.log('transaction creada ok');\n });\n}", "function GenerateTables(tx)\n {\n console.log(\"GENERATING DATAGBASE TABLES\")\n// tx.executeSql(\"DROP TABLE goals\", [], onSuccess, onError);\n\n tx.executeSql(\"CREATE TABLE IF NOT EXISTS goals(\"+\n \"ID INTEGER PRIMARY KEY ASC,\"+\n \"type TEXT,\"+\n \"currentMoney money,\"+\n \"goalMoney money,\"+\n \"startDate long,\"+\n \"endDate long,\"+\n \"complete bit,\"+\n \"points int,\"+\n \"priority int,\"+\n \"progress int,\"+\n \"standing int,\"+\n \"name TEXT)\"\n , [], onSuccess, onError);\n\n tx.executeSql(\"CREATE TABLE IF NOT EXISTS pets(\"+\n \"ID INTEGER PRIMARY KEY ASC,\"+\n \"type TEXT,\"+\n \"currentPoints int,\"+\n \"finalPoints int,\"+\n \"expression text,\"+\n \"skincolor text,\"+\n \"name TEXT)\"\n , [], onSuccess, onError);\n\n tx.executeSql(\"DROP TABLE transactionhistory\", [], onSuccess, onError);\n tx.executeSql(\"CREATE TABLE IF NOT EXISTS transactionhistory(\"+\n \"amount money,\"+\n \"date long,\"+\n \"name TEXT, \"+\n \"CONSTRAINT pk_TransHist PRIMARY KEY (amount, date, name))\"\n , [], onSuccess, onError);\n\n\n tx.executeSql(\"CREATE TABLE IF NOT EXISTS badges(\"+\n \"ID INTEGER PRIMARY KEY,\"+\n \"name text UNIQUE,\"+\n \"date long)\"\n , [], onSuccess, onError);\n\n\n // tx.executeSql(\"DROP TABLE itemmap\", [], onSuccess, onError);\n \n tx.executeSql(\"CREATE TABLE IF NOT EXISTS transactionmap(\"+\n \"item TEXT NOT NULL,\"+\n \"idGoal int NOT NULL,\"+\n \"CONSTRAINT pk_ItemMap PRIMARY KEY (item, idGoal))\"\n , [], onSuccess, onError);\n \n tx.executeSql(\"CREATE TABLE IF NOT EXISTS uncategorizedtransaction(\"+\n \"amount money,\"+\n \"date long,\"+\n \"name TEXT)\"\n , [], onSuccess, onError);\n\n // tx.executeSql(\"DELETE FROM goals\");\n\n InsertGoal(tx, makeGoal(\"Debt\", 15, 100, new Date('2016-10-20').valueOf(), new Date('2016-10-27').valueOf(), 0, \"card Y\", 0));\n InsertGoal(tx, makeGoal(\"Savings\", 114, 200, new Date('2016-10-20').valueOf(), new Date('2016-11-20').valueOf(), 0, \"card Z\", 1));\n InsertGoal(tx, makeGoal(\"Spending\", 611, 1000, new Date('2016-10-20').valueOf(), new Date('2016-10-27').valueOf(), 0, \"card X\", 2));\n }", "function insSQL(){\n var sql = 'INSERT INTO pim_transfers(';\n sql += 'user_id, manufacturer_id, from_id, to_id, products, status_id, delivery_date, type_id, notes)VALUES(';\n sql += '$1::integer, $2::integer, $3::integer, $4::integer, $5::json, $6::integer,';\n sql += ' $7::timestamp without time zone, $8::integer, $9::json) RETURNING id;';\n return sql;\n}", "function constructStatement(){\n\n }", "function setupTable(tx){\n console.log(\"before execute sql for studentProfile Database\");\n tx.executeSql(\"CREATE TABLE IF NOT EXISTS students(id INTEGER PRIMARY KEY,name,image)\");\n console.log(\"Created table if not existed for studentProfile Database\");\n console.log(\"after execute sql in studentProfile Database\");\n}", "function TableCompiler_MySQL() {\n\t _tablecompiler2.default.apply(this, arguments);\n\t}", "function populateDB(tx) {\r\n \r\n var sql = \"CREATE TABLE IF NOT EXISTS Client ( \"\r\n + \"cin INTEGER PRIMARY KEY, \"\r\n + \"prenom VARCHAR(50), \" + \"nom VARCHAR(50), \"\r\n + \"age INTEGER,\" + \"telephone INTEGER,\"+ \"adress VARCHAR(50),\" + \"code INTEGER, \" + \"email VARCHAR(50), \" + \"login VARCHAR(50),\" + \"password VARCHAR(200))\";\r\n tx.executeSql(sql);\r\n }", "function createTableObject(param) {\n\n\tvar args = {};\n\tvar IsGrid = (param.objType==\"GRID\")? true : false;\n\t\n //==== Create Object : readonly 일 경우는 editable을 undefined로 설정한다 (참고 QDM.6320)\n //editable: (param.readonly) ? undefined : { multi: true, bind: \"select\", focus: \"input_val1\", validate: true },\n if (param.objId == \"grdData_Sub\") {\n // Check Input Code\n var sInputCode = gw_com_api.getValue(\"frmData_Main\", 1, \"input_cd\", false);\n if (sInputCode == \"\") sInputCode = \"CHECK\";\n if (sInputCode != v_global.logic.input_cd) v_global.logic.input_cd = sInputCode;\n\n\t //==== Clear Object\n var argsClear = { target: [{ type: param.objType, id: param.objId}] };\n gw_com_module.objClear(argsClear);\n\n // Get dynamic column's definition\n var sColName, sColTitle, sColEdit, sColRspan = \"0\";\n var dynaCols = [];\tvar Cols = [];\n\n // 동적 Columns 정의\n for ( var i = 1; i <= gw_com_api.getRowCount(\"grdData_Temp1\"); i++ ) {\n var RowData = gw_com_api.getRowData( \"grdData_Temp1\", i );\n var nColSize = gw_com_api.getValue(\"grdData_Temp1\", i, \"col_size\", true);\n var sInputType = gw_com_api.getValue(\"grdData_Temp1\", i, \"input_tp\", true);\n var sEditCode = gw_com_api.getValue(\"grdData_Temp1\", i, \"code_nm\", true);\n var sEditYn = gw_com_api.getValue( \"grdData_Temp1\", i, \"edit_yn\", true );\n var sRowSpan = gw_com_api.getValue( \"grdData_Temp1\", i, \"rspan_yn\", true );\n var sAlign = \"cneter\"; //gw_com_api.getValue( \"grdData_Temp1\", i, \"col_align\", true );\n var tempCol = {\n header: gw_com_api.getValue(\"grdData_Temp1\", i, \"col_title\", true), \n name: gw_com_api.getValue(\"grdData_Temp1\", i, \"col_nm\", true), \n width: nColSize * 10, align: sAlign\n };\n\n if (sInputType == \"select\") {\n \ttempCol.format = { type: \"select\", data: { memory: sEditCode} };\n \ttempCol.editable = { type: sInputType, readonly: (sEditYn==\"1\")? false : true\n \t\t\t\t\t, data: { memory: sEditCode, unshift: [ { title: \"-\", value: \"\" } ] } };\n }\n else if (sInputType == \"file\") {\n\t\t\t\ttempCol.editable = { type: \"text\", readonly: true };\n }\n else if (sInputType == \"button\") {\n \ttempCol.format = { type: \"link\", value: \"다운로드\" };\n }\n else {\n\t\t\t\ttempCol.editable = { type: sInputType, readonly: (sEditYn==\"0\")? false : true };\n \t}\n \t\n dynaCols.push( tempCol );\n }\n\n \tvar checkCols = [\n\t\t\t{ header: \"Action\", name: \"input_val1\", width: 220, align: \"left\", editable: { type: \"text\" } },\n { header: \"Description\", name: \"input_val2\", width: 440, align: \"left\", editable: { type: \"text\" } },\n { header: \"Check\", name: \"input_val3\", width: 120, align: \"center\",\n format: { type: \"select\", data: { memory: \"InputCheck\"} },\n\t\t\t\teditable: { type: \"select\", data: { memory: \"InputCheck\", unshift: [ { title: \"-\", value: \"\" } ] } }\n }\n \t];\n \t// 동적 Columns 추가\n if(sInputCode > \" \")\n for (var i = 0; i < dynaCols.length; i++) Cols.push( dynaCols[i] );\n else\n for (var i = 0; i < checkCols.length; i++) Cols.push( checkCols[i] );\n\t\t\n\t\t// 뒤쪽 고정 컬럼 추가\n var lastCols = [\n { name: \"work_cd\", hidden: true, editable: { type: \"hidden\"} },\n { name: \"check_seq\", hidden: true, editable: { type: \"hidden\" } }\n \t];\n \tfor (var i = 0; i < lastCols.length; i++) Cols.push( lastCols[i] );\n\n\t\t// recreate Grid\n args = { targetid: \"grdData_Sub\", query: \"w_mrp1420_S\", title: \"Check Sheet\",\n caption: true, height: \"100%\", pager: false, show: true, selectable: true, number: true,\n editable: (param.readonly) ? undefined : { multi: true, bind: \"select\", focus: \"input_val1\", validate: true },\n element: Cols\n };\n gw_com_module.gridCreate(args);\n\t}\n\telse { return; }\n\t\n //==== Set Events\n var args = { targetid: param.objId, event: \"itemdblclick\", handler: eventItemDblClick, grid: IsGrid };\n gw_com_module.eventBind(args);\n var args = { targetid: param.objId, event: \"itemkeyenter\", handler: eventItemDblClick, grid: IsGrid };\n gw_com_module.eventBind(args);\n var args = { targetid: param.objId, event: \"itemchanged\", handler: eventItemChanged, grid: IsGrid };\n gw_com_module.eventBind(args);\n \n\t//==== Resize Object & Form\n if (param.clear) {\n\t args = { target: [ { type: param.objType, id: param.objId, offset: 8 } ] };\n gw_com_module.objResize(args);\n gw_com_module.informSize();\n }\n}" ]
[ "0.62008107", "0.6133881", "0.61106783", "0.6072589", "0.59852064", "0.5963423", "0.5882691", "0.5819846", "0.57646453", "0.5763504", "0.5757041", "0.57259274", "0.57155514", "0.56967837", "0.56907946", "0.5658477", "0.56051797", "0.56046075", "0.55897003", "0.5564893", "0.55363023", "0.55323917", "0.5526863", "0.5508248", "0.55032665", "0.54893774", "0.54817384", "0.5473421", "0.54722804", "0.54514164", "0.545014", "0.5448704", "0.5445451", "0.5440772", "0.54170316", "0.54110146", "0.54092747", "0.5405866", "0.5403832", "0.54003894", "0.5398658", "0.53943884", "0.538428", "0.5365814", "0.53568995", "0.53397804", "0.5332954", "0.53290063", "0.532885", "0.53280056", "0.53274333", "0.5326799", "0.5326362", "0.5325563", "0.53190964", "0.5311218", "0.530649", "0.5305789", "0.53036946", "0.53021586", "0.52945256", "0.5294461", "0.52924675", "0.5288195", "0.52857006", "0.5284906", "0.52848846", "0.5272391", "0.525847", "0.5256012", "0.5255823", "0.525353", "0.52485347", "0.5243649", "0.5243467", "0.5242607", "0.5241178", "0.52284646", "0.5225625", "0.52190995", "0.52150244", "0.5205258", "0.52002674", "0.5199619", "0.51920015", "0.5191505", "0.5190373", "0.5188053", "0.51845574", "0.51763296", "0.51746035", "0.5172126", "0.51658523", "0.51639426", "0.5162032", "0.5161421", "0.5159452", "0.51570034", "0.51534593", "0.5152066", "0.51495624" ]
0.0
-1
Contains a set of hooks to be called when various operations are performed on a hookable array's elements
function ElementHookCollection() { /** * @type {Function[]} */ this.onElementReferenceSetCallbacks = []; /** * @type {Function[]} */ this.onElementValueSetCallbacks = []; /** * @type {Function[]} */ this.onElementUnsetCallbacks = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hooks(){return hookCallback.apply(null,arguments)}", "function hooks(){return hookCallback.apply(null,arguments)}", "function applyHook (arr, arg1, arg2, arg3, arg4, arg5) {\n arr.forEach(function (fn) {\n fn(arg1, arg2, arg3, arg4, arg5)\n })\n}", "function callHooks(currentView,arr){for(var i=0;i<arr.length;i+=2){arr[i+1].call(currentView[arr[i]]);}}", "hookAll() {\r\n let hooks = [];\r\n for (let [group, temps] of this.hookTemplates) {\r\n for (let template of temps)\r\n hooks.push(this.hookTemplate(template));\r\n }\r\n return hooks;\r\n }", "function callHooks(currentView, arr) {\n for (var i = 0; i < arr.length; i += 2) {\n arr[i + 1].call(currentView[arr[i]]);\n }\n}", "function callHooks(currentView, arr) {\n for (var i = 0; i < arr.length; i += 2) {\n arr[i + 1].call(currentView[arr[i]]);\n }\n}", "function callHooks(currentView, arr) {\n for (var i = 0; i < arr.length; i += 2) {\n arr[i + 1].call(currentView[arr[i]]);\n }\n}", "function MHook(){\n\tthis.hooks = []\n\t\n\t//methods\n\tthis.add = function(hook){\n\t\tthis.hooks.push(hook)\n\t}\n\t\n\tthis.rem = function(hook){\n\t\tfor(i in this.hooks)\n\t\t\tif(this.hooks[i] == hook){\n\t\t\t\tthis.hooks.splice(i,1);\n\t\t\t\tbreak;\n\t\t\t}\n\t}\n\t\n\tthis.execute = function(/*, 0..n args */){\n\t\tfor(i in this.hooks){\n\t\t\tthis.hooks[i].apply(this,arguments);\n\t\t}\n\t}\n}", "attachHooks(hooks){\n if(!hooks){ return false}\n if([] instanceof Array){\n _hooks.concat(hooks)\n }else {\n _hooks.push(hooks)\n }\n return true;\n }", "function _applyHookFunctions(collection) {\n if (hooksApplied) return; // already run\n\n hooksApplied = true;\n var colProto = Object.getPrototypeOf(collection);\n HOOKS_KEYS.forEach(function (key) {\n HOOKS_WHEN.map(function (when) {\n var fnName = when + ucfirst(key);\n\n colProto[fnName] = function (fun, parallel) {\n return this.addHook(when, key, fun, parallel);\n };\n });\n });\n}", "_initHooks() {\n for (let hook in this.opts.hooks) {\n this.bind(hook, this.opts.hooks[hook]);\n }\n }", "merge(hooks) {\n hooks.hooks.before.forEach((actionHooks, action) => {\n actionHooks.forEach((handler) => {\n this.addResolvedHandler('before', action, handler);\n });\n });\n hooks.hooks.after.forEach((actionHooks, action) => {\n actionHooks.forEach((handler) => {\n this.addResolvedHandler('after', action, handler);\n });\n });\n }", "function hooks(vNode, patch, index) {\n if (isVNode(vNode)) {\n if (vNode.hooks) {\n patch[index] = new VPatch(VPatch.PROPS, vNode.hooks, vNode.hooks)\n }\n\n if (vNode.descendantHooks) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n hooks(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n }\n }\n}", "function hooks(vNode, patch, index) {\n if (isVNode(vNode)) {\n if (vNode.hooks) {\n patch[index] = new VPatch(VPatch.PROPS, vNode.hooks, vNode.hooks)\n }\n\n if (vNode.descendantHooks) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n hooks(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n }\n }\n}", "function hooks(vNode, patch, index) {\n if (isVNode(vNode)) {\n if (vNode.hooks) {\n patch[index] = new VPatch(VPatch.PROPS, vNode.hooks, vNode.hooks)\n }\n\n if (vNode.descendantHooks) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n hooks(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n }\n }\n}", "function hooks(vNode, patch, index) {\n if (isVNode(vNode)) {\n if (vNode.hooks) {\n patch[index] = new VPatch(VPatch.PROPS, vNode.hooks, vNode.hooks)\n }\n\n if (vNode.descendantHooks) {\n var children = vNode.children\n var len = children.length\n for (var i = 0; i < len; i++) {\n var child = children[i]\n index += 1\n\n hooks(child, patch, index)\n\n if (isVNode(child) && child.count) {\n index += child.count\n }\n }\n }\n }\n}", "callListeners() {\r\n const listenersCopy = [...this.listeners];\r\n listenersCopy.forEach(listener => {\r\n try {\r\n listener.call();\r\n }\r\n catch (e) {\r\n hookErrorHandler_1.handleHookError(e, this, listener, \"onCall\");\r\n }\r\n });\r\n }", "function beforeHooks(cb) {\n var hooks;\n\n if (Array.isArray(fn.before) && fn.before.length > 0) {\n hooks = fn.before.slice();\n function iter() {\n var hook = hooks.pop();\n hook.call(self, args[0], function (err, data) {\n if (err) {\n return cb(err);\n }\n args[0] = data;\n if (hooks.length > 0) {\n iter();\n }\n else {\n cb(null);\n }\n });\n }\n iter();\n }\n else {\n return cb(null);\n }\n }", "function runHookFunctions (i, hooksList, data, doneAll){\n hooksList[i](data, function afterRunHookFN (err){\n if (err) return doneAll(err);\n // next hook indice\n i++;\n\n if (i < hooksList.length) {\n // run hook if have hooks\n runHookFunctions(i, hooksList, data, doneAll);\n } else {\n // done all\n doneAll();\n }\n });\n}", "registerHooks() {\n this.addHook('afterScrollHorizontally', () => this.refreshDimensions());\n this.addHook('afterScrollVertically', () => this.refreshDimensions());\n this.addHook('afterColumnResize', () => this.refreshDimensions());\n this.addHook('afterRowResize', () => this.refreshDimensions());\n }", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n var startIndex = currentNodeIndex !== undefined ?\n (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :\n 0;\n var nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n var lastNodeIndexFound = 0;\n for (var i = startIndex; i < arr.length; i++) {\n var hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n }\n else {\n var isInitHook = arr[i] < 0;\n if (isInitHook)\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */;\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] =\n (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */) + i +\n 2;\n }\n i++;\n }\n }\n}", "bindHooks() {\n //\n }", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode && assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n var startIndex = currentNodeIndex !== undefined ? currentView[PREORDER_HOOK_FLAGS] & 65535\n /* IndexOfTheNextPreOrderHookMaskMask */\n : 0;\n var nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n var lastNodeIndexFound = 0;\n\n for (var i = startIndex; i < arr.length; i++) {\n var hook = arr[i + 1];\n\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n } else {\n var isInitHook = arr[i] < 0;\n if (isInitHook) currentView[PREORDER_HOOK_FLAGS] += 65536\n /* NumberOfInitHooksCalledIncrementer */\n ;\n\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760\n /* NumberOfInitHooksCalledMask */\n ) + i + 2;\n }\n\n i++;\n }\n }\n}", "_bindUtilHooks() {\n // initial events: when an update button is clicked\n this.cartChangeHooks.forEach((hook) => {\n utils.hooks.on(hook, (event) => {\n this._showOverlay();\n });\n });\n\n // remote events: when the proper response is sent\n this.cartChangeRemoteHooks.forEach((hook) => {\n utils.hooks.on(hook, (event) => {\n this._refreshcartPreview();\n });\n })\n }", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode && assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n var startIndex = currentNodeIndex !== undefined ? currentView[PREORDER_HOOK_FLAGS] & 65535\n /* IndexOfTheNextPreOrderHookMaskMask */\n : 0;\n var nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n var max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n\n var lastNodeIndexFound = 0;\n\n for (var i = startIndex; i < max; i++) {\n var hook = arr[i + 1];\n\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n } else {\n var isInitHook = arr[i] < 0;\n if (isInitHook) currentView[PREORDER_HOOK_FLAGS] += 65536\n /* NumberOfInitHooksCalledIncrementer */\n ;\n\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760\n /* NumberOfInitHooksCalledMask */\n ) + i + 2;\n }\n\n i++;\n }\n }\n }", "function isAllHooksCalled (type, meta) {}", "function _addHook( type, hook, callback, priority, context ) {\n var hookObject = {\n callback : callback,\n priority : priority,\n context : context\n };\n\n // Utilize 'prop itself' : http://jsperf.com/hasownproperty-vs-in-vs-undefined/19\n var hooks = STORAGE[ type ][ hook ];\n if( hooks ) {\n hooks.push( hookObject );\n hooks = _hookInsertSort( hooks );\n }\n else {\n hooks = [ hookObject ];\n }\n\n STORAGE[ type ][ hook ] = hooks;\n }", "registerHooks() {\n this.addLocalHook('click', () => this.onClick());\n this.addLocalHook('keyup', event => this.onKeyup(event));\n }", "addHook (hook) {\n this.hooks.push(hook)\n }", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode &&\n assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ?\n (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :\n 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n }\n else {\n const isInitHook = arr[i] < 0;\n if (isInitHook)\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */;\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] =\n (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */) + i +\n 2;\n }\n i++;\n }\n }\n}", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode &&\n assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ?\n (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :\n 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n }\n else {\n const isInitHook = arr[i] < 0;\n if (isInitHook)\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */;\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] =\n (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */) + i +\n 2;\n }\n i++;\n }\n }\n}", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode &&\n assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ?\n (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :\n 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n }\n else {\n const isInitHook = arr[i] < 0;\n if (isInitHook)\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */;\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] =\n (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */) + i +\n 2;\n }\n i++;\n }\n }\n}", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode &&\n assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ?\n (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :\n 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n }\n else {\n const isInitHook = arr[i] < 0;\n if (isInitHook)\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */;\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] =\n (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */) + i +\n 2;\n }\n i++;\n }\n }\n}", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode &&\n assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ?\n (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :\n 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n }\n else {\n const isInitHook = arr[i] < 0;\n if (isInitHook)\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */;\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] =\n (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */) + i +\n 2;\n }\n i++;\n }\n }\n}", "function callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode &&\n assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ?\n (currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */) :\n 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n }\n else {\n const isInitHook = arr[i] < 0;\n if (isInitHook)\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */;\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] =\n (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */) + i +\n 2;\n }\n i++;\n }\n }\n}", "hook1() {}", "addSourceHotHooks() {\n this.sourceHooks = {\n afterLoadData: () => this.onAfterSourceLoadData(),\n afterChange: changes => this.onAfterSourceChange(changes),\n afterColumnSort: () => this.onAfterColumnSort()\n };\n\n this.hotSource.instance.addHook('afterLoadData', this.sourceHooks.afterLoadData);\n this.hotSource.instance.addHook('afterChange', this.sourceHooks.afterChange);\n this.hotSource.instance.addHook('afterColumnSort', this.sourceHooks.afterColumnSort);\n }", "registerHooks() {\n this.getMultipleSelectElement().addLocalHook('keydown', event => this.onInputKeyDown(event));\n }", "function wrapperCallbacksFakeArrayResetHistory() {\n Object.keys(wrapperCallbacksFakeArray).forEach((key) =>\n wrapperCallbacksFakeArray[key].forEach((func) => func.resetHistory()),\n );\n }", "function _addHook(type, hook, callback, priority, context) {\n var hookObject = {\n callback: callback,\n priority: priority,\n context: context\n }; // Utilize 'prop itself' : http://jsperf.com/hasownproperty-vs-in-vs-undefined/19\n\n var hooks = STORAGE[type][hook];\n\n if (hooks) {\n // TEMP FIX BUG\n var hasSameCallback = false;\n jQuery.each(hooks, function () {\n if (this.callback === callback) {\n hasSameCallback = true;\n return false;\n }\n });\n\n if (hasSameCallback) {\n return;\n } // END TEMP FIX BUG\n\n\n hooks.push(hookObject);\n hooks = _hookInsertSort(hooks);\n } else {\n hooks = [hookObject];\n }\n\n STORAGE[type][hook] = hooks;\n }", "function getHookFunction(callable){\n return function applyOnResults(result, options){\n if(!result){\n return;\n }\n\n if(result.constructor == Array) {\n for (let i = 0; i < result.length; i++) {\n callable(result[i]);\n }\n } else {\n callable(result);\n }\n }\n}", "function getHooks(app, service, type, method, appLast = false) {\n const appHooks = app.__hooks[type][method] || [];\n const serviceHooks = service.__hooks[type][method] || [];\n if (appLast) {\n // Run hooks in the order of service -> app -> finally\n return serviceHooks.concat(appHooks);\n }\n return appHooks.concat(serviceHooks);\n}", "function hooks() {\n \"use strict\";\n}", "function hooked() {\n var result, origResult, tmp;\n\n // Get an array of arguments.\n var args = slice.call(arguments);\n\n // If passName option is specified, prepend prop to the args array,\n // passing it as the first argument to any specified hook functions.\n if (options.passName) {\n args.unshift(prop);\n }\n\n // If a pre-hook function was specified, invoke it in the current\n // context with the passed-in arguments, and store its result.\n if (options.pre) {\n result = options.pre.apply(this, args);\n }\n\n if (result instanceof HookerFilter) {\n // If the pre-hook returned hooker.filter(context, args), invoke the\n // original function with that context and arguments, and store its\n // result.\n origResult = result = orig.apply(result.context, result.args);\n } else if (result instanceof HookerPreempt) {\n // If the pre-hook returned hooker.preempt(value) just use the passed\n // value and don't execute the original function.\n origResult = result = result.value;\n } else {\n // Invoke the original function in the current context with the\n // passed-in arguments, and store its result.\n origResult = orig.apply(this, arguments);\n // If the pre-hook returned hooker.override(value), use the passed\n // value, otherwise use the original function's result.\n result = result instanceof HookerOverride ? result.value : origResult;\n }\n\n if (options.post) {\n // If a post-hook function was specified, invoke it in the current\n // context, passing in the result of the original function as the\n // first argument, followed by any passed-in arguments.\n tmp = options.post.apply(this, [origResult].concat(args));\n if (tmp instanceof HookerOverride) {\n // If the post-hook returned hooker.override(value), use the passed\n // value, otherwise use the previously computed result.\n result = tmp.value;\n }\n }\n\n // Unhook if the \"once\" option was specified.\n if (options.once) {\n exports.unhook(obj, prop);\n }\n\n // Return the result!\n return result;\n }", "function X(e,t){T[e]=T[e]||[],T[e].push(t),\"update\"===e.split(\".\")[0]&&f.forEach(function(e,t){Y(\"update\",t)})}", "function listenArrayEvents(array, listener) {\n\t\t\tif (array._chartjs) {\n\t\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: {\n\t\t\t\t\tlisteners: [listener]\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\tarrayEvents.forEach(function(key) {\n\t\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\t\tvar base = array[key];\n\t\n\t\t\t\tObject.defineProperty(array, key, {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tvalue: function() {\n\t\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\t\tvar res = base.apply(this, args);\n\t\n\t\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}", "function executeHooks(currentView,allHooks,checkHooks,checkNoChangesMode){if(checkNoChangesMode)return;var hooksToCall=currentView[FLAGS]&2/* FirstLViewPass */?allHooks:checkHooks;if(hooksToCall){callHooks(currentView,hooksToCall);}}", "function executeHooks(data, allHooks, checkHooks, creationMode) {\n var hooksToCall = creationMode ? allHooks : checkHooks;\n if (hooksToCall) {\n callHooks(data, hooksToCall);\n }\n}", "function beforeAllHooks(cb) {\n var hooks;\n if (Array.isArray(resource._before) && resource._before.length > 0) {\n hooks = resource._before.slice();\n function iter() {\n var hook = hooks.pop();\n hook = hook.bind({ resource: r.name, method: name });\n hook(args[0], function (err, data) {\n // possible issue related to losing scope with beforeAll() method\n // required if calling API wants to pass in a custom context with resource.foo.call({}, args, cb)\n // hook.call(self, args[0], function (err, data) {\n if (err) {\n return cb(err);\n }\n args[0] = data;\n if (hooks.length > 0) {\n iter();\n }\n else {\n cb(null);\n }\n });\n }\n iter();\n }\n else {\n return cb(null);\n }\n }", "function queueViewHooks(def, tView, i) {\n if (def.afterViewInit) {\n (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewInit);\n }\n if (def.afterViewChecked) {\n (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewChecked);\n (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, def.afterViewChecked);\n }\n}", "function queueViewHooks(def, tView, i) {\n if (def.afterViewInit) {\n (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewInit);\n }\n if (def.afterViewChecked) {\n (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewChecked);\n (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, def.afterViewChecked);\n }\n}", "function queueViewHooks(def, tView, i) {\n if (def.afterViewInit) {\n (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewInit);\n }\n if (def.afterViewChecked) {\n (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewChecked);\n (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, def.afterViewChecked);\n }\n}", "function processWordListChangedListeners() {\n\n var handlers = Object.keys(wordListChangedListeners);\n for (var j = 0; j < handlers.length; j++)\n wordListChangedListeners[handlers[j]]();\n}", "function queueViewHooks(def,tView,i){if(def.afterViewInit){(tView.viewHooks||(tView.viewHooks=[])).push(i,def.afterViewInit);}if(def.afterViewChecked){(tView.viewHooks||(tView.viewHooks=[])).push(i,def.afterViewChecked);(tView.viewCheckHooks||(tView.viewCheckHooks=[])).push(i,def.afterViewChecked);}}", "function enableEventHooks() {\n \n // event hooks are on spaces, but are defined in services. When a space or service is edited, the hook database would need to be re-generated for the space\n // when we use a database, the space would be looked up per request. then we would know its hooks.\n \n // for now we fake it * but at least we are faking it off the real metadata\n \n // foreach space\n \n for (var spacenum = 0; spacenum < spacemetadata.spaces.length; spacenum++) {\n var space = spacemetadata.spaces[spacenum];\n \n console.log(\"Space: \" + space.name);\n if (space.hasOwnProperty(\"services\")) {\n var spaceservices = space.services;\n spacemap[space.uuid] = new Array();\n lastspacemap[space.uuid] = new Array();\n \n for(var sidx = 0; sidx < spaceservices.length; sidx++) {\n var serviceno = objectFindByKey(spacemetadata.services, \"uuid\", spaceservices[sidx]);\n if (serviceno > -1 ) {\n var servicemeta = spacemetadata.services[serviceno];\n console.log(\" service: \" + servicemeta.name);\n if (servicemeta.hasOwnProperty(\"webservice\")) {\n // it's a web service that has a request field - go get THAT\n var webno = objectFindByKey(spacemetadata.webservices, \"uuid\", servicemeta.webservice);\n if (webno > -1) {\n var webmeta = spacemetadata.webservices[webno];\n \n // TBD: make fast lookup for webhook by service?\n \n console.log(\" has a webservice: \" + webmeta);\n if (servicemeta.hasOwnProperty(\"enterhook\")) {\n if (!enterhooks.hasOwnProperty(space.uuid)) {\n enterhooks[space.uuid] = new Array();\n }\n var spacerec = {method: hooknames[servicemeta.enterhook], request: webmeta.request};\n enterhooks[space.uuid].push(spacerec );\n } else {\n servicehookmap[servicemeta.endpoint] = webmeta;\n }\n }\n }\n }\n }\n }\n // enterhooks[\"f06ecb2f-de00-4ea6-a533-c46b217f96a2\"] = new Array();\n // enterhooks[\"f06ecb2f-de00-4ea6-a533-c46b217f96a2\"].push({method: hooknames[\"speak\"], request: {}} );\n \n }\n console.log(enterhooks);\n}", "function listenArrayEvents(array, listener) {\n if (array._chartjs) {\n array._chartjs.listeners.push(listener);\n return;\n }\n\n Object.defineProperty(array, '_chartjs', {\n configurable: true,\n enumerable: false,\n value: {\n listeners: [listener]\n }\n });\n\n arrayEvents.forEach(function (key) {\n var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n var base = array[key];\n\n Object.defineProperty(array, key, {\n configurable: true,\n enumerable: false,\n value: function () {\n var args = Array.prototype.slice.call(arguments);\n var res = base.apply(this, args);\n\n helpers.each(array._chartjs.listeners, function (object) {\n if (typeof object[method] === 'function') {\n object[method].apply(object, args);\n }\n });\n\n return res;\n }\n });\n });\n }", "function listenArrayEvents(array, listener) {\n if (array._chartjs) {\n array._chartjs.listeners.push(listener);\n return;\n }\n\n Object.defineProperty(array, '_chartjs', {\n configurable: true,\n enumerable: false,\n value: {\n listeners: [listener]\n }\n });\n\n arrayEvents.forEach(function (key) {\n var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n var base = array[key];\n\n Object.defineProperty(array, key, {\n configurable: true,\n enumerable: false,\n value: function () {\n var args = Array.prototype.slice.call(arguments);\n var res = base.apply(this, args);\n\n helpers.each(array._chartjs.listeners, function (object) {\n if (typeof object[method] === 'function') {\n object[method].apply(object, args);\n }\n });\n\n return res;\n }\n });\n });\n }", "function reOrder(hookPt, fnRef, order) {\r\n\tvar newPt = new Array(), match, i, j;\r\n\r\n\tif (!order || typeof order == 'undefined' || typeof order == 'number') return hookPt;\r\n\t\r\n\tif (typeof order=='function') {\r\n\t\tif (typeof fnRef=='object') {\r\n\t\t\tnewPt = newPt.concat(fnRef);\r\n\t\t} else {\r\n\t\t\tnewPt[newPt.length++]=fnRef;\r\n\t\t}\r\n\t\t\r\n\t\tfor (i = 0; i < hookPt.length; i++) {\r\n\t\t\tmatch = false;\r\n\t\t\tif (typeof fnRef == 'function' && hookPt[i] == fnRef) {\r\n\t\t\t\tcontinue;\r\n\t\t\t} else {\r\n\t\t\t\tfor(j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {\r\n\t\t\t\t\tmatch = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!match) newPt[newPt.length++] = hookPt[i];\r\n\t\t}\r\n\r\n\t\tnewPt[newPt.length++] = order;\r\n\r\n\t} else if (typeof order == 'object') {\r\n\t\tif (typeof fnRef == 'object') {\r\n\t\t\tnewPt = newPt.concat(fnRef);\r\n\t\t} else {\r\n\t\t\tnewPt[newPt.length++] = fnRef;\r\n\t\t}\r\n\t\t\r\n\t\tfor (j = 0; j < hookPt.length; j++) {\r\n\t\t\tmatch = false;\r\n\t\t\tif (typeof fnRef == 'function' && hookPt[j] == fnRef) {\r\n\t\t\t\tcontinue;\r\n\t\t\t} else {\r\n\t\t\t\tfor (i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {\r\n\t\t\t\t\tmatch = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!match) newPt[newPt.length++]=hookPt[j];\r\n\t\t}\r\n\r\n\t\tfor (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];\r\n\t\tnewPt.length = 0;\r\n\t\t\r\n\t\tfor (j = 0; j < hookPt.length; j++) {\r\n\t\t\tmatch = false;\r\n\t\t\tfor (i = 0; i < order.length; i++) {\r\n\t\t\t\tif (hookPt[j] == order[i]) {\r\n\t\t\t\t\tmatch = true;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (!match) newPt[newPt.length++] = hookPt[j];\r\n\t\t}\r\n\t\tnewPt = newPt.concat(order);\r\n\t}\r\n\r\n\thookPt = newPt;\r\n\r\n\treturn hookPt;\r\n}", "function ArrayUpdateHandler(entry, manipulator) {\n\n /**\n * Keeps a weak map cache of proxies attached to dom nodes so they die along with their attached node.\n * @type {WeakMap<Object, any>}\n */\n let proxyCache = new WeakMap();\n\n /**\n * Keeps a list of all the proxies created so they are not added back to the object or recreated in anyway.\n * @type {WeakMap<Object, any>}\n */\n let proxiesCreated = new WeakMap();\n\n /**\n * A trap for returning values from arrays or proxies of objects from the array.\n * @param target\n * @param name\n * @returns {*}\n */\n this.get = function (target, name) {\n if (typeof target[name] === 'function' || typeof target[name] !== 'object') {\n return target[name];\n }\n\n let node = entry.parent.children[name];\n if (!proxyCache.has(node)) {\n let proxy = new Proxy(target[name], new UpdateHandler(entry.variables, entry.manipulators, entry.parent.children[name]));\n proxyCache.set(node, proxy);\n proxiesCreated.set(proxy, target[name]);\n }\n return proxyCache.get(node);\n }\n\n /**\n * A trap for setting values into the array.\n * @param target\n * @param name\n * @param value\n * @returns {boolean}\n */\n this.set = function (target, name, value) {\n if(proxiesCreated.has(value)) {\n value = proxiesCreated.get(value);\n }\n target[name] = value;\n if (name === 'length') {\n for (let i = 0; i < entry.parent.children.length - value; i++) {\n entry.parent.removeChild(entry.parent.lastChild);\n }\n return true;\n }\n manipulator.set(name, target[name]);\n return true;\n }\n}", "function afterHooks(args, cb) {\n cb = cb || function noop(){};\n var hooks;\n if (Array.isArray(fn.after) && fn.after.length > 0) {\n hooks = fn.after.slice();\n function iter() {\n var hook = hooks.shift();\n hook(args[1], function (err, data) {\n if (err) {\n return cb(err);\n }\n args[1] = data;\n if (hooks.length > 0) {\n iter();\n }\n else {\n return cb(null, args);\n }\n });\n }\n iter();\n }\n else {\n cb(null, args);\n }\n }", "function use (hooks) {\n assert.equal(typeof hooks, 'object', 'barracks.use: hooks should be an object')\n assert.ok(!hooks.onError || typeof hooks.onError === 'function', 'barracks.use: onError should be undefined or a function')\n assert.ok(!hooks.onAction || typeof hooks.onAction === 'function', 'barracks.use: onAction should be undefined or a function')\n assert.ok(!hooks.onStateChange || typeof hooks.onStateChange === 'function', 'barracks.use: onStateChange should be undefined or a function')\n\n if (hooks.onStateChange) onStateChangeHooks.push(hooks.onStateChange)\n if (hooks.onError) onErrorHooks.push(wrapOnError(hooks.onError))\n if (hooks.onAction) onActionHooks.push(hooks.onAction)\n if (hooks.wrapSubscriptions) subscriptionWraps.push(hooks.wrapSubscriptions)\n if (hooks.wrapInitialState) initialStateWraps.push(hooks.wrapInitialState)\n if (hooks.wrapReducers) reducerWraps.push(hooks.wrapReducers)\n if (hooks.wrapEffects) effectWraps.push(hooks.wrapEffects)\n }", "function generateInstanceHooks(st) {\n return {\n callHook: function(cmp, fn, args) {\n if (isArray(args)) {\n args = args.map(rawValue => getFilteredValue(st, rawValue));\n }\n const filteredResult = fn.apply(st, args);\n return getUnwrappedValue(st, filteredResult);\n },\n setHook: function(cmp, prop, rawValue) {\n st[prop] = getFilteredValue(st, rawValue);\n },\n getHook: function(cmp, prop) {\n return getUnwrappedValue(st, st[prop]);\n }\n };\n}", "function _hook (slf, name, handlerInfo, params) {\n if (!slf.__hooks[name]) return\n\n slf.__hooks[name].forEach(function (hook) {\n hook(handlerInfo, params)\n })\n}", "function listenArrayEvents(array, listener) {\n\t\t\tif (array._chartjs) {\n\t\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: {\n\t\t\t\t\tlisteners: [listener]\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tarrayEvents.forEach(function(key) {\n\t\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\t\tvar base = array[key];\n\n\t\t\t\tObject.defineProperty(array, key, {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tvalue: function() {\n\t\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn res;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t}", "function HookPrimitive(config){\n this.when = null;\n this.method_signature = null;\n this.isIntercept = false;\n this.isCustom = false;\n this.interceptBefore = null;\n this.interceptAfter = null;\n this.interceptReplace = null;\n this.onMatch = null;\n this.custom = false;\n this.variables = null;\n this.raw = null;\n\n for(let i in config){\n if(i!=\"multiple_method\" && i!=\"method\")\n this[i] = config[i];\n }\n if(config.method!=null) this.method_signature = config.method;\n return this;\n}", "function setHookCallback(callback){hookCallback=callback;}", "function setHookCallback(callback){hookCallback=callback;}", "function setHookCallback(callback){hookCallback=callback;}", "function setHookCallback(callback){hookCallback=callback;}", "hookGroup(group) {\r\n if (arguments.length != 1)\r\n throw new Error(\"ArgumentError: There should be only 1 argument which is the group name you want to hook.\");\r\n let hooks = [];\r\n if (this.hookTemplates.has(group)) {\r\n let templates = this.hookTemplates.get(group).slice();\r\n for (let template of templates) {\r\n let hook = this.hookTemplate(template);\r\n if (hook)\r\n hooks.push(hook);\r\n }\r\n }\r\n return hooks;\r\n }", "function S(e,t){void 0===t&&(t=!1);var n=k.get(e.object);D(n.value,e.object,e.patches,\"\",t),e.patches.length&&b(n.value,e.patches);var i=e.patches;return i.length>0&&(e.patches=[],e.callback&&e.callback(i)),i}", "addListener(array, callback) {\n if ( typeof callback == 'function') {\n array.push(callback);\n }\n }", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function listenArrayEvents(array, listener) {\n\t\tif (array._chartjs) {\n\t\t\tarray._chartjs.listeners.push(listener);\n\t\t\treturn;\n\t\t}\n\n\t\tObject.defineProperty(array, '_chartjs', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: {\n\t\t\t\tlisteners: [listener]\n\t\t\t}\n\t\t});\n\n\t\tarrayEvents.forEach(function(key) {\n\t\t\tvar method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n\t\t\tvar base = array[key];\n\n\t\t\tObject.defineProperty(array, key, {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: function() {\n\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\tvar res = base.apply(this, args);\n\n\t\t\t\t\thelpers.each(array._chartjs.listeners, function(object) {\n\t\t\t\t\t\tif (typeof object[method] === 'function') {\n\t\t\t\t\t\t\tobject[method].apply(object, args);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}" ]
[ "0.7317651", "0.7317651", "0.71452296", "0.64584", "0.63590115", "0.62486535", "0.62486535", "0.62486535", "0.6153869", "0.6037657", "0.6005855", "0.5946775", "0.593578", "0.5931732", "0.5931732", "0.5931732", "0.5931732", "0.589039", "0.58279073", "0.5819339", "0.58131236", "0.57930815", "0.5770133", "0.5759086", "0.56980526", "0.56973237", "0.568076", "0.56776416", "0.56537175", "0.55798894", "0.5571666", "0.5571666", "0.5571666", "0.5571666", "0.5571666", "0.5571666", "0.5543351", "0.5500116", "0.54926455", "0.5484282", "0.54717493", "0.5437926", "0.5436121", "0.543487", "0.54215884", "0.5421456", "0.5415493", "0.5410614", "0.53894055", "0.53751874", "0.53669035", "0.53669035", "0.53669035", "0.53248024", "0.5322442", "0.530063", "0.52851975", "0.52851975", "0.5276886", "0.5275507", "0.52750534", "0.5263337", "0.5262455", "0.52496576", "0.52357316", "0.52331865", "0.5224577", "0.5224577", "0.5224577", "0.5224577", "0.52119064", "0.51916313", "0.5188584", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214", "0.51874214" ]
0.62751174
5
Try to map a node to all sides of this triangle that don't have a neighbor void MapTriangleToNodes(Triangle& t);
MapTriangleToNodes(t) { if (this.front_ === null) { throw new Error("this.front_ === null"); } for (let i = 0; i < 3; i++) { if (!t.GetNeighbor(i)) { // Node* n = front_->LocatePoint(t.PointCW(*t.GetPoint(i))); const n = this.front_.LocatePoint(t.PointCW(t.GetPoint(i))); if (n) n.triangle = t; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rotateTrianglePair(t, p, ot, op) {\n var n1, n2, n3, n4;\n n1 = t.neighborCCW(p);\n n2 = t.neighborCW(p);\n n3 = ot.neighborCCW(op);\n n4 = ot.neighborCW(op);\n\n var ce1, ce2, ce3, ce4;\n ce1 = t.getConstrainedEdgeCCW(p);\n ce2 = t.getConstrainedEdgeCW(p);\n ce3 = ot.getConstrainedEdgeCCW(op);\n ce4 = ot.getConstrainedEdgeCW(op);\n\n var de1, de2, de3, de4;\n de1 = t.getDelaunayEdgeCCW(p);\n de2 = t.getDelaunayEdgeCW(p);\n de3 = ot.getDelaunayEdgeCCW(op);\n de4 = ot.getDelaunayEdgeCW(op);\n\n t.legalize(p, op);\n ot.legalize(op, p);\n\n // Remap delaunay_edge\n ot.setDelaunayEdgeCCW(p, de1);\n t.setDelaunayEdgeCW(p, de2);\n t.setDelaunayEdgeCCW(op, de3);\n ot.setDelaunayEdgeCW(op, de4);\n\n // Remap constrained_edge\n ot.setConstrainedEdgeCCW(p, ce1);\n t.setConstrainedEdgeCW(p, ce2);\n t.setConstrainedEdgeCCW(op, ce3);\n ot.setConstrainedEdgeCW(op, ce4);\n\n // Remap neighbors\n // XXX: might optimize the markNeighbor by keeping track of\n // what side should be assigned to what neighbor after the\n // rotation. Now mark neighbor does lots of testing to find\n // the right side.\n t.clearNeighbors();\n ot.clearNeighbors();\n if (n1) {\n ot.markNeighbor(n1);\n }\n if (n2) {\n t.markNeighbor(n2);\n }\n if (n3) {\n t.markNeighbor(n3);\n }\n if (n4) {\n ot.markNeighbor(n4);\n }\n t.markNeighbor(ot);\n }", "function rotateTrianglePair(t, p, ot, op) {\n var n1, n2, n3, n4;\n n1 = t.neighborCCW(p);\n n2 = t.neighborCW(p);\n n3 = ot.neighborCCW(op);\n n4 = ot.neighborCW(op);\n\n var ce1, ce2, ce3, ce4;\n ce1 = t.getConstrainedEdgeCCW(p);\n ce2 = t.getConstrainedEdgeCW(p);\n ce3 = ot.getConstrainedEdgeCCW(op);\n ce4 = ot.getConstrainedEdgeCW(op);\n\n var de1, de2, de3, de4;\n de1 = t.getDelaunayEdgeCCW(p);\n de2 = t.getDelaunayEdgeCW(p);\n de3 = ot.getDelaunayEdgeCCW(op);\n de4 = ot.getDelaunayEdgeCW(op);\n\n t.legalize(p, op);\n ot.legalize(op, p);\n\n // Remap delaunay_edge\n ot.setDelaunayEdgeCCW(p, de1);\n t.setDelaunayEdgeCW(p, de2);\n t.setDelaunayEdgeCCW(op, de3);\n ot.setDelaunayEdgeCW(op, de4);\n\n // Remap constrained_edge\n ot.setConstrainedEdgeCCW(p, ce1);\n t.setConstrainedEdgeCW(p, ce2);\n t.setConstrainedEdgeCCW(op, ce3);\n ot.setConstrainedEdgeCW(op, ce4);\n\n // Remap neighbors\n // XXX: might optimize the markNeighbor by keeping track of\n // what side should be assigned to what neighbor after the\n // rotation. Now mark neighbor does lots of testing to find\n // the right side.\n t.clearNeighbors();\n ot.clearNeighbors();\n if (n1) {\n ot.markNeighbor(n1);\n }\n if (n2) {\n t.markNeighbor(n2);\n }\n if (n3) {\n t.markNeighbor(n3);\n }\n if (n4) {\n ot.markNeighbor(n4);\n }\n t.markNeighbor(ot);\n}", "mapCoordsToNode(x, y) {\n\n\t}", "function GenerateTileNeighbours()\n{\n // loop through each tile on the map\n var currentX = 0;\n var currentY = 0;\n\n // since the highest x values can really only be gridheight/width -1, make these the highest tiles we check\n var maxX = (gridHeight - 1);\n var maxY = (gridHeight - 1);\n\n for(currentX = 0; currentX < gridWidth; currentX++)\n {\n for (currentY = 0; currentY < gridHeight; currentY++)\n {\n\n var CurrentTile = Tiles[currentX][currentY];\n // first, if this is a wall tile, we don't care, as we can't generate paths through here, so don't add it to the nodes\n if (!(CurrentTile.TileType == TilesNames.Wall))\n {\n // check each of the tiles neighbours, if it's a valid tile\n if (CurrentTile.x != 0)\n {\n // check the tile to the left of it\n if (IsValidTile(CurrentTile.x - 1, CurrentTile.y))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x - 1][CurrentTile.y]);\n }\n }\n \n if (CurrentTile.x != maxX)\n {\n // check the tile to the right of it\n if (IsValidTile(CurrentTile.x + 1, CurrentTile.y))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x + 1][ CurrentTile.y]);\n }\n }\n\n if (CurrentTile.y != 0)\n {\n // check the tile to the top of it\n if (IsValidTile(CurrentTile.x, CurrentTile.y - 1))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x][CurrentTile.y - 1]);\n }\n }\n\n if (CurrentTile.y != maxY)\n {\n // check the tile below it\n if (IsValidTile(CurrentTile.x, CurrentTile.y + 1))\n {\n // add it to the tiles neighbours\n CurrentTile.Neighbours.push(Tiles[CurrentTile.x][CurrentTile.y + 1]);\n }\n }\n\n }\n }\n\n }\n \n}", "function opposed_triangle(edge_map, triangle, vertex) {\n\t// loop through the points of triangle\n\tfor (var p=0; p<pointnames.length; p++) {\n\t\tvar pt = triangle[pointnames[p]];\n\t\tvar ptn = triangle[pointnames[(p + 1) % pointnames.length]];\n\t\t// if vertex is not in the edge formed by point and point + 1 (opposing edge)\n\t\tif (vertex != pt && vertex != ptn) {\n\t\t\t// console.log(\"opposing:\", vertex, pt, ptn);\n\t\t\t// loop through the triangles of the edge\n\t\t\tvar edge_triangles = edge_map[edge_reference(pt,ptn)];\n\t\t\tfor (var e=0; e<edge_triangles.length; e++) {\n\t\t\t\t// if the current triangle is not our original triangle it's the other\n\t\t\t\t// this is the opposing triangle we want\n\t\t\t\tif (edge_triangles[e] != triangle) {\n\t\t\t\t\t// loop through the points of the opposing triangle\n\t\t\t\t\tfor (var pe=0; pe<pointnames.length; pe++) {\n\t\t\t\t\t\tvar pet = edge_triangles[e][pointnames[pe]];\n\t\t\t\t\t\t// if this point's id is not in the edge we found this is the opposing vertex\n\t\t\t\t\t\tif (pet != pt && pet != ptn) {\n\t\t\t\t\t\t\t// return the opposing triangle and opposing vertex and shared edge\n\t\t\t\t\t\t\treturn {\"t\": edge_triangles[e], \"v\": pet, \"e\": [pt, ptn]};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function makePath(tiles, fromNode, toNode) {\n \"use strict\";\n var row, col;\n tiles.map[toNode[0]][toNode[1]] = FLOOR;\n row = (fromNode[0] + toNode[0]) / 2;\n col = (fromNode[1] + toNode[1]) / 2;\n tiles.map[row][col] = FLOOR;\n}", "function make_edge_map(triangles) {\n\tvar edge_map = {};\n\tfor (var t=0; t<triangles.length; t++) {\n\t\t// loop through the points of this triangle to find the edges\n\t\tfor (var p=0; p<pointnames.length; p++) {\n\t\t\t// the two points involved in this edge\n\t\t\tvar a = triangles[t][pointnames[p]];\n\t\t\tvar b = triangles[t][pointnames[(p + 1) % pointnames.length]];\n\t\t\t// add this triangle to the edge list\n\t\t\tif (edge_map[edge_reference(a,b)]) {\n\t\t\t\tedge_map[edge_reference(a,b)].push(triangles[t]);\n\t\t\t} else {\n\t\t\t\tedge_map[edge_reference(a,b)] = [triangles[t]];\n\t\t\t}\n\t\t}\n\t}\n\treturn edge_map;\n}", "function createWalls(map)\n{\n //var n = [];\n for (var y = 0; y < map.length; y++)\n {\n for (var x = 0; x < map[0].length; x++)\n {\n if (map[y][x] === 1 && map[y][x] !== 2)\n {\n if (y > 0 && y < map.length - 1 && x > 0 && x < map[0].length - 1)\n {\n if (map[y][x + 1] === 0 || map[y + 1][x] === 0)\n map[y][x] = 2;\n if (map[y][x - 1] === 0 || map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === 0) {\n if (map[y + 1][x] === 0)\n map[y][x] = 2;\n }\n if (y === map.length - 1) {\n if (map[y - 1][x] === 0)\n map[y][x] = 2;\n }\n if (x === 0) {\n if (map[y][x + 1] === 0)\n map[y][x] = 2;\n }\n if (x === map[0].length - 1) {\n if (map[y][x - 1] === 0)\n map[y][x] = 2;\n }\n }\n }\n }\n}", "function setNeighbors() {\n\tvar width = tiles[0].length - 1;\n\tvar height = tiles.length - 1;\n\tfor(y = 1; y < height; y++) {\n\t\tfor(x = 1; x < width; x++) {\n\t\t\ttiles[y][x].addNeighbors( tiles[y][x-1]);\n\t\t\ttiles[y][x].addNeighbors( tiles[y+1][x]);\n\t\t\ttiles[y][x].addNeighbors( tiles[y][x+1]);\n\t\t\ttiles[y][x].addNeighbors( tiles[y-1][x]);\t\t\n\t\t}\n\t}\n}", "function mapa3(){\n // Crea un arreglo con los nodos visitados hasta ahora.\n var nodes = [\n \n {id: 1, label: 'Brasil'},\n {id: 2, label: 'Finlandia'},\n {id: 3, label: 'China'},\n ];\n\n // Crea un arreglo con las conexiones entre los nodos.\n var edges = [\n {from: 1, to: 2},\n {from: 2, to: 3},\n\n \n\n ];\n // Crea un arreglo con los nodos activos.\n var activeNode = [ 3 ];\n mapa( nodes, edges, activeNode );\n}", "function mapNodes(nodes) {\n var nodesMap = d3.map();\n for(var i = 0; i < nodes.length; i++) {\n nodesMap.set(nodes[i].id, nodes[i]);\n }\n return nodesMap;\n }", "function calculateAdjacencyInfo(map, x, y){\n let number = 0;\n let Sides = [{x:0,y:-1}, {x:-1,y:0}, {x:1,y:0}, {x:0,y:1}];\n let SidesID = [0x10, 0x20, 0x40, 0x80];\n \n let CornerMask = [0x30, 0x50, 0xA0, 0xC0];\n let Corners = [{x:-1,y:-1}, {x:1,y:-1}, {x:-1,y:1}, {x:1,y:1}];\n let CornersID = [0x01, 0x02, 0x04, 0x08];\n //first, get the 4 directly adjacent tiles\n for(let i = 0;i<4;i++){\n if (isWall(map, x+Sides[i].x, y+Sides[i].y)){\n number = number | SidesID[i];\n }\n }\n //then, get the corners, if they are noticable\n for(let i = 0;i<4;i++){\n //console.log((number & CornerMask[i]) == CornerMask[i]);\n if ((number & CornerMask[i]) === CornerMask[i]){\n \n if ( isWall(map, x+Corners[i].x, y+Corners[i].y)){\n number = number | CornersID[i];\n }\n }\n }\n //\n return number;\n}", "function substitutionTT(tile) {\r\n switch (tile.id[0]) {\r\n case \"triangle0\":\r\n var newtiles = [];\r\n\r\n var new_tri1 = tile.myclone();\r\n new_tri1.tri0to1();\r\n new_tri1.id.push(\"fils_0to1\");\r\n newtiles.push(new_tri1);\r\n\r\n return newtiles;\r\n case \"triangle1\":\r\n var newtiles = [];\r\n\r\n var new_tri2 = tile.myclone();\r\n new_tri2.tri1to2();\r\n new_tri2.id.push(\"fils_1to2\");\r\n newtiles.push(new_tri2);\r\n\r\n return newtiles;\r\n case \"triangle2\":\r\n var newtiles = [];\r\n\r\n var A = new THREE.Vector2(tile.bounds[0], tile.bounds[1]);\r\n var B = new THREE.Vector2(tile.bounds[2], tile.bounds[3]);\r\n var C = new THREE.Vector2(tile.bounds[4], tile.bounds[5]);\r\n var AB_center = ((new THREE.Vector2()).addVectors(A, B)).divideScalar(2);\r\n var AC_center = ((new THREE.Vector2()).addVectors(A, C)).divideScalar(2);\r\n var BC_center = ((new THREE.Vector2()).addVectors(B, C)).divideScalar(2);\r\n var AC_quarter = ((((new THREE.Vector2()).add(A)).multiplyScalar(3)).add(C)).divideScalar(4);\r\n var ABC_center = ((new THREE.Vector2()).addVectors(AC_center, B)).divideScalar(2);\r\n\r\n var new_tri2 = tile.myclone();\r\n\t\t\tnew_tri2.limit = 3\r\n new_tri2.bounds = triangleVectorsToBounds(C, AC_center, B);\r\n new_tri2.id.push(\"fils0\");\r\n newtiles.push(new_tri2);\r\n\r\n var new_tri0_0 = tile.myclone();\r\n new_tri0_0.tri2to0();\r\n new_tri0_0.id.push(\"fils1\");\r\n new_tri0_0.bounds = triangleVectorsToBounds(AB_center, AC_quarter, A);\r\n newtiles.push(new_tri0_0);\r\n\r\n var new_tri0_1 = tile.myclone();\r\n new_tri0_1.tri2to0();\r\n new_tri0_1.id.push(\"fils2\");\r\n new_tri0_1.bounds = triangleVectorsToBounds(B, ABC_center, AB_center);\r\n newtiles.push(new_tri0_1);\r\n\r\n var new_tri0_2 = tile.myclone();\r\n new_tri0_2.tri2to0();\r\n new_tri0_2.id.push(\"fils3\");\r\n new_tri0_2.bounds = triangleVectorsToBounds(AC_center, AC_quarter, AB_center);\r\n newtiles.push(new_tri0_2);\r\n\r\n var new_tri0_3 = tile.myclone();\r\n new_tri0_3.tri2to0();\r\n new_tri0_3.id.push(\"fils4\");\r\n new_tri0_3.bounds = triangleVectorsToBounds(AC_center, ABC_center, AB_center);\r\n newtiles.push(new_tri0_3);\r\n\r\n return newtiles;\r\n default:\r\n console.log(\"caution: undefined tile type for substitutionTT, id = \" + tile.id);\r\n }\r\n}", "function findNeighborTiles(map,xCoOrd, yCoOrd){\n var north = yCoOrd - 1;\n var south = yCoOrd + 1;\n var east = xCoOrd + 1;\n var west = xCoOrd - 1;\n\n \n if(isValidNeighbor(map.tiles[xCoOrd][south]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"south\"] = map.tiles[xCoOrd][south];\n if(isValidNeighbor(map.tiles[xCoOrd][north]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"north\"] = map.tiles[xCoOrd][north];\n if(isValidNeighbor(map.tiles[east][yCoOrd]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"east\"] = map.tiles[east][yCoOrd];\n if(isValidNeighbor(map.tiles[west][yCoOrd]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"west\"] = map.tiles[west][yCoOrd];\n if(isValidNeighbor(map.tiles[east][south]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"southeast\"] = map.tiles[east][south];\n if(isValidNeighbor(map.tiles[west][south]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"southwest\"] = map.tiles[west][south];\n if(isValidNeighbor(map.tiles[east][north]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"northeast\"] = map.tiles[east][north];\n if(isValidNeighbor(map.tiles[west][north]))\n map.tiles[xCoOrd][yCoOrd].neighborTiles[\"northwest\"] = map.tiles[west][north];\n //return whether current tile is a valid neighbor\n function isValidNeighbor(currentTile){\n if(currentTile !== undefined){\n if(currentTile.isPassable){\n return true;\n } else return false;\n }else return false;\n }\n}", "function unb(nodes, node, boardArray, target, name, start, heuristic) {\n let nb = gn(node.id, nodes, boardArray);\n for (let neighbor of nb) {\n un(node, nodes[neighbor], nodes[target], name, nodes, nodes[start], heuristic, boardArray);\n }\n}", "function genNodes(map){\n map.forEach(function(value){\n nodes.push(value);\n });\n}", "function applyRules() {\n let work = map.slice(0);\n map = grid();\n\n for (var row in map) {\n if (map.hasOwnProperty(row)) {\n for (var col in map[row]) {\n if (map[row].hasOwnProperty(col)) {\n\n //map[row][col] = null;\n\n let tile = work[row][col];\n let n = getNeighbors(work, row, col);\n let totalNeigbors = n.reduce(function (total, sum) {\n return (total || 0) + (sum || 0);\n });\n\n if (tile === 1) {\n\n // Any live cell with fewer than two live neighbors dies, as if by underpopulation.\n if (totalNeigbors < 2) {\n map[row][col] = 0;\n }\n // Any live cell with two or three live neighbors lives on to the next generation.\n else if (totalNeigbors == 2 || totalNeigbors == 3) {\n map[row][col] = 1;\n }\n // Any live cell with more than three live neighbors dies, as if by overpopulation.\n else if (totalNeigbors > 3) {\n map[row][col] = 0;\n }\n\n } else {\n\n // Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.\n if (totalNeigbors == 3) {\n map[row][col] = 1;\n }\n\n }\n\n }\n }\n }\n }\n }", "generateTriangles() {\n\t\tvar icosphere = Icosphere.create(this.config.recursion_level);\n\n\t\tthis.triangles = icosphere.triangles;\n\t}", "function unb(nodes, node, boardArray, target, name, start, heuristic) {\n let nb = gn(node.id, nodes, boardArray);\n for (let neighbor of nb) {\n if (target) {\n un(node, nodes[neighbor], nodes[target], name, nodes, nodes[start], heuristic, boardArray);\n } else {\n un(node, nodes[neighbor]);\n }\n }\n}", "function Triangle(v1, v2, v3) {\n\n this.v1 = v1;\n this.v2 = v2;\n this.v3 = v3;\n\n this.normal = new THREE.Vector3();\n\n this.computeNormal();\n\n v1.faces.push(this);\n v1.addUniqueNeighbor(v2);\n v1.addUniqueNeighbor(v3);\n\n v2.faces.push(this);\n v2.addUniqueNeighbor(v1);\n v2.addUniqueNeighbor(v3);\n\n\n v3.faces.push(this);\n v3.addUniqueNeighbor(v1);\n v3.addUniqueNeighbor(v2);\n\n }", "function updateUnvisitedNeighbors(node, grid) {\n const unvisitedNeighbors = getUnvisitedNeighbors(node, grid);\n // calculateManhattanDistance(unvisitedNeighbors, grid);\n // console.log(unvisitedNeighbors);\n for (let neighbor of unvisitedNeighbors) {\n neighbor.distance = node.distance + 1;\n neighbor.totalDistance = node.distance + neighbor.heuristicDistance;\n\n neighbor.previousNode = node;\n }\n}", "function genMap()\r\n\t{\r\n\t\tvar EDGE = 2;\t\t//defaults to fenceless edge\r\n\t\tvar CORNER = 3;\t\t//defaults to fenceless corner\r\n\r\n\t\tif (Math.random() > 0.5)//random fence\r\n\t\t{\r\n\t\t\tEDGE = 4;\r\n\t\t\tCORNER = 5;\r\n\t\t}\r\n\r\n\t\tfor ( var x = 0; x < tileCountX; x ++ )\r\n\t\t{\r\n\t\t\tvar id = 0;\r\n\t\t\tvar rotation = 0;\r\n\r\n\t\t\tspriteTiles[x] = [];\r\n\t\t\tfor ( var y = 0; y < tileCountY; y ++ )\r\n\t\t\t{\r\n\t\t\t\tid = 0;\r\n\r\n\t\t\t\t//level border in clockwise order from top left\r\n\t\t\t\tif ( y == 0 )\t\t\t\t\t\t\t\t// top side\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\tif ( x == tileCountX - 1 )\t\t\t\t\t// right side\r\n\t\t\t\t{\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\t\trotation = 1;\r\n\t\t\t\t}\r\n\t\t\t\tif ( y == tileCountY - 1 )\t\t\t\t\t// bottom side\r\n\t\t\t\t{\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\t\trotation = 2;\r\n\t\t\t\t}\r\n\t\t\t\tif ( x == 0 )\t\t\t\t\t\t\t\t// left side\r\n\t\t\t\t{\r\n\t\t\t\t\tid = EDGE;\r\n\t\t\t\t\trotation = 3;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//level corner --- draws over border\r\n\t\t\t\tif ( x == 0 && y == 0 )\t{\t\t\t\t\t//NW\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 0;\r\n\t\t\t\t}\r\n\t\t\t\tif ( x == tileCountX - 1 && y == 0 )\t\t\t//NE\r\n\t\t\t\t{\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 1;\r\n\t\t\t\t}\r\n\t\t\t\tif ( x == tileCountX - 1 && y == tileCountY - 1 )\t//SE\r\n\t\t\t\t{\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 2;\r\n\t\t\t\t}\r\n\t\t\t\tif ( x == 0 && y == tileCountY - 1 )\t\t\t//SW\r\n\t\t\t\t{\r\n\t\t\t\t\tid = CORNER;\r\n\t\t\t\t\trotation = 3;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//random rocks 1 space inside border\r\n\t\t\t\tif ( x > 1 && x < (tileCountX - 1) - 1 )\r\n\t\t\t\t\tif ( y > 1 && y < (tileCountY - 1) - 1 )\r\n\t\t\t\t\t\tif ( Math.random() > 0.95 )\r\n\t\t\t\t\t\t\tid = 1;\r\n\r\n\t\t\t\tspriteTiles[x].push(new spriteID(id, rotation));\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function triangulate_polygon(poly, edge, triangles) {\n\t//console.log(\"triangulate_polygon\", poly, edge);\n\t// var new_triangles = [];\n\tvar a = edge[0];\n\tvar b = edge[1];\n\tvar c = 0;\n\tvar use_tri = null;\n\t//If P has more than one element then\n\tif (poly.length > 1) {\n\t\t// c:=First vertex of P\n\t\t// For each vertex v in P do\n\t\tfor (var v=0; v<poly.length; v++) {\t\n\t\t\t// If v ∈ CircumCircle (a, b, c) then\n\t\t\tvar new_tri = new DelaunayTriangle(a, b, poly[c]);\n\t\t\tif (Math.pow(_delaunay_distance(poly[v], new_tri), 2) < new_tri.r) {\n\t\t\t\t//c:=v\n\t\t\t\tc = v;\n\t\t\t\tuse_tri = new DelaunayTriangle(a, b, poly[c]);\n\t\t\t}\n\t\t\t//EndIf\n\t\t}\n\t\t//EndFor\n\t\t//Divide P into PE and PD giving P=PE +c+PD\n\t\tvar poly_e = poly.slice(0, c);\n\t\tvar poly_d = poly.slice(c + 1);\n\t\t//TriangulatePseudoPolygon(PE , ac, T)\n\t\ttriangulate_polygon(poly_e, [a, poly[c]], triangles);\n\t\t//TriangulatePseudoPolygon(PD , cd, T)\n\t\ttriangulate_polygon(poly_d, [poly[c], b], triangles);\n\t} else if (poly.length) {\n\t\tuse_tri = new DelaunayTriangle(a, b, poly[c]);\n\t}\n\t// EndIf\n\t//If P is not empty then\n\tif (use_tri) {\n\t\t// Add triangle with vertices a, b, c into T\n\t\ttriangles.push(use_tri);\n\t} else if (poly.length) {\n\t\tvar force_tri = new DelaunayTriangle(a, b, poly[c]);\n\t\tforce_tri.forced = true;\n\t\ttriangles.push(force_tri);\n\t}\n\t//EndIf\n\treturn triangles;\n}", "function getRelevantNeighbors(tile) {\n var neighborIndexX = tile.indexX > originXIndex ? tile.indexX - 1 : tile.indexX + 1,\n neighborIndexY = tile.indexY > originYIndex ? tile.indexY - 1 : tile.indexY + 1;\n\n/* if(tile.indexX === originXIndex) neighborIndexX = null;\n if(tile.indexY === originYIndex) neighborIndexY = null;*/\n\n var neighbors = {\n diagonal: {},\n vertical: {},\n horizontal: {}\n };\n\n for(var j=0; j<tiles.length; j++) {\n var current = tiles[j];\n if(current.indexX === neighborIndexX && current.indexY === tile.indexY)\n neighbors.horizontal = current;\n if(current.indexY === neighborIndexY && current.indexX === tile.indexX)\n neighbors.vertical = current;\n if(current.indexX === neighborIndexX && current.indexY === neighborIndexY)\n neighbors.diagonal = current;\n }\n\n return neighbors;\n}", "function Triangulate (m_points, holes)\n{\n\tvar indices = new Array();\n\n\tif (getWinding (m_points) < 0)\n\t\tm_points.reverse();\n\n//\tRemove holes by joining them with the outer edge\n\tif (holes.length)\n\t{\n\t\tfor (hh=0; hh<holes.length; hh++)\n\t\t{\n\t\t\tvar h = holes[hh];\n\t\t\tif (getWinding (h) > 0)\n\t\t\t\th.reverse();\n\n\t\t\tvar maxpt = 0;\n\t\t\tfor (i=1; i<h.length; i++)\n\t\t\t{\n\t\t\t\tif (h[i][0] > h[maxpt][0] || (h[i][0] == h[maxpt][0] && h[i][1] < h[maxpt][1]))\n\t\t\t\t\tmaxpt = i;\n\t\t\t}\n\t\t\twhile (maxpt > 0)\n\t\t\t{\n\t\t\t\th.push (h.shift());\n\t\t\t\tmaxpt--;\n\t\t\t}\n\t\t}\n\t\tholes.sort(function(a,b){ if (a[0][0] > b[0][0]) return -1; if (a[0][0] < b[0][0]) return 1; return (a[0][1] < b[0][1]) ? 1 : -1; });\n\t\tfor (hh=0; hh<holes.length; hh++)\n\t\t{\n\t\t\tvar h = holes[hh];\n\t\t\tvar maxpt = 0;\n\n\t\t\tfor (i=1; i<h.length; i++)\n\t\t\t\tif (h[i][0] > h[maxpt][0] || (h[i][0] == h[maxpt][0] && h[i][1] < h[maxpt][1]))\n\t\t\t\t\tmaxpt = i;\n\n\t\t\tvar d2 = null;\n\t\t\tvar closestpt;\n\t\t\tfor (i=0; i<m_points.length; i++)\n\t\t\t{\n\t\t\t\tif (m_points[i][0] > h[maxpt][0])\n\t\t\t\t{\n\t\t\t\t\tif (d2 == null)\n\t\t\t\t\t{\n\t\t\t\t\t\td2 = ClosestPointOnLine (h[maxpt], [ m_points[i], m_points[(i+1) % m_points.length] ] )[1];\n\t\t\t\t\t\tclosestpt = i;\n\t\t\t\t\t} else\n\t\t\t\t\t{\n\t\t\t\t\t\tvar dd2 = ClosestPointOnLine (h[maxpt], [ m_points[i], m_points[(i+1) % m_points.length] ] )[1];\n\t\t\t\t\t\tif (dd2 < d2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\td2 = dd2;\n\t\t\t\t\t\t\tclosestpt = i;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t//\tdrawLine (h[maxpt], m_points[closestpt]);\n\t\t//\tapp.activeDocument.pathItems.ellipse (h[maxpt][1]+2+hh,h[maxpt][0]-2-hh,4+2*hh,4+2*hh);\n\t\t//\tapp.activeDocument.pathItems.ellipse (m_points[closestpt][1]+2+hh,m_points[closestpt][0]-2-hh,4+2*hh,4+2*hh).fillColor = gray;\n\n\t\t//\talert (m_points.length);\n\t\t\tm_points.splice (closestpt, 0, [ m_points[closestpt][0],m_points[closestpt][1]+0.1 ]);\n\t\t\tclosestpt++;\n\t\t\th.splice (maxpt, 0, [ h[maxpt][0],h[maxpt][1] ]);\n\t\t\th[maxpt][1] -= 0.1;\n\t\t\tfor (var i=maxpt; i >=0; i--)\n\t\t\t{\n\t\t\t\tm_points.splice (closestpt, 0, h[i]);\n\t\t\t}\n\t\t\tfor (var i=h.length-1; i > maxpt; i--)\n\t\t\t{\n\t\t\t\tm_points.splice (closestpt, 0, h[i]);\n\t\t\t}\n\t\t//\talert (m_points.length);\n\t\t//\tdrawLine (m_points[0], m_points[m_points.length-1]);\n\t\t//\tfor (i=0; i<m_points.length-1; i++)\n\t\t//\t\tdrawLine (m_points[i], m_points[i+1]);\n\t\t}\n\t}\n\n\tvar n = m_points.length;\n\tif (n < 3)\n\t\treturn indices;\n\n//\tapp.activeDocument.pathItems.add().setEntirePath (m_points);\n\n\tvar V = new Array(n);\n\tif (Area(m_points) > 0)\n\t{\n\t\tfor (var v = 0; v < n; v++)\n\t\t\tV[v] = v;\n\t} else\n\t{\n\t\tfor (var v = 0; v < n; v++)\n\t\t\tV[v] = (n - 1) - v;\n\t}\n\n\n\tvar nv = n;\n\tvar count = 2 * nv;\n\tfor (var m = 0, v = nv - 1; nv > 2; )\n\t{\n\t\tif ((count--) <= 0)\n\t\t\treturn indices;\n\n\t\tvar u = v;\n\t\tif (nv <= u)\n\t\t\tu = 0;\n\t\tv = u + 1;\n\t\tif (nv <= v)\n\t\t\tv = 0;\n\t\tvar w = v + 1;\n\t\tif (nv <= w)\n\t\t\tw = 0;\n\n\t\tif (Snip(u, v, w, nv, V, m_points))\n\t\t{\n\t\t\tvar a, b, c, s, t;\n\t\t\ta = V[u];\n\t\t\tb = V[v];\n\t\t\tc = V[w];\n\t\t\tindices.push(a);\n\t\t\tindices.push(b);\n\t\t\tindices.push(c);\n\t\t\tm++;\n\t\t\tfor (s = v, t = v + 1; t < nv; s++, t++)\n\t\t\t\tV[s] = V[t];\n\t\t\tnv--;\n\t\t\tcount = 2 * nv;\n\t\t}\n\t}\n\n\tindices.reverse();\n\treturn indices;\n}", "function filterUnconnectedNodes() {\n //Create a node -> node id mapping\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\n }); //Filter out any edges that were associated to the nodes filtered earlier\n\n edges = edges.filter(function (d) {\n return node_by_id[d.source] && node_by_id[d.target];\n }); //////////// Remove unconnected countries and regions //////////\n //What connections remain per node\n\n linked_to_id = {};\n edges.forEach(function (d) {\n //Save all of the connections to a specific node\n if (!linked_to_id[d.source]) linked_to_id[d.source] = [];\n if (!linked_to_id[d.target]) linked_to_id[d.target] = [];\n linked_to_id[d.source].push(node_by_id[d.target]);\n linked_to_id[d.target].push(node_by_id[d.source]);\n }); //forEach\n //Filter out any countries that are not connected to any remaining elements\n\n var connected_ids = nodes.filter(function (d) {\n return d.type === 'element';\n }).map(function (d) {\n return linked_to_id[d.id].filter(function (n) {\n return n.type === 'country';\n }).map(function (n) {\n return n.id;\n });\n });\n connected_ids = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_4___default.a([].concat.apply([], connected_ids))); //Filter the non-connected ones out\n\n nodes = nodes.filter(function (d) {\n if (d.type === 'country') return connected_ids.indexOf(d.id) >= 0 ? true : false;else return true;\n }); //filter\n //Create a new node -> node id mapping\n\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\n }); //Filter out any edges that were associated to the nodes filtered above\n\n edges = edges.filter(function (d) {\n return node_by_id[d.source] && node_by_id[d.target];\n }); //////////// Remove unconnected remaining concepts //////////\n //Filter out any node that is a concept and has only 1 degree\n\n nodes = nodes.filter(function (d) {\n if (d.type === 'concept') {\n var degree_now = edges.filter(function (l) {\n return l.source == d.id || l.target == d.id;\n }).length;\n return degree_now > 1 ? true : false;\n } else {\n return true;\n }\n }); //forEach\n //Redo node mapping\n\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\n }); //Filter out any edges that were associated to the nodes filtered above\n\n edges = edges.filter(function (d) {\n return node_by_id[d.source] && node_by_id[d.target];\n });\n } //function filterUnconnectedNodes", "function filterUnconnectedNodes() {\n //Create a node -> node id mapping\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\n }); //Filter out any edges that were associated to the nodes filtered above\n\n edges = edges.filter(function (d) {\n return node_by_id[d.source] && node_by_id[d.target];\n }); //////////// Remove unconnected countries and regions //////////\n //What connections remain per node\n\n linked_to_id = {};\n edges.forEach(function (d) {\n //Save all of the connections to a specific node\n if (!linked_to_id[d.source]) linked_to_id[d.source] = [];\n if (!linked_to_id[d.target]) linked_to_id[d.target] = [];\n linked_to_id[d.source].push(node_by_id[d.target]);\n linked_to_id[d.target].push(node_by_id[d.source]);\n }); //forEach\n //Filter out any countries & whc's that are not connected to any remaining elements\n\n var connected_ids = nodes.filter(function (d) {\n return d.type === 'element';\n }).map(function (d) {\n return linked_to_id[d.id].filter(function (n) {\n return n.type === 'country' || n.type === 'whc';\n }).map(function (n) {\n return n.id;\n });\n });\n connected_ids = Object(_babel_runtime_corejs2_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(new _babel_runtime_corejs2_core_js_set__WEBPACK_IMPORTED_MODULE_4___default.a([].concat.apply([], connected_ids))); //Filter the non-connected ones out\n\n nodes = nodes.filter(function (d) {\n if (d.type === 'country' || d.type === 'whc') return connected_ids.indexOf(d.id) >= 0 ? true : false;else return true;\n }); //filter\n //Create a new node -> node id mapping\n\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\n }); //Filter out any edges that were associated to the nodes filtered above\n\n edges = edges.filter(function (d) {\n return node_by_id[d.source] && node_by_id[d.target];\n }); //////////// Remove unconnected remaining nodes //////////\n //Filter out any node that has < 1 degrees that isn't a whc\n\n nodes = nodes.filter(function (d) {\n var degree_now = edges.filter(function (l) {\n return l.source == d.id || l.target == d.id;\n }).length;\n return degree_now > 1 || d.type === 'whc' ? true : false;\n }); //forEach\n //Redo node mapping\n\n node_by_id = {};\n nodes.forEach(function (d) {\n node_by_id[d.id] = d;\n }); //Filter out any edges that were associated to the nodes filtered above\n\n edges = edges.filter(function (d) {\n return node_by_id[d.source] && node_by_id[d.target];\n });\n } //function filterUnconnectedNodes", "function mapa2(){\n // Crea un arreglo con los nodos visitados hasta ahora.\n var nodes = [\n \n {id: 1, label: 'Brasil'},\n {id: 2, label: 'Finlandia'},\n\n ];\n\n // Crea un arreglo con las conexiones entre los nodos.\n var edges = [\n {from: 1, to: 2},\n ];\n // Crea un arreglo con los nodos activos.\n var activeNode = [ 2 ];\n mapa( nodes, edges, activeNode );\n }", "function _default(topology) {\n var junctions = (0, _join.default)(topology),\n coordinates = topology.coordinates,\n lines = topology.lines,\n rings = topology.rings,\n next,\n i,\n n;\n\n for (i = 0, n = lines.length; i < n; ++i) {\n var line = lines[i],\n lineMid = line[0],\n lineEnd = line[1];\n\n while (++lineMid < lineEnd) {\n if (junctions.has(coordinates[lineMid])) {\n next = {\n 0: lineMid,\n 1: line[1]\n };\n line[1] = lineMid;\n line = line.next = next;\n }\n }\n }\n\n for (i = 0, n = rings.length; i < n; ++i) {\n var ring = rings[i],\n ringStart = ring[0],\n ringMid = ringStart,\n ringEnd = ring[1],\n ringFixed = junctions.has(coordinates[ringStart]);\n\n while (++ringMid < ringEnd) {\n if (junctions.has(coordinates[ringMid])) {\n if (ringFixed) {\n next = {\n 0: ringMid,\n 1: ring[1]\n };\n ring[1] = ringMid;\n ring = ring.next = next;\n } else {\n // For the first junction, we can rotate rather than cut.\n rotateArray(coordinates, ringStart, ringEnd, ringEnd - ringMid);\n coordinates[ringEnd] = coordinates[ringStart];\n ringFixed = true;\n ringMid = ringStart; // restart; we may have skipped junctions\n }\n }\n }\n }\n\n return topology;\n}", "function _default(topology) {\n var junctions = (0, _join.default)(topology),\n coordinates = topology.coordinates,\n lines = topology.lines,\n rings = topology.rings,\n next,\n i,\n n;\n\n for (i = 0, n = lines.length; i < n; ++i) {\n var line = lines[i],\n lineMid = line[0],\n lineEnd = line[1];\n\n while (++lineMid < lineEnd) {\n if (junctions.has(coordinates[lineMid])) {\n next = {\n 0: lineMid,\n 1: line[1]\n };\n line[1] = lineMid;\n line = line.next = next;\n }\n }\n }\n\n for (i = 0, n = rings.length; i < n; ++i) {\n var ring = rings[i],\n ringStart = ring[0],\n ringMid = ringStart,\n ringEnd = ring[1],\n ringFixed = junctions.has(coordinates[ringStart]);\n\n while (++ringMid < ringEnd) {\n if (junctions.has(coordinates[ringMid])) {\n if (ringFixed) {\n next = {\n 0: ringMid,\n 1: ring[1]\n };\n ring[1] = ringMid;\n ring = ring.next = next;\n } else {\n // For the first junction, we can rotate rather than cut.\n rotateArray(coordinates, ringStart, ringEnd, ringEnd - ringMid);\n coordinates[ringEnd] = coordinates[ringStart];\n ringFixed = true;\n ringMid = ringStart; // restart; we may have skipped junctions\n }\n }\n }\n }\n\n return topology;\n}", "function fixTetromino () {\r\n for ( let y = 0; y < TETROMINO_SIZE; y++ ) {\r\n for ( let x = 0; x < TETROMINO_SIZE; x++ ) {\r\n if ( tetromino[y][x] != 0 ) {\r\n //Fix the tetromino shape as tetromino_type\r\n field[tetromino_y+y][tetromino_x+x] = tetromino_type;\r\n }\r\n }\r\n }\r\n}", "function mapa1(){\n // Crea un arreglo con los nodos visitados hasta ahora.\n var nodes = [\n \n {id: 1, label: 'Brasil'},\n ];\n\n // Crea un arreglo con las conexiones entre los nodos.\n var edges = [\n\n ];\n // Crea un arreglo con los nodos activos.\n var activeNode = [ 1 ];\n mapa( nodes, edges, activeNode );\n }", "function updateUnvisitedNeighbours (node, grid){\n const unvisitedNeighbours = getUnvisitedNeighbours(node, grid);\n for (const unvisited of unvisitedNeighbours){\n unvisited.distance = node.distance + 1;\n unvisited.previousNode = node;\n }\n}", "trim() {\n // get the reachable nodes from the root\n var reachable = this.reachableNodes;\n var visited = [];\n // remove any nodes that are not reachable from the root\n for(let node in this._nodeMap){\n if(reachable[node] !== true){\n this.removeNode(this._nodeMap[node]);\n }\n }\n }", "function populateExitTile(exitNode,nodeArray){\n for(var i=0; i<nodeArray.length; i++){\n if (nodeArray[i].id == exitNode){\n nodeArray[i].distance = 0;\n nodeArray[i].visited = false;\n document.getElementById(exitNode).style.backgroundColor = 'firebrick';\n }\n }\n return nodeArray;\n}", "function AldousBroderArray(map) {\r\n \r\n var northRow = map.length - 1;\r\n var eastColumn = map[0].length - 1;\r\n var cellCount = map[0].length * map.length;\r\n var visitedCells = 1;\r\n\r\n var i = randomRun(map.length) - 1; // starting cell row\r\n var x = randomRun(map[0].length) - 1; // starting cell column\r\n\r\n var start = randomRun(map[0].length - 1); // start cell\r\n var end = randomRun(map[0].length - 1); // end cell\r\n\r\n var next_i;\r\n var next_x;\r\n var cell = map[i][x];\r\n var nextCell;\r\n\r\n var moves = 4;\r\n var move = 0;\r\n var direction;\r\n var canMoveUp = true;\r\n var canMoveDown = true;\r\n var canMoveRight = true;\r\n var canMoveLeft = true;\r\n\r\n while(visitedCells < cellCount) {\r\n\r\n \r\n // determine where we can move\r\n cell.column = x;\r\n cell.row = i;\r\n\r\n if(0 == i) { cell.borderBottom = true; canMoveDown = false;moves-=1;} // can't move down\r\n if(0 == x) { cell.borderLeft = true; canMoveLeft = false;moves-=1;} // can't move left\r\n if(northRow == i) { cell.borderTop = true; canMoveUp = false;moves-=1;} // can't move up\r\n if(eastColumn == x) { cell.borderRight = true; canMoveRight = false;moves-=1;} //can't move right\r\n \r\n //mark the current cell as visited if it's not already visited\r\n cell.visited = true;\r\n \r\n\r\n if(0 == i && start == x) { cell.entrance = true; }\r\n if(i == (map.length - 1) && x == end) { cell.exit = true; }\r\n \r\n // this should be an impossible situation, but still worth checking\r\n if(moves > 0) {\r\n next_i = i;\r\n next_x = x;\r\n move = randomRun(moves);\r\n switch(move) {\r\n case 1: \r\n if(canMoveUp) { next_i += 1;direction=\"up\";} else { next_i -= 1;direction=\"down\";}; break;\r\n case 3: \r\n if(canMoveDown) { next_i -= 1;direction=\"down\";} else { next_i += 1;direction=\"up\";}; break;\r\n case 2: \r\n if(canMoveRight) { next_x += 1;direction=\"right\";} else { next_x -= 1;direction=\"left\";}; break;\r\n case 4: \r\n if(canMoveLeft) { next_x -= 1;direction=\"left\";} else { next_x += 1;direction=\"right\";}; break;\r\n } \r\n \r\n nextCell = map[next_i][next_x];\r\n\r\n if(!nextCell.visited) {\r\n //okay, we haven't visited the next cell so we need to knock down the borders\r\n visitedCells += 1;\r\n switch(direction) {\r\n case \"up\":\r\n cell.borderTop = false;\r\n nextCell.borderBottom = false;\r\n break;\r\n case \"down\":\r\n cell.borderBottom = false;\r\n nextCell.borderTop = false;\r\n break;\r\n case \"right\":\r\n cell.borderRight = false;\r\n nextCell.borderLeft = false;\r\n break;\r\n case \"left\":\r\n cell.borderLeft = false;\r\n nextCell.borderRight = false;\r\n break;\r\n }\r\n\r\n if(0 == next_i && start == next_x) { nextCell.entrance = true;}\r\n if(next_i == (map.length - 1) && next_x == end) { nextCell.exit = true;}\r\n } \r\n //move the active cell to the next cell\r\n map[i][x] = cell;\r\n map[next_i][next_x] = nextCell;\r\n\r\n i = next_i;\r\n x = next_x;\r\n cell = map[i][x];\r\n }\r\n\r\n //reset variables for the next time through\r\n canMoveUp = true;\r\n canMoveDown = true;\r\n canMoveRight = true;\r\n canMoveLeft = true;\r\n moves = 4;\r\n }; \r\n\r\n return map; \r\n}", "function nodeChildrenAsMap(node){var map$$1={};if(node){node.children.forEach(function(child){return map$$1[child.value.outlet]=child;});}return map$$1;}", "function nodesFromMaze(maze, start) {\n return maze.map( function(row, x) {\n return row.map( function(ele, y) {\n if ( ele ) return { wall: true };\n\n return {\n x,\n y,\n gScore: Infinity,\n fScore: Infinity,\n wall: false,\n neighbors: [],\n cameFrom: undefined,\n toString: function () {\n return String( x ) + \",\" + String( y );\n }\n };\n });\n });\n }", "function mapNodes() {\r\n\tnodes = {};\r\n\tvar node;\r\n\tfor (let i = 0; i < nodesPayload.length; i++) {\r\n\t\tnode = nodesPayload[i];\r\n\t\tif (node.nodeId) nodes[node.nodeId] = node;\r\n\t}\r\n}", "function mapLinesAndNodes(line_map )\n{\n\tvar slot_array = []; // index --> gfx\n\t\n\tfunction sortXHaplo(pos_y, id, fid ){\n\t\tvar key = fid+'_'+id;\n\n\t\tfor (var k=0; k < slot_array.length; k ++){\n\t\t\tif (key === slot_array[k][0]){\n\t\t\t\tslot_array.splice(k,1);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tslot_array.push( [key,pos_y] );\n\t}\n\n\t// The line map is a generation array, so has a very top-bottom\n\t// approach in line placement\n\tvar line_points = {};\n\tvar end_point_nodes_drawn = {}; // Nodes with lines already attached (no multiple lines)\n\n\t\n\tfunction addLinePoint( fid, key, obj )\n\t{\n\t\tif (key in line_points[fid]){\n\t\t\tvar eski_obj = line_points[fid][key],\n\t\t\t\teski_dos = eski_obj.dos\n\n\t\t\tif (obj.dos < eski_dos){\n\t\t\t\tline_points[fid][key] = obj; // Use new object if has a lower DOS\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tline_points[fid][key] = obj;\n\t\t}\n\t}\n\n\tfor (var fid in line_map){\n\t\tvar start_y = 0;\n\t\tvar drop_amount = 50;\n\n\t\tline_points[fid] = {};\n\n\t\tvar back_step = 10;\n\n\t\tfor (var g=0; g < line_map[fid].length; g++){\n\n//\t\t\tconsole.log(\"gen=\", g, line_map[fid][g])\n\n\n\t\t\t// ConnectEEs and connectERs... FUCK THIS\n\t\t\tfor (var sgroup in line_map[fid][g])\n\t\t\t{\n//\t\t\t\tconsole.log(\"SIB GROUP\", sgroup)\n\t\t\t\t//start_y += drop_amount;\n\n\t\t\t\tvar directline = line_map[fid][g][sgroup].directlines,\n\t\t\t\t\tmateline = line_map[fid][g][sgroup].matelines;\n\n\t\t\t\tfor (var mline in mateline)\n\t\t\t\t{\n\t\t\t\t\tvar parents = mline.split('_'),\n\t\t\t\t\t\tfath_id = parents[0],\n\t\t\t\t\t\tmoth_id = parents[1];\n\n\t\t\t\t\t//Place moth + fath\n\t\t\t\t\tsortXHaplo( start_y , fath_id, fid );\n\t\t\t\t\tsortXHaplo( start_y, moth_id, fid );\n\n\t\t\t\t\t// Add mate line\n\t\t\t\t\tvar consang = uniqueGraphOps.getFam(fid).edges['m:'+fath_id+'-'+moth_id].consangineous;\n\n\t\t\t\t\taddLinePoint(\n\t\t\t\t\t\tfid, fath_id,\n\t\t\t\t\t\t{to:moth_id, consang:consang, drop:null, text:null, lastgen:(g==line_map[fid].length-1)}\n\t\t\t\t\t);\n\t\t\t\t\t\n\t\t\t\t\t// Sib line from mateline\n\t\t\t\t\tvar dos = mateline[mline];\n\n\t\t\t\t\tlet isLastGen = (g==line_map[fid].length-1);\n\t\t\t\t\tif (isLastGen){\n\t\t\t\t\t\taddLinePoint(\n\t\t\t\t\t\t\tfid, fath_id+'_'+moth_id,\n\t\t\t\t\t\t\t{to: sgroup, consang: false, drop:drop_amount, \n\t\t\t\t\t\t\ttext: dos, lastgen:isLastGen}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Directline\n\t\t\t\tfor (var dline in directline)\n\t\t\t\t{\n\t\t\t\t\t// Check if dline key is not already part of a mating, (just use that)\n\t\t\t\t\t// Easier to check here than upstream\n\t\t\t\t\tvar found_existing_mateline = false;\n\t\t\t\t\tvar linep_keys = Object.keys(line_points[fid])\n\n\t\t\t\t\tfor (var kk=0; kk < linep_keys.length; kk ++){\n\t\t\t\t\t\tvar key_ids = linep_keys[kk].split('_');\n\n\t\t\t\t\t\tif (key_ids.length != 2) key_ids = [key_ids]\n\n\t\t\t\t\t\tfor (var ik=0; ik < key_ids.length; ik ++){\n\t\t\t\t\t\t\tif (dline === key_ids[ik]){\n\t\t\t\t\t\t\t\tfound_existing_mateline = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (found_existing_mateline) break;\n\n\t\t\t\t\t\t// Doesn't work for 76521 - 76611 - 5 - 7 - 8 for fam 1004\n\t\t\t\t\t\t// but only because 76611 is not related to 5 at all (step mother?)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!(found_existing_mateline)){\n\t\t\t\t\t\tstart_y += drop_amount;\n\n\t\t\t\t\t\tsortXHaplo( start_y, dline, fid );\n\n\t\t\t\t\t\tvar dos = directline[dline]\n\n\t\t\t\t\t\taddLinePoint(\n\t\t\t\t\t\t\tfid, dline, \n\t\t\t\t\t\t\t{to:sgroup, consang:false, drop:drop_amount, \n\t\t\t\t\t\t\t text:dos, lastgen:(g==line_map[fid].length-1)}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t//Iterate over all sibs and hang from anchor\n\t\t\t\tvar sib_ids = sgroup.split('_');\n\t\t\t\tvar sib_stepper = (start_y + drop_amount); // + (back_step*(sib_ids.length -1));\n\n\t\t\t\tfor (var s=0; s < sib_ids.length; s++)\n\t\t\t\t{\n\t\t\t\t\tsortXHaplo(sib_stepper, sib_ids[s], fid );\n\t\t\t\t\t// addLinePoint( fid, sib_ids[s], {to:sib_ids[s-1]})\n\t\t\t\t}\n\t\t\t} // end sib group\n\t\t} // end gen\n\t} // end fam\n\n//\tconsole.log(\"line_map\", line_points, \"slot_array\", slot_array)\n\treturn {lp: line_points, sa: slot_array};\n}", "function challenge() {\n const new_rows = nodes.length;\n const new_cols = nodes[0].length;\n\n console.log(new_rows, new_cols, nodes.length, nodes[0].length);\n\n // Making Changes\n for (let row = 0; row < new_rows; ++row) {\n for (let col = 0; col < new_cols; ++col) {\n // count live neighbors for each cell\n let live_neighbors = 0;\n for (let neigh of neighbors) {\n // row and column of neighbouring cell\n let r = row + neigh[0];\n let c = col + neigh[1];\n\n // Verifying the existence of the new cell and alive.\n\n if (r < new_rows && r >= 0 && c < new_cols && c >= 0) {\n const id = parseInt(nodes[r][c].getAttribute(\"id\"));\n if (Math.abs(id) == 1) live_neighbors += 1;\n }\n }\n\n // Rule 1 or Rule 2\n const id = Math.abs(parseInt(nodes[row][col].getAttribute(\"id\")));\n if (id == 1 && (live_neighbors < 2 || live_neighbors > 3)) {\n nodes[row][col].setAttribute(\"id\", -1);\n }\n\n // Rule 4\n if (id == 0 && live_neighbors == 3) {\n nodes[row][col].setAttribute(\"id\", 2);\n }\n\n // Rule 3 -> left unchanged when the live cell has 2 or more live neighbors\n }\n }\n}", "function getUnvisitedNeighbors(node, grid) {\n const neighbors = [];\n const { col, row } = node;\n if (row > 0) neighbors.push(grid[row - 1][col]);\n if (row < grid.length - 1) neighbors.push(grid[row + 1][col]);\n if (col > 0) neighbors.push(grid[row][col - 1]);\n if (col < grid[0].length - 1) neighbors.push(grid[row][col + 1]);\n return neighbors.filter((node) => !node.isVisited && !node.isWall);\n}", "function CreateHallwayFromNodes(node1, node2)\n{\n\n // first off, we have to find the path from one node to the other\n var HallwayPath = Findpath(node1.x, node1.y, node2.x, node2.y);\n\n // generate a hallwaytile on each tile in the path that was returned\n HallwayPath.forEach(function(item,index){\n\n // we are replacing the tile with a new hallway tile\n // however, for the next hallway to be generated properly, we need to keep this tiles neighbours!\n var CurrentNeighbors = Tiles[item.x][item.y].Neighbours;\n\n Tiles[item.x][item.y] = new HallwayTile(item.x,item.y);\n Tiles[item.x][item.y].Neighbours = CurrentNeighbors;\n\n });\n\n\n \n\n\n /*\n var CurrentTileX = 0;\n var CurrentTileY = 0;\n\n var YFix = 0;\n var XFix = 0;\n\n // make a hallway to the same y from the first node to the second\n var Y_Offset = node2.y - node1.y;\n var YDirection = 0;\n var Ylength = Math.abs(Y_Offset);\n if (Y_Offset > 0)\n {\n YDirection = 1;\n }\n else if (Y_Offset < 0)\n {\n YDirection = -1;\n }\n\n for(var lengthY = 0; lengthY < Ylength; lengthY++)\n {\n // create the hallway tile from the first room node to the y-axis of the second room node\n CurrentTileX = node1.x;\n CurrentTileY = node1.y + (YDirection * lengthY);\n\n CreateHallwayTile(CurrentTileX, CurrentTileY, 'y', YDirection);\n DrawGrid();\n }\n\n // repeat the process for the x-axis (to-do, refunction this into it's own function)\n var X_Offset = node2.x - node1.x;\n var XDirection = 0;\n var Xlength = Math.abs(X_Offset);\n if (X_Offset > 0)\n {\n XDirection = 1;\n }\n else if (X_Offset < 0)\n {\n XDirection = -1;\n }\n\n for(var lengthX = 0; lengthX < Xlength; lengthX++)\n {\n\n CurrentTileX = node1.x + (XDirection * lengthX);\n CurrentTileY = node1.y + Y_Offset;\n\n CreateHallwayTile(CurrentTileX, CurrentTileY, 'x', XDirection);\n }\n */\n}", "function change(m) {\n var result = create(m.length);\n for (var i = 0; i < m.length; i++) {\n for (var j = 0; j < m.length; j++) {\n var n = neighbors(m, i, j);\n if (m[i][j] == 0) {\n if (n == 3) {\n result[i][j] = 1;\n } else {\n result[i][j] = 0;\n }\n } else {\n if (n <= 1 || n >= 4) {\n result[i][j] = 0;\n } else {\n result[i][j] = 1;\n }\n }\n }\n }\n return result;\n}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\tvar p = start;\n\n\tdo {\n\n\t\tvar a = p.prev, b = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim );\n\t\t\ttriangles.push( p.i / dim );\n\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t// remove two nodes involved\n\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn p;\n\n}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\tvar p = start;\n\n\tdo {\n\n\t\tvar a = p.prev, b = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim );\n\t\t\ttriangles.push( p.i / dim );\n\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t// remove two nodes involved\n\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn p;\n\n}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\tvar p = start;\n\n\tdo {\n\n\t\tvar a = p.prev, b = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim );\n\t\t\ttriangles.push( p.i / dim );\n\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t// remove two nodes involved\n\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn p;\n\n}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\tvar p = start;\n\n\tdo {\n\n\t\tvar a = p.prev, b = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim );\n\t\t\ttriangles.push( p.i / dim );\n\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t// remove two nodes involved\n\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn p;\n\n}", "function countAliveNeighbours(map, x, y)\n{\n var count = 0;\n for (var i = -1; i < 2; i++)\n {\n for (var j = -1; j < 2; j++)\n {\n var nb_x = i + x;\n var nb_y = j + y;\n if (i === 0 && j === 0)\n {\n }\n //If it's at the edges, consider it to be solid (you can try removing the count = count + 1)\n else if (nb_x <= 0 || nb_y <= 0 || nb_x >= map[0].length - 2 || nb_y >= map.length - 2)\n count = count + 1;\n else if (map[nb_y][nb_x] === 1)\n count = count + 1;\n }\n }\n return count;\n}", "function get_input_map(nodes) {\n\n var in_map = new Map();\n for (var node_id of nodes.keys()) {\n for (var value_id of nodes.get(node_id).children.keys()) {\n if (value_id in in_map) {\n in_map[value_id].push(node_id);\n } else {\n in_map[value_id] = [];\n in_map[value_id].push(node_id);\n }\n }\n }\n //sort node ids (left edges have lower order in argument list than right edges)\n for (var key in in_map)\n in_map[key].sort(function (a, b) {\n return b - a\n });\n console.log(\"in map: \", in_map);\n return in_map;\n}", "function updateUnvisitedNeighbors(node, grid) {\n const unvisitedNeighbors = getUnvisitedNeighbors(node, grid);\n for (const neighbor of unvisitedNeighbors) {\n if (neighbor.distance > node.distance + 1) {\n neighbor.distance = node.distance + 1;\n neighbor.previousNode = node;\n heap.updateItem(neighbor);\n }\n }\n}", "generateGraph(){\n const start=new Node(0)\n start.setNodeType(\"Start\")\n //const end = new Node(-5)\n\n const graph = new Graph(start)\n\n const map = this.state.electricMap\n //console.log(map)\n let dataLength = this.state.electricMap.length;\n let nodeArray=[]\n for(let i=0;i<dataLength;i++){\n let nodeData = map[i];\n //console.log(nodeData)\n let tempNode = new Node(nodeData.id)\n tempNode.setCurrentPower(nodeData.currentPower)\n tempNode.setNodeType(nodeData.type)\n tempNode.setBranch(nodeData.branch)\n tempNode.setCapacity(nodeData.capacity)\n tempNode.setIsTripped(nodeData.isTripped)\n tempNode.setFaultCurrent(nodeData.faultCurrent)\n tempNode.setSwitchType(nodeData.switchType)\n nodeArray.push(tempNode)\n }\n //nodeArray.push(end)\n graph.addVertertices(nodeArray)\n let allPrimarys = graph.findPrimary();\n for(let i=0;i<allPrimarys.length;i++){\n start.setAdjacent(allPrimarys[i],0)\n }\n //console.log(graph)\n\n let allVertices=graph.getVertices()\n for(let i=0;i<dataLength;i++){\n let nodeData = map[i]\n let nodeAdjacents = \"[\"+nodeData.adjecent+\"]\"\n let nodesJson = JSON.parse(nodeAdjacents)\n //console.log(nodesJson)\n let vertex = allVertices[i+1];\n for(let j=0;j<nodesJson.length;j++){\n let nodeID=nodesJson[j][0]\n let nodeWeight = Number(nodesJson[j][1])\n let nodeLength = Number(nodesJson[j][2])\n let nodeConductivity = Number(nodesJson[j][3])\n let node = graph.getVertex(nodeID)\n if(node!==undefined && nodeWeight!==NaN){\n if(nodeID!==-2){\n if(vertex.getNodeType()===\"Start\"){\n vertex.setAdjacent(node,0,0,0)\n }\n vertex.setAdjacent(node,nodeWeight,nodeLength,nodeConductivity)\n }\n\n //console.log(vertex.getNodeId()+\",\"+node.getNodeId())\n }\n\n }\n }\n this.setState({\n graph: graph\n })\n //console.log(graph,this.state.graph)\n }", "function drawTriangle(t) {\n\tfor (var i = 0; i < 3; i++) {\n\t\tt.moveForward(100);\n\t\tt.turnRight(120);\n\t}\n}", "function cureLocalIntersections(data, start, triangles, dim) {\n var node = start;\n do {\n var a = node.prev,\n b = node.next.next;\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (a.i !== b.i && intersects(data, a.i, node.i, node.next.i, b.i) &&\n locallyInside(data, a, b) && locallyInside(data, b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(node.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n a.next = b;\n b.prev = a;\n\n var az = node.prevZ,\n bz = node.nextZ && node.nextZ.nextZ;\n\n if (az) az.nextZ = bz;\n if (bz) bz.prevZ = az;\n\n node = start = b;\n }\n node = node.next;\n } while (node !== start);\n\n return node;\n}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\t\tvar p = start;\n\n\t\tdo {\n\n\t\t\tvar a = p.prev, b = p.next.next;\n\n\t\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\t\ttriangles.push( a.i / dim );\n\t\t\t\ttriangles.push( p.i / dim );\n\t\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t\t// remove two nodes involved\n\n\t\t\t\tremoveNode( p );\n\t\t\t\tremoveNode( p.next );\n\n\t\t\t\tp = start = b;\n\n\t\t\t}\n\n\t\t\tp = p.next;\n\n\t\t} while ( p !== start );\n\n\t\treturn p;\n\n\t}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\t\tvar p = start;\n\n\t\tdo {\n\n\t\t\tvar a = p.prev, b = p.next.next;\n\n\t\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\t\ttriangles.push( a.i / dim );\n\t\t\t\ttriangles.push( p.i / dim );\n\t\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t\t// remove two nodes involved\n\n\t\t\t\tremoveNode( p );\n\t\t\t\tremoveNode( p.next );\n\n\t\t\t\tp = start = b;\n\n\t\t\t}\n\n\t\t\tp = p.next;\n\n\t\t} while ( p !== start );\n\n\t\treturn p;\n\n\t}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\t\tvar p = start;\n\n\t\tdo {\n\n\t\t\tvar a = p.prev, b = p.next.next;\n\n\t\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\t\ttriangles.push( a.i / dim );\n\t\t\t\ttriangles.push( p.i / dim );\n\t\t\t\ttriangles.push( b.i / dim );\n\n\t\t\t\t// remove two nodes involved\n\n\t\t\t\tremoveNode( p );\n\t\t\t\tremoveNode( p.next );\n\n\t\t\t\tp = start = b;\n\n\t\t\t}\n\n\t\t\tp = p.next;\n\n\t\t} while ( p !== start );\n\n\t\treturn p;\n\n\t}", "function initMap(loc) {\n map = new Array(50);\n traps = new Array(50);\n deadEnded = false;\n searchStack = [];\n for (var x = 0; x < map.length; x++) {\n map[x] = new Array(50).fill(0);\n traps[x] = new Array(50).fill(0);\n }\n map[loc.row][loc.col] = 1; // add visit to start cell\n traps[loc.row][loc.col] = 1; // note lava trap in start cell\n}", "function addNeighbour(relativePosition, n, i, dx, dy) {\n if (hexagons[n].cluster_id !== hexagons[m].cluster_id) {\n hexagons[n].borders.push(i);\n\n }\n\n hexagons[n].neighbours[i] = {};\n hexagons[n].neighbours[i].type = relativePosition;\n hexagons[n].neighbours[i].topic_id = hexagons[m].topic_id;\n hexagons[n].neighbours[i].dx = dx;\n hexagons[n].neighbours[i].dy = dy;\n hexagons[n].neighbours[i].d2 = d2;\n hexagons[n].neighbours[i].sideNo = i;\n }", "fillMap() {\n const layout = this.config.layout || [[]];\n\n // First pass to assign basic walls\n layout.forEach((row, y) => {\n row.forEach((col, x) => {\n if (col === 1) {\n this.groundLayer.putTileAt(TILES.FLOOR.BASIC, x, y);\n return;\n }\n\n const isWall = Object.values(getNeighbors(x, y))\n .reduce((a, pos) => isFloorTile(layout, pos) || a, false);\n\n if (isWall) {\n layout[y][x] = 2;\n }\n });\n });\n\n // Second pass to determine wall orientation\n layout.forEach((row, y) => {\n row.forEach((col, x) => {\n if (col < 2) {\n return;\n }\n\n const neighbors = getNeighbors(x, y);\n\n let wallHash = 0;\n if (isWallTile(layout, neighbors.t)) {\n wallHash |= WALL_FLAGS.TOP;\n }\n if (isWallTile(layout, neighbors.r)) {\n wallHash |= WALL_FLAGS.RIGHT;\n }\n if (isWallTile(layout, neighbors.b)) {\n wallHash |= WALL_FLAGS.BOTTOM;\n }\n if (isWallTile(layout, neighbors.l)) {\n wallHash |= WALL_FLAGS.LEFT;\n }\n\n switch (wallHash) {\n case 1:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.CAP_BOTTOM, x, y);\n break;\n case 2:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_LEFT, x, y);\n break;\n case 3:\n this.groundLayer.putTileAt(TILES.CORNER.BOTTOM_LEFT, x, y);\n break;\n case 4:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.CAP_TOP, x, y);\n break;\n case 5:\n this.groundLayer.putTileAt(TILES.WALL.VERTICAL.OPEN, x, y);\n break;\n case 6:\n this.groundLayer.putTileAt(TILES.CORNER.TOP_LEFT, x, y);\n break;\n case 7:\n this.groundLayer.putTileAt(TILES.T_CORNER.RIGHT, x, y);\n break;\n case 8:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_RIGHT, x, y);\n break;\n case 9:\n this.groundLayer.putTileAt(TILES.CORNER.BOTTOM_RIGHT, x, y);\n break;\n case 10:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.OPEN, x, y);\n break;\n case 11:\n this.groundLayer.putTileAt(TILES.T_CORNER.TOP, x, y);\n break;\n case 12:\n this.groundLayer.putTileAt(TILES.CORNER.TOP_RIGHT, x, y);\n break;\n case 13:\n this.groundLayer.putTileAt(TILES.T_CORNER.LEFT, x, y);\n break;\n case 14:\n this.groundLayer.putTileAt(TILES.T_CORNER.BOTTOM, x, y);\n break;\n case 15:\n this.groundLayer.putTileAt(TILES.T_CORNER.ALL, x, y);\n break;\n default:\n this.groundLayer.putTileAt(TILES.WALL.HORIZONTAL.CAP_BOTH, x, y);\n }\n });\n });\n }", "function createTriangles(){ \n\t\t/* Obj.triangles = [[0,1,2], [3,4,5], ...] */\n\t\tObj.triangles = [];\n\t\tfor(var i = 0; i<Obj.positions.length/3; ++i){\n\t\t\tObj.triangles[i] = [3*i, 3*i+1, 3*i+2];\n\t\t}\n\t}", "function createMap(maze) {\n const wallTile = \"\\x1b[32m# \\x1b[0m\";\n const floorTile = \"\\x1b[36m. \\x1b[0m\";\n\n let map = Array.from(Array(maze.length * 2 + 1)).map((line) =>\n Array.from(Array(maze.length * 2 + 1)).fill(\n wallTile,\n 0,\n maze.length * 2 + 1\n )\n );\n\n maze.map((line, lineIndex) => {\n line.map((cell, columnIndex) => {\n if (cell.visited) {\n map[lineIndex * 2 + 1][columnIndex * 2 + 1] = floorTile;\n cell.corridors.map((corridor) => {\n if (corridor.line > cell.line) {\n map[lineIndex * 2 + 2][columnIndex * 2 + 1] = floorTile;\n } else if (corridor.line < cell.line) {\n map[lineIndex * 2][columnIndex * 2 + 1] = floorTile;\n } else if (corridor.column > cell.column) {\n map[lineIndex * 2 + 1][columnIndex * 2 + 2] = floorTile;\n } else if (corridor.column < cell.column) {\n map[lineIndex * 2 + 1][columnIndex * 2] = floorTile;\n }\n });\n }\n });\n });\n\n return map.map((line) => line.join(\"\")).join(\"\\n\");\n}", "function drawMap() {\r\n\r\n let { grid, enemies } = game.map;\r\n \r\n grid.nodes.forEach(node => {\r\n // don't draw empty nodes\r\n if (node.type === 'empty') return;\r\n\r\n // draw tower node\r\n if (node.type === 'tower') {\r\n\r\n let towerImg = TOWER_IMAGES[node.tower.type];\r\n if (node.tower.level === 4) towerImg = towerImg.final;\r\n else towerImg = towerImg.base;\r\n if (node.tower.getOrientation().length > 5) towerImg = towerImg.diagonal;\r\n else towerImg = towerImg.regular;\r\n if (node.tower.getShooting()) towerImg = towerImg.shooting;\r\n else towerImg = towerImg.resting;\r\n\r\n console.log(node.tower.getShooting())\r\n\r\n // console.log(node.tower.getOrientation())\r\n display.drawImage(\r\n towerImg,\r\n node.col * NODE_SIZE,\r\n node.row * NODE_SIZE, \r\n NODE_SIZE, \r\n NODE_SIZE, \r\n node.tower.getOrientation()\r\n );\r\n\r\n // draw tower range if it is clicked by player\r\n if (node.isSelected()) {\r\n display.drawCircle(\r\n node.col * NODE_SIZE + (NODE_SIZE / 2),\r\n node.row * NODE_SIZE + (NODE_SIZE / 2),\r\n node.tower.range * NODE_SIZE,\r\n 'rgba(100, 100, 100, ',\r\n .2,\r\n );\r\n display.drawRectangle(\r\n node.col * NODE_SIZE,\r\n node.row * NODE_SIZE,\r\n NODE_SIZE,\r\n NODE_SIZE,\r\n SELECTED_COLOR,\r\n flashingTransparency,\r\n )\r\n } \r\n }\r\n \r\n if (node.isStart || node.isEnd) {\r\n // draw start and end node\r\n\r\n display.drawRectangle(\r\n node.col * NODE_SIZE,\r\n node.row * NODE_SIZE,\r\n NODE_SIZE,\r\n NODE_SIZE,\r\n NODE_IMAGES[node.type].color\r\n );\r\n\r\n display.drawImage(\r\n NODE_IMAGES[node.type].img,\r\n node.col * NODE_SIZE,\r\n node.row * NODE_SIZE, \r\n NODE_SIZE + 10, \r\n NODE_SIZE + 10, \r\n );\r\n }\r\n });\r\n\r\n // draw enemies to the map\r\n enemies.map(enemy => {\r\n display.drawImage(\r\n ENEMY_IMAGES[enemy.type],\r\n enemy.x - ENEMY_SIZE / 2, \r\n enemy.y - ENEMY_SIZE / 2,\r\n ENEMY_SIZE,\r\n ENEMY_SIZE,\r\n enemy.getOrientation()\r\n )\r\n\r\n // draw enemy health bar\r\n display.drawRectangle(\r\n enemy.x - (HEALTHBAR.width / 2),\r\n enemy.y - (ENEMY_SIZE / 1.5),\r\n HEALTHBAR.width,\r\n HEALTHBAR.height,\r\n HEALTHBAR.color1,\r\n )\r\n\r\n // draw enemy health in health bar\r\n display.drawRectangle(\r\n enemy.x - (HEALTHBAR.width / 2),\r\n enemy.y - (ENEMY_SIZE / 1.5),\r\n HEALTHBAR.width * (enemy.currentHealth / enemy.startingHealth),\r\n HEALTHBAR.height,\r\n HEALTHBAR.color2,\r\n )\r\n\r\n // draw enemy status\r\n if (enemy.status === 'fire') {\r\n display.drawCircle(\r\n enemy.x, \r\n enemy.y,\r\n ENEMY_SIZE / 2,\r\n 'rgba(255, 50, 50, ',\r\n flashingTransparency,\r\n );\r\n }\r\n\r\n if (enemy.status === 'frozen') {\r\n display.drawCircle(\r\n enemy.x, \r\n enemy.y,\r\n ENEMY_SIZE / 2,\r\n 'rgba(100, 100, 255, ',\r\n flashingTransparency,\r\n );\r\n }\r\n });\r\n}", "function cureLocalIntersections(start, triangles, dim) {\n\n\tvar p = start;\n\n\tdo {\n\n\t\tvar a = p.prev,\n\t\t b = p.next.next;\n\n\t\tif (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n\t\t\ttriangles.push(a.i / dim);\n\t\t\ttriangles.push(p.i / dim);\n\t\t\ttriangles.push(b.i / dim);\n\n\t\t\t// remove two nodes involved\n\n\t\t\tremoveNode(p);\n\t\t\tremoveNode(p.next);\n\n\t\t\tp = start = b;\n\t\t}\n\n\t\tp = p.next;\n\t} while (p !== start);\n\n\treturn p;\n}", "function Trie() {\n\t}", "function getUnvisitedNeighbors(node, grid) {\n const neighbors = [];\n const {col, row} = node;\n if(row > 0) neighbors.push(grid[row - 1][col]); // above\n if(col < grid[0].length - 1) neighbors.push(grid[row][col + 1]) // to the right\n if(row < grid.length - 1) neighbors.push(grid[row + 1][col]); // below \n if(col > 0) neighbors.push(grid[row][col - 1]); // to the left\n \n // if(row > 0 && col < grid[0].length - 1) neighbors.push(grid[row - 1][col + 1]) // upper right\n // if(row < grid.length - 1 && col < grid[0].length - 1) neighbors.push(grid[row + 1][col + 1]);\n // if(row < grid.length - 1 && col > 0) neighbors.push(grid[row + 1][col - 1]);\n // if(row > 0 && col > 0) neighbors.push(grid[row - 1][col - 1])\n return neighbors.filter(neighbor => !neighbor.visited);\n}", "function Nodes(map) {\n\t\tNodes.superclass.constructor.call(this, map);\n\t}", "static cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev, b = p.next.next;\n if (!GraphicsGeometry.equals(a, b) && GraphicsGeometry.intersects(a, p, p.next, b) && GraphicsGeometry.locallyInside(a, b) && GraphicsGeometry.locallyInside(b, a)) {\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n // remove two nodes involved\n GraphicsGeometry.removeNode(p);\n GraphicsGeometry.removeNode(p.next);\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n return p;\n }", "function Triangle( v1, v2, v3, a, b, c ) {\n\n\t\tthis.a = a;\n\t\tthis.b = b;\n\t\tthis.c = c;\n\n\t\tthis.v1 = v1;\n\t\tthis.v2 = v2;\n\t\tthis.v3 = v3;\n\n\t\tthis.normal = new Vector3();\n\n\t\tthis.computeNormal();\n\n\t\tv1.faces.push( this );\n\t\tv1.addUniqueNeighbor( v2 );\n\t\tv1.addUniqueNeighbor( v3 );\n\n\t\tv2.faces.push( this );\n\t\tv2.addUniqueNeighbor( v1 );\n\t\tv2.addUniqueNeighbor( v3 );\n\t\tv3.faces.push( this );\n\t\tv3.addUniqueNeighbor( v1 );\n\t\tv3.addUniqueNeighbor( v2 );\n\n\t}", "function makeTriangles (l, d, u, r) {\n var triangles = {\n left: l,\n down: d,\n up: u,\n right: r,\n display: displayTriangles,\n move: moveTriangles\n }\n return triangles;\n}", "function nodeChildrenAsMap(node) {\n var map = {};\n\n if (node) {\n node.children.forEach(function (child) {\n return map[child.value.outlet] = child;\n });\n }\n\n return map;\n }", "function nodeChildrenAsMap(node) {\n var map = {};\n if (node) {\n node.children.forEach(function (child) { return map[child.value.outlet] = child; });\n }\n return map;\n}", "function getAllNodesNeighborhood(){\n\t\tglobalData.nodes.map(function(node){\n\t\t\tnode.neighbors = getNeighborhoodLabels(node.index)\n\t\t\tneighborhoodLengths.push(node.neighbors.length)\n\t\t\td3.select('#' + node.label)\n\t\t\t\t.attr('neighborhood', node.neighbors.toString())\n\t\t})\n\t}", "constructor(t, i, j) {\n this._terrain = void 0;\n this._info = void 0;\n this._node = void 0;\n this._renderable = void 0;\n this._index = [1, 1];\n this._weightMap = null;\n this._lightmapInfo = null;\n this._terrain = t;\n this._info = t.getBlockInfo(i, j);\n this._index[0] = i;\n this._index[1] = j;\n this._lightmapInfo = t._getLightmapInfo(i, j);\n this._node = new PrivateNode(''); // @ts-ignore\n\n this._node.setParent(this._terrain.node); // @ts-ignore\n\n\n this._node._objFlags |= legacyCC.Object.Flags.DontSave;\n this._renderable = this._node.addComponent(TerrainRenderable);\n }", "function _InitNodeTypeWorld ( type ) {\n if (type.connections) return (type);\n if (type.transform === '') type.transform = 'translate3d(0,0,0)';\n\n var matrix3d = _GetMatrixCSS (type.transform);\n var verts = [\n new Vector( 0, type.height, 0),\n new Vector( type.width, type.height, 0),\n new Vector( type.width, 0, 0),\n new Vector( 0, 0, 0)\n ];\n\n for (var i = 0; i < verts.length; ++i)\n {\n var curr = verts[i];\n \n curr.x -= type.width / 2;\n curr.y -= type.height / 2;\n curr.applyMatrix4 ( matrix3d );\n curr.x += type.width / 2;\n curr.y += type.height / 2;\n }\n\n type.vertices = verts;\n\n // now do the connections\n var edges = [\n // top\n new Vector( type.width / 2, 0, 0),\n\n // right\n new Vector( type.width, type.height / 2, 0),\n\n // bottom\n new Vector( type.width / 2, type.height, 0),\n\n // left\n new Vector( 0, type.height / 2, 0)\n ];\n\n for (var i = 0; i < edges.length; ++i)\n {\n var curr = edges[i];\n \n curr.x -= type.width/2;\n curr.y -= type.height/2;\n curr.applyMatrix4 ( matrix3d );\n curr.x += type.width/2;\n curr.y += type.height/2;\n }\n\n type.connections = edges;\n }", "function mapNode(node, f) {\n // check null first since typeof null is \"object\".\n if (node === null) {\n return f(node);\n } else if (node.constructor === Array) {\n return node.map(f);\n } else if (typeof(node) === 'object') {\n var out = {};\n for (var key in node) {\n out[key] = f(node[key]);\n }\n return out;\n } else {\n return f(node);\n }\n }", "function fillNeighborhoodNodes(nodeIndex, color){// Fill neighborhood \n\t\tlet v = d3.select('#node' + nodeIndex)\n\t\tlet neighborhood = v.attr('neighborhood').split(',')\n\t\tif(neighborhood.length)\n\t\t\tneighborhood.map(function(neighborLabel){\n\t\t\t\tlet node = d3.select('#' + neighborLabel)\n\t\t\t\tif(!node.attr('clique-part'))\n\t\t\t\t\tnode.attr('fill', color)\n\t\t\t\tshowNodeLabelText(neighborLabel)\n\t\t\t})\n\t}", "function populateEntryTile(entryNode,nodeArray){\n for (var i=0; i<nodeArray.length; i++){\n if (nodeArray[i].id == entryNode){\n nodeArray[i].distance = 0;\n nodeArray[i].visited = true;\n nodeArray[i].backgroundcolor = nodeArray[i].backgroundcolor[nodeArray[i].distance];\n document.getElementById(entryNode).style.backgroundColor = nodeArray[i].backgroundcolor;\n }\n }\n return nodeArray; \n}", "function Triangle() {\n var that = this;\n\n if (typeof Triangle.layer == 'undefined')\n Triangle.layer = new paper.Layer();\n\n this.path = new paper.Path();\n this.path.strokeColor = 'black';\n this.vertices = [];\n this.isFinished = false;\n\n /***********/\n this.addVertex = function(vertex) {\n if (that.isFinished) {\n return true;\n }\n\n vertex.isUsedForTriangle = true;\n vertex.setVisible(true);\n\n vertex.addTriangle(that);\n that.vertices.push(vertex);\n that.path.add(vertex.position);\n\n if (that.vertices.length == 3) {\n for (var i = 0; i < that.vertices.length; ++i) {\n that.vertices[i].isUsedForTriangle = false;\n that.vertices[i].setVisible(false);\n }\n\n that.isFinished = true;\n that.path.closed = true;\n that.path.fillColor = 'red';\n that.path.strokeWidth = 0;\n Triangle.layer.addChild(that.path);\n return true;\n }\n else {\n return false;\n }\n }\n\n /***********/\n this.erase = function() {\n var currentVertices = that.vertices.slice(0);\n for (var i = 0; i < currentVertices.length; ++i) {\n currentVertices[i].removeFrom(that);\n }\n\n that.vertices = [];\n that.path.remove();\n }\n\n /***********/\n this.movePointTo = function(x1, y1, x2, y2) {\n for (var i = 0; i < that.path.segments.length; i++) {\n if (that.path.segments[i].point.x == x1 || that.path.segments[i].point.y == x2) {\n that.path.segments[i].point.x = x2;\n that.path.segments[i].point.y = y2;\n }\n }\n }\n \n /***********/\n this.setColorFromRaster = function(raster) {\n var center = new paper.Point(0, 0);\n for (var i = 0; i < that.vertices.length; i++) {\n center.x += that.vertices[i].position[0];\n center.y += that.vertices[i].position[1];\n }\n center.x /= 3;\n center.y /= 3;\n\n that.path.fillColor = raster.getPixel(center.x, center.y);\n }\n}", "function copyMapAddGoal(departure){\n\tlet specialMap = new Map();\n\t//then re-point the nodes.\n\tfor(let city of cityMap){\n\n\t\tlet name = city[0];\n\t\t//if we don't call new, we'll mutate the master copy of cityMap!\n\t\tlet neighbors = new Map(city[1]);\n\n\t\tspecialMap.set(name, neighbors);\n\n\t\tfor(let n of neighbors){\n\t\t\tlet nbrName = n[0];\n\t\t\tlet nbrDist = n[1];\n\t\t\tif(nbrName == departure){\n\t\t\t\tneighbors.delete(nbrName);\n\t\t\t\tneighbors.set('$', nbrDist);\n\t\t\t}\n\t\t}\n\t}\n\n\tspecialMap.set('$', new Map());\n\treturn specialMap;\n}", "constructor() {\n this.nodes = new Map();\n }", "tintTile(){\r\n if (towers[stringFromCoords(this.coords)] != null && \r\n towers[stringFromCoords(this.coords)] != undefined){\r\n this.tint = 0x0000FF; \r\n return;\r\n }\r\n this.tint = 0x00FF00;\r\n }", "getNeighbors(node) {\n const neighbors = [];\n Object.values(node.walls).forEach((side) => {\n if (side instanceof Cell) {\n neighbors.push(side);\n }\n })\n return neighbors; \n }", "function populateValidTiles2(nodeArray, exitNode) {\n for (i = 0; i < nodeArray.length; i++) {\n if (nodeArray[i].visited == true) {\n if (nodeArray[i].distance == colordepth && nodeArray[i].id != exitNode) {\n document.getElementById(nodeArray[i].id).style.backgroundColor = nodeArray[i].backgroundcolor;\n }\n }\n }\n colordepth += 1;\n if (colordepth == maxRow*3) {\n clearInterval(timerId);\n theOptimalPath();\n }\n return nodeArray;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}", "function nodeChildrenAsMap(node) {\n var map = {};\n\n if (node) {\n node.children.forEach(function (child) {\n return map[child.value.outlet] = child;\n });\n }\n\n return map;\n}", "function cureLocalIntersections( start, triangles, dim ) {\n\n\tlet p = start;\n\tdo {\n\n\t\tconst a = p.prev,\n\t\t\tb = p.next.next;\n\n\t\tif ( ! equals( a, b ) && intersects( a, p, p.next, b ) && locallyInside( a, b ) && locallyInside( b, a ) ) {\n\n\t\t\ttriangles.push( a.i / dim | 0 );\n\t\t\ttriangles.push( p.i / dim | 0 );\n\t\t\ttriangles.push( b.i / dim | 0 );\n\n\t\t\t// remove two nodes involved\n\t\t\tremoveNode( p );\n\t\t\tremoveNode( p.next );\n\n\t\t\tp = start = b;\n\n\t\t}\n\n\t\tp = p.next;\n\n\t} while ( p !== start );\n\n\treturn filterPoints( p );\n\n}" ]
[ "0.57377946", "0.57224864", "0.54936296", "0.54827476", "0.54695934", "0.5370923", "0.5347439", "0.5266831", "0.5174743", "0.5151248", "0.50833434", "0.50790626", "0.50676394", "0.50285983", "0.4911989", "0.4893868", "0.48369232", "0.4821082", "0.4805183", "0.47834313", "0.47751355", "0.47748217", "0.4764494", "0.47627547", "0.47589815", "0.47517413", "0.4743375", "0.47384086", "0.4733348", "0.4733348", "0.4724742", "0.472154", "0.4704994", "0.4696197", "0.46841842", "0.46584782", "0.46505082", "0.4645768", "0.46314308", "0.46090373", "0.46079522", "0.46073496", "0.45984602", "0.4594651", "0.45945325", "0.45945325", "0.45945325", "0.45945325", "0.45937243", "0.45937115", "0.4593625", "0.4592119", "0.45837548", "0.4578922", "0.45783657", "0.45783657", "0.45783657", "0.45768476", "0.45708483", "0.4556858", "0.45550686", "0.45546913", "0.45542946", "0.45540398", "0.45524427", "0.45524013", "0.45517656", "0.45454156", "0.45396885", "0.45387504", "0.4538679", "0.4519836", "0.45192483", "0.4518882", "0.45161846", "0.45059082", "0.45041132", "0.44998905", "0.44968212", "0.44874495", "0.44840667", "0.44805247", "0.44749233", "0.44691175", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.44684786", "0.4466351", "0.44591108" ]
0.82703316
0
Point GetPoint(const int& index);
GetPoint(index) { return this.points_.at(index); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeInOffsetByIndex(x, y, index) {\n var outx = x + 15;\n var outy = y + 47 + index * 20;\n\n return { x: outx, y: outy };\n}", "function pointAt(index) {\n var y = Math.floor(index/w) * 1.5;\n var x = ((index + y/3) % w) * rt3;\n return {x: x, y: y};\n }", "get point() {}", "at(index) {}", "get(idx) {\n\n }", "function indexAt(point) {\n var row = Math.ceil(Math.floor(point.y/0.75)/2);\n var col = Math.ceil(Math.floor(2*point.x/rt3 - row)/2);\n col = (col % w + w) % w;\n if(row < 0 || row >= h){return undefined}\n return w * row + col;\n }", "function getPoint(x, gf) { return { 'x': x, 'y': gf(x)*-1 }; }", "function pointToIndex(x, y) {\n return x + y * map.cols;\n }", "getAt(idx) {\n\n }", "pointAt(i, result) {\n if (i >= 0 && i < this._points.length) {\n if (result) {\n result.setFrom(this._points[i]);\n return result;\n }\n return this._points[i].clone();\n }\n return undefined;\n }", "function index(obj,i) {return obj[i]}", "function index(obj,i) {return obj[i];}", "function getCellFromPoint(point) {\n var x = Math.floor(point.x / tile_size);\n var y = Math.floor(point.y / tile_size);\n var index = x + y * width;\n \n return grid.getChildAt(index);\n}", "function point(x, y) {\n return { x, y };\n}", "Point(x, y) {\n\t\treturn { x: x, y: y };\n\t}", "getVertex(index, out = null) {\n const { _coords } = this\n if (index >= 0 && index < this.numVertices) {\n out = out || new Point()\n out.setTo(_coords[index * 2], _coords[index * 2 + 1])\n return out\n } else throw new RangeError('[RangeError] Invalid index: ' + index)\n }", "locate( index ) {\n if( index < this.start ) index = this.start\n else if(index>this.end) index = this.end\n this.pos = index\n return this.current()\n }", "function getRealPosition( index ) {\n var stage = app.getDrawStage();\n return { 'x': stage.offset().x + index.x / stage.scale().x,\n 'y': stage.offset().y + index.y / stage.scale().y };\n }", "function findPointByCoordinates(x, y) {\n let point = null;\n pointsCollection.forEach(function (value) {\n if (value.getPosition().x === x && value.getPosition().y === y) {\n point = value;\n }\n });\n return point;\n}", "GetArrayElementAtIndex() {}", "function Point(x, y) {\n return {x: x, y: y}\n}", "function getPosX(nIndex){\n\treturn 30+(90 * nIndex);\n}", "getElementAtIndex(index) {\n return this.data[index];\n }", "function getPt(index) {\n\t var x = xa.c2p(d[index].x),\n\t y = ya.c2p(d[index].y);\n\t if(x === BADNUM || y === BADNUM) return false;\n\t return [x, y];\n\t }", "function findPointByCoords(point)\n{\n for (var i=0; i < points.length; i++)\n if (points[i].getRealX() == point.getRealX() && points[i].getRealY() == point.getRealY())\n return points[i];\n\n return null;\n}", "function getPt(index) {\n var x = xa.c2p(d[index].x);\n var y = ya.c2p(d[index].y);\n if(x === BADNUM || y === BADNUM) return false;\n return [x, y];\n }", "function getPt(id) {\n for (var i=0; i<points.length; i++) { \n if (points[i].id == id) { return points[i]; }\n }\n}", "function Point(x, y) {\n return {x, y}\n}", "function determinePosition(x, y) {\n return new Point(x, y);\n}", "function getPt(index) {\n var x = xa.c2p(d[index].x),\n y = ya.c2p(d[index].y);\n if(x === BADNUM || y === BADNUM) return false;\n return [x, y];\n }", "function getCellIndex(x, y) {\n return y * 10 + x;\n}", "function index(y,x)\r\n{\r\n if(x<0 || y<0|| x> n-1|| y> n-1)\r\n {\r\n return -1;\r\n }\r\n return x + y*n;\r\n}", "function Point(x, y) {\n return {x: x, y: y};\n}", "get(index) {\n if( index === undefined ) {\n return this.map.get(0);\n }\n else {\n return this.map.get(index);\n }\n }", "Point( x, y ) {\n return { x, y }\n }", "function find_pt(item, index) {\n if (xpos === item[0]) {\n if (map_hex_hgt === item[1] - 35) {\n hex_point = index;\n }\n }\n }", "constructor(indx,x,y)\n {\n this.index = indx;\n this.x = x;\n this.y = y;\n }", "function getIndexOfClosestPoint(kineticPoint) {\n var pt1 = kineticPoint.getPosition();\n for (var ii = 0; ii < points.length; ii++) {\n var pt2 = points[ii].getPosition();\n var dist = getSquareDistance(pt1, pt2);\n if (dist < DIST_LIMIT) {\n return ii;\n }\n }\n return -1;\n}", "function accessElementInArray(array, index){\n var element = array[index]\n return element\n}", "function getPt(index) {\n\t var x = xa.c2p(d[index].x),\n\t y = ya.c2p(d[index].y);\n\t if(x === badnum || y === badnum) return false;\n\t return [x, y];\n\t }", "at(x, y) {\n return this.grid[y][x];\n }", "getIndex() {\nreturn this.index;\n}", "IndexOf() {\n\n }", "function pt(x, y) { \n return new Point(x, y);\n}", "function accessElementInArray(array,index){\n return array[index]\n}", "function pointToMapArrIndex(point)\n\t{\t\n\t\tvar size = Math.floor(Math.sqrt(mapArr.length));\n\t\t//size*newY+newX\n\t\treturn (point[1] * size + point[0]);\n\t}", "function xGetEleAtPoint(x, y)\r\n{\r\n var he = null, z, hz = 0;\r\n var i, list = xGetElementsByTagName('*');\r\n for (i = 0; i < list.length; ++i) {\r\n if (xHasPoint(list[i], x, y)) {\r\n z = xZIndex(list[i]);\r\n z = z || 0;\r\n if (z >= hz) {\r\n hz = z;\r\n he = list[i];\r\n } \r\n }\r\n }\r\n return he;\r\n}", "function accessElementInArray(array, index){\nreturn array[index];\n}", "function pointToOffset(point) {\n var line = point && point.line\n var column = point && point.column\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n return (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return -1\n }", "function index(i, j){\n if (i < 0 || j < 0 || i > cols - 1 || j > rows - 1) {\n return -1;\n }\n return i + j * cols; \n}", "getCheckpoint (index) {\n for (var i = 0; i < this.checkpoints.length; i++) {\n if (this.checkpoints[i].id === index) {\n return this.checkpoints[i]\n }\n }\n }", "getKey(value, index) {\n return index;\n }", "function getXForIndex(idx, len) {\n return idx * getXStep(len);\n }", "function getCoordinates(index) {\n return [index % width, Math.floor(index / width)]\n}", "function accessElementInArray(array, index){\n return array[index];\n}", "function randomPoint(){\n\tx =(Math.random()*200)-100;\n\ty =(Math.random()*200)-100;\n\n\treturn new Point(x,y);\n}", "getAt(idx) {\n let curr = this.head;\n \n let i = 0;\n while(i < idx){\n if(curr){\n curr = curr.next;\n i ++\n } else {\n throw new Error(\"invalid index\");\n }\n }\n\n return curr.val;\n }", "function findPointByElement(element) {\n let point = null;\n pointsCollection.forEach(function (value) {\n if (value.getElement() === element) {\n point = value;\n }\n });\n return point;\n}", "static getIndexFromCoords(x, y, w) {\n return x + (y * w);\n }", "function index(i, j){\r\n if(i < 0 || j < 0 || i > cols-1 || j > rows-1){\r\n return -1;\r\n }\r\n return i + j * cols;\r\n}", "getPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}", "getPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}", "getPointAt( u, optionalTarget ) {\n\n\t\treturn this.getPoint( u, optionalTarget );\n\n\t}", "get(index) {\n if (index < 0 || index >= this.length) {\n throw new Error(\"Index error\");\n }\n return memory.get(this.ptr + index);\n }", "function getPoint(x, y){\n\t\t\tif( $.type(x) === 'array'){\n\t\t\t\ty = x[1];\n\t\t\t\tx = x[0];\n\t\t\t}\n\n\t\t\treturn new google.maps.LatLng(x, y);\n\t\t}", "getAt(idx) {\n if(idx >= this.length || idx < 0) {\n throw new Error(\"Invalid index.\");\n }\n return this._get(idx).val;\n }", "getPointAt(u, optionalTarget) {\n\n return this.getPoint(u, optionalTarget);\n\n }", "function getPion(x,y){\n for(let i = 0; i < pions.length; i++) {\n if(pions[i] != undefined)\n if(pions[i].position.x == x && pions[i].position.y == y) return i;\n }\n return undefined;\n}", "function findPointByElement(element)\n{\n for (var i=0; i < points.length; i++)\n if (points[i].element.is (element))\n return points[i];\n\n return null;\n}", "static getTarget(point) {\n let target = Registry.viewManager.snapToGrid(point);\n return [target.x, target.y];\n }", "static getTarget(point) {\n let target = Registry.viewManager.snapToGrid(point);\n return [target.x, target.y];\n }", "function randPoint () {\n\t\treturn allPoints[Math.floor(Math.random() * allPoints.length)];\n\t}", "getPoint() {\n return this;\n }", "getExactPoint(x, y) {\n for (let i = 0; i < this.circleArray.length; i++) {\n if (x > this.circleArray[i].x - 30 && x < this.circleArray[i].x + 30 && y > this.circleArray[i].y - 30 && y < this.circleArray[i].y + 30) {\n return {\n x: this.circleArray[i].x,\n y: this.circleArray[i].y\n }\n\n }\n }\n }", "function searchPointAt(x, y) {\n\t\tvar result = null;\n\t\tvar point = scope.bezierSpline.firstPoint;\n\t\twhile (point != null) {\n\t\t\tif (x <= point.x + Point.radius\n\t\t\t\t\t&& x >= point.x - Point.radius\n\t\t\t\t\t&& y <= point.y + Point.radius\n\t\t\t\t\t&& y >= point.y - Point.radius) {\n\t\t\t\tresult = point;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tpoint = point.next;\n\t\t}\n\t\treturn result;\n\t}", "function getIndex(id, array){ //function that returns the index of where a seat element object is\n\tfor(i=0; i<array.length; i++) {\n\t\tif(array[i].seat == id)\n\t\t{\n\t\t\treturn i;\n\t\t\tbreak;\n\t\t}\n}\n}", "function pointToOffset(point) {\n var line = point && point.line\n var column = point && point.column\n var offset\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n offset = (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return offset > -1 && offset < indices[indices.length - 1] ? offset : -1\n }", "function pointToOffset(point) {\n var line = point && point.line\n var column = point && point.column\n var offset\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n offset = (indices[line - 2] || 0) + column - 1 || 0\n }\n\n return offset > -1 && offset < indices[indices.length - 1] ? offset : -1\n }", "function Crimepoint(latlon, index){\n this.location = latlon;\n this.weight = index\n }", "function getPosition() {\n let position = document.getElementById(getyx(y,x));\n\treturn position;\n}", "function imageIndexOf(x,y) {\n return x+(y+2)*(maxX+3)+topImages+3; } // This is the simplified version", "function pointToOffset(point) {\n var line = point && point.line;\n var column = point && point.column;\n var offset;\n\n if (!isNaN(line) && !isNaN(column) && line - 1 in indices) {\n offset = (indices[line - 2] || 0) + column - 1 || 0;\n }\n\n return offset > -1 && offset < indices[indices.length - 1] ? offset : -1\n }", "function getCoordinates(index) {\n return [index % width, Math.floor(index / width)];\n }", "function getPoints() {}", "at(row, col) {\n\t\treturn this.cells[DokuCell.calculateIndex(row, col)]\n\t}", "getAt(idx) {\n if (idx < 0 || idx >= this.length) {\n throw new Error(\"Invalid index\");\n }\n\n let i = 0;\n let current = this.head;\n while (i < idx && current.next) {\n current = current.next;\n i++;\n }\n\n return current.val;\n }", "cellIndex(x, y) {\n var indexNumber = x + y*this.width;\n return this.cells[indexNumber];\n }", "get(index) {\n if(index < 0 || index >= this.length) {\n throw new Error('Index error')\n }\n return memory.get(this.ptr + index)\n }", "function nth(list, place){ \n return listToArray(list)[place]\n \n}", "pointAt( { x, y } ) {\n\t\tthis.hed = this.getHedTo( { x, y } );\n\t}", "get(point) {\r\n\t\tlet [x, y] = point.get;\r\n\t\treturn this.has(point) ? this.matrix[y][x] : undefined;\r\n\t}", "function getCoordinates(index) {\n return [index % width, Math.floor(index / width)]\n }", "function point_offset(i) {\n return 4*i;\n }", "function posToIndex(x, y) {\r\n\treturn x + (y * 32);\r\n}", "function listGet(list, idx) { return list.slice(idx)[0]; }", "getPointAt( u, optionalTarget ) {\n\n\t\t\treturn this.getPoint( u, optionalTarget );\n\n\t\t}", "getPointAt( u, optionalTarget ) {\n\n\t\t\treturn this.getPoint( u, optionalTarget );\n\n\t\t}", "function indexToPos(index) {\n if (index < 4) {\n return [0, index];\n } else if (index < 8) {\n return [1, index - 4];\n } else if (index < 12) {\n return [2, index - 8];\n } else {\n return [3, index - 12];\n }\n}", "function accessElementInArray(array, index) {\n return array[index];\n}", "getSegment(\n pathIndex = this.state.selectedPathIndex,\n pointIndex = this.state.selectedPointIndex,\n ) {\n return this.state.allPaths[pathIndex].definition[pointIndex];\n }" ]
[ "0.7117669", "0.7050225", "0.6788835", "0.6652022", "0.6570453", "0.6551717", "0.64776117", "0.644447", "0.64352006", "0.6357566", "0.63529104", "0.6349525", "0.62419534", "0.6203459", "0.6184747", "0.6174074", "0.6151645", "0.6124953", "0.6121487", "0.6117371", "0.6091552", "0.6073114", "0.60708296", "0.60663927", "0.60420436", "0.6039518", "0.603486", "0.6023788", "0.6023488", "0.6010938", "0.6000444", "0.59965104", "0.5996108", "0.59957033", "0.59850436", "0.5973558", "0.5959553", "0.59503937", "0.5949989", "0.5941094", "0.5932491", "0.5910873", "0.58969384", "0.58883333", "0.5881956", "0.5865879", "0.58490187", "0.5840181", "0.5837697", "0.5823103", "0.5820737", "0.581573", "0.58074266", "0.57982594", "0.57970566", "0.5788276", "0.5786463", "0.57861054", "0.5784428", "0.577764", "0.5776333", "0.5776333", "0.5776333", "0.57733977", "0.5769361", "0.57625425", "0.57278776", "0.57264036", "0.5721714", "0.5721663", "0.5721663", "0.57115716", "0.5704615", "0.57021254", "0.57014155", "0.5700894", "0.56993186", "0.56993186", "0.5690328", "0.5685378", "0.5683686", "0.5682671", "0.56745034", "0.567356", "0.56725335", "0.5672104", "0.5667199", "0.5657516", "0.56569386", "0.56546605", "0.5644985", "0.5642118", "0.56405187", "0.56363076", "0.56340355", "0.5624685", "0.5624685", "0.56187433", "0.5610316", "0.56083757" ]
0.76091355
0
for rounding to decimal places
function roundit(num,dex) { return parseFloat(num).toFixed(dex); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function roundToDecimalPlace(value, decimal) {\r\n var factor = Math.pow(10, decimal);\r\n roundedValue = ((Math.round(value * factor))/factor).toFixed(decimal);\r\n return roundedValue;\r\n}", "function RoundDecimals(float) {\n var roundedFloat = Math.round(float * 10) / 10;\n return roundedFloat;\n console.log(\"roundedFloat: \" + roundedFloat);\n}", "function round(value)\n{\n\tvalue = +value.toFixed(3)\n\treturn value;\n}", "function round(control) \n{ \n ans = control.value * 1000 \n ans = Math.round(ans /10) + \"\" \n while (ans.length < 3) {ans = \"0\" + ans} \n len = ans.length \n ans = ans.substring(0,len-2) + \".\" + ans.substring(len-2,len)\n control.value = ans; \n}", "function round(decimal) {\n return parseFloat(Math.round(decimal * 100) / 100).toFixed(2);\n}", "function round(number,decimal_points) {\r\n\tif (number == null) return 'NaN';\r\n\tif (!decimal_points || decimal_points == null) return Math.round(number);\r\n\tvar exp = Math.pow(10, decimal_points);\r\n\tnumber = Math.round(number * exp) / exp;\r\n\treturn parseFloat(number.toFixed(decimal_points));\r\n}", "function round_to(x, num) {\n\tvar r = x.toFixed(num) + \"\";\n\tif (r.match('.'))\n\t\treturn r.replace(/\\.?0+$/,'');\n\treturn r;\n}", "function roundIt(value) {\n let places = 100;\n if (value < 100) {\n places = 10000;\n } else if (value < 0.001) {\n places = 1000000;\n }\n return Math.round((value + Number.EPSILON) * places) / places;\n }", "function Round(x){\nif (x <0.001) {x = \"<0.001\"};\nif (x >1) {x = \"1.0000\"};\nreturn x;\n}", "function round(value, fixed){\n\t\treturn parseFloat(Math.round(value * 10.0) / 10.0).toFixed(fixed);\n\t}", "function round( nr ) {\n\t\treturn Math.round( 100*nr )/100;\n\t}", "function round(num) {\n return Math.round((num + Number.EPSILON) * 100) / 100;\n}", "function round(num) {\n return Math.round(num * 100) / 100;\n }", "function roundNum(num){\n return Math.round(num * 10) / 10;\n }", "function roundme(val) {\n return val;\n }", "function round_x(x) {\n var out = parseFloat(parseFloat(x).toFixed(DECIMALS));\n return out;\n}", "function round(num){\n return Math.round(num*10) / 10;\n }", "function digits(value, round) {\n return parseFloat(value.toFixed(round));\n }", "roundPrice(price) {\n var roundedPrice = Math.round(price * 100) / 100;\n return roundedPrice.toFixed(2);\n }", "function roundToNearestHundreth(x){\n return (x).toFixed(2);\n }", "function roundDec(no, dec)\r\n{\r\n var flotante = parseFloat(no);\r\n var result = Math.round(flotante*Math.pow(10,dec))/Math.pow(10,dec);\r\n if(isNaN(flotante)){\r\n return '';\r\n }else{\r\n return result;\r\n }\r\n}", "function round_to_sigfigs(val, sigfigs){\n return Number.parseFloat(val.toPrecision(sigfigs));\n}", "round(value) {\n return Math.round(value);\n }", "function round(number) {\n return Math.round(number * 100) / 100;\n}", "_round(x) {\n\t\treturn Math.round( x * 1000) / 1000;\n\t}", "function roundMoney(val) {\n return Math.round(val * 100) / 100;\n}", "function fc_Round(num, dec) {\n num = (num+\"\")\n num = num.substring(0,num.indexOf(\".\")+dec+1); \n var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);\n return result;\n}", "function myRound(val,places) {\n\tvar c = 1;\n\tfor (var i = 0; i < places; i++)\n\t\tc *= 10;\n\treturn Math.round(val*c)/c;\n}", "function round(number, precision)\r\n{\r\n divisor = Math.pow(10, precision);\r\n return Math.round(number * divisor) / divisor;\r\n}", "function round_number(number,decimals){\n return Math.round(number*Math.pow(10,decimals))/Math.pow(10,decimals)\n }", "function round (amount, numOfDecDigits) {\n numOfDecDigits = numOfDecDigits || 2;\n return Math.round(amount * Math.pow(10, numOfDecDigits)) / Math.pow(10, numOfDecDigits);\n }", "function roundToDollar(dollars){\n return (Math.floor(100*(dollars)))/100;\n}", "function round_decimal(value, decimals) {\n return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);\n}", "function round(x) {\n return Math.round( x * 1000) / 1000;\n }", "function round(n) {\n return Math.round(n * 100) / 100;\n }", "function round(number) {\n return Math.round(number * 100) / 100;\n}", "function round(number) {\n return Math.round(number * 100) / 100;\n}", "function round(value, precision) {\n var multiplier = Math.pow(10, precision || 0);\n return Math.round(value * multiplier) / multiplier;\n }", "function getDecimalPlaces(value) {\n var match = \"\"\n .concat(value)\n .match(/(?:\\.(\\d+))?(?:[eE]([+-]?\\d+))?$/);\n\n if (!match) {\n return 0;\n }\n\n return Math.max(\n 0, // Number of digits right of decimal point.\n (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0) // Adjust for scientific notation.\n );\n } // Round to the nearest step", "function roundTo(value, places) {\n places = places || 0;\n var factor = Math.pow(10, places);\n return Math.round(value * factor) / factor;\n}", "function roundBy(decimalPlaces, num) {\n var scale = Math.pow(10, decimalPlaces);\n return Math.round(scale * num) / scale;\n }", "round(place = 0) {\r\n const factor = Math.pow(10, place)\r\n return FNumber(Math.round(this.data * factor) / factor)\r\n }", "function round(num)\n{\n return (num*100|0)/100;\n}", "function roundToTwoDecPlace(res) {\n return Math.round((res) * 100) / 100;\n}", "function round(value) {\n return Math.round(value);\n}", "function round(x) {\r\n return Math.round(x * 1000) / 1000;\r\n }", "function round(x) {\r\n return Math.round(x * 1000) / 1000;\r\n }", "function round(x) {\r\n return Math.round(x * 1000) / 1000;\r\n }", "function round(x) {\r\n return Math.round(x * 1000) / 1000;\r\n }", "function roundNum(num, point) {\n return 1 * num.toFixed(point);\n}", "function preciseRound(num, decimals) {\r\n var t = Math.pow(10, decimals);\r\n return (Math.round(num * Math.pow(10, decimals)) / Math.pow(10, decimals)).toFixed(2);\r\n}", "function round(value, precision) {\n var multiplier = Math.pow(10, precision || 0);\n return Math.round(value * multiplier) / multiplier;\n}", "function round(value, precision) {\n var multiplier = Math.pow(10, precision || 0);\n return Math.round(value * multiplier) / multiplier;\n}", "function round(value, precision) {\n var multiplier = Math.pow(10, precision || 0);\n return Math.round(value * multiplier) / multiplier;\n}", "function round(num, places) {\n var multiplier = Math.pow(10, places);\n return Math.round(num * multiplier) / multiplier;\n }", "function round(value, precision) {\n\t precision = precision || 0;\n\t\n\t value = ('' + value).split('e');\n\t value = Math.round(+(value[0] + 'e' + (value[1] ? +value[1] + precision : precision)));\n\t\n\t value = ('' + value).split('e');\n\t value = +(value[0] + 'e' + (value[1] ? +value[1] - precision : -precision));\n\t\n\t return value.toFixed(precision);\n\t}", "function roundup(number,decimal_points) {\r\n\tif (number == null) return 'NaN';\r\n\tif (!decimal_points || decimal_points == null) return Math.ceil(number);\r\n\tvar exp = Math.pow(10, decimal_points);\r\n\tnumber = Math.ceil(number * exp) / exp;\r\n\treturn parseFloat(number.toFixed(decimal_points));\r\n}", "function round(n) {\n if (!n) {\n return 0;\n }\n return Math.floor(n * 100) / 100;\n }", "function roundOneDec(x) {\n return (Math.round((x) * 10) / 10);\n }", "function round(value, decimals) {\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n }", "function round(value, decimals) {\n if (typeof value !== \"number\") {return value};\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n}", "function round(number,decimal) {\n\tvar power = Math.pow(10,decimal);\n\treturn (Math.round(number*power)/power).toFixed(decimal);\n}", "function roundTo(n, digits) { //round up\n var negative = false;\n if (digits === undefined) {\n digits = 0;\n }\n if( n < 0) {\n negative = true;\n n = n * -1;\n }\n var multiplicator = Math.pow(10, digits);\n n = parseFloat((n * multiplicator).toFixed(11));\n n = (Math.round(n) / multiplicator).toFixed(2);\n if( negative ) { \n n = (n * -1).toFixed(2);\n }\n return n;\n} //end of roundTo", "function RoundNumber (number, decimal){\n\tvar retval = Math.round(Math.pow(10, decimal) * number)/ Math.pow(10, decimal);\n\tif (decimal = 2){\n\t\tvar s_retval = retval.toString();\n\t\tif (s_retval.indexOf('.')>=0){\n\t\t\tanum = s_retval.split('.');\n\t\t\tvar rem = anum[1];\n\t\t\tif (rem.length == 1){\n\t\t\t\treturn s_retval + \"0\";\n\t\t\t}\n\t\t}else{\n\t\t\treturn s_retval + \".00\";\n\t\t}\n\t}\n\treturn retval; \n}", "function round(value, decimals) {\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n}", "function round(value, decimals) {\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n}", "function round(value, decimals) {\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n}", "function round(value, decimals) {\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n}", "function round(value, decimals) {\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n}", "function round(value, decimals) {\n return Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n}", "function precise() {\n var num1 = 13495439.346983409;\n\n document.getElementById(\"precision\").innerHTML = num1.toPrecision(10);\n}", "function roundTo(value, x) {\n return Math.round(value / x) * x;\n}", "function rounding (number) {\n return Math.round(number)\n}", "function round_value(value, amount) {\n return parseFloat(value).toLocaleString(\"en-US\", {\n minimumFractionDigits: amount, \n maximumFractionDigits: amount\n });\n}", "function round(value, precision) {\r\n let multiplier = Math.pow(10, precision || 0);\r\n return Math.round(value * multiplier) / multiplier;\r\n}", "function round(value, precision) {\r\n let multiplier = Math.pow(10, precision || 0);\r\n return Math.round(value * multiplier) / multiplier;\r\n}", "function approx(){\nalert(\"Numbers can be rounded off to the nearest whole number,certain number of decimal places and to a certain number of significant figures.\");\nalert(\"To round off look at the digit next to the one to be rounded off.If this digit is less than 5 the digit to be rounded off remains unchanged.If the digit is greater than or equal to 5 the digit to be rounded off increases by 1.\");\nalert(\"For example rounding off 6.471 to the nearest whole number. We are rounding off at 6 and so we look at 4 which is less than 5 hence 6 remains unchanged.Therefore 6.471=6(to the nearest whole number).\");\nalert(\"Rounding off 32.63 to the nearest whole number.We are rounding off at 2 hence we look at 6 which is greater than 5 hence 2 increases by 1.Therefore 32.63=33(to the nearest whole number.)\");\nalert(\"Rounding off 4.0561 to 1 decimal place.We are rounding off at 0 so we look at 5 which is greater than or equal to 5 hence zero increases by 1.Therefore 4.0561=4.1(to 1 dp)=4.06(to 2 dp)=4.056(to 3dp)\");\nalert(\"A significant figure is a figure with a value higher than zero.Zero becomes a significant figure when located between other figures after the decimal point.To count number of significant figures start from the first non zero number.\");\nalert(\"Writing 0.070603 to 5 significant figures. We start counting at 7.Hence 0.070603=0.070603(to 5 sf).We keep the first two zeros to keeo the value of the number as a decimal.\");\nalert(\"More examples. 0.070603=0.0706(to 3 sf)=0.071(to 2 sf)=0.07(to 1 sf)\");\nalert(\"More examples.45.2637=45.264(to 5 sf)=45.26(to 4 sf)=45.3(to 3 sf)=45(to 2 sf)=50(to 1 sf).\");\n}", "function round(num, places) {\n var multiplier = Math.pow(10, places);\n return Math.round(num * multiplier) / multiplier;\n}", "function round(averagePrice){\n return Number((averagePrice).toFixed(2));\n // also:\n // Number(Math.round((x)+'e2')+'e-2') is eq to Number((x).toFixed(2))\n}", "function round(value, decimals) {\n\t\t\treturn Number(Math.round(value+'e'+decimals)+'e-'+decimals);\n\t\t}", "static round(value, precision) {\n let multiplier = Math.pow(10, precision || 0);\n return Math.round(value * multiplier) / multiplier;\n }", "function precise_round(num, dec){\n if ((typeof num !== 'number') || (typeof dec !== 'number'))\nreturn false;\n\n var num_sign = num >= 0 ? 1 : -1;\n return (Math.round((num*Math.pow(10,dec))+(num_sign*0.0001))/Math.pow(10,dec)).toFixed(dec);\n}", "function round(n, precision) {\n if (precision < 0) {\n const length = String(n).split('.')[0].length;\n return parseFloat(n.toLocaleString('en', { maximumSignificantDigits: length + precision, useGrouping: false }));\n }\n return parseFloat(n.toLocaleString('en', { maximumFractionDigits: precision, useGrouping: false }));\n}", "function roundNum(num){\n return Number(num.toFixed(2));\n}", "function round(num, places) {\n var shift = Math.pow(10, places);\n return Math.round(num * shift)/shift;\n }", "function HGC_roundup(value) {\n\tvar decplaces = config.get(\"hgc_decimal_places\", 5);\n\treturn Math.ceil(value * Math.pow(10, decplaces)) / Math.pow(10, decplaces);\n}", "function round(value, precision) {\n precision = precision || 0;\n\n value = ('' + value).split('e');\n value = Math.round(+(value[0] + 'e' + (value[1] ? +value[1] + precision : precision)));\n\n value = ('' + value).split('e');\n value = +(value[0] + 'e' + (value[1] ? +value[1] - precision : -precision));\n\n return value.toFixed(precision);\n}", "function round(value, precision) {\n precision = precision || 0;\n\n value = ('' + value).split('e');\n value = Math.round(+(value[0] + 'e' + (value[1] ? +value[1] + precision : precision)));\n\n value = ('' + value).split('e');\n value = +(value[0] + 'e' + (value[1] ? +value[1] - precision : -precision));\n\n return value.toFixed(precision);\n}", "function round(value, decimals) {\n return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);\n}", "function round(value, decimals) {\n return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);\n}", "function round(num, dp){\n\treturn Math.round((num * (Math.pow(10, dp))))/Math.pow(10, dp);\n}", "function round(x) {\n\treturn Math.round( x * 1000) / 1000;\n}", "function round(value, precision, floor) {\n if (!_Type__WEBPACK_IMPORTED_MODULE_0__[\"isNumber\"](precision) || precision <= 0) {\n var rounded = Math.round(value);\n if (floor) {\n if (rounded - value == 0.5) {\n rounded--;\n }\n }\n return rounded;\n }\n else {\n var d = Math.pow(10, precision);\n return Math.round(value * d) / d;\n }\n}", "function roundDecimalX(num, x) {\n if (x > 0) {\n var rounder = 10 ** x;\n return Math.round(num * rounder) / rounder;\n } else return num;\n}", "function round(num, prec, mode) {\n mode = mode || 'normal';\n var func = {\n normal: Math.round,\n up: Math.ceil,\n down: Math.floor\n }[mode];\n var k = Math.pow(0.1, prec);\n return func(num / k) * k;\n}", "function round(value, decimals) {\n return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals).toFixed(decimals);\n}", "function round(x) {\n\t\treturn Math.round( x * 1000) / 1000;\n\t}", "function round(x) {\n\t\treturn Math.round( x * 1000) / 1000;\n\t}", "function precisionRound(number) {\n var factor = Math.pow(10, 2);\n return Math.round(number * factor) / factor;\n}", "function fixed_method() {\n var test = 165.654794151;\n document.write(test.toFixed(3))\n}" ]
[ "0.711695", "0.7111932", "0.7093263", "0.69894254", "0.6966892", "0.69576955", "0.6957056", "0.69513786", "0.69166195", "0.68901163", "0.68674254", "0.68340963", "0.6805976", "0.67917323", "0.6777266", "0.67765355", "0.67475647", "0.6742682", "0.67203707", "0.67139536", "0.6683925", "0.66813236", "0.6648232", "0.66479015", "0.6646287", "0.66384333", "0.6629736", "0.6615871", "0.6612216", "0.65941983", "0.6593048", "0.6587304", "0.65856063", "0.6584663", "0.6584368", "0.6575512", "0.6575512", "0.65721464", "0.6571424", "0.6570113", "0.65676093", "0.65627843", "0.6555938", "0.65489036", "0.65417", "0.6536865", "0.6536865", "0.6536865", "0.6536865", "0.6531438", "0.65184546", "0.6514492", "0.6514492", "0.6514492", "0.65025824", "0.65014386", "0.65012556", "0.6500228", "0.6487758", "0.6478308", "0.6472979", "0.6468978", "0.6465816", "0.6465218", "0.645758", "0.645758", "0.645758", "0.645758", "0.645758", "0.645758", "0.6440441", "0.6438866", "0.6429479", "0.6428673", "0.6426905", "0.6426905", "0.6410297", "0.640969", "0.64033294", "0.6401334", "0.6395581", "0.63954395", "0.63843083", "0.63832945", "0.6373975", "0.6367718", "0.6364954", "0.6364954", "0.6355069", "0.6355069", "0.6352948", "0.6348925", "0.6342365", "0.6334774", "0.6334081", "0.63280994", "0.63258326", "0.63258326", "0.6319654", "0.6317643" ]
0.7337368
0
enabling legend toggling without hanging in the last state
function legendClosure(name, key) { google.maps.event.addDomListener(document.getElementById(name + '_div'), 'click', function () { // the real legend toggling showDict[key] = !showDict[key]; if (showDict[key]!=true) { document.getElementById(name).src="https://maps.google.com/mapfiles/ms/icons/ltblue-dot.png"; } else { document.getElementById(name).src=icons[key].icon; } handlePlotRequest("all"); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleLegend() {\n var button = d3.select(\"#btn_scene_toggleLegend\")[0][0];\n if(button.value == \"Remove Legend\") {\n button.value = \"Show Legend\";\n showLegend = false;\n } else {\n button.value = \"Remove Legend\";\n showLegend = true;\n }\n redraw(context.root);\n} // end toggleAxis", "function toggleLegendObject(){\n //Si le style cliquer est celui qui est deplie\n //alert(classe+\" \"+style+\" \"+mapFile.currentStyle);\n \n if(mapFile.legendObject.expand){\n mapFile.legendObject.expand=false;\n mapFile.legendObject.clearGUI();\n $(mapFile.legendObject.id+'_attr').style.display=\"none\";\n }else{\n mapFile.legendObject.expand=true;\n $(mapFile.legendObject.id+'_attr').style.display=\"block\";\n mapFile.legendObject.initGUI();\n }\n}", "toggleLegendState(el) {\r\n if(el.classList.contains('legendSelected')) {\r\n el.classList.remove('legendSelected');\r\n } else {\r\n el.classList.add('legendSelected');\r\n }\r\n }", "handleLegend() {\n const status = this.state.toggleLegend;\n return this.state.legend[status];\n }", "function toggleSelection(event) {\n const wasShown = !isShown\n updateHiddenTraces(label, wasShown)\n\n const legendEntry = {\n label, numPoints, numLabels, wasShown, iconColor,\n hasCorrelations\n }\n log('click:scatterlegend:single', legendEntry)\n }", "toggleLegend() {\n const legend = this.state.toggleLegend === \"opened\" ? \"closed\" : \"opened\";\n \n this.setState({\n toggleLegend: legend\n });\n }", "function toggleLegend3Dview(elt) {\n document.getElementById(\"view3DIfram\").contentDocument.getElementById(\"Legendbtn\").click();\n \n track_legend = !track_legend;\n if(track_legend) {\n elt.innerHTML=\"Hide Legend\";\n } else {\n elt.innerHTML=\"Show Legend\";\n }\n}", "function legendClickHandler(d, i) {\n\tsn.runtime.excludeSources.toggle(d.source);\n\tregenerateChart(sn.runtime.powerIOAreaChart);\n}", "function resetLegend(toggle){\n var legend = $(\"#map-legend\");\n if(toggle){\n legend.toggle();\n }\n legend.css({\n bottom:offset,\n left: offset\n });\n }", "function legendClickHandler(d, i) {\n\tsn.runtime.excludeSources.toggle(d.source);\n\tregenerateChart();\n}", "function bindLegendsAction() {\n if (!this.legend) {\n return false;\n }\n\n this.legend.itemSet.forEach(function (item, i) {\n var el = elements[i];\n item.hover(\n function () {\n this.rotate(45);\n\n el.stop();\n el.transform('t' + (el.mx - el.cx) / 5 + ',' + (el.my - el.cy) / 5);\n if (el.text) {\n el.text.stop();\n el.text.transform('t' + (el.mx - el.cx) / 5 + ',' + (el.my - el.cy) / 5);\n }\n },\n function () {\n this.rotate(-45);\n\n el.animate({\n transform:'s1,1,' + el.cx + ',' + el.cy\n }, 500, \"bounce\");\n\n if (el.text) {\n el.text.animate({\n transform:'t0,0'\n }, 500, \"bounce\");\n }\n }\n );\n });\n\n this.legend.on('click', (function () {\n var arr = new Array(series.length);\n return function (e, i) {\n if (arr[i] == true || arr[i] == undefined) {\n arr[i] = false;\n elements[i].attr('opacity', 0).text.attr('opacity', 0);\n } else {\n arr[i] = true;\n elements[i].attr('opacity', 1).text.attr('opacity', 1);\n }\n }\n })());\n }", "addLegend () {\n \n }", "set legendShow(newlegendShow) {\n if (newlegendShow) {\n this._legendShow = newlegendShow;\n }\n }", "function preventDblClickLegend(chart) {\n chart.legend.dispatch.on('legendDblclick', function (e) {\n chart.legend.updateState(false);\n setTimeout(function () {\n chart.legend.updateState(true);\n }, 1);\n });\n}", "function toggleLegends() {\r\n\r\n\tif (jQuery('#div-legends').css('display') == 'none') {\r\n\t\tjQuery('#div-legends').css('display', '');\r\n\r\n\t\t// add class \"seuratLegendTextBorder\" to div\r\n\t\tjQuery('#legendTextBox').addClass(\"seuratLegendTextBorder\");\r\n\r\n\t\t// hide the \"show legend\" label and show \"hide legends\" label\r\n\t\tjQuery('#seuratTxtShowLegend').css('display', 'none');\r\n\t\tjQuery('#seuratTxtHideLegend').css('display', '');\r\n\r\n\t\t// make filler div visible\r\n\t\tjQuery('#fillerDiv').css('display', 'none');\r\n\r\n\t} else {\r\n\t\tjQuery('#div-legends').css('display', 'none');\r\n\r\n\t\t// remove class \"seuratLegendTextBorder\" to div\r\n\t\tjQuery('#legendTextBox').removeClass(\"seuratLegendTextBorder\");\r\n\r\n\t\t// hide the \"hide legend\" label and show \"show legends\" label\r\n\t\tjQuery('#seuratTxtShowLegend').css('display', '');\r\n\t\tjQuery('#seuratTxtHideLegend').css('display', 'none');\r\n\r\n\t\t// make filler div visible\r\n\t\tjQuery('#fillerDiv').css('display', '');\r\n\r\n\t}\r\n}", "_setLegend(){\n $('#legend-form').empty(); // drop old controllers\n\n // Add checkbox for each channel\n let ticksID = {};\n this.channels.forEach((channel, index) => {\n ticksID[channel.name] = 'ch'.concat(index).concat('-tick');\n const inputTag = \"<input id='\".concat(ticksID[channel.name]).concat(\"' type='checkbox' checked/>\");\n\n // Add square with color\n $('#legend-form').append(\n $('<svg>')\n .attr('class', 'legend-rect-container')\n .append(\n $('<rect>')\n .attr('class','legend-rect')\n .css('fill', channel.color)\n )\n );\n\n // Add input\n $('#legend-form').append(' ', inputTag, ' ', channel.name, '<br>');\n\n // Generate id-like tag\n ticksID[channel.name] = '#'.concat(ticksID[channel.name]);\n });\n\n // HACK: Refresh svg\n $(\"#legend-form\").html($(\"#legend-form\").html());\n\n\n // Show/hide events\n let graph = this; // this is needed to call nested functions\n this.channelNames.forEach((channelName) => {\n let tickID = ticksID[channelName];\n $(tickID).click(function() {\n graph.enablePath[channelName] = this.checked;\n graph.paths[channelName].style(\"opacity\", this.checked ? 1 : 0);\n });\n });\n }", "function toggleLine(id, className, btn) {\r\n\tvar line = d3.selectAll('#' + id + ' .' + className + '.plot');\r\n\tvar altLine = d3.select('#' + id + ' .' + className + '.alternate');\r\n\tvar legend = d3.select('#' + id + ' .' + className + '.graph-legend');\r\n\tvar current = line.attr('class');\r\n\t\r\n\tif (current == className + ' plot') {\r\n\t\tline.attr('class', className + ' plot active');\r\n\t\tlegend.attr('class', className + ' graph-legend active');\r\n\t\tif (altLine.length)\r\n\t\t\taltLine.attr('class', className + ' alternate active');\r\n\t}\r\n\telse{\r\n\t\tline.attr('class', className + ' plot');\r\n\t\tlegend.attr('class', className + ' graph-legend');\r\n\t\tif (altLine.length)\r\n\t\t\taltLine.attr('class', className + ' alternate');\r\n\t}\r\n\t\r\n\t$(btn).toggleClass('active');\r\n\t\r\n}", "open() {\n this.legendLayer.click();\n }", "get legendShow() {\n return this._legendShow;\n }", "function onLegendItemClick(event) {\n\t\thideDisplayedPoints(this);\n\t}", "function showLegend(){\n d3.select(\".panel\")\n .transition()\n .duration(500)\n .attr(\"transform\", \"translate(0,0)\")\n}", "function resetLegend(element){\n\tif ($(element+'_header').attr('class').indexOf(\"open\") >=0){\n\t\t//$(element+'_header').button( \"option\", \"icons\", {primary:'ui-icon-triangle-1-e',secondary:null} );\n\t\t$(element+'_header').button( \"option\", \"icons\", {primary:null,secondary:null} );\n\t\t$(element+'_header').toggleClass(\"open\");\n\t\t$(element+'_body').hide();\n\t}\n\t\n}", "function setShowLegend(showLegend, dst) {\n if (showLegend === undefined) {\n // If the default was auto, make a choice for this field\n var isAutoByDefault = DEFAULTS.showLegend === undefined;\n\n if (isAutoByDefault) {\n // these styles default to having legends\n var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE;\n\n dst.showLegend = isLegendGraphStyle;\n } else {\n // Leave current value as is\n }\n } else {\n dst.showLegend = showLegend;\n }\n }", "function setShowLegend(showLegend, dst) {\n if (showLegend === undefined) {\n // If the default was auto, make a choice for this field\n var isAutoByDefault = DEFAULTS.showLegend === undefined;\n\n if (isAutoByDefault) {\n // these styles default to having legends\n var isLegendGraphStyle = dst.style === STYLE.DOTCOLOR || dst.style === STYLE.DOTSIZE;\n\n dst.showLegend = isLegendGraphStyle;\n } else {\n // Leave current value as is\n }\n } else {\n dst.showLegend = showLegend;\n }\n }", "function onLinkedSeriesLegendItemClick(event) {\n\t\tevent.preventDefault(); // We handle toggling the clicked series manually.\n\t\t\n\t\ttoggleLinkedChartSeries(this, this.chart.options.linkedCharts);\n\t}", "function onSeriesLegendItemClick() {\n var series = this,\n chart = series.chart,\n visible = series.visible,\n legend = series.chart.legend;\n var status;\n if (legend && legend.bubbleLegend) {\n // Temporary correct 'visible' property\n series.visible = !visible;\n // Save future status for getRanges method\n series.ignoreSeries = visible;\n // Check if at lest one bubble series is visible\n status = getVisibleBubbleSeriesIndex(chart) >= 0;\n // Hide bubble legend if all bubble series are disabled\n if (legend.bubbleLegend.visible !== status) {\n // Show or hide bubble legend\n legend.update({\n bubbleLegend: { enabled: status }\n });\n legend.bubbleLegend.visible = status; // Restore default status\n }\n series.visible = visible;\n }\n }", "function drawLegend(index, svg, x, y) {\n var filename = allDataFileList[index]\n var color = colorMap.get(filenameToId(filename));\n var eventsFileName = eventsFileList[index];\n var id = filenameToId(eventsFileName)\n\n\n svg.append(\"circle\")\n .attr(\"cx\", width)\n .attr(\"cy\", -100 + index * 60)\n .attr(\"r\", 20)\n .attr(\"id\", \"legend\" + filenameToId(eventsFileName))\n .attr(\"stroke\", color)\n .attr(\"stroke-width\", 8)\n .attr(\"fill\", color)\n .on(\"click\", function() {\n // get opacity\n var opacity = d3.select(\"#line\" + id).attr(\"opacity\")\n // if opacity equals to 1, then means the layer is on\n if (opacity == 1) {\n // turn off layer: line, area, circle\n var i = dynamicFileList.indexOf(IdToAllDataFilename(id))\n dynamicFileList.splice(i, 1);\n\n\n d3.select(\"#legend\" + id)\n .attr(\"fill\", \"white\")\n\n d3.select(\"#line\" + id)\n .attr(\"opacity\", 0)\n .on('mouseover', null)\n .on('mouseout', null)\n\n d3.selectAll(\".circle\" + id)\n .attr(\"opacity\", 0)\n .on('mouseover', null)\n .on('mouseout', null)\n .on('click', null)\n\n d3.select(\"#area\" + id).attr(\"opacity\", 0)\n .on('mouseover', null)\n .on('mouseout', null)\n\n } else {\n // turn on\n dynamicFileList.push(IdToAllDataFilename(id))\n\n d3.select(\"#legend\" + id)\n .attr(\"fill\", color)\n\n d3.select(\"#line\" + id)\n .attr(\"opacity\", 1)\n .on('mouseover', lineMouseOverHandler)\n .on('mouseout', lineMouseOutHandler)\n\n d3.selectAll(\".circle\" + id)\n .attr(\"opacity\", 1)\n .on('mouseover', circleMouseOverHandler)\n .on('mouseout', circleMouseOutHandler)\n .on('click', circleClickHandler)\n\n d3.select(\"#area\" + id)\n .attr(\"opacity\", 0.3)\n .on('mouseover', areaMouseOverHandler)\n .on('mouseout', areaMouseOutHandler)\n\n }\n\n\n })\n // annotation\n svg.append(\"text\")\n .attr(\"x\", width + 40)\n .attr(\"y\", -90 + index * 60)\n .text(id)\n .style(\"font-size\", \"20px\")\n}", "function hideLegend(){\n d3.select(\".panel\")\n .transition()\n .duration(500)\n .attr(\"transform\", \"translate(165,0)\")\n}", "function updateLegend() {\n d3.selectAll('.legend div, .legend h6')\n .remove();\n }", "function legendReset(n){\n\tconsole.log(n.children[0].className = 'normal');\n}", "function legendOver(opac){\n\t\t\n\t\treturn function(d,i){\n\t\t\n\t\t\n\t\tvar selected = beerColors.domain()[i];\n\t\t\n\t\tchart.selectAll(\".beers\")\n\t\t\t.filter(function(d){ return d.STYLE != selected;})\n\t\t\t.transition()\n\t\t\t.style(\"opacity\",opac)\n\t\t\n\t\t\n\t\t};\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "function legendCallback(handedness) {\n handednessMap[handedness].visible = !handednessMap[handedness].visible;\n drawChart(data, \"avg\", 0.0);\n }", "function mainLegend() {\n\t\t\t// var ldata = data.filter(function(i) {return REGIONS[i.name].selected});\n\t\t\tldata = data;\n\t\t\tLegend(ldata, null,\n\t\t\t\tfunction(i){\n\t\t\t\t\tprovinceHoverIn(shapes.selectAll(\".circle\")[0][i]);\n\t\t\t\t}, function(i) {\n\t\t\t\t\tprovinceHoverOut(shapes.selectAll(\".circle\")[0][i]);\n\t\t\t\t}, function(i) {\n\t\t\t\t\tprovinceClick(shapes.selectAll(\".circle\")[0][i]);\n\t\t\t\t});\t\n\t\t}", "_drawLegend() {\n if (this.displayOptions.legend.position !== scada.chart.AreaPosition.NONE) {\n const layout = this._chartLayout;\n const legend = this.displayOptions.legend;\n\n let trendCnt = this.chartData.trends.length;\n let lineCnt = Math.ceil(trendCnt / legend.columnCount);\n let useStatusColor = this._getUseStatusColor();\n\n let columnMarginTop = scada.chart.DisplayOptions.getMargin(legend.columnMargin, 0);\n let columnMarginRight = scada.chart.DisplayOptions.getMargin(legend.columnMargin, 1);\n let columnMarginLeft = scada.chart.DisplayOptions.getMargin(legend.columnMargin, 3);\n\n let fullColumnWidth = legend.columnWidth + columnMarginLeft + columnMarginRight;\n let lineXOffset = layout.legendAreaRect.left + layout.canvasXOffset + columnMarginLeft;\n let lineYOffset = layout.legendAreaRect.top + layout.canvasYOffset + columnMarginTop;\n\n this._context.textAlign = \"left\";\n this._context.textBaseline = \"middle\";\n this._context.font = legend.fontSize + \"px \" + this.displayOptions.chartArea.fontName;\n\n for (let trendInd = 0; trendInd < trendCnt; trendInd++) {\n let trend = this.chartData.trends[trendInd];\n let columnIndex = Math.trunc(trendInd / lineCnt);\n let lineIndex = trendInd % lineCnt;\n let lineX = fullColumnWidth * columnIndex + lineXOffset;\n let lineY = legend.lineHeight * lineIndex + lineYOffset;\n let iconX = lineX + 0.5;\n let iconY = lineY + (legend.lineHeight - legend.iconHeight) / 2 - 0.5;\n let lblX = lineX + legend.iconWidth + legend.fontSize / 2;\n let lblY = lineY + legend.lineHeight / 2;\n\n if (!useStatusColor) {\n this._setColor(trend.color);\n this._context.fillRect(iconX, iconY, legend.iconWidth, legend.iconHeight);\n this._setColor(legend.foreColor);\n this._context.strokeRect(iconX, iconY, legend.iconWidth, legend.iconHeight);\n }\n\n this._context.fillText(trend.caption, lblX, lblY);\n }\n }\n }", "update() {\n if (!this.suspendUpdate) {\n this.draw();\n this.legend.setSeriesViewRect(this.viewRect);\n this.legend.update();\n }\n }", "async setLegend(_) {\n if (!arguments.length)\n return this._nodeEdgeLegend;\n this._nodeEdgeLegend = _;\n }", "function onLinkedPieLegendItemClick(event) {\n\t\tevent.preventDefault(); // We handle toggling the clicked series manually.\n\t\t\n\t\ttoggleLinkedChartSeries(this, this.series.chart.options.linkedCharts);\n\t}", "get showLegend() {\n\t\treturn this.nativeElement ? this.nativeElement.showLegend : undefined;\n\t}", "function clickHandler(e) {\n var layer = e.target;\n if (plugin.selectionLegend.isSelected(layer)) {\n plugin.selectionLegend.removeSelection(layer);\n plugin.unhighlightFeature(layer);\n }\n else {\n plugin.selectionLegend.addSelection(layer);\n plugin.highlightFeature(layer);\n plugin.zoomToFeature(layer);\n }\n }", "function setLegend() {\n if (_options.legendDivId) {\n var i;\n var j;\n var layer;\n var legendInfo;\n var infoObject;\n var legendView;\n var layers = _config.getLayers();\n\n var legend = jQuery(\"#\" + _options.legendDivId);\n // Make sure element is empty before appending possible new content.\n legend.empty();\n\n // Check if there are any legends configured.\n var legendCount = 0;\n for ( i = 0; i < layers.length; ++i) {\n layer = layers[i];\n // Check that layer provides legend info getter.\n // All of the layers may not be animation layers.\n if (layer.getVisibility() && layer.getLegendInfo) {\n legendInfo = layer.getLegendInfo();\n for ( j = 0; j < legendInfo.length; ++j) {\n infoObject = legendInfo[j];\n if (infoObject.hasLegend) {\n // At least one layer has some URL set for legend.\n ++legendCount;\n }\n }\n }\n }\n\n if (!legendCount) {\n // There is no legend available.\n // Set the corresponding classes for animation and legend elements.\n legend.addClass(\"animatorLegendNoLegend\");\n if (_options.animationDivId) {\n jQuery(\"#\" + _options.animationDivId).addClass(\"animatorAnimationNoLegend\");\n }\n\n } else if (1 === legendCount) {\n // Make sure possible previously set different state classes are removed.\n legend.removeClass(\"animatorLegendNoLegend\");\n if (_options.animationDivId) {\n // Legends div is available. So, make sure legend div is shown.\n jQuery(\"#\" + _options.animationDivId).removeClass(\"animatorAnimationNoLegend\");\n }\n // There is only one legend.\n // Set the corresponding classes for animation and legend elements.\n legendView = jQuery('<div class=\"animatorLegendView animatorLegendViewOne\"></div>');\n legend.append(legendView);\n // Set the one legend as background image for the view.\n for ( i = 0; i < layers.length; ++i) {\n layer = layers[i];\n // Check that layer provides legend info getter.\n // All of the layers may not be animation layers.\n if (layer.getVisibility() && layer.getLegendInfo) {\n legendInfo = layer.getLegendInfo();\n for ( j = 0; j < legendInfo.length; ++j) {\n infoObject = legendInfo[j];\n if (infoObject.hasLegend) {\n legendView.css(\"background-image\", \"url('\" + infoObject.url + \"')\");\n // There can be only one.\n break;\n }\n }\n }\n }\n\n } else {\n // Make sure possible previously set different state classes are removed.\n legend.removeClass(\"animatorLegendNoLegend\");\n if (_options.animationDivId) {\n // Legends div is available. So, make sure legend div is shown.\n jQuery(\"#\" + _options.animationDivId).removeClass(\"animatorAnimationNoLegend\");\n }\n // Some legends are available. So, create legend components.\n var legendThumbnails = jQuery('<div class=\"animatorLegendThumbnails\"></div>');\n legendThumbnails.append('<div class=\"scroll-pane ui-widget ui-widget-header ui-corner-all\"><div class=\"scroll-content\"></div><div class=\"scroll-bar-wrap ui-widget-content ui-corner-bottom\"><div class=\"scroll-bar\"></div></div></div>');\n legend.append(legendThumbnails);\n legendView = jQuery('<div class=\"animatorLegendView\"></div>');\n legend.append(legendView);\n var contentContainer = jQuery(\".scroll-content\");\n var firstSelected = false;\n for ( i = 0; i < layers.length; ++i) {\n layer = layers[i];\n // Check that layer provides legend info getter.\n // All of the layers may not be animation layers.\n if (layer.getVisibility() && layer.getLegendInfo) {\n legendInfo = layer.getLegendInfo();\n for ( j = 0; j < legendInfo.length; ++j) {\n infoObject = legendInfo[j];\n if (infoObject.hasLegend) {\n fetchLegendContent(contentContainer, legendView, infoObject, !firstSelected);\n firstSelected = true;\n }\n }\n }\n }\n // Initialize slider for legend after items have been inserted there.\n initLegendSlider();\n }\n\n } else if (_options.animationDivId) {\n // Legends div is not available. So, use the whole area for animation.\n jQuery(\"#\" + _options.animationDivId).addClass(\"animatorAnimationNoLegend\");\n }\n\n // Also make sure that slider controller is updated properly.\n // This is required to update controller when legend is hidden or shown.\n if (_animationControllerResize) {\n _animationControllerResize();\n }\n }", "function onLegendAfterUpdate() {\n var colorAxes = this.chart.colorAxis;\n if (colorAxes) {\n colorAxes.forEach(function (colorAxis) {\n colorAxis.update({}, arguments[2]);\n });\n }\n }", "function updateLegend(value) {\n let legendContainer = document.getElementById(\"collapseOne\");\n \n // create a color scale\n let legendContent = \"\";\n let feature = roadDevelopment.toGeoJSON().features[0];\n\n if(value == \"status\") {\n legendContent = getLegendContent(status, feature, \"status\", value);\n } else if (value == \"contractor\") {\n legendContent = getLegendContent(contractors, feature, \"contractor\", value);\n } else if (value == \"funding\") {\n legendContent = getLegendContent(funding, feature, \"funding\", value);\n } else if (value == \"developmentType\") {\n legendContent = getLegendContent(developmentNature, feature, \"nature_dvp\", value);\n } else if (value == \"maintenanceType\") {\n legendContent = getLegendContent(maintenanceType, feature, \"maint_type\", value);\n } \n\n\n legendContainer.innerHTML = legendContent;\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function createLegend(choiceContainer, infos) {\n // Sort series by name\n var keys = [];\n $.each(infos.data.result.series, function(index, series){\n keys.push(series.label);\n });\n keys.sort(sortAlphaCaseless);\n\n // Create list of series with support of activation/deactivation\n $.each(keys, function(index, key) {\n var id = choiceContainer.attr('id') + index;\n $('<li />')\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\n .append($('<label />', { 'text': key , 'for': id }))\n .appendTo(choiceContainer);\n });\n choiceContainer.find(\"label\").click( function(){\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\n this.style.color=\"#818181\";\n }else {\n this.style.color=\"black\";\n }\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\n });\n choiceContainer.find(\"label\").mousedown( function(event){\n event.preventDefault();\n });\n choiceContainer.find(\"label\").mouseenter(function(){\n this.style.cursor=\"pointer\";\n });\n\n // Recreate graphe on series activation toggle\n choiceContainer.find(\"input\").click(function(){\n infos.createGraph();\n });\n}", "function toggleHeatMap() {\n heatMap.canvas.style.setProperty('display', this.checked ? 'block' : 'none');\n}", "drawLegend() {\n let parent = this;\n let svgSelect = d3.select(\"#vis-8-svg\");\n //Each legend is in a <g> group that contains: circle and text\n let numFireLegend = svgSelect.append(\"g\")\n .attr(\"class\", \"legend\")\n .attr(\"transform\", (d, i) => `translate(${this.vizMinWidth + 10},${0 + 45})`);\n numFireLegend.append(\"circle\")\n .attr(\"class\", \"numFiresLegendCircle\")\n .attr(\"cx\", 0)\n .attr(\"cy\", 0)\n .attr(\"r\", \".5rem\");\n numFireLegend.append(\"text\")\n .attr(\"class\", \"numFiresLegendText\")\n .attr(\"x\", 17)\n .attr(\"y\", 4)\n .text(\"Number of Wildfires\")\n .classed(\"text-small\", true);\n\n numFireLegend.on(\"mouseover\", function(event, d) {\n d3.select(\".numFiresLegendCircle\")\n .attr(\"r\", \"0.7rem\")\n .style(\"\");\n d3.select(\".numFiresLegendText\")\n .classed(\"h5\", true)\n .classed(\"text-large\", true);\n })\n .on(\"mouseout\", function(event, d) {\n if (!parent.isHighlightNumFires) {\n d3.select(\".numFiresLegendCircle\")\n .attr(\"r\", \"0.5rem\");\n d3.select(\".numFiresLegendText\")\n .classed(\"h5\", false)\n .classed(\"text-large\", false);\n }\n\n })\n .on(\"click\", function(event, d) {\n if (!parent.isHighlightNumFires) {\n parent.isHighlightTotalAcres = false;\n parent.unhighlightTotalAcres();\n\n parent.isHighlightNumFires = true;\n parent.highlightNumFires();\n } else {\n parent.isHighlightNumFires = false;\n parent.unhighlightNumFires();\n }\n });\n\n let AcresLegend = svgSelect.append(\"g\")\n .attr(\"class\", \"legend\")\n .attr(\"transform\", (d, i) => `translate(${this.vizMinWidth + 10},${0 + 15})`);\n AcresLegend.append(\"circle\")\n .attr(\"class\", \"totalAcresLegendCircle\")\n .attr(\"cx\", 0)\n .attr(\"cy\", 0)\n .attr(\"r\", \".5rem\");\n AcresLegend.append(\"text\")\n .attr(\"class\", \"totalAcresLegendText\")\n .attr(\"x\", 17)\n .attr(\"y\", 4)\n .text(\"Total Acres Burned\")\n .classed(\"text-small\", true);\n\n AcresLegend.on(\"mouseover\", function(event, d) {\n d3.select(\".totalAcresLegendCircle\")\n .attr(\"r\", \"0.7rem\")\n .style(\"stroke\", \"#3b4351\")\n .style(\"stroke-width\", \"1px\");\n d3.select(\".totalAcresLegendText\")\n .classed(\"h5\", true)\n .classed(\"text-large\", true);\n })\n .on(\"mouseout\", function(event, d) {\n if (!parent.isHighlightTotalAcres) {\n d3.select(\".totalAcresLegendCircle\")\n .attr(\"r\", \"0.5rem\")\n .style(\"stroke\", \"\")\n .style(\"stroke-width\", \"0px\");\n d3.select(\".totalAcresLegendText\")\n .classed(\"h5\", false)\n .classed(\"text-large\", false);\n }\n })\n .on(\"click\", function(event, d) {\n if (!parent.isHighlightTotalAcres) {\n parent.isHighlightNumFires = false;\n parent.unhighlightNumFires();\n\n parent.isHighlightTotalAcres = true;\n parent.highlightTotalAcres();\n } else {\n parent.isHighlightTotalAcres = false;\n parent.unhighlightTotalAcres();\n }\n });\n\n }", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function createLegend(choiceContainer, infos) {\r\n // Sort series by name\r\n var keys = [];\r\n $.each(infos.data.result.series, function(index, series){\r\n keys.push(series.label);\r\n });\r\n keys.sort(sortAlphaCaseless);\r\n\r\n // Create list of series with support of activation/deactivation\r\n $.each(keys, function(index, key) {\r\n var id = choiceContainer.attr('id') + index;\r\n $('<li />')\r\n .append($('<input id=\"' + id + '\" name=\"' + key + '\" type=\"checkbox\" checked=\"checked\" hidden />'))\r\n .append($('<label />', { 'text': key , 'for': id }))\r\n .appendTo(choiceContainer);\r\n });\r\n choiceContainer.find(\"label\").click( function(){\r\n if (this.style.color !== \"rgb(129, 129, 129)\" ){\r\n this.style.color=\"#818181\";\r\n }else {\r\n this.style.color=\"black\";\r\n }\r\n $(this).parent().children().children().toggleClass(\"legend-disabled\");\r\n });\r\n choiceContainer.find(\"label\").mousedown( function(event){\r\n event.preventDefault();\r\n });\r\n choiceContainer.find(\"label\").mouseenter(function(){\r\n this.style.cursor=\"pointer\";\r\n });\r\n\r\n // Recreate graphe on series activation toggle\r\n choiceContainer.find(\"input\").click(function(){\r\n infos.createGraph();\r\n });\r\n}", "function toggleDataSeries(e) {\n if (typeof (e.dataSeries.visible) === \"undefined\" || e.dataSeries.visible) {\n e.dataSeries.visible = false;\n } else {\n e.dataSeries.visible = true;\n }\n e.chart.render();\n}", "function toggleDataSeries(e) {\n if (typeof (e.dataSeries.visible) === \"undefined\" || e.dataSeries.visible) {\n e.dataSeries.visible = false;\n }\n else {\n e.dataSeries.visible = true;\n }\n chart.render();\n }", "function createMapLegend() {\n\n}", "function updateLegend(colorScale) {\n svg_legend.selectAll('*').remove();\n makeLegend(colorScale);\n}", "function toggleDataSeries(e) {\n if (typeof (e.dataSeries.visible) === \"undefined\" || e.dataSeries.visible) {\n e.dataSeries.visible = false;\n } else {\n e.dataSeries.visible = true;\n }\n e.chart.render();\n }", "function onToggleStroke() {\n changeCurrMeme('is-stroke');\n toggleStrokeBtn();\n renderCanvas();\n}", "function toggleTab(i, label) {\n if(chart.data.datasets[i].hidden === false) {\n chart.data.datasets[i].hidden = true; \n label.classList.remove('option-active');\n } else if(chart.data.datasets[i].hidden === true) {\n chart.data.datasets[i].hidden = false;\n label.classList.add('option-active');\n } \n chart.update();\n}", "function LegendEntry({\n label, numPoints, iconColor, correlations, numLabels, hiddenTraces, updateHiddenTraces,\n showColorControls, updateEditedCustomColors, setActiveTraceLabel, showLegendSearch\n}) {\n let entry = label\n // whether to show the color picker modal\n const [showColorPicker, setShowColorPicker] = useState(false)\n // the current user-picked (though not necessarily saved) color\n // note that the color picker components do not allow invalid inputs, so we don't need to do any additional validation\n const [pickedColor, setPickedColor] = useState(iconColor)\n const hasCorrelations = correlations !== null\n if (correlations) {\n const correlation = Math.round(correlations[label] * 100) / 100\n\n // ρ = rho = Spearman's rank correlation coefficient\n entry = `${label} (${numPoints} points, ρ = ${correlation})`\n }\n\n const isShown = hiddenTraces.includes(label)\n\n const iconStyle = { backgroundColor: iconColor }\n const shownClass = (isShown ? '' : 'shown')\n\n /** Toggle state of this legend filter, and accordingly upstream */\n function toggleSelection(event) {\n const wasShown = !isShown\n updateHiddenTraces(label, wasShown)\n\n const legendEntry = {\n label, numPoints, numLabels, wasShown, iconColor,\n hasCorrelations\n }\n log('click:scatterlegend:single', legendEntry)\n }\n\n /** handle 'ok' press by updating the colors to the parent, and closing the dialog */\n function handleColorPicked() {\n updateEditedCustomColors(label, pickedColor)\n setShowColorPicker(false)\n }\n\n /**\n * If there are 200 or more labels for the annotation add a delay for hover functionality for\n * mouse events on the legend for better performance.\n */\n const delayTimeForHover = (numLabels >= 200) ? 700 : 0\n\n /**\n * Handle mouse-enter-events, used for hovering, by wrapping setActiveTraceLabel in a debounce,\n * this will delay the call to setActiveTraceLabel and can be canceled. These enhancements\n * will reduce the calls to setActiveTraceLabel that occur from quick mouse movements in the legend.\n */\n const debouncedHandleMouseEnter = debounce(() => {\n setActiveTraceLabel(label)\n }, delayTimeForHover) // ms to delay the call to setActiveTraceLabel()\n\n /**\n * Cancel the call to update the active label from the debounced-mouse-leave function\n * and call the debounced-mouse-enter function\n */\n function handleOnMouseEnter() {\n debouncedHandleMouseLeave.cancel()\n debouncedHandleMouseEnter()\n }\n\n /**\n * Cancel the call to update the active label from the debounced-mouse-enter function\n * and call the debounced-mouse-leave function\n */\n function handleOnMouseLeave() {\n debouncedHandleMouseEnter.cancel()\n debouncedHandleMouseLeave()\n }\n\n /**\n * Handle mouse leave events by resetting the active label, and wrap this call in a debounce\n * so that it can be delayed and canceled to reduce the calls to setActiveTraceLabel that occur\n * from quick mouse movements in the legend.\n */\n const debouncedHandleMouseLeave = debounce(() => {\n setActiveTraceLabel('')\n }, delayTimeForHover) // ms to delay the call to setActiveTraceLabel()\n\n\n // clicking the label will either hide the trace, or pop up a color picker\n const entryClickFunction = showColorControls ? () => setShowColorPicker(true) : toggleSelection\n\n return (\n <>\n <div\n className={`scatter-legend-row ${shownClass}`}\n role=\"button\"\n onClick={entryClickFunction}\n\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n >\n <div className=\"scatter-legend-icon\" style={iconStyle}>\n { showColorControls && <FontAwesomeIcon icon={faPalette} title=\"Change the color for this label\"/> }\n </div>\n <div className=\"scatter-legend-entry\">\n <span className=\"legend-label\" title={entry}>{entry}</span>\n <span className=\"num-points\" title={`${numPoints} points in this group`}>{numPoints}</span>\n </div>\n </div>\n { showColorPicker && !showLegendSearch &&\n <Modal\n id='color-picker-modal'\n show={showColorPicker}\n onHide={() => setShowColorPicker(false)}\n animation={false}\n bsSize='small'>\n <Modal.Body>\n <div className=\"flexbox-align-center flexbox-column\">\n <span>Select color</span>\n <span className=\"flexbox-align-center\">\n #<HexColorInput color={pickedColor} onChange={setPickedColor}/>\n &nbsp;\n <span className=\"preview-block\" style={{ background: pickedColor }}></span>\n </span>\n <HexColorPicker color={pickedColor} onChange={setPickedColor}/>\n </div>\n </Modal.Body>\n <Modal.Footer>\n <button className=\"btn btn-primary\" onClick={handleColorPicked}>OK</button>\n <button className=\"btn terra-btn-secondary\" onClick={() => setShowColorPicker(false)}>Cancel</button>\n </Modal.Footer>\n </Modal>\n }\n </>\n )\n}", "function updateLegend2() {\n // Get value of Layer selector\n var current_layer = c.selectLayer.selector.getValue();\n // Check layer\n if (current_layer == 'Time Zone'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue());\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(-12);\n c.legend2.centerLabel.setValue(0);\n c.legend2.rightLabel.setValue(12);\n } else if (current_layer == 'Solar Azimuth'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(90);\n c.legend2.centerLabel.setValue(180);\n c.legend2.rightLabel.setValue(270);\n } else if (current_layer == 'Solar Elevation'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(45);\n c.legend2.rightLabel.setValue(90);\n } else if (current_layer == 'Solar Zenith'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(45);\n c.legend2.rightLabel.setValue(90);\n } else if (current_layer == 'Solar-Surface Azimuth'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(180);\n c.legend2.rightLabel.setValue(360);\n } else if (current_layer == 'Solar-Surface Elevation'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(45);\n c.legend2.rightLabel.setValue(90);\n } else if (current_layer == 'Solar-Surface Zenith'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(45);\n c.legend2.rightLabel.setValue(90);\n } else if (current_layer == 'Slope'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(45);\n c.legend2.rightLabel.setValue(90);\n } else if (current_layer == 'Aspect'){\n c.legend2.title.setValue(c.selectLayer.selector.getValue() + ' in degrees');\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['green', 'yellow', 'yellow', 'orange', 'orange', 'blue', 'blue', 'green']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(180);\n c.legend2.rightLabel.setValue(360);\n // For hillshade\n } else {\n c.legend2.title.setValue(c.selectLayer.selector.getValue());\n c.legend2.colorbar.setParams({\n bbox: [0, 0, 1, 0.1],\n dimensions: '100x10',\n format: 'png',\n min: 0,\n max: 1,\n palette: ['black', 'white']\n });\n c.legend2.leftLabel.setValue(0);\n c.legend2.centerLabel.setValue(127.5);\n c.legend2.rightLabel.setValue(255);\n }\n}", "function jordans_createLegend(jordans) {\n\n\t//Create legend\n var jordans_legend = jordans_svg.selectAll(\"legend\")\n\t.data(jordans)\n\t.enter()\n\t.append(\"g\")\n\t.attr(\"class\", \"legend\")\n\t.on(\"click\", function(d) {\n\t\t//Reverse visible on chosen series\n\t\td.visible ? d.visible = false : d.visible = true;\n\t\t//Update graph\n\t\tjordans_update(jordans);\n\t});\n\n \tjordans_legend.append('rect')\n\t.attr('x', 80)\n\t.attr('y', function(d, i) {\n\t\treturn jordans_height - 140 - (i * 18);\n\t})\n\t.attr('width', 15)\n\t.attr('height', 15)\n\t.style('fill', function(d) {\n\t\tif (d.visible === false) {\n\t\t\treturn \"black\"\n\t\t} else {\n\t\t\treturn jordans_colors_dict[d.name];\n\t\t}\n\t})\n\t.on(\"mouseover\", function(d) {\n\t\td3.select(this).style(\"fill\", function(d) {\n\t\t\tif (d.visible === false) {\n\t\t\t\treturn colors_dict[d.name];\n\t\t\t} else {\n\t\t\t\treturn \"black\";\n\t\t\t}\n\t\t});\n\t})\n\t.on(\"mouseout\", function(d) {\n\t\td3.select(this).style(\"fill\", function(d) {\n\t\t\tif (d.visible === false) {\n\t\t\t\treturn \"black\"\n\t\t\t} else {\n\t\t\t\treturn jordans_colors_dict[d.name];\n\t\t\t}\n\t\t});\n\t});\n\n jordans_legend.append('text')\n\t.attr('x', 100)\n\t.attr('y', function(d, i) {\n\t\treturn jordans_height - 127 - (i * 18);\n\t})\n\t.text(function(d) {\n\t\tif (d.name === 'blue') {\n\t\t\treturn \"\\\"\" + \"UNIVERSITY BLUE\" + \"\\\"\"\n\t\t} else {\n\t\t\treturn \"\\\"\" + d.name.toUpperCase() + \"\\\"\";\n\t\t}\n\t});\n}", "function updateLegend(map){\n\n removeElement(\"point-text\");\n removeElement(\"point-legend\");\n\t\n if (popDenValue['max']==0)\n return;\n\n var container = document.getElementsByClassName(\"legend-control-container\")[0];\n\n $(container).append('<text id=\"point-text\">Pop Density Affected</text>');\n\n var svg = '<svg id=\"point-legend\" width=\"120px\" height=\"70px\">';\n var circles = {\n max: 25,\n mean: 45,\n min: 65\n };\n for (var circle in circles){\n svg += '<circle class=\"legend-circle\" id=\"' + circle + '\" fill=\"#000000\" fill-opacity=\"0\" stroke=\"#666666\" stroke-width=\"2\" opacity=\"1\" cx=\"35\"/>';\n svg += '<text id=\"' + circle + '-text\" fill=\"#FFFFFF\" x=\"75\" y=\"' + circles[circle] + '\"></text>';\n };\n svg += \"</svg>\";\n\n $(container).append(svg);\n\n for (var key in popDenValue){\n var radius = calcPropRadius(popDenValue[key]);\n $('#'+key).attr({\n cy: 69 - radius,\n r: radius\n });\n $('#'+key+'-text').text(Math.round(popDenValue[key]*100)/100);\n };\n}" ]
[ "0.7705349", "0.7570516", "0.75012374", "0.728045", "0.72712314", "0.7142838", "0.7106217", "0.71001184", "0.70776147", "0.70358354", "0.69971377", "0.6935705", "0.6873846", "0.682868", "0.67633307", "0.6681451", "0.66568285", "0.66276896", "0.6617666", "0.66127104", "0.64246714", "0.64178395", "0.641688", "0.641688", "0.6405936", "0.64033276", "0.63983357", "0.6351744", "0.6321632", "0.6281351", "0.62636423", "0.62624973", "0.6245716", "0.6234836", "0.62134206", "0.6203091", "0.61921346", "0.61599654", "0.6156534", "0.61533225", "0.6129884", "0.6119241", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6066809", "0.6064651", "0.60623044", "0.603811", "0.603811", "0.603811", "0.603811", "0.603811", "0.603811", "0.603811", "0.603811", "0.603811", "0.6030324", "0.59893245", "0.59888196", "0.5965867", "0.5943508", "0.5919744", "0.59169877", "0.59111845", "0.5846823", "0.5840765", "0.5835968" ]
0.6837717
13
add data to map
async function addToMap(data, name) { let empty = Boolean(false); // scrape data from text callback response let rows = data.split('\n'); if (rows.length <= 1) { empty = Boolean(true); } if (empty === false) { for (let i = 0; i < rows.length - 1; i++) { let corrupted = Boolean(false); let elements = rows[i].split(/\s+/); // The next "if" wasn't there for a good while, latest change if (elements.length !== 15) { corrupted = Boolean(true); } else { // check to make sure everything but the date is a number for (let j = 3; j < elements.length; j++) { if (isNaN(elements[j])) { console.log("Corrupted"); corrupted = Boolean(true); } } } // store each data point as an object if (corrupted === false) { let dataPoint = new DataPoint(elements[0], elements[1] + " " + elements[2], elements[3], elements[4], elements[5], elements[6], elements[7], elements[8], elements[9], elements[10], elements[11], elements[12], elements[13], elements[14]); dataPoints.push(dataPoint); } } // sort by date to make sure the datapoints are in // order from oldest to newest, which for "all" // requires work but for the individual floats the // input came sorted already dataPoints = selectionSort(dataPoints); console.log("datapoints size given name: " + name + " " + dataPoints.length); // set up panning bounds let bounds = new google.maps.LatLngBounds(); // set up variables let legLength; let legSpeed; let legTime; let netDisplacement; let totalDistance; let totalTime; let avgVelocity; let EEZ; let GEBCODepth; let marker; // iterate over arrays, placing markers let k = 0; //k value labels floats in cases where some are turned off in legend (fixes problems with arrow keys on map) let initial=0; let data; //Grab data for floats given the tab the map is currentlu in if (name === 'all') { data = await grabAllData(); } else { data = await grabIndData(name); } //Properly account for the index of the data table given we are only looking for the most recent 30 float points let iniIndex=0; if (showAll === false){ iniIndex=data.length-60; if(iniIndex<0){ iniIndex=0; } } for (let i = 0; i < dataPoints.length; i++) { let latLng = new google.maps.LatLng(dataPoints[i].stla, dataPoints[i].stlo); // set up marker, fade on age, unless using the 'all' option if (showDict[dataPoints[i].owner] === true) { if(k===0){ initial = k; } if (name === 'all') { marker = new google.maps.Marker({ position: latLng, map: map, clickable: true }); } else { // if (slideShowOn === true) { // await sleep(1000); // } // // expand bounds to fit all markers // bounds.extend(marker.getPosition()); marker = new google.maps.Marker({ position: latLng, map: map, clickable: true, // opacity between a minop and maxop opacity: (i + 1) / dataPoints.length }); } // Alternate coloring for floats.. // GEOAZUR MERMAIDs if (dataPoints[i].owner === "geoazur") { marker.setIcon(icons.geoazur.icon); // Dead MERMAIDs } else if (dataPoints[i].owner === "dead") { marker.setIcon(icons.dead.icon); // SUSTECH MERMAIDs } else if (dataPoints[i].owner === "sustech") { marker.setIcon(icons.sustech.icon); // Princeton MERMAIDs } else if (dataPoints[i].owner === "princeton") { marker.setIcon(icons.princeton.icon); // Stanford MERMAIDs } else if (dataPoints[i].owner === "stanford") { marker.setIcon(icons.stanford.icon); // JAMSTEC MERMAIDs } else if (dataPoints[i].owner === "jamstec") { marker.setIcon(icons.jamstec.icon); } // expand bounds to fit all markers bounds.extend(marker.getPosition()); //Handle case of all floats separately from individual floats if (name !== 'all'){ EEZ = await eezFinder(dataPoints[i].stla, dataPoints[i].stlo, EEZList, AllGeometries); // Get float data from data array netDisplacement = data[iniIndex+i][2]/1000; totalDistance = data[iniIndex+i][3]/1000; totalTime = data[iniIndex+i][4]; // Fills data with depth so makeWMSrequest becomes superfluous GEBCODepth = data[iniIndex+i][5]; if (totalTime === 0) { avgVelocity = 0; } else { avgVelocity = (totalDistance / totalTime); } legLength = data[iniIndex+i][0]/1000; legTime = data[iniIndex+i][1]; // avoid division by zero when calculating velocity if (legTime === 0) { legSpeed = 0; } else { legSpeed = legLength / legTime; } } else if (name === 'all') { //Gather proper float information for all floats EEZ = await eezFinder(dataPoints[i].stla, dataPoints[i].stlo, EEZList, AllGeometries); let dataArr = data.filter(item => item[0]===dataPoints[i].name); netDisplacement = dataArr[0][1]/1000; totalDistance = dataArr[0][2]/1000; totalTime = dataArr[0][3]; GEBCODepth = dataArr[0][4] if (totalTime === 0) { avgVelocty = 0; } else { avgVelocity = (totalDistance / totalTime); } } let allPage = name === 'all'; // create info windows setInfoWindow(allPage, k, i, marker, netDisplacement, totalDistance, avgVelocity, totalTime, legLength, legSpeed, legTime, GEBCODepth, EEZ, 0, 0); markers.push(marker); k++; } } // pan to bounds // updated to use a min zoom (13) to avoid missing imagery map.fitBounds(bounds); let listener = google.maps.event.addListener(map, "idle", function () { if (map.getZoom() > 12) map.setZoom(12); google.maps.event.removeListener(listener); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addData(key, value) {\n this.Serialize.addData(key, value);\n }", "function add(map, key, value) {\n fetch(map, key).add(value);\n}", "function add(map, key, value) {\n fetch(map, key).add(value);\n}", "function eqfeed_callback(data) {\n map.data.addGeoJson(data);\n }", "function eqfeed_callback(data) {\n map.data.addGeoJson(data);\n }", "function putEntry(data) {\n db.get(\"data_entries_point\").push(data).write();\n}", "function addData(data) {\n console.log(' Adding Keys ');\n Keys.insert(data);\n}", "function addData(data) {\n console.log(` Adding: ${data.name} (${data.icon})`);\n Reports.insert(data);\n}", "function addData(data) {\n console.log(` Adding: ${data.building} audit data`);\n Data.insert(data);\n}", "add (data) {\n if (!data) return this;\n var size = this.size();\n data = data.map((entry) => {\n if (typeof entry === 'object') entry._id = ++size;\n else entry = {_id: ++size, data: entry};\n return entry;\n });\n this.cf.add(data);\n dataEvents.call('data', this, data);\n return this;\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 addDataToMap(dataLayer, choice) {\n var url = 'https://eichnersara.cartodb.com/api/v2/sql?' + $.param({\n q: 'SELECT * FROM bk_oddlots ' + choice,\n format: 'GeoJSON'\n });\n $.getJSON(url)\n \n .done(function (data) {\n dataLayer.clearLayers();\n dataLayer.addData(data);\n console.log(data);\n });\n}", "appendMapData(newData, coordinates, scene) {\n const parkingSpaceCalcInfo = [];\n for (const kind in newData) {\n if (!newData[kind]) {\n continue;\n }\n\n if (!this.data[kind]) {\n this.data[kind] = [];\n }\n\n for (let i = 0; i < newData[kind].length; ++i) {\n switch (kind) {\n case 'lane':\n const lane = newData[kind][i];\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addLane(lane, coordinates, scene),\n text: this.addLaneId(lane, coordinates, scene),\n }));\n break;\n case 'clearArea':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addZone(\n newData[kind][i], colorMapping.YELLOW, coordinates, scene,\n ),\n }));\n break;\n case 'crosswalk':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addZone(\n newData[kind][i], colorMapping.PURE_WHITE, coordinates, scene,\n ),\n }));\n break;\n case 'junction':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addBorder(\n newData[kind][i], colorMapping.BLUE, coordinates, scene,\n ),\n }));\n break;\n case 'pncJunction':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addZone(\n newData[kind][i], colorMapping.BLUE, coordinates, scene,\n ),\n }));\n break;\n case 'signal':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addStopLine(\n newData[kind][i].stopLine, coordinates, scene,\n ),\n }));\n this.trafficSignals.add([newData[kind][i]], coordinates, scene);\n break;\n case 'stopSign':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addStopLine(\n newData[kind][i].stopLine, coordinates, scene,\n ),\n }));\n this.stopSigns.add([newData[kind][i]], coordinates, scene);\n break;\n case 'yield':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addStopLine(\n newData[kind][i].stopLine, coordinates, scene,\n ),\n }));\n this.yieldSigns.add([newData[kind][i]], coordinates, scene);\n break;\n case 'road':\n const road = newData[kind][i];\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addRoad(road, coordinates, scene),\n }));\n break;\n case 'parkingSpace':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addBorder(\n newData[kind][i], colorMapping.YELLOW, coordinates, scene,\n ),\n text: this.addParkingSpaceId(newData[kind][i], coordinates, scene),\n }));\n parkingSpaceCalcInfo.push(this.calcParkingSpaceExtraInfo(newData[kind][i],\n coordinates));\n break;\n case 'speedBump':\n this.data[kind].push(Object.assign(newData[kind][i], {\n drewObjects: this.addCurve(\n newData[kind][i].position, colorMapping.RED, coordinates, scene,\n ),\n }));\n break;\n default:\n this.data[kind].push(newData[kind][i]);\n break;\n }\n }\n }\n return [parkingSpaceCalcInfo];\n }", "function add(key, value) {\r\nthis.datastore[key] = value;\r\n}", "function addValueToMap(map, key, value) {\n //if the list is already created for the \"key\", then uses it\n //else creates new list for the \"key\" to store multiple values in it.\n map[key] = map[key] || [];\n map[key].push(value);\n}", "function add(key, value) {\n\tthis.dataStore[key] = value;\n}", "addPlace(x, y) {\n const place = { x: x, y: y, empty: true };\n\n this.map.push(place);\n }", "function addData(data) {\n console.log(` Adding: ${data.name} (${data.owner})`);\n Spots.insert(data);\n // Spots.findOne({ name: data.name }).createIndex(\n // { nameIndex: data.name },\n // );\n}", "function mapData(map, data) {\n var newData = {};\n $.each(data, function(p, v) {\n if ( typeof map[p]==='undefined' ) {\n newData[p] = data[p];\n } else {\n newData[map[p]] = data[p];\n }\n });\n return newData;\n}", "_addKeyToData(key) {\n if (!this.data.hasOwnProperty(key)) {\n this.data[key] = {};\n return true;\n }\n\n return false;\n }", "function setHeatMapData(mapData){\n\n\tdata.data = mapData;\n\theatmapLayer.setData(data);\n\n}", "function addLevelDBData(key,value){\n console.log('Add data to level db ' + key + ' value ' + value);\n db.put(key, value, function(err) {\n if (err) return `Block ${key} submission failed: ${err}`;\n })\n}", "function addData(data) {\n console.log(` Adding: Tag (${data.name})`);\n Tags.insert(data);\n}", "function addUserToMap(userName){\nusersMap.push(userName);\n}", "function processData(data) {\n mapData = data[0]\n incidence = data[1];\n mortality = data[2]\n for (var i = 0; i < mapData.features.length; i++) {\n mapData.features[i].properties.incidenceRates = incidence[mapData.features[i].properties.adm0_a3];\n mapData.features[i].properties.mortalityRates = mortality[mapData.features[i].properties.adm0_a3];\n }\n drawMap()\n}", "function updateGeocoderObject(data, zoom, type) {\r\n // add property zoom level to the features\r\n data.features = data.features.map((feature) => {\r\n feature.properties.type = type;\r\n feature.properties.zoom = zoom;\r\n\r\n return feature;\r\n });\r\n\r\n console.log(data);\r\n searchData.push(...data.features);\r\n}", "function addData(obj) {\n data.push(obj);\n \n updateDOM();\n}", "function updateMap(){\n //nullifying tendieMap to rewrite it\n tendieMap = new Map();\n //getting the tendielist file \n var tendieList = fs.readFileSync('./tendie/tendiebox.txt', 'utf8');\n //splitting up the tendie list \n var tendieArray = tendieList.split(\"|\");\n \n //now storing the data in tendieMap\n for(i=0;i<tendieArray.length/2;i+=2){\n tendieMap.set(tendieArray[i],new user.tendieUser(tendieArray[i],tendieArray[i+1]));\n }\n}", "function on_data(data) {\n data_cache[key] = data;\n placeholder.update();\n }", "function addLevelDBData(key,value){\n db.put(key, value, function(err) {\n if (err) {\n return ('Block ' + key + ' submission failed', err);\n // reject('error in addLevelDBData')\n\n }else{\n // getLevelDBData(key);\n }\n \n \n })\n \n \n }", "addRequest(key, data) {\n this.requests[key] = {\n query_key: data.query_key,\n timestamp: data.timestamp,\n data_hash: data.data_hash,\n };\n }", "function addData(obj) {\n data.push(obj);\n updateDOM();\n}", "function addData(obj) {\n data.push(obj);\n updateDOM();\n}", "function addData(obj) {\r\n data.push(obj);\r\n\r\n updateDOM();\r\n}", "function addTopoData(topoData) {\n topoLayer.addData(topoData);\n topoLayer.addTo(map0)\n topoLayer.eachLayer(handleLayer);\n }", "function addLocationData(data3) {\n originLatitude = data3[0][0];\n originLongitude = data3[0][1];\n}", "function addPlace(lData) {\n// console.log(\"add Place: \" + JSON.stringify(lData.title));\n lData.mapMarkerDetail.setMap(map);\n}", "function addLevelDBData(key, value) {\n return db.put(key, value);\n}", "function addData(obj) {\n data.push(obj);\n\n updateDOM();\n}", "function addData(obj) {\n data.push(obj);\n\n updateDOM();\n}", "function addData(obj) {\n data.push(obj);\n\n updateDOM();\n}", "addData(datum) {\n this.data.push(datum);\n }", "addData(datum) {\n this.data.push(datum);\n }", "function markersOnAdded(data) {\n root.mapAddMarker(fireBaseGetMarkerData(data));\n }", "function drawMap(data) {\n // Assigns data from server to client's foodTrucks variable\n foodTrucks = data;\n\n // Adds a marker for every foodtruck\n Object.keys(foodTrucks).forEach(function(key, index) {\n const foodTruck = foodTrucks[key];\n const xPos = foodTrucks[key].xPos;\n const yPos = foodTrucks[key].yPos;\n\n addMarker(xPos, yPos, foodTruck);\n });\n}", "function Map2(data) {\n this.map = new Map;\n this.size = 0;\n if (data) {\n for (var i = 0; i < data.length; i++) {\n var d = data[i];\n this.set(d[0], d[1], d[2]);\n }\n }\n}", "function add_application_data_for_group(group,application,data){\n var temp = group_application_map.get(group);\n if(temp)\n {\n if(temp.hasOwnProperty(application)){\n temp[application].push(data);\n }else{\n temp[application]=[data];\n }\n }else {\n var temp = {};\n temp[application]=[data];\n group_application_map.set(group,temp);\n }\n console.log(\"add application for group\",group_application_map);\n //process_registerd_promises();\n }", "function addData(data) {\n console.log(` Adding: ${data.title}`);\n console.log(` Adding: ${data.date}`);\n console.log(` Adding: ${data.image}`);\n console.log(` Adding: ${data.category}`);\n console.log(` Adding: ${data.price}`);\n console.log(` Adding: ${data.description}`);\n console.log(` Adding: ${data.location}`);\n console.log(` Adding: ${data.owner}`);\n Items.insert(data);\n}", "function AddData() {\n var i;\n for (i = 0; i < app.entries.length; i++) {\n myEmotionalData.push(app.entries[i].slider);\n myDateData.push(app.entries[i].date);\n }\n}", "function addLevelDBData(key,value){\n db.put(key, value, function(err) {\n if (err) return console.log('Block ' + key + ' submission failed', err);\n })\n}", "function addLevelDBData(key,value){\n db.put(key, value, function(err) {\n if (err) return console.log('Block ' + key + ' submission failed', err);\n })\n}", "newMap(){\n\t\tthis.idIterator = 1;\n\n\t\tthis.currentFeature = new Feature(this.assignId());\n\n\t\tthis.geo = {};\n\t\tthis.geo.type = \"FeatureCollection\";\n\t\tthis.geo.features = [];\n\t}", "add_entry(entry) {\n this.dictionary.push(entry)\n }", "function addData(data) {\n var dps = data.item;\n for (var i = 0; i < dps.length; i++) {\n //Memasukan value get kedalam array dataPoints\n dataPoints.push({\n x: new Date(dps[i][0]),\n y: dps[i][1],\n label : direction(dps[i][1])\n });\n }\n chart.render();\n }", "function addWeatherInfo(_data, err, cb) {\n if (err) {\n cb(err, _data);\n } else {\n var lat = _data[\"items\"][0].latitude\n var lng = _data[\"items\"][0].longitude\n if (weatherCache[lat+\"\"+lng] == undefined) {\n forecast = new Forecast(options);\n forecast.get(latitude, longitude, function(error, data) {\n if (!err) {\n _data[\"items\"][0].weather = data;\n weatherCache[lat+\"\"+lng] = data;\n }\n cb(err, _data);\n });\n } else {\n _data[\"items\"][0].weather = weatherCache[lat+\"\"+lng];\n cb(err, _data);\n }\n }\n}", "add(item) {\n this.data.push(item);\n }", "function addData(data) {\n console.log(` Adding: ${data.name} (${data.owner})`);\n Patients.insert(data);\n}", "function addData(data) {\n console.log(` Adding: ${data.title} (${data.owner})`);\n Foods.insert(data);\n}", "function put(data) {\n\tvar pos = this.betterHash(data) ;\n\tthis.table[pos] = data;\n}", "async add_post(id, data) {\n var marker = L.marker([data[\"lat\"], data[\"lon\"]], {\n icon: selfieIcon,\n eventid: data['eventid']\n }).addTo(map)\n console.log(data)\n marker.bindPopup(postView(data));\n var m = L.layerGroup([marker]);\n m.addTo(map);\n map.closePopup();\n\n }", "function addData(a)\n {\n if(isObject(a.event.value) || isArray(a.event.value))\n {\n if(!isObservable(a.event.value))\n {\n a.preventDefault();\n var local = a.event.local,\n str = local.__kbscopeString+(local.__kbscopeString.length !== 0 ? '.' : '')+a.key,\n builder = (isObject(a.event.value) ? KObject : KArray)(local.__kbname,local,str);\n \n overwrite(builder).parseData(a.event.value);\n if(local[a.key] === undefined)\n {\n local.add(a.key,builder);\n }\n else if(isArray(local))\n {\n local.splice(a.key,0,builder);\n }\n else if(isObject(local))\n {\n local.set(a.key,builder);\n }\n }\n }\n }", "add(key, value) {\r\n const hash = this.calculateHash(key);\r\n if(!this.values.hasOwnProperty(hash)) {\r\n this.values[hash] = {};\r\n }\r\n if(!this.values[hash].hasOwnProperty(key)) {\r\n this.numberOfValues++;\r\n }\r\n this.values[hash][key] = value;\r\n }", "function addData() {\n // resets all info on the page\n resetTeamPage();\n // adds in images\n addImagesToPage();\n // adds in pit data\n addPitDataToPage();\n // adds in prescout data\n if (Object.keys(prescout_data).length !== 0) {\n addPrescoutDataToPage();\n }\n // adds in stand data\n addStandDataToPage();\n // adding average/mean/max to btn-div (non match-specific)\n addOverallStatsToPage();\n // adds in notes data\n addNotesToPage();\n // view data button functionality\n addDataToViewDataButton();\n // hides sensitive info if applicable\n displaySensitiveInfo();\n}", "add(key, value) {\n let check = this.generalCheck(key);\n if (check.errMsg) return check;\n\n let hash = this.hashKeyFun(key);\n // console.log(hash);\n if (!this.map[hash]) {\n this.map[hash] = new LinkedList();\n }\n // console.log(this.map[hash]);\n let bucket = { [key]: value };\n this.map[hash].add(bucket);\n }", "function getLocationData(inData){\n let newTableData = [];\n //console.log(inData)\n\n inData.forEach(function(d){\n let flag = 0;\n let datum = {};\n \n datum.count=1;\n datum.lng = +d.lng;\n datum.lat = +d.lat;\n datum.location = d.user_location;\n\n for(var i=0; i<newTableData.length; i++){\n if((datum.lng==newTableData[i].lng) && (datum.lat==newTableData[i].lat)){\n flag = 1;\n newTableData[i].count += 1;\n break;\n }\n }\n\n if (flag==0){\n newTableData.push(datum);\n }\n })\n\n //console.log(newTableData);\n\n //clear map\n vectorLayer.getSource().clear();\n \n //add new data points\n newTableData.forEach(function(d){\n add_map_point(d.lng,d.lat,(d.count).toString(),d.location);\n })\n}", "_addMap(map) {\n this._selectedMaps.push(map);\n this._eventBus.trigger(EVENT.TOGGLE_VIDEO_MAP, this._selectedMaps);\n }", "function getDataAddFactor({ label, value, map }) {\n\tconsole.log(label, value);\n\tfactor = label;\n\tmap.eachLayer(function (layer) {\n\t\tmap.removeLayer(layer);\n\t});\n\tvar platesLayer = createPlatesLayer(globalData);\n\tplatesLayer.addTo(myMap);\n}", "add(data) {\n // check if data was already in the array\n if (this.dataStore.indexOf(data) < 0) {\n this.dataStore.push(data);\n return true;\n } else {\n return false;\n }\n }", "function add ( name, text ) {\n data.push( { id: data.length, name: name, text: text } );\n}", "function addItem(item){\n var hash = getHashItem(item);\n spatialhashing[hash]=spatialhashing[hash]||[];\n spatialhashing[hash].push(item);\n}", "function addDataToMap(dataIndex) {\n\n // data container\n var plotData = {};\n\n // loop over the original dataset to fix the data format and find minMax\n $.each(internetData, function(_, entry) {\n\n // if first time using the data transform to 3 letter ISO country code\n if (entry.ISO.length < 3) {\n entry.ISO = countryConverter(entry.ISO);\n }\n });\n\n /* Remove the old legend. \n * While this is a bit of a 'hacky way to do it' it seems like datamaps \n * is actually working pretty smoothly when doing it this way.\n * More fancy 'd3-type' changes caused all kinds of complications, making\n * them not worth my time to fix.\n */\n $('.datamaps-legend').remove();\n // set the new map scale\n var scale = setMapScale(dataIndex);\n\n // remake the legend\n var mapLegend = {\n legendTitle: cleanText(dataIndex),\n defaultFillName: 'No data',\n labels: {}\n };\n\n // all data entries will be 9 categories, so again a bit of an 'ugly' fix\n for (var i = 0; i < 9; i++) {\n\n // this functions gives you the upper and lower bounds of a quantized scale\n var bounds = scale.invertExtent(i);\n mapLegend.labels[i] = String(parseInt(bounds[0])) + '-' + String(parseInt(bounds[1]));\n }\n\n // prepare the new data to be visualized\n $.each(internetData, function(_, entry) {\n plotData[entry.ISO] = {\n value: entry[dataIndex],\n fillKey: scale(entry[dataIndex])\n }\n });\n\n // update both map and legend\n map.updateChoropleth(plotData);\n map.legend(mapLegend);\n}", "function addData(item) {\n ns_newboard = {};\n ns_newboard.money = START_MONEY;\n ns_newboard.privileges = [1, 2, 3, 4, 5];\n ns_newboard.barrels = set_vector(0, NUM_OF_BARRELS);\n ns_newboard.brewmaster = BMASTER_START;\n ns_newboard.scoring_disks = set_vector(0, MAX_SCORING_DISKS);\n ns_newboard.scored_privs = set_vector(0, ns_newboard.privileges.length);\n ns_newboard.sunny = set_vector(-1, HALF_MAP_SIZE);\n ns_newboard.shady = set_vector(-1, HALF_MAP_SIZE);\n ns_newboard.sheds = set_vector(-1, NUM_OF_SHEDS);\n ns_newboard.prev_sq = -1;\n ns_newboard.cur_sq = 0;\n ns_newboard.resources = {};\n RCOLOR.forEach(set_resources);\n ns_newboard.canIncRes = false;\n ns_glob_board[item] = ns_newboard;\n }", "function drawTTCDataonMap(data)\n{\n //console.log(\"drawTTCDataonMap recived data as: \", data);\n var numberOfVehicles = data.length;\n console.log(\"numberOfVehicles is: \", numberOfVehicles);\n\n // Formatting the data to send to ttcHeatmap\n var i;\n for(i = 0; i < numberOfVehicles; i++)\n {\n var latitude = data[i][\"coordinates\"][1];\n var longitude = data[i][\"coordinates\"][0];\n var entry = new google.maps.LatLng(latitude, longitude);\n ttcVehicleLocations.push(entry);\n }\n //console.log(\"ttcVehicleLocations is: \", ttcVehicleLocations);\n initTTCHeatMap();\n}", "addType(id, data) {\n this.types[id] = new TypeData(data);\n }", "function populateMap(data, map) {\n data.businesses.forEach(business => {\n let lati = business.coordinates.latitude;\n let long = business.coordinates.longitude;\n L.mapquest.textMarker([lati, long], {\n text: business.name,\n type: 'marker',\n position: 'bottom',\n alt: business.name + 'Rating:' + business.rating + 'out of 5 stars' + 'Number of reviews:' + business.review_count + 'Read more about' + business.name + 'on Yelp',\n icon: {\n primaryColor: '#333333',\n secondaryColor: '#333333',\n size: 'sm',\n },\n }).bindPopup(`${business.name} <br>Rating: ${business.rating}/5 <br>Reviews: ${business.review_count} <br><a target='_blank' aria-label='Read more about ${business.name} on Yelp' href=${business.url}>Yelp</a>`).openPopup().addTo(map);\n });\n watchHomeButton(); \n}", "function buildDataMap() {\n // Creating a p-element with the identity \"date\"\n let datamap_container = document.getElementById(\"datamap_container\");\n let text = document.createElement(\"P\");\n let date = new Date();\n text.setAttribute(\"id\", \"date\");\n datamap_container.prepend(text);\n text.style.textAlign = \"center\";\n text.style.fontSize = \"large\";\n \n // Changing date to the preferred format\n let day = date.getDate();\n let month = date.getMonth() + 1;\n let year = date.getFullYear() - 2000;\n \n // The date as a string\n let strDate = month.toString() + \"/\" + day.toString() + \"/\" + year.toString();\n \n // Changing the date to the current day\n document.getElementById(\"date\").innerHTML = strDate;\n \n for(let country of Object.keys(codeMap)) {\n // get the country code\n let ccode = codeMap[country];\n // Update the color of the country in question first\n if(caseMap[ccode] != undefined) {\n let color = getColor(caseMap[ccode][\"confirmed\"],caseMap[ccode][\"deaths\"]);\n dmap.options.data[ccode] = color;\n dmap.updateChoropleth(dmap.options.data);\n console.log(\"Initialization \" + ccode + \" \" + color);\n console.log(\"Confirmed: \" + caseMap[ccode][\"confirmed\"] + \" Deaths: \" + caseMap[ccode][\"deaths\"]);\n }\n else {\n dmap.options.data[ccode] = DEFAULT_FILL;\n dmap.updateChoropleth(dmap.options.data);\n }\n }\n }", "add(index, instance) {\n // Add a single object only one parameter is passed\n // so index = instance\n if( instance === undefined) this.map.set( 0, index );\n else this.map.set( index, instance );\n }", "function overwriteToMap(deviceName, map, key, value) {\n initMap(map, deviceName);\n initMap(map[deviceName], key);\n\n var obj = {value : value};\n map[deviceName][key] = [];\n map[deviceName][key].push(obj);\n}", "function createPropSymbols(data, map){\n \n //create a Leaflet GeoJSON layer and add it to the map\n L.geoJson(data, {\n pointToLayer:pointToLayer\n }).addTo(map);\n}", "_addConfigElements(store, data) {\n\t\tObject.keys(data).forEach((name) => {\n\t\t\tdata[name].name = name;\n\t\t\tstore[name] = data[name];\n\t\t});\n\t}", "function add (name, text) {\n data.push({ name: name, text: text, id: String(data.length) });\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}", "setAxisDataMap() {\n this.axisDataMap = this._createAxesData();\n }", "function generateMapData() {\n map.clearMap();\n database.readCurrentDelays(extractionCallback);\n }", "function addToHashMap(hashmap, line) {\r\n if (hashmap[line[5]] == undefined) {\r\n hashmap[line[5]] = [];\r\n }\r\n hashmap[line[5]].push(line);\r\n }", "addDataToFront(data) {}", "function makeMap(data) {\r\n var mapData = {};\r\n // Link mobile phone dataset with countrycodes and categorize the mobile phone dataset\r\n for (i = 0; i < data.length; i++){\r\n var object = data[i];\r\n\r\n\r\n for (j = 0; j < countryCodes.length; j++){\r\n // [\"...\"] to be able to walk over strings\r\n if (object[\"Mobile cellular subscriptions (per 100 people)\"] == countryCodes[j][2]){\r\n object.countryCodes = countryCodes[j][1]\r\n }\r\n }\r\n\r\n // Within the Countrycode object, create a fillkey and add the countryname and # of cellphones\r\n // No Data (to append to Json, source: http://stackoverflow.com/questions/736590/add-new-attribute-element-to-json-object-using-javascript)\r\n if (object[\"2011\"] == null){\r\n mapData[object.countryCodes] = {fillKey: \"noData\",\r\n name: object[\"Mobile cellular subscriptions (per 100 people)\"],\r\n cellphones: object[\"2011\"]}\r\n }\r\n\r\n // 0-33 phones per 100 people ()\r\n if (0 < object[\"2011\"] && object[\"2011\"] <= 33){\r\n mapData[object.countryCodes] = {fillKey: \"phones0To33\",\r\n name: object[\"Mobile cellular subscriptions (per 100 people)\"],\r\n cellphones: object[\"2011\"]}\r\n } \r\n\r\n // 34-66 Phones per 100 people\r\n if (34 <= object[\"2011\"] && object[\"2011\"] <= 66){\r\n mapData[object.countryCodes] = {fillKey: \"phones34To66\",\r\n name: object[\"Mobile cellular subscriptions (per 100 people)\"],\r\n cellphones: object[\"2011\"]}\r\n }\r\n\r\n // 67-99 phones per 100 people\r\n if (67 <= object[\"2011\"] && object[\"2011\"] <= 100){\r\n mapData[object.countryCodes] = {fillKey: \"phones67To99\",\r\n name: object[\"Mobile cellular subscriptions (per 100 people)\"],\r\n cellphones: object[\"2011\"]}\r\n }\r\n\r\n // 100 - 133 phones per 100 people\r\n if (100 <= object[\"2011\"] && object[\"2011\"] <= 133){\r\n mapData[object.countryCodes] = {fillKey: \"phones100To133\",\r\n name: object[\"Mobile cellular subscriptions (per 100 people)\"],\r\n cellphones: object[\"2011\"]}\r\n }\r\n\r\n // 134+ phones per 100 people\r\n if (134 <= object[\"2011\"]){\r\n mapData[object.countryCodes] = {fillKey: \"phones134AndMore\",\r\n name: object[\"Mobile cellular subscriptions (per 100 people)\"],\r\n cellphones: object[\"2011\"]}\r\n }\r\n }\r\n \r\n // Creating the map\r\n var map = new Datamap ({\r\n element: document.getElementById('container'),\r\n\r\n // Fill the countries with the right colors (https://www.w3schools.com/colors/colors_hexadecimal.asp)\r\n fills: {\r\n 'noData': \"grey\",\r\n 'phones0To33': \"#33f40c\",\r\n 'phones34To66': \"#20a420\",\r\n 'phones67To99': \"#207b20\",\r\n 'phones100To133': \"#205b20\",\r\n 'phones134AndMore': \"#203020\",\r\n defaultFill: \"grey\" \r\n },\r\n // Input data\r\n data: mapData,\r\n // Styling\r\n geographyConfig: {\r\n borderColor: 'black',\r\n highlightBorderColor: 'white',\r\n highlightOnHover: true,\r\n highlightFillColor: false,\r\n popupTemplate: function(geography, mapData) {\r\n return '<div class=\"hoverinfo\">' + 'Number of cellphones: '\r\n + mapData.cellphones + '<br> Country name: ' + mapData.name \r\n }\r\n }\r\n\r\n });\r\n\r\n // Creating a legend \r\n map.legend({\r\n legendTitle: \"# Phones per 100 people\",\r\n labels: {\r\n noData: \"No data in dataset\",\r\n phones0To33: \"0-33\",\r\n phones34To66: \"34-66\",\r\n phones67To99: \"67-99\",\r\n phones100To133: \"100-133\",\r\n phones134AndMore: \"134+\"\r\n }\r\n });\r\n}", "function addData(data) {\n console.log(` Adding: ${data.firstName} (${data.owner})`);\n Vaccine.collection.insert(data);\n}", "function add(item) {\n data.push(item);\n console.log('Item Added...');\n }", "addToJSMap(ctx, map) {\n for (const {\n source\n } of this.value.items) {\n if (!(source instanceof stringifyNumber.YAMLMap)) throw new Error('Merge sources must be maps');\n const srcMap = source.toJSON(null, ctx, Map);\n\n for (const [key, value] of srcMap) {\n if (map instanceof Map) {\n if (!map.has(key)) map.set(key, value);\n } else if (map instanceof Set) {\n map.add(key);\n } else if (!Object.prototype.hasOwnProperty.call(map, key)) {\n Object.defineProperty(map, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n }\n }\n\n return map;\n }", "addEntry(entry) {\n const newStore = new Map(this.store);\n newStore.set(entry.toVertex, entry);\n return new ResultMap(newStore);\n }", "_addItemsToData(data, league, api) {\n // Add keys if necessary\n this._addKeyToData(league);\n this._addKeyToLeagueData(league, api.type);\n\n this.data[league][api.type] = data.lines;\n }", "function inject_data(items, item_data) {\n items.forEach(item=>{for (let key in item_data[item.id]) item[key] = item_data[item.id][key];});\n }", "function addTopoData(topoData) {\r\n // Add data to the layer\r\n topoLayer.addData(topoData);\r\n // Add layer to the map\r\n topoLayer.addTo(map);\r\n\r\n // Color each layer according to attribute value\r\n // And add some event listeners to each layer\r\n topoLayer.eachLayer(handleLayer);\r\n\r\n createLegend();\r\n // Create a legend for the map if the screen size is large enough\r\n if ($(window).width() < 768) {\r\n $('.legend-control-container').hide();\r\n }\r\n // Create window event listener to switch legend on/off depending on window width\r\n window.addEventListener(\"resize\", (function() {\r\n if ($(window).width() < 768) {\r\n $('.legend-control-container').hide();\r\n } else if ($(window).width() >= 768) {\r\n $('.legend-control-container').show();\r\n }\r\n }))\r\n\r\n }", "function addToData(worksetid) {\n addid(worksetid);\n var wsResponse;\n\n function wsListener () {\n wsResponse = JSON.parse(this.responseText);\n wsResponse.forEach(function (d) { \n ldinjs.createDataObject(d.value,d.id);\n });\n ldinjs.markupSearch();\n } \n\n var oReq = new XMLHttpRequest();\n oReq.open(\"POST\", \"/worksets/items\", true);\n oReq.addEventListener(\"load\", wsListener);\n oReq.setRequestHeader(\"Content-type\", \"application/json\");\n oReq.send(JSON.stringify({'id': worksetid}));\n }", "function addData(newUser) {\n data.push(newUser);\n updateDOM();\n}", "function addData(newUser){\n data.push(newUser);\n updateDOM();\n}", "function addweather(data) {\n fetch('/weather', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Accept': 'application/json'\n },\n body: JSON.stringify({\n lat: data[1],\n lng: data[2]\n })\n })\n .then(res => {\n if (res.status >= 200 && res.status < 300)\n return Promise.resolve(res.json());\n else\n return Promise.reject(new Error(res.statusText));\n })\n .then(data => {\n setdata(data);\n })\n}", "async function addGeoCodeData() {\n\t\t\tconst geoCoded = deDuplicatedData.map((row, i) => {\n\t\t\t\t// apply limiter to prevent being rate-limited\n\t\t\t\treturn limiter.schedule(() => {\n\t\t\t\t\treturn GoogleApi.geoCode(row, apiKey, i);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn await Promise.all(geoCoded).then((info) => info);\n\t\t}", "function renderMap(data) {\n // `data` is an array of objects\n // console.log(data);\n // Add each object to the map if `latitude` and `longitude` are available\n data.forEach(function(obj) {\n if (obj['latitude'] != undefined){\n if (obj['longitude'] != undefined){\n // Use `bindPopup()` to add `type`, `datetime`, and `address` properties\n L.marker([obj['latitude'], obj['longitude']]).addTo(seattleMap)\n .bindPopup('<strong>' + obj['name'] + '</strong>' \n + '<br>' + '<strong>' + 'Phone Number: '+ '</strong>' + obj['phone_number']\n + '<br>' + '<strong>' + 'Address: ' + '</strong>' + obj['address']\n + '<br>' + obj['city'] + ', ' + obj['state'])\n }\n }\n });\n}" ]
[ "0.65148616", "0.65142655", "0.65142655", "0.64365965", "0.64306176", "0.6401961", "0.63153934", "0.6273486", "0.62699276", "0.62332815", "0.6221927", "0.621562", "0.6175734", "0.6158281", "0.61183894", "0.6114473", "0.60513574", "0.60421544", "0.6038233", "0.5992232", "0.5984247", "0.5958212", "0.59447694", "0.59392583", "0.5934449", "0.59328544", "0.5911769", "0.58989376", "0.58978695", "0.58924127", "0.5884463", "0.5883473", "0.5883473", "0.5875468", "0.5874494", "0.5870699", "0.5855167", "0.585447", "0.58495337", "0.58495337", "0.58495337", "0.5845021", "0.5845021", "0.5844448", "0.5824483", "0.5801173", "0.5786371", "0.5768455", "0.57636493", "0.57545865", "0.57545865", "0.5747124", "0.57464164", "0.5742744", "0.5739048", "0.57376295", "0.573243", "0.57270473", "0.57263225", "0.57240725", "0.5723122", "0.57105935", "0.57003266", "0.5693464", "0.5685617", "0.568059", "0.5676174", "0.5667817", "0.5665904", "0.5665742", "0.5662434", "0.56515235", "0.5650721", "0.5649219", "0.5637511", "0.56340206", "0.56312263", "0.5617012", "0.56097215", "0.559686", "0.55950266", "0.5592175", "0.55907714", "0.55860764", "0.55849004", "0.5582386", "0.55785996", "0.55763566", "0.55589783", "0.55524087", "0.5550686", "0.55363476", "0.5524804", "0.5522467", "0.551885", "0.55145144", "0.5511993", "0.5509803", "0.5504543", "0.5503257" ]
0.62823504
7
for dynamic info windows
function setInfoWindow(allPage, k, i, marker, netDisplacement, totalDistance, avgVelocity, totalTime, legLength, legSpeed, legTime, GEBCODepth, EEZ, lat, lng) { // No more live requests since the data get read by grabIndData // makeWMSrequest(dataPoints[k]); google.maps.event.addListener(marker, 'click', function (event) { // close existing windows closeIWindows(); if (allPage!=='drop'){ markerIndex = k; } //Redeclare variables for jQuery (it doesn't work if I don't do this, I have no idea why) dropMarkerList = dropMarkers; currentMarker = dropMarkers.findIndex(item => { if (item.title === marker.title) { return true; } return false; }); tempClose = closeIWindows; // Pan to include entire infowindow let offset = -0.32 + (10000000) / (1 + Math.pow((map.getZoom() / 0.0035), 2.07)); let center = new google.maps.LatLng( parseFloat(marker.position.lat() + offset / 1.5), parseFloat(marker.position.lng() + offset / 2) ); map.panTo(center); let iwindow; // info window preferences if (allPage==="drop") { iwindow = new InfoBubble({ maxWidth: 270, maxHeight: 150, shadowStyle: 1, padding: 10, backgroundColor: 'rgb(255,255,255)', borderRadius: 4, arrowSize: 20, borderWidth: 2, borderColor: '#000F35', disableAutoPan: true, hideCloseButton: false, arrowPosition: 30, backgroundClassName: 'phoney', arrowStyle: 0, disableAnimation: 'true' }); } else { iwindow = new InfoBubble({ maxWidth: 320, maxHeight: 265, shadowStyle: 1, padding: 10, backgroundColor: 'rgb(255,255,255)', borderRadius: 4, arrowSize: 20, borderWidth: 2, borderColor: '#000F35', disableAutoPan: true, hideCloseButton: false, arrowPosition: 30, backgroundClassName: 'phoney', arrowStyle: 0, disableAnimation: 'true' }); } let floatTabContent; if (allPage === true) { // content for float data tab floatTabContent = '<div id="tabContent">' + // '<b>Float Name:</b> ' + dataPoints[i].name + // '<br/> ' + '<b>UTC:</b> ' + dataPoints[i].stdt + // '<br/><b>Your Date:</b> ' + dataPoints[i].loct + '<br/><b>GPS Lat/Lon:</b> ' + dataPoints[i].stla + ', ' + dataPoints[i].stlo + '<br/><b>GPS Hdop/Vdop:</b> ' + dataPoints[i].hdop + ' m , ' + dataPoints[i].vdop + ' m' + '<br/><b>GEBCO WMS Depth:</b> ' + GEBCODepth + ' m' + '<br/><b>EEZ:</b> ' + EEZ + '<br/> ' + '<br/><b>Battery:</b> ' + dataPoints[i].Vbat + ' mV' + '<br/><b>Internal Pressure:</b> ' + dataPoints[i].Pint + ' Pa' + '<br/><b>External Pressure:</b> ' + dataPoints[i].Pext + ' mbar' + '<br/> ' + '<br/><b>Total Time:</b> ' + roundit(totalTime,0) + ' h' + '<br/><b>Distance Travelled:</b> ' + roundit(totalDistance,0) + ' km' + '<br/><b>Average Speed:</b> ' + roundit(avgVelocity,3) + ' km/h' + '<br/><b>Net Displacement:</b> ' + roundit(netDisplacement,0) + ' km'; } else if (allPage === 'drop'){ // content for dropped marker tab floatTabContent = '<div id="tabContent">' + '<br/><b>GPS Lat/Lon:</b> ' + lat + ', ' + lng + '<br/><b>GEBCO WMS Depth:</b> ' + GEBCODepth + ' m' + '<br/><b>EEZ:</b> ' + EEZ + //This next line we create an <a> tag with an href that calls a javascript function using jQuery '<br/><br/><span style="cursor:pointer;display:inline-block;"><a href="javascript:dropMarkerList[currentMarker].setMap(null);tempClose();void dropMarkerList.splice(currentMarker,1);"><b>Clear Marker</b></a></span>'; } else { // content for float data tab floatTabContent = '<div id="tabContent">' + // '<b>Float Name:</b> ' + dataPoints[i].name + // '<br/> ' + '<b>UTC:</b> ' + dataPoints[i].stdt + // '<br/><b>Your Date:</b> ' + dataPoints[i].loct + '<br/><b>GPS Lat/Lon:</b> ' + dataPoints[i].stla + ', ' + dataPoints[i].stlo + // '<br/><b>GPS Hdop/Vdop:</b> ' + dataPoints[i].hdop + ' m , ' + dataPoints[i].vdop + ' m' + // We're not making a WMS request here so no more datapoint and now more that field // '<br/><b>GEBCO WMS Depth:</b> ' + dataPoints[i].wmsdepth + ' m' + '<br/><b>GEBCO WMS Depth:</b> ' + GEBCODepth + ' m' + '<br/><b>EEZ:</b> ' + EEZ + // '<br/> ' + // '<br/><b>Battery:</b> ' + dataPoints[i].Vbat + ' mV' + // '<br/><b>Internal Pressure:</b> ' + dataPoints[i].Pint + ' Pa' + // '<br/><b>External Pressure:</b> ' + dataPoints[i].Pext + ' mbar' + '<br/> ' + '<br/><b>Leg Length:</b> ' + roundit(legLength,1) + ' km' + '<br/><b>Leg Time:</b> ' + roundit(legTime,2) + ' h' + '<br/><b>Leg Speed:</b> ' + roundit(legSpeed,3) + ' km/h' + '<br/> ' + '<br/><b>Total Time:</b> ' + roundit(totalTime,0) + ' h' + '<br/><b>Distance Travelled:</b> ' + roundit(totalDistance,0) + ' km' + '<br/><b>Average Speed:</b> ' + roundit(avgVelocity,3) + ' km/h' + '<br/><b>Net Displacement:</b> ' + roundit(netDisplacement,0) + ' km'; } // content for earthquake tabs let earthquakeTabContent = '<div id="tabContent">' + '<b>Code:</b> ' + "/* filler */" + '<br/><b>UTC:</b> ' + "/* filler */" + '<br/><b>Your Date:</b> ' + "/* filler */" + '<br/><b>Lat/Lon:</b> ' + "/* filler */" + '<br/><b>Magnitude:</b> ' + "/* filler */" + '<br/><b>Great Circle Distance:</b> ' + "/* filler */" + '<br/><b>Source:</b> ' + "/* filler */"; let floatName; if(allPage === 'drop'){ floatName = '<div id="tabNames">' + '<b>' + 'Drop Pin' + '</b> '; } else { floatName = '<div id="tabNames">' + '<b>' + dataPoints[i].name + '</b> '; } let earthquakeName = '<div id="tabNames">' + '<b>EarthQuake Info</b> '; let seismograms = '<div id="tabNames">' + '<b>Seismograms</b> '; // add info window tabs iwindow.addTab(floatName, floatTabContent); // iwindow.addTab(earthquakeName, earthquakeTabContent); // iwindow.addTab(seismograms, ""); iwindow.open(map, this); iwindows.push(iwindow); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function InfoBarWindow(){}", "function information() {\n\t//alert(\"Created by Monica Michaud\\nIn the Institute for New Media Studies\\nAdviser: Gordon Carlson, PhD\\nDev Version: 0.2 (Apr 25)\");\n\n\tvar mapInfoBoxString;\n\t\n\tmapInfoBoxString = '<div id=\"content\"><h1 id=\"infoWindowHeading\" class=\"infoWindowHeading\">Information : </h1>' +\n\t\t'<div id=\"infoWindowBodyContent\"><p>Created by Monica Michaud <br /> In the Institute for New Media Studies <br /> Adviser: Gordon Carlson, PhD <br /> Dev Version: 0.2 (Apr 25)</p></div></div>';\n\t\n\tmap.setCenter(MAP_CENTER_COORDINATES); \n\tinfoWindow.setContent(mapInfoBoxString);\n\tinfoWindow.setPosition(MAP_CENTER_COORDINATES);\n\tinfoWindow.open(map);\n}", "function showInfoWindow() { \n currentmarker = this;\n infoWindow.open(map, currentmarker);\n buildIWContent();\n\n}", "function infoWindows(marker, data) {\n //Event listener for when a marker i clicked\n google.maps.event.addListener(marker, \"click\", function (e) {\n //Wrap the content inside an HTML DIV in order to set height and width of InfoWindow.\n infoWindow.setContent(\"<div style = 'max-height:300px'>\" + '<p style=\"font-size: 24px; text-decoration: underline;\"><strong><a href=\"' + data.link + '\" target=\"blank\">' + data.name + '</a></strong></p>' + \"<br><p>\" + data.description + \"</p></div>\");\n //Open the markers infowindow\n infoWindow.open(map, marker);\n });\n }", "function createInfoWindow(KMLEvent_latLng, infoData) {\r\n CommonInfoWindow.close();\r\n //$(\"#map-loader\").hide();\r\n\r\n var content = \"<div class='content infoDiv'>\";\r\n if (infoData.establishments.length > 1) {\r\n content += \"<div class='row infoRow'><div class='col-md-12'><span class='infoImportant'>\" + infoData.address + \"</span></div></div>\";\r\n content += \"<div class='row infoRow infoHeader'><div class='col-md-12'>\" + infoData.establishments.length + \" establishments at this address</div></div>\";\r\n } else {\r\n content += \"<div class='row infoRow infoHeader'><div class='col-md-12'><span class='infoImportant'>\" + infoData.address + \"</span></div></div>\";\r\n \r\n }\r\n for (var i = 0; i < infoData.establishments.length; i++) {\r\n content += \"<div class='row infoRow'><div class='col-md-12'><img src='\" + statusIcons[infoData.establishments[i].status].medium + \"'>&nbsp;&nbsp;<span class='infoImportant orgLink'><a href='#' data-id='\" + infoData.establishments[i].estId + \"'>\" + infoData.establishments[i].name + \"</a></span></div></div>\";\r\n }\r\n content += \"<div class='row infoRow'><div class='col-md-12'><a class='svLink' href='#' data-latlng='\" + KMLEvent_latLng + \"'><img src='\" + STREET_VIEW_ICON + \"' alt='StreetView'></a></div></div>\";\r\n \r\n //} \r\n content += \"</div>\"; \r\n CommonInfoWindow.setOptions({ \"position\": KMLEvent_latLng,\r\n \"pixelOffset\": 0, //KMLEvent.pixelOffset,\r\n \"content\": content}); //KMLEvent.featureData.infoWindowHtml.replace(/ target=\"_blank\"/ig, \"\") });\r\n CommonInfoWindow.open(gblMap);\r\n}", "function openInfoWindow() {\n infobox.close();\n infobox.setContent(contentString.replace('%user', walker.user).replace('%phone', walker.phone));\n infobox.setOptions(infoBoxOptions);\n infobox.open(map, marker);\n }", "function openinfo(n,myvar) {\r\n\tz = window.open((n==0?\"data/\":\"\") + \"SingleClass.html?soc=\"+myvar,\"_blank\",\"channelmode=no,directories=no,fullscreen=no,height=\"+(myvar>999?500:350)+\",left=50,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=no,top=50,width=700\",false);\r\n}", "function infoWindowCreate() {\n var infoWindows = new google.maps.InfoWindow();\n return infoWindows;\n}", "function info(title) {\r\n var text = \"...\"\r\n var string = \"<html><head><style>li { padding: 5px; } .help_text_header { font-size: 1.3em; font-weight: bold; }</style><title>\" + title + \"</title><body style='font-family: Arial,Helvetica,sans-serif; font-size: 80%;'>\";\r\n string += \"<h2>\" + title + \"</h2> \";\r\n string += \"<p style='text-align: justify'>\" + dummy_text + \"</p>\";\r\n string += \"<br/><br/><a href='javascript:window.close()' style='color: #A14685; font-size: 0.9em; font-weight: bold; text-decoration: none;'>\" + \"CLOSE\" + \"</a>\";\r\n string += \"</body></html>\";\r\n var popupWidth = 700;\r\n var popupHeight = 500;\r\n var left = (screen.width - popupWidth) / 2;\r\n var top = (screen.height - popupHeight) / 4;\r\n helpWindow = window.open('', 'id1', 'scrollbars=yes, left=' + left + ', top=' + top + ', width=' + popupWidth + ', height=' + popupHeight);\r\n helpWindow.document.open(\"text/html\");\r\n helpWindow.document.write(string);\r\n helpWindow.document.close();\r\n}", "function ShowInfo(id){\n var desc=dataModel.locations[id].view.getDescription(id);\n // open new info window\n if(desc){\n // close infoo window if already open\n CloseInfo();\n infoWindow=new google.maps.InfoWindow({\n content: desc\n });\n infoWindow.open(mapElement, GetMarker(id));\n }\n}", "function createInfoWindow(marker, content) {\n // open info window with created content\n infoWindow = new google.maps.InfoWindow({\n content: content\n });\n\n infoWindow.open(map, marker);\n \n // turn popover windows on\n $('[data-toggle=\"popover\"]').popover();\n\n // to close mobile popovers\n $('[data-toggle=\"popover\"]').click(function(evt) {\n $(this).popover(\"hide\");\n });\n\n\n }", "function testInfoWindow(){\n var infoWindow = new google.maps.InfoWindow({\n content: \"<div class='latestPhotoInfo'><img src='http://distilleryimage7.instagram.com/8ae63806970311e1af7612313813f8e8_7.jpg'/></div>\",\n position: new google.maps.LatLng(0, 151)\n });\n infoWindow.open(realtimeMap);\n}", "function createNewInfoWindow(coord, content){\n // information window is displayed at click position\n\tmapCollector.infowindow = new google.maps.InfoWindow({\n\t \tcontent: content,\n\t \tposition: coord\n\t});\n }", "function showInfoWindow(event) {\n\tvar $elementFired = $( event.data.elementPlotter );\n\t\n\tif (exists($elementFired)) {\n\t\tvar id = $elementFired.attr('item-id');\n\t\t\n\t\tif (id) {\n\t\t\tfor (var indexInfoMarks = 0; indexInfoMarks < markers.length; indexInfoMarks++) {\n\t\t\t\tvar infoMark = markers[indexInfoMarks];\n\t\t\t\t\n\t\t\t\tif (infoMark.id == id) {\n\t\t\t\t\tnew google.maps.event.trigger( infoMark.googleOBJ , 'click' );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function showInfoWindow() {\n var marker = this;\n placesService.getDetails({placeId: marker.placeResult.place_id},\n function(place, status) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {\n return;\n }\n infoWindow.open(map, marker);\n buildIWContent(place);\n });\n }", "function infoPopUpWindow(sInfo)\n{\n\tvar sPopUpId = '#popup_info .popup_info_sms';\n\t$(sPopUpId).append(\"<div id='sPopup-container'>\"+\n\t\t\t\t\t\t\"<div id='sPopup-popup'>\"+\n\t\t\t\t\t\t\t\"<div title='close' id='sPopup-close'></div>\"+\n\t\t\t\t\t\t\t\t\"<div style='clear:both;'></div>\"+\n\t\t\t\t\t\t\t\t\tsInfo+\n\t\t\t\t\t\t\t\"</div>\"+\n\t\t\t\t\t\t\"</div>\"+\n\t\t\t\t\t\"</div>\");\n\t$('body').css({ overflow : 'hidden' });\n\t$(sPopUpId).fadeIn(400, function(){\n\t\t$(this).css({ display: 'block' });\n\t});\n\t$('#sPopup-close').click(function(){\n\t\t$('body').css({ overflow : 'auto' });\n\t\t$('#sPopup-container').fadeOut(400, function(){\n\t\t\t$(this).remove();\n\t\t});\n\t});\t\n}", "function setInfoWindowContents() {\n for (const store of brewData) {\n coordObj.lat = store.latitude;\n coordObj.lng = store.longitude;\n createMarker(store, coordObj);\n\n loc = new google.maps.LatLng(marker.position.lat(), marker.position.lng());\n bounds.extend(loc);\n\n hours = store.hoursOfOperation || '';\n\n address = store.streetAddress || '';\n\n description = store.brewery.description || 'No Description Avaliable';\n\n phone = store.phone || '';\n\n if (store.website === undefined) {\n website = '';\n brewName = '';\n } else {\n website = store.website;\n brewName = store.brewery.name;\n }\n\n if (store.brewery.images === undefined) {\n logo = '';\n } else {\n logo = `<img src=${store.brewery.images.medium}>`;\n }\n\n\n content = '<div id=\"content\">' +\n `<h3 id=\"firstHeading\" class=\"firstHeading\">${store.brewery.name}</h3>` +\n `<div>${logo}` +\n '<div id=\"bodyContent\">' +\n `${description} ` +\n '</div>' +\n '</br>' +\n `<div>${address}</div>` +\n '</br>' +\n `<div>${hours}</div>` +\n '</br>' +\n `<div><a href='tel:${phone}'>${phone}</div>` +\n '</br>' +\n `<div><a href=${website}>${brewName}</div>` +\n '</div>';\n\n infowindow = new google.maps.InfoWindow({\n content: content\n });\n\n setEventListner();\n }\n }", "function displayInfobox(e) {\n infowindow.setOptions({description: e.target.Description, visible: true, showPointer: false});\n infowindow.setLocation(e.target.getLocation());\n }", "function initInformationWindow(position, content){\t\t\n\t\tvar options\t\t\t= new Object();\n\t\toptions.content\t\t= content;\n\n\t\tself.infowindow = new google.maps.InfoWindow(options);\n\t}", "function openInfoWindow(e, current) {\r\n\t\tcloseInfoWindow(); \r\n\t\tvar x = e.pageX - parseInt($('#inner').css('left')) - $['mapsettings'].element.get(0).offsetLeft - 9;\r\n\t\tvar y = e.pageY - parseInt($('#inner').css('top')) - $['mapsettings'].element.get(0).offsetTop - 10;\r\n\t\t$['mapsettings'].infoWindowLocation[$['mapsettings'].zoom] = new Point(x,y);\r\n\t\t$('<div id = \"infowindow\" />').css('left',x-4).css('top',y-53).html('<div class = \"inner\">'+ $['mapsettings'].exitLink + $['mapsettings'].infoDisplay + '</div>').appendTo('#infowindows').hide();\r\n\t\tvar infow = $('#infowindow');\r\n\t\tinfoWidth = infow.innerWidth();\r\n\t\tinfoHeight = infow.innerHeight();\r\n\t\tinfow.css('left', x-4).css('top',y-16-infoHeight).show();\r\n\t\t$(\"#infowindows\").append($['mapsettings'].infoImage);\r\n\t\t$(\"#infowindows img\").css('left',x).css('top',y-15);\r\n\t\t$('#infowindows form').submit(function(e) { \r\n\t\t\te.preventDefault(); \r\n\t\t\tcloseInfoWindow();\r\n\t\t\taddMarker(new Point(x,y), function(e){\r\n\t\t\t\te.preventDefault();\r\n\t\t\t\topenInfoWindowHtml(markerPoint(this), \"<h2>Some Name</h2><p>Some Description.</p>\");\r\n\t\t\t});\r\n\t\t\t\r\n\t\t });\r\n\t\t$(\"#exitLink\").click(function(e){\r\n\t\t\te.preventDefault();\r\n\t\t\tcloseInfoWindow();\r\n\t\t\treturn false;\r\n\t\t});\r\n\t\t$['mapsettings'].hasOpenInfoWindow = true;\r\n\t}", "function InfoBox() {\n}", "function infoWindows(marker, data) {\n //Event listener for when a marker i clicked \n google.maps.event.addListener(marker, \"click\", function (e) {\n //Wrap the content inside an HTML DIV in order to set height and width of InfoWindow.\n infoWindow.setContent(\"<div style = 'max-height:300px'>\" + \"<p style='font-size: 24px; text-color: red;'><strong>Meetup only supports location accuracy by zip code within the USA, Canda and GB</strong></p><br><p style='font-size: 18px;'>Here is a list of all the Meetups in the city of \" + data.city + ':' + '</p><br><a style=\"font-size: 18px;\" href=\"http://www.meetup.com/cities/'+data.country+'/'+data.city+'\" target=\"blank\">List of all Meetups in '+data.city+'</a></div>');\n //Open the markers infowindow\n infoWindow.open(map, marker);\n });\n }", "function infoBox(){\n\t//\tCreate a new instance of Google Maps infowindows\n\tvar infobox = new google.maps.InfoWindow();\n\t// Adding a click event to the Marker\n\tgoogle.maps.event.addListener(marker, \"click\", function(){\n\t\t//\tsetContent is just like innerHTML. You can write HTML into this document\n\t\tinfobox.setContent(\"<div><strong>\"+marker.title+\"</strong></div><hr>\"+\n\t\t\t\t\t\t\t\"<div>\"+marker.description+\"</div>\"\n\t\t\t);\n\t\t//\tOpening the infoBox\n\t\tinfobox.open(map, marker);\n\t});\n\n}", "function showInfoWindow() {\n var marker = this\n places.getDetails({ placeId: marker.placeResult.place_id }, function(\n place,\n status\n ) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {\n return\n }\n\n buildIWContent(map, marker, place)\n })\n}", "function PopUp_Info(i) {\n console.log(i);\n $('<div id=\"window-popup\"><div id=\"window-content\"></div></div>').appendTo('body');\n $('<div id = \"close\"><img src=\"IMG/close-button.gif\"></div>').appendTo('#window-content');\n\n $('<div class = \"text\"><img id = \"pic\" src=' + data[i].image + '></div>').appendTo('#window-content');\n $('<div class = \"text\"><b>' + data[i].name + '</b></div>').appendTo('#window-content');\n $('<hr>').appendTo('#window-content');\n $('<div id = \"description\">' + data[i].desc + '</div>').appendTo('#window-content');\n $('#close').click(function() {\n $('#window-popup').remove();\n });\n }", "function showInfoWindow() {\n var marker = this;\n jsonifyPlace(marker);\n console.log(\"Debugging Marker\" , marker);\n placesService.getDetails({ placeId: marker.placeResult.place_id }, \n function(place,status) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {\n return;\n }\n infoWindow.open(map, marker);\n buildIWContent(place);\n });\n}", "function show_info(txt)\r\n{\r\n\t//alert(txt);\r\n $('info_div').show();// = 'shown';\r\n //var info_style = \r\n $('info_div').setStyle({left:mouseX+\"px\",top:mouseY+\"px\"});\r\n //info_style.left = mouseX+\"px\";\r\n //info_style.top = mouseY+\"px\";\r\n $('info_div').update(txt);\r\n}", "function showInfoWindowApi() {\n var marker = this;\n\n console.log(infoWindow);\n infoWindow.open(map, marker);\n buildIWContentApi(marker.placeResult);\n}", "function informationHandler(event)\n\t\t{\n\t\t\tg.informe();\n\t\t\thideButtons(this);\n\t\t}", "function setup_showInfo() {\n\tdocument.getElementById(\"basic\").style.display = \"none\";\n\tdocument.getElementById(\"create\").style.display = \"none\";\n\tdocument.getElementById(\"source\").style.display = \"none\";\n\tdocument.getElementById(\"info\").style.display = \"block\";\n}", "function buildInfoWindow(id) {\r\n\t// Information shown in window\r\n\tvar name;\r\n\tvar publish;\r\n\tvar pubmed;\r\n\tvar integ;\r\n\tvar zfin;\r\n\tvar anatomy;\r\n\tvar scanned;\r\n\tvar smed;\r\n\r\n\t// Finding line's information based on id and type\r\n\tif(includes(TRANSGENIC, id)) {\r\n\t\tvar index = TRANSGENIC.indexOf(id);\r\n\t\tname = TRANSGENIC_NAMES[index];\r\n\t\tpublish = TRANSGENIC_PUBLISHED[index];\r\n\t\tpubmed = TRANSGENIC_PUBMED[index];\r\n\t\tinteg = TRANSGENIC_INTEGRATION_SITE[index];\r\n\t\tzfin = TRANSGENIC_ZFIN_FEATURE[index];\r\n\t\tanatomy = TRANSGENIC_ANATOMY[index];\r\n\t\tscanned = TRANSGENIC_SCANNED[index];\r\n\t\tsmed = TRANSGENIC_SPUBMED[index];\r\n\t} else if(includes(GAL4, id)) {\r\n\t\tvar index = GAL4.indexOf(id);\r\n\t\tname = GAL4_NAMES[index];\r\n\t\tpublish = GAL4_PUBLISHED[index];\r\n\t\tpubmed = GAL4_PUBMED[index];\r\n\t\tinteg = GAL4_INTEGRATION_SITE[index];\r\n\t\tzfin = GAL4_ZFIN_FEATURE[index];\r\n\t\tanatomy = GAL4_ANATOMY[index];\r\n\t\tscanned = GAL4_SCANNED[index];\r\n\t\tsmed = GAL4_SPUBMED[index];\r\n\t} else if(includes(CRE, id)) {\r\n\t\tvar index = CRE.indexOf(id);\r\n\t\tname = CRE_NAMES[index];\r\n\t\tpublish = CRE_PUBLISHED[index];\r\n\t\tpubmed = CRE_PUBMED[index];\r\n\t\tinteg = CRE_INTEGRATION_SITE[index];\r\n\t\tzfin = CRE_ZFIN_FEATURE[index];\r\n\t\tanatomy = CRE_ANATOMY[index];\r\n\t\tscanned = CRE_SCANNED[index];\r\n\t\tsmed = CRE_SPUBMED[index];\r\n\t} else if(includes(MISC, id)) {\r\n\t\tvar index = MISC.indexOf(id);\r\n\t\tname = MISC_NAMES[index];\r\n\t\tpublish = MISC_PUBLISHED[index];\r\n\t\tpubmed = MISC_PUBMED[index];\r\n\t\tinteg = MISC_INTEGRATION_SITE[index];\r\n\t\tzfin = MISC_ZFIN_FEATURE[index];\r\n\t\tanatomy = MISC_ANATOMY[index];\r\n\t\tscanned = MISC_SCANNED[index];\r\n\t\tsmed = MISC_SPUBMED[index];\r\n\t} else {\r\n\t\tname = HUC_CER_NAME[0];\r\n\t\tpublish = HUC_CER_PUBLISHED[0];\r\n\t\tpubmed = HUC_CER_PUBMED[0];\r\n\t\tinteg = HUC_CER_INTEGRATION_SITE[0];\r\n\t\tzfin = HUC_CER_ZFIN_FEATURE[0];\r\n\t\tanatomy = HUC_CER_ANATOMY[0];\r\n\t\tscanned = HUC_CER_SCANNED[0];\r\n\t\tsmed = HUC_CER_SPUBMED[0];\r\n\t}\r\n\r\n\t// Constructing HTML for info window\r\n\t// Styles are also provided in style tags because this window doesn't link to any stylesheets\r\n\tvar infoText = \t'<title>' +\r\n\t\t\t\t\t\t(name == '' ? id : name) + ' Info' +\r\n\t\t\t\t\t'</title>' +\r\n\t\t\t\t\t'<style>' +\r\n\t\t\t\t\t'body {' +\r\n\t\t\t\t\t\t'margin: 0;' +\r\n\t\t\t\t\t\t'overflow-y: hidden;' +\r\n\t\t\t\t\t'}' +\r\n\t\t\t\t\t'.ind-info {' +\r\n\t\t\t\t\t\t'font-family: verdana;' +\r\n\t\t\t\t\t\t'position: absolute;' +\r\n\t\t\t\t\t\t'top: 8px;' +\r\n\t\t\t\t\t\t'bottom: 8px;' +\r\n\t\t\t\t\t\t'left: 8px;' +\r\n\t\t\t\t\t\t'right: 8px;' +\r\n\t\t\t\t\t\t'color: white;' +\r\n\t\t\t\t\t\t'padding: 19px;' +\r\n\t\t\t\t\t\t'border-radius: 20px;' +\r\n\t\t\t\t\t\t'box-shadow: 0 0 20px black;' +\r\n\t\t\t\t\t\t'background: #555555;' +\r\n\t\t\t\t\t'}' +\r\n\t\t\t\t\t'.header-p {' +\r\n\t\t\t\t\t\t'margin-bottom: 0;' +\r\n\t\t\t\t\t\t'font-weight: bold;' +\r\n\t\t\t\t\t'}' +\r\n\t\t\t\t\t'.text-p {' +\r\n\t\t\t\t\t\t'margin-top: 0;' +\r\n\t\t\t\t\t'}' +\r\n\t\t\t\t\t'.zfin-link {' +\r\n\t\t\t\t\t\t'color: white;' +\r\n\t\t\t\t\t'}' +\r\n\t\t\t\t\t'</style>' +\r\n\t\t\t\t\t'<div id=\"' + id + '-info\" class=\"ind-info\">' +\r\n\t\t\t\t\t\t'<p class=\"header-p\">Line:</p>' +\r\n\t\t\t\t\t\t'<p class=\"text-p\">' + (name == '' ? id : name) + '</p>' +\r\n\t\t\t\t\t\t'<p class=\"header-p\">Published:</p>' +\r\n\t\t\t\t\t\t'<p class=\"text-p\">' + (pubmed == '' ? '' : '<a class=\"zfin-link\" href=\"https://www.ncbi.nlm.nih.gov/pubmed/' + pubmed + '\" target=\"_blank\">') + publish + (pubmed == '' ? '' : '</a>') + '</p>' +\r\n\t\t\t\t\t\t'<p class=\"header-p\">Integration Site:</p>' +\r\n\t\t\t\t\t\t'<p class=\"text-p\">'+ integ + '</p>' +\r\n\t\t\t\t\t\t'<p class=\"header-p\">ZFIN Feature:</p>' +\r\n\t\t\t\t\t\t'<p class=\"text-p\"><a class=\"zfin-link\" href=\"' + zfin + '\" target=\"_blank\">' + zfin + '</a></p>' +\r\n\t\t\t\t\t\t'<p class=\"header-p\">Anatomy:</p>' +\r\n\t\t\t\t\t\t'<p class=\"text-p\">' + anatomy + '</p>' +\r\n\t\t\t\t\t\t'<p class=\"header-p\">Scanned By:</p>' +\r\n\t\t\t\t\t\t'<p class=\"text-p\">' + (smed == '' ? '' : '<a class=\"zfin-link\" href=\"https://www.ncbi.nlm.nih.gov/pubmed/' + smed + '\" target=\"_blank\">') + scanned + (smed == '' ? '' : '</a>') + '</p>' +\r\n\t\t\t\t\t'</div>';\r\n\r\n\t// Opening info window\r\n\tvar infoWindow = window.open('', id + '-window-' + windowCounter++, 'width=500px,height=500px'); // windowCounter is used and incremented to make sure every window opened is unique\r\n\tinfoWindow.document.write(infoText); // Writing constructed HTML to window\r\n}", "function makeInfoWindow(position, msg) {\n // close old window if it exists\n if (infoWindow) infoWindow.close();\n\n // make a new InfoWindow\n infoWindow = new google.maps.InfoWindow({\n map: map,\n position: position,\n\n content: \"<b>\" + msg + \"</b>\"\n });\n}", "function moreInfo() {\n var infoWindowElem = $('.info-window');\n infoWindowElem.css('top', '0');\n infoWindowElem.css('height', '100vh');\n infoWindowElem.css('overflow', 'scroll');\n}", "function showInfoWindow() {\n var marker = this;\n places.getDetails({ placeId: marker.placeResult.place_id },\n function(place, status) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {\n return;\n }\n infoWindow.open(map, marker);\n buildIWContent(place);\n\n // Checks what the dropdown list is currently selected on and fills either\n // text boxes with the location's name.\n if (document.getElementById('poi').value === 'lodging') {\n document.getElementsByClassName('selectedHotelTB')[0].value =\n place.name,\n // Stores address for Navigation.\n startID = place.formatted_address;\n // Displays the text boxes for selected locations.\n showDisplayTwo();\n\n }\n else {\n document.getElementsByClassName('selectedPOItb')[0].value =\n place.name,\n // Stores address for Navigation.\n finishID = place.formatted_address;\n // Displays the POI textbox.\n showDisplayFour();\n }\n // if textbox ISN'T empty then display satnav btn.\n if (document.getElementsByClassName('selectedPOItb')[0].value !== \"\") {\n showDisplayThree();\n }\n else {\n return;\n }\n });\n}", "function dispInfoModal(vid){\n document.getElementById('infoModal').style.display='block';\n mapspecific.resize();\n mapspecific.flyTo({\n center: trucks[0].pos\n });\n getTruckColSpec();\n showTruckDetailsSpec(vid, \"mapspecific\");\n showRoute(trucks[vid], \"mapspecific\");\n}", "function infoBox(map, marker, item) {\n var infoWindow = new google.maps.InfoWindow();\n // Attaching a click event to the current marker\n google.maps.event.addListener(marker, \"click\", function (e) {\n //map.setZoom(8),\n map.setCenter(marker.getPosition());\n infoWindow.setContent(this.html);\n infoWindow.open(map, marker);\n });\n\n\n\n\n }//fin funcion informacion de marcador", "function showDetails() {\n _('infoDiv').innerHTML = infoText;\n _('infoPanel').style.display = 'block';\n}", "function setMarkerInfo(info) {\n infoWindow.setContent(info);\n }", "function toggleInfoWindow(event){\t\t\n\t\tif (!self.infowindow)\n\t\t\t// console.log(event.latLng);\n\t\t\t// console.log(self.message);\n\t\t\t initInformationWindow(event.latLng, self.message);\n\t\t\t \n\t\tif (self.infowindow.getMap())\n\t\t\tself.infowindow.close();\n\t\telse\n\t\t\tself.infowindow.open(GoogleMaps.map, self.marker);\n\t\t// Show flicker api images\n\t\t//alert('http://'+window.location.host + '/studier/API-programmering/Uppgift-4-App/ShareYourVacation/public/api/flickr?lat='+self.location_lat+'&lng='+self.location_lng);\n\t\tGoogleMaps.ajax = new Ajax();\n\t\tGoogleMaps.ajax.get( 'http://'+window.location.host + '/studier/API-programmering/Uppgift-4-App/ShareYourVacation/public/api/flickr?lat='+self.location_lat+'&lng='+self.location_lng , parseFlickrImages);\n\n\t}", "function showInfoWindow() {\n const marker = this;\n places.getDetails(\n {\n placeId: marker.placeResult.place_id,\n },\n (place, status) => {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {\n return;\n }\n infoWindow.open(map, marker);\n buildIWContent(place);\n }\n );\n}", "function showInfo() {\n info.style.display = 'block';\n \n // clean up after ourselves\n d.controlSettings.removeEventListener('click', showInfo);\n d.closer.addEventListener('click', hideInfo);\n}", "function Allinfobox(marker){\n\tif(infobox){\n\t\tinfobox.close();\n\t}\n\tinfobox = new google.maps.InfoWindow();\n\tgoogle.maps.event.addListener(marker, \"click\", function(){\n\t\tinfobox.setContent(\"<div><strong>\"+marker.title+\"</strong></div><hr>\"+\n\t\t\t\t\t\t\t\"<div>\"+marker.description+\"</div>\"\n\t\t\t);\n\t\tinfobox.open(map, marker);\n\t});\n}", "function populateInformationModal() {\n\t// add text to the label\n\tvar category = allViews[activeView];\n\t// trim the heading \"TissueSpecific\" if necessary\n\tif (category.substr(0,14) == \"TissueSpecific\") {\n\t\tcategory = category.substr(14);\n\t}\n\t$('#informationLabel').text(category+\" Information\"); \n\t\n\t// now put info text in body\n\t$('#informationBody').html(allInfoFiles[activeView]);\n\t\n}", "showInfoWindow(){\n var infowindow = $(\"#infoiwnd\");\n infowindow.removeClass(\"d-none\");\n infowindow.addClass(\"d-block\");\n }", "function info_screen() {\n var wf2d = window.frames[2].document;\n if (screen_check_already_there('pmc_info_screen')) {\n return screen_abort();\n }\n screen_prepare();\n var ifr;\n ifr = $('<div style=\"text-align:center; margin-top:20px;\">\\\n <div id=\"dismiss\">\\\n <b style=\"color: #777\">Press ESC or click here to dismiss.</b></div>\\\n <object width=\"50%\" height=\"220\"></object>\\\n </div>');\n $('body > :first-child', wf2d).before(ifr);\n ifr.attr('id', 'pmc_info_screen');\n ifr.addClass('pmc_screen');\n ifr.find('object').attr('data',\n 'http://training.cat-europe.com/ShowQuestionInfo.aspx');\n ifr.find('#dismiss').click(screen_abort);\n return false;\n}", "function showInfoWindow() {\n var marker = this;\n places.getDetails({\n placeId: marker.placeResult.place_id,\n },\n function(place, status) {\n if (status !== google.maps.places.PlacesServiceStatus.OK) {\n return;\n }\n infoWindow.open(map, marker);\n buildIWContent(place);\n }\n );\n}", "createInfoWindow(marker, infoWindow, map) {\n\t\tif (this.onReadyInfoWindow) window.google.maps.event.removeListener(this.onReadyInfoWindow);\n\t\tif (this.onCloseInfoWindow) window.google.maps.event.removeListener(this.onCloseInfoWindow);\n\t\tinfoWindow.marker = marker;\n\t\tinfoWindow.setContent('<div id=\"infoWindow\" />');\n\t\tthis.onReadyInfoWindow = infoWindow.addListener('domready', e => {\n\t\t\trender(<InfoWindow marker={marker} />, document.getElementById('infoWindow'));\n\t\t});\n\t\tthis.onCloseInfoWindow = infoWindow.addListener('closeclick', function() {\n\t\t\tinfoWindow.marker = null;\n\t\t});\n\t\tinfoWindow.open(map, marker);\n\t}", "function pop_up_window(abbrev,def)\r\n {\r\n //\r\n var generator=window.open('','info','height=' + \r\n info_window_height + ',width=' +\r\n info_window_width + ',resizable=yes,scrollbars=yes,toolbar=yes');\r\n //\r\n //\r\n generator.document.write('<html><head><title>Abbreviation: ' + abbrev + '</title>');\r\n generator.document.write('<link rel=\"stylesheet\" href=\"reset.css\">');\r\n generator.document.write('<link rel=\"stylesheet\" href=\"text.css\">');\r\n generator.document.write('<link rel=\"stylesheet\" href=\"960.css\">');\r\n generator.document.write('<link rel=\"stylesheet\" href=\"wwi.css\">');\r\n generator.document.write('</head><body>');\r\n generator.document.write('<div class=\"container_16\"><div class=\"grid_14 prefix_1 suffix_1\">');\r\n \r\n generator.document.write('<h1 class=\"heading1\">Abbreviation: ' + abbrev + '</h1>');\r\n generator.document.write('<p class=\"body\">Abbreviation: ' +\r\n abbrev + '<br class=\"x\"/> Definition: ' + def + '</p>');\r\n generator.document.write('<p><a href=\"javascript:self.close()\">Close</a> the popup.</p>');\r\n generator.document.write('</div><div class=\"clear\"></div></div>'); // end all divs\r\n generator.document.write('</body></html>');\r\n generator.document.close();\r\n }", "function makeResultInfoWindow(position, result) {\n // close old window if it exists\n if (infoWindow) infoWindow.close();\n let pir = \"unknown\";\n if(result.price)\n {\n pir = result.price;\n }\n // make a new InfoWindow\n infoWindow = new google.maps.InfoWindow({\n map: map,\n position: position,\n // edit this section for CSS markdown (Alex)\n content: '<div id=\"infoWindowContent\">' +\n '<a href=\"'+ result.url +'\" \" ><h1 id=\"nameHeading\">'+result.name+ '</h1></a>'+\n '<div id=\"keyInfo\">'+\n '<h4 id=\"rating\">Rating: '+result.rating+'</h4>'+\n '<h5>'+pir+'</h5>'+\n '<h5>Phone: '+result.display_phone+'</h4>'+\n '<h5>Address: '+ result.location.address1 +'</h5>'+\n //'<img src=\"'+result.image_url+'\">'+\n '<h5>Distance: '+getMiles(result.distance).toFixed(1)+' miles</h5>'+\n '<img id=\"img\" src=\"'+result.image_url+'\">'+\n '</div>'\n });\n}", "function bindInfoWindow(item, loc, code, data) {\n\t// html string to display 'weight : count'\n\tvar count_text = \"\";\n\tfor (var i = 0; i<data[\"counts\"].length; i++) {\n\t\tcount_text += i.toString() + \" : \" + data[\"counts\"][i].toString() + \"<br>\";\n\t}\n\t\n\tgoogle.maps.event.addListener(item, 'mouseover', function() {\n\t\tinfoWindow.setContent(\"<div class='info-box'><b>\" + code + \"</b><br>\" + count_text + \"</div>\");\n\t\tinfoWindow.setPosition(loc);\n\t\tinfoWindow.open(map);\n\t});\n\tgoogle.maps.event.addListener(item, 'mouseout', function() {\n\t\tinfoWindow.close();\n\t});\n\treturn item;\n}", "function popupInfoSite(path, x_html, x_registerProject) {\n var oWindow = null;\n var iWidth = 500;\n var iHeight = 500;\n oWindow = window.open(path + \"/help/info.\" + x_html + \".jsp?registerProject=\" + x_registerProject, \"POPUP_INFO\", \"dependent=yes,locationbar=no,menubar=no,scrollbars=yes,resizable=yes,status=no,screenX=0,screenY=0,height=\" + iHeight + \",width=\" + iWidth);\n if (top.window.opener) {\n oWindow.opener = top.window.opener;\n }\n centerWindow(oWindow, iWidth, iHeight);\n}", "function getInfoWindowContent(location){\r\n\tvar content = '';\r\n\tvar placeType = '';\r\n\tfor (var i=0; i < locationInfo.length; i++) {\r\n\t\tif (locationInfo[i].place === location) {\r\n\t\t\tplaceType = getPlaceType(locationInfo[i].type);\r\n\r\n\t\t\tcontent += '<div class=\"info-window clearfix\">'\r\n\t\t\tcontent += '<h4 class=\"map-title\">' + locationInfo[i].place + '</h4>';\r\n\t\t\tcontent += '<h5 class=\"map-title\">' + placeType + '</h5>';\r\n\t\t\tcontent += '<p>' + locationInfo[i].description + '</p>';\r\n\t\t\tcontent += '<div class=\"info-window-pic-container\">'\r\n\t\t\tcontent += '<img class=\"info-window-pic\" src=\"' + locationInfo[i].image_url + '\" alt=\"' + locationInfo[i].image_alt + '\">'\r\n\t\t\tcontent += '<p class=\"map-image-caption\"> Image courtesy of ' + locationInfo[i].image_attribute + '</>'\r\n\t\t\tcontent += '</div>'\r\n\t\t\tcontent += '</div>'\r\n\t\t}\r\n\t}\r\n\treturn content;\r\n}", "function createInfoWindow (marker){\n // Create the InfoWindow\n var infoWindow = new google.maps.InfoWindow();\n // Create StreetViewService to show a street view window for marker location or nearest places within 50 meter\n var StreetViewService = new google.maps.StreetViewService();\n var radius = 50;\n //Create an onclick event listener to open\n marker.addListener('click', function(){\n infoWindow.marker = marker;\n infoWindow.setContent('<div Id=\"infoWindowDiv\"><h5>' + marker.title +'</h5></div>');\n\n //** One options to be displayed in InfoWindow **//\n /* 1) Displaying Wikipedia articals: */\n var wikiURL = 'http://en.wikipedia.org/w/api.php?action=opensearch&search=' + marker.title + '&format=json&callback=wikiCallback';\n var wikiRequestTimeout = setTimeout(function() {\n alert(\"failed to load wikipedia resources\");\n }, 8000);\n $.ajax({\n url: wikiURL,\n dataType: \"jsonp\",\n success: function(response) {\n var articalsList = response[1];\n var atricalTitle ;\n $('#infoWindowDiv').append('<div Id=\"wikiDiv\"><ul id=\"wikiListItem\"></ul></div>');\n for (var i = 0 , length = articalsList.length; i < length && i < 4 ; i++ ){\n atricalTitle = articalsList[i];\n $('#wikiListItem').append('<li><a href=\"http://en.wikipedia.org/wiki/'+atricalTitle+'\">'+atricalTitle+'</a></li>');\n }\n clearTimeout(wikiRequestTimeout);\n },\n });\n infoWindow.open(map, marker);\n });\n\n\n //** Other options to be displayed in InfoWindow **//\n /* 2) Displaying an Image usign URL parameters: (Note: Not working well for some reasons)\n -------> Should be placed before infoWindow.Open()\n\n $('#pano').append('<img src= https://maps.googleapis.com/maps/api/streetview?'+\n 'size=200x150&location='+marker.position+'&heading=151.78&pitch=-0.76'+\n '&key=AIzaSyBpcOjPqBYX5nfyfSKIUp3NXwUIiQHP0lQ></img>'); */\n\n /* 3) Displaying an Street view object: (Note: Not working well for some reasons)\n -------> Should be placed before infoWindow.Open()\n StreetViewService.getPanoramaByLocation(marker.position, radius, getViewStreet);\n function getViewStreet(data, status){\n if (status === 'Ok'){\n infoWindow.setContent('<div><h5>' + marker.title +'</h5><div Id=\"pano\"></div></div>');\n var nearViewStreetLocation = data.location.latLng;\n var heading = google.map.geometry.spherical.computeHeading(nearViewStreetLocation, marker.position);\n var panoramaOptions = {\n position : nearViewStreetLocation,\n pov :{ heading: heading, pitch: 30 }\n };\n var panorama = new google.maps.StreetViewPanorama(document.getElementById('pano'),panoramaOptions);\n map.setStreetView(panorama);\n }\n else{\n infoWindow.setContent('<div><h5>' + marker.title +'</h5><div>No Street View Found</div></div>');\n }\n }*/\n\n }", "function setInfowindowMarkup(info) {\n return '<h4>'+ info['name'] +'</h4>' +\n '<p>'+ info['street'] + ' ' + info['city'] + ' ' + info['state'] + '</p>';\n}", "function infoMarkers(marker){\r\n\t\t\tvar infowindow = new google.maps.InfoWindow({\r\n\t\t\t content: marker.title,\r\n\t\t\t});\r\n\t\t\t \r\n\t\t\tmarker.addListener('click', function(){\r\n\t\t\t infowindow.open(marker.get('map'),marker);\r\n\t\t\t});\r\n\r\n\t\t}", "function reposInfoWindow() {\n\t// use the outer div for infowindow for calculations\n\tvar $infoWindowBox = $('.infowindow').parents().eq(3);\n\n\t// delay repositioning to account for Maps API's own repositioning\n\t// otherwise `.panBy()` stops panning prematurely\n\tsetTimeout(function() {\n\t\tvar marker = infoWindow.marker;\n\t\tvar iwHeight = $infoWindowBox.height();\n\t\tvar offset = -1 * ((iwHeight / 2) + 40);\n\n\t\tmap.setCenter(marker.getPosition());\n\t\tmap.panBy(0, offset);\n\t}, 100);\n}", "function initInfoBoxes() {\n var self = this;\n\n // close\n _utility.$doc.on('click', '.nk-info-box .nk-info-box-close', function onInfoboxCloseClick(e) {\n e.preventDefault();\n var $box = (0, _utility.$)(this).parents('.nk-info-box:eq(0)');\n _utility.tween.to($box, 0.3, {\n opacity: 0,\n onComplete: function onComplete() {\n _utility.tween.to($box, 0.3, {\n height: 0,\n padding: 0,\n margin: 0,\n display: 'none',\n onComplete: function onComplete() {\n self.debounceResize();\n }\n });\n }\n });\n });\n}", "function makeInfoBox(config) {\n var html = '' +\n '<div class=\"mappopup\">' +\n '<h4>' + config.title + '</h4>' +\n '<p>' + config.content + '</p>' +\n '<a href=\"' + config.url + '\" ' + (config.external ? 'target=\"_blank\"' : '') + '>' +\n config.linktext +\n '</a>' +\n '</div>';\n\n return new google.maps.InfoWindow({\n content: html\n });\n}", "displayInfo() {\n this.getTime();\n $('#modalTitle').html(`${this.name}`);\n $('#modalInfo').html(\n `<li>Current Time: &nbsp; ${this.time}</li><li>Latitude: &nbsp; ${this.latitude}</li><li>Longitude: &nbsp; ${this.longitude}</li><li>Distance from your location: &nbsp; ${this.distance}km</li>`\n );\n $('#wikiInfo').removeClass('show');\n $('#forecastInfo').removeClass('show');\n $('#weatherInfo').removeClass('show');\n $('#generalInfo').addClass('show');\n $('#infoModal').modal();\n }", "function createInfoWindow(item, index) {\n let content = `<a href=\"${item.website()}\" target=\"_blank\"><h3>` +\n `${item.name()}</h3></a><p>${item.info()}<br> `+\n `<div><span>Current Weather:</span><canvas id=\"weather-info-${index}\"` +\n ` width=\"32\" height=\"32\"></canvas></div>` +\n `Rating:${item.rating()}/5</p>`;\n return new google.maps.InfoWindow({\n content: content\n })\n}", "function disp_info(d) {\n //console.log(d);\n materialInfo.html(getMaterialInfo(d))\n .attr(\"class\", \"panel_on\");\n }", "function infoWindow() {\n const modal = document.getElementById(\"myModal\");\n const fileModal = document.getElementById(\"file-content\");\n const infoModal = document.getElementById(\"info-content\");\n fileModal.style.display = \"none\";\n infoModal.style.display = \"block\";\n modal.style.display = \"flex\";\n}", "openInfoWindow(location) {\n this.closeInfoWindow();\n this.state.infowindow.open(this.state.map, location.marker);\n this.state.infowindow.setContent(\"Looking Up . . . \");\n this.getWindowData(location);\n }", "function populateInfoWindow(details, marker, infowindow) {\n\n var content = '<div class=\"card\" style=\"width: 12rem;\">\\n' +\n ' <img class=\"card-img-top\" src=\"'+details.picture+'\" alt=\"Card image cap\">\\n' +\n ' <div class=\"card-body\">\\n' +\n ' <h5 class=\"card-title\">'+details.name+'</h5>\\n' +\n ' <p class=\"card-text\">'+details.address+'</p>\\n' +\n ' </div>\\n' +\n '</div>';\n // check if infoWindow is already opened\n if (infowindow.marker != marker) {\n infowindow.marker = marker;\n infowindow.setContent(content);\n infowindow.open(map, marker);\n // clear marker when infoWindow is closed\n infowindow.addListener(\"closeclick\", function(){\n infowindow.setMarker = null;\n });\n }\n }", "function showInfoWindow(i) {\n return function(place, status) {\n // Closes other windows when one is clicked\n if (infowindow) {\n infowindow.close();\n infowindow = null;\n }\n\n // Displays window\n if (status == google.maps.places.PlacesServiceStatus.OK) {\n infowindow = new google.maps.InfoWindow({\n content: getIWContent(place)\n });\n infowindow.open(map, markers[i]); \n }\n }\n}", "function createInfoWindowContent(place) {\n console.log(place);\n var content = '<div id=info>' +\n '<h4>' + place.name + '</h4>';\n\n if (place.shouldShowRating) {\n content = content.concat('<p>FourSquare Rating: ' + place.rating + '</p>');\n }\n\n if (place.status) {\n var cssClass = place.isOpen ? \"status-open\" : \"status-closed\";\n content = content.concat('<div class=' + cssClass + '>');\n content = content.concat('<p>' + place.status + '</p>');\n content = content.concat('</div>');\n }\n\n if (place.url) {\n content = content.concat('<a href=' + place.url + '>' + place.url +'</a>');\n }\n\n content = content.concat('<p>Powered by FourSquare</p>');\n\n return content;\n\n}", "function fnhideInformation()\r\n\t\t{\r\n\t\t\tmblnOnInfoWindow = false;\r\n\t\t}", "function populateInfoWindow(marker, infowindow) {\n\t\t\t// Check to make sure the infowindow is not already opened on this marker.\n\t\t\t\tif (infowindow.marker != marker) {\n\t\t\t\t\t\tinfowindow.marker = marker;\n\t\t\t\t\t\t// Wiki(marker.location);\n\t\t\t\t\t\tmarker.setAnimation(google.maps.Animation.BOUNCE);\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\t\tmarker.setAnimation(null);\n\t\t\t\t\t\t}, 1000);\n\t\t\t\t\t\t// Wiki(marker.location);\n\t\t\t\t\t\t\n\t\t\t\t\t\tinfowindow.setContent(wikicontent + '<hr>' + '<div>' + marker.title + '</div>');\n\t\t\t\t\t\tconsole.log('information window : '+ wikicontent);\n\t\t\t\t\t\tinfowindow.open(map, marker);\n\t\t\t\t\t\t// Make sure the marker property is cleared if the infowindow is closed.\n\t\t\t\t\t\tinfowindow.addListener('closeclick', function() {\n\t\t\t\t\t\t\t\tinfowindow.marker = null;\n\t\t\t\t\t\t});\n\t\t\t\t}\n\t\t}", "function buildMarkers(){\n\tfor (q=0; q<=2; q++){\n\t\tinfoWindow[q] = new google.maps.InfoWindow({\n\t\t\tcontent: contentString[q]\n\t });\n\t\t\t\n\t}\n}", "function showInfoWindowForMarker(featureData, clusteredId) {\n var idString = \"\"+ featureData.topicId + \"\";\n var htmlString = '<b>' + featureData.topicName + '</b><br/><a href=javascript:showTopicInSideBar(\"'\n + idString+'\")>weitere Details</a>';\n // if ( clusteredId != null ) {\n if ( featureData.cluster != null ) {\n htmlString = \"<b class=\\\"redTitle\\\">Es gibt hier mehrere M&ouml;glichkeiten an einem Ort:</b><p/>\";\n for (i=0; i < featureData.cluster.length; i++) {\n var clusterTopicId = featureData.cluster[i].topicId;\n var clusterTopic = getTopicById(clusterTopicId);\n htmlString += '<b>' + clusterTopic.name + '</b>&nbsp; - <a href=javascript:showTopicInSideBar(\"'\n + clusterTopicId + '\")>weitere Details</a><br/>';\n }\n // htmlString += \"</li>\";\n }\n // just make sure that there is not more than 1active PopUpWindow\n hideAllInfoWindows();\n // var htmlString = '<b>' + featureData.topicName\n // + '</b><br/><a href=javascript:showTopicInSideBar(\"'+idString+'\")>weitere Details</a>';\n var lonlat = new OpenLayers.LonLat(featureData.lon, featureData.lat);\n var popup = new OpenLayers.Popup.FramedCloud(\n \"infoPoop-\"+featureData.topicId,\n lonlat, new OpenLayers.Size(250, 200),\n htmlString, null,\n false);\n // popup.keepInMap = true;\n popup.autoSize = true;\n popup.panMapIfOutOfView = false;\n /*popup.addCloseBox(function(){\n var feat = checkFeatureById(idString);\n feat.renderIntent = \"default\";\n myNewLayer.redraw();\n }); **/\n map.addPopup(popup);\n }", "function setInfoWindow(place, marker) {\n //clone a new element for window content and set the place name\n var content = $(\"#place-info\").clone().removeAttr('id');\n content.find('.name').text(place.name);\n \n //set address if available\n if(typeof place.formatted_address === 'undefined') {\n content.find('.address').remove();\n }\n else {\n content.find('.address').text(place.formatted_address);\n }\n \n //set phone number if available\n if(typeof place.formatted_phone_number === 'undefined') {\n content.find('.phone').remove();\n }\n else {\n content.find('.phone').prop('href', 'tel:' + place.formatted_phone_number).text(place.formatted_phone_number);\n }\n \n //set directions button action\n content.find('button').click(function() {\n app.calcRoute(place.geometry.location);\n app.infoWindow.close();\n });\n \n //set the window content and open it\n app.infoWindow.setContent(content[0]);\n app.infoWindow.open(app.map, marker);\n }", "function addInfoWindow(map, marker, infowindow) {\n\tmarker.addListener('click', function() {\n\t\tinfowindow.setContent('<div id=\"stationinfo_' + marker.get('station_id') + '\">Loading station info for station ' + marker.get('station_id') + '...</div>');\n\t\tinfowindow.open(map, marker);\n\t\tget_station(marker.get('station_id'));\n\t});\n}", "function bindInfoWindow(marker, map, infoWindow, contentString, yelpID) {\n google.maps.event.addListener(marker, 'click', function () {\n for (var i in infoWindowArray) {\n infoWindowArray[i].close();\n }\n infoWindow.setContent(contentString);\n infoWindow.open(map, marker);\n var targetScrollRow = document.getElementById('tablerow-' + yelpID);\n targetScrollRow.scrollIntoView();\n });\n }", "function openInfoView(loc) {\n infoWindow.close(); //closes currently displayed infoView (if it is there). \n \n //center the map at the marker for which infoView is displayed.\n map.setCenter(new google.maps.LatLng(loc.lat, loc.lon)); \n var htmlStrings = [];\n htmlStrings[0] = '<div>' + '<strong>' + loc.name + '</strong>' + '</div>';\n htmlStrings[1] = '<p>' + loc.category + '</p>';\n htmlStrings[2] = '<p>' + loc.address + '</p>';\n htmlStrings[3] = '<p>' + 'Phone No. ' + loc.phone + '</p>';\n var html = htmlStrings.join('');\n infoWindow.setContent(html);//'html' has the infoView content\n \n //sets the BOUNCE animation on marker\n loc.marker.setAnimation(google.maps.Animation.BOUNCE);\n \n //switch off the animation after 1second.\n setTimeout(function() { loc.marker.setAnimation(null);},1000);\n infoWindow.open(map, loc.marker);\n}", "function setInfoWindow(marker, infoWindow) {\n if (infoWindow.marker != marker) {\n infoWindow.marker = marker;\n infoWindow.setContent(\"<div class='title'>\" + marker.title + \"</div>\" + marker.contentString);\n }\n marker.setAnimation(google.maps.Animation.BOUNCE);\n setTimeout(function() {\n marker.setAnimation(null);\n }, 500);\n infoWindow.open(map, marker);\n \n infoWindow.addListener('closeclick', function() {\n infoWindow.setMarker = null;\n });\n\n //Automatically close info window after 3 seconds\n window.setTimeout(function(){\n infoWindow.close();\n }, 3000);\n }", "function openInfoWindow(map, marker, infoWindow) {\n const windowNode = document.createElement(\"div\");\n\n let owner = document.createElement(\"div\");\n owner.innerText = marker.owner;\n owner.className = \"user-nickname\";\n windowNode.appendChild(owner);\n\n let overview = document.createElement(\"div\");\n overview.innerText = marker.overview;\n overview.className = \"task-content-marker\";\n windowNode.appendChild(overview);\n\n let category = document.createElement(\"div\");\n category.innerText = \"#\" + marker.category;\n category.className = \"task-category\";\n windowNode.appendChild(category);\n\n let dateTime = document.createElement(\"div\");\n dateTime.innerText = marker.dateTime;\n dateTime.className = \"task-date-time\";\n windowNode.appendChild(dateTime);\n\n // adds help out option\n if (marker.get(\"isCurrentUser\") == false) {\n const helpOutButton = document.createElement(\"button\");\n helpOutButton.innerText = \"Help Out\";\n helpOutButton.className = \"help-out-marker\";\n\n // adds help out button click event\n helpOutButton.addEventListener(\"click\", function(e) {\n let helpOverlay = document.getElementById(\"help-overlay-map\");\n helpOverlay.style.display = \"block\";\n\n // adds confirm help click event\n document.getElementById(\"confirm-map\").addEventListener(\"click\", function(e) {\n confirmHelp(marker.get(\"key\"));\n helpOverlay.style.display = \"none\";\n e.stopPropagation();\n });\n\n // adss exit help click event\n document.getElementById(\"exit-help-map\").addEventListener(\"click\", function(e) {\n helpOverlay.style.display = \"none\";\n e.stopPropagation();\n });\n e.stopPropagation();\n });\n windowNode.appendChild(helpOutButton);\n }\n\n // adds click even to open up the task details modal\n windowNode.addEventListener(\"click\", function() {\n showTaskInfo(marker.get(\"key\"));\n });\n \n infoWindow.setContent(windowNode);\n infoWindow.open(map, marker);\n infoWindows.push(infoWindow);\n}", "function refreshInfoWindow() {\n\tvar marker = infoWindow.marker;\n\n\tinfoWindow.open(map, marker);\n\n\t// enables KO bindings, needed for dynamically injected elements\n\tvar $infowindow = $(\".infowindow\")[0];\n\tko.applyBindingsToDescendants(viewModel, $infowindow);\n}", "function addInfoWindow(marker, message,myLatLng,i) {\nvar infoWindow = new google.maps.InfoWindow({\n content: \"\"\n});\n var geocoder = new google.maps.Geocoder;\n google.maps.event.addListener(marker, 'click', function () {\n\t\t\tgeocodeLatLng(geocoder, map,marker, infoWindow,myLatLng,i);\n\t\t\t//infoWindow.open(map, marker);\n });\n}", "function openInfo(lat,lng,content) {\n\tvar latLng = new google.maps.LatLng(lat,lng);\n\n\n\tif (content == null) {\n\t var m = latLngCache.get(latLng.toString());\n\n\t var content = tag('div',{},[\n\t\ttext(m.place.name)\n\t ]);\n\t}\n\n\n\tinfowindow.setContent(content);\n\tinfowindow.setPosition(latLng);\n\t\n\tif (m != null) {\n\t infowindow.open(googleMap,m.marker);\n\t \n\t} else {\n\t infowindow.open(googleMap);\n\n\n\t}\n\n\n\n\n\n\n }", "function createInfoWindow(map) {\n console.log(\"creating info window\");\n infowindow = new google.maps.InfoWindow();\n google.maps.event.addListener(map, 'mouseover', function() {\n infowindow.close();\n });\n return infowindow;\n}", "function populateInfoWindow(marker, infowindow) {\n if (infowindow.marker != marker) {\n infowindow.marker = marker;\n infowindow.setContent('<div id=infoWindow>' + marker.title + '</div>');\n infowindow.open(map, marker);\n infowindow.addListener('closeclick', function() {\n infowindow.setMarker = null;\n });\n }\n }", "function createInfoWindow(savedLocation){\n\tif(savedLocation){\n\t\tinfowindow = new google.maps.InfoWindow({\n\t\t\tcontent: generateInfoContent(true),\n\t\t\tmaxWidth: 300\n\t\t});\n\t\tinfowindow.open(map,marker);\n\t}else{\n\t\tlatLng = marker.getPosition();\n\t\tgeocoder.geocode( { 'latLng': latLng}, function(results, status) {\n\t\t\tif (status == google.maps.GeocoderStatus.OK) {\n\t\t\t\taddress = results[0].formatted_address; \n\t\t \t\tif(typeof infowindow != \"undefined\"){\n\t\t \tinfowindow.close();\n\t\t }\n\t\t\t\tinfowindow = new google.maps.InfoWindow({\n\t\t\t\t\tcontent: generateInfoContent(false),\n\t\t\t\t\tmaxWidth: 300\n\t\t\t\t});\n\t\t\t\tinfowindow.open(map,marker);\n\t\t\t}\n\t\t});\n\t}\n}", "function bindInfoWindow(marker, map, infowindow, site) {\n\n\tgoogle.maps.event.addListener(marker, 'click', function () {\n\n\t\tif (ctrlPressed) {\n\n\t\t\tif (selectedMarkers.indexOf(marker) == -1) {\n\t\t\t\tselectedMarkers.push(marker);\n\t\t\t\tmarker.setIcon({url: 'http://maps.gstatic.com/mapfiles/markers2/icon_green.png'});\n\t\t\t\t// marker.set(labelContent', 'labels[labelIndex++ % labels.length]);\n\t\t\t\tselectedSensors.push(site);\n\t\t\t\tupdateSiteWindowPane();\n\t\t\t}\n\n\t\t}\n\t\telse {\n\n\t\t\t// Handle 1 selected marker on map\n\t\t\tclearSelectedMarkers();\n\t\t\tclearSelectedSensors();\n\t\t\tlabelIndex = 0;\n\t\t\tselectedMarker = marker;\n indexSite = site._id;\n\n\t\t\tif (selectedMarkers.indexOf(marker) == -1) {\n\n\t\t\t\t// log('Selected site', site);\n\n // Place camera at center and on top of marker\n\t\t\t\tif (Dashboard.state.localeCompare(\"minimized\") == 0)\n\t\t\t\t\toffsetCenter(marker.getPosition(), -($(window).width() * 0.15), 0);\n\t\t\t\telse\n\t\t\t\t\tmap.panTo(marker.getPosition());\n\n\t\t\t\tselectedMarkers.push(selectedMarker);\n\t\t\t\tselectedSensors.push(site);\n\t\t\t\t//TODO: add local icon\n\t\t\t\tmarker.setIcon({url: 'http://maps.gstatic.com/mapfiles/markers2/icon_green.png'});\n\t\t\t\t\n // InfoWindow\n //TODO: Id of ballon should be the site id\n\n\t\t\t\tvar markerSection = '<div id=\"site-marker-section\"></div>';\n\n infowindow.setContent(markerSection);\n\t\t\t\tinfowindow.open(map, marker);\n\n\t\t\t\tViewsManager.populateSections(site);\n\n }\n\t\t}\n\t\t// infoWindow Pane\n\t\t// infowindow.setContent(\"SensorID: \" + sensor.id + \"\\n TimeValue: \" + sensor.timeValue + \"\\nValue: \" + sensor.value);\n\t\t// updateSiteWindowPane(\"SensorID: \" + sensor.id + \"/n TimeValue: \" + sensor.timeValue + \"/nValue: \" + \"+ sensor.value\");\n\t});\n}", "function setupInfoWindow() {\n var marker, photoUrl;\n for (var i = 0; i < markers.length; i++) {\n markers[i].infoWindow = new google.maps.InfoWindow();\n markers[i].photoUrl = photos[i];\n markers[i].addListener('click', function (marker) {\n return function () {\n toggleBounce(marker);\n populateInfoWindow(marker);\n }\n\n }(markers[i]));\n markers[i].addListener('mouseover', function (marker) {\n return function () {\n marker.setIcon(highlightedIcon);\n }\n\n }(markers[i]));\n markers[i].addListener('mouseout', function (marker) {\n return function () {\n marker.setIcon(defaultIcon);\n }\n }(markers[i]));\n }\n // Apply bindings after map as been loaded and the images have been received.\n ko.applyBindings(new PlaceViewModal());\n}", "function openInfoWindow(marker) {\n if (infoWindow.marker !== marker) {\n infoWindow.marker = marker;\n infoWindow.setContent(buildInfoContent(marker));\n infoWindow.open(self.map, marker);\n infoWindow.addListener('closeclick', function () {\n infoWindow.marker = null;\n });\n getYelpInfo(marker);\n }\n }", "function initMakerInfoWindow(marker, markerGoogle) {\n\tgoogle.maps.event.addListener(markerGoogle, 'click', function() {\n\t\tcloseAllMarkersWindows();\n\t\t\n \tvar infowindow = new InfoBubble({\n\t\t\tcontent: buildInfoWindow(marker),\n\t\t\tpadding: 0\n\t\t});\n \tinfowindow.open(MAP_MAIN, markerGoogle);\n \t\n \tinfoWindows[marker.id] = infowindow;\n });\n}", "function displayInfo(evt)\n {\n // Repérer la feature sous la souris\n var coord= map.getEventPixel(evt.originalEvent);\n var feature = map.forEachFeatureAtPixel(coord, function(feature, layer) {\n return feature;\n });\n\n // si pas de feature on cache le popup & retourne\n if( !feature){\n overlay.setPosition(undefined);\n popup_closer.blur();\n return;\n }\n\n // Si c'est un cluster, on affiche le popup\n if ( feature.get('features') && feature.get('features').length > 0) {\n\n // chaine de caractère du popup\n var str=\"\";\n popup_content.innerHTML= \"\";\n\n // feature contenues dans le cluster\n var features = feature.get('features');\n\n // on parcourt les feature pour les ajouter au popup\n var index= 0;\n var button= null;\n for(var i = 0; i < features.length; i++) {\n\n //id de route représentée par la feature\n id= features[i].get('id_bdd');\n\n // Bouton avec le nom de la route\n button = document.createElement(\"p\");\n button.id = id;\n button.className = \"popup_button\";\n button.innerHTML = liste_routes[id]['nom_route'];\n\n // aajout du parent au popup\n popup_content.appendChild(button);\n\n // lors du click sur un bouton, fonction\n button.onclick= function() {\n\n // on cache le popup\n overlay.setPosition(undefined);\n\n // enregistrement du PI actif\n id_PI_active= this.id; // pour casser les pointeurs\n\n // émission d'un évènement update\n $rootScope.$emit(updateEvent);\n };\n\n // on s'arrête à 4 routes contenues dans le popup\n index++;\n if( index == 5) {\n // bouton\n button = document.createElement(\"p\");\n button.className = \"popup_button\";\n button.innerHTML = '...';\n\n // ajout du bouton au popup\n popup_content.appendChild(button);\n\n break;\n }\n }\n\n // affichage du popup\n overlay.setPosition(evt.coordinate);\n }\n\n //si c'est une feature type point, renvoie un event avec l'id\n else if (feature.getGeometry().getType() == \"Point\")\n {\n // reset du popup\n var str=\"\";\n popup_content.innerHTML= \"\";\n\n // récupération de l'id du point, du type et des images\n var id= feature.get('id_bdd');\n var type= feature.get('type_bdd');\n var img_src= feature.get('images_bdd');\n var index_image= feature.get('index_image');\n\n // si pas d'id, on retourne\n if( !id || id == -1)\n return;\n\n // enregistrement du PI actif\n id_PI_active= id;\n\n // div contenant l'en tête\n var en_tete= document.createElement(\"div\");\n en_tete.className = \"popup_en_tete\";\n\n // texte avec le type\n var titre = document.createElement(\"span\");\n titre.className = \"popup_titre\";\n titre.innerHTML= type;\n\n // ajout du titre à l'en tête\n en_tete.appendChild(titre);\n\n // ajout de l'en tête au popup\n popup_content.appendChild(en_tete);\n\n // récupération de l'image si besoin\n if( type == 'photos'){\n // image dans une div\n var div= document.createElement(\"div\");\n div.className= \"popup_image\"\n var img= document.createElement(\"img\");\n img.id = index_image;\n img.src= \"http://seame.alwaysdata.net/\";\n img.src+= img_src[0];\n div.appendChild(img);\n popup_content.appendChild(div);\n\n // lors du click sur l'image, fonction\n img.onclick= function() {\n\n // enregistrement du PI actif\n index_image_active= this.id;\n\n // émission d'un évènement update: clic image\n $rootScope.$emit(imageEvent);\n };\n }\n\n // affichage du popup\n overlay.setPosition(evt.coordinate);\n\n // émission d'un évènement update\n $rootScope.$emit(updateEvent);\n }\n }", "function addMarkerInfo() {\n\n for (var i = 0; i < markersOnMap.length; i++) {\n var contentString = '<div id=\"content\"><h1>' + markersOnMap[i].placeName +\n\n '</h1><p>' + markersOnMap[i].description + ' <a href=\"walks.html\">See our Walks page for further details</a>r</p></div>';\n\n const marker = new google.maps.Marker({\n position: markersOnMap[i].LatLng[0],\n map: map\n });\n\n const infowindow = new google.maps.InfoWindow({\n content: contentString,\n maxWidth: 200\n });\n\n marker.addListener('click', function () {\n closeOtherInfo();\n infowindow.open(marker.get('map'), marker);\n InforObj[0] = infowindow;\n });\n\n }\n}", "function showInfoBox (sText, sTitle, aCallBack)\n// ---------------------------------------------------------------------\n{\n var aConf =\n {\n msg: sText.replace(/\\[ait-[0-9]*\\]\\n/, \"\").replace(/\\[ado-[0-9]*\\]\\n/g, \"\"),\n icon: Ext.MessageBox.INFO,\n title: sTitle,\n fn: aCallBack\n };\n return showBox (aConf);\n}", "function infoWindowContent(title, address, tel, type, position) {\n let content = [];\n ajax(title, function (data) {\n content.push(\"<img src='\" + data + \"'>\");\n contentCreate(content, title, address, tel, type, position);\n }, function (error) {\n content.push(\"图片:\" + error);\n contentCreate(content, title, address, tel, type, position);\n });\n}", "function showInfoWindow(marker)\n {\n\n var address;\n var linkContent;\n var openInNewAttrs = \"\";\n\n /* jshint validthis: true */\n // 1. if there’s no window\n if (oWin === null)\n {\n oWin = new google.maps.InfoWindow({ content: \"\" });\n }\n\n // 2. Converts address to string with only +'s not spaces'\n if( marker.address ) {\n address = marker.address.split(' ').join('+');\n }\n\n if( marker.openInNew !== undefined && marker.openInNew ) {\n openInNewAttrs = ' target=\"_blank\" ';\n }\n\n if (marker.linkText && marker.linkHref) {\n linkContent = '<a ' + openInNewAttrs + ' href=\"'+ marker.linkHref +'\">' + marker.linkText + '</a>';\n } else {\n linkContent = '<a ' + openInNewAttrs + ' href=\"https://www.google.com/maps?daddr='+ address +'\">Get directions</a>';\n }\n\n\n // 3. set the content + show it\n oWin.setContent(\n '<strong class=\"map__info-window\">'+marker.title+'</strong>' +\n '<br>' +\n linkContent\n );\n oWin.open(oMap, marker);\n }", "function klikInfoWindow(id, marker)\n{\n google.maps.event.addListener(marker, \"click\", function(){\n detailmes_infow(id);\n\n });\n\n}", "function _initInfoBoxes() {\n var self = this;\n\n // close\n $doc.on('click', '.nk-info-box .nk-info-box-close', function (e) {\n e.preventDefault();\n var $box = $(this).parents('.nk-info-box:eq(0)');\n tween.to($box, 0.3, {\n opacity: 0,\n onComplete: function onComplete() {\n tween.to($box, 0.3, {\n height: 0,\n padding: 0,\n margin: 0,\n display: 'none',\n onComplete: function onComplete() {\n self.debounceResize();\n }\n });\n }\n });\n });\n}", "function populateInfoWindow(marker, infowindow) {\n if (infowindow.marker == marker) {\n infowindow.marker = marker;\n infowindow.addListener('closeclick', function() {\n infowindow.marker = null;\n marker.setIcon(makeMarkerIcon('0091ff'));\n });\n \n // Add content to info window. Can be made richer and as needed.\n var content = \"<div class='infoWindowTitle'>\" + marker.title + \"</div>\";\n if(marker.content) {\n content += \"<div class='infoWindowContent'>\" + marker.content + \"</div>\";\n }\n \n infowindow.setContent(content);\n infowindow.open(map, marker);\n }\n}", "function createInfoWindow(marker, centerMarker) {\n var onclick;\n var centerMarkerId\n var rating = (marker.rating == \"None\") ? \"\" : \"Rating: \" + Math.round(marker.rating) + \"/100\";\n var errorMessage = ($(\"#err\").length) ? $(\"#err\").html() : \"\";\n\n // There is no centerMarker if the marker is on our path\n if (centerMarker == null) {\n onclick = ' id=\"removeBtn\" onclick=\"removePoint(' + marker.id + ');\">' +\n '<span class=\"glyphicon glyphicon-trash\"></span>';\n } else {\n centerMarkerId = centerMarker.id;\n onclick = ' id=\"addBtn\" onclick=\"addPoint(' + marker.id + ', ' +\n centerMarker.id + ');\">Add';\n }\n\n var content = '<p>' + marker.name + '</p><p>' +\n rating + '</p><p id=\"err\">' + errorMessage +\n '</p><div class=\"btn btn-primary btn-sm\"' + onclick +\n '</div><div class=\"btn btn-link btn-sm\"' +\n 'onclick=\"setInfoWindowContent('+ marker.id + ', ' + centerMarkerId +\n ');\">More Info...</div>';\n\n namespace.popWindow.marker = marker;\n namespace.popWindow.setContent(content);\n namespace.popWindow.open(namespace.map, marker);\n}", "function bindInfoWindow(marker, map, infoWindow, html) {\n google.maps.event.addListener(marker, 'click', function() {\n infoWindow.setContent(html);\n infoWindow.open(map, marker);\n });\n }", "function createInfoPanel() {\n return new Ext.Panel({\n border: true,\n id: 'infoPanel',\n baseCls: 'md-info',\n autoWidth: true,\n contentEl: 'infoContent',\n autoLoad: {\n url: '../../apps/search/home_' + catalogue.LANG + '.html',\n callback: loadCallback,\n scope: this,\n loadScripts: false\n }\n });\n }", "function open_infobox(point_id) {\n var point_bullet = $(window.point_list[point_id]);\n $('.infobox h1').text(point_bullet.find('h3').text());\n $('.infobox__insertedhtml').html(point_bullet.find('.point_data__content').html());\n $('.infobox').fadeIn(\"fast\", function () {\n $(this).addClass('show');\n });\n}", "function getPageInfos(){\n browser.tabs.query({active: true, currentWindow: true}, function(tabs) {\n browser.tabs.sendMessage(tabs[0].id, {infoCode: \"pageInfo\"}, function(response) {\n writeToPopup(response);\n });\n });\n}", "function showInfoWindowForTopicId(topicId) {\n // just make sure that there is not more than 1active PopUpWindow\n hideAllInfoWindows();\n //var topicInfo = getTopicById(data.topicId);\n var idString = \"\"+ topicId + \"\";\n var featureData = checkFeatureById(topicId).data;\n var htmlString = '<b>' + featureData.topicName + '</b><br/><a href=javascript:showTopicInSideBar(\"'\n + idString+'\")>weitere Details</a>';\n var lonlat = new OpenLayers.LonLat(featureData.lon, featureData.lat);\n //\n var popup = new OpenLayers.Popup.FramedCloud(\n \"infoPoop-\"+featureData.topicId,\n lonlat, new OpenLayers.Size(250, 100),\n htmlString, null, false);\n popup.keepInMap = true;\n // popup.panMapIfOutOfView = false;\n popup.autoSize = true;\n map.addPopup(popup);\n }" ]
[ "0.7568426", "0.73341227", "0.72246873", "0.7048647", "0.6988801", "0.6925267", "0.69147074", "0.68862957", "0.6785943", "0.6757487", "0.6754483", "0.67405164", "0.6734155", "0.6727168", "0.6710071", "0.6678896", "0.663082", "0.66148293", "0.6611635", "0.6611221", "0.6608989", "0.6597", "0.65736014", "0.6564026", "0.6560495", "0.6539586", "0.6519481", "0.6511333", "0.65055585", "0.6504806", "0.6497256", "0.6485993", "0.6475818", "0.64709675", "0.646554", "0.6464645", "0.64555454", "0.6449853", "0.6448047", "0.643781", "0.6433188", "0.6424316", "0.6418175", "0.639475", "0.63943857", "0.63865846", "0.6382696", "0.6375609", "0.6359243", "0.6351466", "0.6350011", "0.6346839", "0.6345001", "0.6343117", "0.6339517", "0.6337534", "0.6326427", "0.6326174", "0.6321067", "0.6319598", "0.6314396", "0.6313912", "0.631181", "0.6310369", "0.6309528", "0.6306156", "0.63020873", "0.6300437", "0.628446", "0.6277314", "0.6275063", "0.62664765", "0.6261226", "0.62519497", "0.62451315", "0.62346345", "0.62296194", "0.6224761", "0.62203145", "0.62093884", "0.62030923", "0.62024915", "0.6201374", "0.6188418", "0.6187252", "0.6185289", "0.61825395", "0.6170366", "0.6167466", "0.6162225", "0.61598706", "0.6158942", "0.61560386", "0.61455154", "0.61417377", "0.61403066", "0.6137055", "0.61361504", "0.6135334", "0.61304903" ]
0.62012273
83
delete all added markers
function clearMarkers() { for (let i = 0; i < markers.length; i++) { markers[i].setMap(null); } for (let i = 0; i < dropMarkers.length; i++) { dropMarkers[i].setMap(null); } markerNum=0; markers.length = 0; dropMarkers.length=0; dataPoints.length = 0; closeIWindows(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteMarkers() {\r\n setMapOnAll(null);\r\n markers = [];\r\n }", "function deleteMarkers() {\n\n clearMarkers();\n markers = [];\n\n}", "function deleteMarkers() {\r\n clearMarkers();\r\n markers = [];\r\n}", "function deleteMarkers() {\r\n clearMarkers();\r\n markers = [];\r\n}", "function deleteMarkers() {\r\n clearMarkers();\r\n markers = [];\r\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\r\n clearMarkers();\r\n markers = [];\r\n }", "function deleteMarkers() {\r\n clearMarkers();\r\n markers = [];\r\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n clearRows();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n }", "function deleteMarkers() {\n\t\t\t clearMarkers();\n\t\t\t markers = [];\n\t\t\t}", "function deleteMarkers() {\n\t\t\t\t clearMarkers();\n\t\t\t\t markers = [];\n\t\t\t\t}", "function deleteMarkers() {\n\tclearMarkers();\n\tmarkers = [];\n}", "function deleteMarkers() {\n\tclearMarkers();\n\tmarkers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers1 = [];\n }", "function deleteMarkers() {\n clearMarkers()\n markerArr = []\n}", "function deleteMarkers() {\n\t\t\tclearMarkers();\n\t\t\tmarkers = [];\n\t\t}", "function deleteMarkers() {\n\t\t clearMarkers();\n\t\t markers = [];\n\t\t}", "function deleteMarkers() {\n displayAllMarkers(null);\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n marker_count = 0;\n}", "function deleteMarkers() {\n\t clearMarkers();\n\t markers = [];\n\t}", "function deleteMarkers() {\n\t clearMarkers();\n\t markers = [];\n\t}", "function deleteMarkers() {\n\t clearMarkers();\n\t markers = [];\n\t}", "function deleteMarkers() {\n clearMarkers();\n markers.length = 0;\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n infoViews = [];\n}", "function deleteMarkers() {\r\n for (var i = 0; i < markers.length; i++) {\r\n markers[i].setMap(null);\r\n }\r\n\r\n markers = [];\r\n }", "function deleteMarkers() {\n for (var i = 0; i < allMarkers.length; i++) {\n allMarkers[i].setMap(null);\n }\n allMarkers = [];\n}", "function deleteMarkers() {\n var i;\n for (i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n infowindows = [];\n console.log(\"cleared\", markers);\n}", "function deleteMarkers() {\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers = [];\n}", "function deleteMarkers() {\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers = [];\n }", "function deleteAllMarkers(){\n for (var i = 0; i < $scope.markers.length; i++) {\n $scope.markers[i].setMap(null);\n }\n }", "function deleteMarkers() {\n for (let i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n markers = [];\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n choiceMarkers = [];\n searchResMarkers = [];\n}//deleteMarkers", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n // remove bounds values from boundsArray\n boundsArray = [];\n}", "function deleteAllMarkers() {\r\n if (_markersArray) {\r\n for (i in _markersArray) {\r\n _markersArray[i].setMap(null);\r\n }\r\n _markersArray.length = 0;\r\n }\r\n }", "function deleteAllMarkers() {\n //console.log('[DEV] deletemarkers fired : length : %s',markers.length);\n if (markers.length == 0) return;\n\n // close the card\n closeCard();\n\n // remove active markers\n deleteActiveMarker();\n\n //reset markerclusterers \n markerclusterer.clearMarkers();\n markerclusterer.removeMarkers(markers);\n\n //remove markers from google map\n for (var i = 0; i < markers.length; i++) {\n markers[i].setMap(null);\n }\n // reset google marker array\n markers = [];\n\n //get rid of infowindows content\n infowindow.close();\n infowindowContents = [];\n\n //reset bounds to init values\n bounds = new google.maps.LatLngBounds();\n \n // show the loading animation\n onReady(function () {\n show('loading', true);\n });\n}", "function deleteMarkers() {\n\tfor (var i = 0; i < markers.length; i++) {\n\t\tmarkers[i].setMap(null);\n\t}\n\n\tmarkers = [];\n}", "function deleteMarkers() {\n setMapOnAll(null);\n markers.length = 0;\n locations.length = 0;\n console.log(markers);\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n deleteClusters();\n deleteLegend();\n}", "function deleteMarkers() {\n clearMarkers();\n $scope.markers = [];\n }", "function deleteMarkers() {\n clearMarkers();\n route_markers = [];\n update_route_buttons ();\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n if (markerCluster != undefined)\n markerCluster.clearMarkers();\n}", "function deleteOverlays() {\n clearOverlays();\n markers = [];\n}", "function deleteMarkers() {\r\n clearMarkers();\r\n markers = [];\r\n for(i = 0; i < heatmaps.length; i++){\r\n heatmaps[i].setMap(null)\r\n }\r\n heatmaps = [];\r\n crimeID = [];\r\n }", "function deleteMarkers() {\n infowindows.length = 0;\n for (marker of markers) {\n marker.setMap(null);\n }\n markers.length = 0;\n}", "function deleteMarkers() {\n clearMarkers();\n markers = [];\n console.log(markers);\n}", "function deleteMarkers() {\n\t// clear all markers from map\n\tfor (var i = 0; i < markers.length; i++) {\n\t markers[i].setMap(null);\n\t}\n\tmarkers = [];\n\t\n\tbounds = new google.maps.LatLngBounds();\n}", "function clearMarkers() {\n\n setAllMap(null);\n\n}", "function clearMarkers() {\n setAllMap(null);\n markers =[];\n }", "function clearMarkers() {\n\t\t\t \n\t\t\t setAllMap(null);\n\t\t\t\n\t\t\t}", "function clearMarkers() {\r\n setAllMap(null);\r\n}", "function clearMarkers() {\n markers.forEach(function(marker) {\n marker.removeFrom(mymap);\n });\n markers = [];\n}", "function clearMarkers() {\n setAllMap(null);\n}", "function clearMarkers() {\n setAllMap(null);\n}", "function clearMarkers() {\n setAllMap(null);\n}", "function clearMarkers() {\n setAllMap(null);\n}", "function clearMarkers() {\n setAllMap(null);\n}" ]
[ "0.8746498", "0.8729005", "0.87261117", "0.87261117", "0.87261117", "0.8722791", "0.8706614", "0.870597", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.87028074", "0.86984247", "0.86959255", "0.86959255", "0.86959255", "0.86959255", "0.86959255", "0.86959255", "0.8692119", "0.8692119", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.8691115", "0.86778086", "0.8675583", "0.86726236", "0.86619705", "0.8650403", "0.8628119", "0.8628119", "0.86128503", "0.8608525", "0.8606304", "0.86036074", "0.85851264", "0.8584961", "0.8572039", "0.8572039", "0.8572039", "0.8570169", "0.85097855", "0.845383", "0.8431613", "0.83890986", "0.8371821", "0.8350733", "0.8344054", "0.8340472", "0.8340145", "0.8336121", "0.8334285", "0.83088076", "0.8293758", "0.82594323", "0.8203352", "0.8193515", "0.8177464", "0.816428", "0.81626034", "0.81584084", "0.8140939", "0.81326985", "0.8123553", "0.8068926", "0.80591697", "0.8053122", "0.8051078", "0.8038558", "0.80382365", "0.8027335", "0.8027335", "0.8027335", "0.8027335", "0.8027335" ]
0.0
-1
close ALL info windows (stuff could have been left hanging if you click too quickly)
function closeIWindows() { for (let i = 0; i < iwindows.length; i++) { iwindows[i].close(); } iwindows = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeAllInfoWindows() {\n for (var i=0;i<infowins.length;i++) {\n infowins[i].close();\n infowins.splice(i, 1);\n }\n}", "function closeAllInfoWindows() {\n\tfor (var i=0;i<infoWindows.length;i++) {\n\t\tinfoWindows[i].close();\n\t}\n}", "function closeAllMarkersWindows() {\n\tvar keys = Object.keys(infoWindows);\n\t\n\tfor (infoKeyIndex in keys ) {\n\t\tvar infoWindowIndex = keys[infoKeyIndex]; \n\t\tvar markerInfoWindow = infoWindows[infoWindowIndex];\n\t\t\n\t\tmarkerInfoWindow.close();\n\t}\n}", "function closeAllInfoWindows() {\n if(originInfoWindowList != undefined){\n for (var i=0;i<originInfoWindowList.length;i++) {\n originInfoWindowList[i].close();\n }\n }\n if(currentInfoWindowList != undefined){\n for (var i=0;i<currentInfoWindowList.length;i++) {\n currentInfoWindowList[i].close();\n }\n }\n if(destinationInfoWindowList != undefined){\n for (var i=0;i<destinationInfoWindowList.length;i++) {\n destinationInfoWindowList[i].close();\n }\n }\n }", "function CloseInfo(){\n // close infoo window if already open\n if (infoWindow) {\n infoWindow.close();\n }\n}", "function closeAllInfoWindows(infowindow){\n\tif(infowindow.length > 0){\n\t\t$.each(infowindow, function(i,o){\n\t\t\to.close();\n\t\t\tif(infowindow.length == (i+1)){\n\t\t\t\tinfowindowclosingruns = false;\n\t\t\t}\n\t\t});\n\t}else{\n\t\tinfowindowclosingruns = false;\n\t}\n}", "function closeInfoWindow() {\r\n\t\t$('#infowindows').html('');\r\n\t\t$['mapsettings'].infoWindowLocation = [];\r\n\t\t$['mapsettings'].hasOpenInfoWindow = false;\r\n\t}", "function closeWindow() {\n\t\t\t\tinfoWin.close();\n\t\t\t}", "function fCloseInfoWindow(){\n\tif (myShowWindows.length==0) return false;\n\t\n\tvar handle = myShowWindows.pop();\n\tmyInfoWindow.close();\n\t\n\tif (handle.content) {\n\t\thandle.content.parentNode.removeChild(handle.content);\n\t\thandle.content = null;\n\t}\n\tif (myShowWindows.length!=0){\n\t\t\tfBuildInfoWindow(myInfoWindow,myShowWindows[myShowWindows.length-1].content)\n\t\t\tfShowInfoWindow(vMap,myShowWindows[myShowWindows.length-1]);\n\t}\n\treturn true;\n}", "function closeOtherInfoWindow() {\n if (infoWindowObject.length > 0) {\n infoWindowObject[0].set(\"marker\", null);\n /* and close it */\n infoWindowObject[0].close();\n /* blank the array */\n infoWindowObject = [];\n }\n}", "function closeInfoWindow() {\n map.clearInfoWindow();\n}", "function hideAllInfoWindows(map) {\n markersOnMap.forEach(function(marker) {\n marker.infoWindow.close(map, marker);\n }); \n}", "function clearInfoWindows() {\n infowindows.forEach((infowindow) => {infowindow.close();});\n infowindows = [];\n}", "function closeMapWindows() {\n\t\t\t if (click_infowindow!=undefined) click_infowindow.hide();\n \t\t\tif (delete_infowindow!=undefined) delete_infowindow.hide();\n if (edit_metadata!=undefined) edit_metadata.hide();\n\t\t\t}", "function closeOtherInfo() {\n if (infoObj.length > 0) {\n infoObj[0].set(\"marker\", null);\n infoObj[0].close();\n infoObj[0].length = 0;\n }\n }", "function closeOtherInfo() {\n if (infoObj.length > 0) {\n infoObj[0].set(\"marker\", null);\n infoObj[0].close();\n infoObj[0].length = 0;\n }\n }", "function closeOtherInfo() {\n if (infoObj.length > 0) {\n infoObj[0].set(\"marker\", null);\n infoObj[0].close();\n infoObj[0].length = 0;\n }\n }", "function closeOtherInfo() {\n if (infoObj.length > 0) {\n infoObj[0].set(\"marker\", null);\n infoObj[0].close();\n infoObj[0].length = 0;\n }\n }", "close() {\n this.googleInfoWindow_.close();\n this.googleInfoWindow_.setContent(null);\n }", "function fHideInfoWindow(){\n\tmyInfoWindow.close();\n\treturn true;\n//\tmyLock.noredraw = false;\n}", "function closeInfo() {\n infomodal.style.display = 'none';\n}", "function closeInfoWindow() {\n \n vm.infoWindowVisible(false);\n\n if (isMobile) {\n var iw = $('.info-window');\n iw.css('top', '');\n iw.css('height', '');\n iw.css('overflow', '');\n }\n\n}", "function closeAll() {\n document.getElementById(\"About\").style.display = \"none\";\n document.getElementById(\"Information\").style.display = \"none\";\n document.getElementById(\"header\").style.display = \"none\";\n document.getElementById(\"player\").style.display = \"none\";\n document.getElementById(\"Account\").style.display = \"none\";\n document.getElementById(\"Stats\").style.display = \"none\";\n document.getElementById(\"permission\").style.display = \"none\";\n}", "function hideInfoWindowCloseControl() {\n // $(\".gm-style-iw\").next(\"div\").css('display', 'none'); // this function gets rid of close btn in infowindows\n // udacity doesn't like it for this project so having an x is fine\n }", "function closeAllPopups()\n {\n if(infoPopupVisible)\n {\n $('#' + configuration.CSS.ids.infoPopupId).fadeOut();\n infoPopupVisible = false; \n }\n \n if(otherPopupVisible)\n {\n $('#' + configuration.CSS.ids.otherPopupId).fadeOut();\n otherPopupVisible = false;\n }\n \n if(economicalPopupVisible)\n {\n $('#' + configuration.CSS.ids.economicalPopupId).fadeOut();\n economicalPopupVisible = false; \n }\n \n if(politicalPopupVisible)\n {\n $('#' + configuration.CSS.ids.politicalPopupId).fadeOut();\n politicalPopupVisible = false; \n } \n }", "function closingInfoBox () {\n // adding some magic to btn on hover event (css selector doesn't work)\n $(\".exitBtn\").on(\"mouseenter mouseleave\", function() {\n $(this).toggleClass(\"hoverBtn\");\n });\n\n // closing infoBox by clicking on \"x\"\n $(\".exitBtn\").on(\"click\", function() {\n $(\".infoBox\").css(\"display\", \"none\");\n });\n\n //closing infoBox by clicking somewhere on the page\n $(\"body\").on(\"click\", function(e) { \n if ($(\".infoBox\").is(\":visible\")) {\n\n // except infoBox\n if($(e.target).hasClass(\"infoBox\") || $(e.target).hasClass(\"deleteButton\")) {\n return;\n }\n\n // and except the descendants of calendar and infoBox\n if($(e.target).closest(\".calendarBox\").length || $(e.target).closest(\".infoBox\").length) {\n return; \n }\n\n $(\".infoBox\").css(\"display\", \"none\");\n }\n })\n }", "function closeOthers(infoObj, map) {\n if (infoObj.length > 0) {\n infoObj[0].set(\"marker\", null);\n infoObj[0].close();\n infoObj[0].length = 0;\n map.setZoom(9);\n }\n }", "function closeAllPopups() {\n gees.tools.setElementDisplay(DISPLAY_ELEMENTS_KML, 'none');\n gees.dom.setDisplay('BuildResponseDiv', 'none');\n}", "closeAll() {\n this._closeDialogs(this.openDialogs);\n }", "closeAll() {\n this._closeDialogs(this.openDialogs);\n }", "closeAll() {\n this._closeDialogs(this.openDialogs);\n }", "function closeInfoWindow(index) {\n let infowindow = infowindows[index];\n infowindow.close();\n}", "function closeAllPopups() {\n setEditAvatarPopupOpen(false);\n setEditProfilePopupOpen(false);\n setAddPlacePopupOpen(false);\n setDeleteCardPopupOpen(false);\n setImagePopupOpen(false);\n setInfoToolTipOpen(false);\n setSelectedCard({});\n }", "function fnhideInformation()\r\n\t\t{\r\n\t\t\tmblnOnInfoWindow = false;\r\n\t\t}", "function closeContextMenus() {\n for (let i = 0; i < 100; i++) {\n const popperOverlay = getLastClass(document, 'popper__overlay');\n if (popperOverlay) {\n popperOverlay.click();\n } else {\n break;\n }\n if (i == 99) {\n warn('Tried a lot to close poppers.');\n }\n }\n click(document.body);\n withClass(document, 'manager', (manager) => {\n const cancelBtn = getUniqueClass(manager, 'cancel');\n if (cancelBtn) {\n click(cancelBtn);\n }\n });\n // Close windows with close buttons, particularly move-to-project\n //\n // (probably old)\n withClass(document, 'GB_window', (gbw) => {\n withClass(gbw, 'close', (close) => {\n withTag(close, 'div', click);\n });\n });\n // Close windows with close buttons\n withQuery(document, '[aria-label=\"Close modal\"]', click);\n // Close todoist-shortcuts' modals\n withClass(document, 'ts-modal-close', click);\n }", "function closeSystemInfo() {\n if (isSystemInfoOpen) {\n systemInfoPanel.classList.add('hidden');\n isSystemInfoOpen = false;\n }\n }", "function closeToolModals(){\n Quas.each(\".post-tool-modal\", function(el){\n el.visible(false);\n });\n\n Quas.each(\".toolbar-modal-btn\", function(el){\n el.active(false);\n });\n\n Quas.scrollable(true);\n}", "closeCleanup() {\n this.hide();\n this.addPopUpListener();\n }", "function closeAll() {\n\t\t\t$.each( menuItems, function( index ) {\n\t\t\t\tmenuItems[index].close();\n\t\t\t});\n\t\t}", "function closePopups() {\n locations.forEach(location => {\n location.marker.getPopup().remove()\n })\n}", "closeAll() {\n this._openCloseAll(false);\n }", "function forcedClose_p () {\n// --------------------------------------------------------\n window_o.close(true);\n}", "function destroyInfoBox() {\n\t\tsvg.selectAll(\".popup\").remove()\n\t}", "closeInfoWindow() {\n this.state.infoWindow.close()\n }", "closeAllEntries() {\n for(var entryIndex in entries) {\n var entry = entries[entryIndex];\n\n if(entry.isCloseable()) {\n entry.close();\n }\n }\n\n this.updateWindowHeight();\n }", "function closeDetails() {\n\n\tif (!Alloy.Globals.detailsWindow) {\n\t\treturn;\n\t}\n\n\t$.tab.closeWindow(Alloy.Globals.detailsWindow);\n\n\tAlloy.Globals.detailsWindow = null;\n}", "function clearInfo(){\n\tif (infoArray) {\n\t\tfor(var i=0;i<infoArray.length;i++){\n\t\t\tinfoArray[i].close();\n\t\t}\n\t}\n}", "function closeTooltips() {\r\n\t\t\tif (_markers && _markers.length > 0) {\r\n\t\t\t\tfor (var i = 0; i < _markers.length; i++) {\r\n\t\t\t\t\tvar current = _markers[i];\r\n\t\t\t\t\tif (current.tooltip)\r\n\t\t\t\t\t\tcurrent.tooltip.close();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t} // closeTooltips", "function remove_all_infoWindows() {\n for (var i=0 ; i<infoWindows.length ; i++) {\n infoWindows[i].setMap(null);\n }\n}", "function closeGetInfoOptions(){\n\tvar getInfoOptions = document.getElementById(\"container-options-info\");\n\tgetInfoOptions.style.display = \"none\";\n\tvar checkBoxes = document.getElementsByClassName(\"check-friend\");\n\tfor (var i = 0; i < checkBoxes.length; i++) {\n\t\tcheckBoxes[i].style.display=\"none\";\n\t}\n}", "close() {\n\n // Pop the activity from the stack\n utils.popStackActivity();\n\n // Hide the screen\n this._screen.scrollTop(0).hide();\n\n // Hide the content behind the placeholders\n $(\"#page--info .ph-hidden-content\").hide();\n\n // Stop the placeholders animation\n this._placeholders.removeClass(\"ph-animate\").show();\n\n // Hide the delete button\n $(\"#info-delete\").hide();\n\n // Hide the info button\n $(\"#info-edit\").hide();\n\n // Show all the fields\n $(\".info-block\").show();\n\n // Delete the content of each of the fields\n $(\"#info-createdAt .info-content\").html(\"\");\n $(\"#info-updatedAt .info-content\").html(\"\");\n $(\"#info-coordinates .info-content\").html(\"\");\n $(\"#info-coordinatesAccuracy .info-content\").html(\"\");\n $(\"#info-altitude .info-content\").html(\"\");\n $(\"#info-altitudeAccuracy .info-content\").html(\"\");\n $(\"#info-type .info-content\").html(\"\");\n $(\"#info-materialType .info-content\").html(\"\");\n $(\"#info-hillPosition .info-content\").html(\"\");\n $(\"#info-water .info-content\").html(\"\");\n $(\"#info-vegetation .info-content\").html(\"\");\n $(\"#info-mitigation .info-content\").html(\"\");\n $(\"#info-mitigationsList .info-content\").html(\"\");\n $(\"#info-monitoring .info-content\").html(\"\");\n $(\"#info-monitoringList .info-content\").html(\"\");\n $(\"#info-damages .info-content\").html(\"\");\n $(\"#info-damagesList .info-content\").html(\"\");\n $(\"#info-notes .info-content\").html(\"\");\n\n // Show the image placeholder\n $(\"#info-photo-preview\").attr(\"src\", \"img/no-img-placeholder-200.png\");\n\n }", "function closeApp(){\n\tfor(var i=windows.length-1;i>=0;i--){\n\t\twindows[i].close();\n\t}\n\twindows = [];\n}", "function closeHintWindow(){\n\t\t$('#hint_set').hide();\n }", "function closeallmenus() {\n\t\tif (active_tabcontent != null) {\n\t\t\tblocknone(active_tabcontent,active_tab1,'none','#000000','#ABCDEF','pointer');\n\t\t}\n\t}", "function onClose() {\r\n window.close();\r\n}", "function closeWindow(){\n/* 603 */ \t\tvar windowId = MochaUI.getFrameWindowId();\n/* 604 */ \t\tparent.MochaUI.closeWindow(parent.$(windowId));\n/* 605 */ \t}", "_closeAll() {\n this._closeItems();\n this._toggleShowMore(false);\n }", "function clearEventSpecificInfo() {\n\twindow.location.hash = '';\n\tdocument.title = 'Events around you - Furlango';\n\tif (currentInfoWindow) { // defined in watodoo.js\n\t\tcurrentInfoWindow.close();\n\t}\n}", "function closeWindow(){\n $(document).ready(function(){\n $(\".close,.close2,.close3,.close4,.close5,.close6,.close7,.close8,.close9\").click(function(){\n $(\".bg-model,.bg-model2,.bg-model3,.bg-model4,.bg-model5,.bg-model6,.bg-model7,.bg-model8\").css('display', 'none');\n })\n })\n }", "function adjustInfoWindowContent_closeclick(oInfoWindow)\r\n{\r\n\r\n\t//document.getElementById(\"editorContent\").style.height = \"90px\";\r\n\tvar eUL_Tabs;\r\n\tif(NSGlobal.bIE)\r\n\t{\r\n\t\teUL_Tabs = NSFunctions.getElementsByName('tabs_ul_windowGUID_' + oInfoWindow.get(\"id\"))[0];\r\n\r\n\t}\r\n\telse\r\n\t{\r\n\t\teUL_Tabs = document.getElementsByName('tabs_ul_windowGUID_' + oInfoWindow.get(\"id\"))[0];\r\n\t}\r\n\r\n\tif(NSGlobal.bFireFox)\r\n\t{\r\n\t\tif(eUL_Tabs)\r\n\t\t{\r\n\t\t\teUL_Tabs.style.width = \"\";\r\n\t\t}\r\n\t}\r\n\r\n\treturn;\r\n\r\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "function closeAll() {\n\tdocument.getElementsByClassName(\"fst_container\")[0].remove();\n\twindow.location.reload();\n}", "function closeAllMenus() {\r\n hideOverlay();\r\n closeMobileCart();\r\n closeMobileCustomerMenu();\r\n closeMobileMainMenu();\r\n closeFilterMenu();\r\n}", "function closeAllPopups() {\nmap.eachLayer(function (layer) {\n layer.closePopup();\n});}", "function SRC_closeWindowOpener()\r\n{\r\n\tif (confirm(\"This Resource Search window can no longer access the HTML editor\\r\\n\\r\\n\"\r\n\t\t\t+ \" Close the search window?\"))\r\n {\r\n window.close();\r\n }\r\n}", "function CloseDesc() {\n detailContainer.animate({\n left: \"-100%\",\n }, 500, function() {\n detailContainer.css(\"display\", \"none\");\n });\n placesList.css(\"display\", \"block\");\n infoWindowArray[focusMarker].close();\n map.fitBounds(bounds);\n map.panTo(bounds);\n\n}", "function exit () {\n windowStack.forEach(function(window){\n window.hide();\n });\n}", "function showClickWindow() {\n $(\"#tipWindow\").show();\n $(\"#tipWindow\").find(\".f-close\").click(function(){\n $('#tipWindow').hide();\n });\n}", "function closePopups() {\n timeBox = $(\"#time-box\");\n $(\".backdrop\").css(\"display\", \"none\");\n $(\"#info-box\").css(\"display\", \"none\");\n $(\"#host-box\").css(\"display\", \"none\");\n $(\"#round-end-box\").css(\"display\", \"none\");\n }", "function window_close() {\n window.close()\n}", "function closeWindow() {\r\n window.close();\r\n }", "function closeSpecialInstructions(){\n\t$('#container').css('z-index', '10');\n\t$('#overlay').hide();\n\t$('#special-instructions').html('');\n}", "function closeAll() {\n $scope.closeMenu();\n document.activeElement.blur();\n $scope.ib.close();\n var listBox = document.getElementById(\"floating-panel\");\n while (listBox.firstChild) {\n listBox.removeChild(listBox.firstChild);\n }\n listBox.className = \"hidden\";\n $scope.closeWndr();\n }", "function Popups_CloseAll(bForced)\n{\n\t//interactions blocked? unless this is forced\n\tif (__SIMULATOR.UserInteractionBlocked() && !bForced)\n\t{\n\t\t//ignore it\n\t}\n\telse\n\t{\n\t\t//while we have popups\n\t\twhile (this.PopupData.length > 0)\n\t\t{\n\t\t\t//close the last popup\n\t\t\tthis.CloseLast(bForced);\n\t\t}\n\t\t//inform the Simulator that we just trigger the close all mini event\n\t\t__SIMULATOR.NotifyMiniAction(__MINIACTION_EVENT_POPUP_DESTROY);\n\t}\n}", "function closeNoChanges() {\r\n\t//check that parent is still open\r\n\tif (window.opener && !window.opener.closed){\t\t\r\n\t\twindow.opener.focus();\r\n\t}\r\n\twindow.close();\r\n}", "function closeAllMenus(){\n closeMenu(\"divMenuHelp\");\n closeMenu(\"divMenuOpt\");\n closeMenu(\"divMenuGame\"); }", "function closeWindow() {\n\t\twin.close();\n\t}", "function closeWindow() {\n\t\twin.close();\n\t}", "_handleCloseClick() {\n\t\tthis.close();\n\t}", "function overrideBubbleCloseClick() {\n infoBubble.close();\n return false;\n}", "function closeList() {\n\tif (iPopupOpen) {\n\t\tofVBAISpan.style.display=\"none\";\n\t\tiPopupOpen=false;\n\t\t}\n\t}", "function close_it( )\n{\n\twindow.close();\n\treturn false;\n}", "function cerrar() {\twindow.close(); }", "function close_setting_page()\r\n{\r\n\tchrome.tabs.query({url:chrome.extension.getURL('info.html')}, function(tabs){\r\n\t\tif(tabs != null) {\r\n\t\t\tfor(var tab in tabs)\r\n\t\t\t{\r\n\t\t\t\tchrome.tabs.remove(tabs[tab].id);\r\n\t\t\t\tprint_msg(\"remove info.html\"+tabs[tab].id);\r\n\t\t\t}\r\n\t\t}\t\r\n\t});\r\n}", "function slide_closeMsgBox() {\n slide_hideExifInfos();\n slide_hideOptions();\n slide_hideHelp();\n slide_addBinds();\n return true;\n}", "closeInfoWindow() {\n if (this.state.prevmarker) {\n this.state.prevmarker.setAnimation(null);\n }\n this.setState({\n 'prevmarker': ''\n });\n this.state.infowindow.close();\n }", "closeInfoWindow() {\n if (this.state.prevmarker) {\n this.state.prevmarker.setAnimation(null);\n }\n this.setState({\n 'prevmarker': ''\n });\n this.state.infowindow.close();\n }", "function closeAll() {\n $(\".tap-target\").tapTarget(\"close\");\n $(\".tap-target\").tapTarget(\"destroy\");\n}", "closeAll() {\n this.modalControl.closeAll();\n }", "function close_window() {\n window.close();\n}", "function displayInfoboxClose(e) {\n if (e.targetType == 'pushpin') {\n infobox.setLocation(e.target.getLocation());\n infobox.setOptions({ visible: false});\n }\n }", "close(){\n isfull = false;\n myWindow.close();\n return \"bye\";\n }", "close(){\n isfull = false;\n myWindow.close();\n return \"bye\";\n }", "hideWindow() {\n\t\tfinsembleWindow.hide();\n\t}", "function hidePopups() {\n if (infoPopupActive) {\n $('.info-popup').remove();\n infoPopupActive = false;\n }\n}", "function close_window() {\n\tnewwindow.close();\n}", "function close() {\n\t'use strict';\n\n\t// close the window, showing the master window behind it\n\t$.win.close();\n}", "function closeThisWindow() {\n window.open('', '_self').close();\n}" ]
[ "0.86925125", "0.8564588", "0.8192397", "0.8017867", "0.7920798", "0.7836474", "0.7820995", "0.7799062", "0.7748041", "0.76991296", "0.76485234", "0.7517645", "0.74641776", "0.7372011", "0.735043", "0.735043", "0.735043", "0.735043", "0.7267257", "0.7200919", "0.7182884", "0.71461064", "0.7023834", "0.7018701", "0.6997402", "0.6954088", "0.6937196", "0.69045323", "0.6873439", "0.6873439", "0.6873439", "0.6806303", "0.679225", "0.67735434", "0.6769112", "0.67668843", "0.676559", "0.6756768", "0.6737542", "0.6729617", "0.66994685", "0.6690018", "0.66838187", "0.6680279", "0.66762066", "0.667052", "0.6663168", "0.6657237", "0.6651141", "0.6648889", "0.66413224", "0.66385615", "0.6633489", "0.66313726", "0.6585515", "0.6582109", "0.6575108", "0.65731454", "0.6568142", "0.65325266", "0.65275913", "0.65275913", "0.65275913", "0.65275913", "0.65275675", "0.6520659", "0.65201265", "0.64993376", "0.64847213", "0.6472316", "0.6467701", "0.6467534", "0.6467232", "0.6454485", "0.64509743", "0.6438578", "0.6437622", "0.6433852", "0.64304537", "0.64304537", "0.64240944", "0.6418923", "0.6418912", "0.639232", "0.6385409", "0.63820976", "0.63774776", "0.63573", "0.63573", "0.6354091", "0.63513386", "0.6351283", "0.63205236", "0.6304963", "0.6304963", "0.6303001", "0.629942", "0.62961197", "0.6289409", "0.62824" ]
0.68234515
31
handles async use of data
async function getFloatData(name) { clearMarkers(); let url; if (name === "all") { url = "https://geoweb.princeton.edu/people/simons/SOM/all.txt"; } else { url = "https://geoweb.princeton.edu/people/simons/SOM/" + name + showTail; } let dataPromise = fetchAndDecodeFloatData(url, 'text'); let values = await Promise.all([dataPromise]); return values[0]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "completed(data) {}", "function syncData() {}", "async processData(type, data) {\n const payload = {\n type, data\n }\n console.log(\"Calling handleData from cloudUser...\")\n return await handleData(payload)\n }", "async function StoredDataGetter(){\n\n return await updated_data;\n\n}", "onData(data) {\n let done = false;\n if (data.progress) {\n this.onProgress(this.progressBarElement, this.progressBarMessageElement, data.progress);\n }\n if (data.complete === true) {\n done = true;\n if (data.success === true) {\n this.onSuccess(this.progressBarElement, this.progressBarMessageElement, this.getMessageDetails(data.result));\n } else if (data.success === false) {\n this.onTaskError(this.progressBarElement, this.progressBarMessageElement, this.getMessageDetails(data.result));\n } else {\n done = undefined;\n this.onDataError(this.progressBarElement, this.progressBarMessageElement, \"Data Error\");\n }\n if (data.hasOwnProperty('result')) {\n this.onResult(this.resultElement, data.result);\n }\n } else if (data.complete === undefined) {\n done = undefined;\n this.onDataError(this.progressBarElement, this.progressBarMessageElement, \"Data Error\");\n }\n return done;\n }", "function asyncGetTempData(){\n //should I overwrite with the new(and old) data,(takes longer, simple)\n //check the database and only get then upload new data,(more complicated, no needless data retrieval)\n //or temp download all data and then check and upload new data?(might be easier to check database after getting the data)\n //There is also SQL online that will transfer directly from the FTP server to MySQL,\n //but it is beyond my level of knowledge and would have to just copy the code.\n}", "async loadData() {\n if (!this.load_data) throw new Error('no load data callback provided');\n\n return await Q.nfcall(this.load_data);\n }", "async processData() {\n this.dataProcessors += 1\n const dataEntity = this.dequeueDataEntity()\n dataEntity.attempts += 1\n const { success } = await dataEntity.dataProcessor.run(dataEntity.data)\n if (!success) {\n /* handle failed result */\n }\n this.dataProcessors -= 1\n }", "async function handle_data (connection, team_number, event_code, match_types) {\n await get_data(connection, team_number, event_code, match_types)\n\t.then(data => print_data(data))\n\t.then(() => connection.end())\n\t.catch((err) => console.error(err));\n}", "async function loadData() {\n console.log('loadData() called');\n await downloadFromServer();\n console.log('Downloaded data from server');\n messages = JSON.parse(backend.getItem('message')) || [];\n // users = JSON.parse(backend.getItem('user_img')) || [];\n\n\n}", "_doFetch() {\n\t\tthis.emit(\"needs_data\", this);\n\t}", "async myTask(data, msg, conn, ch, db) {\n\n\t\ttry\n\t\t{\n\t\t\tif (!data.authToken || !data.authToken.id || !data.authToken.app) {\n\t\t\t\tthrow Error(\"Must include authorization\");\n\t\t\t}\n\n\t\t\tif (!data.authToken.admin) {\n\t\t\t\tdata.filters.app = data.authToken.app;\n\t\t\t\tdata.filters.user_id = data.authToken.id;\n\t\t\t}\n\n\t\t\tlet rows = await DataRepository.drill_completionSummary(data, db);\n\n\t\t\t//console.log(` [x] Wrote ${JSON.stringify(rows)} to ${this.DbName + \".\" + c}`);\n\n\t\t\tch.ack(msg);\n\n\t\t\treturn rows;\n\t\t} catch (ex) {\n\t\t\tthis.logError(data, msg, ex);\n\t\t\tch.ack(msg);\n\t\t}\n\t}", "AsyncProcessResponse() {\n\n }", "function waitForData(){\n if(data.fetching){\n setTimeout(waitForData, 10);\n } else {\n callback(data);\n }\n }", "async function fetcher() {\n let data = {};\n try {\n data = await query()\n }\n catch (error) {\n setError(error)\n return\n }\n console.log(\"DATAAA\", data)\n setLoading(false)\n setData(data)\n setDone(true)\n }", "function dataLoaded(err,data,m){\n}", "function loadData(data) {\r\n // returns a promise\r\n }", "function getAsync(data) {\n\tconsole.log('Request received: ' + data);\n\n\treturn new Promise(function(resolve, reject) {\n\t\tsetTimeout(function() {\n\t\t\tconsole.log('Resolved: ' + data);\n\t\t\tresolve(data + '');\n\t\t}, (Math.floor(Math.random() * 4) + 1) * 2000);\n\t})\n}", "async method(){}", "async getUserData() { }", "makeData (callback) {\n\t\tBoundAsync.series(this, [\n\t\t\tthis.adjustMarkers,\t\t\t// adjust those markers for a different commit\n\t\t\tthis.setData\t\t\t\t// set the data to be used in the request that will result in a message sent\n\t\t], callback);\n\t}", "_handleData() {\n // Pull out what we need from props\n const {\n _data,\n _dataOptions = {},\n } = this.props;\n\n // Pull out what we need from context\n const {\n settings = {},\n } = this.context;\n\n // Pull the 'getData' method that all modules which need data fetching\n // must implement\n const {\n getData = (() => Promise.resolve({ crap: 5 })),\n } = this.constructor;\n\n /**\n * Check if data was loaded server-side.\n * If not - we fetch the data client-side\n * and update the state\n *\n * We'll also add add the global settings to\n * the request implicitely\n */\n if (!_data) {\n getData(Object.assign({}, { __settings: settings }, _dataOptions))\n .then(_data => this.setState({ ['__data']: _data }))\n .catch(_data => this.setState({ ['__error']: _data }));\n }\n }", "async readWait() {\n this.notifyFromServer('onread', { data: this.data });\n return this.data;\n }", "async connectedCallback() {\n let request = new XMLHttpRequest();\n request.open('GET', jsonData, false);\n request.send(null);\n this.data = JSON.parse(request.responseText);\n // turns out that github does not provide \n // unauthenticated access to public repos over rest\n // Thank you github. Hence cannot fatch Data using the Fetch API \n //const data = await fetchDataHelper({ amountOfRecords: 100 });\n //this.data = data;\n this.calculateData();\n }", "loadingData() {}", "loadingData() {}", "function getData (cb) {\n let url = known_data_instances[Math.floor(Math.random() * known_data_instances.length)]\n\n console.log(url)\n // Do something with the requests\n // request(url, {json: true}, (err, res, data) => {\n // if (err) return cb(err)\n\n // cb(null, data)\n // })\n}", "function on_data(data)\n{\n //wj(\"web_face:on_data: got data response from web_data q\", data);\n\n job = jobs[data.job.jobid];\n if (!job)\n {\n w.warn(\"web_face: IGNORING UNKNOWN jobid=\"+data.job.jobid);\n return;\n }\n\n var resp = {\"info\":null, \"data\":null};\n resp.data = data.results;\n\n var info = job.qry;\n info.tsdone = Date.now();\n info.millis = info.tsdone - info.tsstart;\n info.ncount = data.results.length;\n resp.info = info;\n\n w.info(\"web_face:on_data: response took \"+ info.millis+\" ms\");\n\n res = job.res;\n res.writeHead(200, {'Content-Type': 'application/json'});\n res.write(JSON.stringify(resp,null,4));\n res.write('\\n');\n res.end();\n\n delete jobs[data.job.jobid];\n}", "async function retreiveData() {\n data = await getPost();\n }", "function get_data() {}", "function async_io_normal(cb) {\n\n}", "async onFinished() {}", "async function getData() {\n header(); // calling header function\n const data = await get();\n display(data); // calling display function and pasing data to that function\n footer(); // calling footer function\n console.log(data);\n}", "async function getDataAsync() {\n try {\n let data = getSomeData();\n return data;\n } catch (e) {\n throw e;\n }\n}", "_readProductsDataFromStorage() {\n $.ajax({\n url : \"json/storage.json\",\n async : false\n })\n .done((data) => { \n this.data = data;\n })\n .fail(() => { \n throw new Error('Error reading storage'); \n });\n }", "requestRemoteData(handler) {\n }", "onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }", "onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }", "onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }", "async function getData() {\n let data = await getUsername1()\n data = await getAge1(data)\n data = await getDepartment1(data)\n data = await printDetails1(data)\n}", "function updateData() {\n\t/*\n\t* TODO: Fetch data\n\t*/\n}", "function get_data_loop()\r\n{\r\n if(!ansvers){\r\n \tget_data();\r\n \tansvers = 1;\r\n }\r\n \tsetTimeout(\"get_data_loop()\",10000);\r\n}", "function requestData() {\n firstDataPass = true;\n __notifySubscribersForNewDataCache(firstDataValues);\n firstDataValues = [];\n }", "async loadData() {\n this.setState({\n data: await get()\n })\n }", "function loadAPIConnectionDataAsync( ) {\n\n\t// create promise\n\tvar lacdaEmitter = new EventEmitter( 'loadAPIConnectionDataAsyncEnded' );\n\n\tStorage.read( at_file ).\n\t\tthen(\n\n\t\t\t// success\n\t\t\tfunction( data ) {\n\n\t\t\t\tdata = JSON.parse( data );\n\n\t\t\t\tif ( ( 'undefined' !== data.token ) && ( 'undefined' !== data.baseurl ) ) {\n\n\t\t\t\t\tAccessToken = data.token;\n\t\t\t\t\tBASE_URL = data.baseurl;\n\n\t\t\t\t\tlacdaEmitter.emit( 'loadAPIConnectionDataAsyncEnded', 'ok' );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tlacdaEmitter.emit( 'loadAPIConnectionDataAsyncEnded', 'API connection data not correctly read from storage.' );\n\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t// error reading file data\n\t\t\tfunction( error ) {\n\t\t\t\tlacdaEmitter.emit( 'loadAPIConnectionDataAsyncEnded', 'error ' + JSON.stringify( error ) );\n\t\t\t}\n\n\t);\n\n\treturn lacdaEmitter.promiseOf( 'loadAPIConnectionDataAsyncEnded' );\n\n}", "do(func) {\n return async && data instanceof Promise\n ? using(data.then(func), async)\n : using(func(data), async)\n }", "function handleData(stateObj, err, data) {\n var hash = stateObj.hash;\n\n // Assume this must be a connection error, not positive that's only case though (TODO)\n if (err) this.setState({ error: err });\n\n // else if no data received from getTransaction, if the txObj exists remove tx from its current state and callback the txObj that failed\n else if (!data || !data.hash) {\n\n // if txinfo exists for this, yet it failed\n if (hash in this.state.info) {\n // stateObj.type _could_ be overwritten here by state.info[hash].type...\n if (stateObj.hasOwnProperty(\"type\")) this.setState({ accounts: this.delTxState(this.state.accounts, stateObj, false) }); // saved to ls after loadTxData completes\n errors.push(_.merge(stateObj, this.state.info[hash]));\n delete this.state.info[hash];\n this.setState({ info: this.state.info });\n } else errors.push(stateObj); // if txinfo doesn't exist, why are we looking at this?\n\n // else data was received\n } else {\n\n // If unseen by objects (first tx data found for hash), add tx state to pending\n data.hash = utils.formatHex(data.hash);\n if (!(data.hash in this.state.objects)) {\n this.setState({ accounts: this.addTxState(this.state.accounts, {\n hash: data.hash,\n account: data.from,\n type: \"pending\",\n nonce: data.nonce\n }, false) });\n }\n\n this.setState({ objects: _.set(this.state.objects, data.hash, data) });\n }\n\n if (++dataCount == txs.length * methods.length && typeof callback === \"function\") callback(errors.length ? errors : null);\n }", "function rawData() {\n if(request.readyState == 4 && request.status == 200) {\n const data = JSON.parse(request.responseText);\n resolve(data);\n } else if(request.readyState == 4) {\n reject(\"Data error: Unable to fetch data\");\n }\n }", "async function getData() {\n const location = document.getElementById('location').value;\n\n getGeoData(location)\n .then(function(data) {\n postData({\n latitude: data.geonames[0].lat,\n longitude: data.geonames[0].lng\n });\n getCoordinates()\n .then(function(localData) {\n callWeather(localData)\n .then(function(newData) { \n postWeather({\n day1: newData.data[1],\n day2: newData.data[2],\n day3: newData.data[3],\n day4: newData.data[4],\n day5: newData.data[5],\n day6: newData.data[6],\n day7: newData.data[7],\n day8: newData.data[8],\n day9: newData.data[9],\n day10: newData.data[10],\n day11: newData.data[11],\n day12: newData.data[12],\n day13: newData.data[13],\n day14: newData.data[14],\n });\n getPix(location)\n .then(function(pixData) {\n postPix({\n picture: pixData.hits[0]\n });\n updateUI(location);\n });\n });\n }); \n });\n}", "handleDataSuccess() {\n\t\tthis.setState( {\n\t\t\treceivingData: true,\n\t\t\tloading: false,\n\t\t} );\n\t}", "getData(cb){\n\t\tlet promArray = [];\n\t\tthis.allUserNames.map((userName)=>{\n\t\t\tpromArray.push(fetch(`https://api.github.com/users/${userName}`).then(res=>res.json()))\n\t\t})\n\n\t\tPromise.all(promArray)\n\t\t\t.then(data => {\n\t\t \t\t// do something with the data\n\t\t \t\t cb(data);\n\t\t\t})\n\n\t}", "function on_data(data) {\n data_cache[key] = data;\n placeholder.update();\n }", "onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }", "async function asyncWrapperFunction() {\r\n await htmlRouting();\r\n await videoRouting();\r\n const data = await dataProcessing();\r\n const nodes = await nodesGetting();\r\n dynamic(data,nodes);\r\n display(data,nodes);\r\n}", "async function receber() {\n setLoading(true)\n try {\n const response_get = await api.get('/api/bot')\n const data = response_get.data\n setTask(data)\n // setBotID(tasks) \n console.log(data);\n setLoading(false)\n } catch (error) {\n console.log(error)\n }\n}", "function exchangeData() {\n\n // is this ccm.load call already waiting for currently loading resource(s)? => skip data exchange\n if ( waiting ) return;\n\n // is cross domain request? => use JSONP\n if ( url.indexOf( 'http' ) === 0 ) {\n\n jQuery.ajax( {\n\n url: url,\n data: data,\n dataType: 'jsonp',\n username: data && data.username ? data.username : undefined,\n password: data && data.password ? data.password : undefined,\n success: successData\n\n } );\n\n }\n\n // inner domain request => normal HTTP GET request\n else {\n\n jQuery.ajax( {\n\n url: url,\n data: data,\n username: data && data.username ? data.username : undefined,\n password: data && data.password ? data.password : undefined,\n success: successData\n\n } ).fail( onFail );\n\n }\n\n }", "onResponseProcessed(data, resolve) {\n // if stop progress true, the cleanup already has been performed\n if (this.stopProgress) {\n return;\n }\n /*\n * normal case, cleanup == next item if possible\n */\n resolve(data);\n }", "function getData() {\n\n\tuserIDHash = getuserIDHash();\n\n\tif(streamName != '') {\n\t\tif(!userIDHash) { // no userIDHash means first run\n\t\t\tinsertFirstRunMessage();\n\t\t\tbindFistRun();\n\t\t} else {\n\t\t\t// no error callback allowed due to cross domain\n\t\t\t// so, if all data isn't gathered within 10 seconds\n\t\t\t// then self detruct \n\t\t\tvar serverTimeout = setTimeout(function(){\n\t\t\t\tdataFailure('init');\n\t\t\t}, 10000);\n\n\t\t\t// first get communityTags\t\n\t\t\t$.ajax({\n\t\t\t\turl: tkServerHREF + 'read.php?function=communityTags&streamName=' + streamName,\n\t\t\t\tcache: false,\n\t\t\t\tdataType: 'text',\n\t\t\t\tsuccess: function(response) {\n\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\tconvertLocalCommunityTags(response);\n\t\t\t\t\t// next get userTags\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\turl: tkServerHREF + 'read.php?function=userTags&streamName=' + streamName + '&userIDHash=' + userIDHash,\n\t\t\t\t\t\tcache: false,\n\t\t\t\t\t\tdataType: 'text',\n\t\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\t\t\tconvertLocalUserTags(response);\n\t\t\t\t\t\t\t// next get searchTags\n\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\turl: tkServerHREF + 'read.php?function=searchTags',\n\t\t\t\t\t\t\t\tcache: false,\n\t\t\t\t\t\t\t\tdataType: 'text',\n\t\t\t\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\t\t\t\t\tconvertLocalSearchTags(response);\n\t\t\t\t\t\t\t\t\t// next get stats\n\t\t\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\t\turl: tkServerHREF + 'read.php?function=tagStats&userIDHash=' + userIDHash,\n\t\t\t\t\t\t\t\t\t\tcache: false,\n\t\t\t\t\t\t\t\t\t\tdataType: 'text',\n\t\t\t\t\t\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\t\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\t\t\t\t\t\t\tclearTimeout(serverTimeout);\n\t\t\t\t\t\t\t\t\t\t\tconvertLocalTagStats(response);\n\t\t\t\t\t\t\t\t\t\t\t// got all data, now start\n\t\t\t\t\t\t\t\t\t\t\tafterData();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t} // not a stream so do nothing\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 }", "onData(data) {\n this.emit(\"data\", data);\n this.onSuccess();\n }", "async processFile(hndl) {\n }", "async processFile(hndl) {\n }", "function handleData(data, fromIdle) {\n var songinfo = false;\n var dat = {};\n\n var command;\n var args;\n if(fromIdle) {\n command = \"idle\";\n } else {\n command = lastCommand.shift();\n args = lastArguments.shift();\n }\n\n // We got some songinfo (from 'playlistinfo' command or similar)\n var songInfoCommands = [ \"playlistinfo\", \"search\" ];\n if(songInfoCommands.indexOf(command) != -1) {\n songinfo = true;\n dat.songinfo = [];\n }\n\n var lines = data.split(\"\\n\");\n lines.forEach(function(e) {\n if(e != \"OK\" && e != '') {\n d = e.split(\": \");\n key = d[0];\n value = d[1];\n if(songinfo) {\n var l = dat.songinfo.length || 1;\n if(key == \"file\") {\n // Be sure to send every 6 entries. Easier to handle then a load of data.\n // TODO: test this against a playlist of 2000 or more entries.\n if(l > 5) {\n var d = {};\n d[command] = dat;\n d[command]._arguments = args;\n send(d);\n dat.songinfo = [];\n }\n dat.songinfo.push({file: value});\n\n } else {\n dat.songinfo[l-1][key] = value;\n }\n } else {\n dat[key] = value;\n }\n }\n });\n var d = {};\n d[command] = dat;\n d[command]._arguments = args;\n send(d);\n }", "_get(callback, data, id) {\n let err = null; //placeholder for real calls\n //call API - for this example fake an async call with setTimeout\n setTimeout( () => {\n //set the response in the cache - cache exists across\n //multiple calls and this solves a problem with having\n //to make a state existence check in componentWillMount\n let dataToCache = data;\n if (err) {\n dataToCache = err;\n }\n cache.add(id, dataToCache);\n return callback(err, {result: dataToCache, id: id});\n }, 200);\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 }", "gotInfo (err, data, cb) {\n if (err) return cb(err)\n if (!data) data = []\n\n const lastUpdate = Date.now() / 1000\n\n // refill our instances cache\n for (let datum of data) {\n const id = datum.meta.id\n const found = this.instances.has(id)\n const instance = found ? this.instances.get(id) : {}\n\n instance.lastUpdate = lastUpdate\n\n if (found) continue\n\n instance.app = util.normalizeName(datum.meta.app)\n\n let tags = datum.reply.tags || []\n tags = tags.map(tag => util.normalizeName(tag))\n instance.tags = tags.join(',')\n\n this.instances.set(id, instance)\n }\n\n cb(null, data)\n }", "async function getData() {\n await fetchingData(\n endP({ courseId }).getCourse,\n setCourse,\n setIsFetching\n );\n\n await fetchingData(\n endP({ courseId }).getGroups,\n setGroups,\n setIsFetching\n );\n }", "function returnHandler(data){\n allHandle(data);\n }", "function asynch_func() {\n // console.log(req.responseText)\n if (req.status >= 200 && req.status < 400) {\n let res_JSON = JSON.parse(req.responseText);\n console.log(res_JSON.args);\n res_span.textContent = \"(*For Grader this message will dissapear in 10 sec) The response we got from our GET Request from https://httpbin.org/get is: \" + JSON.stringify(res_JSON.args)\n } else {\n console.log(\"Error: \" + req.statusText);\n res_span.textContent = req.statusText;\n }\n }", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\t\t\tupdateCallback(newData);\n\t\t}", "whileLoading(data) {\n const position = data.secondsLoaded / data.duration\n this.updateLoadingProgressElement(position)\n if (typeof this.whileLoadingCallback === \"function\") {\n this.whileLoadingCallback(data)\n }\n this.log(\"track:whileLoading\", data)\n }", "async function awaitData(cl, ct){\n var data = await Promise.all([getHealthIndex(cl), getVolume(cl), getCurrentPrice(cl)]);\n if(!!data){\n setCryptoCard(ct, cl, data);\n \n return;\n }\n return data;\n}", "async function getDataAndDoSomethingAsync() {\n try {\n let data = await getDataAsync();\n doSomethingHere(data);\n } catch (error) {\n throw error;\n }\n}", "get data () {return this._data;}", "async function getData (url){ //aca getData nos esta devolviendo una promesa porque hace await \n const response = await fetch(url);\n const data = await response.json()\n return data;\n}", "function getData(callback) {\n console.log('AWS done triggered');\n doneCalled = true;\n trigger_upload();\n callback('NA');\n }", "function getDataAndDoSomethingAsync() {\n getDataAsync()\n .then((data) => {\n doSomethingHere(data);\n })\n .catch((error) => {\n throw error;\n });\n}", "async function getData() {\n try {\n const jsonValue = await AsyncStorage.getItem('@storage_Key')\n const res = jsonValue != null ? JSON.parse(jsonValue) : null;\n workDispatch({ type: \"userData\", payload: res })\n // console.log(\"res\", res);\n } catch (e) {\n // error reading value\n console.log(\"Error Home\", e);\n }\n }", "async setData(url) {\n try {\n const _fetchedData = await this.fetchData(url);\n this.data = _fetchedData;\n const _fetchHumans = await this.data.people.map(person => this.fetchData(person));\n const _resolveHumans = await Promise.all(_fetchHumans)\n return _resolveHumans;\n\n } catch (error){\n console.log(error);\n return error;\n }\n }", "function callback(response, status, jqXHRobject){\n //tasks using the data go here\n var mydata = response;\n console.log(response);\n nextFunction(mydata);\n}", "async componentDidMount() {\n return await this.getData()\n }", "async function getData(uniqueArtist) { \n try {\n let response = await axios.get(`${url}${uniqueArtist}`) \n let data = response.data.artists[0] \n removeWallpaper()\n removeDetails()\n removeBio()\n artistWallpaper(data)\n artistDetails(data)\n artistBio(data)\n } catch (error) {\n console.log('Oh, no! There seems to be an issue. Please try again later.')\n }\n}", "function handleDataReturn(data,e) {\n if (!stat.isSuccessfull(e)) {\n var err=new stat.states.items.INVALID_ITEM_FILE({\n description:\"loading item data\",\n parseStr:cache[c][1],\n name:item,\n id:id,\n parseData:parseData,\n error:{\n errorObj:e,\n msg:e.message\n }\n });\n accept(id,null,err);\n return;\n } else {\n itemAddData=data;\n loadWithData();\n }\n }", "async function asyncFn() {\n return value;\n }", "async function asyncFn() {\n return value;\n }", "async function doSomeDataFetching() {\n Timeout.set(2000)\n \n // Getting back data from the net, through the wire, air, and the ocean:\n const res = await axios.get(\"https://jsonplaceholder.typicode.com/posts?_limit=5\");\n \n console.log(\"Got back:\", res.data);\n setArticles(res.data);\n }", "static async method(){}", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\n\t\t\t// I'm calling updateCallback to tell it I've got new data for it to munch on.\n\t\t\tupdateCallback(newData);\n\t\t}", "async function awaitFetchData() {\n let returnedData = await fetchData();\n console.log(returnedData);\n}", "async getDataFromServer()\n {\n throw Error(\"Cannot call this function from a base class\");\n }", "function queueData() {\n\n queue()\n //.defer(d3.csv, 'data/merged7daysSinglePoints.csv', parse)\n .defer(d3.csv, 'data/merged7days.csv', parse)\n //.defer(d3.csv,'data/Merge3.csv',parse)\n .await(dataLoaded);\n}", "getData(context, callback) {\n this.initialize().then(() => {\n // Build list of read commands\n let list = [];\n if (context.userId) {\n if (context.persistUserData) {\n // Read userData\n list.push({\n id: this.getUserDataId(context),\n field: Fields.userData,\n });\n }\n if (context.conversationId) {\n // Read privateConversationData\n list.push({\n id: this.getPrivateConversationDataId(context),\n field: Fields.privateConversationData,\n });\n }\n }\n if (context.persistConversationData && context.conversationId) {\n // Read conversationData\n list.push({\n id: this.getConversationDataId(context),\n field: Fields.conversationData,\n });\n }\n // Execute reads in parallel\n let data = {};\n async.each(list, (entry, cb) => {\n let filter = { \"_id\": entry.id };\n this.botStateCollection.findOne(filter, (error, entity) => {\n if (!error) {\n if (entity) {\n // let botData = entity.data || {};\n let botData = entity || {};\n try {\n data[entry.field] = botData != null ? botData : null;\n }\n catch (e) {\n error = e;\n }\n cb(error);\n }\n else {\n data[entry.field] = null;\n cb(error);\n }\n }\n else {\n cb(error);\n }\n });\n }, (err) => {\n if (!err) {\n callback(null, data);\n }\n else {\n let m = err.toString();\n callback(err instanceof Error ? err : new Error(m), null);\n }\n });\n }).catch(err => callback(err, null));\n }", "connectedCallback(){\n this.fetchData();\n\n setTimeout(() => console.log('timeout', this.repoData), 2000)\n console.log('callback', this.data);\n \n }", "async function loadData() {\n //initialize() will return either\n //multiple resolved promises of AJAX calls for initializing database or\n //Already Initialized\n const result = await initialize();\n\n //if result is array we have array of resolved promises\n //which they are data which is initialized to database\n if(Array.isArray(result)) {\n //so we just display this data without making additional AJAX call to database\n displayData(result);\n return;\n }\n\n //if data is already initialized we make AJAX request to get it\n const request = {\n method: 'GET',\n headers: {\n authorization: 'Kinvey ' + authToken,\n 'Content-Type': 'application/json',\n },\n };\n\n const response = await fetch(baseUrl, request)\n .then(handler)\n .catch(console.log);\n\n displayData(response);\n}", "function retrieveData(){\ntrainsDatabase.on(\"value\", getData, error); \n}", "onData(chunk) {\n this.chunks.push(chunk);\n }", "onData(chunk) {\n this.chunks.push(chunk);\n }", "async function getData() {\n var data = await connectToDeviantArt();\n return data;\n }", "async function getData() {\n var data = await connectToDeviantArt();\n return data;\n }", "function getData() {\n StatusService.startWaiting();\n $q.all([ScenarioModelService.load(),\n ProcessService.load(),\n LciaMethodService.load(),\n FragmentFlowService.load({scenarioID: scenarioID, fragmentID: fragmentID}),\n ParamModelService.load(scenarioID)])\n .then(handleSuccess,\n StatusService.handleFailure);\n }", "function fetch_data() {\n\n function on_data_received(data) {\n\t load_data_into_table(data);\n\n if (refresh_rate != 0) {\n\t setTimeout(fetch_data, refresh_rate * 1000);\n\t }\n }\n \n $.ajax({\n url: dataurl,\n method: 'GET',\n dataType: 'json',\n success: on_data_received\n });\n }" ]
[ "0.65509397", "0.6510695", "0.6394085", "0.6382737", "0.6298544", "0.6291526", "0.6281737", "0.6232637", "0.62081504", "0.61953175", "0.6182528", "0.6177811", "0.61770225", "0.6167254", "0.61538863", "0.6141359", "0.6121726", "0.6087322", "0.6086492", "0.6065808", "0.605562", "0.6045864", "0.6012827", "0.59811926", "0.5933448", "0.5933448", "0.5916071", "0.5903684", "0.5902755", "0.5877011", "0.58737725", "0.58566856", "0.58539844", "0.5843782", "0.5830035", "0.5821031", "0.5809895", "0.5809895", "0.5809895", "0.5807493", "0.5788816", "0.5788117", "0.57781595", "0.5770218", "0.5746574", "0.5745435", "0.5744171", "0.5735823", "0.57335675", "0.5730917", "0.5729144", "0.57288396", "0.57246673", "0.57209957", "0.5717582", "0.57011586", "0.56970274", "0.5696678", "0.56905067", "0.5686367", "0.56784815", "0.56784815", "0.56749356", "0.56735635", "0.5671769", "0.56714225", "0.5663156", "0.5655492", "0.5649344", "0.56433797", "0.5639765", "0.5632623", "0.5630306", "0.56217206", "0.5618951", "0.5603521", "0.5590283", "0.5579606", "0.5577171", "0.5572927", "0.55723643", "0.5566702", "0.5560634", "0.55589575", "0.55589575", "0.55578005", "0.55526286", "0.55448574", "0.5541912", "0.55411273", "0.55399746", "0.553501", "0.5531293", "0.5528168", "0.5527575", "0.55267406", "0.55267406", "0.5524432", "0.5524432", "0.55211234", "0.5516493" ]
0.0
-1
Grab float data from distances.txt
async function grabAllData(){ let dataArr=[]; let data = await fetchAndDecodeFloatData("https://geoweb.princeton.edu/people/sk8609/DEVearthscopeoceans/data/FloatInfo/distances.txt", 'text'); tempArr = data.split('\n'); for(let i=0; i<tempArr.length;i++){ let splitArr = tempArr[i].split(' '); dataArr.push([splitArr[0], parseInt(splitArr[1]), parseInt(splitArr[2]), parseFloat(splitArr[3]), parseInt(splitArr[4])]); } return dataArr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function grabIndData(Float){\n let dataArr=[];\n let data = await fetchAndDecodeFloatData(`https://geoweb.princeton.edu/people/sk8609/DEVearthscopeoceans/data/FloatInfo/${Float}.txt`, 'text');\n tempArr = data.split('\\n');\n for(let i=0; i<tempArr.length;i++){\n let splitArr = tempArr[i].split(' ');\n dataArr.push([parseInt(splitArr[0]), parseFloat(splitArr[1]), parseInt(splitArr[2]), parseInt(splitArr[3]), parseFloat(splitArr[4]), parseInt(splitArr[5])]);\n }\n return dataArr;\n }", "async function getFloatData(name) {\n clearMarkers();\n\n let url;\n if (name === \"all\") {\n url = \"https://geoweb.princeton.edu/people/simons/SOM/all.txt\";\n } else {\n url = \"https://geoweb.princeton.edu/people/simons/SOM/\" + name + showTail;\n }\n\n let dataPromise = fetchAndDecodeFloatData(url, 'text');\n let values = await Promise.all([dataPromise]);\n return values[0];\n\n }", "function readFloat(){\n checkLen(4);\n var flt = buf.readFloatLE(pos);\n pos += 4;\n return formSinglePrecision(flt);\n }", "getPointsFromTXTData(data){\n\t\tlet lines = data.split(/\\r|\\n/); // this regex is to make sure we don't run into the windows vs mac newline issue\n\t\tlet lista = [];\n\t\tlet listb = [];\n\t\tfor(let i = 0; i < lines.length; i++){\n\t\t\tif(lines[i].length && lines[i][0] != '#'){\n\t\t\t\ttry{\n\t\t\t\t\tlet points = lines[i].split(',');\n\t\t\t\t\tlet to_a = parseFloat(points[0]);\n\t\t\t\t\tlet to_b = parseFloat(points[1]);\n\t\t\t\t\tif(to_a && to_b){\n\t\t\t\t\t\tlista.push(to_a);\n\t\t\t\t\t\tlistb.push(to_b);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch(err){\n\t\t\t\t\tconsole.log(err);\n\t\t\t\t\tconsole.log('skipped line: '+data[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.cleanDataOrdering([lista, listb]);\n\t}", "function split_and_shift_float( objline )\n {\n var vals = objline.split(\" \");\n vals.shift();\n return vals.map( function( v ) { return parseFloat(v); } );\n }", "testFileWithDenseProperData() {\n const max_distance = 100;\n const pointsWithinDistance = findPointsWithinRange('./data/proper_dense_test_data.txt', SOURCE_COORDINATES, max_distance);\n\n const expectedResult = [{ name: 'Joby Rudefort', user_id: 3 },\n { name: 'Taco Bell', user_id: 67 },\n { name: 'Dominos', user_id: 88 }];\n\n assert.deepStrictEqual(pointsWithinDistance, expectedResult, 'testFileWithDenseProperData: Function to filter points by using Haversine Distance is not giving proper results');\n console.log('testFileWithDenseProperData => Successfully Completed');\n }", "function readLocator () {\r\n orb.readLocator(function (err, data) {\r\n if (err) {\r\n console.error(\"error: \", err);\r\n readLocator();\r\n } else {\r\n console.log(data.xpos);\r\n console.log(data.ypos);\r\n var dist = Math.sqrt(Math.pow((data.xpos - x), 2) + Math.pow((data.ypos - y), 2));\r\n x = data.xpos;\r\n y = data.ypos;\r\n socket.emit('newDistanceSphero', {dist: dist});\r\n }\r\n });\r\n}", "function getNumbersFromData(data) {\n\tvar numbers = [];\n\tvar lines = data.split('\\n');\n\tfor (var l = 0; l < lines.length; l++) {\n\t\tvar nums = lines[l].split(' ');\n\t\tfor (var n = 0; n < nums.length; n++) {\n\t\t\tvar value = parseFloat(nums[n]);\n\t\t\tnumbers.push(value);\n\t\t}\n\t}\n\treturn numbers;\n}", "function distanceConversion(meters) {\n return Math.round((meters * 0.000621371) * 10) / 10;\n}", "async readfloat(pos) {\n\t\tlet readbytes = 4;\n\t\treturn this.readbin(readbytes, pos - 1, 'float');\n\t}", "function parseDistance(err, distances) {\n if (!err){\n let result = (distances.rows[0].elements[0].duration.text);\n let response = {\n text: \"The trip will take \" + result\n }\n sendMessage(sender_psid, response)\n }\n }", "testFileWithSparseProperData() {\n const max_distance = 500;\n const pointsWithinDistance = findPointsWithinRange('./data/proper_sparse_test_data.txt', SOURCE_COORDINATES, max_distance);\n\n const expectedResult = [{ name: 'Jillian Gun', user_id: 802 },\n { name: 'Zedekiah Grelik', user_id: 866 },\n { name: 'Yoshi Brownhill', user_id: 885 },\n { name: 'Curcio Manwell', user_id: 981 },\n { name: 'Saraann Hainge', user_id: 1595 }];\n\n assert.deepStrictEqual(pointsWithinDistance, expectedResult, 'testFileWithSparseProperData: Function to filter points by using Haversine Distance is not giving proper results');\n console.log('testFileWithSparseProperData => Successfully Completed');\n }", "function parser(d) { \n\td.density = parseFloat(String(d.density).replace(',','')); \n\treturn d.density\n}", "function substringEnergyToFloat(value) {\n\tif (value != null) {\n\t\tvar grab = parseFloat(\n\t\t\t\tvalue.substring(value.indexOf('=') + 1, value.indexOf('H') - 1))\n\t\t\t\t.toPrecision(12); // Energy = -5499.5123027313 Hartree\n\t\tgrab = grab * 2625.50;\n\t\tgrab = Math.round(grab * 1000000000000) / 1000000000000;\n\t}\n\treturn grab;\n}", "function getAcceleration(data) {\n let array = [];\n $.each(data, function(index, item){\n let x = 0;\n let y = 0;\n let z = 0;\n\n if(item != null) {\n let x_str = (item.split(',')[0]).substring(0);\n x = parseInt(x_str);\n let y_str = (item.split(',')[1]);\n y = parseInt(y_str);\n let z_str = (item.split(',')[2]).split('\"')[0];\n z = parseInt(z_str);\n\n let sqrt = Math.sqrt(x*x + y*y + z*z);\n array.push(sqrt);\n }\n });\n return array;\n}", "function extractXandY (line) {\n var line = line.replace(/[^0-9]/g, \" \");\n var lineSplits = line.split(\" \");\n var datas = [];\n for(var index=0; index < lineSplits.length; index++) {\n if(lineSplits[index].length != 0) {\n datas.push(parseInt(lineSplits[index]));\n }\n }\n\n return datas;\n }", "static readDistance(sketchObject, sourceDistance) {\n for (let i = 0; i < sketchObject.objects.length; i++) {\n const path = sketchObject.objects[i];\n if (path.uniqueIdentifier === sourceDistance.path) {\n let distance = new SketchDistance(\n path,\n sourceDistance.element,\n sourceDistance.element + 1\n );\n distance.offset = {\n x: sourceDistance.offset.X,\n y: sourceDistance.offset.Y\n };\n SketchUtils.copyTextAttributes(sourceDistance, distance);\n return distance;\n }\n }\n }", "function StringArrayToFloatArray( data ) {\n\tvar dataArr = [];\n\n\tfor (var i = 0; i < data.length; i++) {\n\t\tdataArr = data[i].split(\"/\");\n\n\t\tdataArr[0] = parseFloat(dataArr[0]);\n\t\t// If contains a '/', do the division and save the float into pos 0\n\t\tif (dataArr.length == 2) {\n\t\t\tdataArr[1] = parseFloat(dataArr[1]);\n\t\t\tdataArr[0] = dataArr[0] / dataArr[1];\n\t\t}\n\n\t\t// Set the correct final float value in the input array\n\t\tdata[i] = dataArr[0];\n\t}\n\n\treturn data;\n}", "function findDistances(userPoint) {\n // initialize the array of distances\n var distances = [];\n // loop through the markers finding the GPS points for each\n for (i = 0; i < markerData.length; i++) {\n var pointLat = parseFloat(markerData[i].lat);\n var pointLng = parseFloat(markerData[i].lng);\n var markerPoint = {\n lat: pointLat,\n lng: pointLng\n }\n // calculate the distance between user and each point\n distances[i] = Haversine(userPoint, markerPoint);\n }\n return distances;\n}", "function computeDistances() {\n if (serverData == null) return;\n var firstReading = false;\n if (distances == null) {\n distances = new Array(serverData.length);\n for (var index = 0; index < serverData.length; index++) distances[index] = 0; \n firstReading = true;\n }\n //alert(serverData.length);\n for (var index = 0; index < serverData.length; index++) {\n var currentDistance = computeDistance(currentPosition, serverData[index]);\n if(firstReading && index == 0){\n closestPoint = serverData[0]; \n closestDistance = currentDistance; \n }\n // get the absolute distance from the point\n var oldDistance = distances[index] < 0 ? -distances[index] : distances[index];\n // if 0, set the new distance\n if(oldDistance == 0){\n distances[index] = currentDistance;\n }else{\n // if approaching that point, set a positive distance\n if(oldDistance > currentDistance){\n distances[index] = currentDistance;\n }else{\n // if moving further away, set a negative distance\n distances[index] = -currentDistance;\n }\n }\n\n if ((distances[index] >= 0) && (distances[index] < closestDistance)) {\n closestDistance = distances[index];\n closestPoint = serverData[index];\n } \n }\n // check the closest point\n checkClosestPoint();\t\t\n //alert(closestDistance + 'lat: '+ closestPoint.latitude + 'long: ' + closestPoint.longitude);\n}", "function distance(source, target){\n\tlet fields = Math.sqrt(Math.pow(source[1]-target[1],2)+Math.pow(source[0]-target[0],2));\n\treturn fields;\n\t}", "function getFloatFromExchangeResult(html){\n\t\t\t\t\t\t\t\t\n\tvar html = \"<div class='target-label'><div title='Wear Value' style='position:relative;right:-43px;top:-0.8em'>0.20041191577911376953</div></div>\";\n\tvar $ = cheerio.load(html);\n\tconsole.log(\"RESULTAT: \", $('.target-label').text());\n\treturn $('.target-label').text();\n}", "async GetValueFloat(id, command) {\n var packet = new DpsPacket(id, DpsConstants.sender, command, [0,0,0,0,0,0,0,0]);\n var result = await this.PacketIO(packet);\n if ((result && (result.sender != id || result.command != command)) || result == null) return null;\n else {\n var buf = new ArrayBuffer(8);\n var view = new DataView(buf);\n for (var i = 0; i < 4; i++) {\n view.setUint8(3 - i, result.data[i]);\n }\n return view.getFloat32(0);\n }\n }", "function initialize() {\n directionsService = new google.maps.DirectionsService()\n directionsDisplay = new google.maps.DirectionsRenderer();\n var chicago = new google.maps.LatLng(41.850033, -87.6500523);\n var mapOptions = {\n zoom:7,\n mapTypeId: google.maps.MapTypeId.ROADMAP,\n center: chicago\n }\n \n map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);\n marker=new google.maps.Marker();\n directionsDisplay.setMap(map);\n //map.addListener('click',function(e){getClosestRoad(e.latLng)});\n \n var rawFile = new XMLHttpRequest();\n rawFile.open(\"GET\", \"coords_test.csv\", false);\n rawFile.onreadystatechange = function ()\n {\n if(rawFile.readyState === 4)\n {\n if(rawFile.status === 200 || rawFile.status == 0)\n {\n var allText = rawFile.responseText;\n var allTextLines = allText.split(/[\\n,]/);\n for(i=0; i<allTextLines.length; i++) {\n coor_list.push(parseFloat(allTextLines[i])); \n }\n }\n }\n }\n rawFile.send(null);\n// var test_thing = [41.436, -86.058145];\n// alert(coor_list[40001]);\n// var coords = [{lat: coor_list[40000], lng: coor_list[40001]},{lat: coor_list[40002], lng: coor_list[40003]}, {lat: coor_list[40004], lng: coor_list[40005]}, {lat: coor_list[40006], lng: coor_list[40007]}];\n \n //{lat: 41.273877, lng: -86.058145},{lat: 47.753731, lng: -125.359647}, {lat: 41.273877, lng: -85.058145}];\n //[{lat: 47.753731, lng: -125.359647}] //js_coords.coords; //\n \n }", "function arrayStringToFloat(table) {\n data = [];\n for (i = 0; i < table.length; i++) {\n table[i] = table[i].replace(\",\", \".\");\n data.push(table[i]);\n }\n return data;\n}", "function parseDistanceMatrix(response) {\n var origins = response.originAddresses;\n var destinations = response.destinationAddresses;\n\n let ansArr = [];\n for (var i = 0; i < origins.length; i++) {\n var results = response.rows[i].elements;\n for (var j = 0; j < results.length; j++) {\n var element = results[j];\n ans = {};\n ans.distanceText = element.distance.text;\n ans.durationText = element.duration.text;\n ans.distance = element.distance.value; // in meters\n ans.duration = element.duration.value; // in second\n ans.from = origins[i];\n ans.to = destinations[j];\n ansArr.push(ans);\n }\n }\n return ansArr;\n}", "function readDistance(xml,index) {\n //var xmlText = new XMLSerializer().serializeToString(xml);\n var xmlDoc = xml.responseXML;\n var x = xmlDoc.getElementsByTagName('Distance')[0];\n var y = x.childNodes[0];\n //console.log(typeof b);\n\n var a = xmlDoc.getElementsByTagName('BaseTime')[0];\n var b = a.childNodes[0];\n distance= xmlToString(y);\n traveltime=xmlToString(b);\n var distanceint=parseInt(distance,10);\n var traveltimeint=parseInt(traveltime,10);\n console.log(distanceint);\n console.log(distance);\n console.log(traveltime);\n cpInfoArray[index][6]=(distanceint/1000);\n cpInfoArray[index][7]=(traveltimeint/60);\n \n updateCarParkButtons();\n}", "function readDouble(){\n checkLen(8);\n var dbl = buf.readDoubleLE(pos);\n pos += 8;\n return dbl.toString();\n }", "function pointToPointDistances(r) {\n for (let index_route = 0; index_route < r.length - 1; index_route++) {\n distancesPointToPoint[index_route] = distanceInMeter(r[index_route], r[index_route + 1]);\n }\n}", "get distance() {}", "getPointsFromCSVData(data){\n\t\tlet lines = data.split(/\\r|\\n/); // this regex is to make sure we don't run into the windows vs mac newline issue\n\t\tlet lista = [];\n\t\tlet listb = [];\n\t\tfor(let i = 0; i < lines.length; i++){\n\t\t\ttry{\n\t\t\t\tlet points = lines[i].split(',');\n\t\t\t\tlet to_a = parseFloat(points[0]);\n\t\t\t\tlet to_b = parseFloat(points[1]);\n\t\t\t\tif(to_a && to_b){\n\t\t\t\t\tlista.push(to_a);\n\t\t\t\t\tlistb.push(to_b);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch(err){\n\t\t\t\tconsole.log(err);\n\t\t\t\tconsole.log('skipped line: '+data[i]);\n\t\t\t}\n\t\t}\n\t\treturn this.cleanDataOrdering([lista, listb]);\n\t}", "function loadProximity() {\n d3.csv(\"data/Proximity2.csv\", function(error, data) {\n if (error) {\n document.write(\"Error reading file\");\n console.warn(error);\n return;\n }\n proximity = data;\n \n // transform proximity data\n console.log(\"Transforming Proximity...\");\n proximity.map(function(d) {\n d[\"time\"] = YmdXParser(d[\"time\"]);\n });\n \n // log proximity data\n console.log(\"Proximity\", proximity);\n \n }).on(\"progress\", function(event) {\n console.log(\"Loading data/Proximity.csv: \", formatPercent(d3.event.loaded/d3.event.total));\n });\n}", "function parseToArray(stringArr) {\n let pts = [];\n for (let i=0; i<stringArr.length; i++) {\n let line = stringArr[i];\n\n if (line.length > 0) {\n let pt = line.split(\",\"); // split x and y\n for (let j=0; j<pt.length; j++) {\n pt[j] = parseFloat(pt[j]); // convert string to float\n }\n pts.push(pt);\n }\n }\n return pts;\n}", "function simonSays() {\n fs.readFile('random.txt', 'utf8', (error, data) => {\n if (error) {\n console.log(error);\n } else {\n const dataArry = data.split(',');\n console.log(dataArry);\n }\n });\n}", "function extractNumbers(text) {\n return parseFloat(text);\n}", "function findNearest(lat, lon, amt){\n var nearest = [];\n var all = [];\n var hold = [];\n //trying to remove duplicates from the dataset DOESNT WORK YET\n for(var i = 0; i < data.length; i++){\n for(var j = i+1; j < data.length; j++){\n if(data[i].applicant == data[j].applicant){\n data.splice(j,\"\");\n } \n }\n }\n\n //for each truck find the distance from your position to the truck if longitude exists\n for (var i = 0; i < data.length; i++) {\n if(data[i].longitude != undefined && data[i].latitude != undefined){\n all[i] = distance(data[i].longitude, data[i].latitude, lon, lat);\n }\n }\n //duplicate all array to hold array\n for(var m = 0; m < all.length; m++){\n hold[m] = all[m];\n }\n //sorts the hold array from lowest to highest\n hold.sort(function(a,b){return a-b});\n\n //compares the hold array to the all array. the amt is the number of results wanted. push the \n for(var j = 0; j < amt; j++){\n nearest.push(hold[j]); \n }\n\n //create result array, from the nearest array for each element push the data value to the result array. basically the nearest array is replicated to the result array but the result array holds the information about the truck\n var result = [];\n nearest.forEach(function(value){\n result.push(data[value]);\n });\n return result;\n }", "function to_float(rows) {\n return rows.map(function(row) {\n return new Float32Array(row);\n });\n }", "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 findDistances(results) {\n let arrayLocation = [];\n\n /* Use geolib to determine meter distances given coordinates */\n for (let i = 0; i < results.length; i++) {\n arrayLocation.push(\n geolib.getDistance(\n {\n 'latitude': results[i].geometry.location.lat,\n 'longitude': results[i].geometry.location.lng,\n },\n {\n 'latitude': location.lat,\n 'longitude': location.lng,\n }\n )\n\n );\n }\n\n return arrayLocation;\n}", "function createDistances()\n{\n var distances = [];\n for( var i = 0; i < totalRows; i++ )\n {\n var row = [];\n for( var j = 0; j < totalCols; j++ )\n row.push(Number.POSITIVE_INFINITY);\n distances.push( row );\n }\n return distances;\n}", "readFloat() {\n const helper = new misc_functions_1.ReturnHelper();\n const start = this.cursor;\n const readToTest = this.readWhileRegexp(StringReader.charAllowedNumber);\n\n if (readToTest.length === 0) {\n return helper.fail(EXCEPTIONS.EXPECTED_FLOAT.create(start, this.string.length));\n } // The Java readInt throws upon multiple `.`s, but Javascript's doesn't\n\n\n if ((readToTest.match(/\\./g) || []).length > 1) {\n return helper.fail(EXCEPTIONS.INVALID_FLOAT.create(start, this.cursor, this.string.substring(start, this.cursor)));\n }\n\n try {\n return helper.succeed(parseFloat(readToTest));\n } catch (error) {\n return helper.fail(EXCEPTIONS.INVALID_FLOAT.create(start, this.cursor, readToTest));\n }\n }", "function readVals(){\n points = [];\n for(var i = 0; i < 8; i++){\n var verts = [];\n \n //Make array containing connected vertices\n for(var j = 1; j < vertices[i].options.length; j++){\n if(vertices[i].options[j].selected == true && switches[getIndex(vertices[i].options[j].text)].checked == true){\n verts[verts.length] = vertices[i].options[j].text;\n }\n }\n \n //If switch is on, create point\n if(switches[i].checked == true){\n //Applies transformation matrix\n var x = xPos[i].value * matrixVals[0].value + yPos[i].value * matrixVals[1].value;\n var y = xPos[i].value * matrixVals[2].value + yPos[i].value * matrixVals[3].value;\n \n rotate(rotation.value);\n scaleValue = scale.value;\n \n \n var newX, newY;\n newX = (x * rotationMatrix[0] + y * rotationMatrix[1]) * scaleValue;\n newY = (x * rotationMatrix[2] + y * rotationMatrix[3]) * scaleValue;\n \n //Adds point\n points[points.length] = new Point(newX, newY, names[i], verts);\n }\n }\n \n}", "function getFloat(reg){\r\n\t//same stuff as in getLong()\r\n\tlet buffer = new ArrayBuffer(4);\r\n\tlet view = new DataView(buffer);\r\n\tview.setUint16(0, modbusValues[reg], true);\r\n\tview.setUint16(2, modbusValues[reg+1], true);\r\n\t//read the buffer as float and round to 5 digits\r\n\treturn view.getFloat32(0, true).toPrecision(5);\r\n}", "calculer_distance() {}", "readPosition() {\r\n\t\tconst x = this.data.readFloatLE();\r\n\t\tconst z = this.data.readFloatLE();\r\n\t\tconst y = this.data.readFloatLE() * -1;\r\n\r\n\t\treturn [x, y, z];\r\n\t}", "function coord1(value) {\n\t return value\n\t .replace(removeSpace, \"\")\n\t .split(\",\")\n\t .map(parseFloat)\n\t .filter((num) => !isNaN(num))\n\t .slice(0, 3);\n\t}", "function JSONextractNumber2(abs, ord1, ord2, data) {\n\n var res = [];\n\tconsole.log(abs + \" \" + ord1 + \" \" + ord2)\n res.push([abs, ord1, ord2]);\n $.each(data, function (index) {\n\t\tif (this[abs] !== undefined && this[ord1] !== undefined && this[ord2] !== undefined && this[ord1] != \"NA\" && this[abs] != \"NA\" && this[ord2] != \"NA\") \n\t\t\tres.push([parseFloat(this[abs]), parseFloat(this[ord1]), parseFloat(this[ord2])]);\n });\n console.log(res);\n return res;\n}", "function processFile(){\n var file = document.querySelector(\"#myFile\").files[0] ;\n var reader = new FileReader() ;\n reader.readAsText(file) ;\n\n // only the when the file is loaded it can be analyzed\n reader.onload = function(event){\n var result = event.target.result ;\n var data = result.split(',') ;\n\n var width = parseInt(data[0]) ;\n var height = parseInt(data[1]) ;\n\n var table = new Float32Array(width*height*4) ;\n var p = 0 ;\n for (var i=2 ; i< data.length; i++){ // modify accordingly\n table[p++] = parseFloat( data[i]) ;\n }\n\n fcolor.data = table ;\n scolor.data = table ;\n }\n}", "function calcularDistancia(lat1,lng1,lat2,lng2){\n //https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=25.7502756,-108.9813402&destinations=25.7646791,-108.987061&key=AIzaSyBtWTMHlkpHzWZ943bH9yK5N3e78VgB8Gs\n var url = \"https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=\"+lat1+\",\"+\n lng1+\"&destinations=\"+lat2+\",\"+lng2+\"&key=AIzaSyBtWTMHlkpHzWZ943bH9yK5N3e78VgB8Gs\";\n var headers = {\n 'User-Agent':'Super Agent/0.0.1',\n 'Content-Type':'application/x-www-form-urlencoded'\n }\n var options = {\n url : url,\n method : 'GET',\n jar : true,\n headers : headers\n }\n request(options, function (error, response, body) {\n if (!error && response.statusCode == 200) {\n var res = JSON.parse(body);\n console.log(res.rows[0].elements[0].distance.value);\n return (res.rows[0].elements[0].distance.value);\n }\n });\n}", "readFloat80 (littleEndian) {\n this.read(10, littleEndian)\n return float80()\n }", "function createDistances(){\n\tvar distances = [];\n\tfor (var i = 0; i < totalRows; i++){\n\t\tvar row = [];\n\t\tfor (var j = 0; j < totalCols; j++){\n\t\t\trow.push(Number.POSITIVE_INFINITY);\n\t\t}\n\t\tdistances.push(row);\n\t}\n\treturn distances;\n}", "readBinaryFloat() {\n const buf = this.readBytesWithLength();\n if (!buf) {\n return null;\n }\n return this.parseBinaryFloat(buf);\n }", "function datafrompath (path) {\n return path.getAttribute('d').match(/[\\d\\.]+\\s+[\\d\\.]+/g).map(function(el) {\n return el.split(/\\s+/).map(function(num){ return Number(num); });\n });\n}", "function dataToRadians(v, vT) {\n\tvar v2 = [];\n\tfor(var i=0, len=v.length; i<len; i++) {\n\t\tif (i !=0) {\n\t\t\tv2[i] = v2[i-1] + (v[i]/vT * 2);\n\t\t} else {\n\t\t\tv2[i] = v[i]/vT * 2;\n\t\t}\n\t}\n\treturn v2\n}", "function processData1(dat) {\n var allTextLines = dat.split(/\\r\\n|\\n/);\n points = [];\n for (var i = 0; i < allTextLines.length; i++) {\n var data = allTextLines[i].split(' ');\n var tarr = [];\n for (var j = 0; j < data.length; j++) {\n tarr.push(data[j]);\n }\n points.push(tarr);\n }\n}", "function getFloat(str) {\n return parseFloat(str.replace(/[^0-9\\.\\-]/g, ''));\n}", "function distanceInFeet(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 * 5280;\n}", "get floatValue() {}", "function parseNumAr(data){\n\tvar result = [];\n\t\n\tif(typeof data == 'string'){ data = [data]; }\n\t\n\tfor (var i=0; i < data.length; i++){\n\t\t//console.log(data[i]);\n\t\tresult.push(parseFloat(data[i]));\n\t}\n\treturn result;\n}", "function getAverageDistance(distances) {\n let sum = 0;\n for (let i = 0; i < distances.length; i++) {\n sum += distances[i];\n }\n return (sum / distances.length);\n }", "function processFile(routeId, fileInput){\n var output = [];\n var coordinates = fileInput.split('\\n');\n \n for(var i = 0; i < coordinates.length; i++) {\n var latitude = coordinates[i].split(',')[0];\n var longitude = coordinates[i].split(',')[1];\n var sleepTime = parseInt(coordinates[i].split(',')[2].replace(\"\\r\", \"\"));\n output.push({\n routeId: routeId,\n latitude: latitude,\n longitude: longitude,\n sleepSeconds: sleepTime\n });\n }\n\n return output;\n}", "function extractRaDecVals(reg,txt) {\n var charPos = [];\n var raDeg, decDeg;\n var r1, r2, r3, d1, d2, d3,s;\n var r2Acc,r3Acc,d2Acc,d3Acc;\n var raAcc,decAcc;\n var findMatch = txt.match(new RegExp(reg));\n if (findMatch) {\n r1 = findMatch[1].replace(/[^0-9]/g,'');\n r2 = findMatch[2].replace(/[^0-9]/g,'');\n r2Acc = 0.5;\n r3 = '';\n if (findMatch[3]) {\n r3Acc = 0.5;\n r3 = findMatch[3].replace(/[^0-9]/g,''); }\n if (findMatch[4] && r3 != '') {\n r3Acc = Math.pow(10,-1.0*(findMatch[4].replace(/[^0-9]/g,'').length));\n r3 = r3 + findMatch[4].replace(/[^0-9\\.]/g,'');\n } else if(findMatch[4]) {\n r2Acc = Math.pow(10,-1.0*(findMatch[4].replace(/[^0-9]/g,'').length));\n r2 = r2 + findMatch[4].replace(/[^0-9\\.]/g,''); }\n if (r3 == '') {r3 = '0'; }\n s = 1;\n if (findMatch[5].replace(/[^+-]/g,'') == '-') {s = -1; }\n d1 = findMatch[6].replace(/[^0-9]/g,'');\n d2 = findMatch[7].replace(/[^0-9]/g,'');\n d2Acc = 0.5;\n d3 = '';\n if (findMatch[8]) {\n d3Acc = 0.5;\n d3 = findMatch[8].replace(/[^0-9]/g,''); }\n if (findMatch[9] && d3 != '') {\n d3Acc = Math.pow(10,-1.0*(findMatch[9].replace(/[^0-9]/g,'').length));\n d3 = d3 + findMatch[9].replace(/[^0-9\\.]/g,'');\n } else if (findMatch[9]) {\n d2Acc = Math.pow(10,-1.0*(findMatch[9].replace(/[^0-9]/g,'').length));\n d2 = d2 + findMatch[9].replace(/[^0-9\\.]/g,''); }\n if (d3 == '') {d3 = '0'; }\n raDeg = ((parseFloat(r1) + parseFloat(r2)/60 + parseFloat(r3)/3600) * 360/24).toFixed(5);\n decDeg = (s*(parseFloat(d1) + parseFloat(d2)/60 + parseFloat(d3)/3600)).toFixed(5);\n if (r3Acc) {\n raAcc = (r3Acc*(360/(24*3600))).toFixed(5);\n } else {\n raAcc = (r2Acc*(360/(24*60))).toFixed(5); }\n if (d3Acc) {\n decAcc = (d3Acc/3600).toFixed(5);\n } else {\n decAcc = (d2Acc/60).toFixed(5); }\n return [raDeg, decDeg, raAcc, decAcc, findMatch[0]];\n } else {return [\"\",\"\",\"\",\"\",\"\"]; }\n }", "function extractLineEnergy(value, units, del) {\n// the del, in same units as value, is optional\n var energy = '';\n var delta = '';\n var convertFactor = 0;\n var unitName = '';\n var matched = '';\n var thisIdx = '';\n var thisX = '';\n var thisDelta = '';\n var thisEnergy = '';\n var waveFreq = '';\n var tmp = '';\n var tmp1 = 0;\n var tmp2 = 0;\n var i = 0;\n var isSpecial = false;\n var diff = [];\n var tmpDiff = 0;\n var itmp = 0;\n var spectralRegions = ''; // all energies are in eV units\n var gammarayMin = 500*Math.pow(10,3);\n var hardxrayMin = 3*Math.pow(10,3);\n var softxrayMin = 120;\n var euvMin = planckEv * light/(912.0*Math.pow(10,-10));\n var fuvMin = planckEv * light/(2000.0*Math.pow(10,-10));\n var nuvMin = planckEv * light/(3300.0*Math.pow(10,-10));\n var visibleMin = planckEv * light/(8000.0*Math.pow(10,-10));\n var nirMin = planckEv * light/(7.0*Math.pow(10,-6));\n var mirMin = planckEv * light/(25.0*Math.pow(10,-6));\n var firMin = planckEv * light/(300.0*Math.pow(10,-6));\n var submmMin = planckEv * light/(1*Math.pow(10,-3));\n if (value.match(/\\./)) {\n tmp = Math.pow(10, -1.0*(value.replace(/[0-9]+\\./,'').length)); // if 45.066, returns 0.001\n } else {\n tmp = Math.pow(10, value.length-1); // if 45, returns 10\n if (tmp == 1) { // if original number bet/ 1 and 9, delta is +- 0.5\n tmp = 0.5;\n } else if (tmp <= 100) { // if original number bet/ 10 and 100, delta is +/- 1\n tmp = 1;\n } else { // if original number greater than 100, delta is 0.2% (if 5455, tmp = 1000*0.002 = 2)\n tmp = tmp*0.002; }\n }\n if (del !== undefined && del != '') {\n delta = parseFloat(del);\n } else {delta = tmp; }\n// Now figure out what the provided units correspond to and how to convert them to basic metric values\n// (e.g, gigahertz would have a conversion factor of 10^9 to convert it to hertz)\n if (units.match(/^a/i)) {\n convertFactor = Math.pow(10,-10);\n unitName = 'ang';\n waveFreq = 'w';\n } else if (units.match(/^c/i)) {\n convertFactor = Math.pow(10,-2);\n unitName = 'cm';\n waveFreq = 'w';\n } else if (units.match(/^mil/i) || units.match(/^mm/i)) {\n convertFactor = Math.pow(10,-3);\n unitName = 'mm';\n waveFreq = 'w';\n } else if (units.match(/^mic/i) || units.match(/^um/i) || units.match(/^mu/i)) {\n convertFactor = Math.pow(10,-6);\n unitName = 'um';\n waveFreq = 'w';\n } else if (units.match(/^n/i)) {\n convertFactor = Math.pow(10,-9);\n unitName = 'nm';\n waveFreq = 'w'; }\n if (units.match(/^gh/i) || units.match(/^gigah/i)) {\n convertFactor = Math.pow(10,9);\n unitName = 'ghz';\n waveFreq = 'f';\n } else if (units.match(/^kh/i) || units.match(/^kiloh/i)) {\n convertFactor = Math.pow(10,3);\n unitName = 'khz';\n waveFreq = 'f';\n } else if (units.match(/^th/i) || units.match(/^terah/i)) {\n convertFactor = Math.pow(10,12);\n unitName = 'thz';\n waveFreq = 'f';\n } else if (units.match(/^mh/i) || units.match(/^megah/i)) {\n convertFactor = Math.pow(10,6);\n unitName = 'mhz';\n waveFreq = 'f';\n } else if (units.match(/^ev/i)) {\n convertFactor = Math.pow(10,0);\n unitName = 'ev';\n waveFreq = 'e';\n } else if (units.match(/^kev/i)) {\n convertFactor = Math.pow(10,3);\n unitName = 'kev';\n waveFreq = 'e'; }\n// Now compute the energy and associated uncertainty:\n tmp = parseFloat(value);\n if (waveFreq == 'w') {\n energy = (planckEv * light)/ (tmp * convertFactor);\n delta = (delta * planckEv * light) / (Math.pow(tmp,2) * convertFactor);\n } else if (waveFreq == 'f') {\n energy = planckEv * convertFactor * tmp;\n delta = planckEv * convertFactor * delta;\n } else if (waveFreq == 'e') {\n energy = convertFactor * tmp;\n delta = convertFactor * delta; }\n// only retain the first significant figure of the accuracy value:\n delta = (''+delta).replace(/([1-9])([0-9]*)\\.[0-9]+/,function(x,x1,x2){ // turns 4565.989 into 4000\n return x1 + x2.replace(/[0-9]/g,'0'); });\n delta = (''+delta).replace(/(0\\.[1-9])[0-9]*/,'$1'); // turns 0.84535345 into 0.8\n delta = (''+delta).replace(/(0\\.0+[1-9])[0-9]*/,'$1'); // turns 0.000454 into 0.0004\n// delta is now a string\n//\n// let energy always have 8 decimal places when written in exponential form -- overkill in accuracy for the \n// full range of values that would be relevant in astronomy, but will help eliminate possibility that 2 completely\n// unrelated spectral lines overwrite each other in the index.\n energy = energy.toExponential();\n tmp = Number(energy.match(/\\d+\\.\\d+/)); // get the stuff in front of exponential\n tmp = Number(Math.round(tmp + 'e8') + 'e-8'); // round the value ... shown here is a trick to ensure a \".5\" is dealt with accuractly\n// attach the properly rounded off and truncated to 8 decimal points value to the exponential stuff:\n energy = tmp + energy.replace(/\\d+\\.\\d+/,'');\n// energy is a string\n// Now look up what wavelength regime this energy corresponds to, and add that regime to the list to be indexed:\n// Possibilities are: \"hardxray\", \"softxray\", \"euv\",\"fuv\", \"nuv\", \"visible\", \"nir\", \"mir\", \"fir\", \"submm\", \"radio\"\n// The definition of the energy/wavelength ranges taken from // http://astronomy.swin.edu.au/~gmackie/MAG/MAG_chap2.pdf\n tmp = parseFloat(energy);\n if (tmp >= gammarayMin) {\n } else if (tmp >= hardxrayMin && tmp < gammarayMin) {\n spectralRegions = \"hard_*x_ray\";\n } else if (tmp >= softxrayMin && tmp < hardxrayMin) {\n spectralRegions = \"soft_*x_ray\";\n } else if (tmp >= euvMin && tmp < softxrayMin) {\n spectralRegions = \"extreme_*ultraviolet\";\n } else if (tmp >= fuvMin && tmp < euvMin) {\n spectralRegions = \"far_*ultraviolet\";\n } else if (tmp >= nuvMin && tmp < fuvMin) {\n spectralRegions = \"near_ultraviolet\";\n } else if (tmp >= visibleMin && tmp < nuvMin) {\n spectralRegions = \"visible\";\n } else if (tmp >= nirMin && tmp < visibleMin) {\n spectralRegions = \"near_infrared\";\n } else if (tmp >= mirMin && tmp < nirMin) {\n spectralRegions = \"*mid_infrared\" + '\\|' + \"thermal_infrared\";\n } else if (tmp >= firMin && tmp < mirMin) {\n spectralRegions = \"far_infrared\" + '\\|' + \"thermal_infrared\";\n } else if (tmp >= submmMin && tmp < firMin) {\n spectralRegions = \"*sub_milli_meter\";\n } else if (tmp < submmMin) {\n spectralRegions = \"radio\"; }\n delta = parseFloat(delta).toExponential();\n return JSON.stringify([energy, delta, spectralRegions, waveFreq]);\n }", "function main() {\n var timeCharged = parseFloat(readLine());\n\n const trainingData =\n`2.81,5.62\n7.14,8.00\n2.72,5.44\n3.87,7.74\n1.90,3.80\n7.82,8.00\n7.02,8.00\n5.50,8.00\n9.15,8.00\n4.87,8.00\n8.08,8.00\n5.58,8.00\n9.13,8.00\n0.14,0.28\n2.00,4.00\n5.47,8.00\n0.80,1.60\n4.37,8.00\n5.31,8.00\n0.00,0.00\n1.78,3.56\n3.45,6.90\n6.13,8.00\n3.53,7.06\n4.61,8.00\n1.76,3.52\n6.39,8.00\n0.02,0.04\n9.69,8.00\n5.33,8.00\n6.37,8.00\n5.55,8.00\n7.80,8.00\n2.06,4.12\n7.79,8.00\n2.24,4.48\n9.71,8.00\n1.11,2.22\n8.38,8.00\n2.33,4.66\n1.83,3.66\n5.94,8.00\n9.20,8.00\n1.14,2.28\n4.15,8.00\n8.43,8.00\n5.68,8.00\n8.21,8.00\n1.75,3.50\n2.16,4.32\n4.93,8.00\n5.75,8.00\n1.26,2.52\n3.97,7.94\n4.39,8.00\n7.53,8.00\n1.98,3.96\n1.66,3.32\n2.04,4.08\n11.72,8.00\n4.64,8.00\n4.71,8.00\n3.77,7.54\n9.33,8.00\n1.83,3.66\n2.15,4.30\n1.58,3.16\n9.29,8.00\n1.27,2.54\n8.49,8.00\n5.39,8.00\n3.47,6.94\n6.48,8.00\n4.11,8.00\n1.85,3.70\n8.79,8.00\n0.13,0.26\n1.44,2.88\n5.96,8.00\n3.42,6.84\n1.89,3.78\n1.98,3.96\n5.26,8.00\n0.39,0.78\n6.05,8.00\n1.99,3.98\n1.58,3.16\n3.99,7.98\n4.35,8.00\n6.71,8.00\n2.58,5.16\n7.37,8.00\n5.77,8.00\n3.97,7.94\n3.65,7.30\n4.38,8.00\n8.06,8.00\n8.05,8.00\n1.10,2.20\n6.65,8.00`;\n\n let trainingDataArr = trainingData.split('\\n');\n trainingDataArr = trainingDataArr.map( (v, i) => {\n let temp = trainingDataArr[i].split(',');\n\n return [parseFloat(temp[0]), parseFloat(temp[1])];\n });\n\n let arrX = [];\n let arrY = [];\n\n let maximumBattery = 0;\n\n trainingDataArr.forEach( (v) => {\n if (v[1] > maximumBattery) {\n maximumBattery = v[1];\n }\n });\n\n // Ignore datapoints where maximum battery is achieved\n trainingDataArr = trainingDataArr.filter( (v) => {\n return v[1] !== maximumBattery;\n });\n\n trainingDataArr.forEach( (v) => {\n arrX.push(v[0]);\n arrY.push(v[1]);\n })\n\n // Helper functions from other problems\n function correlationCoefficient(dataArr1, dataArr2) {\n\n if (dataArr1.length !== dataArr2.length) {\n throw new Error('correlationCoefficient: The sets aren\\'t the same size.');\n }\n\n let size = dataArr1.length;\n let dataArr1Total = 0;\n let dataArr2Total = 0;\n let dataArr1SquaredTotal = 0;\n let dataArr2SquaredTotal = 0;\n let dataArr1dataArr2Total = 0;\n\n for (let i = 0; i < size; ++i) {\n dataArr1Total += dataArr1[i];\n dataArr2Total += dataArr2[i];\n dataArr1SquaredTotal += Math.pow(dataArr1[i], 2);\n dataArr2SquaredTotal += Math.pow(dataArr2[i], 2);\n dataArr1dataArr2Total += dataArr1[i] * dataArr2[i];\n }\n\n // Math is hard\n let temp2 = size * dataArr1dataArr2Total;\n let temp3 = dataArr1Total * dataArr2Total;\n let temp4 = temp2 - temp3;\n let temp5 = size * dataArr1SquaredTotal;\n let temp6 = dataArr1Total * dataArr1Total;\n let temp7 = temp5 - temp6;\n let temp8 = size * dataArr2SquaredTotal;\n let temp9 = dataArr2Total * dataArr2Total;\n let temp10 = temp8 - temp9;\n let temp11 = temp7 * temp10;\n let temp11a = Math.sqrt(temp11);\n let temp12 = temp4 / temp11a;\n\n return temp12;\n }\n\n function mean(arr) {\n return arr.reduce( (prev, curr) => {\n return prev + curr;\n }, 0) / arr.length;\n }\n\n function standardDeviation(arr) {\n let arrMean = mean(arr);\n let subtractMeanSquareArr = [];\n\n arr.forEach( (v) => {\n subtractMeanSquareArr.push(Math.pow(v - arrMean, 2));\n });\n\n return Math.sqrt(mean(subtractMeanSquareArr));\n }\n\n function regressionLine(arr1, arr2) {\n let standardDeviationX = standardDeviation(arr1);\n let standardDeviationY = standardDeviation(arr2);\n let correlation = correlationCoefficient(arr1, arr2);\n\n return correlation * (standardDeviationY / standardDeviationX);\n }\n\n let result = regressionLine(arrX, arrY) * timeCharged;\n\n if (result > maximumBattery) {\n result = maximumBattery;\n }\n\n console.log(result)\n}", "toUnsafeFloat() { return parseFloat(this.toString()); }", "toFloat(value){\n return parseFloat(value.replace(/,/g, ''));\n }", "function getList(filename) {\n fs.readFile(filename, function(err, data) {\n if (err) {\n return console.error(err);\n }\n\n list = [];\n rawList = data.toString().split(\"\\n\");\n for (item in rawList) {\n newEntry = rawList[item].split(\",\");\n list.push(newEntry);\n }\n\n getCoordBatch(list);\n });\n}", "function populateDistanceMatrix()\r\n{\r\n\t//Note that the distance matrix will be permanent.\r\n\tvar matrix = distanceMatrix;\r\n\r\n\tmatrix[0][1] = 0.338;\r\n\tmatrix[0][2] = 0.118;\r\n\r\n\tmatrix[1][0] = 0.338;\r\n\tmatrix[1][179] = 0.024;\r\n\r\n\tmatrix[2][6] = 0.272;\r\n\tmatrix[2][180] = 0.023;\r\n\r\n\tmatrix[3][69] = 0.026;\r\n\r\n\tmatrix[4][183] = 0.014;\r\n\r\n\tmatrix[5][3] = 0.044;\r\n\r\n\tmatrix[6][178] = 0.136;\r\n\tmatrix[6][7] = 0.072;\r\n\tmatrix[6][180] = 0.265;\r\n\r\n\tmatrix[7][6] = 0.072;\r\n\tmatrix[7][178] = 0.112;\r\n\tmatrix[7][8] = 0.028;\r\n\r\n\r\n\tmatrix[8][11] = 0.271;\r\n\tmatrix[8][81] = 0.330;\r\n\r\n\tmatrix[9][179] = 0.258;\r\n\tmatrix[9][10] = 0.122;\r\n\r\n\tmatrix[10][9] = 0.122;\r\n\tmatrix[10][80] = 0.534;\r\n\r\n\tmatrix[11][9] = 0.170;\r\n\r\n\tmatrix[12][11] = 0.411;\r\n\r\n\tmatrix[13][12] = 0.090;\r\n\tmatrix[13][17] = 0.077;\r\n\r\n\tmatrix[14][13] = 0.041;\r\n\tmatrix[14][16] = 0.041;\r\n\r\n\tmatrix[15][14] = 0.057;\r\n\tmatrix[15][18] = 0.077;\r\n\r\n\tmatrix[16][80] = 0.054;\r\n\tmatrix[16][14] = 0.041;\r\n\r\n\tmatrix[17][82] = 0.088;\r\n\tmatrix[17][13] = 0.077;\r\n\tmatrix[17][18] = 0.104;\r\n\tmatrix[17][20] = 0.045;\r\n\r\n\tmatrix[18][17] = 0.104;\r\n\tmatrix[18][19] = 0.047;\r\n\r\n\tmatrix[19][20] = 0.107;\r\n\tmatrix[19][22] = 0.080;\r\n\r\n\tmatrix[20][17] = 0.045;\r\n\tmatrix[20][19] = 0.107;\r\n\tmatrix[20][21] = 0.024;\r\n\r\n\tmatrix[21][82] = 0.108;\r\n\tmatrix[21][20] = 0.024;\r\n\tmatrix[21][22] = 0.089;\r\n\r\n\tmatrix[22][21] = 0.089;\r\n\tmatrix[22][171] = 0.143;\r\n\tmatrix[22][23] = 0.210;\r\n\r\n\tmatrix[23][82] = 0.206;\r\n\tmatrix[23][24] = 0.198;\r\n\r\n\tmatrix[24][25] = 0.127;\r\n\tmatrix[24][83] = 0.337;\r\n\tmatrix[24][53] = 0.471;\r\n\r\n\tmatrix[25][26] = 0.024;\r\n\tmatrix[25][24] = 0.127;\r\n\tmatrix[25][197] = 0.142;\r\n\tmatrix[25][196] = 0.208;\r\n\r\n\tmatrix[26][37] = 0.211;\r\n\tmatrix[26][191] = 0.154;\r\n\tmatrix[26][25] = 0.024;\r\n\r\n\tmatrix[27][36] = 0.041;\r\n\tmatrix[27][37] = 0.089;\r\n\r\n\tmatrix[28][27] = 0.207;\r\n\tmatrix[28][29] = 0.072;\r\n\r\n\tmatrix[29][30] = 0.087;\r\n\tmatrix[29][28] = 0.072;\r\n\tmatrix[29][176] = 0.043;\r\n\r\n\tmatrix[30][120] = 0.058;\r\n\tmatrix[30][29] = 0.087;\r\n\tmatrix[30][32] = 0.138;\r\n\r\n\tmatrix[31][32] = 0.079;\r\n\tmatrix[31][176] = 0.093;\r\n\tmatrix[31][33] = 0.080;\r\n\tmatrix[31][93] = 0.124;\r\n\r\n\tmatrix[32][90] = 0.163;\r\n\tmatrix[32][30] = 0.138;\r\n\tmatrix[32][31] = 0.079;\r\n\tmatrix[32][92] = 0.120;\r\n\r\n\tmatrix[33][31] = 0.080;\r\n\tmatrix[33][177] = 0.093;\r\n\tmatrix[33][35] = 0.050;\r\n\tmatrix[33][94] = 0.127;\r\n\r\n\tmatrix[34][42] = 0.115;\r\n\tmatrix[34][200] = 0.213;\r\n\r\n\tmatrix[35][33] = 0.050;\r\n\tmatrix[35][36] = 0.091;\r\n\tmatrix[35][55] = 0.029;\r\n\r\n\tmatrix[36][177] = 0.046;\r\n\tmatrix[36][27] = 0.041;\r\n\tmatrix[36][35] = 0.091;\r\n\r\n\r\n\tmatrix[37][39] = 0.025;\r\n\tmatrix[37][38] = 0.028;\r\n\tmatrix[37][26] = 0.211;\r\n\r\n\tmatrix[38][39] = 0.036;\r\n\tmatrix[38][40] = 0.195;\r\n\r\n\tmatrix[39][55] = 0.060;\r\n\tmatrix[39][37] = 0.025;\r\n\tmatrix[39][38] = 0.036;\r\n\r\n\tmatrix[40][96] = 0.100;\r\n\tmatrix[40][41] = 0.105;\r\n\r\n\tmatrix[41][97] = 0.046;\r\n\tmatrix[41][42] = 0.137;\r\n\r\n\tmatrix[42][43] = 0.083;\r\n\tmatrix[42][34] = 0.115;\r\n\tmatrix[42][123] = 0.125;\r\n\r\n\tmatrix[43][44] = 0.078;\r\n\tmatrix[43][97] = 0.130;\r\n\tmatrix[43][42] = 0.083;\r\n\r\n\tmatrix[44][110] = 0.081;\r\n\tmatrix[44][98] = 0.130;\r\n\tmatrix[44][43] = 0.078;\r\n\tmatrix[44][45] = 0.091;\r\n\r\n\tmatrix[45][46] = 0.081;\r\n\tmatrix[45][44] = 0.091;\r\n\r\n\tmatrix[46][111] = 0.079;\r\n\tmatrix[46][110] = 0.092;\r\n\tmatrix[46][47] = 0.054;\r\n\r\n\tmatrix[47][122] = 0.078;\r\n\tmatrix[47][46] = 0.054;\r\n\tmatrix[47][48] = 0.025;\r\n\r\n\tmatrix[48][121] = 0.078;\r\n\tmatrix[48][47] = 0.025;\r\n\tmatrix[48][119] = 0.033;\r\n\r\n\tmatrix[49][117] = 0.074;\r\n\tmatrix[49][112] = 0.087;\r\n\tmatrix[49][121] = 0.082;\r\n\tmatrix[49][50] = 0.088;\r\n\r\n\tmatrix[50][49] = 0.088;\r\n\tmatrix[50][51] = 0.162;\r\n\r\n\r\n\r\n\t//mestart\r\n\r\n\tmatrix[51][50] = 0.162;\r\n\tmatrix[51][119] = 0.050;\r\n\r\n\r\n\tmatrix[52][150] = 0.196;\r\n\tmatrix[52][138] = 0.541;\r\n\r\n\t//53 here\r\n\tmatrix[53][60] = 0.046;\r\n\tmatrix[53][24] = 0.471;\r\n\tmatrix[53][61] = 0.037;\r\n\r\n\r\n\tmatrix[54][95] = 0.038;\r\n\tmatrix[54][96] = 0.072;\r\n\tmatrix[54][99] = 0.095;\r\n\r\n\tmatrix[55][39] = 0.059;\r\n\tmatrix[55][95] = 0.130;\r\n\tmatrix[55][35] = 0.077;\r\n\r\n\tmatrix[56][195] = 0.405;\r\n\r\n\tmatrix[57][56] = 0.013;\r\n\r\n\tmatrix[58][60] = 0.081;\r\n\r\n\tmatrix[59][160] = 0.342;\r\n\r\n\tmatrix[60][53] = 0.043;\r\n\tmatrix[60][61] = 0.033;\r\n\r\n\tmatrix[61][53] = 0.033;\r\n\tmatrix[61][137] = 0.465;\r\n\r\n\tmatrix[62][64] = 0.109;\r\n\r\n\tmatrix[63][66] = 0.233;\r\n\tmatrix[63][62] = 0.015;\r\n\r\n\tmatrix[64][200] = 0.296;\r\n\r\n\tmatrix[65][66] = 0.036;\r\n\tmatrix[65][62] = 0.218;\r\n\r\n\tmatrix[66][165] = 0.196;\r\n\r\n\tmatrix[67][201] = 0.036;\r\n\r\n\tmatrix[68][73] = 0.139;\r\n\tmatrix[68][72] = 0.137;\r\n\tmatrix[68][120] = 0.093;\r\n\r\n\tmatrix[69][2] = 0.062;\r\n\r\n\tmatrix[70][184] = 0.018;\r\n\tmatrix[70][188] = 0.258;\r\n\r\n\tmatrix[71][181] = 0.418;\r\n\tmatrix[71][84] = 0.073;\r\n\r\n\tmatrix[72][73] = 0.032;\r\n\tmatrix[72][71] = 0.035;\r\n\r\n\tmatrix[73][74] = 0.116;\r\n\r\n\tmatrix[74][76] = 0.229;\r\n\r\n\tmatrix[75][71] = 0.176;\r\n\tmatrix[75][74] = 0.014;\r\n\r\n\tmatrix[76][77] = 0.017;\r\n\r\n\tmatrix[77][76] = 0.017;\r\n\tmatrix[77][75] = 0.228;\r\n\r\n\tmatrix[78][92] = 0.066;\r\n\tmatrix[78][79] = 0.077;\r\n\r\n\tmatrix[79][78] = 0.077;\r\n\tmatrix[79][93] = 0.069;\r\n\tmatrix[79][101] = 0.063;\r\n\r\n\tmatrix[80][16] = 0.054;\r\n\tmatrix[80][15] = 0.040;\r\n\r\n\tmatrix[81][187] = 0.021;\r\n\tmatrix[81][82] = 0.345;\r\n\tmatrix[81][83] = 0.157;\r\n\r\n\tmatrix[82][81] = 0.345;\r\n\tmatrix[82][12] = 0.081;\r\n\tmatrix[82][21] = 0.108;\r\n\r\n\tmatrix[83][24] = 0.337;\r\n\tmatrix[83][190] = 0.220;\r\n\r\n\tmatrix[84][85] = 0.039;\r\n\tmatrix[84][87] = 0.018;\r\n\r\n\tmatrix[85][185] = 0.127;\r\n\tmatrix[85][70] = 0.084;\r\n\r\n\tmatrix[86][127] = 0.113;\r\n\tmatrix[86][88] = 0.049;\r\n\tmatrix[86][126] = 0.137;\r\n\r\n\tmatrix[87][72] = 0.100;\r\n\tmatrix[87][68] = 0.149;\r\n\r\n\tmatrix[88][124] = 0.140;\r\n\tmatrix[88][125] = 0.134;\r\n\tmatrix[88][86] = 0.049;\r\n\r\n\tmatrix[89][120] = 0.179;\r\n\tmatrix[89][90] = 0.160;\r\n\r\n\tmatrix[90][89] = 0.160;\r\n\tmatrix[90][32] = 0.163;\r\n\tmatrix[90][91] = 0.084;\r\n\r\n\tmatrix[91][90] = 0.084;\r\n\tmatrix[91][92] = 0.165;\r\n\tmatrix[91][104] = 0.152;\r\n\r\n\tmatrix[92][91] = 0.165;\r\n\tmatrix[92][32] = 0.120;\r\n\tmatrix[92][93] = 0.083;\r\n\tmatrix[92][78] = 0.066;\r\n\r\n\tmatrix[93][92] = 0.083;\r\n\tmatrix[93][31] = 0.124;\r\n\tmatrix[93][94] = 0.084;\r\n\tmatrix[93][79] = 0.069;\r\n\r\n\tmatrix[94][93] = 0.084;\r\n\tmatrix[94][33] = 0.127;\r\n\tmatrix[94][95] = 0.080;\r\n\tmatrix[94][100] = 0.132;\r\n\r\n\tmatrix[95][94] = 0.080;\r\n\tmatrix[95][55] = 0.125;\r\n\tmatrix[95][54] = 0.038;\r\n\r\n\tmatrix[96][54] = 0.072;\r\n\tmatrix[96][40] = 0.100;\r\n\tmatrix[96][98] = 0.100;\r\n\r\n\tmatrix[97][98] = 0.073;\r\n\tmatrix[97][41] = 0.046;\r\n\tmatrix[97][43] = 0.130;\r\n\r\n\tmatrix[98][99] = 0.080;\r\n\tmatrix[98][96] = 0.100;\r\n\tmatrix[98][97] = 0.073;\r\n\r\n\tmatrix[99][100] = 0.086;\r\n\tmatrix[99][54] = 0.097;\r\n\tmatrix[99][98] = 0.080;\r\n\tmatrix[99][110] = 0.127;\r\n\r\n\r\n\tmatrix[100][94] = 0.130;\r\n\tmatrix[100][99] = 0.082;\r\n\tmatrix[100][101] = 0.081;\r\n\tmatrix[100][109] = 0.127;\r\n\r\n\r\n\tmatrix[101][79] = 0.059;\r\n\tmatrix[101][100] = 0.081;\r\n\tmatrix[101][102] = 0.077;\r\n\tmatrix[101][108] = 0.123;\r\n\r\n\r\n\tmatrix[102][78] = 0.057;\r\n\tmatrix[102][101] = 0.077;\r\n\tmatrix[102][103] = 0.076;\r\n\tmatrix[102][107] = 0.125;\r\n\r\n\r\n\tmatrix[103][102] = 0.076;\r\n\tmatrix[103][104] = 0.083;\r\n\tmatrix[103][106] = 0.122;\r\n\r\n\r\n\tmatrix[104][91] = 0.0149;\r\n\tmatrix[104][103] = 0.083;\r\n\tmatrix[104][105] = 0.0124;\r\n\r\n\r\n\tmatrix[105][104] = 0.0124;\r\n\tmatrix[105][106] = 0.071;\r\n\r\n\r\n\tmatrix[106][103] = 0.122;\r\n\tmatrix[106][105] = 0.071;\r\n\tmatrix[106][107] = 0.076;\r\n\tmatrix[106][114] = 0.085;\r\n\r\n\r\n\tmatrix[107][102] = 0.125;\r\n\tmatrix[107][106] = 0.076;\r\n\tmatrix[107][108] = 0.078;\r\n\tmatrix[107][113] = 0.085;\r\n\r\n\r\n\tmatrix[108][101] = 0.123;\r\n\tmatrix[108][107] = 0.078;\r\n\tmatrix[108][109] = 0.080;\r\n\tmatrix[108][112] = 0.087;\r\n\r\n\r\n\r\n\tmatrix[109][100] = 0.127;\r\n\tmatrix[109][108] = 0.080;\r\n\tmatrix[109][110] = 0.081;\r\n\tmatrix[109][111] = 0.088;\r\n\r\n\tmatrix[110][44] = 0.079;\r\n\tmatrix[110][46] = 0.090;\r\n\tmatrix[110][99] = 0.127;\r\n\tmatrix[110][109] = 0.081;\r\n\r\n\r\n\r\n\tmatrix[111][109] = 0.088;\r\n\tmatrix[111][112] = 0.080;\r\n\tmatrix[111][122] = 0.055;\r\n\r\n\r\n\tmatrix[112][49] = 0.085;\r\n\tmatrix[112][108] = 0.087;\r\n\tmatrix[112][113] = 0.078;\r\n\r\n\r\n\tmatrix[113][107] = 0.085;\r\n\tmatrix[113][114] = 0.078;\r\n\tmatrix[113][116] = 0.082;\r\n\r\n\r\n\tmatrix[114][106] = 0.085;\r\n\tmatrix[114][115] = 0.088;\r\n\r\n\r\n\tmatrix[115][114] = 0.088;\r\n\tmatrix[115][116] = 0.078;\r\n\r\n\r\n\tmatrix[116][113] = 0.082;\r\n\tmatrix[116][115] = 0.078;\r\n\tmatrix[116][117] = 0.011;\r\n\r\n\r\n\tmatrix[117][49] = 0.078;\r\n\tmatrix[117][116] = 0.011;\r\n\r\n\r\n\t//\r\n\r\n\tmatrix[118][51] = 0.068;\r\n\tmatrix[118][194] = 0.020;\r\n\r\n\r\n\tmatrix[119][48] = 0.032;\r\n\tmatrix[119][118] = 0.055;\r\n\r\n\r\n\tmatrix[120][28] = 0.087;\r\n\tmatrix[120][30] = 0.056;\r\n\tmatrix[120][68] = 0.098;\r\n\r\n\r\n\tmatrix[121][48] = 0.077;\r\n\tmatrix[121][49] = 0.083;\r\n\tmatrix[121][122] = 0.025;\r\n\r\n\r\n\tmatrix[122][121] = 0.025;\r\n\tmatrix[122][111] = 0.055;\r\n\tmatrix[122][47] = 0.079;\r\n\r\n\r\n\tmatrix[123][45] = 0.117;\r\n\tmatrix[123][118] = 0.190;\r\n\r\n\r\n\tmatrix[124][22] = 0.298;\r\n\tmatrix[124][127] = 0.049;\r\n\tmatrix[124][151] = 0.479;\r\n\r\n\r\n\tmatrix[125][88] = 0.132;\r\n\tmatrix[125][126] = 0.047;\r\n\r\n\r\n\tmatrix[126][125] = 0.047;\r\n\tmatrix[126][86] = 0.133;\r\n\r\n\r\n\tmatrix[127][86] = 0.110;\r\n\r\n\r\n\tmatrix[128][129] = 0.081;\r\n\r\n\r\n\tmatrix[129][128] = 0.081;\r\n\tmatrix[129][130] = 0.109;\r\n\tmatrix[129][131] = 0.052;\r\n\r\n\r\n\tmatrix[130][129] = 0.109;\r\n\tmatrix[130][132] = 0.045;\r\n\r\n\t//\r\n\r\n\tmatrix[131][129] = 0.052;\r\n\tmatrix[131][132] = 0.135;\r\n\r\n\r\n\tmatrix[132][130] = 0.045;\r\n\tmatrix[132][131] = 0.135;\r\n\tmatrix[132][133] = 0.042;\r\n\r\n\t//\r\n\r\n\tmatrix[133][132] = 0.042;\r\n\tmatrix[133][134] = 0.115;\r\n\r\n\r\n\tmatrix[134][133] = 0.115;\r\n\tmatrix[134][135] = 0.032;\r\n\tmatrix[134][140] = 0.071;\r\n\t//\r\n\r\n\tmatrix[135][134] = 0.032;\r\n\tmatrix[135][136] = 0.047;\r\n\tmatrix[135][143] = 0.068;\r\n\r\n\r\n\tmatrix[136][135] = 0.047;\r\n\tmatrix[136][145] = 0.067;\r\n\tmatrix[136][173] = 0.037;\r\n\r\n\r\n\tmatrix[137][149] = 0.068;\r\n\r\n\r\n\tmatrix[138][64] = 0.105;\r\n\tmatrix[138][57] = 0.517;\r\n\r\n\r\n\tmatrix[139][140] = 0.033;\r\n\tmatrix[139][141] = 0.040;\r\n\r\n\r\n\tmatrix[140][134] = 0.072;\r\n\tmatrix[140][139] = 0.033;\r\n\tmatrix[140][143] = 0.036;\r\n\r\n\r\n\tmatrix[141][139] = 0.040;\r\n\tmatrix[141][142] = 0.051;\r\n\tmatrix[141][143] = 0.036;\r\n\tmatrix[141][144] = 0.044;\r\n\r\n\r\n\tmatrix[142][141] = 0.053;\r\n\tmatrix[142][151] = 0.075;\r\n\r\n\tmatrix[143][135] = 0.070;\r\n\tmatrix[143][140] = 0.038;\r\n\tmatrix[143][141] = 0.038;\r\n\tmatrix[143][145] = 0.044;\r\n\r\n\r\n\tmatrix[144][141] = 0.047;\r\n\tmatrix[144][145] = 0.039;\r\n\tmatrix[144][146] = 0.056;\r\n\r\n\r\n\tmatrix[145][143] = 0.044;\r\n\tmatrix[145][174] = 0.039; //norzagay, quezon blvd\r\n\tmatrix[145][144] = 0.037;\r\n\r\n\r\n\tmatrix[146][174] = 0.042; //norzagay, quezon blvd\r\n\tmatrix[146][144] = 0.056;\r\n\r\n\tmatrix[147][135] = 0.067;\r\n\tmatrix[147][148] = 0.037;\r\n\r\n\tmatrix[148][136] = 0.066;\r\n\tmatrix[148][147] = 0.039;\r\n\tmatrix[148][149] = 0.043;\r\n\r\n\tmatrix[149][148] = 0.043;\r\n\r\n\r\n\tmatrix[150][175] = 0.037; //carlos palanca, sr after quezon bridge\r\n\tmatrix[150][153] = 0.047;\r\n\r\n\r\n\tmatrix[151][142] = 0.075;\r\n\tmatrix[151][152] = 0.083;\r\n\tmatrix[151][124] = 0.475;\r\n\r\n\r\n\tmatrix[152][175] = 0.020; //carlos palanca, sr after quezon bridge\r\n\tmatrix[152][151] = 0.083;\r\n\r\n\tmatrix[153][150] = 0.047;\r\n\tmatrix[153][154] = 0.044;\r\n\tmatrix[153][159] = 0.167;\r\n\r\n\tmatrix[154][153] = 0.043;\r\n\tmatrix[154][155] = 0.063;\r\n\r\n\tmatrix[155][154] = 0.063;\r\n\tmatrix[155][156] = 0.042;\r\n\r\n\tmatrix[156][155] = 0.041;\r\n\r\n\tmatrix[157][58] = 0.153;\r\n\tmatrix[157][164] = 0.180;\r\n\r\n\tmatrix[158][160] = 0.090;\r\n\tmatrix[158][159] = 0.053;\r\n\r\n\tmatrix[159][153] = 0.167;\r\n\tmatrix[159][158] = 0.053;\r\n\r\n\tmatrix[160][158] = 0.090;\r\n\tmatrix[160][161] = 0.011;\r\n\r\n\tmatrix[161][160] = 0.011;\r\n\r\n\tmatrix[162][170] = 0.082;\r\n\tmatrix[162][172] = 0.046; //muelle before sta cruz\r\n\r\n\tmatrix[163][162] = 0.067;\r\n\tmatrix[163][169] = 0.085;\r\n\r\n\tmatrix[164][168] = 0.040;\r\n\tmatrix[164][163] = 0.217;\r\n\r\n\tmatrix[165][167] = 0.053;\r\n\r\n\tmatrix[166][67] = 0.181; \r\n\r\n\tmatrix[167][166] = 0.038;\r\n\tmatrix[167][168] = 0.069;\r\n\tmatrix[167][58] = 0.053;\r\n\r\n\tmatrix[168][164] = 0.040;\r\n\tmatrix[168][169] = 0.206;\r\n\tmatrix[168][202] = 0.080;\r\n\r\n\tmatrix[169][163] = 0.083;\r\n\tmatrix[169][170] = 0.054;\r\n\r\n\tmatrix[170][162] = 0.081;\r\n\r\n\r\n\tmatrix[171][88] = 0.160;\r\n\tmatrix[171][124] = 0.273;\r\n\r\n\r\n\tmatrix[172][161] = 0.058;\r\n\r\n\r\n\tmatrix[173][136] = 0.037;\r\n\tmatrix[173][149] = 0.067;\r\n\r\n\r\n\tmatrix[174][145] = 0.038;\r\n\tmatrix[174][173] = 0.067;\r\n\r\n\r\n\tmatrix[175][152] = 0.020;\r\n\tmatrix[175][146] = 0.040;\r\n\tmatrix[175][150] = 0.035;\r\n\r\n\tmatrix[176][29] = 0.042;\r\n\tmatrix[176][31] = 0.093;\r\n\tmatrix[176][177] = 0.076;\r\n\r\n\tmatrix[177][176] = 0.076;\r\n\tmatrix[177][33] = 0.088;\r\n\tmatrix[177][36] = 0.043;\r\n\r\n\tmatrix[178][1] = 0.031;\r\n\tmatrix[178][6] = 0.127;\r\n\r\n\tmatrix[179][1] = 0.014;\r\n\tmatrix[179][8] = 0.130;\r\n\tmatrix[179][9] = 0.257;\r\n\r\n\tmatrix[180][181] = 0.011;\r\n\tmatrix[180][84] = 0.388;\r\n\tmatrix[180][85] = 0.402;\r\n\r\n\tmatrix[181][182] = 0.079;\r\n\tmatrix[181][2] = 0.019;\r\n\r\n\tmatrix[182][3] = 0.014;\r\n\tmatrix[182][4] = 0.103;\r\n\r\n\tmatrix[183][5] = 0.064;\r\n\tmatrix[183][4] = 0.015;\r\n\r\n\tmatrix[184][87] = 0.109;\r\n\r\n\tmatrix[185][70] = 0.061;\r\n\tmatrix[185][186] = 0.061; //dagdag ni Keren\r\n\r\n\tmatrix[186][7] = 0.311;\r\n\r\n\tmatrix[187][186] = 0.008;\r\n\tmatrix[187][185] = 0.195;\r\n\r\n\tmatrix[188][189] = 0.192;\r\n\tmatrix[188][190] = 0.116;\r\n\r\n\tmatrix[189][187] = 0.109;\r\n\r\n\tmatrix[190][25] = 0.146;\r\n\r\n\tmatrix[191][189] = 0.260;\r\n\tmatrix[191][184] = 0.362;\r\n\r\n\tmatrix[192][193] = 0.042;\r\n\tmatrix[192][67] = 0.275;\r\n\tmatrix[192][201] = 0.299;\r\n\r\n\tmatrix[193][192] = 0.042;\r\n\tmatrix[193][195] = 0.083;\r\n\r\n\tmatrix[194][192] = 0.062;\r\n\tmatrix[194][193] = 0.051;\r\n\r\n\tmatrix[195][51] = 0.066;\r\n\r\n\tmatrix[196][65] = 0.399;\r\n\r\n\tmatrix[197][198] = 0.083;\r\n\tmatrix[197][199] = 0.083;\r\n\r\n\tmatrix[198][60] = 0.253;\r\n\r\n\tmatrix[199][59] = 0.326;\r\n\r\n\tmatrix[200][26] = 0.231;\r\n\r\n\tmatrix[201][34] = 0.084;\r\n\r\n\tmatrix[202][58] = 0.082;\r\n\tmatrix[202][168] = 0.080;\r\n\r\n\t//Count the number of adjacencies:\r\n\tvar adjacencyCount = 0;\r\n\tfor(var i = 0; i < matrix.length; i++)\r\n\t\tfor(var j = 0; j < matrix[i].length; j++)\r\n\t\t{\r\n\t\t\tif(matrix[i][j] != 0 && matrix[i][j] != Number.POSITIVE_INFINITY)\r\n\t\t\t{\r\n\t\t\t\tadjacencyCount++;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\tconsole.log(\"Speed matrix adj count: \" + adjacencyCount);\r\n}", "function readVariable(name) {\n\n // Iterate through all values.\n var values = []\n $(name).each(function() {\n\n // Get the floating point value from the cell. If it is not a float\n // then take it as 0.\n var val = parseFloat($(this).val());\n if (isNaN(val)) {\n val = 0;\n }\n values.push(val);\n })\n\n return values;\n\n }", "function getNeighborhood(userLat, userLong, evictionPts) {\n var d = 0.5,\n temp;\n var nearest;\n\n for (var i = 0; i < evictionPts.length; i++) {\n evLat = parseFloat(evictionPts[i]['lat']);\n evLong = parseFloat(evictionPts[i]['long']);\n\n temp = calculateDist(userLat, userLong, evLat, evLong);\n\n if (temp < d) {\n d = temp;\n nearest = evictionPts[i];\n }\n\n }\n //console.log(d);\n return nearest;\n}", "function ParseTheData() {\n\n // Read necessary metadata from the string, error if not found\n let parseError = \"Error reading the data: Metadata not found.\";\n try {\n console.log(\"Reading metadata...\");\n canvasWidth = dataString.match(/(?<=^ncols\\s*)\\d+/);\n if (canvasWidth == null) {\n throw parseError;\n return;\n }\n canvasHeight = dataString.match(/(?<=nrows\\s*)\\d+/);\n if (canvasHeight == null) {\n throw parseError;\n return;\n }\n noDataValue = dataString.match(/(?<=NODATA_value\\s*)-?\\d*\\.\\d+/);\n if (noDataValue == null) {\n throw parseError;\n return;\n }\n\n // Separate elevation data from metadata, only numbers should remain afterwards\n let findTheMatrixRegex = new RegExp(\"(?<=\" + noDataValue.toString() + \"\\\\s*)-?\\\\d+\");\n let indexOfMatrix = dataString.search(findTheMatrixRegex);\n elevationData = dataString.slice(indexOfMatrix);\n console.log(\"Done.\");\n }\n catch (err) {\n throw (err);\n return;\n }\n\n // Turn into an array, check if array size matches metadata\n console.log(\"Converting to array...\");\n let p1 = performance.now();\n console.log(p1);\n elevationData = elevationData.replace(/\\r?\\n/g, \"\");\n elevationData = elevationData.split(\" \");\n console.log(\"Done.\");\n\n if (elevationData.length != canvasHeight * canvasWidth) {\n throw (\"Error: Unexpected map size.\");\n return;\n }\n\n // Convert to float, change NODATA values to NaN\n console.log(\"Converting to float...\");\n elevationData = elevationData.map(parseFloat);\n\n noDataValue = parseFloat(noDataValue);\n elevationData.forEach((_item, index, arr) => {\n if (arr[index] == noDataValue) {\n arr[index] = NaN;\n }\n });\n let p2 = performance.now();\n console.log(p2);\n console.log(p2 - p1);\n console.log(\"Done.\");\n}", "function totalDistance() {\n var distanceSum = 0;\n for (let index = 0; index < distancesPointToPoint.length; index++) { //iterationg over the distances\n distanceSum += distancesPointToPoint[index]; //add the distance\n }\n distanceSum = Math.round(distanceSum * 1000) / 1000;\n return distanceSum;\n}", "function importData() {\n var raw_data = $('#datatable').val().trim();\n \n try {\n importPoints(JSON.parse(raw_data));\n return;\n } catch(err) {\n \n // sanitize data and treat as OmniGraphSketcher format\n var points = [];\n var data = raw_data.split('\\n');\n if (data.length === 0) return;\n $.each(data, function(i,o) {\n var point = o.split(/[,\\ \\t]+/);\n if (point.length === 0) return;\n if (!point[0]) return;\n point = $.map(point, function(o,i) { return o*1; }); // cast to float\n points.push(point);\n });\n importPoints(points);\n }\n}", "function readFloatInName(cardName){\n\treturn parseFloat(cardName.replace(',','.').match(/\\(([^)]+)\\)/)[1]);\n}", "function bits_to_float(bits) {\n intbuf[0] = bits;\n return fltbuf[0];\n}", "function getPointsList(){\n var t = js_data;\n var tmp=JSON.parse(js_data);\n\n let power = 2147483648;\n \n let pointslist = [];//[-75, 37,-95, 36,-125, 37];\n\n for(x in tmp){\n \n var z=tmp[x];\n var lat= z.fields.position_lat; // * ( 180 / power );\n var lon= z.fields.position_long; // * ( 180 / power );\n //var alt = z.fields.altitude;\n pointslist.push(lon);\n pointslist.push(lat);\n // pointslist.push(alt);\n }\n return pointslist;\n \n}", "function calculateRoute(data) {\n // get boat position\n var lat2 = boatPos[0];\n var lon2 = boatPos[1];\n\n // push the boat to the route array as starting point\n route.push([\"boat\", 0, lat2, lon2])\n\n // push the points from the json file to a new array\n // this format is easier to use later on in the code\n for(let point of data.points){\n let location = new Array();\n location[0] = point.title;\n // leave location[1] clear for the distance\n location[2] = point.lat;\n location[3] = point.lon;\n points.push(location);\n }\n \n // 2. & 3. loop through points and calculate distance between last route item\n while(points.length > 0){\n var lastRouteItem = route.length - 1; \n var nextPoint = calcPoint(route[lastRouteItem]);\n // 2.1 add the nearest point to the previous point to the route array\n route.push(nextPoint);\n }\n\n // log the final route\n console.log(\"Route: \");\n console.log(route);\n\n return route;\n}", "function parseCoordinates(mapId) {\n var coordsField = $('#map-coords-field-' + mapId).val(); // read values from mak\n var coordsFormat = $('#map-coords-format-' + mapId).val();\n\n // Regex inspiration by: http://www.nearby.org.uk/tests/geotools2.js\n\n // It seems to be necessary to escape the values. Otherwise, the degree\n // symbol (°) is not recognized.\n var str = escape(coordsField);\n // However, we do need to replace the spaces again do prevent regex error.\n str = str.replace(/%20/g, ' ');\n\n var pattern, matches;\n var latsign, longsign, d1, m1, s1, d2, m2, s2;\n var latitude, longitude, latlong;\n\n if (coordsFormat === '1') {\n // 46° 57.1578 N 7° 26.1102 E\n pattern = /(\\d+)[%B0\\s]+(\\d+\\.\\d+)\\s*([NS])[%2C\\s]+(\\d+)[%B0\\s]+(\\d+\\.\\d+)\\s*([WE])/i;\n matches = str.match(pattern);\n if (matches) {\n latsign = (matches[3] === 'S') ? -1 : 1;\n longsign = (matches[6] === 'W') ? -1 : 1;\n d1 = parseFloat(matches[1]);\n m1 = parseFloat(matches[2]);\n d2 = parseFloat(matches[4]);\n m2 = parseFloat(matches[5]);\n latitude = latsign * (d1 + (m1 / 60.0));\n longitude = longsign * (d2 + (m2 / 60.0));\n latlong = [latitude, longitude];\n }\n } else if (coordsFormat === '2') {\n // 46° 57' 9.468\" N 7° 26' 6.612\" E\n pattern = /(\\d+)[%B0\\s]+(\\d+)[%27\\s]+(\\d+\\.\\d+)[%22\\s]+([NS])[%2C\\s]+(\\d+)[%B0\\s]+(\\d+)[%27\\s]+(\\d+\\.\\d+)[%22\\s]+([WE])/i;\n matches = str.match(pattern);\n if (matches) {\n latsign = (matches[4] === 'S') ? -1 : 1;\n longsign = (matches[8] === 'W') ? -1 : 1;\n d1 = parseFloat(matches[1]);\n m1 = parseFloat(matches[2]);\n s1 = parseFloat(matches[3]);\n d2 = parseFloat(matches[5]);\n m2 = parseFloat(matches[6]);\n s2 = parseFloat(matches[7]);\n latitude = latsign * (d1 + (m1 / 60.0) + (s1 / (60.0 * 60.0)));\n longitude = longsign * (d2 + (m2 / 60.0) + (s2 / (60.0 * 60.0)));\n latlong = [latitude, longitude];\n }\n } else if (coordsFormat === '3') {\n // N 46° 57.1578 E 7° 26.1102\n pattern = /([NS])\\s*(\\d+)[%B0\\s]+(\\d+\\.\\d+)[%2C\\s]+([WE])\\s*(\\d+)[%B0\\s]+(\\d+\\.\\d+)/i;\n matches = str.match(pattern);\n if (matches) {\n latsign = (matches[1] === 'S') ? -1 : 1;\n longsign = (matches[4] === 'W') ? -1 : 1;\n d1 = parseFloat(matches[2]);\n m1 = parseFloat(matches[3]);\n d2 = parseFloat(matches[5]);\n m2 = parseFloat(matches[6]);\n latitude = latsign * (d1 + (m1 / 60.0));\n longitude = longsign * (d2 + (m2 / 60.0));\n latlong = [latitude, longitude];\n }\n } else if (coordsFormat === '4') {\n // N 46° 57' 9.468\" E 7° 26' 6.612\"\n pattern = /([NS])\\s*(\\d+)[%B0\\s]+(\\d+)[%27\\s]+(\\d+\\.\\d+)[%22%2C\\s]+([WE])\\s*(\\d+)[%B0\\s]+(\\d+)[%27\\s]+(\\d+\\.\\d+)/i;\n matches = str.match(pattern);\n if (matches) {\n latsign = (matches[1] === 'S') ? -1 : 1;\n longsign = (matches[5] === 'W') ? -1 : 1;\n d1 = parseFloat(matches[2]);\n m1 = parseFloat(matches[3]);\n s1 = parseFloat(matches[4]);\n d2 = parseFloat(matches[6]);\n m2 = parseFloat(matches[7]);\n s2 = parseFloat(matches[8]);\n latitude = latsign * (d1 + (m1 / 60.0) + (s1 / (60.0 * 60.0)));\n longitude = longsign * (d2 + (m2 / 60.0) + (s2 / (60.0 * 60.0)));\n latlong = [latitude, longitude];\n }\n } else if (coordsFormat === '5') {\n // 46.95263, 7.43517\n pattern = /(\\d+\\.\\d+)[%2C\\s]+(\\d+\\.\\d+)/i;\n matches = str.match(pattern);\n if (matches) {\n latlong = [matches[1], matches[2]];\n }\n }\n\n if (latlong != null) {\n var mapOptions = getMapOptionsById(mapId);\n zoomAddSearchMarker(mapOptions, L.latLng(latlong), true);\n showParseFeedback(mapId, 'Coordinates successfully parsed.', 'success');\n } else {\n showParseFeedback(mapId, tForInvalidFormat, 'error');\n }\n return false;\n}", "function toFloat(valor) {\n\t\treturn parseFloat(valor.replace('R$ ', '').replace('.', '').replace(',', '.'));\n\t}", "function readFile(){\n fs.readFile(\"random.txt\", \"utf8\", function(error, data){\n var dataArr = data.split(\",\");\n console.log(dataArr);\n searchSpotify(dataArr[1])\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 }", "function getDistorsionValue() {\n var pos = logToPos(k);\n return parseFloat(pos).toFixed(1);\n }", "function displayDist(){\n \n const points=getPoints();\n\n for (let i=1; i<points.length; i++) {\n const p1 = points[i-1];\n const p2 = points[i];\n // NB points[i] is derived from latlong2 \n const distElement = document.getElementById(`dist${i}`);\n const bearingElement = document.getElementById(`bearing${i}`);\n\n let dist = null;\n let bearing=null;\n if (p1 && p2) {\n dist=haversine(p1,p2);\n dist=`${parseInt(dist)}m`;\n\n bearing = calcBearing(p1,p2);\n bearing =`${parseInt(bearing)}°`;\n }\n distElement.innerText=dist;\n bearingElement.innerText=bearing;\n }\n}", "function getNearestPoints(from, to) {\n var fromPoint = getAttachPointes(from),\n toPoint = getAttachPointes(to),\n nearest = false,\n collector,\n current;\n\n if(fromPoint !== null && toPoint !== null) {\n angular.forEach(fromPoint, function (f, fi) {\n angular.forEach(toPoint, function (t, ti) {\n current = Math.max(Math.abs(f.x - t.x), Math.abs(f.y - t.y)); // Calculate distance between points\n if (!nearest || current < nearest) {\n nearest = current; // update the lower value of distance between points\n collector = { // Set the index of the nearest point until now\n \"from\": fi,\n \"to\": ti\n };\n }\n });\n });\n return [fromPoint[collector.from], toPoint[collector.to]];\n }\n else {\n return null;\n }\n }", "function calculateDistance(locationOfInterest, data) {\n return _.map(data, (foodtruck)=> {\n foodtruck.distance =\n geodist(locationOfInterest,\n {lat:foodtruck.Latitude, lon: foodtruck.Longitude},\n {exact: true, unit: 'miles'});\n return foodtruck;\n });\n}", "initDataDist(distancesMatrix) {\n\t\t\tconst N = distancesMatrix.length;\n\t\t\tassert(N > 0, ' X is empty? You must have some data!');\n\t\t\t// convert D to a (fast) typed array version\n\t\t\tconst convertedDistances = zeros(N * N); // allocate contiguous array\n\t\t\tfor (let i = 0; i < N; i++) {\n\t\t\t\tfor (let j = i + 1; j < N; j++) {\n\t\t\t\t\tconst d = distancesMatrix[i][j];\n\t\t\t\t\tconvertedDistances[i * N + j] = d;\n\t\t\t\t\tconvertedDistances[j * N + i] = d;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.P = d2p(convertedDistances, this.perplexity, 1e-4);\n\t\t\tthis.N = N;\n\t\t\tthis.initSolution(); // refresh this\n\t\t}", "ParseFloat(s){\r\n\t\tif(s == '' || s == 'undefined' || s == null){\r\n\t\t\treturn 0.0;\r\n\t\t}\r\n\t\t\r\n\t\tvar chr, ss = '', i, l = s.length;\r\n\t\ts = s.toString();\r\n\t\tfor(i = 0; i < l; i += 1){\r\n\t\t\tchr = s.charAt(i);\r\n\t\t\tif(((chr >= '0') && (chr <= '9')) || chr == '.' || chr == '-') {\r\n\t\t\t\tss += chr;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn parseFloat(ss);\r\n\t}", "parse (array = []) {\r\n // If already is an array, no need to parse it\r\n if (array instanceof Array) return array\r\n\r\n return array.trim().split(delimiter).map(parseFloat)\r\n }", "function getAccelerometerValues() {\n acc.onreading = () => {\n xval.innerHTML = acc.x.toFixed(3);\n yval.innerHTML = acc.y.toFixed(3);\n zval.innerHTML = acc.z.toFixed(3);\n // Data must be sent on reading!\n this.sendValues();\n }\n acc.start();\n}", "function parseFloatList(a) {\n\tfor (let i = 0; i < a.length; i++) {\n\t\ta[i] = parseFloat(a[i]);\n\t}\n\treturn a;\n}", "function distanceTravelledInFeet(start, destination) {\n let result = Math.abs(start - destination) * 264;\n // console.log('start:', start);\n // console.log('dest: ', destination);\n // console.log('result: ', result);\n return result;\n}", "async GetValueDouble(id, command) {\n var packet = new DpsPacket(id, DpsConstants.sender, command, [0,0,0,0,0,0,0,0]);\n var result = await this.PacketIO(packet);\n if ((result && (result.sender != id || result.command != command)) || result == null) return null;\n else {\n var buf = new ArrayBuffer(8);\n var view = new DataView(buf);\n for (var i = 0; i < 8; i++) {\n view.setUint8(7 - i, result.data[i]);\n }\n return view.getFloat64(0);\n }\n }", "function parseInput() {\n return fs.readFileSync('day05/day05.txt', 'utf8')\n .split(',')\n .map(x => parseInt(x));\n}", "function logInfo(info) {\n var sum = 0;\n for (i = 0; i < info.length; i++) {\n sum += parseFloat(info[i].replace(/[^0-9\\.]+/g, \"\"));\n }\n document.getElementById(\"resultDiv\").innerHTML=sum;\n}", "function processPinProximData()\n \t{\n \t\tvar pinData = null;\n \t\t\n \t\t// Reads the specified pin data from buffer\n \t\tpinData = storedData.pinA2;\n \t\t\n \t\tvar analogVal = ((pinData[0] & 0xFF) << 8) | (pinData[1] & 0xFF); // Combines high and low bytes\n \t\t\n \t\t// Convert analog value into the number of volts (2.048 = 0.01V)\n \t\tanalogVal = analogVal / 2.048 / 100;\n \t\t\n \t\tconsole.log(analogVal);\n \t\t// If analog value is valid, calculate corresponding distance else return 0\n \t\tif(analogVal < 3.5 && analogVal > 0)\n \t\t{\n \t\t\treturn Math.pow((analogVal / 15.556), (1/-0.832));\n \t\t}\n \t\telse\n \t\t{\n \t\t\treturn 0;\n \t\t}\n \t\t\n \t}", "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 float(v) {\n\treturn v ? parseFloat(v.toString().replace(/[^\\d.-]/g, '')) || 0 : 0;\n}", "function extract_price(source, fromText) {\n var priceRegex = /\\d+\\.\\d+|\\d+\\,\\d+\\.\\d+|\\d/ // extracts first price in XX.XX or X,XXX.XX or XXXX format\n var substr = source.substring(source.indexOf(fromText))\n var price = substr.match(priceRegex)\n return parseFloat(price)\n}", "function getDistance(location) {\n return Math.abs(location[0]) + Math.abs(location[1]);\n}", "GetDistanceToPoint() {}" ]
[ "0.6266799", "0.58963054", "0.55773324", "0.5534366", "0.5458368", "0.5421081", "0.5285426", "0.52673453", "0.5235717", "0.52149403", "0.5201872", "0.51820207", "0.5136303", "0.5061028", "0.5058574", "0.5051513", "0.50466347", "0.50391406", "0.5024825", "0.496351", "0.49588543", "0.49497175", "0.4940734", "0.49277315", "0.48858473", "0.4848352", "0.48481458", "0.48235914", "0.4815545", "0.4795796", "0.47919223", "0.4784295", "0.47825408", "0.4753582", "0.47380587", "0.47336367", "0.47211584", "0.4719669", "0.47135192", "0.47134548", "0.4702258", "0.46952704", "0.46859154", "0.4675202", "0.4662124", "0.4662034", "0.46508628", "0.46507218", "0.4636721", "0.46366018", "0.46292007", "0.46269238", "0.46252084", "0.46243522", "0.46223515", "0.4621608", "0.4604886", "0.4592605", "0.45923778", "0.4589815", "0.45726916", "0.45721927", "0.45697218", "0.45691177", "0.45529303", "0.4537589", "0.4531817", "0.4524773", "0.4522283", "0.4514701", "0.45024177", "0.45019317", "0.45009443", "0.44965258", "0.44846132", "0.4480067", "0.44795772", "0.4479125", "0.44762638", "0.44686922", "0.44612056", "0.44581354", "0.44519356", "0.44417614", "0.44363326", "0.44337875", "0.4432043", "0.44294113", "0.44271284", "0.4424601", "0.44235086", "0.44230402", "0.44125777", "0.44093198", "0.44090715", "0.44069305", "0.44055778", "0.4402026", "0.4399775", "0.4395111" ]
0.6627487
0
Gets time, distance, and depth
async function grabIndData(Float){ let dataArr=[]; let data = await fetchAndDecodeFloatData(`https://geoweb.princeton.edu/people/sk8609/DEVearthscopeoceans/data/FloatInfo/${Float}.txt`, 'text'); tempArr = data.split('\n'); for(let i=0; i<tempArr.length;i++){ let splitArr = tempArr[i].split(' '); dataArr.push([parseInt(splitArr[0]), parseFloat(splitArr[1]), parseInt(splitArr[2]), parseInt(splitArr[3]), parseFloat(splitArr[4]), parseInt(splitArr[5])]); } return dataArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get Depth() {}", "get time ()\n\t{\n\t\tlet speed = parseInt (this.token.actor.data.data.attributes.movement.walk, 10);\n\t\t\n\t\tif (! speed)\n\t\t\tspeed = 30;\n\n\t\treturn speed / this.gridDistance;\n\t}", "get distance() {}", "function DISTANCE(here, there) {\n \n var mapObj = Maps.newDirectionFinder();\n mapObj.setOrigin(here);\n mapObj.setDestination(there);\n \n var directions = mapObj.getDirections();\n var getTheLeg = directions[\"routes\"][0][\"legs\"][0];\n var mins = getTheLeg[\"duration\"][\"text\"];\n \n return mins;\n}", "distance() {\n return this.speed * this.duration() / 3600000;\n }", "get distance() {\n return this.object3d.children[0].children[0].position.z;\n }", "function getDistance(){\n if (departure.value == \"dep-auck\" && destination.value == \"dest-taup\" || departure.value == \"dep-taup\" && destination.value == \"dest-auck\"){\n tripDistance = distance.taupAuck;\n }\n else if (departure.value == \"dep-well\" && destination.value == \"dest-taup\" || departure.value == \"dep-taup\" && destination.value == \"dest-well\"){\n tripDistance = distance.wellTaup;\n }\n else if (departure.value == \"dep-well\" && destination.value == \"dest-auck\" || departure.value == \"dep-auck\" && destination.value == \"dest-well\"){\n tripDistance = distance.auckWell;\n }\n }", "function calcRouteTime() {\n\tif (route.directions == null)\n\t\treturn 0;\n\tvar time = 0;\n\tfor (var i = 0; i < route.directions.length; i++) {\n\t\ttime += route.directions[i].time;\n\t}\n\treturn time;\n}", "get planeDistance() {}", "getspeed() {\n\t\tif(this.vars.alive){\n\t\t\treturn distance(this.vars.x,this.vars.y,this.vars.px,this.vars.py);\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n\t}", "getDepth() {\n return this.depth;\n }", "get depth() {}", "function _depth() { \n\t\t\t\t\treturn Math.max( Math.min( _pointA.z, _pointB.z ), 0.0001 ); \n\t\t\t\t}", "calculer_distance() {}", "calcSpeed(){\n\treturn this.distance/(this.time/60);//miles per hour\n }", "function getDistanceTime(x, y) {\n console.log(\"getDistanceTime function ran\");\n var directionsService = new google.maps.DirectionsService();\n var request = {\n origin: x, // a city, full address, landmark etc\n destination: y,\n travelMode: google.maps.DirectionsTravelMode.DRIVING,\n };\n\n directionsService.route(request, function(response, status) {\n console.log(\"****routing****\");\n if (status == google.maps.DirectionsStatus.OK) {\n console.log(response);\n var distance = response.routes[0].legs[0].distance.text;\n var duration = response.routes[0].legs[0].duration.text;\n $(\"#theDistance\").text(distance);\n $(\"#theDuration\").text(duration);\n //Drive Cost\n var driveDistance = parseInt(distance);\n console.log(\"distance: \" + distance);\n var gasPrice = 2.50;\n var driveCost = (driveDistance / mpg) * gasPrice;\n console.log(\"**********************\")\n console.log(\"drivecost: \" + driveCost);\n console.log(\"mpg: \" + mpg);\n console.log(\"***********************\")\n $(\"#gascost\").text(\"$\" + driveCost.toFixed(2));\n\n }\n else {\n alert(\"getDistanceTime failed\")\n }\n\n });\n }", "updateDepthInformation() {\n Log(\"Analyzing distance from Central Note. CN path: \" +\n this.settings.get(\"CN_path\"));\n let depth = 0; // distance from the CN. starts at zero\n let checked_links = []; // all the notes that have already been visited. dont visit them again to prevent endless loops\n let do_continue = true;\n // start at the the CN\n let links = [this.settings.get(\"CN_path\")];\n while (do_continue) {\n let next_links = [];\n links.forEach((link) => {\n // extract all active and passive connections (linked to or from) for the next iteration of link-following\n let note = this.getNoteFromPath(link);\n note.links_to.forEach((link) => {\n if (!checked_links.contains(link) && !next_links.contains(link)) {\n next_links.push(link);\n }\n });\n note.linked_from.forEach((link) => {\n if (!checked_links.contains(link) && !next_links.contains(link)) {\n next_links.push(link);\n }\n });\n // update the info on how far the note is removed from CN\n if (note.distance_from_CN == null || note.distance_from_CN > depth) {\n note.distance_from_CN = depth;\n }\n checked_links.push(link);\n });\n links = next_links.slice();\n if (links.length == 0) {\n do_continue = false;\n }\n depth += 1;\n }\n }", "function getTotalDistance (result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total /= 1000;\n return total;\n}", "_getDistance (timeElapsed) {\r\n const currentSeg = this._dna[this._getSegIndex(timeElapsed)]\r\n const distInThisSeg = (timeElapsed - currentSeg.startTime) / (currentSeg.pace * 60 / 1000)\r\n return currentSeg.startDistance + distInThisSeg\r\n }", "function Pathfinder() {\n this.calculateDistancesFromIndex = function (start) {\n let frontier = new Set();\n const distances = [];\n frontier.add(start);\n distances[ start ] = 0;\n\n let neighbors = neighborsForIndex(start);\n let currentDistance = 1;\n\n while (frontier.size <= levelList[ levelNow ].length) {\n let newNeighbors = [];\n for (let i = 0; i < neighbors.length; i++) {\n const frontierSize = frontier.size;\n frontier.add(neighbors[ i ]);\n if (frontier.size > frontierSize) {\n distances[ neighbors[ i ] ] = currentDistance;\n newNeighbors = newNeighbors.concat(neighborsForIndex(neighbors[ i ]));\n }\n }\n\n neighbors = newNeighbors;\n\n currentDistance++;\n }\n\n let string = \"\";\n for (let j = 0; j < levelList[ levelNow ].length; j++) {\n let distString = distances[ j ].toString();\n if (distString.length < 2) {\n distString = (\"0\" + distString);\n }\n\n distString += \", \";\n string += distString;\n if ((j + 1) % ROOM_COLS == 0) {\n string += \"\\n\";\n }\n }\n// console.log(string);//Temporary\n };\n\n const neighborsForIndex = function (index) {\n const result = [];\n const above = indexAboveIndex(index);\n if (above != null) {\n result.push(above);\n }\n const below = indexBelowIndex(index);\n if (below != null) {\n result.push(below);\n }\n const left = indexLeftofIndex(index);\n if (left != null) {\n result.push(left);\n }\n const right = indexRightOfIndex(index);\n if (right != null) {\n result.push(right);\n }\n\n return result;\n };\n\n const indexAboveIndex = function (index) {\n const result = index - ROOM_COLS;\n if (result < 0) {\n return null;\n } else {\n return result;\n }\n };\n\n const indexBelowIndex = function (index) {\n const result = index + ROOM_COLS;\n if (result > levelList[ levelNow ].length) {\n return null;\n } else {\n return result;\n }\n };\n\n const indexLeftofIndex = function (index) {\n const result = index - 1;\n if (result < 0) {\n return null;\n } else {\n return result;\n }\n };\n\n const indexRightOfIndex = function (index) {\n const result = index + 1;\n if (result > levelList[ levelNow ].length) {\n return null;\n } else {\n return result;\n }\n }\n}", "setDepths() {\n this.room2_floor.setDepth(0);\n this.room2_character_north.setDepth(50);\n this.room2_character_east.setDepth(50);\n this.room2_character_south.setDepth(50);\n this.room2_character_west.setDepth(50);\n this.room2_E_KeyImg.setDepth(49);\n this.room2_activity1A.setDepth(100);\n\t// this.room2_activity1B.setDepth(100);\n\t// this.room2_activity1C.setDepth(100);\n\t// this.room2_activity1D.setDepth(100);\n this.room2_activity2A.setDepth(100);\n this.room2_activity2B.setDepth(100);\n\t// this.room2_activity2C.setDepth(100);\n\t// this.room2_activity2D.setDepth(100);\n this.room2_activity3A.setDepth(100);\n this.room2_activity3B.setDepth(100);\n this.room2_activity4A.setDepth(100);\n this.room2_activity4B.setDepth(100);\n\t// this.room2_activity4C.setDepth(100);\n\t// this.room2_activity4D.setDepth(100);\n\t// this.room2_activity4E.setDepth(100);\n this.room2_activity5A.setDepth(100);\n this.room2_activity5B.setDepth(100);\n\t// this.room2_activity5C.setDepth(100);\n\t// this.room2_activity5D.setDepth(100);\n\t// this.room2_activity5E.setDepth(100);\n\t// this.room2_activity5F.setDepth(100);\n this.room2_activity6A.setDepth(100);\n this.room2_activity6B.setDepth(100);\n this.room2_activity6C.setDepth(100);\n this.room2_activity6D.setDepth(100);\n this.room2_activity6E.setDepth(100);\n this.room2_map.setDepth(100);\n this.room2_notebook.setDepth(100);\n this.room2_help_menu.setDepth(100);\n this.countCoin.setDepth(0);\n\t this.returnDoor.setDepth(1);\n\t this.profile.setDepth(0);\n\n }", "function positionInformation(rowID) {\n var distance = 0;\n var prevLat = null;\n var prevLon = null;\n var firstTime = 0;\n var lastTime = 0;\n var nbPositions = 0;\n var rs = global.db.execute('SELECT Latitude, Longitude, Date ' +\n 'FROM Positions WHERE TimeID = (?) ' +\n 'ORDER BY Date', [rowID]);\n\n while (rs.isValidRow()) {\n nbPositions++;\n var lat = rs.field(0);\n var lon = rs.field(1);\n var date = rs.field(2);\n\n if (firstTime != 0) {\n distance += haversineDistance(prevLat, prevLon, lat, lon);\n } else {\n firstTime = date;\n }\n prevLat = lat;\n prevLon = lon;\n lastTime = date;\n rs.next();\n }\n\n var secTime = (lastTime - firstTime) / 1000;\n var averageSpeed = ((distance * 3600) / secTime);\n var roundedDistance = (((distance*1000)|0)/1000);\n var roundedSpeed = ((averageSpeed*1000)|0)/1000;\n\n var description = \" (\" + roundedDistance + \" km)\";\n description += \"<br>Average speed: \" + roundedSpeed + \" km/h\";\n description += \"<br>\" + nbPositions + \" positions saved\";\n\n return description;\n}", "getNeighborDistance(node1, node2) {\n const R = 6371e3; // meters\n const phi1 = node1.y * Math.PI / 180;\n const phi2 = node2.y * Math.PI / 180;\n const deltaLat = (node2.y - node1.y) * Math.PI / 180;\n const deltaLong = (node2.x - node1.x) * Math.PI / 180;\n\n const a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) +\n Math.cos(phi1) * Math.cos(phi2) *\n Math.sin(deltaLong / 2) * Math.sin(deltaLong / 2);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n const distance = R * c;\n\n // 150 lb person burns 4 calories/minute @ 1.34112 meters/sec. (https://caloriesburnedhq.com/calories-burned-walking/)\n // For every 1% of grade, increase calories burned by about 0.007456472% more calories per meter for a 150-pound person (https://www.verywellfit.com/how-many-more-calories-do-you-burn-walking-uphill-3975557) \n let secondsToTravel = (distance / 1.34112);\n let percentGrade = (node2.elevation - node1.elevation) / distance || 1;\n let calorieMultiplierFromElevation = 0.00007456472 / percentGrade / 100;\n let caloriesBurned = (4 / 60) * secondsToTravel;\n caloriesBurned += (calorieMultiplierFromElevation * caloriesBurned);\n\n return {\n distance: distance,\n calories: caloriesBurned,\n grade: percentGrade\n };\n }", "function getTransitionTime (distance, speed) {\n return distance / speed * 1000;\n}", "get depth() {\n return this._depth;\n }", "get depth() {\n return this._depth;\n }", "function TNodes_doFindClosestLineDistance(nd,direction){\n var mysplit=nd.Parent;\n var myupnode=nd.Parent.UpNode;\n var mydownnode=nd; \n var resultnode={};\n \n // TOP ********************************************************\n if (direction=='top'){\n resultnode=myupnode; \n \n if (myupnode.HasChild==true){\n var ot=mysplit.Orientation;\n var maxTD=mydownnode.TopDistance - myupnode.Height;\n\n //console.log(mysplit.AbsoluteIndex + '.top element -> maxTD:' + maxTD); \n \n var n=(mydownnode.HasChild)?mydownnode.Child.AbsoluteIndex-1:this.Count;\n for (var i=myupnode.Child.AbsoluteIndex;i<=n;i++){\n if (this.Item[i].Level<=mysplit.Level) {\n break;\n }\n if (ot==this.Item[i].Orientation){\n if (this.Item[i].UpNode.TopDistance + this.Item[i].UpNode.Height>=maxTD){\n maxTD=this.Item[i].UpNode.TopDistance + this.Item[i].UpNode.Height;\n resultnode=this.Item[i].UpNode;\n //console.log(this.Item[i].UpNode.Ident + ' ' + i + '.top element -> maxTD:' + maxTD); \n }\n } \n }\n }\n //console.log('top: max topdistance -->' + maxTD + ' | ' + 'top resultnode->' ,resultnode);\n\n if (nd.Parent.AbsoluteIndex==resultnode.Parent.AbsoluteIndex){\n var upinterval=myupnode.Height + mydownnode.Height - zeroConstants.mingridheight \n }else{\n var upinterval=nd.Height + nd.TopDistance - resultnode.TopDistance - resultnode.Height - zeroConstants.mingridheight;\n }\n \n return upinterval;\n \n } // end top\n\n // BOTTOM *************************************\n if (direction=='bottom'){\n resultnode=mydownnode; \n \n if (mydownnode.HasChild==true){\n var ot=mysplit.Orientation;\n var minTD=mydownnode.TopDistance + mydownnode.Height;\n\n //console.log(mysplit.AbsoluteIndex + '.bottom element -> minTD:' + minTD); \n\n for (var i=mydownnode.Child.AbsoluteIndex;i<=this.Count; i++){\n if (this.Item[i].Level<=mysplit.Level) {\n break;\n }\n if (ot==this.Item[i].Orientation){\n if (this.Item[i].DownNode.TopDistance<=minTD){\n minTD=this.Item[i].DownNode.TopDistance;\n resultnode=this.Item[i].DownNode;\n //console.log(this.Item[i].DownNode.Ident + ' ' + i + '.element -> minTD:' + minTD); \n }\n } \n }\n }\n //console.log('bottom: min topdistance -->' + minTD + ' | ' + 'bottom resultnode -->' ,resultnode);\n\n if (nd.Parent.AbsoluteIndex==resultnode.Parent.AbsoluteIndex){\n var downinterval=zeroConstants.mingridheight; \n }else{\n if (nd.TopDistance>resultnode.TopDistance){\n alert('negative distance during finding bottomline ');\n downinterval=zeroConstants.mingridheight;\n }else{\n var downinterval=nd.Height - (resultnode.TopDistance - nd.TopDistance) + zeroConstants.mingridheight;\n }\n }\n\n return downinterval;\n \n }// end bottom\n\n\n // LEFT ********************************************************\n if (direction=='left'){\n resultnode=myupnode; \n \n if (myupnode.HasChild==true){\n var ot=mysplit.Orientation;\n var maxLD=mydownnode.LeftDistance - myupnode.Width;\n\n //console.log(mysplit.AbsoluteIndex + '.left element -> maxLD:' + maxLD); \n \n var n=(mydownnode.HasChild)?mydownnode.Child.AbsoluteIndex-1:this.Count;\n for (var i=myupnode.Child.AbsoluteIndex;i<=n;i++){\n if (this.Item[i].Level<=mysplit.Level) {\n break;\n }\n if (ot==this.Item[i].Orientation){\n if (this.Item[i].UpNode.LeftDistance + this.Item[i].UpNode.Width>=maxLD){\n maxLD=this.Item[i].UpNode.LeftDistance + this.Item[i].UpNode.Width;\n resultnode=this.Item[i].UpNode;\n //console.log(this.Item[i].UpNode.Ident + ' ' + i + '.left element -> maxLD:' + maxLD); \n }\n } \n }\n }\n //console.log('left max leftdistance -->' + maxLD + ' | ' + 'left resultnode->' ,resultnode);\n\n if (nd.Parent.AbsoluteIndex==resultnode.Parent.AbsoluteIndex){\n var upinterval=myupnode.Width + mydownnode.Width - zeroConstants.mingridwidth; \n }else{\n var upinterval=nd.Width + (nd.LeftDistance - resultnode.LeftDistance) - resultnode.Width - zeroConstants.mingridwidth;\n\n if (upinterval<zeroConstants.mingridwidth){\n console.log('negative distance during finding rightline '); \n upinterval=zeroConstants.mingridwidth;\n } \n }\n \n return upinterval;\n\n } // end left\n \n // RIGHT *************************************\n if (direction=='right'){\n resultnode=mydownnode; \n \n if (mydownnode.HasChild==true){\n var ot=mysplit.Orientation;\n var minLD=mydownnode.LeftDistance + mydownnode.Width;\n\n //console.log(mysplit.AbsoluteIndex + '.right element -> minLD:' + minLD); // + ' minTD:' + minTD); \n\n for (var i=mydownnode.Child.AbsoluteIndex;i<=this.Count; i++){\n if (this.Item[i].Level<=mysplit.Level) {\n break;\n }\n if (ot==this.Item[i].Orientation){\n if (this.Item[i].DownNode.LeftDistance<=minLD){\n minLD=this.Item[i].DownNode.LeftDistance;\n resultnode=this.Item[i].DownNode;\n //console.log(this.Item[i].DownNode.Ident + ' ' + i + '.element -> minLD:' + minLD); // + ' minTD:' + minTD); \n }\n } \n }\n }\n //console.log('right: min leftdistance -->' + minLD + ' | ' + 'right resultnode->' ,resultnode);\n \n if (nd.Parent.AbsoluteIndex==resultnode.Parent.AbsoluteIndex){\n var downinterval=zeroConstants.mingridwidth; \n }else{\n var downinterval=nd.Width - (resultnode.LeftDistance - nd.LeftDistance) + zeroConstants.mingridwidth;\n \n if (downinterval<zeroConstants.mingridwidth){\n console.log('negative distance during finding rightline '); \n downinterval=zeroConstants.mingridwidth;\n }\n }\n\n return downinterval;\n\n }// end right\n \n }", "getUsedDepth() {\n return this.usedDepth;\n }", "getRouteInformation() {\n const route = this.props.route;\n const data = {\n startingStop: this.getStartingStop(route),\n endingStop: this.getEndingStop(route),\n departTime: this.calculateDepartArive(route),\n arrivalTime: this.calculateArrivalTime(route),\n busInfo: this.routeType(route)\n }\n return data;\n }", "function getDepth(mag) {\n return (mag/10) \n }", "function calcSpeed(distance, time){\n return distance/time;\n}", "get depth() {\n\t\treturn this._depth;\n\t}", "function getDistance(data) {\n var nextStopId = data.data.entry.status.nextStop;\n var prevStopId = data.data.entry.schedule.stopTimes[0].stopId;\n var prevStopTime = data.data.entry.schedule.stopTimes[0].arrivalTime;\n var prevStopDist = data.data.entry.schedule.stopTimes[0].distanceAlongTrip;\n var i = 0;\n while(i < data.data.entry.schedule.stopTimes.length - 1 && data.data.entry.schedule.stopTimes[i].stopId != nextStopId) {\n prevStopId = data.data.entry.schedule.stopTimes[i].stopId;\n prevStopTime = data.data.entry.schedule.stopTimes[i].arrivalTime;\n prevStopDist = data.data.entry.schedule.stopTimes[i].distanceAlongTrip;\n i++;\n }\n nextStopTime = data.data.entry.schedule.stopTimes[i].arrivalTime;\n nextStopDist = data.data.entry.schedule.stopTimes[i].distanceAlongTrip;\n if(i == 0) return data.data.entry.schedule.stopTimes[data.data.entry.schedule.stopTimes.length - 1].distanceAlongTrip - prevStopDist;\n return nextStopDist - prevStopDist;\n}", "calculateDepth() {\n for (let object of this.objects) {\n if (object.isNatural() || object.transitionsToward.length === 0) {\n this.setObjectDepth(object, new Depth({value: 0, craftable: object.isNatural()}));\n }\n }\n }", "GetDistanceToPoint() {}", "function calculateTime(speedAndDistance) {\n /* The parameter speedAndDistance is an object \n with 2 properties speed and destination distance. */\n let totalTime;\n let timeInHours;\n let timeInMinutes;\n totalTime =\n speedAndDistance[\"destinationDistance\"] / speedAndDistance[\"speed\"];\n timeInHours = Math.floor(totalTime);\n timeInMinutes = Math.round((totalTime - timeInHours) * 60);\n return timeInHours + \" hours \" + timeInMinutes + \" minutes\";\n}", "function getDriveTime(x, y) {\n var directionsService = new google.maps.DirectionsService();\n var request = {\n origin: x,\n destination: y,\n travelMode: google.maps.DirectionsTravelMode.DRIVING,\n };\n\n directionsService.route(request, function(response, status) {\n if (status == google.maps.DirectionsStatus.OK) {\n console.log(\"RESPONSE: \" + response);\n var duration = response.routes[0].legs[0].duration.text;\n $(\"#theDuration\").text(\" in \" + duration);\n $(\"#theDuration\").show();\n\n }\n else {\n console.log(\"There is no route information available for this trip\");\n }\n });\n}", "parseStatsKD() {\r\n this._kill = this._datas_str[\"lifeTimeStats\"][10][\"value\"];\r\n this._match_played = this._datas_str[\"lifeTimeStats\"][7][\"value\"];\r\n this._ratio_kd = this._datas_str[\"lifeTimeStats\"][11][\"value\"];\r\n this._kill_min = this._datas_str[\"lifeTimeStats\"][12][\"value\"];\r\n }", "GetSpeed(position,previousPosition){\n\n let distance = this.GetDistance(position.Latitude,position.Longitude,previousPosition.Latitude,previousPosition.Longitude);\n console.log(`distanceFromPreviousPoint=====${distance}`);\n let now=Date.fromMysqlDate(`${position.DateTime}`);\n console.log(`Time Now is: ${now}`);\n //let start=Date.fromMysqlDate('2018-03-22 10:22:00');\n let previous=Date.fromMysqlDate(`${previousPosition.DateTime}`);\n console.log(`Time Previous is: ${previous}`);\n let diff=now.getTime()-previous.getTime();\n let hourDiff=diff/(60*60*1000);\n if(hourDiff===0){\n return -1;\n }\n console.log(`hourDiff=====${hourDiff}`);\n let speed=distance/hourDiff;\n \n return speed;\n }", "function calculate_distance() {\n\n currgal_length_in_Mpc = convert_ltyr_to_Mpc(currgal_length_in_ltyr);\n currgal_distance = currgal_length_in_Mpc / view_height_rad;\n\n print_distance(\"calculating.\");\n setTimeout(function () {\n print_distance(\"calculating..\")\n }, 500);\n setTimeout(function () {\n print_distance(\"calculating...\")\n }, 1000);\n setTimeout(function () {\n print_distance(Math.round(currgal_distance).toLocaleString() + \" Mpc\")\n }, 1500);\n }", "function computeLinkDepths() {\n\t nodes.forEach(function(node) {\n\t node.sourceLinks.sort(ascendingTargetDepth);\n\t node.targetLinks.sort(ascendingSourceDepth);\n\t });\n\t nodes.forEach(function(node) {\n\t var sy = 0, ty = 0;\n\t node.sourceLinks.forEach(function(link) {\n\t link.sy = sy;\n\t sy += link.dy;\n\t });\n\t node.targetLinks.forEach(function(link) {\n\t link.ty = ty;\n\t ty += link.dy;\n\t });\n\t });\n\n\t function ascendingSourceDepth(a, b) {\n\t return a.source.y - b.source.y;\n\t }\n\n\t function ascendingTargetDepth(a, b) {\n\t return a.target.y - b.target.y;\n\t }\n\t }", "function calculateRouteTimeDistance(sitterID, sitterRoute) {\n\n\t let waypointsArr = [];\n\t let visit_count = sitterRoute.length;\n\n\t sitterRoute.forEach((visit) => {\n\t let lat = parseFloat(visit.lat);\n\t let lon = parseFloat(visit.lon);\n\t let coordPair = [];\n\t coordPair.push(lon);\n\t coordPair.push(lat);\n\t let coord = {\n\t \"coordinates\": coordPair\n\t };\n\t let waypointName = {\n\t \"name\": visit.clientName\n\t };\n\t waypointsArr.push(coord);\n\t visit_count = visit_count - 1;\n\n\t });\n\n\t allSitters.forEach((sitter) => {\n\t if (sitterID == sitter.sitterID) {\n\t let lat = parseFloat(sitter.sitterLat);\n\t let lon = parseFloat(sitter.sitterLon);\n\t let coordPair = [];\n\t coordPair.push(lon);\n\t coordPair.push(lat);\n\t let coord = {\n\t \"coordinates\": coordPair\n\t };\n\n\t if (lat != null && lon != null && lon > -90 && lat < 90) {\n\t waypointsArr.push(coord);\n\t waypointsArr.unshift(coord);\n\t createSitterMapMarker(sitter);\n\t } else {\n\t console.log('sitter does not have valid coordinates');\n\t }\n\n\t }\n\t });\n\t checkDistanceMatrix(waypointsArr);\n\t let waypointDict = {\n\t \"waypoints\": waypointsArr\n\t };\n\t var mapboxClient = mapboxSdk({\n\t accessToken: mapboxgl.accessToken\n\t });\n\t mapboxClient.directions.getDirections(waypointDict)\n\t .send()\n\t .then(response => {\n\t const directions = response.body;\n\t let waypoints = directions['waypoints'];\n\t let routes = directions.routes;\n\t //console.log('Number of route elements: ');\n\t let d2 = routes[0];\n\t //parseDistanceData(d2, waypoints, sitterID);\n\t LTMGR.addDistanceMatrixPair(d2,waypoints);\n\t }, error => {\n\t console.log('Hit error');\n\t console.log(error.message);\n\t });\n\t}", "get shadowDistance() {}", "function getData() {\n return {\n ergReps: ergReps,\n bikeReps: bikeReps,\n repRate: repRate,\n totTime: totTime,\n Distance: Distance\n }\n }", "function dist() {\n let temp = Math.floor(\n findDistance(coord.lat, goal.lat, coord.long, goal.long)\n );\n\n return temp;\n }", "function computeTotalDistance(result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000.0;\n}", "function getDistances (source, mech) {\n const distance = getDistance(source, mech.company_absolute_location);\n console.log(distance);\n return {\n mechanic: mech,\n distanceFromSource: distance\n };\n}", "get distanceToNext()\r\n {\r\n if (!this._endOfPath)\r\n {\r\n // Return remaining distance in m.\r\n let distanceValue = this._distanceToNext().toFixed(2);\r\n return distanceValue.toString() + \" m\"\r\n }\r\n else\r\n {\r\n return \"None\"\r\n }\r\n }", "async function getRouteDist(start, end, vid, partofroute){\n var url = 'https://api.mapbox.com/directions/v5/mapbox/driving-traffic/' + start[0] + ',' + start[1] + ';' + end[0] + ',' + end[1] + '?steps=true&geometries=geojson&access_token=' + mapboxgl.accessToken;\n let result = await makeRequest('GET', url);\n var json = JSON.parse(result);\n var data = json.routes[0];\n if (partofroute == 'driven'){\n trucks[vid].distanceDriven = data.distance;\n }\n else{\n trucks[vid].distanceLeft = data.distance;\n }\n var route = data.geometry.coordinates;\n return route;\n}", "function computeLinkDepths() {\n nodes.forEach(function(node) {\n node.sourceLinks.sort(ascendingTargetDepth);\n node.targetLinks.sort(ascendingSourceDepth);\n });\n nodes.forEach(function(node) {\n var sy = 0, ty = 0;\n node.sourceLinks.forEach(function(link) {\n link.sy = sy;\n sy += link.dy;\n });\n node.targetLinks.forEach(function(link) {\n link.ty = ty;\n ty += link.dy;\n });\n });\n\n function ascendingSourceDepth(a, b) {\n return a.source.y - b.source.y;\n }\n\n function ascendingTargetDepth(a, b) {\n return a.target.y - b.target.y;\n }\n }", "function computeLinkDepths() {\n nodes.forEach(function(node) {\n node.sourceLinks.sort(ascendingTargetDepth);\n node.targetLinks.sort(ascendingSourceDepth);\n });\n nodes.forEach(function(node) {\n var sy = 0, ty = 0;\n node.sourceLinks.forEach(function(link) {\n link.sy = sy;\n sy += link.dy;\n });\n node.targetLinks.forEach(function(link) {\n link.ty = ty;\n ty += link.dy;\n });\n });\n\n function ascendingSourceDepth(a, b) {\n return a.source.y - b.source.y;\n }\n\n function ascendingTargetDepth(a, b) {\n return a.target.y - b.target.y;\n }\n }", "function getData() {\n console.log(\"Duration array length: \" + props.durations.length);\n // Changes with time signature\n const num = Math.ceil(props.durations.length );\n if(num === 1) {\n return [];\n }\n const points = new Array(num).fill(1);\n\n // Return the coordinates in the array where x is the index and y is the duration\n return points.map((point, index) => {\n console.log(\"Duration:\" + (Math.ceil(props.durations[index] - props.durations[(index - 1)])));\n let duration = props.durations[index] - props.durations[(index - 1)];\n return {x: index + 1, y: duration};\n });\n }", "function geomToDistance(geom){\n let coords = geom.coordinates;\n let td = 0;\n let sd = 0;\n let c = 0;\n let f = 0;\n let xy = [];\n\n //reproject to EPSG:28355 so distance is in metres\n let epsg28355 = '+proj=utm +zone=55 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs';\n let p1 = proj4(epsg28355,[coords[0][0],coords[0][1]]);\n let p2 = 0;\n\n for (i = 0; i < coords.length-1; i++) {\n p2 = proj4(epsg28355,[coords[i+1][0],coords[i+1][1]]);\n\n // calculate distance traveled\n let deltax = p1[0] - p2[0];\n let deltay = p1[1] - p2[1];\n let distance = Math.sqrt(deltax*deltax + deltay*deltay);\n sd = sd + distance;\n td = td + distance;\n\n p1 = p2;\n\n // calculate climb/fall\n if (coords[i][2] < coords[i+1][2]){\n c = c + coords[i+1][2] - coords[i][2];\n } else {\n f = f + coords[i][2] - coords[i+1][2];\n }\n if (sd >= 100) {\n xy.push({\n x:td,\n y:coords[i][2]\n });\n sd = 0;\n }\n }\n\n return {chartdata:xy,climb:c,fall:f,totaldistance:td};\n}", "function traveledDistance() {\n if (data.mousetrackingX !== undefined) {\n if (data.mousetrackingX.length === data.mousetrackingY.length) {\n return data.mousetrackingX.length;\n }\n }\n return -1;\n }", "function getDebugInfo() {\n\t\treturn waypointsSet;\n\t}", "function getSpeed()\r\n {\r\n return speed;\r\n }", "async function getGPSData(data) {\n let frameRate;\n let inner = '';\n let device = '';\n if (data['frames/second'] != null)\n frameRate = `${Math.round(data['frames/second'])} fps`;\n for (const key in data) {\n if (data[key]['device name'] != null) device = data[key]['device name'];\n if (data[key].streams) {\n for (const stream in data[key].streams) {\n await breathe();\n //If we find a GPS stream, we won't look on any other DEVCS\n if (\n (stream === 'GPS5' || stream === 'GPS9') &&\n data[key].streams[stream].samples\n ) {\n let name;\n if (data[key].streams[stream].name != null)\n name = data[key].streams[stream].name;\n let units;\n if (data[key].streams[stream].units != null)\n units = `[${data[key].streams[stream].units.toString()}]`;\n let sticky = {};\n //Loop all the samples\n\n for (let i = 0; i < data[key].streams[stream].samples.length; i++) {\n const s = data[key].streams[stream].samples[i];\n //Check that at least we have the valid values\n if (s.value && s.value.length > 1) {\n //Update and remember sticky data\n if (s.sticky) sticky = { ...sticky, ...s.sticky };\n let time = '';\n let ele = '';\n let geoidHeight = '';\n //Use sticky info\n if (sticky.geoidHeight != null)\n geoidHeight = `\n <geoidheight>${sticky.geoidHeight}</geoidheight>`;\n //Set elevation if present\n if (s.value.length > 1)\n ele = `\n <ele>${s.value[2]}</ele>`;\n //Set time if present\n if (s.date != null) {\n if (typeof s.date != 'object') s.date = new Date(s.date);\n try {\n time = `\n <time>${s.date\n .toISOString()\n .replace(/\\.(\\d{3})Z$/, 'Z')}</time>`;\n } catch (e) {\n time = `\n <time>${s.date}</time>`;\n }\n }\n //Create sample string\n const partial = `\n <trkpt lat=\"${s.value[0]}\" lon=\"${s.value[1]}\">\n ${(ele + time + geoidHeight).trim()}\n </trkpt>`;\n if (i === 0 && s.cts > 0) {\n // If first sample missing, fake it for better sync\n let firstDate;\n try {\n firstDate = new Date(s.date.getTime() - s.cts)\n .toISOString()\n .replace(/\\.(\\d{3})Z$/, 'Z');\n } catch (e) {\n firstDate = new Date(s.date - s.cts)\n .toISOString()\n .replace(/\\.(\\d{3})Z$/, 'Z');\n }\n const firstTime = `\n <time>${firstDate}</time>`;\n const fakeFirst = `\n <trkpt lat=\"${s.value[0]}\" lon=\"${s.value[1]}\">\n ${(ele + firstTime + geoidHeight).trim()}\n </trkpt>`;\n inner += `${fakeFirst}`;\n }\n //Add it to samples\n inner += `${partial}`;\n }\n }\n //Create description of file/stream\n const description = [frameRate, name, units]\n .filter(e => e != null)\n .join(' - ');\n return { inner, description, device };\n }\n }\n }\n }\n return { inner, description: frameRate || '', device };\n}", "function computeTotalDistance(result) {\n\n //adds the total time for arrival\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n\n //gets user room number input\n var r = document.getElementById('startroom').value;\n var r2 = document.getElementById('endroom').value;\n\n var dis = (total/1000)*(0.621371/1);//round distance needed to travel\n dis = round(dis,1)//rounds it off\n\n //displays the distance in miles (PERSON USE)\n // document.getElementById('total').innerHTML = dis + ' mi';\n\n //average speed (PERSON USE)\n var spe =1.45;\n // document.getElementById('speed').innerHTML = spe + ' speed';\n\n var at = r.substring(0,1);\n var c=0;\n if(!isEmpty(at)){\n while(!isInt(at)){\n at = r.substring(c,(c+1));\n c++;\n }\n }\n var at2 = r2.substring(0,1);\n var c=0;\n if(!isEmpty(at2)){\n while(!isInt(at2)){\n at2 = r2.substring(c,(c+1));\n c++;\n }\n }\n \n function isInt(value) {\n return !isNaN(value) && \n parseInt(Number(value)) == value && \n !isNaN(parseInt(value, 10));\n }\n\n function isEmpty(str) {\n return (!str || 0 === str.length);\n }\n //seconds for stair (PERSON USE)\n var sps = Number(at) * 0.10;\n var sps2 = Number(at2) * 0.10;\n // document.getElementById('addedTime').innerHTML = sps + ' time added';\n // document.getElementById('time2').innerHTML = sps2 + ' time added';\n // document.getElementById('tot').innerHTML = (sps+sps2) + ' time added';\n\n //time (PERSON USE)\n tim =(total/spe)*(1/60);\n tim = round(tim+sps+sps2,0)\n document.getElementById('time').innerHTML = tim + ' min';\n\n //creates the current time and displays (PERSON USE)\n var today = new Date();\n var h = today.getHours();\n var m = today.getMinutes();\n var s = today.getSeconds();\n m = checkTime(m);\n s = checkTime(s);\n a = h + \":\" + m + \":\" + s+\" \"+a;\n\n //round numbers method\n function round(number, precision) {\n var shift = function (number, precision, reverseShift) {\n if (reverseShift) {\n precision = -precision;\n } \n var numArray = (\"\" + number).split(\"e\");\n return +(numArray[0] + \"e\" + (numArray[1] ? (+numArray[1] + precision) : precision));\n };\n return shift(Math.round(shift(number, precision, false)), precision, true);\n }\n //method used to get current time\n function checkTime(i) {\n if( i < 10 ) {\n i = \"0\" + i;\n }\n return i;\n }\n}", "function getDistance() {\r\n\talert('Detecting distance');\r\n\tnavigator.geolocation.getCurrentPosition(getDistanceFromPoint); \r\n}", "function andoird_calculate_Dx() { \n\tvar Dx = $M([\t \n\t\t[((Math.pow(node1.d_android, 2) - Math.pow(node2.d_android, 2)) - (Math.pow(node1.x, 2) - Math.pow(node2.x, 2)) - (Math.pow(node1.y, 2) - Math.pow(node2.y, 2))), (2*(node2.y - node1.y))],\n\t\t[((Math.pow(node1.d_android, 2) - Math.pow(node3.d_android, 2)) - (Math.pow(node1.x, 2) - Math.pow(node3.x, 2)) - (Math.pow(node1.y, 2) - Math.pow(node3.y, 2))), (2*(node3.y - node1.y))]\n\t]);\n\treturn Dx;\n}", "stats() {\n const packets = this.getDataPackets();\n \n const sampleTimes = packets.map(p => p._sampleTime);\n const timings = _.isEmpty(sampleTimes) ? [0] : sampleTimes;\n\n return {\n name: this.name,\n label: this.label,\n address: this.node.getBoltAddress(),\n lastObservation: this.state && this.state.data ? this.state.data[0] : null,\n query: this.query,\n packets: packets.length,\n stdev: math.std(...timings),\n mean: math.mean(...timings),\n median: math.median(...timings),\n mode: math.mode(...timings),\n min: math.min(...timings),\n max: math.max(...timings),\n augFns: this.augmentFns.length,\n aliases: this.aliases.length,\n timings,\n };\n }", "function tubesDistance() {\n var distance = {};\n for (var i = 0, n = diameters.length; i < n; i++)\n distance[diameters[i]['diametro']] = 0;\n for (i = 0, n = tubes.length; i < n; i++)\n distance[tubes[i]['diametro']] += (tubes[i]['link']['distance'] * scale) + (tubes[i]['link']['source']['height'] / 100) + (tubes[i]['link']['target']['height'] / 100);\n return distance;\n}", "function add_directions_duration(lat, lon) {\n var directionsService = new google.maps.DirectionsService();\n var destinationMarker= new google.maps.LatLng(lat, lon);\n var request = {\n origin: initial_loc,\n destination: new google.maps.LatLng(lat,lon),\n travelMode: google.maps.TravelMode.WALKING,\n unitSystem: google.maps.UnitSystem.IMPERIAL\n };\n directionsService.route(request, function(response, status) {\n if (status == google.maps.DirectionsStatus.OK) {\n console.log(response);\n var distance = response.routes[0].legs[0].distance.text;\n console.log(distance);\n // $(\".duration\").append(response.routes[0].legs[0].duration.text);\n }\n });\n }", "getDistance(x, y) {\n\n const currentObject = this;\n\n const getNewDirection = function(c1x, c1y, dir) {\n const radsOffset = dir*Math.PI/2.0;\n const isZero = (y - c1y) == 0 && (x - c1x) == 0;\n var rads = 0.0;\n if (!isZero) {\n rads = (Math.atan2(y - c1y, x - c1x) - radsOffset + 4.0*Math.PI) % (2.0*Math.PI);\n }\n\n if (rads <= Math.PI/4.0) {\n return currentObject.dirReturn(dir, 0);\n }\n else if (rads <= Math.PI) {\n return currentObject.dirReturn(dir, 1);\n }\n else if (rads <= Math.PI*7.0/4.0) {\n return currentObject.dirReturn(dir, 3);\n }\n else {\n return currentObject.dirReturn(dir, 0);\n }\n };\n\n // NOTE: Since JavaScript is not guaranteed to have tail recursion optimization,\n // this can overflow the stack for too high iteration values.\n const distanceToCircle = function(c1x, c1y, r1, n1, dir, lastDistance) {\n\n const currentDistance = Math.min(calcLength(x - c1x, y - c1y) - r1, lastDistance);\n\n if (currentDistance <= 0 || n1 <= 0) {\n return currentDistance;\n }\n else {\n // Calculate new circle.\n\n const rnew = r1*(1.0/(1.0*currentObject.divisionFactor));\n const dirnew = getNewDirection(c1x, c1y, dir);\n const radsnew = dirnew*Math.PI/2.0;\n const cnx = c1x + (r1 + rnew)*Math.cos(radsnew);\n const cny = c1y + (r1 + rnew)*Math.sin(radsnew);\n\n return distanceToCircle(cnx, cny, rnew, n1 - 1, dirnew, currentDistance);\n }\n };\n\n return distanceToCircle(\n this.centerX, this.centerY, this.startRadius, this.numberOfIterations,\n this.startDirection, this.maximumDistance);\n }", "function calculateTravelTime(departureRoute, arrivalRoute)\n\t{\n\t\tvar start = xmlDoc.getElementsByTagName(\"departure\")[departureRoute].getElementsByTagName(\"datetime\")[0].childNodes[0].nodeValue;\n\t\tvar stop = xmlDoc.getElementsByTagName(\"arrival\")[arrivalRoute].getElementsByTagName(\"datetime\")[0].childNodes[0].nodeValue;\n\t\tstartH = start.substring(11,13);\n\t\tstartM = start.substring(14,16);\n\t\tstopH = stop.substring(11,13);\n\t\tstopM = stop.substring(14, 16);\n\n\t\t //console.log(\"start = \" + start);\n\t\t //console.log(\"stop = \" + stop);\n\n\t\tvar h = stopH-startH;\n\t\tvar m = stopM-startM;\n\n\t\tif(m<0){\n\t\t\th = h-1;\n\t\t\tm = 60+m;\n\t\t}\n\t\t\n\t\t//console.log(\"vilket blir: \" + h + \" timmar och \" + m + \" minuter\");\n\t\treturn {h: h , m: m};\n\t}", "static getTileInfo(tileX, tileY, tileZ) {\n const leftLongitude = Layer.tileToLongitude(tileX, tileZ);\n const rightLongitude = Layer.tileToLongitude(tileX + 1, tileZ);\n const topLatitude = Layer.tileToLatitude(tileY, tileZ);\n const bottomLatitude = Layer.tileToLatitude(tileY + 1, tileZ);\n const angularTileWidth = Math.abs(rightLongitude - leftLongitude);\n const angularTileHeight = Math.abs(topLatitude - bottomLatitude);\n const angularPixelWidth = angularTileWidth / Layer.TILE_SIZE;\n const angularPixelHeight = angularTileHeight / Layer.TILE_SIZE;\n const angularVectorWidth = angularTileWidth / Layer.TILE_VECTOR_BLOCKS;\n const angularVectorHeight = angularTileHeight / Layer.TILE_VECTOR_BLOCKS;\n\n return {\n leftLongitude,\n rightLongitude,\n topLatitude,\n bottomLatitude,\n angularTileWidth,\n angularTileHeight,\n angularPixelWidth,\n angularPixelHeight,\n angularVectorWidth,\n angularVectorHeight,\n };\n }", "function o2ws_get_time() { return o2ws_get_float(); }", "getRemainingDepth() {\n return this.remainingDepth;\n }", "constructor(startLocation,endLocation,startTime,endTime,startTimetoLocale,endTimetoLocale){ \n this._startLocation=startLocation;\n this._endLocation=endLocation;\n this._pathTaken=[];\n this._startTime=startTime;\n this._endTime=endTime; \n this._startTimetoLocale=startTimetoLocale;\n this._endTimetoLocale=endTimetoLocale;\n this._timeTaken;\n this._distanceRan;\n this._averageSpeed;\n this._nickname;\n this._description;\n }", "computeRoute(){\n if (this.startLocation && this.endLocation){\n if (this.mode === \"MILES\"){\n this.plotMiles();\n } else {\n this.plotDirection();\n }\n }\n }", "function getTripTimesUsingHeuristics(tripTimes, route, directionId) {\n const routeId = route ? route.id : null;\n const tripTimesForDir = getTripTimesForDirection(\n tripTimes,\n routeId,\n directionId,\n );\n\n if (!tripTimesForDir) {\n // console.log(\"No trip times found at all for \" + directionId + \" (gtfs out of sync or route not running)\");\n // not sure if we should remap to normal terminal\n return {\n tripTimesForFirstStop: null,\n directionInfo: null,\n firstStopDistance: null,\n };\n }\n\n // console.log('trip times for dir: ' + Object.keys(tripTimesForDir).length + ' keys' );\n\n // Note that some routes do not run their full length all day like the 5 Fulton, so they\n // don't go to all the stops. Ideally we should know which stops they do run to.\n\n const directionInfo = route.directions.find(\n direction => direction.id === directionId,\n );\n\n const routeHeuristics = getAgency(route.agencyId).routeHeuristics;\n\n const ignoreFirst = ignoreFirstStop(routeHeuristics, routeId, directionId); // look up heuristic rule\n let firstStop = null;\n\n if (ignoreFirst !== true && ignoreFirst !== false) {\n firstStop = ignoreFirst; // ignore the stops prior the index specified by ignoreFirst\n } else {\n // is a boolean\n firstStop = directionInfo.stops[ignoreFirst ? 1 : 0];\n }\n\n let tripTimesForFirstStop = tripTimesForDir[firstStop];\n\n // if this stop doesn't have trip times (like the oddball J direction going to the yard, which we currently ignore)\n // then find the stop with the most trip time entries\n\n if (!tripTimesForFirstStop || !Object.keys(tripTimesForFirstStop).length) {\n // console.log(\"No trip times found for \" + routeId + \" from stop \" + firstStop + \". Using stop with most entries.\");\n tripTimesForFirstStop = Object.values(tripTimesForDir).reduce(\n (accumulator, currentValue) =>\n Object.values(currentValue).length > Object.values(accumulator).length\n ? currentValue\n : accumulator,\n {},\n );\n }\n\n return {\n tripTimesForFirstStop,\n directionInfo,\n firstStopDistance: directionInfo.stop_geometry[firstStop].distance,\n };\n}", "function getWindSpeed(city) {\n return city.wind.speed;\n}", "_vars () {\n this.progress = 0;\n this._prevTime = undefined;\n this._progressTime = 0;\n this._negativeShift = 0;\n this._state = 'stop';\n // if negative delay was specified,\n // save it to _negativeShift property and\n // reset it back to 0\n if ( this._props.delay < 0 ) {\n this._negativeShift = this._props.delay;\n this._props.delay = 0;\n }\n\n return this._calcDimentions();\n }", "function updateTravelInfo() {\n\tlet m = data.consts.turbo/10 + 1\n\n\tlet d = data.consts.distance.n\n\tif (d >= data.consts.distanceMax \n\t|| d <= data.consts.speed.n * 2\n\t|| d <= 2\n\t&& !data.consts.isStopped) {\n\t\tif (d == 0 && d <= 0) {\n\t\t\tdata.consts.distance.n = 0\n\t\t\tdata.consts.speed.n = 0\n\t\t} else {\t\t\t\n\t\t\tupdateDistance()\n\t\t}\n\t\t\n\t}\n\tif (data.consts.distance.n >= data.consts.speed.n * m) {\n\t\tdata.consts.distance.n -= data.consts.speed.n * m\t\n\t} else {\n\t\t// Arrived at destination\n\t\tdata.consts.distance.n = 0\n\t\tdata.consts.distance.u = 0\n\n\t\tdata.consts.speed.u = 0\n\t\tdata.consts.speed.n = 0\n\n\t\tdata.consts.isStopped = true\n\t}\n}", "constructor(){\n\t\tthis.visited = {}; // {ni:dfsi}\n\t\tthis.counter = 1; // current dfs number\n\t\tthis.times = 0; // number of times the path has been updated\n\t}", "function getLayerTimes(layer) {\n var times;\n if (layer) {\n var dimensions = layer.dimensions;\n if (dimensions) {\n var time = dimensions.time;\n if (time) {\n times = time.values;\n }\n }\n }\n return times;\n }", "function googleDistances() {\n this.origins = ''\n this.distances = []\n thi.mod = 'walking';\n this.data;\n\n var ajaxUrl = 'https://maps.googleapis.com/maps/api/distancematrix/json'\n this.getJsonData = function() {\n var parameters = {\n origins: this.origins,\n distances: this.distances.join('|'),\n mod: this.mod;\n }\n\n $.get(url, parameters)\n .done(function(data){\n alert(data)\n })\n }\n\n this.getTimes = function() {\n var elements = this.data.rows.elements;\n var times = [];\n for (i in elements) {\n times[i] = elements.duration.text;\n }\n return times\n }\n this.getDistances = function() {\n var elements = this.data.rows.elements;\n var distances = [];\n for (i in elements) {\n distances[i] = elements.distance.text;\n }\n return distances\n }\n}", "async getDistanceOneToOne()\n {\n const Location1Str = this.state.currentLat + \",\" + this.state.currentLng;\n const Location2Str = this.state.nextLat + \",\" + this.state.nextLng;\n // using google api for \"distancematrix\" service\n let ApiURL = \"https://maps.googleapis.com/maps/api/distancematrix/json?\";\n // sending the parameters to the api including return language (hebrew)\n let params = `origins=${Location1Str}&destinations=${Location2Str}&key=${myAPI}&language=${\"iw\"}`;\n let finalApiURL = `${ApiURL}${encodeURI(params)}`;\n let fetchResult = await fetch(finalApiURL); // call API\n let result = await fetchResult.json(); // extract json\n this.setState({\n directionTime: result.rows[[0]].elements[[0]].duration.text,\n directionDistance: result.rows[[0]].elements[[0]].distance.text,\n currentLocationText: result.origin_addresses\n })\n }", "get(){\n\t\t// debug\n\t\t// console.log(\"atomicGLClock::get\");\t\n\t\treturn this.elapsed;\n\t}", "function localDepth(depth, units) {\n if (typeof depth === 'undefined' || depth == null) {\n return '';\n } else if (units === \"f\") {\n return (depth * 3.28084).toFixed(2) + \" ft\";\n } else {\n return depth.toFixed(2) + \" m\";\n }\n}", "computeDrawPathBuffers() {\n const buffer = this._pathBuffer;\n let preview,current,next;\n const cList = $objs.cases_s;\n for (let i=0, l=buffer.length; i<l; i++) {\n const preview = buffer[i-1];\n const current = buffer[i ];\n const next = buffer[i+1];\n const preview_id = preview && cList.indexOf(preview);\n const current_id = current && cList.indexOf(current);\n const next_id = next && cList.indexOf(next);\n //TODO: FIXME: compute distance via global position for Math.hypot\n if(preview){\n current.pathConnexion[String(preview_id)] = Math.hypot(preview.x-current.x, preview.y-current.y);\n };\n if(next){\n current.pathConnexion[String(next_id)] = Math.hypot(next.x-current.x, next.y-current.y);\n };\n };\n console.log0('PathsBuffers: ', buffer);\n this._pathBuffer = [];\n this.refreshPath();\n }", "get accessed() {\n return Math.floor(this.stats.atimeMs)\n }", "function calculateTravelTime(currLoc,newLoc){\n\n // Slice up the locations into coordinates\n var currX = parseInt(currLoc[0].slice(0,-1))\n var currY = parseInt(currLoc[1].slice(0,-1))\n var newX = parseInt(newLoc[0].slice(0,-1))\n var newY = parseInt(newLoc[1].slice(0,-1))\n\n // Calculate the distance between them\n var xOffset = currX - newX\n var yOffset = currY - newY\n var dist = Math.sqrt(xOffset*xOffset + yOffset*yOffset)\n\n // Multiply by speed to give a time\n var speed = 1.85\n var time = dist*speed\n\n return time\n\n}", "getGroupAfterDive (depth, duration, startGroup = 0, o2percentage = 21) {\n // TODO: calculate adjusted depth (o2percentage, depth)\n // TODO: calculate adjusted duration (startGroup, adjusted depth)\n\n let colIndex = ArrayUtil.getIndexMinFit(depth, this.RDP1a.colHeaders);\n //< min => min: built-in\n //> max => ERROR: manual\n if (colIndex == undefined) { throw \"Off the charts!\"; }\n\n let lineIndex = ArrayUtil.getIndexMinFit(duration, this.RDP1a.getColumn(colIndex));\n //< min => min: built-in\n //> max => ERROR: manual\n if (lineIndex == undefined) { throw \"Off the charts!\"; }\n\n return this.RDP1a.lineHeaders[lineIndex];\n }", "getDistance() {\n this.distance = [...this.sections].map((section) => {\n const offset = section.offsetTop;\n return {\n element: section,\n offset: Math.floor(offset - this.windowPerc),\n };\n });\n }", "function walkGeom(theGeometry) {\n var theGeomPart;\n var coordX;\n var coordY;\n var coordM;\n\n for (var a=0; a < theGeometry.features.length; a++) {\n theGeomPart= theGeometry.features[a].geometry.paths;\n\n for (var i = 0; i < theGeomPart.length; i++) {\n for (var j = 0; j < theGeomPart[i].length; j++) {\n coordX = theGeomPart[i][j][0];\n coordY = theGeomPart[i][j][1];\n coordM = roundToDecimalPlace(theGeomPart[i][j][2],3);\n console.log(\"X:\"+ roundToDecimalPlace(coordX,0),\"Y:\"+roundToDecimalPlace(coordY,0),\"M:\"+coordM);\n }\n }\n }\n}", "calcDirectionCoordsForTraitor(lat1, lon1, lat2, lon2) {\n //Line will be around 1000m long or something\n const multiplier = 1000 / this.calcDistance(lat1, lon1, lat2, lon2);\n return ([{\n latitude: lat2 + ((lat1 - lat2) * multiplier),\n longitude: lon2 + ((lon1 - lon2) * multiplier)\n },\n {\n latitude: lat2,\n longitude: lon2\n }]);\n }", "getReadableTime() {\n // Debugging line.\n Helper.printDebugLine(this.getReadableTime, __filename, __line);\n\n // Stop the time please. How long was the crawling process?\n let ms = new Date() - this.startTime,\n time = Parser.parseTime(ms),\n timeString = `${time.d} days, ${time.h}:${time.m}:${time.s}`;\n\n this.output.write(timeString, true, 'success');\n this.output.writeLine(`Stopped at: ${new Date()}`, true, 'success');\n }", "getDepth(obj, path) {\n return path.split('.').reduce((value, tag) => {\n return value[tag];\n }, obj);\n }", "getDistanceToCamera(context, child) {\n const matrix = mat4.copy(mat4.create(), context.sceneMatrix);\n\n /*get the combined transform-matrices of the child*/\n this.getChildSceneMatrix(child, matrix);\n\n /*get position*/\n const pos = vec3.fromValues( matrix[12],\n matrix[13],\n matrix[14]);\n\n /*get cameraPosition*/\n const camPos = vec3.fromValues( context.invViewMatrix[12],\n context.invViewMatrix[13],\n context.invViewMatrix[14]);\n\n /*calculate distance*/\n vec3.subtract(pos, pos, camPos);\n var distance = vec3.length(pos);\n\n /*if the point is behind the camera, it has a negative distance*/\n if(vec3.dot(context.lookAtVector, pos) < 0.0)\n distance *= -1;\n\n return distance;\n }", "distance() {\n return this.get('DISTANCE');\n }", "function getDebugInfo(name, entries = []) {\n // In some cases there won't be any entries (e.g. if CLS is 0,\n // or for LCP after a bfcache restore), so we have to check first.\n if (entries.length) {\n if (name === 'LCP') {\n const lastEntry = entries[entries.length - 1];\n return {\n // What layout shift caused LCP to fire/\n debug_target: getSelector(lastEntry.element),\n };\n } else if (name === 'FID') {\n const firstEntry = entries[0];\n return {\n // What did the user interact with that caused FID to fire.\n debug_target: getSelector(firstEntry.target),\n // The user event that triggered FID.\n debug_event: firstEntry.name,\n // If FID occurred before TTI\n debug_timing: wasFIDBeforeTTI(firstEntry) ? 'pre_tti' : 'post_tti',\n // The start time of the event that caused FID.\n event_time: firstEntry.startTime,\n };\n } else if (name === 'CLS') {\n const largestEntry = getLargestLayoutShiftEntry(entries);\n if (largestEntry && largestEntry.sources) {\n const largestSource = getLargestLayoutShiftSource(largestEntry.sources);\n if (largestSource) {\n return {\n // The selector of the largest layout shift\n debug_target: getSelector(largestSource.node),\n // The time of the largest layout shift.\n event_time: largestEntry.startTime,\n };\n }\n }\n }\n }\n}", "get remainingDistance()\r\n {\r\n if (!this._endOfPath)\r\n {\r\n // Return remaining distance in km.\r\n let distanceValue = this._getRemainingDistance().toFixed(2);\r\n return distanceValue.toString() + \" m\"\r\n }\r\n else\r\n {\r\n return \"None\"\r\n }\r\n }", "function get_speed(loc1, loc2) {\n var distance = get_distance(loc1, loc2);\n var time = get_time(loc1, loc2);\n var speed = distance / time;\n \n return (speed * 3.6);\n}", "function getJogDistance() {\n\n\tvar jogDistance = 0\n\tswitch(getXSelectorValue()) {\n\t\tcase XSelector.X1:\n\t\t\tjogDistance = SINGLESTEP_X1_JOGDISTANCE;\n\t\t\tbreak;\n\t\tcase XSelector.X10:\n\t\t\tjogDistance = SINGLESTEP_X10_JOGDISTANCE;\n\t\t\tbreak;\n\t\tcase XSelector.X100:\n\t\t\tjogDistance = SINGLESTEP_X100_JOGDISTANCE;\n\t\t\tbreak;\n\t}\n\treturn jogDistance\n}", "function getLevelDepth( e, id, waypoint, cnt ) {\n\t\tcnt = cnt || 0;\n\t\tif ( e.id.indexOf( id ) >= 0 ) return cnt;\n\t\tif( $( e).hasClass( waypoint ) ) {\n\t\t\t++cnt;\n\t\t}\n\t\treturn e.parentNode && getLevelDepth( e.parentNode, id, waypoint, cnt );\n\t}", "getElapsedTime() {\n\t\tthis.getDelta();\n\t\treturn this.elapsedTime;\n\t}", "_getAverageSpeed()\r\n {\r\n let endTime = Date.now()\r\n // Get elapsed time in seconds.\r\n let elapsedTime = (endTime - this._startTime) / 1000;\r\n\r\n // Return average speed in m/s.\r\n return this._totalDistance / elapsedTime;\r\n }", "function calcTime(dist){\n\t//Get duration of the video\n\tvar dur = Popcorn(\"#video\").duration();\n\t//Get width of timeline in pixels\n\tvar wdth = document.getElementById(\"visualPoints\").style.width;\n\t//Trim for calculations\n\twdth = wdth.substr(0,wdth.length - 2);\n\t//Calculate pixel/total ratio\n\tvar ratio = dist / wdth;\n\t//Return time value in seconds calculated using ratio\n\treturn (ratio * dur);\n}", "function getDistance ( routeDetails ) {\n\t\tgetDate(false);\n\t\tgetHour();\n\t\t$('#modal-route').modal('show');\n\t\t//Origin pos\n\t\tvar im = new google.maps.LatLng(routeDetails[0].geometry.location.lat(), routeDetails[0].geometry.location.lng());\n\t\t//Destination pos\n\t\tvar goto = new google.maps.LatLng(routeDetails[1].geometry.location.lat(), routeDetails[1].geometry.location.lng());\n\t\tservice = new google.maps.DistanceMatrixService();\n\t\tservice.getDistanceMatrix(\n\t\t{\n\t\t\torigins: [im],\n\t\t\tdestinations: [goto],\n\t\t\ttravelMode: google.maps.TravelMode.DRIVING,\n\t\t\tavoidHighways: false,\n\t\t\tavoidTolls: false\n\t\t}, \n\t\tcallback\n\t);\n\tfunction callback(response, status) { \n\t\tif ( status == \"OK\" ) {\n\t\t\tdistancia = response.rows[0].elements[0].distance.value;\n\t\t\tjQuery(\"label[for='distance-label']\").html( response.rows[0].elements[0].distance.text );\n\t\t\ttiempo = response.rows[0].elements[0].duration.value\n\t\t\tjQuery(\"label[for='duration-label']\").html( response.rows[0].elements[0].duration.text );\n\t\t\tprecio = response.rows[0].elements[0].distance.value/1000;\n\t\t\tprecio = Math.round(precio*100)/100;\n\t\t\tconsole.log(precio)\n\t\t\tif( precio < 6){\n\t\t\t precio = 6.00;\n\t\t\t}\n\t\t\tjQuery(\"label[for='price-label']\").html( precio +\"€\");\n\n\t\t} else {\n\t\t\talert( \"Error: \" + status );\n\t\t}\n\t}\n\t\n}", "function getLevelDepth( e, id, waypoint, cnt ) {\n cnt = cnt || 0;\n if ( e.id.indexOf( id ) >= 0 ) return cnt;\n if( classie.has( e, waypoint ) ) {\n ++cnt;\n }\n return e.parentNode && getLevelDepth( e.parentNode, id, waypoint, cnt );\n }" ]
[ "0.6271434", "0.6232298", "0.5984194", "0.5886497", "0.5882493", "0.58116114", "0.57304025", "0.57129747", "0.56929505", "0.56708187", "0.56501734", "0.559313", "0.5568701", "0.54554975", "0.5420293", "0.5389727", "0.53844094", "0.5362384", "0.5361103", "0.5351491", "0.5343285", "0.53423023", "0.5315381", "0.5312818", "0.5301913", "0.5301913", "0.52897286", "0.52758074", "0.52679896", "0.5255601", "0.52529347", "0.5252404", "0.5247628", "0.52450716", "0.52269953", "0.5219324", "0.5196389", "0.51947546", "0.516678", "0.51522857", "0.51271874", "0.51161104", "0.50762045", "0.5070629", "0.5064696", "0.5064372", "0.5049595", "0.5048075", "0.50436133", "0.50285095", "0.50285095", "0.5021231", "0.50165594", "0.5015861", "0.5015673", "0.50143206", "0.5012367", "0.5010792", "0.5004646", "0.5000346", "0.49820673", "0.49771526", "0.4971637", "0.4950898", "0.49504495", "0.4946853", "0.49363115", "0.49349546", "0.49334618", "0.49333087", "0.49156496", "0.4912903", "0.4908681", "0.49079236", "0.48981956", "0.48906794", "0.48851576", "0.48850712", "0.48841596", "0.48831576", "0.4881571", "0.48800802", "0.48782456", "0.48739284", "0.4872564", "0.48707104", "0.48681003", "0.48671898", "0.48643535", "0.48625147", "0.48528188", "0.4850065", "0.48427138", "0.48362583", "0.48319894", "0.48273033", "0.48253462", "0.48224598", "0.48191708", "0.4811363", "0.48092458" ]
0.0
-1
Injects compiled CSS/JS/HTML files into the main index page using gulpinject Also uses wiredep to include libs from bower_components
function inject(callback) { // Grab all of the compiled css files var injectStyles = gulp.src(path.join(config.paths.dev, config.paths.styles, '/**/*.css'), { read: false }); var injectStylesOptions = { ignorePath: [config.paths.src, path.join(config.paths.dev)], addRootSlash: false }; // Inject the compiled javascript files into the index var paths = []; var scripts = config.scripts.inject; if (scripts.length > 0) { scripts.forEach(function(path) { // If the string beings with !, stub in the tmp directory after it if (/^\!/.test(path)) { paths.push(path.substr(0, 1) + config.paths.dev + '/' + path.substr(1)) } else { paths.push(config.paths.dev + '/' + path) } }); } else { paths = [ path.join(config.paths.dev, config.paths.scripts, '/**/*.js'), path.join('!' + config.paths.dev, config.paths.scripts, '/**/*.spec.js'), path.join('!' + config.paths.dev, config.paths.scripts, '/**/*.mock.js'), ] } var injectScripts = gulp.src(paths) .pipe(gulpif(config.angular.enabled, angularFilesort())) .on('error', util.errorHandler('angularFilesort')); var injectScriptsOptions = { ignorePath: [config.paths.src, config.paths.dev], addRootSlash: false }; // Inject file containing environment settings, just incase // this file needs to be imported before others var injectEnv = gulp.src(path.join(config.paths.dev, config.paths.scripts, '/env.js'), { read: false }); var injectEnvOptions = { starttag: '<!-- inject:env -->', ignorePath: [config.paths.src, config.paths.dev], addRootSlash: false }; // Non Bower third party templates var injectVendor = gulp.src(path.join(config.paths.dev, config.paths.vendor, '/**/*.js'), { read: false }); var injectVendorOptions = { starttag: '<!-- inject:vendor -->', ignorePath: [config.paths.src, config.paths.dev], addRootSlash: false }; // Angular templateCache injection into index.html var injectTemplates = gulp.src(path.join(config.paths.dev, '/templates/templates.js'), { read: false }); var injectTemplatesOptions = { starttag: '<!-- inject:templates -->', ignorePath: [config.paths.src, config.paths.dev], addRootSlash: false }; return gulp.src(path.join(config.paths.src, '/*.html')) .pipe(gulpif(util.fileExists('bower.json'), wiredep({ directory: config.paths.bower }))) .on('error', util.errorHandler('wiredep')) .pipe(gulpif(config.angular.enabled, ginject(injectTemplates, injectTemplatesOptions))) .pipe(ginject(injectStyles, injectStylesOptions)) .pipe(ginject(injectEnv, injectEnvOptions)) .pipe(ginject(injectVendor, injectVendorOptions)) .pipe(ginject(injectScripts, injectScriptsOptions)) .pipe(preprocess({ context: { NODE_ENV: process.env.NODE_ENV } })) .pipe(gulp.dest(config.paths.dev)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inject() {\n\n const injectStyles = gulp.src([\n 'src/assets/css/normalize.css',\n 'src/assets/css/topcoat/topcoat-desktop-light.css',\n 'src/assets/**/*.css'\n ], {read: false});\n\n const injectOptions = {\n ignorePath: ['src/'],\n addRootSlash: false,\n relative: true\n };\n\n return gulp.src('src/app/index.html')\n .pipe(gulpInject(injectStyles, injectOptions))\n .pipe(wiredep({\n cwd: 'src/'\n }))\n .pipe(rename('index.compiled.html'))\n .pipe(gulp.dest('src/app/'));\n}", "function index() {\n var opt = {read: false};\n return gulp.src('./client/index.html')\n .pipe(wiredep())\n .pipe($.inject(es.merge(appFiles(opt), cssFiles(opt)), {\n ignorePath: ['../.tmp'],\n relative: true\n }))\n .pipe(gulp.dest('./client'))\n .pipe(livereload());\n}", "function genHtml(){\n\tgulp.src(path.dist + 'index.html')\n\t\t//.pipe(inject(gulp.src(mainBowerFiles(), {read: false}), {name: 'bower'}))\n\t\t.pipe(inject(gulp.src([path.dist_static + '**/*.js'], {read: false}), {name: 'app'}))\n\t\t.pipe(inject(gulp.src([path.dist + '**/*.css'], {read: false}), {name: 'style'}))\n\t\t.pipe(gulp.dest(path.dist));\n}", "function bowerInstall() {\n return gulp.src('./public/index.html')\n \t.pipe(inject(gulp.src(bowerFiles(), {read: false}), {name: 'bower'}))\n \t.pipe(gulp.dest('./public/'))\n}", "function injectingassets() {\n\n\n var injectSrc = gulp.src(\n [\n './assets/javascripts/vendor/jquery*.js',\n './assets/javascripts/govuk/selection-buttons.js',\n './assets/javascripts/vendor/polyfills/bind.js',\n './assets/javascripts/vendor/details.polyfill.js',\n './assets/javascripts/main.js'\n ], {\n read: false\n });\n\n var options = {\n bowerJson: require('../bower.json'),\n ignorePath: '..'\n };\n\n return gulp.src('./views/**/*.hbs')\n .pipe(wiredep(options))\n .pipe(inject(injectSrc))\n .pipe(gulp.dest('./views'));\n}", "function include() {\n return gulp.src('./src/Pages/src/**/*.html')\n // Components\n .pipe(fileinclude({\n prefix: '@@',\n indent: true,\n basepath: './src/Components/**'\n }))\n // CSS + JS Inject\n .pipe(inject(\n gulp.src(['./src/Styles/dist/main.css', './src/Scripts/dist/main.bundle.js'], { read: false }), { relative: true })) // *DEV\n // gulp.src(['./src/Styles/dist/main.min.css', './src/Scripts/dist/main.bundle.min.js'], { read: false }), { relative: true })) // *PROD\n .pipe(gulp.dest('./src/Pages/dist'))\n .pipe(browserSync.stream());\n}", "function injectToHTML() {\n\n\tlet sources = [\n\t\tconfig.injectSourceCSS, config.injectSourceJS\n\t];\n\n\tconst d = \"?\" + Date.now();\n\n\treturn gulp.src(basePages)\n\t\t.pipe(gulpif(config.settings.fileVersion, \n\t\t\tinject(gulp.src(sources, {read: false}), {\n\t\t\taddRootSlash: false,\n\t\t\tignorePath: config.dist,\n\t\t\taddSuffix: d\n\t\t}), inject(gulp.src(sources, {read: false}), {\n\t\t\taddRootSlash: false,\n\t\t\tignorePath: config.dist\n\t\t})))\n\t\t.pipe(inject(gulp.src([config.partials]), {\n\t\t\tstarttag: '<!-- inject:partial:{{path}} -->',\n\t\t\trelative: true,\n\t\t\ttransform: function (filePath, file) {\n\t\t\t // return file contents as string\n\t\t\t return file.contents.toString('utf8')\n\t\t\t}\n\t\t}))\n\t\t.pipe(fileInclude().on('error', function() {\n\t\t\tconsole.log(arguments);\n\t\t}))\n\t\t.pipe( gulp.dest( config.dist ) )\n}", "async function buildAndReload() {\n await includeHTML();\n CopyFiles();\n styles(\"src/scss/style.scss\", \"main.css\");\n // styles('src/scss/style.rtl.scss', 'main.rtl.css');\n // imageMin();\n // scripts();\n reload();\n}", "function inject_style() {\n $.util.log($.util.colors.grey(\"Injecting minified CSS into <head>...\"));\n return gulp.src('./dist/index.html')\n .pipe($.inject(gulp.src('./dist/css/main.min.css'), {\n starttag: '<!--inject:style-->',\n endtag: '<!--endinject-->',\n removeTags: false,\n transform: settings.inject_transform.style\n }))\n .pipe($.replace('<link rel=\"stylesheet\" href=\"' + $path + '/css/main.min.css\">', ''))\n .pipe(gulp.dest('./dist'));\n}", "function injectBowerFile () {\n return inject(gulp.src(bowerFile(), {read: false}), {\n name: 'bower',\n transform: function (filepath, file, i, length, target) {\n var tmpl;\n var flag = true;\n var extname = path.extname(filepath);\n\n // remove `/dist` string\n filepath = filepath.substr(5); \n\n // remove `/src` string\n target = target.path.split(__dirname)[1].split(path.sep).join('/').substr(4);\n\n // decide whether gulp should inject this bower dependencies to the html file or not.\n flag = dep[target].exclude.indexOf(filepath) === -1 ? true : false;\n if (!flag) { return; }\n\n // use different template according to the extname.\n if (extname === '.js') {\n tmpl = scriptTmpl;\n } else if (extname === '.css') {\n tmpl = cssTmpl;\n }\n return tmpl.replace('{{src}}', filepath);\n }\n });\n}", "function htmlComp(cb){\n return src(\"./src/html/pages/**/*.+(html|njk)\")\n .pipe(njkRender({path: ['./src/html/templates/layouts/', './src/html/templates/partials/']}))\n .pipe(dest(buildDir))\n .pipe(browserSync.stream());\n cb();\n}", "function deploy() {\n return gulp.src('./public/**/*')\n .pipe($.ghPages());\n}", "function buildDevHtml() {\n return gulp\n .src(\"./src/index.html\")\n .pipe(inject(gulp.src(\"./src/app/**/*.css\", { read: false }), { relative: true })) // css app files\n .pipe(inject(gulp.src(\"./src/app/**/*.js\", { read: false }), { relative: true })) // js app files\n .pipe(gulp.dest(\"./src\"));\n}", "function buildProdHtml(cb) {\n return gulp\n .src(\"./dist/index.html\")\n .pipe(inject(gulp.src(\"./dist/app/app-*.min.css\", { read: false }), { relative: true, removeTags: true })) // css app files\n .pipe(inject(gulp.src(\"./dist/app/app-*.min.js\", { read: false }), { relative: true, removeTags: true })) // js app files\n .pipe(gulp.dest(\"./dist\"));\n}", "function distCssJs() {\n return gulp.src('app/*.html')\n .pipe(useref())\n .pipe(gulpIf('*.js', uglify()))\n .pipe(gulpIf('*.css', cssnano()))\n .pipe(gulp.dest('dist'));\n}", "function cssInject() {\n return src('app/temp/styles/styles.css')\n .pipe(browserSync.stream());\n}", "function watchAndServe() {\n browserSync.init({\n server: 'dist',\n });\n\n watch('src/styles/**/*.scss', styles);\n watch('src/pug/pages/*.pug', pugHtml);\n // watch('src/**/*.html', html);\n watch('src/assets/**/*', assets);\n watch('src/js/**/*.js', scripts);\n watch('dist/*.html').on('change', browserSync.reload);\n}", "function serve() {\n browserSync.init({\n server: \"./dist\"\n });\n\n gulp.watch('./src/scss/**/*.scss', compileSass);\n gulp.watch(['./dist/*.html', './src/css/style.css', './dest/js/*.js']).on('change', browserSync.reload);\n}", "function publishHtml(\n options,\n details,\n packageMap,\n deps,\n cssFileMap,\n cb\n) {\n // we need to load all components\n var dependencies = [ ],\n cssFiles = [];\n if (deps) {\n Object.keys(deps).forEach(function (d) {\n dependencies.push(d + '/' + d + '.js');\n });\n Object.keys(cssFileMap).forEach(function (k) {\n var details = cssFileMap[k].details,\n vfn = (details.name + k.slice(details.dirname.length));\n cssFiles.push(vfn.split('\\\\').join('/'));\n });\n }\n fs.writeFile(\n path.join(options.dstFolder, details.name + '.html'),\n jqtpl.tmpl('componentTemplate', {\n dependencies: dependencies,\n css: cssFiles,\n main: details.name,\n jquery: options.jquery ? path.basename(options.jquery) : null\n }),\n cb\n );\n}", "function serve() {\n browserSync.init({\n server: {\n baseDir: './',\n },\n });\n buildSass();\n gulp.watch('scss/**/*.scss', buildSass);\n gulp.watch('*.html').on('change', browserSync.reload);\n}", "function grind(grunt) {\n\n // grunt.loadNpmTasks('grunt-closure-compiler');\n\n // Project configuration.\n var config = {\n pkg: '<json:../package.json>',\n meta: {\n banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +\n '<%= grunt.template.today(\"yyyy-mm-dd\") %>\\n' +\n '<%= pkg.homepage ? \"* \" + pkg.homepage + \"\\n\" : \"\" %>' +\n '* Copyright (c) <%= grunt.template.today(\"yyyy\") %> <%= pkg.author.name %>;' +\n ' Licensed <%= _.pluck(pkg.licenses, \"type\").join(\", \") %> */',\n original: '/* View original: <%= pkg.name %>-<%= pkg.version %>.js */'\n },\n lint: {\n files: ['grunt.js', 'js/**/*.js']\n },\n concat: {\n dist: {\n // built dynamically\n // src: ['<banner:meta.banner>', 'public/js/intro.js', 'public/js/*.js', 'public/js/**/*.js', 'public/js/outro.js'],\n src: [],\n dest: 'js/<%= pkg.name %>-<%= pkg.version %>.js'\n }\n },\n min: {\n dist: {\n src: ['<banner:meta.original>', '<banner:meta.banner>', '<config:concat.dist.dest>'],\n dest: 'js/<%= pkg.name %>-<%= pkg.version %>.min.js'\n }\n },\n watch: {\n files: '<config:lint.files>',\n tasks: 'lint'\n },\n jshint: {\n options: {\n curly: true,\n eqeqeq: true,\n immed: true,\n latedef: true,\n newcap: true,\n noarg: true,\n sub: true,\n undef: true,\n boss: true,\n eqnull: true,\n browser: true\n },\n globals: {\n jQuery: true,\n jsbin: true\n }\n }\n ,\n 'closure-compiler': {\n frontend: {\n root: 'js/',\n js: '', // completed dynamically\n jsOutputFile: '<%= pkg.name %>-<%= pkg.version %>.min.js',\n sourcemap: '<%= pkg.name %>-<%= pkg.version %>.map',\n options: {\n create_source_map: '<%= pkg.name %>-<%= pkg.version %>.map',\n source_map_format: 'V3',\n compilation_level: 'ADVANCED_OPTIMIZATIONS',\n language_in: 'ECMASCRIPT5_STRICT'\n }\n }\n }\n };\n\n var scripts = require('../scripts.json'),\n scriptsRelative = scripts.map(function (script) {\n return script.substring(1);\n });\n\n config.lint.files = scriptsRelative;\n config.concat.dist.src = scriptsRelative;\n config['closure-compiler'].frontend.js = scripts.map(function (script) {\n return script.substring(4);\n });\n config.concat.dist.src.unshift('js/intro.js');\n config.concat.dist.src.unshift('<banner:meta.banner>');\n config.concat.dist.src.push('js/outro.js');\n\n grunt.initConfig(config);\n // Default task.\n grunt.registerTask('default', 'concat min');\n grunt.registerTask('sourcemap', 'closure-compiler');\n // grunt.registerTask('lint', 'lint');\n\n}", "function watch()\n{\n\tgulp.watch('/index.html', copyHtml);\n\tgulp.watch('img/*', copyImgs);\n\tgulp.watch('css/*.css', styles);\n\tgulp.watch('/js/*.js', scripts);\n}", "function serveFn(){\n\trunSequence(['allHtml','styles','js'],function(){\n\t\tbrowserSync.init({\n\t\t\tserver: {\n\t\t\t\tbaseDir: doc\n\t\t\t}\n\t\t});\n\t})\n}", "function scaffold() {\n\treturn gulp.src(paths.source, { base: './' })\n\n\t\t// development: vendors.js and main.js\n\t\t// in different files to speed up workflow\n\t\t.pipe( $.if( !production, $.htmlReplace({\n\t\t\tstyles: paths.dist.styles + 'main.css',\n\t\t\tscripts: [\n\t\t\t\tpaths.dist.scripts + 'vendors.js',\n\t\t\t\tpaths.dist.scripts + 'main.js'\n\t\t\t],\n\t\t\tmodernizr: paths.dist.scripts + 'modernizr.js',\n\t\t\tsvgs: config.svgs.sprite ? { src: config.svgs.sprite, tpl: '%s' } : ''\n\t\t})))\n\n\t\t// production\n\t\t// minify and cacheBust\n\t\t.pipe( $.if( production, $.htmlReplace({\n\t\t\tstyles: paths.dist.styles + 'styles.min.css' + cacheBuster,\n\t\t\tscripts: paths.dist.scripts + 'scripts.min.js' + cacheBuster,\n\t\t\tmodernizr: paths.dist.scripts + 'modernizr.js',\n\t\t\tsvgs: config.svgs.sprite ? { src: config.svgs.sprite, tpl: '%s' } : ''\n\t\t})))\n\n\t\t// base.src becomes index.{extension} - config.path.source\n\t\t.pipe($.rename(paths.base))\n\t\t.pipe(gulp.dest('.'));\n}", "function compile() {\n sites.map(function (site) {\n stylesDev(site);\n scriptsDev(site);\n });\n}", "function html() {\n return src(['./src/views/*'])\n .pipe(nunjucks.compile({\n env: new njk.Environment(new njk.FileSystemLoader('./src/views'))\n }))\n .pipe(dest('dist/'))\n}", "function wacthFiles() {\n watch('src/assets/scss/**/*.scss', series(compileCss))\n watch('src/assets/js/**/*.js', series(compileJs))\n watch('src/assets/img/**/*', series(minifyImg))\n watch('src/**/*.hbs', series(resetPages, compileHtml))\n watch('src/data/*.json', series(resetPages, compileHtml))\n}", "function buildHtml() {\n // NOTE: sri-hash expects to find asset files referenced by the source HTML files either relative\n // to the file's base Vinyl attribute (which is typically the glob base, see here:\n // https://gulpjs.com/docs/en/api/concepts#glob-base) or relative to the directory containing the\n // HTML file.\n //\n // Neither of these work if we're piping HTML files located in the src directory directly into\n // sri-hash because the assets (CSS and JS files) referenced by those HTML files aren't fully\n // realized until they have been built and written to the dist directory. No amount of config can\n // get sri-hash to load the built assets from the dist directory if the HTML file it's currently\n // processing has a Vinyl path located under the src directory.\n //\n // Instead, we pipe the HTML files directly to dest, which writes them to dist and updates their\n // path attributes. We then call sri-hash to update the HTML files with the add the integrity\n // attributes. Finally, we write the new HTML file contents to disk.\n return gulp.src('./src/index.html')\n .pipe(gulp.dest('./dist'))\n .pipe(sriHash())\n .pipe(gulp.dest('./dist'));\n}", "function cssBundle() {\n let postcssPlugins = [\n autoprefixer()\n ];\n\n return gulp.src([\"scss/facade.scss\"])\n .pipe(sass().on(\"error\", sass.logError))\n .pipe(postcss(postcssPlugins))\n .pipe(gulp.dest(\"public/css\"))\n .pipe(touch())\n .pipe(browserSync.stream());\n}", "function copy_html(cb) {\n src(\"src/renderer/*.html\").pipe(dest(\"build/renderer\")).on(\"end\", cb);\n}", "function html(){\n return gulp.src('./src/*.html')\n .pipe(gulp.dest('./build'))\n .pipe(browserSync.stream());\n}", "function exposeBundles(b,packageConfig){\n b.transform(stringify(['.html']));\n b.transform('deamdify');\n b.transform(textify());\n b.add('./src/index.js', {expose: packageConfig.name });\n }", "function serve() {\n browserSync.init({\n server: 'dist/'\n });\n\n watch(srcPaths.html, { interval: 1000 }, html);\n watch(srcPaths.scripts, { interval: 1000 }, scripts);\n watch(srcPaths.styles, { interval: 1000 }, styles);\n watch(srcPaths.images, { interval: 1000 }, images)\n}", "function mini() {\n return gulp.src('project/*.html')\n .pipe(useref())\n .pipe(gulpIf('*.js', terse()))\n .pipe(gulpIf('*.css', cssnano()))\n .pipe(gulp.dest('dist'))\n}", "function compileFiles(appName) {\n\n let stream;\n\n const cssOnly = process.argv.indexOf('--css-only') !== -1;\n const jsOnly = process.argv.indexOf('--js-only') !== -1;\n\n let styles;\n let scripts;\n\n if (cssOnly) {\n\n styles = css();\n\n stream = styles;\n }\n\n if (jsOnly) {\n\n scripts = js();\n\n stream = scripts;\n }\n\n if (!cssOnly && !jsOnly) {\n\n styles = css();\n scripts = js();\n\n stream = merge(styles, scripts);\n }\n\n return stream;\n\n // realiza processos para gerar os arquivos js\n function js() {\n\n let streamJs = gulp.src('.');\n\n const tsPath = `${src.ts}/inits/${appName}.init.ts`;\n\n if (fs.existsSync(tsPath)) {\n\n // 1 - pegue o arquivo \"init\" typescript do app\n // 2 - compile o arquivo para javascript\n // 3 - aplique pollyfills caso seja necessário \n let scripts = browserify(tsPath)\n .plugin(tsify, { typeRoots: [\"./node_modules/@types\", \"./type-definitions\"], target: \"esnext\" })\n .transform(stringify, {\n appliesTo: { includeExtensions: ['.html'] },\n minify: true,\n minifyOptions: {\n collapseBooleanAttributes: true,\n collapseInlineTagWhitespace: true,\n collapseWhitespace: true,\n removeEmptyAttributes: true,\n removeRedundantAttributes: true,\n sortAttributes: true,\n sortClassName: true,\n trimCustomFragments: true\n }\n })\n .transform(babelify, {\n presets: [\n [\n '@babel/preset-env',\n {\n 'useBuiltIns': 'usage',\n 'corejs': 3\n }\n ]\n ],\n extensions: ['.ts']\n })\n .transform('exposify', { expose: { angular: 'angular' }, filePattern: /\\.ts/ })\n .external(['angular']);\n\n // se solicitado a minificação...\n if (production) {\n\n // aplique os seguintes plugins:\n // 1 - Aplique as configurações de produção\n // 2 - Minifique cada módulo (arquivo .ts) individualmente\n // 3 - Remove exports não utilizados\n // 4 - Simplifica os 'require' do js final para variáveis\n scripts = scripts.transform('envify', { global: true })\n .transform(uglifyify, { global: true })\n .plugin('common-shakeify')\n .plugin('browser-pack-flat/plugin');\n }\n\n // junte os arquivos e coloque o arquivo final na pasta de destino\n scripts = scripts.bundle();\n\n // se solicitado a minificação...\n if (production) {\n\n // aplique o seguinte plugin:\n // 1 - minifica o arquivo js final\n scripts = scripts.pipe(minifyStream({ sourceMap: false }));\n }\n\n scripts = scripts.pipe(source(`${appName}.min.js`))\n .pipe(buffer());\n\n scripts = scripts.pipe(gulp.dest(dest.js));\n\n streamJs = scripts;\n }\n\n return streamJs;\n }\n\n // realiza processos para gerar os arquivos css\n function css() {\n\n // 1 - pegue o arquivo sass/scss referente ao app\n // 2 - compile o arquivo para css\n // 3 - aplique atributos compatíveis com a versão de browser especificada na propriedade \"browserslist\" do arquivo package.json\n // 4 - crie os arquivos e coloque o compilado css na pasta de destino\n // 5 - minifique o arquivo css\n // 6 - renomeie o arquivo minificado\n // 7 - coloque minificado css na pasta de destino\n let css = gulp.src(`${src.sass}/${appName}.{scss,sass}`)\n .pipe(sassCompiler().on('error', sassCompiler.logError))\n .pipe(autoprefixer())\n .pipe(csso())\n .pipe(rename({ extname: '.min.css' }))\n .pipe(gulp.dest(dest.css));\n\n if (uploadFiles) {\n\n // aplique a stream de upload de arquivos\n css = upload(css, dest.css);\n }\n\n return css;\n }\n}", "function compileHTML(){\n return gulp.src(config.assetPath + \"/markup/**/*.html\")\n .pipe(mustache(config.meta, {\n extension: \".html\"\n }))\n .pipe(gulp.dest( config.dev ))\n}", "function compile(watch){\n var bundle= browserify('./src/index.js');\n\n\n\n if(watch){\n bundle=watchify(bundle);\n //se utilizara el metodo on y el evento update\n // la funcion se llamara cada cuendo haya cambios\n bundle.on('update', function(){\n console.log(\"--> Bundling....\");\n rebundle();\n })\n }\n\n function rebundle(){\n bundle\n .transform(babel, {presets: [\"es2015\"], plugins:['syntax-async-functions','transform-regenerator'] })\n .bundle()\n .on('error', function(err){\n console.log(err);\n this.emit('end')\n })\n .pipe(source('index.js'))\n //.pipe(souce('index.js'))\n .pipe(rename('app.js'))\n .pipe(gulp.dest('public'));\n }\n\n //lo llamara por primera vez\n rebundle();\n}", "function copyIndexFile() {\n return gulp.src([\n srcRoot + '/index.html'\n ])\n //delete script line, last body tag, and last html tag.\n //these rows get recreated below.\n .pipe(deleteLines({\n 'filters': [\n /<script\\s+type=[\"']text\\/javascript[\"']\\s+src=/i\n ]\n }))\n .pipe(deleteLines({\n 'filters': [\n /<\\/html/\n ]\n }))\n //update script files to use include statements\n //append body and html tags at end of file\n .pipe(headerfooter.footer(\"\\n<?!= include('inline.bundle.js.html'); ?>\\n\"))\n .pipe(headerfooter.footer(\"<?!= include('polyfills.bundle.js.html'); ?>\\n\"))\n .pipe(headerfooter.footer(\"<?!= include('styles.bundle.js.html'); ?>\\n\"))\n .pipe(headerfooter.footer(\"<?!= include('vendor.bundle.js.html'); ?>\\n\"))\n .pipe(headerfooter.footer(\"<?!= include('main.bundle.js.html'); ?>\\n\"))\n .pipe(headerfooter.footer(\"</body>\\n </html>\"))\n .pipe(gulp.dest(dstRoot));\n}", "function mainJs() {\n notify('Building JS files...');\n return gulp.src('src/js/main/**/*.js')\n .pipe(sourcemaps.init())\n .pipe(uglify())\n .pipe(concat('scripts.min.js'))\n .pipe(plumber())\n .pipe(sourcemaps.write('.'))\n .pipe(gulp.dest('_site/assets/js/'))\n .pipe(browserSync.reload({ stream: true }))\n .pipe(gulp.dest('assets/js'));\n}", "function HeadScripts(){\n return parent.gulp.src(parent.CONFIG.appHeadScripts)\n //.pipe(parent.concat('dependencies.min.js'))\n //.pipe(parent.gulpIf(parent.dist, parent.uglify()))\n .pipe(parent.gulp.dest((parent.dist ? parent.CONFIG.distRoot : parent.CONFIG.tmpRoot) + '/assets'));\n}", "function templateContent() {\n const html = fs.readFileSync(\n path.resolve(process.cwd(), 'app/index.html')\n ).toString();\n\n if (!dllPlugin) { return html; }\n\n const doc = cheerio(html);\n const body = doc.find('body');\n const dllNames = !dllPlugin.dlls ? ['reactBoilerplateDeps'] : Object.keys(dllPlugin.dlls);\n\n dllNames.forEach(dllName => body.append(`<script data-dll='true' src='/${dllName}.dll.js'></script>`));\n\n return doc.toString();\n}", "function scripts() {\n\treturn src([\n\t\t// 'node_modules/jquery/dist/jquery.min.js', // npm vendor example (npm i --save-dev jquery)\n\t\t'docs/js/common.js' // common.js. Always at the end\n\t])\n\t\t.pipe(concat('scripts.min.js'))\n\t\t.pipe(babel({\n\t\t\tpresets: ['@babel/env'],\n\t\t\tplugins: ['@babel/plugin-syntax-import-meta'],\n\t\t}))\n\t\t.pipe(uglify()) // Minify JS (opt.)\n\t\t.pipe(dest('docs/js'))\n\t\t.pipe(browserSync.stream())\n}", "async function scripts() {\n\tlet watch = (mode == 'production') ? false : true;\n\n\tconst config = {\n\t\twatch: watch,\n\t\tmode: mode,\n\t\tentry: {\n\t\t\t'main': './src/js/main.js',\n\t\t\t'app': './src/js/app.js',\n\t\t},\n\t\toutput: {\n\t\t\tpath: __dirname,\n\t\t\tfilename: '[name].js'\n\t\t},\n\t\tmodule: {\n\t\t\trules: [\n\t\t\t\t{\n\t\t\t\t\ttest: /\\.vue$/,\n\t\t\t\t\tloader: 'vue-loader'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttest: /\\.scss$/,\n\t\t\t\t\tuse: [\n\t\t\t\t\t\t'vue-style-loader',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tloader: 'css-loader',\n\t\t\t\t\t\t\toptions: { modules: true }\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'sass-loader'\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tplugins: [\n\t\t\tnew VueLoaderPlugin()\n\t\t]\n\t};\n\n\treturn src('./src/js/*.js')\n\t\t.pipe(webpack(config))\n\t\t.pipe(dest('build/js/'))\n\t\t.pipe(browserSync.stream());\n}", "function watch() {\n gulp.watch(['src/templates/**/*.hbs'], ['pages', reload]);\n gulp.watch(['src/**/*.js'], ['scripts', reload]);\n gulp.watch(['src/**/*.{less,css}'], ['styles', reload]);\n gulp.watch(['src/**/*.{svg,png,jpg,gif}'], ['assets', reload]);\n gulp.watch(['package.json', 'bower.json'], ['assets']);\n}", "function pages(cb) {\n // Gets .html files. see file layout at bottom\n var env = new $.nunjucks.Environment(\n new $.nunjucks.FileSystemLoader(templates)\n );\n // all fo the follwing is optional and this will all work just find if you don't include any of it. included it here just in case you need to configure it.\n $.marked.setOptions({\n renderer: new $.marked.Renderer(),\n gfm: true,\n tables: true,\n breaks: false,\n pedantic: false,\n sanitize: true,\n smartLists: true,\n smartypants: false\n });\n\n // This takes the freshley created nunjucks envroment object (env) and passes it to nunjucks-markdown to have the custom tag regestered to the env object.\n // The second is the marked library. anything that can be called to render markdown can be passed here.\n $.markdown.register(env, $.marked);\n\n // let data = JSON.parse({ files: getData('markup') });\n let data = { files: getData('markup') };\n let cData = { cFiles: getData('markup-c') };\n\n // get styles data\n src([templates + '/*.html'])\n // Renders template with nunjucks and marked\n .pipe($.data(data))\n .pipe($.gulpnunjucks.compile('', { env: env }))\n // Uncomment the following if your source pages are something other than *.html.\n // .pipe(rename(function (path) { path.extname=\".html\" }))\n // output files in dist folder\n .pipe(dest(dist));\n\n // get components data\n src([templates + '/*.html'])\n // Renders template with nunjucks and marked\n .pipe($.data(cData))\n .pipe($.gulpnunjucks.compile('', { env: env }))\n .pipe(dest(dist));\n\n cb();\n}", "function cons() {\n return src([\n 'src/js/jquery.custom.min.js',\n 'src/js/menu.min.js',\n 'src/js/swiper.custom.min.js',\n ], { sourcemaps: true })\n .pipe(concat('app.min.js'))\n .pipe(dest('dist/', { sourcemaps: true }))\n}", "function copyProjectToDist() {\n fs.rmSync(\"dist\", { force: true, recursive: true });\n fs.mkdirSync(path.join(\"dist\", \"webdriver-ts\"), { recursive: true });\n\n fs.copyFileSync(\n path.join(\"webdriver-ts\", \"table.html\"),\n path.join(\"dist\", \"webdriver-ts\", \"table.html\")\n );\n fs.copyFileSync(\"index.html\", path.join(\"dist\", \"index.html\"));\n\n processDirectories();\n}", "function bind(indexHtmlFileName, buildConfig, buildParam) {\r\n return {\r\n generateConfigFile: function(callback) {\r\n var config = devUtil.generateAppConfig(buildParam.baseUrl, buildParam.waitSeconds, buildParam.configObject);\r\n fs.writeFile(\r\n buildConfig.mainConfigFile,\r\n 'define(function() { requirejs.config('+ JSON.stringify(devUtil.generateConfig(config)) +'); });',\r\n 'utf8',\r\n function(err, written, buffer) { if (!err) callback(); }\r\n );\r\n },\r\n\r\n purgeWorkingDir: function(callback) {\r\n logHeader('PURGE WORKING DIR');\r\n\r\n exec('rm -Rf build/working', function(error, stdout, stderr) { callback(); });\r\n },\r\n\r\n initializeWorkingDir: function(callback) {\r\n logHeader('MAKE WORKING DIR');\r\n\r\n exec('mkdir -p build/working', function(error, stdout, stderr) { callback(); });\r\n },\r\n\r\n copyLibs: function(callback) {\r\n logHeader('COPY LIBS TO MERGED DIR');\r\n ncp('../../lib/client', buildConfig.appDir, {filter: buildConfig.filter}, callback);\r\n },\r\n\r\n copyApps: function(callback) {\r\n logHeader('COPY APPS TO MERGED DIR');\r\n ncp('client', buildConfig.appDir, callback);\r\n },\r\n\r\n optimize: function(callback) {\r\n logHeader('OPTIMIZE');\r\n\r\n requirejs.optimize(buildConfig, function(buildOutput) {\r\n logHeader('OPTIMIZE COMPLETE', buildOutput);\r\n callback();\r\n });\r\n },\r\n\r\n finalizeBuild: function(callback) {\r\n logHeader('FINALIZE BUILD');\r\n\r\n var copyrightTemplate = fs.readFileSync('../../copyright_template.txt', 'utf8').replace('{{BUILD_YEAR}}', (new Date()).getFullYear());\r\n\r\n for (var i = 0; i < buildConfig.modules.length; i++) {\r\n var module = buildConfig.modules[i];\r\n\r\n var moduleRoot = buildConfig.dir + module.name.replace('main', '');\r\n var indexPath = moduleRoot + indexHtmlFileName;\r\n\r\n console.log('Modifying ' + indexPath + '...');\r\n\r\n // Prepend copyright notices.\r\n prependCopyrightNotice(moduleRoot + 'main.js', '/*', '*/', copyrightTemplate);\r\n\r\n // Add md5 checksum all urls in index.aspx, to break client side caches.\r\n var indexhtml = fs.readFileSync(indexPath, 'utf8');\r\n\r\n indexhtml = cacheBreak(indexhtml, moduleRoot, /data-main=\"(\\w+)\"/g,\r\n function(match) { return match + '.js'; },\r\n function(match, version) { return 'data-main=\"' + match + '.js?v=' + version + '\"'; }\r\n );\r\n indexhtml = cacheBreak(indexhtml, moduleRoot, /href=\"(\\S+).css\"/g,\r\n function(match) { return match + '.css'; },\r\n function(match, version) { return 'href=\"' + match + '.css?v=' + version + '\"'; }\r\n );\r\n\r\n fs.writeFileSync(indexPath, indexhtml, 'utf8');\r\n }\r\n\r\n // Purge unoptimized JS files from package and app hierarchy (save <module>/main.js).\r\n var appMains = buildConfig.modules.map(function(module) {\r\n return fs.realpathSync(buildConfig.dir + module.name + '.js');\r\n });\r\n\r\n var libFiles = [];\r\n visitTree(buildConfig.dir + '/packages/platform/lib', function(path) {\r\n libFiles.push(path);\r\n });\r\n\r\n var resourceFiles = [];\r\n var packagesPath = buildConfig.dir + 'packages';\r\n\r\n fs.readdirSync(packagesPath).forEach(function(topPackageName) {\r\n var topPackagePath = packagesPath + '/' + topPackageName;\r\n\r\n if (fs.statSync(topPackagePath).isDirectory()) {\r\n\r\n fs.readdirSync(topPackagePath).forEach(function (packageName) {\r\n var nlsPath = topPackagePath + '/' + packageName + '/nls';\r\n\r\n if (fs.existsSync(nlsPath)) {\r\n var rootResourceNames = [];\r\n var localizationNames = [];\r\n\r\n // Exclude localized resources for each root resource\r\n fs.readdirSync(nlsPath).forEach(function (nlsName) {\r\n if (fs.statSync(nlsPath + '/' + nlsName).isDirectory()) {\r\n localizationNames.push(nlsName);\r\n } else {\r\n rootResourceNames.push(nlsName);\r\n }\r\n });\r\n\r\n localizationNames.forEach(function (localizationName) {\r\n rootResourceNames.forEach(function (rootResourceName) {\r\n resourceFiles.push(fs.realpathSync(\r\n nlsPath + '/' + localizationName + '/' + rootResourceName\r\n ));\r\n });\r\n });\r\n }\r\n });\r\n }\r\n });\r\n\r\n var purgeExceptions = appMains.concat(libFiles).concat(resourceFiles);\r\n\r\n purgeJsFiles(buildConfig.dir + 'packages', purgeExceptions);\r\n buildConfig.modules.forEach(function(module) {\r\n purgeJsFiles(buildConfig.dir + module.name.replace('main', ''), appMains);\r\n });\r\n\r\n // Purge .DS_Store crud.\r\n visitTree(buildConfig.dir, function(path) {\r\n var dsPath = path + '/' + '.DS_Store';\r\n if (fs.existsSync(dsPath)) {\r\n fs.unlinkSync(dsPath);\r\n }\r\n });\r\n\r\n // Purge empty dirs.\r\n visitTree(buildConfig.dir, function(path) {\r\n if (fs.statSync(path).isDirectory() && 0 === fs.readdirSync(path).length) {\r\n fs.rmdirSync(path);\r\n }\r\n });\r\n\r\n fs.unlinkSync(buildConfig.mainConfigFile);\r\n callback();\r\n },\r\n\r\n run: function(callback) {\r\n return async.series([\r\n this.generateConfigFile,\r\n this.initializeWorkingDir,\r\n this.copyLibs,\r\n this.copyApps,\r\n this.optimize,\r\n this.finalizeBuild\r\n ], callback);\r\n }\r\n };\r\n}", "function browserifyComponents(shouldWatch) {\n var b = browserify({\n cache: {},\n packageCache: {},\n fullPaths: true,\n debug: true\n });\n if (shouldWatch) {\n b = watchify(b);\n b.on('update', function () {\n console.log('Updating components')\n return bundleShare(b);\n });\n }\n //Add file to browserify list\n b.add('./src/base/components/components.js');\n b.add('./src/base/components/uiHelper.js');\n //b.add('./src/base/services/jsonPa)rser.js')\n return bundleShare(b);\n function bundleShare(b) {\n return b.bundle()\n .pipe(source('components.js'))\n .pipe(gulp.dest('./test/components/js'));\n }\n}", "function loadScripts(){\n renderer.setIPC();\n inject.uglifyScripts();\n inject.injectScripts();\n}", "function html() {\n // Gets .html and .nunjucks files in pages\n return gulp.src('src/pages/**/*.+(html|nunjucks)')\n // Renders template with nunjucks\n .pipe(nunjucksRender({\n path: ['src/templates']\n }))\n // output files in src folder\n .pipe(gulp.dest('app'));\n}", "function buildBootstrap () {\n\tvar basePath = './node_modules/bootstrap/dist/',\n\t\toutFolder = './app/lib/bootstrap/';\n\n gulp.src([basePath + 'css/bootstrap.css', basePath + 'css/bootstrap-theme.css'])\n .pipe(sourcemaps.init({loadMaps : true}))\n .pipe(sourcemaps.write('./'))\n .pipe(gulp.dest(outFolder + 'css'));\n\n gulp.src(basePath + 'js/bootstrap.js', {base: basePath})\n \t.pipe(gulp.dest(outFolder));\n\n gulp.src(basePath + 'fonts/*').pipe(gulp.dest(outFolder + 'fonts'));\n}", "function watch() {\n browserSync.init({\n // Tell browser to use thos directory and serve it as a mini-server\n server: {\n baseDir: \"./build\"\n }\n });\n\n style();\n\n gulp.watch(paths.styles.src, style);\n\n // Tell gulp which files to watch to trigger the reload\n // This can be html or whatever you're using to develop your website\n gulp.watch(paths.html.src).on('change', browserSync.reload);\n}", "function watch() {\n\n //set base directory for browsersync\n browserSync.init({\n server: {\n baseDir: \"src\",\n index: \"/index.html\"\n }\n }\n\n );\n\n //define our watch tasks\n gulp.watch(['node_modules/bootstrap/scss/bootstrap.scss', 'src/scss/*.scss'], style);\n gulp.watch('src/*.html').on('change', browserSync.reload);\n gulp.watch('src/js/*.js').on('change', browserSync.reload);\n\n\n}", "function copyIndex() {\n return gulp.src(\"./index.html\")\n .pipe(gulp.dest(\"./dist/\"));\n}", "function compileStyles() {\n return gulp.src(files.mainScss)\n .pipe(plugins.inject(\n gulp.src([files.styles, `!${files.mainScss}`, `!${files.bowerComponents}`]),\n {\n relative: true,\n starttag: '/*** scss-inject ***/',\n endtag: '/*** end scss-inject ***/',\n transform(filepath) {\n return `@import \"${filepath}\";`;\n },\n },\n ))\n .pipe(plugins.sourcemaps.init())\n .pipe(plugins.sass({\n includePaths: [paths.bowerComponents],\n outputStyle: 'compressed',\n }))\n .pipe(plugins.autoprefixer())\n .pipe(plugins.sourcemaps.write())\n .pipe(gulp.dest(paths.tmp));\n}", "async function init() {\n const html = await fetchHtml();\n const tempElm = document.createElement('html');\n tempElm.innerHTML= html.replace(/href=\"./g, `href=\"${packageUrl}/build`).replace(/src=\"./g, `src=\"${packageUrl}/build`);\n \n const scripts = tempElm.querySelectorAll('script');\n const styles = tempElm.querySelectorAll('link[rel=stylesheet]');\n\n // Create root element if not exists\n createRootElm();\n\n // Load RESTool (most recent) styles\n loadStyles(styles);\n\n // Load RESTool (most recent) scripts\n loadScriptsRecursively(Array.apply(null, scripts));\n }", "function watch() {\n // browsersync.init({\n // server: {\n // baseDir: './'\n // }\n // });\n gulp.watch('./assets/stylesheet/scss/**/*.scss', style);\n gulp.watch('./*.html').on('change', browsersync.reload);\n}", "function htmlDevelopmentBuild(cb) {\r\n return src(htmlSource)\r\n .pipe(dest(htmlDestination));\r\n cb();\r\n}", "function serve() {\n const options = {\n server: {\n baseDir: BUILD_PATH\n },\n open: false // Change it to true if you wish to allow Browsersync to open a browser window.\n }\n\n browserSync(options)\n\n // Watches for changes in files inside the './src' folder.\n gulp.watch(`${SOURCE_PATH}/**/*.js`, ['watch-js'])\n\n // Watches for changes in files inside the './static' folder. Also sets 'keepFiles' to true (see cleanBuild()).\n gulp.watch(`${STATIC_PATH}/**/*`, ['watch-static']).on('change', () => {\n keepFiles = true\n })\n}", "function watch() {\n\tserverInit();\n\tgulp.watch(\"./app/scss/*.scss\", cssHandler);\n\tgulp.watch(\"./app/pug/*.pug\", htmlHandler);\n\tgulp.watch(\"./app/js/*.js\", jsHandler);\n}", "function bowerCSSTask() {\n return gulp\n .src(mainBowerFiles({\n filter: '**/*.css',\n checkExistence: true\n }))\n .pipe(gulp.dest(ENV.bower.dst.css, {overwrite: true}));\n }", "function index() {\n return gulp.src('./src/index.html')\n .pipe(gulp.dest(PATHS.dist))\n }", "function watch(){\n\n browser_Sync.init({\n server: {\n baseDir: \"app\"\n }\n });\n\n gulp.watch('app/*.html').on('change', browser_Sync.reload);\n gulp.watch('app/assets/css/**/*.css', styles_files);\n gulp.watch('app/assets/js/**/*.js', scripts_files);\n\n\n}", "function watchHtml() {\n const watchDirectories = config.html.sources;\n if (config.html.twig.enabled) {\n watchDirectories.push(config.html.twig.baseDir + '**/*.twig');\n watchDirectories.push(config.html.twig.dataSrc + '**/*.json');\n }\n return gulp.watch(watchDirectories, gulp.series('compile:html', 'validate:html'));\n }", "function statics(){\n slushy\n .src( templates.static.base.all() )\n .pipe($.rename( _this.files().replace ) )\n .pipe($.template( filters ))\n .pipe($.conflict( _this.dirs.root ) )\n .pipe( slushy.dest( _this.dirs.root ) )\n }", "async function injectAllScripts() {\n\n // inject our customizations manually so that we can just depend on the\n // stock pdf.js viewer.html application.\n\n // TODO: make this into an if / then if we're running in a renderer process.\n // if(isElectron()) {\n // window.$ = window.jQuery = await require('/node_modules/jquery/dist/jquery.min.js');\n // } else {\n await injectScript('/node_modules/jquery/dist/jquery.min.js', 'module');\n window.$ = window.jQuery;\n // }\n\n // TODO: use a Promise.all() on all of these to await them as a batch.\n // It's not going to make a massive performance difference though since we\n // are loading locally.\n\n await injectScript('/web/js/utils.js', 'module');\n await injectScript('/web/js/polar.js');\n //injectScript('/web/js/annotations.js');\n await injectScript('/web/js/metadata.js');\n await injectScript('/web/js/model.js');\n await injectScript('/web/js/view.js', 'module');\n await injectScript('/web/js/controller.js', 'module');\n await injectScript('/web/js/clock.js');\n await injectScript('/web/js/optional.js');\n await injectScript('/web/js/datastore/datastore.js');\n await injectScript('/web/js/text-highlights.js', 'module');\n await injectScript('/lib/TextHighlighter.js');\n\n}", "function createStatic() {\n fs.copy(config.paths.assets_dir, config.paths.public_dir + \"/\" + config.paths.public_assets_dir)\n .then(() => {\n renderToPublic();\n })\n .catch(err => {\n console.error(err)\n })\n}", "function scripts (watch, dest) {\n watch = watch || false;\n dest = dest || paths.build;\n\n var options = _.assign({}, watchify.args, {\n entries: ['./src/index.js'],\n standalone: 'datalasso'\n });\n\n if (watch) {\n options.plugin = [watchify];\n options.debug = true;\n }\n\n var b = browserify(options);\n b.transform('jstify', { engine: 'lodash' })\n b.transform(sassr);\n\n bundle = function () {\n return b.bundle()\n .on('error', console.error.bind(console, 'Browserify Error'))\n .pipe(source('datalasso.js'))\n .pipe(buffer())\n .pipe(gulpif(watch, sourcemaps.init({loadMaps: true})))\n .pipe(gulpif(watch, sourcemaps.write('./')))\n .pipe(derequire())\n .pipe(gulp.dest(dest));\n }\n\n b.on('update', bundle);\n b.on('log', console.log);\n\n return bundle();\n}", "function html(){\n\treturn gulp.src('./src/*.html')\n\t\t\t .pipe(gulp.dest('./dist'))\n\t\t\t .pipe(browserSync.stream());\n}", "function scripts() {\n var jsFile = [\n \"src/js/jquery.js\",\n \"src/js/script.js\"\n ];\n return gulp\n .src(jsFile, { sourcemaps: true })\n .pipe(plumber())\n .pipe( concat( 'theme.js' ) )\n .pipe(gulp.dest(`${config.src.root}/js`, { sourcemaps: true }))\n .pipe(gulp.dest(`${config.dist}/js`, { sourcemaps: true }))\n .pipe(rename({ suffix: \".min\" }))\n .pipe( uglify())\n .pipe(gulp.dest(`${config.src.root}/js`, { sourcemaps: true }))\n .pipe(gulp.dest(`${config.dist}/js`, { sourcemaps: true }));\n}", "function buckyTutorials() {\n\tbuckyHTML();\n\tbuckyAngularJS();\n}", "function pugHtml() {\n return src('src/pug/pages/*.pug')\n .pipe(\n pug({\n pretty: true,\n })\n )\n .pipe(dest('dist'));\n}", "function javascript() {\n return gulp.src(PATHS.javascript)\n .pipe($.sourcemaps.init())\n .pipe($.babel({ignore: ['html2canvas.js', 'quill.min.js']}))\n .pipe($.concat('app.js'))\n .pipe($.if(PRODUCTION, $.uglify()\n .on('error', e => { console.log(e); })\n ))\n .pipe($.if(!PRODUCTION, $.sourcemaps.write()))\n .pipe(gulp.dest(PATHS.dist + '/scripts'));\n}", "function addDefaultAssets() {\n // Skip this step on the browser, or if emptyRepo was supplied.\n var isNode = require('detect-node');\n if (!isNode || opts.emptyRepo) {\n return doneImport(null);\n }\n\n var blocks = new BlockService(self._repo);\n var dag = new DagService(blocks);\n\n var initDocsPath = path.join(__dirname, '../../init-files/init-docs');\n\n var i = new Importer(dag);\n i.resume();\n\n glob(path.join(initDocsPath, '/**/*'), function (err, res) {\n if (err) {\n throw err;\n }\n var index = __dirname.lastIndexOf('/');\n parallelLimit(res.map(function (element) {\n return function (callback) {\n var addPath = element.substring(index + 1, element.length);\n if (!fs.statSync(element).isDirectory()) {\n var rs = new Readable();\n rs.push(fs.readFileSync(element));\n rs.push(null);\n var filePair = { path: addPath, content: rs };\n i.write(filePair);\n }\n callback();\n };\n }), 10, function (err) {\n if (err) {\n throw err;\n }\n i.end();\n });\n });\n\n i.once('end', function () {\n doneImport(null);\n });\n\n function doneImport(err, stat) {\n if (err) {\n return callback(err);\n }\n\n // All finished!\n callback(null, true);\n }\n }", "function cssTask(){\n return src(files.cssPath)\n .pipe(browserSync.stream())\n .pipe(concatCss(\"css/main.css\"))\n .pipe(cleanCSS({compatibility: 'ie8'}))\n .pipe(dest('pub')\n );\n }", "function htmlHandler() {\n\treturn gulp.src(\"./app/pug/index.pug\")\n\t.pipe(pug({pretty: true}).on(\"error\", errorHandler))\n\t.pipe(gulp.dest(\"./dist/\"))\n\t.pipe(browserSync.stream());\n}", "function Index(){\n\treturn parent.gulp.src(parent.CONFIG.index)\n\t\t.pipe(parent.fileinclude({\n\t\t\tprefix: '@@'\n\t\t}))\n\t\t.pipe(parent.preprocess({\n\t\t\tcontext: {\n\t\t\t\tENVIRONMENT: parent.dist ? 'PRODUCTION' : 'DEVELOPMENT',\n\t\t\t\tTS: Date.now()\n\t\t\t}\n\t\t}))\n\t\t.pipe(parent.gulp.dest(parent.build ? parent.CONFIG.distRoot : parent.CONFIG.tmpRoot));\n}", "function scripts() {\n return (\n gulp\n .src([\"./assets/js/**/*\"])\n .pipe(newer(\"./docs/assets/js\"))\n .pipe(babel({presets: ['@babel/preset-env']}))\n .pipe(minify({noSource: true, ext: {min: '.min.js'}}))\n .pipe(gulp.dest(\"./docs/assets/js/\"))\n );\n}", "injectStitchFrameworkCss() {\n\n let node_string = \"<style type=\\\"text/css\\\">\" + Stitch_FrameWork_EmbeddedStyles + \"</style>\";\n\n let style = document.createElement(\"style\");\n style.type = 'text/css';\n\n if (style.styleSheet) {\n style.styleSheet.cssText = node_string;\n } else {\n style.appendChild(document.createTextNode(Stitch_FrameWork_EmbeddedStyles));\n }\n\n document.getElementsByTagName(\"head\")[0].appendChild(style);\n }", "async function documentAll(config = {}) {\n configure(config)\n await fs.mkdirs(config.output)\n\n for (const source of config.sources) {\n await documentOne(source, config)\n }\n\n await copyAsset(config.css, 'file', config)\n await copyAsset(config.public, 'directory', config)\n}", "function compileToMinifiedHTML() {\n return src(srcFiles.pathPug).pipe(pug()).pipe(dest(destFolders.minified));\n}", "function compileCSS() {\n return gulp.src(\"app/css/**/*.css\")\n .pipe(concat(\"bundled.css\"))\n .pipe(gulpif(argv.production, streamify(minifyCSS())))\n .pipe(gulp.dest(\"build/css/\"))\n .pipe(gulpif(argv.livereload, livereload()));\n}", "function browserSync() {\r\n // Run serveSass when starting the dev server to make sure the SCSS & dev CSS are the same\r\n serveSass();\r\n\r\n bs.init({\r\n // Dev server will run at localhost:8080\r\n port: 8080,\r\n server: {\r\n baseDir: paths.input,\r\n },\r\n });\r\n\r\n watch(paths.devHTML).on('change', bs.reload);\r\n watch(paths.devCSS).on('change', bs.reload);\r\n watch(paths.devJS).on('change', bs.reload);\r\n}", "function watch() {\r\n gulp.watch('scss/**/*', gulp.series(compileSass));\r\n gulp.watch('html/pages/**/*', gulp.series(compileHtml));\r\n gulp.watch('html/{layouts,includes,helpers,data}/**/*', gulp.series(compileHtmlReset, compileHtml));\r\n}", "function modules() {\n // Bootstrap JS \n var bootstrapJS = gulp.src('./node_modules/startbootstrap-sb-admin-2/vendor/bootstrap/js/*')\n .pipe(gulp.dest(paths.vendor + '/bootstrap/js'));\n\n // Bootstrap Select\n var bootstrapSelectJS = gulp.src('./node_modules/bootstrap-select/dist/js/*')\n .pipe(gulp.dest(paths.vendor + '/bootstrap-select/js'));\n var bootstrapSelectCSS = gulp.src('./node_modules/bootstrap-select/dist/css/*')\n .pipe(gulp.dest(paths.vendor + '/bootstrap-select/css'));\n\n // Bokeh\n var bokehJS = gulp.src('./node_modules/@bokeh/bokehjs/build/js/bokeh.min.js')\n .pipe(gulp.dest(paths.vendor + '/bokehjs'));\n\n // SB Admin 2 Bootstrap template\n var bootstrapSbAdmin2 = gulp.src([\n './node_modules/startbootstrap-sb-admin-2/js/*.js',\n './node_modules/startbootstrap-sb-admin-2/css/*.css'\n ]).pipe(gulp.dest(paths.vendor + '/startbootstrap-sb-admin-2'));\n\n // Bootstrap4 toggle\n var bootstrap4toggle = gulp.src([\n './node_modules/bootstrap4-toggle/js/*.js',\n './node_modules/bootstrap4-toggle/css/*.css'\n ]).pipe(gulp.dest(paths.vendor + '/bootstrap4-toggle'));\n\n // dataTables\n var dataTables = gulp.src([\n './node_modules/datatables.net/js/*.js',\n './node_modules/datatables.net-bs4/js/*.js',\n './node_modules/datatables.net-bs4/css/*.css'\n ])\n .pipe(gulp.dest(paths.vendor + '/datatables'));\n\n // dataTables-buttons\n var dataTablesButtons = gulp.src([\n './node_modules/datatables.net-buttons/js/*.js',\n './node_modules/datatables.net-buttons-bs4/js/*.js',\n './node_modules/datatables.net-buttons-bs4/css/*.css'\n ])\n .pipe(gulp.dest(paths.vendor + '/datatables-buttons'));\n\n // Font Awesome\n var fontAwesome = gulp.src('./node_modules/@fortawesome/**/*')\n .pipe(gulp.dest(paths.vendor + ''));\n\n // jQuery Easing\n var jqueryEasing = gulp.src('./node_modules/jquery.easing/*.js')\n .pipe(gulp.dest(paths.vendor + '/jquery-easing'));\n\n // jQuery\n var jquery = gulp.src([\n './node_modules/jquery/dist/*',\n '!./node_modules/jquery/dist/core.js'\n ])\n .pipe(gulp.dest(paths.vendor + '/jquery'));\n\n // jszip\n var jszip = gulp.src([\n './node_modules/jszip/dist/*.js',\n ])\n .pipe(gulp.dest(paths.vendor + '/jszip'));\n\n // d3 celestial\n var d3Celestial = gulp.src([\n './node_modules/d3-celestial/celestial*.js',\n './node_modules/d3-celestial/lib/d3*.js'\n ])\n .pipe(gulp.dest(paths.vendor + '/d3-celestial'));\n var d3CelestialData = gulp.src('./node_modules/d3-celestial/data/*.json')\n .pipe(gulp.dest(paths.vendor + '/d3-celestial/data'));\n var d3CelestialImage = gulp.src('./node_modules/d3-celestial/images/*')\n .pipe(gulp.dest(paths.cssDir + '/images'));\n\n // particles.js\n var particlesJs = gulp.src('./node_modules/particles.js/particles.js')\n .pipe(gulp.dest(paths.vendor + '/particles.js'));\n\n // PrismJs\n var prismJs = gulp.src('./node_modules/prismjs/prism.js')\n .pipe(gulp.dest(paths.vendor + '/prismjs'));\n var prismJsYaml = gulp.src('./node_modules/prismjs/components/prism-yaml.min.js')\n .pipe(gulp.dest(paths.vendor + '/prismjs'));\n var prismJsLineNum = gulp.src('./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.min.js')\n .pipe(gulp.dest(paths.vendor + '/prismjs/line-numbers'));\n var prismJsCss = gulp.src('./node_modules/prismjs/themes/prism.css')\n .pipe(gulp.dest(paths.vendor + '/prismjs'));\n var prismJsLineNumCss = gulp.src('./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css')\n .pipe(gulp.dest(paths.vendor + '/prismjs/line-numbers'));\n\n return merge(bootstrapJS, bootstrapSbAdmin2, bootstrap4toggle, bokehJS, dataTables, dataTablesButtons, fontAwesome, jquery, jqueryEasing, jszip, d3Celestial, d3CelestialData, d3CelestialImage, particlesJs, prismJs, prismJsYaml, prismJsLineNum, prismJsCss, prismJsLineNumCss);\n}", "function browsersync() {\n gulp_browsersync.init({\n server: {\n baseDir: 'dist/'\n }\n });\n}", "function bundle(name){\n var path = 'client/' + name + '/index';\n var js = path + '.js';\n var css = path + '.css';\n var scss = path + '.scss';\n var dest = 'build/bundles/' + name;\n var assets_source = 'client/common/branding/assets';\n var assets_destination = dest + '/assets';\n\n function build(){\n // browserify\n browserifyFile(js, dest);\n // sass\n sassFile(scss, dest);\n //assets\n assets(assets_source, assets_destination);\n }\n\n function watch(){\n // browserify\n browserifyFile(js, dest, {watch:true});\n\n // sass\n sassFile(scss, dest)\n gulp.watch('client/' + name + '/**/*.scss', function(){\n return sassFile(scss, dest, {watch:true});\n });\n }\n\n return {\n build: build,\n watch: watch\n }\n}", "function watcher() {\n src('src/js/livereload.js')\n .pipe(dest('dist/'));\n\n watch(['./src/**/*.html'], { ignoreInitial: false }, html);\n watch(['./src/**/.js'], { ignoreInitial: false }, series(min, cons));\n watch(['./src/**/.styl'], { ignoreInitial: false }, css);\n watch(['./src/images/**'], { ignoreInitial: false }, images);\n}", "async function run() {\n const routeToComponentModuleMap = await getRouteToComponentModuleMap(\n getReactRouterRoutes('./App/Routes')\n )\n\n const linksAndRoutes = buildLinksAndRoutes(routeToComponentModuleMap)\n\n // clean out public/\n await remove('./public/')\n console.log('Cleaned public/')\n\n // write index.html files for each known route (does both static and dynamic right now but dynamic is wrong)\n const renderedRoutes = await renderRoutes(routeToComponentModuleMap, linksAndRoutes)\n console.log('Routes to render', renderedRoutes)\n await Promise.all(\n Object.entries(renderedRoutes).map(async ([route, indexHTML]) => {\n // replace :param in the react route with _param in the directory name generated\n // so that it's easier to write rewrite rules for tools like serve, nginx, etc\n const publicPath = resolve(CWD, 'public', '.' + route.replace(/\\/:/g, '/_'))\n await mkdirp(publicPath)\n await writeFile(`${publicPath}${publicPath.endsWith('/') ? '' : '/'}index.html`, indexHTML)\n console.log('Generated', publicPath + '/index.html')\n })\n )\n\n // generate public/assets/app.js and css bundles\n await execProm(`npx webpack --config ${path.resolve(CWD, 'webpack.static.config.js')}`)\n const webpackStaticBundlingLogs = readdirSync('./public/assets').map(\n f => `Generated ${resolve(CWD, './public/assets/', f)}`\n )\n console.log(webpackStaticBundlingLogs.join('\\n'))\n}", "function javascript() {\n return gulp.src('./src/scripts/**/*.js')\n .pipe($.sourcemaps.init())\n .pipe($.concat('app.js'))\n .pipe($.if(PRODUCTION, $.uglify()\n .on('error', e => { console.log(e); })\n ))\n .pipe($.if(!PRODUCTION, $.sourcemaps.write()))\n .pipe(gulp.dest('./dist/js/'));\n}", "function injectScripts() {\n const needToInject = fs.existsSync(INJECT_JS_PATH);\n if (!needToInject) {\n return;\n }\n require(INJECT_JS_PATH);\n}", "function watch() {\n gulp.watch(PATHS.assets, copy);\n gulp.watch('src/templates/**/*.html').on('change', gulp.series(pages, browser.reload));\n gulp.watch('src/index.html').on('change', gulp.series(index, browser.reload));\n gulp.watch('src/assets/scss/**/*.scss', sass);\n gulp.watch('src/assets/js/**/*.js').on('change', gulp.series(javascript, browser.reload));\n gulp.watch(['src/assets/img/**/*', 'src/assets/data/resolutions.json']).on('change', gulp.series(resp, browser.reload));\n gulp.watch(['src/assets/data/projects3.xls', 'src/assets/data/resolutions.json']).on('change', gulp.series(ex2json, browser.reload));\n // gulp.watch('src/styleguide/**').on('change', gulp.series(styleGuide, browser.reload));\n }", "function compileJs() {\n return merge(\n // config-theme.js\n src(['src/assets/js/*.js', '!src/assets/js/indonez/*.js'])\n .pipe(beautify({js: {file_types: ['.js']} })) \n .pipe(dest('dist/js')),\n\n // indonez.min.js\n src('src/assets/js/indonez/*.js')\n .pipe(concat('indonez.min.js', {newLine: '\\r\\n\\r\\n'}))\n //.pipe(babel({presets: ['babel-preset-env']}))\n .pipe(minify({minify: true, minifyJS: {sourceMap: false}}))\n .pipe(dest('dist/js/vendors')),\n\n // uikit.min.js\n src('node_modules/uikit/dist/js/uikit.min.js')\n .pipe(newer('dist/js/vendors'))\n .pipe(dest('dist/js/vendors')),\n\n // js vendors\n src('src/assets/js/vendors/*.js')\n .pipe(newer('dist/js/vendors'))\n .pipe(dest('dist/js/vendors'))\n )\n}", "function cssTask() {\n return src(files.cssPath)\n //conCat put the files togheter into a file with the name main.css\n .pipe(conCat('main.css'))\n .pipe(cssnano())\n .pipe(dest('pub/css'));\n}", "function scripts() {\n // Source\n return gulp.src(['src/Scripts/src/main.js'], {base: \"./src/Scripts/src\"})\n .pipe(vinylNamed())\n .pipe(webpackStream(webpackConfig))\n .pipe(gulp.dest('./src/Scripts/dist'))\n // Stream update to browsers\n .pipe(browserSync.stream());\n}", "loadDependencies() {\n gulpNunjucksRender = require('gulp-nunjucks-render');\n }", "function script(cb) {\n src(js.in)\n .pipe(sourcemaps.init())\n // .pipe(concat(\"app.js\")) //Will make all seperate file.\n .pipe(sourcemaps.write(\".\"))\n .pipe(dest(js.out))\n watch(js.watch, series(script, browsersync.reload))\n cb()\n}", "setup(app) {\n app.use('/assets', express.static(__dirname + '/assets'))\n }", "function scripts() {\n\tvar stream = browserify({\n\t\t\tfullPaths: false,\n\t\t\tentries: paths.src.scripts + 'main.js',\n\t\t\tdebug: config.sourcemaps.scripts,\n\t\t\textensions: config.extensions\n\t\t});\n\n\t// references to the vendors' bundle\n\tconfig.vendors.forEach(function(vendor) {\n\t\tstream.external(vendor);\n\t});\n\n\treturn stream\n\t\t.transform(babelify, { presets: config.presets })\n\t\t.bundle().on('error', errorHandler.bind(this))\n\t\t.pipe(source('main.js'))\n\t\t.pipe(gulp.dest(paths.dist.scripts))\n\t\t.pipe(bsync.reload({stream: true, once: true}));\n}" ]
[ "0.71322167", "0.7091961", "0.6842738", "0.6610468", "0.65285134", "0.6332572", "0.6306781", "0.6248213", "0.62262154", "0.6158753", "0.6129816", "0.6046693", "0.6044777", "0.60364723", "0.59398615", "0.59145343", "0.5904882", "0.5881265", "0.5879225", "0.58589405", "0.58497775", "0.58195055", "0.5812774", "0.57973605", "0.57910854", "0.5756727", "0.5693908", "0.5685314", "0.56660354", "0.56533474", "0.56459975", "0.56458724", "0.5623778", "0.5621067", "0.56155944", "0.5597062", "0.5596539", "0.55932075", "0.5576769", "0.5576133", "0.5574388", "0.55743504", "0.5570838", "0.5556236", "0.55470246", "0.5546562", "0.55237716", "0.55191565", "0.55181885", "0.55177784", "0.5517358", "0.5514267", "0.5505099", "0.5502957", "0.55004036", "0.5497226", "0.5496873", "0.54898113", "0.5479448", "0.54743737", "0.54700947", "0.54567736", "0.54541713", "0.54421616", "0.544205", "0.54351586", "0.543431", "0.5422407", "0.54205424", "0.54193294", "0.5413735", "0.54121745", "0.5405888", "0.5403867", "0.53991693", "0.5397834", "0.5391817", "0.538591", "0.5383301", "0.53796035", "0.5375422", "0.5371784", "0.53671026", "0.5355794", "0.53548837", "0.53544575", "0.5350049", "0.5349028", "0.5344804", "0.53376997", "0.53351396", "0.53203046", "0.53182834", "0.5312934", "0.53111565", "0.5305262", "0.530162", "0.5300998", "0.5294476", "0.52944493" ]
0.6465873
5
change color over hover function
function changeColor1() { console.log(this.id); const cDivChange = document.getElementById(this.id); cDivChange.style.backgroundColor = "pink"; // cDivChange.classList.add = "new-background"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseOverlink(){\n // Changed the color and background color in this function\n $(this).css('color', 'lime').css('background-color','blue');\n}", "function changeColor()\n\t{\n\t\t$('div div').mouseenter(function() \n\t\t{\n\t\t\t$(this).toggleClass('hover');\n\t\t});\n\t}", "function hoverButtonColorOn(e) {\n e.target.style.background = '#c4941c';\n}", "function hoverColor() {\n\tif (this.id !== board.currentColor) {\n\t\tif (this.id === 'blue') {\n\t\t\t$(this).css('background-color', active_blue)\n\t\t} else if (this.id === 'yellow') {\n\t\t\t$(this).css('background-color', active_yellow)\n\t\t} else if (this.id === 'green') {\n\t\t\t$(this).css('background-color', active_green)\n\t\t} else if (this.id === 'purple') {\n\t\t\t$(this).css('background-color', active_purple)\n\t\t} else if (this.id === 'red') {\n\t\t\t$(this).css('background-color', active_red)\n\t\t} else if (this.id === 'brown') {\n\t\t\t$(this).css('background-color', active_brown)\n\t\t}\n\t}\n}", "function colorHover(){\n\t$('.squares').hover(function(){\n\t\tif(colorCondition === false){\n\t\t\t$(this).css({\"background\": \"white\"});\n\t\t} else {\n\t\t\trandomColor();\n\t\t\t$(this).css({\"background\": randomColorValue})\n\t\t}\n\t})\n}", "set setHoverColor (color) {\n this.hoverColor = color;\n }", "function hovering(e) {\n console.log('enter');\n $(e.target).css('color', 'red');\n}", "function mouseover() \n\t{\n \t document.getElementById(\"rb\").style.color = \"red\";\n }", "function default_color() {\n\t$(\".square\").hover(function() {\n\t\t$(this).css('background-color', '#FF00FF'); \n\t});\n}", "function default_color(){\n\n $(\".square\").hover(function(){\n\n $(this).css('background-color', 'white');\n\n });\n\n}", "function addHoverColor(element) {\n element.style.backgroundColor = 'rgba(255, 255, 255, 0.25)';\n}", "function hover_over(item) {\n item.style.background = \"#ccc\";\n}", "function mouseOver(ref)\r\n{\r\n ref.style.background = \"#eeeeee\";\r\n}", "function hovering() {\n\n}", "hover() {}", "function changeSquareColor(){\n $('.square').hover(function () {\n $(this).css(\"background-color\", \"#0F0F0F\")\n });\n}", "function hoverEnter(e) {\n var $div = $(e.target).closest(\"div\");\n $div.css(BACKGROUND_COLOR, $div.data(BUTTON_NAME) ? \"#FFF\" : \"#FFC\");\n }", "interactHover(obj) {\n if (obj.object.state === 'idle') {\n obj.object.material.color.setHex(obj.object.hoverColor);\n }\n }", "function hoverButtonColorOff(e) {\n e.target.style.background = 'goldenrod';\n}", "function pixelHover(){\n\t$(\".pixel\").hover(\n\n\t\tfunction() {\n\t\t\tswitch ($(\"#colors\").val()){\n\t\t\t\tcase \"black\":\n\t\t\t\t\t$(this).css({\"background-color\": \"#000000\"});\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"rainbow\":\n\t\t\t\t\tvar randomColor = \"rgb(\" + (Math.floor(Math.random() * 256)) + \",\" + (Math.floor(Math.random() * 256)) + \",\" + (Math.floor(Math.random() * 256)) + \")\";\n\t\t\t\t\t$(this).css({\"background\": randomColor});\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"shadow\":\n\n\t\t\t\t\t$(this).css({\"background-color\": \"#CCCCCC\"})\n\t\t\t\t\t$(this).fadeToggle(250);\n\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"default\":\n\t\t\t\t\t$(this).css({\"background-color\": \"#000000\"});\n\t\t\t}\n\t\t\t\n\t\t}\n\t);\n}", "function hoverOn($div, colorA, colorB){\n $div.hover(function(){\n $(this).css({\"color\":colorA,\n \"cursor\":\"pointer\"});\n }, function(){\n $(this).css({\"color\":colorB,\n \"cursor\":\"auto\"});\n });\n}", "function backIconHover() {\n\t\tbackIcon.hover(function() {\n\n\t\t\t$(this).css({\n\t\t\t\t'background-color' \t: royalHex2Rgba( back_btn_hcol, back_btn_hcol_tr ),\n\t\t\t\t'color' \t\t\t: back_btn_txt_hcol\n\t\t\t});\n\n\t\t}, function() {\n\n\t\t\t$(this).css({\n\t\t\t\t'background-color' \t: royalHex2Rgba( back_btn_col, back_btn_col_tr ),\n\t\t\t\t'color' \t\t\t: back_btn_txt_col\n\t\t\t});\n\n\t\t});\n\t}", "mouseHover(ringHoverColor, ringActualSessionColor){\n\n var app = this;\n var div = $('.divanchor');\n var self = null;\n\n div.hover(function(){\n\n self = $(this);\n\n self.css({\n\n \"background-color\" : ringHoverColor\n });\n \n }, function(){\n\n if (self.hasClass('actual-Session')) {\n\n self.css({\n \"background-color\" : ringActualSessionColor\n });\n return;\n\n } else {\n\n self.css({\n \"background-color\" : \"rgba(255, 255, 255, 0)\"\n });\n }\n });\n }", "mouseover() {\n this.hoverActive = true;\n }", "function colorChanger(color){\n\n mouse.color = color;\n hold.style.background = color;\n\n\n\n\n}", "function initHoverColor() {\r\n $('header .nav h4').hover(\r\n function () {\r\n $(this).animate({\r\n 'color': '#FDFDFD',\r\n 'background-color': '#3BAF9B'\r\n }, 'fast');\r\n },\r\n function () {\r\n $(this).animate({\r\n 'color': '#575064',\r\n 'background-color': '#FDFDFD'\r\n });\r\n }\r\n );\r\n\r\n $('.program .side .list .parent').hover(\r\n function () {\r\n $(this).animate({\r\n 'background-color': '#31AB96'\r\n }, 'fast');\r\n },\r\n function () {\r\n $(this).animate({\r\n 'background-color': '#494158'\r\n }, 'fast');\r\n }\r\n );\r\n\r\n $('.program .side .list .parent i').hover(\r\n function () {\r\n $(this).animate({\r\n 'color': '#FDFDFD'\r\n }, 'fast');\r\n },\r\n function () {\r\n $(this).animate({\r\n 'color': '#A9ACAD'\r\n });\r\n }\r\n );\r\n\r\n $('.program .side .list .sub-list .child').hover(\r\n function () {\r\n $(this).animate({\r\n 'background-color': '#CCCCCC'\r\n }, 'fast');\r\n },\r\n function () {\r\n $(this).animate({\r\n 'background-color': '#F3F3F3'\r\n }, 'fast');\r\n }\r\n );\r\n}", "mouseEnter () {\r\n this.setState({bgColor: this.props.theme.headerMarketsHover})\r\n }", "function fRollEvents( elem, origColor ) {\n\t\t\t//\tconsole.log( \"elem: \", elem );\n\t\t\telem.css( {\n\t\t\t\t\"color\": origColor\n\t\t\t} )\n\t\t\telem.mouseover( () => {\n\t\t\t\telem.css( {\n\t\t\t\t\t\"color\": \"Orange\",\n\t\t\t\t\t\"cursor\": \"pointer\",\n\t\t\t\t\t\"text-decoration\": \"none\"\n\t\t\t\t} )\n\t\t\t} )\n\t\t\telem.mouseout( () => {\n\t\t\t\telem.css( {\n\t\t\t\t\t\"color\": origColor,\n\t\t\t\t\t\"text-decoration\": \"none\"\n\t\t\t\t} )\n\t\t\t} )\n\t\t}", "function dHover(obj) {\r\n obj.parentElement.setAttribute(\r\n \"style\",\r\n \"background-color: rgba(255, 0, 0, 0.548\"\r\n );\r\n}", "function paint() {\n\t$('.cell').hover(function() {\n\t\t$(this).css('background-color', 'hsl(0, 0%, 90%)');\n});\n}", "function sHover(obj) {\r\n obj.parentElement.setAttribute(\"style\", \"background-color: #f1f1f1\");\r\n}", "function pm_rollover_funkcionalnost(){\n\t\tvar predhodna_vrijednost;\n\t\t$('.pMenu').hover(function(){\n\t\t\tif($(this).hasClass('pmMenuUcitano')) return;\n\t\t\tpredhodna_vrijednost = $(this).css('backgroundColor');\n\t\t\t$(this).stop().animate({'background-color':'#FFF', 'top':'1px'}, 500);\n\t\t}, function(){\n\t\t\tif($(this).hasClass('pmMenuUcitano')) return;\n\t\t\t$(this).stop().animate({'background-color':predhodna_vrijednost, 'top':'25px'}, 1000);\n\n\t\t});\n\t}", "function pPostMoreHover() {\n\n\t\tpPostMore.hover(function() {\n\n\t\t\t$(this).css({\n\t\t\t\t'background-color' \t: royalHex2Rgba( pPost_more_bg_hcol, pPost_more_bg_hcol_tr ),\n\t\t\t\t'color' \t\t\t: pPost_more_txt_hcol,\n\t\t\t\t'border-color' \t\t: pPost_more_bd_hcol\n\t\t\t});\n\n\t\t}, function() {\n\n\t\t\tpPostMore.css({\n\t\t\t\t'background-color' \t : royalHex2Rgba( pPost_more_bg_col, pPost_more_bg_col_tr ),\n\t\t\t\t'color' \t\t\t : pPost_more_txt_col,\n\t\t\t\t'border-top-color' \t : pPost_more_bd_tp[2],\n\t\t\t\t'border-right-color' : pPost_more_bd_rt[2],\n\t\t\t\t'border-bottom-color' : pPost_more_bd_bt[2],\n\t\t\t\t'border-left-color' : pPost_more_bd_lt[2]\n\t\t\t});\n\n\t\t});\n\n\t}", "function mouseOver() {\r\n document.getElementById(\"mytext\").style.color = \"black\";\r\n}// end function", "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 hoverColor(gridNum){\n document.getElementById(gridNum).style.backgroundColor = color;\n document.getElementById(\"selectedColor\").setAttribute(\"value\", color)\n}", "function rangeMouseOver(color) {\n $(\"#rangeMouseOver\").html(makeSwatch(color, principal, principal));\n}", "function changeColor (){\n\t\t$(this).css('background-color', 'red');\t\n\t}", "function feturedHover(){\r\n\t\t$(\".single-fetured\").hover(function(){\r\n\t\t\t$(\".single-fetured\").removeClass(\"active\");\r\n\t\t\t$(this).addClass(\"active\");\r\n\t\t});\r\n\t}", "function hover(element) {\n element.setAttribute('src', \"images/csaLogoYellow.png\");\n const text = document.querySelector(\".homeSection\");\n text.style.color = \"#FFE12B\";\n}", "function mouseOver (){\n const selectDivs = document.querySelectorAll('.main > div');\n \n selectDivs.forEach( divs => divs.addEventListener('mouseover',function(e){\n divs.style.background = `rgb(${changueColor()}, ${changueColor()}, ${changueColor()})`;\n}))}", "function mouseOutlink(){\n // Changed the bg color back to white\n // Used the variable I made above to set the text color back to its original\n $(this).css('background-color','white').css('color',orginalColor);\n}", "function drapal_mouseover() {\n if(mass_opener && (max_tab > 1)) {\n this.style.backgroundColor = \"rgba(255,255,255,0.7)\";\n this.style.color = \"black\";\n }\n}", "function colorForCurrent(){\n\n}", "function setupLatestNews()\r\n{\r\n $j(\".lastNews\").hover(\r\n function()\r\n {\r\n $j(this).find(\".lastNewsTitle\").css(\"color\", \"#222\");\r\n }, \r\n function()\r\n {\r\n $j(this).find(\".lastNewsTitle\").css(\"color\", \"#444\");\r\n }\r\n );\r\n}", "function hoverEffect(color) {\n let grids = document.querySelectorAll(\".grid-item\");\n let gridsArr = Array.from(grids);\n gridsArr.forEach(element =>\n element.addEventListener(\"mouseover\", ()=>{\n element.style.backgroundColor = color;\n }));\n}", "function changeColor(e) {}", "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 mouseOverBox(){\n box.style.backgroundColor = \"blue\"\n}", "oncolor() {\n let color = Haya.Utils.Color.rgbHex($.color.red, $.color.green, $.color.blue, \"0x\");\n this.target.sprite.color = color;\n this.target.sprite.tint = color;\n }", "function handleMouseOver(){\r\n d3.select(this)\r\n .transition(\"mouse\")\r\n .attr(\"fill\",\"#A04000\")\r\n .attr(\"stroke\", \"#641E16\")\r\n .attr(\"stroke-width\", 5)\r\n .style(\"cursor\", \"pointer\")\r\n }", "function handleMouseOver(d){\r\n/*// fast color transition\r\n var b,c;\r\n var a =d3.select(this)\r\n .style(\"fill\", function(){c=d3.select(this).style(\"fill\");}) ;\r\n console.log(c);// make the body green\r\n a.transition().duration(400)\r\n .style(\"fill\", function(){ b = d3.select(this).classed(\"hover\", true).style(\"fill\")}); // then transition to red\r\n console.log(b);\r\n// end fast color transition*/\r\n\r\n//d3.select(this).classed(\"hover\", true) //<== most basic version\r\n\r\n// heavy tween function //\r\n var origfill = d3.select(this).style(\"fill\");\r\n d3.select(this).transition().duration(200)\r\n .styleTween(\"fill\", function()\r\n {\r\n return d3.interpolate(origfill, d3.select(this).classed(\"hover\", true).style(\"fill\") );\r\n });\r\n//\r\n\r\n var province_name= d.properties.NAME_1\r\n var count = d.properties.count\r\n maptooltip.select('.province').html(province_name);\r\n maptooltip.select('.count').html( count);\r\n maptooltip.style('display', 'block');\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}", "function hexBrush() {\n colorContainer.addEventListener(\"mouseover\", function (e) {\n e.target.style.backgroundColor = rainbowMode();\n // console.log(e.target);\n });\n}", "function hoverColor() {\n colorful = !colorful;\n const squareDivs = document.querySelectorAll(\".square-div\");\n squareDivs.forEach(function(square) {\n square.addEventListener(\"mouseover\", function () {\n if (colorful) {\n square.style.backgroundColor = '#'+Math.floor(Math.random()*16777215).toString(16);\n colorButton.textContent = \"Greyscale\";\n }\n else {\n colorButton.textContent = \"Make it colorful!\";\n square.style.backgroundColor = \"grey\";\n }\n })\n square.addEventListener(\"click\", function () {\n square.style.backgroundColor = \"white\";\n })\n })\n}", "function mouseover() {\n tooltip\n .style('opacity', 1)\n d3.select(this)\n .style('stroke', 'black')\n .style('opacity', 1)\n }", "function contactLangHover() {\n $('.flags-images').hover( function (){\n let flagSrc = $(this).attr('src');\n \n if (flagSrc == 'images/usa.png') {\n $('.en').css('color', '#222');\n } else if (flagSrc == 'images/spain.png') {\n $('.es').css('color', '#222');\n }\n console.log('mouse enter');\n }, function() {\n let flagSrc = $(this).attr('src');\n \n if (flagSrc == 'images/usa.png') {\n $('.en').css('color', '#B63F55');\n } else if (flagSrc == 'images/spain.png') {\n $('.es').css('color', '#B63F55');\n }\n console.log('mouse out');\n });\n}", "function bPostMoreHover() {\n\n\t\tbPostMore.hover(function() {\n\n\t\t\t$(this).css({\n\t\t\t\t'background-color' \t: royalHex2Rgba( bPost_more_bg_hcol, bPost_more_bg_hcol_tr ),\n\t\t\t\t'color' \t\t\t: bPost_more_txt_hcol,\n\t\t\t\t'border-color' \t\t: bPost_more_bd_hcol\n\t\t\t});\n\n\t\t}, function() {\n\n\t\t\tbPostMore.css({\n\t\t\t\t'background-color' \t : royalHex2Rgba( bPost_more_bg_col, bPost_more_bg_col_tr ),\n\t\t\t\t'color' \t\t\t : bPost_more_txt_col,\n\t\t\t\t'border-top-color' \t : bPost_more_bd_tp[2],\n\t\t\t\t'border-right-color' : bPost_more_bd_rt[2],\n\t\t\t\t'border-bottom-color' : bPost_more_bd_bt[2],\n\t\t\t\t'border-left-color' : bPost_more_bd_lt[2]\n\t\t\t});\n\n\t\t});\n\n\t}", "function hover(element) {\n if(element.getAttribute(\"id\").valueOf() != elementAnterior.getAttribute(\"id\").valueOf()) {\n element.style.color = \"red\";\n }\n \n}", "function hover(element) {\n if(element.getAttribute(\"id\").valueOf() != elementAnterior.getAttribute(\"id\").valueOf()) {\n element.style.color = \"red\";\n }\n \n}", "function mouseReleased(){\n background(\"rgb(255, 24, 24)\");\n}", "function addHoverEffect() {\n $(\"#boxContainer\").on(\"mouseenter\", \".boxColumn .box\", function() {\n $(this).css(\"background-color\", genRandomColor());\n });\n}", "function mouseout() \n {\n document.getElementById(\"rb\").style.color = \"black\";\n }", "function sidebarFoldIconHover() {\n\t\tsidebarFoldIcon.hover(function() {\n\n\t\t\t$(this).css({\n\t\t\t\t'background-color' \t: royalHex2Rgba( sidebar_fold_btn_hcol, sidebar_fold_btn_hcol_tr ),\n\t\t\t\t'color' \t\t\t: sidebar_fold_btn_txt_hcol\n\t\t\t});\n\n\t\t}, function() {\n\n\t\t\t$(this).css({\n\t\t\t\t'background-color' \t: royalHex2Rgba( sidebar_fold_btn_col, sidebar_fold_btn_col_tr ),\n\t\t\t\t'color' \t\t\t: sidebar_fold_btn_txt_col\n\t\t\t});\n\n\t\t});\n\t}", "_buttonPointerOver() {\n\t\tthis.background.setAlpha(1);\n\t\tthis.text.setColor(\"#FFFFFF\");\n\t}", "function mouseEnter() {\n const destinationText = document.querySelector('.content-destination');\n destinationText.addEventListener(\"mouseenter\", (e) => e.target.style.color = \"red\");\n}", "function mouseOver(elem) {\n let place = (elem.id);\n console.log(place);\n addColor(place);\n return place;\n}", "set HoverAlpha(value) {\n this._hoverAlpha = value;\n }", "set HoverAlpha(value) {\n this._hoverAlpha = value;\n }", "function mouseoverTag(event) {\n e = getEvent(event);\n var src = e.srcElement || e.target;\n if(src.mybackground == \"yellow\") return;\n src.mybackground = src.style.backgroundColor;\n src.style.backgroundColor=\"yellow\";\n}", "function iconsHover() {\n $('.container__content').hover(\n function() {\n $('h3', this).addClass('content-subtitle--green');\n },\n function() {\n $('h3', this).removeClass('content-subtitle--green');\n }\n );\n}", "set Hovered(value) {\n this._hovered = value;\n }", "function quoteBtnHover() {\n var btnBg = document.getElementById(\"quoteBtn\");\n var btnTxt = document.getElementById(\"quoteBtnH3\");\n btnBg.style.backgroundColor = \"#004e92\";\n btnBg.style.cursor = \"pointer\";\n btnTxt.style.color = \"white\";\n btnTxt.style.cursor = \"pointer\";\n\n}", "'mouseover .cb-img-title'( e, t ) { //hover\n $( '.cb-img-title' ).prop( 'src', '/img/title-dark.png' );\n }", "function changeColor(){\n console.log('change color activated');\n\n $(this).css('background-color','black');\n } // end changeColor", "function changeGreenEnter() {\n $(this).css('background-color', 'green');\n }", "function hover() {\n raycaster.setFromCamera( pointer, camera );\n const intersects = raycaster.intersectObjects( buttons ); // De objecten binnen de array aan buttons die doorkruist worden door de ray van de raycaster.\n\n if ( intersects.length > 0 ) {\n if ( hoveredItem != intersects[ 0 ].object ) {\n hoveredItem = intersects[ 0 ].object;\n hoveredItem.material.transparent = true;\n hoveredItem.material.opacity = 0.3;\n }\n } else {\n if ( hoveredItem ) hoveredItem.material.opacity = 0.8;\n hoveredItem = null;\n }\n}", "function defaultEtch() {\n\t$(\"#wrapper\").children().off(\"mouseover\");\n\t$(\"#wrapper\").children().on(\"mouseover\", function() {\n\t\tvar color = \"#FFFFFF\";\n\t\tif (!$(this).hasClass(\"highlighted\")){\n\t\t\t$(this).css({\"background-color\": color});\n\t\t\t$(this).addClass(\"highlighted\");\n\t\t}\n\t});\n}", "function eleccion_color(){\r\n\r\n }", "function randomColorMode(){\n $('.square').hover(function(){\n var r = Math.floor(Math.random()*256);\n var g = Math.floor(Math.random()*256);\n var b = Math.floor(Math.random()*256);\n var opa = Math.random();\n $(this).css(\"background-color\", \"rgb(\" + r +\",\" + g + \",\" + b +\")\");\n $(this).css(\"opacity\", opa+.2);\n });\n}", "function handle_mouseout () {\n d3.select(this).attr('fill', tmp_colour)\n}", "function handleMouseOver(event) {\n if (event.type == \"mouseover\") {\n event.target.alpha = .5;\n somethingHighlighted = true;\n } else {\n event.target.alpha = 1;\n somethingHighlighted = false;\n }\n}", "function handleMouseOver() { // Add interactivity\n// Use D3 to select element, change color and size\n\td3.select(this)\n\t\t.style(\"fill\", \"orange\")\n\t\t.attr(\"r\", 15);\n\t\n}", "function changeColor (event){\n event.currentTarget.style.color = rgb(); //se llama a la primera función\n}", "function onHover(div) {\n\n unHighLight(div);\n highLight(div);\n\n\n}", "function hoverOver(d) {\n var hoverAttr = {\n hover_textOpacity: 0,\n hover_strokeOpacity: 0.2\n };\n highlightConnections(graphNodesData, graphLinksData, d, hoverAttr);\n }", "function mouseOver_2(){\n document.getElementById(\"book-button\").style.backgroundColor = \"#FFFC92\";\n document.getElementById(\"book-button\").style.color = \"#6000CE\";\n document.getElementById(\"book-button\").style.border = \"solid 2px #6000CE\";\n}", "function hoverLightYellowToBlue(llum){\r\n llum.classList.replace(\"yellow\",\"blue\");\r\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 mousePressed() {\n background(\"rgb(233, 255, 232)\");\n\n}", "function mouseOver() {\n setMouseOver(true);\n }", "function addEvents(){\n\n\t$('table').mouseover(function(){\n //assign color to variable rgb\n\t\tvar color = \"rgb(\";\n\n //loop to assign new css color to table when mouseover\n\t\tfor (var i=0; i<3; i++){\n //assign random to a randome variable between 0 and 255\n\t\t\tvar random = Math.round(Math.random() * 255);\n\n\t\t\tcolor += random;\n //the else statement keeps running and only one value in rgb()\n\t\t\tif (i<2){\n\t\t\t\tcolor += \",\";\n\n\t\t\t} else {\n\t\t\t\tcolor += \")\";\n console.log(color)\n\t\t}};\n\n\n\t\t$(this).css('color', color);\n });\n //calls function clickme()\n clickme()\n\n\t}", "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 color (e){\n e.target.style.color = \"red\"\n}", "function addHover(num) {\n\tmagHolder[num].addEventListener('mouseover', function() {\n\t\tmagText[num].setAttribute(\"style\", \"background-color: white; display: block; border: solid 1px #d5d6d7; z-index: 15; position: absolute; width: 160px; text-align: center; padding: 5px 5px 5px 7px\");\n\t}, false);\n\tmagHolder[num].addEventListener('mouseleave', function() {\n\t\tmagText[num].style.display = 'none';\n\t}, false);\n}", "function setColoring(func) {\n getColor = func;\n}", "mouseEnter(event) {\n this.setHover();\n }", "function mouseOverCircle() {\n $(this).css(\"opacity\", \"0.5\");\n }", "function changeColor(e){\n if (colorScheme == \"BLACK\"){\n e.target.style.backgroundColor = \"BLACK\";\n e.target.style.opacity = 1;\n } else if (colorScheme == \"RAINBOW\"){\n e.target.style.backgroundColor = \"#\" + Math.floor(Math.random() * 4096).toString(16);\n e.target.style.opacity = 1;\n } else if (colorScheme == \"DARKEN\"){\n let darken = Number(e.target.style.opacity);\n e.target.style.opacity = darken += 0.1;\n e.target.style.backgroundColor = '#000';\n }\n}", "function iconHovers(){\n $('[data-iconcolor]').each(function(){\n var element = $(this);\n var original_color =$(element).css('background-color');\n var original_text_color =$(element).find('i').css('color');\n element.on('mouseenter', function(){\n element.css('background-color' , element.attr('data-iconcolor'));\n if (element.parents('.social-icons').hasClass('social-simple')) {\n element.find('i').css('color' , element.attr('data-iconcolor'));\n }\n });\n element.on('mouseleave', function(){\n element.css('background-color' ,original_color);\n if (element.parents('.social-icons').hasClass('social-simple')) {\n element.find('i').css('color' , original_text_color);\n }\n });\n\n });\n}", "function makeHover () {\n console.log(currentColor);\n svgAll.forEach(item => {\n item.addEventListener('mouseover', event => {\n if(currentColor === 0) {\n event.target.style.fill = \"rgb(168,168,168)\";\n event.target.style.pointerEvents = \"all\";\n event.target.style.cursor = \"pointer\";\n event.target.style.strokeOpacity = \"1\";\n event.target.style.fillOpacity = \"0.3\";\n event.target.style.transitionDuration = \"0.5s\";\n event.target.style.transitionTimingFunction = \"ease-in\";\n }\n })\n })\n svgAll.forEach(item => {\n item.addEventListener('mouseout', event => {\n if(currentColor === 0) {\n event.target.style.fill = \"none\";\n event.target.style.stroke = \"white\";\n event.target.style.pointerEvents = \"all\";\n event.target.style.strokeOpacity = \"1\";\n event.target.style.fillOpacity = \"0.1\";\n event.target.style.transitionDuration = \"0.5s\";\n event.target.style.transitionTimingFunction = \"ease-out\";\n }\n })\n })\n }" ]
[ "0.78836304", "0.76134425", "0.7598597", "0.7552804", "0.7435088", "0.7385897", "0.73299944", "0.72994447", "0.72788274", "0.72470504", "0.72297806", "0.7165106", "0.7149541", "0.71338016", "0.7092287", "0.7077333", "0.70342183", "0.69868296", "0.69224566", "0.69011366", "0.687585", "0.68465465", "0.6795194", "0.67725986", "0.67419547", "0.6740555", "0.67377275", "0.67363316", "0.6725088", "0.6711914", "0.6707074", "0.67025936", "0.66911864", "0.66818583", "0.6664923", "0.6624852", "0.6619148", "0.6611047", "0.66045564", "0.65982306", "0.65755886", "0.6568286", "0.6564846", "0.6558941", "0.65537304", "0.6537004", "0.65316826", "0.65181863", "0.6508787", "0.6501158", "0.6492908", "0.6489546", "0.64729613", "0.6470266", "0.64701784", "0.6465325", "0.6458866", "0.64515686", "0.64452434", "0.64452434", "0.64350444", "0.64344925", "0.6431167", "0.64259654", "0.6417885", "0.64055", "0.6404219", "0.6403796", "0.6403796", "0.6402526", "0.64009935", "0.6387348", "0.6384536", "0.63830006", "0.6370796", "0.63670367", "0.636634", "0.63519293", "0.6350672", "0.6348248", "0.6339483", "0.6329874", "0.6327919", "0.632264", "0.6317358", "0.631705", "0.63132423", "0.6308563", "0.6306629", "0.6300569", "0.62912625", "0.62901324", "0.6288877", "0.6278085", "0.6273774", "0.62720734", "0.6270901", "0.62705857", "0.6269113", "0.62661797", "0.62652946" ]
0.0
-1
any special rendering we want to occur.
onclick(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_render() {}", "onBeforeRendering() {}", "static rendered () {}", "static rendered () {}", "function render() {\n\t\t\t}", "function render() {\n\n\t\t\t}", "function render() {\n\t\t\n\t}", "function render() {\n\t}", "function general_render(obj) {\n obj.render();\n }", "render() {}", "render() {}", "render() {}", "function render() {\n renderRegistry();\n renderDirectory();\n renderOverride();\n}", "_firstRendered() { }", "render() {\n // Subclasses should override\n }", "function render() {\r\n\r\n}", "function render() {\r\n\r\n}", "handleRendered_() {\n\t\tthis.isRendered_ = true;\n\t}", "render() { }", "render(){return renderNotImplemented;}", "function TextRenderer(){}// no need for block level renderers", "render() {\n\n\t}", "render() {\n\n\t}", "render() {\n\t\tthis.a1.render(this.context);\n\t\tthis.b1.render(this.context);\n\t\tthis.c1.render(this.context);\n\t\tthis.c2.render(this.context);\n\t\tthis.d1.render(this.context);\n\t\tthis.e1.render(this.context);\n\t\tthis.f1.render(this.context);\n\t\tthis.g1.render(this.context);\n\t\tthis.a1s.render(this.context);\n\t\tthis.c1s.render(this.context);\n\t\tthis.d1s.render(this.context);\n\t\tthis.f1s.render(this.context);\n\t\tthis.g1s.render(this.context);\n\n\t}", "renderPrep() {\n }", "function Render() {\n ClearScreen();\n RenderEnergeticDroplets();\n ResetRenderingConditions();\n}", "render () {\n throw new Error('render function must be override!')\n }", "render() { return super.render(); }", "render() {\n return renderNotImplemented;\n }", "render() {\n return renderNotImplemented;\n }", "function TextRenderer() {} // no need for block level renderers", "function TextRenderer() {} // no need for block level renderers", "onRender()/*: void*/ {\n this.render();\n }", "function renderEverything() {\n renderPepperonni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n renderPrice();\n}", "render() {\n\t\treturn null;\n\t}", "function nullRender() { return null; }", "render(){}", "render(){}", "render() {\n }", "beforeRender() { }", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n renderButtons();\n renderPrice();\n renderReceipt()\n}", "render() {\n\n }", "afterRender() { }", "afterRender() { }", "render( ) {\n return null;\n }", "function RenderEvent() {}", "renderBasedOnType() {\r\n switch (this.type) {\r\n case 'audio':\r\n return this.renderAudioCard();\r\n default:\r\n return this.renderBase();\r\n }\r\n }", "onAfterRendering() {}", "render(){\r\n\r\n\t}", "postRender()\n {\n super.postRender();\n }", "render(){if(this.renderer){this.renderer.call(this.owner,this.content,this.owner,this.model)}}", "function renderEverything() {\n renderPepperonni()\n renderMushrooms()\n renderGreenPeppers()\n renderWhiteSauce()\n renderGlutenFreeCrust()\n\n renderButtons()\n renderPrice()\n}", "function renderEverything() {\n renderPepperonni()\n renderMushrooms()\n renderGreenPeppers()\n renderWhiteSauce()\n renderGlutenFreeCrust()\n\n renderButtons()\n renderPrice()\n}", "render() {\n\n }", "render() {\n\n }", "render() {\n\n }", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "function renderEverything() {\n renderPepperoni();\n renderMushrooms();\n renderGreenPeppers();\n renderWhiteSauce();\n renderGlutenFreeCrust();\n\n renderButtons();\n renderPrice();\n}", "onBeforeRender () {\n\n }", "function render() {\n let bigString;\n console.log('render fxn ran')\n if (store.view === 'landing') {\n bigString = generateTitleTemplate(store);\n\n }\n else if (store.view === 'question') {\n bigString = generateQuestionTemplate(store);\n\n }\n else if (store.view === 'feedback') {\n bigString = generateFeedbackTemplate(store)\n\n }\n else if (store.view === 'results') {\n bigString = generateResultsTemplate(store);\n\n }\n $('main').html(bigString);\n\n //attach event listeners\n\n\n}", "RenderProbe() {}", "function AfterTextRenderHook() {}", "function pauseRender() {\n shouldRender = false;\n }", "onRender () {\n\n }", "render() {\n }", "render() {\n }", "render() {\r\n return;\r\n }", "function renderEverything() {\n renderPepperonni() ;\n renderMushrooms() ;\n renderGreenPeppers() ;\n renderWhiteSauce() ;\n renderGlutenFreeCrust() ;\n // renderButtons() -- not done, integrated this into the render of each ingredient ;\n renderPrice() ;\n}", "function RendererType2() {}", "function RendererType2() {}", "function RendererType2() {}", "sysRender() {\n \n let rendered = this.render();\n \n // If render() returns a String, then insert that as innerHTML in the\n // Part View node. Otherwise, do something else (TODO)\n \n if (typeof rendered === 'string') {\n this.domNode.innerHTML = rendered;\n } else if (false) { // TODO: test for jQuery return, DOM Node object, etc.\n // WHAT? \n }\n }", "render(context)\n {\n throw new Error(\"Not Implenemted\")\n }", "render() {\n\t\treturn (\n\t\t\tnull\n\t\t)\n\t}", "render() {\n return super.render();\n }", "Render(){\n throw new Error(\"Render() method must be implemented in child!\");\n }", "render() {\n /* renderComponent() -> this will call renderComponent() and be applied for all conditions in it.\n */\n return <div style={{ border: \"red\" }}>{this.renderComponent()}</div>;\n }", "function RendererType2(){}", "render() {\n return null;\n }", "render() {\n return null;\n }", "function RendererType2() { }", "function RendererType2() { }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "function nullRender() {\r\n return null;\r\n}", "function nullRender() {\r\n return null;\r\n}", "function handleRender() {\n view._isRendered = true;\n triggerDOMRefresh();\n }", "function handleRender() {\n view._isRendered = true;\n triggerDOMRefresh();\n }", "function Renderer() {}", "function handleRender() {\n\t view._isRendered = true;\n\t triggerDOMRefresh();\n\t }", "renderPage() {}", "function renderEverything() {\n renderIngredients();\n renderButtons();\n renderPrice();\n}", "function createRender() {\n\t\t\tsetSendIconYellow();\n }", "function ProceduralRenderer3(){}", "postRendering() {\n this.ctx.restore();\n }", "function ProceduralRenderer3() { }" ]
[ "0.72275764", "0.71838546", "0.71016276", "0.71016276", "0.70250773", "0.69832045", "0.6942229", "0.68835384", "0.6879546", "0.6731949", "0.6731949", "0.6731949", "0.67253333", "0.6721431", "0.66653764", "0.6664835", "0.6664835", "0.6619843", "0.66169894", "0.6573162", "0.651943", "0.64880925", "0.64880925", "0.638569", "0.6318224", "0.6312153", "0.6307589", "0.6294851", "0.6286397", "0.6286397", "0.6274195", "0.6274195", "0.6264914", "0.6249079", "0.62474173", "0.62149787", "0.61887157", "0.61887157", "0.6183358", "0.6169871", "0.6165575", "0.6127562", "0.61257267", "0.61257267", "0.6120585", "0.6113805", "0.6104213", "0.608713", "0.6074968", "0.6050812", "0.60459477", "0.6035456", "0.6035456", "0.6027574", "0.6027574", "0.6027574", "0.60185206", "0.60185206", "0.60185206", "0.60185206", "0.60185206", "0.60185206", "0.60185206", "0.6016693", "0.60096765", "0.6001965", "0.5988428", "0.59804124", "0.5979563", "0.5975356", "0.5975356", "0.5954653", "0.5951107", "0.5939366", "0.5939366", "0.5939366", "0.59297466", "0.59177965", "0.59129816", "0.59116536", "0.5908327", "0.59077203", "0.58963394", "0.5892405", "0.5892405", "0.58848673", "0.58848673", "0.58653057", "0.58653057", "0.5861874", "0.5861874", "0.5845915", "0.5845915", "0.5841757", "0.5835303", "0.5830568", "0.5828595", "0.5825693", "0.5823963", "0.5815911", "0.5808683" ]
0.0
-1
A Recursive promise call to load images one at a time
function loadImages(i=0,j=0){ return new Promise(function(resolve,reject){ if(j >= Object.keys(tiles).length){ resolve("Loaded all images"); return; } if(i >= Object.keys(tiles[Object.keys(tiles)[j]]).length){ loadImages(0,j+1).then(function(msg){ resolve(msg); }).catch(function(err){ reject(err); }); return; } var kind = Object.keys(tiles)[j]; var key = Object.keys(tiles[kind])[i]; var src = resourceLocation + "images/" + tiles[kind][key].source; if(tiles[kind][key].source === null){ loadImages(i+1,j).then(function(msg){ resolve(msg); }).catch(function(err){ reject(err); }); } else{ loadImage(src,function(img){ tiles[kind][key].image = img; tiles[kind][key].render = "image"; loadImages(i+1,j).then(function(msg){ resolve(msg); }).catch(function(err){ reject(err); }); },function(err){ reject(err); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function loadImages() {\n let data = arg.splice(1, arg.length - 1);\n let promise = [];\n data.forEach(img => {\n if(typeof img === \"string\") {\n let image = Canva2D.API.Preloader(\"singleImageOnly\", img);\n promise.push(image);\n } else if(img.hasOwnProperty(\"img\") && img.hasOwnProperty(\"src\")) {\n let image = Canva2D.API.Preloader(\"singleImageOnly\", img[\"img\"], img[\"src\"]);\n promise.push(image);\n } else {\n let image = Canva2D.API.Preloader(\"singleImageOnly\", img);\n promise.push(image);\n }\n });\n return await Promise.all(promise).then(e => {\n for(const img of e) \n _IMAGES_STACK.push(img);\n return _IMAGES_STACK;\n }).then(e => getImage);\n }", "function loadImagesSeq() {\n\t\t const button = document.querySelector('#loadImagesSeq');\n\t\t const container = document.querySelector('#image-container');\n\t\t const promises = [];\n\t\t button.addEventListener(\"click\", (event) => {\n\n\t\t const images = imageNames();\n\n\t\t images.forEach((image) => {\n\t\t promises.push(requestInSeq(image, container));\n\t\t });\n\t\t console.log(promises);\n\t\t // when all promises are resolved then this promise is resolved.\n\t\t Promise.all(promises).then((imageDataObjs) => {\n\t\t console.log(imageDataObjs);\n\t\t imageDataObjs.forEach((imageData) => {\n\t\t const imageElement = imageData.imageElement;\n\t\t const imageSrc = imageData.objectURL;\n\t\t imageElement.src = imageSrc;\n\t\t });\n\n\t\t });\n\t\t });\n\n\n\t\t}", "loadImages() {\n if (this._queue.length > 0) {\n let img = new Image();\n let src = this._queue.pop();\n\n let name = src.slice(src.lastIndexOf('/') + 1);\n img.src = src;\n img.onload = (function() {\n this.loadImages();\n }).bind(this);\n this.images[name] = img;\n } else {\n this._callback();\n }\n }", "loadImg() {\n let loadedCount = 0\n function onLoad() {\n loadedCount++\n if (loadedCount >= this.imgPaths.length) {\n this.flowStart()\n }\n }\n this.baseImages = this.imgPaths.map(path => {\n const image = new Image()\n image.onload = onLoad.bind(this)\n image.src = path\n return image\n })\n }", "function loadImages() {\n\t\t const button = document.querySelector('#loadImages');\n\t\t const container = document.querySelector('#image-container');\n\n\t\t button.addEventListener(\"click\", (event) => {\n\n\t\t const images = imageNames();\n\t\t images.forEach((image) => {\n\t\t requestFor(image, container).then(imageData => {\n\t\t const imageElement = imageData.imageElement;\n\t\t const imageSrc = imageData.objectURL;\n\t\t imageElement.src = imageSrc;\n\t\t });\n\t\t });\n\t\t });\n\t\t}", "function findImagesToLoad() {\n\tsetLazyImagePositions.call(this);\n\tconst imagesToLoad = getImagesInView(this.images);\n\tloadImages.call(this, imagesToLoad);\n}", "async preloadImages(data) {\n const urls = data.map(imageData => {\n const uri = this.returnImageUrl(imageData);\n return CacheManager.get(uri).getPath();\n });\n this.setState({imagesLoaded: true});\n }", "function fetchImages() {\n const numPhotos = 18;\n const graphicPromises = [];\n const baseUrl =\n \"https://arcgis.github.io/arcgis-samples-javascript/sample-data/featurelayer-collection/photo-\";\n\n for (let i = 1; i <= numPhotos; i++) {\n const url = baseUrl + i.toString() + \".jpg\";\n const graphicPromise = exifToGraphic(url, i);\n graphicPromises.push(graphicPromise);\n }\n\n return promiseUtils.eachAlways(graphicPromises);\n}", "loadImages() {\n let loadCount = 0;\n let loadTotal = this.images.length;\n\n if (WP.shuffle) {\n this.images = this.shuffle(this.images);\n }\n\n const imageLoaded = (() => {\n loadCount++;\n\n if (loadCount >= loadTotal) {\n // All images loaded!\n this.setupCanvases();\n this.bindShake();\n this.loadingComplete();\n }\n }).bind(this);\n\n for (let image of this.images) {\n // Create img elements for each image\n // and save it on the object\n const size = this.getBestImageSize(image.src);\n image.img = document.createElement('img'); // image is global\n image.img.addEventListener('load', imageLoaded, false);\n image.img.src = image.src[size][0];\n }\n }", "function McDeferredLoadImages() {\n var items = {};\n\n this.addImage = function (idx, hash, src, href) {\n if (!items.hasOwnProperty(idx)) {\n items[idx] = [hash, src, href];\n }\n };\n\n this.load = function (cb) {\n var count = Object.keys(items).length;\n var currentIdx = 0;\n\n Object.keys(items).forEach(function (idx) {\n var hash = items[idx][0];\n var imgSrc = items[idx][1];\n var lnkHref = items[idx][2];\n\n var _link = document.getElementById('link_' + hash + idx);\n var _img = document.getElementById('img_' + hash + idx);\n\n if (_img && _img.src && _link && _link.href){\n _img.src = imgSrc;\n _link.href = lnkHref;\n\n console.log('loadAll: ' + imgSrc);\n\n _img.onload = function () {\n currentIdx ++;\n delete items[idx];\n\n if (currentIdx === count && cb){\n cb();\n }\n };\n\n _img.onerror =_img.onabort = function (err) {\n console.warn(err);\n }\n }\n });\n };\n}", "function fetchImages() {\n $.getJSON(\"/images.php\", function(data) {\n preloadImages(data);\n }); \n }", "function start_loadImages()\n {\n methods.loadImages(\n function() {\n methods.getDataURI();\n run_app();\n },\n imagesRack.imgList\n );\n }", "loadAllImages (props = this.props) {\n const generateLoadDoneCallback = (srcType, imageSrc) => (err) => {\n // Give up showing image on error\n if (err) {\n return\n }\n\n // Don't rerender if the src is not the same as when the load started\n // or if the component has unmounted\n if (this.props[srcType] !== imageSrc || !this.mounted) {\n return\n }\n\n // Force rerender with the new image\n this.forceUpdate()\n }\n\n // Load the images\n this.getSrcTypes().forEach((srcType) => {\n const type = srcType.name\n\n // Load unloaded images\n if (props[type] && !this.isImageLoaded(props[type])) {\n this.loadImage(type, props[type], generateLoadDoneCallback(type, props[type]))\n }\n })\n }", "async getAllImages() {\n // if (!enable()) return null;\n\n try {\n console.log(\"[imgur] GET All Images\");\n\n // get img count\n let count = await this.imagesCount();\n if (count == null) throw (\"[imgur] Can not get images count!\");\n\n // loop for pages\n let pArray = [];\n let pages = parseInt(count / 50);\n for (let page = 0; page <= pages; page++) {\n pArray.push(this.images({ page }));\n }\n\n // get result\n let result = [];\n await Promise.all(pArray).then(values => {\n for (let arr of values) {\n result = result.concat(arr);\n }\n });\n\n console.log(\"[imgur] Imgur account images load complete (\" + result.length + \" images)!\");\n return result;\n\n } catch (error) {\n console.log(`[imgur] imgur.api.account.getAllImages`);\n console.log(error);\n return null;\n }\n }", "function loadImages(images, pretrainedModel) {\n let promise = Promise.resolve();\n for (let i = 0; i < images.length; i++) {\n const image = images[i];\n promise = promise.then(data => {\n return loadImage(image).then(loadedImage => {\n // Note the use of `tf.tidy` and `.dispose()`. These are two memory management\n // functions that Tensorflow.js exposes.\n // https://js.tensorflow.org/tutorials/core-concepts.html\n //\n // Handling memory management is crucial for building a performant machine learning\n // model in a browser.\n return tf.tidy(() => {\n const processedImage = loadAndProcessImage(loadedImage);\n const prediction = pretrainedModel.predict(processedImage);\n\n if (data) {\n const newData = data.concat(prediction);\n data.dispose();\n return newData;\n }\n\n return tf.keep(prediction);\n });\n });\n }).catch(err => {\n console.log('promise error: ', err);\n });\n }\n\n return promise;\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 loadImages(atlas)\n\t\t{\n\t\t\tdataAtlas = atlas.tiles;\n\t\t\tplayerAtlas = atlas.player;\n\n\t\t\tlet images = [\"img/Tiles/sheet.png\", \"img/Player/p1_spritesheet.png\"];\n\t\t\tlet imgsPromises = images.map (function (url)\n\t\t\t{\n\t\t\t\treturn new Promise ( (ok, error) => {\n\t\t\t\t\tvar img = new Image();\n\t\t\t\t\timg.src = url;\n\t\t\t\t\timg.onload = () => ok(img);\n\t\t\t\t});\n\t\t\t});\n\t\t\treturn (Promise.all(imgsPromises))\n\t\t}", "loadAllImages(props = this.props) {\n const generateLoadDoneCallback = (srcType, imageSrc) => err => {\n // Give up showing image on error\n if (err) {\n return;\n }\n\n // Don't rerender if the src is not the same as when the load started\n // or if the component has unmounted\n if (this.props[srcType] !== imageSrc || this.didUnmount) {\n return;\n }\n\n // Force rerender with the new image\n this.forceUpdate();\n };\n\n // Load the images\n this.getSrcTypes().forEach(srcType => {\n const type = srcType.name;\n\n // there is no error when we try to load it initially\n if (props[type] && this.state.loadErrorStatus[type]) {\n this.setState(prevState => ({\n loadErrorStatus: { ...prevState.loadErrorStatus, [type]: false },\n }));\n }\n\n // Load unloaded images\n if (props[type] && !this.isImageLoaded(props[type])) {\n this.loadImage(\n type,\n props[type],\n generateLoadDoneCallback(type, props[type])\n );\n }\n });\n }", "async function loadImagesIntoPage(userPhotoLibrary) {\n var imageDiv = document.getElementById(\"grid\");\n while (imageDiv.firstChild) {\n imageDiv.removeChild(imageDiv.firstChild);\n }\n\n // Generate image HTML\n var i = 0;\n for (i = 0; i < userPhotoLibrary.length; i++) {\n var img = document.createElement(\"img\");\n var imageUrl = 'https://img.rec.net/' + userPhotoLibrary[i].ImageName + '?width=500';\n img.setAttribute('data-src', imageUrl);\n img.classList.add(\"grid-image\");\n //img.src = \"\";\n\n var divGridItem = document.createElement(\"div\");\n divGridItem.classList.add(\"grid-item\");\n divGridItem.setAttribute('type', 'button');\n divGridItem.setAttribute('data-toggle', 'modal');\n divGridItem.setAttribute('data-target', '#imageDetailModal');\n divGridItem.setAttribute('onclick', 'loadDataImageDetailModal(' + userPhotoLibrary[i].Id + '); return false;');\n divGridItem.appendChild(img);\n\n if (userPhotoLibrary[i].CheerCount >= 1) {\n var divCheerContainer = document.createElement(\"div\");\n divCheerContainer.classList.add(\"imageCheerContainer\");\n divGridItem.appendChild(divCheerContainer);\n\n var cheerIcon = document.createElement(\"img\");\n cheerIcon.classList.add(\"imageCheerIcon\");\n cheerIcon.setAttribute('src', './images/cheer.png');\n\n // add image to container\n divCheerContainer.appendChild(cheerIcon);\n\n var cheerCount = document.createElement(\"div\");\n cheerCount.classList.add(\"imageCheerText\");\n cheerCount.innerText = userPhotoLibrary[i].CheerCount;\n\n // add div to container\n divCheerContainer.appendChild(cheerCount);\n }\n\n var src = document.getElementById(\"grid\");\n src.appendChild(divGridItem); // append Div\n }\n\n const targets = document.querySelectorAll('img');\n const lazyLoad = target => {\n let observer = {\n threshold: 1\n }\n const io = new IntersectionObserver((entries, observer) => {\n\n entries.forEach(entry => {\n\n if (entry.isIntersecting) {\n const img = entry.target;\n const src = img.getAttribute('data-src');\n\n if (img.hasAttribute('data-src')) {\n img.setAttribute('src', src);\n }\n observer.disconnect();\n }\n });\n });\n io.observe(target);\n };\n targets.forEach(lazyLoad);\n}", "function loadImages(){\n prev_btnj.addClass('loading')\n next_btnj.addClass('loading')\n fs.readdir(dirname, (err, files) => {\n if (!err){\n images = files.filter(isImage)\n curIndex = images.indexOf(basename)\n prev_btnj.removeClass('loading')\n next_btnj.removeClass('loading')\n setBtn()\n }\n })\n}", "function findImages(elem){\n if(elem.children.length == 0) {\n if(elem.nodeName.toLowerCase() === 'img' && elem.width > 40 && elem.height > 40) {\n if(elem.src.length < 1000) {\n var n = elem.src.indexOf(';');\n pictures.push(elem.src.substring(0, n != -1 ? n : elem.src.length));\n }\n else {\n setTimeout(waiturl(elem), 500);\n }\n }\n }\n \n else {\n for(var j = 0; j < elem.children.length; j++) {\n findImages(elem.children[j]);\n }\n }\n}", "load(assets) {\n return new Promise((function (resolve, reject) {\n // result holder\n let result = {\n success: [],\n fail: []\n };\n\n // counters\n let toLoad = 0; // number of expected loaded assets\n let loaded = 0; // number of loaded assets\n\n function assetLoaded(asset, success) {\n loaded += 1;\n\n if (success) {\n result.success.push(asset);\n } else {\n result.fail.push(asset);\n }\n\n if (loaded >= toLoad) {\n resolve(result);\n }\n }\n\n // load all images:\n assets.images = assets.images || [];\n assets.images.forEach((function (asset) {\n if (!asset.path) {\n return;\n }\n\n toLoad++; // count only supposedly valid assets\n\n this.loadImage(asset.path, asset.alias).then(\n function () {\n assetLoaded(asset, true);\n }, function () {\n assetLoaded(asset, false);\n }\n )\n }).bind(this));\n\n // load all images:\n assets.audio = assets.audio || [];\n assets.audio.forEach((function (asset) {\n if (!asset.path) {\n return;\n }\n\n toLoad++; // count only supposedly valid assets\n\n this.loadAudio(asset.path, asset.alias).then(\n function () {\n assetLoaded(asset, true);\n }, function () {\n assetLoaded(asset, false);\n }\n )\n }).bind(this));\n\n // load all images:\n assets.files = assets.files || [];\n assets.files.forEach((function (asset) {\n if (!asset.path) {\n return;\n }\n\n toLoad++; // count only supposedly valid assets\n\n this.loadFile(asset.path, asset.alias).then(\n function () {\n assetLoaded(asset, true);\n }, function () {\n assetLoaded(asset, false);\n }\n )\n }).bind(this));\n }).bind(this));\n }", "function loadAllImages() {\n var images = document.querySelectorAll('img[data-src]');\n\n for (var i = 0; i < images.length; i++) {\n ImageLoader.load(images[i]);\n }\n }", "function loadImages(imagesToLoad) {\n\timagesToLoad.forEach(lazyImage => {\n\t\tthis.fireLazyEvent(lazyImage.image);\n\t\tlazyImage.resolved = true;\n\t});\n}", "loadImages(): void {\n let self = this;\n let items = this.getState().items;\n for (let i = 0; i < items.length; i++) {\n let item: ItemType = items[i];\n // Copy item config\n let config: ImageViewerConfigType = {...item.viewerConfig};\n if (_.isEmpty(config)) {\n config = makeImageViewerConfig();\n }\n let url = item.url;\n let image = new Image();\n image.crossOrigin = 'Anonymous';\n self.images.push(image);\n image.onload = function() {\n config.imageHeight = this.height;\n config.imageWidth = this.width;\n self.store.dispatch({type: types.LOAD_ITEM, index: item.index,\n config: config});\n };\n image.onerror = function() {\n alert(sprintf('Image %s was not found.', url));\n };\n image.src = url;\n }\n }", "function refreshImages() {\n var images = document.querySelectorAll('img[data-src]');\n\n for (var i = 0; i < images.length; i++) {\n ImageLoader.load(images[i]);\n }\n }", "async function initialiseGameImages() {\n var i;\n var urlList = [];\n for (i = 0; i < 10; i++) {\n urlList.push(await addImage());\n }\n //console.log(urlList);\n return urlList;\n}", "async TryGetImages(fetchParams) {\n if (!this.state.loadingMore) {\n this.setState({ loadingMore: true }, () => { this.GetImages(fetchParams) })\n }\n }", "loadImages(input_files) {\n this.stateMap.images_still_loading += input_files.length;\n for (let file of input_files) {\n const reader = new FileReader();\n reader.onload = () => {\n let image = new Image();\n image.onload = () => {\n spa.imagelistmodel.addImagebox(file.name,file.lastModified,image);\n this.imageLoadEnded();\n };\n image.onerror = () => {\n this.imageLoadEnded();\n };\n image.src = reader.result;\n };\n reader.onabort = () => {this.imageLoadEnded();};\n reader.onerror = () => {this.imageLoadEnded();};\n reader.readAsDataURL(file);\n }\n\n // tell loaderbox that images are being loaded\n spa.loaderbox.handleLoad();\n \n return true;\n }", "function loadPhotos() {\n\n for(let i = 0; i < 10; i++) {\n fetch(`https://picsum.photos/500/500?random=${i}`)\n .then(x => {\n \n gallery.innerHTML += `\n <img src=\"${x.url}\" alt=\"\">\n `\n });\n }\n}", "function getImages() {\n alert(\"Page will reload once images are finished loading\");\n // runs 1540photo.py, which collects images from Gmail\n exec(\"python 1540photo.py\");\n loaded_images_from_tba = 0;\n // for each team, loads media\n for (let team_id in teams) {\n loadMediaFromTBA(teams[team_id]);\n }\n // gets local files\n let local_dir = fs.readdirSync(\"./data/images/\");\n for (let team_id in local_dir) {\n try {\n let file = local_dir[team_id];\n if (manifest_images.indexOf(file) < 0) {\n manifest_images.push(file);\n }\n } catch (_) {}\n }\n // checks to see if all images are loaded, and saves a manifest if true\n window.setInterval(saveImageManifest, 3000);\n}", "function loadImages( lastCb, imgList )\n {\n //:both these arrays contain completionItems\n var completionList = [];\n var completionCount = 0;\n\n function checkCompletion()\n {\n if( completionCount === imgList.length ) {\n lastCb( completionList );\n }\n }\n imgList.forEach( function( listItem, ix ) {\n var img = new Image();\n var completionItem = { img:img, listItem:listItem };\n\n completionList.push( completionItem );\n imagesRack.loadedImages[ listItem.id ] = completionItem;\n\n img.onload = function() {\n completionCount++;\n listItem.cb && listItem.cb( img, ix );\n checkCompletion();\n }\n img.src = listItem.src;\n });\n }", "function loadImages() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var urls = opts.urls,\n _opts$onProgress3 = opts.onProgress,\n onProgress = _opts$onProgress3 === undefined ? noop : _opts$onProgress3;\n\n (0, _assert2.default)(urls.every(function (url) {\n return typeof url === 'string';\n }), 'loadImages: {urls} must be array of strings');\n var count = 0;\n return Promise.all(urls.map(function (url) {\n var promise = (0, _browserLoad.loadImage)(url, opts);\n promise.then(function (file) {\n return onProgress({\n progress: ++count / urls.length,\n count: count,\n total: urls.length,\n url: url\n });\n });\n return promise;\n }));\n}", "function recursive(url) {\n $.ajax({type: 'GET',dataType: 'jsonp',url: url}).done(function(data){\n //console.log(data);\n $.each(data.entries, function(i,item){\n \n if(item.img.orig){\n\n photos.push({\n 'preview' : item.img.XXS.href,\n //'original': item.img.origin.href, // High load page!\n 'original': item.img.XL.href,\n 'id' : item.id,\n 'index' : photos.length+1\n });\n\n }; \n });\n if(data.links.next)\n recursive(data.links.next);\n else{\n def.resolve();\n };\n });\n }", "resizeImages () {\n // @@@ future feature: consider combining all the promises and using\n // Promise.all() to better handle things?\n [...this.elements].forEach(this.calculateImages, this);\n }", "async getPhotos() {\n\n let pics = await MediaLibrary.getAssetsAsync({\n after: this.state.after,\n first: 50,\n sortBy: [[ MediaLibrary.SortBy.default, true ]]\n });\n\n let promises = [];\n for (var i = 0; i < pics['assets'].length; i++) {\n promises.push(MediaLibrary.getAssetInfoAsync(pics['assets'][i].id));\n }\n\n let a = await Promise.all(promises);\n\n let photos = [];\n for (var i = 0; i < promises.length; i++) {\n photos.push({\n id: a[i].id, // \"F719041D-8A97-4156-A2D9-E25C6CA263AC/L0/001\",\n uri: a[i].uri, // \"assets-library://asset/asset.JPG?id=F719041D-8A97-4156-A2D9-E25C6CA263AC&ext=JPG\",\n file: a[i].localUri, // \"file:///var/mobile/Media/DCIM/116APPLE/IMG_6677.JPG\",\n unix: a[i].creationTime\n });\n }\n\n if (this._isMounted) {\n this.setState((currentState) => {\n return {\n photos: [...currentState.photos, ...photos],\n after: pics['endCursor']\n };\n }, () => {\n // Repeat until the screen is full of images\n // then, we will load more photos with getMoreImages below\n if (this.state.photos.length < 40) {\n this.getPhotos();\n }\n });\n\n }\n }", "function loadAllImages(temple_image_names) {\n //var temple_images = [];\n var temple_images_objects = [];\n for (i = 0; i < temple_image_names.length; i ++) {\n //console.log('temple_images/' + temple_image_names[i] + '_large.webp');\n var oneTemple = new Image();\n oneTemple.src = 'temple_images/' + temple_image_names[i] + '_large.webp';\n //temple_images.push(oneTemple);\n var temple_image_object = {\n image: oneTemple,\n currentX: -1,\n currentY: -1,\n currentSize: -1,\n lastX: -1,\n lastY: -1,\n lastSize: -1,\n };\n temple_images_objects.push(temple_image_object);\n\n }\n //return temple_images;\n return temple_images_objects;\n}", "load(imageSources) {\n return __awaiter(this, void 0, void 0, function* () {\n for (const imageName in imageSources) {\n this.images.set(imageName, yield loadImage(imageSources[imageName]));\n }\n });\n }", "function loadImages(array) {\n var cache=[];\n array.forEach(function(path) {\n // load image into cache\n cache[path] = cacheImages(path);\n });\n return cache;\n }", "function loadImages(images, callback) {\n if (!images[0].complete) {\n if (!images[0].imageReloadTries) {\n images[0].imageReloadTries = 0;\n setTimeout(function(){\n images[0].imageReloadTries += 1;\n loadImages(images, callback);\n },\n 50);\n } else if (images[0].imageReloadTries < IMG_RELOAD_RETRY_MAX) {\n setTimeout(function() {\n images[0].imageReloadTries += 1;\n loadImages(images, callback);\n },\n 250);\n } else {\n // failed so ignore\n widgets.log(\"failed to load \" + images[0].src + \" retries=\" + images[0].imageReloadTries);\n images.shift();\n if (images.length == 0) {\n callback();\n } else {\n loadImages(images, callback);\n }\n }\n } else {\n // remove the first item\n images.shift();\n if (images.length == 0) {\n callback();\n } else {\n loadImages(images, callback);\n }\n }\n }", "preload() {\n const images = Object.keys(ASSET.IMAGE).map(\n (imgKey) => ASSET.IMAGE[imgKey]\n );\n for (let image of images) {\n this.load.image(image.KEY, image.ASSET);\n }\n }", "async GetImages(fetchParams) {\n if (this.state.lastCursor) {\n fetchParams.after = this.state.lastCursor;\n }\n\n CameraRoll.getPhotos(fetchParams).then(\n r => this.AppendImages(r)\n )\n }", "setImageGroup(img, data) {\n var container = new createjs.Container();\n container.addChild(img);\n var queue = new createjs.LoadQueue(true);\n queue.on(\"complete\", this.positionGroup.bind(this, container, data));\n\n for (var i = 0; i < data.children.length; i++) {\n queue.on(\"fileload\", this.handleChildLoad.bind(this, container, data.children[i], data));\n queue.loadFile({\n id:data.children[i].id,\n src:this.assetSrc + data.children[i].img[\"src\"]\n });\n }\n }", "loadAll(...data) {\n // create dir if not exist\n return (0, checkNonEmptyString_1.default)(\"initAll/directory\", this.directory).then(() => {\n return (0, promises_1.mkdir)(this.directory, {\n \"recursive\": true\n }).then(() => {\n return (0, checkAbsoluteDirectory_1.default)(\"initAll/directory\", this.directory);\n });\n // create dir if not exist\n }).then(() => {\n return (0, checkNonEmptyString_1.default)(\"initAll/externalRessourcesDirectory\", this.externalRessourcesDirectory).then(() => {\n return (0, promises_1.mkdir)(this.externalRessourcesDirectory, {\n \"recursive\": true\n }).then(() => {\n return (0, checkAbsoluteDirectory_1.default)(\"initAll/externalRessourcesDirectory\", this.externalRessourcesDirectory);\n });\n });\n // ensure loop\n }).then(() => {\n return new Promise((resolve) => {\n setImmediate(resolve);\n });\n // execute _beforeLoadAll\n }).then(() => {\n return \"function\" !== typeof this._beforeLoadAll ? Promise.resolve() : new Promise((resolve, reject) => {\n const fn = this._beforeLoadAll(...data);\n if (!(fn instanceof Promise)) {\n resolve();\n }\n else {\n fn.then(resolve).catch(reject);\n }\n });\n // init plugins\n }).then(() => {\n return (0, promises_1.readdir)(this.directory);\n // load all\n }).then((files) => {\n return (0, loadSortedPlugins_1.default)(this.directory, this.externalRessourcesDirectory, files, this.plugins, this._orderedPluginsNames, this.emit.bind(this), this._logger, ...data);\n // sort plugins\n }).then(() => {\n this.plugins.sort((a, b) => {\n if (a.name < b.name) {\n return -1;\n }\n else if (a.name > b.name) {\n return 1;\n }\n else {\n return 0;\n }\n });\n return Promise.resolve();\n // end\n }).then(() => {\n this.emit(\"allloaded\", ...data);\n return Promise.resolve();\n });\n }", "async function getImage(nbrPage){\n //get list image name on firebase store\n var listRef = storageRef.child('Images');\n var firstPage = await listRef.list({ maxResults: 10});\n\n if(nbrPage > 0){\n getOtherImage(listRef, firstPage, nbrPage)\n }else{\n giveImageToHtml(firstPage, parent);\n }\n}", "function parseImage(items) {\n var curr_data = [];\n items.forEach(function (element, index, array) {\n console.log(element.media_key.S);\n getImage(element.media_key.S).then((img) => {\n curr_data.push(img);\n if (curr_data.length == items.length) {\n displayImages(curr_data);\n }\n })\n })\n }", "function LoadImages()\n{\n\tvar loadedImages = 0;\n\tvar numImages = 0;\n\tfor (var src in ImgList)\n\t{\n\t\tnumImages++;\n\t}\n\tfor (var src in ImgList)\n\t{\n\t\tImgs[src] = new Image();\n\t\tImgs[src].onload = function()\n\t\t{\n\t\t\tloadedImages = loadedImages +1;\n\t\t\tif(loadedImages >= numImages)\n\t\t\t{\n\t\t\t\t//Finished loading!\n\t\t\t\ttstsetup();\n\t\t\t\tImgsFinished = 1;\n\t\t\t}\n\t\t};\n\n\t\tif (src < 6)\n\t\t{\n\t\t\tImgs[src].src = ImgList[src];\n\t\t}\n\t\telse\n\t\t{\n\t\t\tImgs[src].src = ImgURL + ImgList[src];\n\t\t}\n\t}\n}", "function loadImages (){\n var img = [\n 'src/Barba Garcia, Francisco.jpg',\n 'src/Barba Rodriguez, Arturo.jpg',\n 'src/Caro Bernal, Miguel Angel.jpg',\n 'src/Castillo Peña, José Luis.jpg',\n 'src/Cruz Vidal, Alejandro.jpg',\n 'src/Gallego Martel, Jose Maria.jpg',\n 'src/Garci Peña, José Joaquín.jpg',\n 'src/Vazquez Rodriguez, Maria del Mar.jpg',\n ];\n\n setImgs(shuffle(initImgs(img)));\n}", "function run() {\n return new Promise((resolve, reject) => {\n if (map.length == 0) {\n reject()\n }\n\n for (let i = 0; i < map.length; i++) {\n promises.push(() => {\n console.log('Fetching pngs into', `${map[i].destination_path}/png`, 'dir.')\n return fetchPngs(map[i])\n })\n }\n\n runSync(promises).then(() => {})\n resolve()\n })\n}", "function fetchImgs() {\n const imgUrl = \"https://dog.ceo/api/breeds/image/random/4\";\n fetch(imgUrl)\n .then(resp => resp.json())\n .then(results => insertImgs(results)) \n}", "function getLoadedImages() {\r\n return images;\r\n }", "generateImages(){const fullDeferred=new $.Deferred;const thumbDeferred=new $.Deferred;const resolveFullBlob=blob=>fullDeferred.resolve(blob);const resolveThumbBlob=blob=>thumbDeferred.resolve(blob);const displayPicture=url=>{const image=new Image;image.src=url;// Generate thumb.\nconst maxThumbDimension=friendlyPix.Uploader.THUMB_IMAGE_SPECS.maxDimension;const thumbCanvas=friendlyPix.Uploader._getScaledCanvas(image,maxThumbDimension);thumbCanvas.toBlob(resolveThumbBlob,'image/jpeg',friendlyPix.Uploader.THUMB_IMAGE_SPECS.quality);// Generate full sized image.\nconst maxFullDimension=friendlyPix.Uploader.FULL_IMAGE_SPECS.maxDimension;const fullCanvas=friendlyPix.Uploader._getScaledCanvas(image,maxFullDimension);fullCanvas.toBlob(resolveFullBlob,'image/jpeg',friendlyPix.Uploader.FULL_IMAGE_SPECS.quality)};const reader=new FileReader;reader.onload=e=>displayPicture(e.target.result);reader.readAsDataURL(this.currentFile);return Promise.all([fullDeferred.promise(),thumbDeferred.promise()]).then(results=>{return{full:results[0],thumb:results[1]}})}", "function countLoadedImagesAndLaunchIfReady() {\n\tpicsToLoad--;\n\tif(picsToLoad == 0) {\n\t\thandleComplete();\n\t}\n}", "function loadImages(elements, callback) {\n var count = elements.find('img').length;\n if (count == 0) {\n return;\n }\n\n var total = 0;\n elements.find('img').each(function () {\n $(this).on('load', function() {\n total++;\n if (total == count) callback();\n }).each(function() {\n if (this.complete) $(this).load();\n });\n });\n }", "function loadAsync() {\n\t\t\tvar funcs = [getScriptsFunc(scriptsToLoad), getImagesFunc(imagesToLoad)];\n\t\t\tasync.parallelLimit(funcs, maxThreads, function(err, result) {\n\t\t\t\tif (onDone) onDone(err);\n\t\t\t});\n\t\t}", "pollImages() {\r\n\t\tthis.request.get('http://' + this.config.IP + ':4430/titan/handles', (error, response, body) => {\r\n\t\t\tif (!error && response.statusCode == 200) {\r\n\t\t\t\tvar jsonobj = JSON.parse(Buffer.from(body).toString());\r\n\t\t\t\tfor (var i = 0; i < jsonobj.length; i++) {\r\n\t\t\t\t\tif(jsonobj[i][\"icon\"] != null) {\r\n\t\t\t\t\t\tthis.getImage(jsonobj[i][\"userNumber\"][\"hashCode\"], jsonobj[i][\"icon\"])\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tthis.checkFeedbacks('image');\r\n\t\t});\r\n\t}", "function asyncLoadAllTextures(props) {\n const textureLoader = new THREE.TextureLoader();\n\n function checkJSONStatus(response) {\n if (response.status >= 200 && response.status < 300) {\n return Promise.resolve(response);\n }\n return Promise.reject(new Error(response.statusText));\n }\n\n function processJSON(response) {\n return response.json();\n }\n\n function startLoad() {\n // fetch the JSON file to get the list of images\n return fetch(props.imageJSONFile)\n .then(checkJSONStatus)\n .then(processJSON)\n .then(data => data.imageList)\n .catch((err) => {\n console.error(`JSON request failed with: ${err}`);\n });\n }\n\n return startLoad().then((images) => {\n THREE.ImageUtils.crossOrigin = '';\n const imageAssets = [];\n\n // start loading all images\n images.forEach((image, k) => {\n imageAssets[k] = textureLoader.load(`${props.imagePath}${image}`);\n });\n\n return imageAssets;\n });\n}", "function getImageLinks(breeds, AURL, num) {\n let promises = [];\n for (let x of breeds) {\n for (let i = 0; i < num; i++) {\n promises.push(getImage(AURL, x));\n }\n }\n return Promise.all(promises);\n}", "function preload(){\n for (let i = 0; i<totalImages; i++)\n {\n img[i] = loadImage(\"load/img\" + (i+1) + \".jpg\");\n }\n}", "function preloadImages( images, callback ) {\n\n function _preload( asset ) {\n asset.img = new Image();\n asset.img.src = 'img/Spy/' + asset.id+'.png';\n\n asset.img.addEventListener(\"load\", function() {\n _check();\n }, false);\n\n asset.img.addEventListener(\"error\", function(err) {\n _check(err, asset.id);\n }, false);\n }\n\n var loadc = 0;\n function _check( err, id ) {\n if ( err ) {\n alert('Error al cargar ' + id );\n }\n loadc++;\n if ( images.length == loadc ) \n return callback()\n }\n\n images.forEach(function(asset) {\n _preload( asset );\n });\n}", "function load(paths) {\n\tfunction loadImage(path, callback) {\n\t\tvar img = document.createElement('img');\n\t\timg.addEventListener('load', callback, false);\n\t\timg.src = path;\n\t}\n\tfunction loadResource(path, callback) {\n\t\tvar req = new XMLHttpRequest();\n\t\treq.open('GET', path, true);\n\t\treq.onreadystatechange = function () {\n\t\t\tif (req.readyState === 4)\n\t\t\t\tcallback({\n\t\t\t\t\ttext: req.responseText,\n\t\t\t\t\tstatus: req.status\n\t\t\t\t});\n\t\t};\n\t\treq.send(null);\n\t}\n\treturn ({ then: function (callback) {\n\t\treturn new Async(callback.accumulate(paths.length), function (callback) {\n\t\t\tpaths.forEach(function (path, i) {\n\t\t\t\t(/\\.(png|jpg|gif)$/.test(path) ? loadImage : loadResource)\n\t\t\t\t\t(path, callback.curry(i));\n\t\t\t});\n\t\t})\n\t}})\n}", "compare() {\n let self = this\n return new Promise(function (resolve, reject) {\n self.buildImages()\n .then(res => { resolve() })\n .catch(err => { reject(err) })\n }).catch(err => {\n throw err\n })\n }", "function update() {\n\n if (uploading) return;\n\n fetch('/image/list', {method: 'get'}, // Get a list of all the images from the server\n ).then(response => response.json()\n ).then(imageList => {\n\n for (let receivedImage of imageList) {\n\n let alreadyKnown = false;\n for (let existingImage of images) {\n if (existingImage.src.endsWith(receivedImage.path)) {\n alreadyKnown = true;\n break;\n }\n }\n if (!alreadyKnown) { // Add new ones if required, skip ones we've already loaded\n let newImage = new Image();\n newImage.src = receivedImage.path;\n newImage.addEventListener(\"load\", function() { // Add the image to images when it's loaded\n images.push(newImage);\n });\n }\n }\n\n fetch('/tile/list', {method: 'get'}, // Get a list of all the tiles from the server\n ).then(response => response.json()\n ).then(tileData => {\n\n tiles.length = 0; // Erase the current tile list...\n\n for (let tile of tileData) { // ... rebuild it using the data from the server\n tiles.push({x: tile.x, y: tile.y, path: tile.path});\n }\n\n drawCanvas();\n\n });\n\n });\n}", "function LoadSliderImages(sublist) {\n\t\t\tvar numImages = sublist.find('.item > a > .src').length;\n\t\t\tsublist.find('.item > a > .src').each(function(i) {\n\t\t\t\tvar img = new Image();\n\t\t\t\tvar imgSrc = $(this).html();\n\t\t\t\tvar imgAlt = $(this).parent().find('.alt').html();\n\t\n\t\t\t\t$(this).parent().append(img);\n\t\t\t \n\t\t\t\t// wrap our new image in jQuery, then:\n\t\t\t\t$(img).load(function () {\n\t\t\t\t\tnumImages--;\n\t\t\t\t\tif (numImages == 0) {\n\t\t\t\t\t\tSetSublist(sublist);\n\t\t\t\t\t}\n\t\t\t\t\t/*\n\t\t\t\t\tif (i == sublist.find('.item > a > .src').size() - 1) {\n\t\t\t\t\t\tSetSublist(sublist);\n\t\t\t\t\t}\n\t\t\t\t\t*/\n\t\t\t\t})\n\t\t\t\t.error(function () {\n\t\t\t\t// notify the user that the image could not be loaded\n\t\t\t\t})\n\t\t\t\t.attr('src', imgSrc).attr('alt', imgAlt);\n\t\t\t});\n\t\t}", "function preloadImages() {\n for (var i = 0; i < numberOfGifsToPreload; i++) {\n popThenAddImage(fileNamesArray);\n }\n }", "preload(i){\n if(i===this.imgUrl.length){\n return;\n }\n if(this.prelaodImg.length === 2){\n document.dispatchEvent(new CustomEvent('load-complete',{}));\n }\n const tImg = document.createElement('img');\n tImg.src = this.imgUrl[i];\n //when load is done, load next\n tImg.addEventListener('load',(event)=>{this.preload(++i);\n console.log('loaded '+tImg.src);\n })\n this.prelaodImg.push(tImg);\n }", "function preload() {\n //load pics named \"0.jpg\" though \"100.jpg\"\n for(let i = 0; i <= 100; i++) {\n let tempCat = loadImage(`cats/${i}.jpg`);\n cats.push(tempCat);\n }\n}", "async function loadMisGuifos(){\n for(let i = 0; i<arrayGallery.length; i++){\n let url = `https://api.giphy.com/v1/gifs/${arrayGallery[i]}?api_key=${APIKey}`\n let responseLoad = await fetch(url);\n let dataLoad = await responseLoad.json();\n \n misGuifoscardGenerator(dataLoad.data.images.original.url)\n };\n}", "_start(resolve, reject) {\n return this._imageLister\n .then((images) => {\n return Promise.all(_.map(images, (imageInfo) => {\n return this.removeSingleImage(imageInfo.Id);\n }));\n });\n }", "function fetch( i, img, retry ) {\n // IE problem, can't preload more than 15\n if( img.attachEvent /* msie */ && data.next && data.next % settings.gap == 0 && !retry ){\n window.setTimeout(\n function() {\n fetch( i, img, true );\n }, 10\n );\n return false;\n }\n if( data.next == data.total ) {\n return false;\n }\n img.index = data.next; // save it, we'll need it.\n img.src = sources[data.next++];\n if( settings.onRequest ) {\n data.index = img.index;\n data.element = img;\n data.image = img.src;\n data.original = original[data.next-1];\n settings.onRequest( data );\n }\n }", "function preloadImages() {\n\tidList.forEach(function(id) {\n\t\tlet $newImage = $('#image-preloader').clone();\n\t\t$newImage.attr('src', `${ART_URL}${id}.png`);\n\t\t$('#image-preloader-container').append();\n\t});\n}", "async function loadImagesOntoPage() {\n try {\n dtImageLoadStart = moment(new Date());\n var username = document.getElementById(\"txtUsername\").value;\n var imageDiv = document.getElementById(\"grid\");\n var buttonFeedType = document.getElementById(\"btnFeedLibrary\");\n\n // Add Spinner to button\n // Disable the button to prevent extra load cycles\n var btnLoad = document.getElementById(\"btnLoad\");\n if (btnLoad) {\n var loadingSpinner = document.getElementById(\"loadingSpinner\");\n if (btnLoad.innerText == \"Load Images\") {\n var loadingSpinner = document.createElement(\"span\");\n loadingSpinner.classList.add(\"spinner-border\");\n loadingSpinner.classList.add(\"spinner-border-sm\");\n loadingSpinner.setAttribute(\"id\", \"loadingSpinner\");\n loadingSpinner.setAttribute(\"role\", \"status\");\n loadingSpinner.setAttribute(\"aria-hidden\", \"true\");\n\n btnLoad.disabled = true;\n btnLoad.innerText = \"\";\n btnLoad.appendChild(loadingSpinner);\n }\n }\n\n if (username == \"\" && buttonFeedType.value != 2) {\n console.log('Clearing out images..');\n while (imageDiv.firstChild) {\n imageDiv.removeChild(imageDiv.firstChild);\n }\n\n if (btnLoad) {\n var loadingSpinner = document.getElementById(\"loadingSpinner\");\n btnLoad.removeChild(loadingSpinner);\n btnLoad.innerText = \"Load Images\";\n btnLoad.disabled = false;\n }\n return;\n }\n\n var userId = 0;\n if (buttonFeedType.value != 2) {\n userId = await getUserId(username);\n }\n\n var userPhotoLibrary = await getUserPublicPhotoLibrary(userId);\n\n // Apply Filters\n var filterValues = await swapFilterValuesWithIds();\n var newFilteredUserPhotoLibrary = [];\n\n // for each image\n if (filterValues.length != 0) {\n userPhotoLibrary.forEach(image => {\n // for each filter item (verify image has the corret criteria)\n var imageMustMatchAllFilters = true; // TO DO MAKE THIS TOGGLEABLE ON THE UI\n var imageMatchesAllFilterCriteria = true;\n\n var imageMatchedAtleastOneCriteria = false;\n filterValues.forEach(filter => {\n var filterParts = filter.split(\"|\");\n\n switch (filterParts[0]) {\n case 'A':\n // Activity\n // Example Value: A|GoldenTrophy\n if (image.RoomId == filterParts[1]) {\n imageMatchedAtleastOneCriteria = true;\n } else if (imageMustMatchAllFilters) {\n imageMatchesAllFilterCriteria = false;\n }\n break;\n\n case '!A':\n // Not Activity\n // Example Value: !A|GoldenTrophy\n if (image.RoomId != filterParts[1]) {\n imageMatchedAtleastOneCriteria = true;\n } else if (imageMustMatchAllFilters) {\n imageMatchesAllFilterCriteria = false;\n }\n break;\n\n case 'P':\n // Person\n // Example Value: P|Boethiah\n //console.log(image.TaggedPlayerIds.length);\n if (image.TaggedPlayerIds.length === 0) {\n imageMatchesAllFilterCriteria = false;\n break;\n }\n\n var taggedPlayers = [];\n image.TaggedPlayerIds.forEach(player => { taggedPlayers.push(player) });\n if ((taggedPlayers.findIndex((player) => player == filterParts[1]) > -1) && imageMatchesAllFilterCriteria) {\n imageMatchedAtleastOneCriteria = true;\n } else if (imageMustMatchAllFilters) {\n imageMatchesAllFilterCriteria = false;\n }\n break;\n\n case '!P':\n // Not Person\n // Example Value: !P|Boethiah\n if (image.TaggedPlayerIds.length === 0) {\n imageMatchesAllFilterCriteria = false;\n break;\n }\n\n var taggedPlayers = [];\n image.TaggedPlayerIds.forEach(player => { taggedPlayers.push(player) });\n if (!(taggedPlayers.findIndex((player) => player == filterParts[1]) > -1) && imageMatchesAllFilterCriteria) {\n imageMatchedAtleastOneCriteria = true;\n } else if (imageMustMatchAllFilters) {\n imageMatchesAllFilterCriteria = false;\n }\n break;\n\n default:\n //error occured log to console\n console.log(\"An error occured parsing filter type: \" + filterType);\n }\n });\n if (imageMustMatchAllFilters && imageMatchesAllFilterCriteria) {\n newFilteredUserPhotoLibrary.push(image);\n } else if (!(imageMustMatchAllFilters) && imageMatchedAtleastOneCriteria) {\n newFilteredUserPhotoLibrary.push(image);\n }\n });\n };\n\n if (filterValues.length > 0) {\n userPhotoLibrary = newFilteredUserPhotoLibrary;\n }\n\n const imageResults = document.getElementById('imageResultNumber');\n if (imageResults) {\n if (userPhotoLibrary.length === 0) {\n imageResults.innerText = 'No Images Found!';\n } else {\n imageResults.innerText = 'Image Results: ' + userPhotoLibrary.length;\n }\n }\n\n var dateOrder = document.getElementById(\"btnOldestToNewest\");\n if (dateOrder.value == \"1\") { // Oldest to Newest\n userPhotoLibrary = userPhotoLibrary.reverse();\n }\n\n while (imageDiv.firstChild) {\n imageDiv.removeChild(imageDiv.firstChild);\n }\n\n // Generate Master Lists\n getMasterLists(userPhotoLibrary);\n\n // Generate image HTML\n loadImagesIntoPage(userPhotoLibrary);\n\n if (!username == '') {\n var NewestFirst = false;\n var button = document.getElementById(\"btnOldestToNewest\");\n if (button) {\n if (button.value == \"0\") {\n NewestFirst = true;\n } else {\n NewestFirst = false;\n }\n }\n\n var filterCriteriaString\n if (filterValues.length == 0) {\n filterCriteriaString = 'No filters applied'\n } else { filterCriteriaString = filterValues };\n\n dtImageLoadEnd = moment(new Date());\n\n var duration = moment.duration(dtImageLoadEnd.diff(dtImageLoadStart));\n var seconds = duration.asSeconds();\n var feedType = '';\n if (buttonFeedType.value == 0) {\n feedType = 'Feed';\n } else if (buttonFeedType.value == 1) {\n feedType = 'Library';\n } else if (buttonFeedType.value == 2) {\n feedType = 'Global'\n }\n\n // Log analytics event\n Nucleus.track(\"Button Clicked: Load_Images\", {\n FilterCriteriaString: filterCriteriaString,\n ImageResultCount: userPhotoLibrary.length,\n NewestFirst: NewestFirst,\n LoadDuration: seconds,\n FeedType: feedType\n })\n }\n } catch (error) {\n // Remove Spinner on load button\n // Disable the button to prevent extra load cycles\n console.log(error);\n var btnLoad = document.getElementById(\"btnLoad\");\n if (btnLoad) {\n var loadingSpinner = document.getElementById(\"loadingSpinner\");\n btnLoad.removeChild(loadingSpinner);\n btnLoad.innerText = \"Load Images\";\n btnLoad.disabled = false;\n }\n\n var errorText = document.getElementById('filterErrorText');\n var filterContainer = document.getElementById('filterCategoryContainer');\n\n if (errorText && filterContainer) {\n if (!filterContainer.classList.contains('displayNone')) {\n errorText.classList.remove('displayNone');\n errorText.innerText = \"Failed to load images. Filter criteria may contain invalid values. Check/remove values and try again.\";\n }\n }\n console.log('Error occured loading images onto page: ');\n console.log(error);\n }\n}", "LoadImage(){\n var images=[]\n // hard coded for convenienceproxy to a static serving end point\n if(this.state.images!=undefined){\n this.state.images.map(i =>{\n images.push(\n this.request.getStamp()+'-' + i\n )\n })\n return images; \n }\n else{\n \n return null\n }\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 pilau_preload_images() {\n\tvar args_len, i, cache_image;\n\targs_len = arguments.length;\n\tfor ( i = args_len; i--;) {\n\t\tcache_image = document.createElement('img');\n\t\tcache_image.src = arguments[i];\n\t\tcache.push( cache_image );\n\t}\n}", "function getAllImages() {\n printLog('Requiring all images the user solved from the server.');\n IMAGES = [];\n // IMAGES_ON_CLIENT = 0;\n send(json_get_all_images_message());\n}", "function getImages() {\n\t$.get(\"resources/get_images.php\", {\"page\": globalPage}).success(function(data) {\n\t\tglobalPage++;\n\t\t\n\t\tvar imgz = JSON.parse(data).images;\n\t\tgenerateThumbnails(imgz);\n\t\tgenerateShowMoreButton(imgz);\n\t}).fail(function() {\n\t\twindow.location.replace(\"index.php\");\n\t});\n}", "function loadImages(sources, callback) {    \n\t\tfor(var src in sources) {         \t// get num of sources\n        numImages++;\n        }\n    for(var src in sources) {\n        images[src] = new Image();\n\t\t\timages[src].onload = function() {\n\t\t\t\tif(++loadedImages >= numImages) {\n\t\t\t\tcallback(images);\n\t\t\t\t}\n\t\t\t};\n        images[src].src = sources[src];\n        }\n    }", "function loadNextAsset() {\n\tif (current_image.next().length === 0) {\n\t\treturn;\n\t} else {\n\t\tcurrent_image = current_image.next();\n\t}\n\t\n\tloadAsset();\n}", "function imageLoader(numImages, completion) {\n\tvar count = 0;\n\n\treturn function() {\n\t\tif (numImages == ++count)\n\t\t\tcompletion();\n\t};\n}", "function _onImageLoaded() {\n _imagesToLoad = _imagesToLoad - 1;\n if (!_imagesToLoad) {\n $$log(\"All images loaded, rendering again.\");\n PP64.renderer.render();\n }\n }", "function load_imdb_images () {\n return new Promise (resolve => {\n $.spinnerWait (true);\n userLog (\"Det här kan ta några minuter ...\", true, 5000)\n let cmd = '$( pwd )/ld_imdb.js -e ' + $(\"#imdbPath\").text (); // pwd = present working dir\n execute (cmd).then ( () => {\n // $ (\"button.updText\").css (\"float\", \"right\");\n // $ (\"button.updText\").hide ();\n resolve (\"Done\")\n });\n });\n}", "function loadImages() {\n if (surveyLength > 24) {\n surveyEnd();\n }\n\n lastIndex = [];\n\n lastIndex.push(randomIndex1);\n lastIndex.push(randomIndex2);\n lastIndex.push(randomIndex3);\n\n //Re-assigning the variables for each picture\n randomIndexGenerator();\n\n //While loop to prevent double choices AND no prior choice repeats\n while (randomIndex1 === lastIndex[0] || randomIndex1 === lastIndex[1] || randomIndex1 === lastIndex[2] || randomIndex2 === lastIndex[0] || randomIndex2 === lastIndex[1] || randomIndex2 === lastIndex[2] || randomIndex3 === lastIndex[0] || randomIndex3 === lastIndex[1] || randomIndex3 === lastIndex[2] || randomIndex1 === randomIndex2 || randomIndex1 === randomIndex3 || randomIndex2 === randomIndex3) {\n randomIndexGenerator();\n }\n //Makes leftImg's src property equal to the fileName of the indexed item\n leftImg.src = catalogArray[randomIndex1].filePath;\n centerImg.src = catalogArray[randomIndex2].filePath;\n rightImg.src = catalogArray[randomIndex3].filePath;\n\n //Adds 1 to the display tally property of the indexed object\n catalogArray[randomIndex1].tallyDisplayed += 1;\n catalogArray[randomIndex2].tallyDisplayed += 1;\n catalogArray[randomIndex3].tallyDisplayed += 1;\n\n}", "preloadImages() {\n const {products} = this.props;\n const groups = _.keys(products.byGroup);\n const images = [];\n\n groups.map(name => {\n const productId = products.byGroup[name][0]\n const image = new Image();\n\n image.src = products.byId[productId].image; \n return images.push(image);\n });\n\n return images;\n }", "function countLoadedImagesAndLaunchIfReady() {\n picsToLoad--;\n // console.log(picsToLoad);\n if (picsToLoad == 0) {\n imageLoadingDoneSoStartGame();\n } // wait for images to finish loading\n} // end of function", "function runPromise()\n {\n Promise.all( ajaxesForPromice ).then( values => {\n values.forEach( function( value, vix ) {\n insertImage( values[vix], vix, 'data:image/png;base64,' );\n }); \n continueAfterChartsLoaded();\n }); \n }", "function startLoading(callBackFunc) {\n console.log(\"startloading\");\n for (let i = 0; i < imageURLS.length; i++) {\n let img = new Image();\n images.push(img);\n img.onload = () => {\n imagesCounter++;\n console.log(imagesCounter);\n if (imagesCounter >= imageURLS.length) {\n callBackFunc();\n }\n };\n\n img.onerror = () => {\n alert(\"image load failed\");\n };\n img.src = imageURLS[i];\n }\n}", "function preloadImages(images) {\n imagesAmount = images.length;\n for (var i = 0; i < images.length; i++) {\n var img = new Image();\n img.addEventListener('load', imageLoadedCallback, false);\n img.src = basePath + 'images/' + images[i];\n }\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}", "componentDidMount() {\n var arrOfPromises = [];\n\n gridItems.data.forEach((gridItem) => {\n arrOfPromises.push(\n new Promise((resolve, reject) => {\n let img = new Image();\n img.src = gridItem.src;\n img.addEventListener('load', function() {\n resolve(gridItem.id);\n });\n })\n )\n });\n\n // When all images are loaded then only call onAllImgsLoaded that would make the grid visible.\n Promise.all(arrOfPromises).then(values => {\n this.props.onAllImgsLoaded();\n });\n\n // make the images observe scrolling events. \n for (const imgRef of this.imgRefs) {\n try {\n this.observer.observe(imgRef.current);\n } catch (err) {\n console.log(err);\n }\n }\n }", "function loadFiles() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var urls = opts.urls,\n _opts$onProgress2 = opts.onProgress,\n onProgress = _opts$onProgress2 === undefined ? noop : _opts$onProgress2;\n\n (0, _assert2.default)(urls.every(function (url) {\n return typeof url === 'string';\n }), 'loadImages: {urls} must be array of strings');\n var count = 0;\n return Promise.all(urls.map(function (url) {\n var promise = (0, _browserLoad.loadFile)(Object.assign({ url: url }, opts));\n promise.then(function (file) {\n return onProgress({\n progress: ++count / urls.length,\n count: count,\n total: urls.length,\n url: url\n });\n });\n return promise;\n }));\n}", "function preloadImages(images, callback)\n{\n\n var imagesLoading = images.slice();\n function imageLoaded(image)\n {\n var idx = imagesLoading.indexOf(image);\n if (idx != -1)\n {\n imagesLoading.splice(idx, 1);\n if (imagesLoading.length == 0) callback();\n }\n }\n for (var i = 0; i < images.length; i++)\n {\n var url = images[i];\n var image = new Image();\n image.onload = function (img)\n {\n return function ()\n {\n imageLoaded(img);\n };\n }(images[i]);\n image.src = url;\n }\n}", "function preload(){\n images.forEach(function(elem) {\n im = new Image();\n im.src = elem;\n });\n}", "function loadImages() {\r\n\t\tremoveUnseenImages();\r\n\t\tvar sets = $['mapsettings'];\r\n\t\tvar range = getPixelRange();\r\n\t\tfor(var i=range.start.x; i<range.end.x && i<sets.resolutions[sets.zoom-1].width; i+=addi(i)) {\r\n\t\t\tfor(var j=range.start.y; j<range.end.y && j<sets.resolutions[sets.zoom-1].height; j+=256) {\r\n\t\t\t\tvar col = getColumn(i);\r\n\t\t\t\tif(!isLoaded(col,i,j)) { // Prevent already loaded images from being reloaded\r\n\t\t\t\t\tvar imgurl = sets.image_name.replace(/%Z/, sets.zoom );\r\n\t\t\t\t\timgurl = imgurl.replace(/%L/, sets.level);\r\n\t\t\t\t\timgurl = imgurl.replace(/%C/, col);\r\n\t\t\t\t\timgurl = imgurl.replace(/%X/, (i-firstInColumnLocation(col-1)));\r\n\t\t\t\t\timgurl = imgurl.replace(/%Y/, j);\r\n\t\t\t\t\timgurl = sets.image_dir + imgurl;\r\n\t\t\t\t\t$['mapsettings'].loaded[sets.zoom+\"-\"+col+\"-\"+i+\"-\"+j] = true;\r\n\t\t\t\t\tvar style = \"top: \" + j + \"px; left: \" + i + \"px;\"\r\n\t\t\t\t\tvar theClass = \"file\" + sets.zoom + \"-\" + col +\"-\" + i + \"-\" + j;\r\n\t\t\t\t\t$(\"<img/>\").attr(\"style\", style).attr('class',theClass).appendTo(\"#images\").hide();\r\n\t\t\t\t\t$(\"img.\" + theClass).load(function(e){ $(this).show(); }); // Only show the image once it is fully loaded\r\n\t\t\t\t\t$(\"img.\" + theClass).attr(\"src\", imgurl);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "async function getImgs() {\n\tconst mediadiv = document.getElementById('media');\n\tconst medianodes = mediadiv.childNodes;\n\tlet dlpath = await getPath();\n\tconsole.log(dlpath);\n\tdlpath = dlpath.path.toString();\n\tconst getimgs = new Getimg(dlpath);\n\tgetimgs.on('tvelem', data => {\n\t\tgetImgDB(data).then(res => {\n\n\t\t});\n\t});\n\tgetimgs.on('episode', data => {\n\t\tconst db = new PouchDB(require('path').join(require('electron').remote.app.getPath('userData'), 'dbImg').toString());\n\t\tconsole.log('ep');\n\t\tconst elem = data[0];\n\t\tconst tvelem = data[1];\n\t\tconst elempath = data[2];\n\t\tmedianodes.forEach((img, ind) => {\n\t\t\tif (img.id === elempath) {\n\t\t\t\ttvdb.getEpisodeById(elem.id)\n\t\t\t\t\t.then(res => {\n\t\t\t\t\t\tif (ind === medianodes.length - 1) {\n\t\t\t\t\t\t\tindeterminateProgress.end();\n\t\t\t\t\t\t\tdocument.getElementById('Loading').style.display = 'none';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (res.filename !== '') {\n\t\t\t\t\t\t\timg.children[0].src = `http://thetvdb.com/banners/${res.filename}`;\n\t\t\t\t\t\t\tconvertImgToBlob(img.children[0], blob => {\n\t\t\t\t\t\t\t\tdb.put({\n\t\t\t\t\t\t\t\t\t_id: `img${tvelem.show.replace(' ', '')}S${tvelem.season}E${tvelem.episode}`,\n\t\t\t\t\t\t\t\t\telempath: data[2],\n\t\t\t\t\t\t\t\t\telem: data[0],\n\t\t\t\t\t\t\t\t\ttvelem: data[1],\n\t\t\t\t\t\t\t\t\t_attachments: {\n\t\t\t\t\t\t\t\t\t\timg: {\n\t\t\t\t\t\t\t\t\t\t\tcontent_type: 'image/jpeg', // eslint-disable-line\n\t\t\t\t\t\t\t\t\t\t\tdata: Buffer.from(blob, 'base64')\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} else if (res.filename === '') {\n\t\t\t\t\t\t\timg.children[0].src = `file:///${__dirname}/404.png`;\n\t\t\t\t\t\t\timg.children[0].parentNode.style.display = 'inline-block';\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(err => {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t\tbugsnag.notify(new Error(err), {\n\t\t\t\t\t\t\tsubsystem: {\n\t\t\t\t\t\t\t\tname: 'Viewer'\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}\n\t\t});\n\t});\n}", "function processImages() {\n //check img visibility for contextual-output - clear existing images\n if (checkVisible($(\".contextual-output\")) === false) {\n //empty existing images\n $(\".contextual-output\").empty();\n }\n //get data from image search input field\n var $img_data = getImageInput();\n //use image data to get images, and pass for rendering\n $.when(getImages($img_data)).done(function(response) {\n //console.log(response.toSource());\n //create object for search metadata\n var search_meta = {title:response.title, link:response.link};\n //check for empty items array in response object\n if (response.items.length !== 0) {\n //set initial metadata for returned search\n metaOutput(search_meta);\n //use jQuery's generic iterative function for the response...\n $.each( response.items, function( i, item ) {\n var img = item.media.m;\n createImage(img);\n //limit test images to 4\n if ( i === 5 ) {\n return false;\n }\n });\n } else {\n var img_error = \"No images available - please try a different search.\";\n outputError(img_error);\n }\n //remove ajax spinner\n $(\".spinner\").remove();\n });\n }", "function RandomImageGrid(props) {\n\n var imageOrder;\n var childrenLoaded = 0;\n\n //const [loading, isLoading] = useContext(LoadingContext);\n const [loading, isLoading] = useState(LoadingContext);\n const [childrenLoaded, setChildrenLoaded] = useState(0);\n\n // Similar to componentDidMount and componentDidUpdate:\n useEffect(() => {\n console.log(\"loading: \" + loading);\n }, [loading]);\n\n useEffect(() => {\n setChildrenLoaded(0);\n }, [props.imageType]);\n \n\n //When all the <img> have loaded in the <GridImage> component, then update the state so we know loading is done\n const handleChildLoad = useCallback(() => {\n\n setChildrenLoaded(childrenLoaded+1);\n\n if(childrenLoaded === props.gridSize){\n isLoading(false);\n }\n }, []);\n\n //an array of image paths for the src attribute in the <img> tags \n imagesSources = ['cats_01.jpg', 'cats_02.jpg', 'cats_03.jpg', 'cats_04.jpg', 'cats_05.jpg', 'cats_06.jpg', 'cats_07.jpg', 'cats_08.jpg', 'cats_09.jpg']\n\n return (\n \n <div key={props.imageType} className=\"catcha-images\">\n { imagesSources.map((source, gridPosition) => {\n return(\n <div>\n <img\n src={source} \n onLoad={ () => {handleChildLoad()}}\n />\n </div>\n )\n }) }\n </div>\n )\n }", "async function loadData() {\n if (initialRender.current) {\n initialRender.current = false;\n\n }\n else {\n\n let tempArray = []\n\n for (let i = 0; i < imageKeys.length; i++) {\n\n if (!imageKeys[i].Key.endsWith('/')) {\n let url = \"https://manhuapointin.s3.amazonaws.com/\" + imageKeys[i].Key\n tempArray.push(url)\n }\n }\n setImageUrl(tempArray)\n }\n }", "function openImageEdit() { \n imagesCaptured = selectedProduct.images;\n var imageLoadPromise = [];\n for(var i=0; i<imagesCaptured.length; i++) {\n if(typeof imagesCaptured[i] === \"string\") {\n imageLoadPromise.push(getImageBlob(i));\n }\n }\n $(\".product-list-wrap\").hide();\n $(\".product-update-wrap\").load(\"/image-edit\", function() {\n $(\".product-info .name, .sub-page\").text(selectedProduct.type);\n $(\".product-info .id\").text(\"Product ID: \" + selectedProduct.productID);\n loadTabs(); \n Promise.all(imageLoadPromise).then(function() {\n $(\"#approvalPage\").load(\"/upload-image\", function() {\n $(\".loading-icon\").hide();\n if(selectedProduct.status === config.statusMapper.rejFromApprover) {\n checkUploadLimit(); \n $('.product-edit-tabs a[href=\"#approvalPage\"]').tab('show');\n } else {\n loadEditTab();\n }\n });\n }); \n });\n}", "lazyLoad() {\n if(!this.state.loading && this.state.next) {\n const offset = this.state.offset + this.state.limit;\n this.getAlbums(offset);\n }\n }" ]
[ "0.78189987", "0.7396206", "0.71686983", "0.71121335", "0.69902384", "0.69570225", "0.69126505", "0.68489885", "0.6775809", "0.6747921", "0.6720045", "0.6715199", "0.66828054", "0.66714275", "0.6655029", "0.66428274", "0.66404057", "0.66297644", "0.6619906", "0.660698", "0.6562918", "0.6545264", "0.64909536", "0.6481686", "0.643432", "0.64341015", "0.64271146", "0.6412519", "0.6406537", "0.639881", "0.63905585", "0.6374498", "0.6356972", "0.63502896", "0.6339084", "0.633847", "0.632447", "0.63227737", "0.631773", "0.63111395", "0.6307407", "0.6301867", "0.6280036", "0.6255252", "0.62541354", "0.6245398", "0.62345344", "0.6233445", "0.6232223", "0.6223176", "0.6222803", "0.6219447", "0.6217124", "0.619629", "0.61858195", "0.6180643", "0.6175692", "0.6175378", "0.6166905", "0.6162107", "0.6147693", "0.6140676", "0.61373454", "0.61353445", "0.61259335", "0.61241996", "0.61199194", "0.61179614", "0.6116881", "0.61115885", "0.6099166", "0.6092393", "0.60858357", "0.6077604", "0.6075587", "0.6073056", "0.6067876", "0.60664666", "0.6062739", "0.60459167", "0.6044952", "0.60442895", "0.60430527", "0.6040164", "0.6037479", "0.6021324", "0.60173196", "0.60148513", "0.60095245", "0.600677", "0.5994753", "0.59926844", "0.59917766", "0.5980296", "0.5979395", "0.597213", "0.59694576", "0.59674317", "0.5958719", "0.59581864" ]
0.71868724
2
REST This function register all listeners for the sockets server
registerListeners(){ this.io.on('connection', socket => { this.App.debug("Client connected", this.prefix); this.registerSocketListener(socket, 'send-message', data => { this.App.MessageOrm.getByChatName({chatName: data.room}, (err, rows) => { if (err) return this.App.throwErr(err, this.prefix); if (rows) rows.forEach(row => row.userId = this.App.serializeSalt(row.userId));//Serialize userId this.send(this.io.sockets, 'get-message', rows) }) }); this.registerSocketListener(socket, 'refresh', data => { this.App.MessageOrm.getByChatName({chatName: data.room}, (err, rows) => { if (err) return this.App.throwErr(err, this.prefix); if (rows) rows.forEach(row => row.userId = this.App.serializeSalt(row.userId));//Serialize userId this.send(this.io.sockets, 'refresh', rows) }) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_attachListeners () {\n const onListening = () => {\n const address = this._server.address()\n debug(`server listening on ${address.address}:${address.port}`)\n this._readyState = Server.LISTENING\n }\n\n const onRequest = (request, response) => {\n debug(`incoming request from ${request.socket.address().address}`)\n request = Request.from(request)\n response = Response.from(response)\n this._handleRequest(request, response)\n }\n\n const onError = err => {\n this.emit('error', err)\n }\n\n const onClose = () => {\n this._readyState = Server.CLOSED\n }\n\n this._server.on('listening', onListening)\n this._server.on('request', onRequest)\n this._server.on('checkContinue', onRequest)\n this._server.on('error', onError)\n this._server.on('close', onClose)\n this._readyState = Server.READY\n }", "function socketListeners(){\n\tsocket.on('joined',function(){\n\t\tuser.success();\n\t});\n\tsocket.on('exists',function(err){\n\t\tuser.error(err);\n\t});\n\tsocket.on('roomList',function(roomlist){\n\t\tchatRoom.populate(roomlist);\n\t});\n}", "listen() {\n let others = this._context._services.get(this.name, this.type).filter(entry => {\n return entry.address == this.address;\n });\n if (others.length) {\n for (let node of others) {\n this.socket.connect(node.address);\n }\n }\n this.socket.bind(this.node.host + ':' + this.port);\n }", "registerListeners() {}", "setUpSocketEventListeners() {}", "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 }", "doListen(registry) {}", "initSockets() {\n this.relay.on('requests satisfied', (data) => {\n const sockets = this.channel('relay');\n\n if (!sockets)\n return;\n\n this.to('relay', 'relay requests satisfied', data);\n });\n }", "_setDefaultListeners () {\n this.io.on('connection', (objSocket) => {\n console.log('Socket client connected', this.io.engine.clientsCount);\n objSocket.on('join_room', (strRoom) => {\n console.log('Joining room', strRoom);\n objSocket.join(strRoom);\n });\n })\n }", "function onListening() {\n Object.keys(httpServers).forEach(key => {\n var httpServer = httpServers[key];\n var addr = httpServer.address()||{};\n var bind = typeof addr === \"string\"\n ? \"pipe \" + addr\n : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n })\n}", "listen () {\n if (this._wss) return\n\n super.listen()\n\n this._wss = new WS.Server({\n perMessageDeflate: false,\n port: this._apiPort\n })\n\n this._clients = []\n this._wss.on('connection', this._onConnection.bind(this))\n\n debug('ws2 api server listening on port %d', this._apiPort)\n }", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n console.log('API available on: /api/tasks');\n console.log('Socket connection available on: https://10.3.2.52:3333');\n}", "loadSockets () {\n const funcs = this.loadModules();\n this.io.on('connection', (socket) => {\n console.log('Socket Connected');\n const keys = Object.keys(funcs);\n for (let k = 0; k < keys.length; k++) {\n const key = keys[k];\n socket.on(key, (data) => funcs[key](socket, data));\n }\n });\n }", "function listeners() {\n\t//Connection event--currently no data passed\n\tsocket.on('connect', function() {\n\t\ttotalTimer.start();\n\t});\n\t\n\t//Sets colors\n\tsocket.on('color', function(data) {\n\t\tif (data.color == 'white')\n\t\t\tisWhite = true;\n\t\telse\n\t\t\tisWhite = false;\n\t});\n\t\n\t//Updates board from server\n\tsocket.on('update', function(data) {\n\t\tboard = data.board;\n\t\tdrawBoard(data.board);\n\t\tdrawTurn(data.color);\n\t});\n\t\n\t//Bad move handler\n\tsocket.on('badMove', function() {\n\t\talert('Sorry, that was a bad move. Try a different one');\n\t});\n}", "listen(){\n this.namespace.on('connection', (socket)=>{\n socket.on('teacher start poll', (teacherSocketId, poll) => {\n this.handleStartPoll(teacherSocketId, poll);\n });\n socket.on('student submit poll', (answersInfo, userId, sessionId)=>{\n this.handleStudentSubmitPoll(answersInfo, userId, sessionId);\n })\n });\n }", "startSocketHandling() {\n this.userNamespace.on('connection', (socket) => {\n logger.debug(`New socket connected to namespace ${this.userNamespace.name} + ${socket.id}`);\n\n // Register socket functions\n socket.on('getQuestions', this.getQuestions(socket));\n socket.on('answerQuestion', this.answerQuestion(socket));\n socket.on('answerOpenQuestion', this.answerOpenQuestion(socket));\n });\n }", "_initMainListeners() {\n if (process.env.NODE_ENV !== 'production') {\n console.log(chalk.cyan.bold('\\nExpress is now listening to the following routes :'));\n }\n\n Object.entries(this.routes).forEach(([routeName, routeConfig]) => {\n this._pushRouteListener(removeUrlLastSlash(routeName), routeConfig, routeName);\n });\n\n if (process.env.NODE_ENV !== 'production') {\n console.log('\\n');\n }\n }", "_setListeners(callback) {\n this._socket.on('close', hadError => this._onCloseEvent(hadError));\n this._socket.on('error', err => this._onError(err));\n this._socket.setTimeout(this._server.options.socketTimeout || SOCKET_TIMEOUT, () => this._onTimeout());\n this._socket.pipe(this._parser);\n if (!this.needsUpgrade) {\n return callback();\n }\n this.upgrade(() => false, callback);\n }", "registerListeners() {\n const client = MatrixClientPeg.get();\n\n client.on('sync', this.onSync);\n client.on('Room.timeline', this.onRoomTimeline);\n client.on('Event.decrypted', this.onEventDecrypted);\n client.on('Room.timelineReset', this.onTimelineReset);\n client.on('Room.redaction', this.onRedaction);\n }", "_addEventListeners () {\n this._socket.on(ConnectionSocket.EVENT_ESTABLISHED, this._handleConnectionEstablished.bind(this))\n this._socket.on(ConnectionSocket.EVENT_CLOSED, this._handleConnnectionClosed.bind(this))\n this._socket.on(ConnectionSocket.EVENT_PEER_CONNECTED, this._handlePeerConnected.bind(this))\n this._socket.on(ConnectionSocket.EVENT_PEER_PING, this._handlePingMessage.bind(this))\n this._socket.on(ConnectionSocket.EVENT_PEER_SIGNAL, (signal) => this._rtc.signal(signal))\n this._rtc.on(ConnectionRTC.EVENT_RTC_SIGNAL, (signal) => this._socket.sendSignal(signal))\n this._rtc.on(ConnectionRTC.EVENT_PEER_PING, this._handlePingMessage.bind(this))\n this._rtc.on(ConnectionRTC.EVENT_CLOSED, this._handleConnnectionClosed.bind(this))\n }", "_onListening() {\n /* Called after socket.bind */\n let address = this.socket.address()\n log.info(`server listening ${address.address}:${address.port}`)\n }", "setListeners(){\n let self = this;\n\n self.socketHub.on('connection', (socket) => {\n console.log(`SOCKET HUB CONNECTION: socket id: ${socket.id}`)\n self.emit(\"client_connected\", socket.id);\n socket.on(\"disconnect\", (reason)=>{\n console.log(\"Client disconnected: \" + socket.id)\n self.emit(\"client_disconnected\", socket.id)\n });\n\n socket.on('reconnect', (attemptNumber) => {\n self.emit(\"client_reconnected\", socket.id)\n });\n\n socket.on(\"ping\", ()=>{\n console.log(\"RECEIVED PING FROM CLIENT\")\n socket.emit(\"pong\");\n })\n\n socket.on(\"error\", (err)=>{\n Logger.error(`Client socket error: ${err.message}`, {stack: err.stack});\n })\n\n });\n\n self.dataSocketHub.on('connection', (socket)=>{\n console.log(\"File socket connected\");\n self.emit(\"data_channel_opened\", socket);\n console.log(\"After data_channel_opened emit\")\n socket.on(\"disconnect\", (reason)=>{\n self.emit(\"data_channel_closed\", socket.id);\n });\n\n socket.on(\"reconnect\", (attemptNumber) => {\n self.emit(\"data_channel_reconnection\", socket.id);\n })\n\n socket.on(\"error\", (err)=>{\n Logger.error(\"Data socket error: \" + err)\n })\n\n })\n }", "function startSocketService() {\n\n sockets = initCameraSocketService(config, socketService);\n\n sockets.forEach(function(socket) {\n\n socket.on('camera:status', updateCameraStatus);\n\n socket.on('disconnect', disconnectHandler);\n\n socket.on('camera:freespace', updateSizeChart);\n\n });\n\n }", "function listenForClients () {\n\n // call listen method\n listen({ event: \"connection\" }, function (client) {\n\n // add the client to the global client hash\n clients[client.id] = client;\n\n // sockets.server.send\n listen({\n event: \"sockets.server.send\",\n client: client\n }, function (options) {\n M.emit(\"sockets.send\", options);\n });\n\n // sockets.server.emitGlobal\n listen({\n event: \"sockets.server.emitGlobal\",\n client: client\n }, function (options) {\n M.emit(options.event, options.data);\n });\n\n // if we have a session, add the client to thi session as well\n if (client.handshake.headers.cookie) {\n\n var match = client.handshake.headers.cookie.match(/_s=(.*);/);\n if (match && match[1]) {\n\n // get the session id and its clients\n var sid = match[1]\n , sessionClients = sessions[sid] || []\n ;\n\n // push the new client id\n sessionClients.push(client.id);\n\n // set the clients of the session in the sessions object\n sessions[sid] = sessionClients;\n }\n }\n });\n}", "constructor() {\n this.socketEventList = [];\n this.asyncExtensionList = [];\n this.extensions = {};\n this.setupSocket();\n }", "addEventListeners() {\n this.ws.onopen = () => {\n if (this.opts.autoUnref) {\n this.ws._socket.unref();\n }\n\n this.onOpen();\n };\n\n this.ws.onclose = this.onClose.bind(this);\n\n this.ws.onmessage = ev => this.onData(ev.data);\n\n this.ws.onerror = e => this.onError(\"websocket error\", e);\n }", "Sockets() {\n this.io = socketIo(this.server);\n let sockets = new Socket_1.Socket(this.io);\n }", "init() {\n // Setup event handlers for the socket\n this._setListeners(() => {\n // Check that connection limit is not exceeded\n if (this._server.options.maxClients && this._server.connections.size > this._server.options.maxClients) {\n return this.send(421, this.name + ' Too many connected clients, try again in a moment');\n }\n\n // Keep a small delay for detecting early talkers\n setTimeout(() => this.connectionReady(), 100);\n });\n }", "function onListening() {\n\tconst addr = server.address();\n\tconst bind = `${serverConfig.host}:${serverConfig.defaultPort}`;\n\t// const bind = typeof(addr) === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n\tdebug('Listening on ' + bind);\n}", "async registerHttpServer() {\n this.httpServer = new HttpServer(this.app, this.port);\n this.httpServer.on('error', (err) => {\n this.emit('error', err);\n });\n this.httpServer.on('info', (msg) => {\n this.emit('info', msg);\n });\n\n await this.httpServer.init();\n }", "addEventListeners() {\n this.ws.onopen = () => {\n if (this.opts.autoUnref) {\n this.ws._socket.unref();\n }\n this.onOpen();\n };\n this.ws.onclose = this.onClose.bind(this);\n this.ws.onmessage = ev => this.onData(ev.data);\n this.ws.onerror = e => this.onError(\"websocket error\", e);\n }", "function onListening() {\n const addr = server.address()\n const bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port: ' + addr.port\n //打印log\n console.log(CGlobal.logLang('clothingshop:server HTTP启动成功,{0} IP地址为:{1}', bind, ip || 'localhost'))\n console.timeEnd('HTTP service start time is')\n console.log('界面访问 http://%s:%s%s/index', 'localhost', addr.port, contextPath === '/' ? '' : contextPath)\n console.log('swagger界面访问 http://%s:%s%s/swagger-ui/', 'localhost', addr.port, contextPath === '/' ? '' : contextPath)\n // console.log('Node 界面访问 http://%s:%s/superLogin', hostname, addr.port);\n // console.log('Vue 界面访问 http://%s:%s/v-index', hostname, addr.port);\n // console.log('Angular 界面访问 http://%s:%s/ng-index', hostname, addr.port);\n }", "function setSocketIoConnectionListener() {\n io.on('connection', function (client) {\n setSocketIoListeners(client);\n });\n}", "initSockets() {\n ;\n }", "function onListening() \n{\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n console.log('init - awesome server');\n // logger.info('init - awesome server');\n}", "_constructSocketListeners () {\n /* Handles our open event */\n this._ws.addEventListener('open', evt => {\n setInterval(() => {\n this._sendArray([{ m: '+ls' }])\n }, this._roomScanMS)\n this._isConnected = true\n this._sendArray([{ m: 'hi' }])\n this._heartbeatInterval = setInterval(() => {\n this._sendArray([{ m: 't', e: Date.now() }])\n }, this._heartbeatMS)\n this.emit('connected')\n this.setChannel('lobby')\n this._noteFlushInterval = setInterval(() => {\n if (this._noteBufferTime && this._noteBuffer.length > 0) {\n this._sendArray([{ m: 'n', t: this._noteBufferTime + this._serverTimeOffset, n: this._noteBuffer }])\n this._noteBufferTime = 0\n this._noteBuffer = []\n }\n }, this._noteFlushIntervalMS)\n })\n\n /* Handles our close event */\n this._ws.addEventListener('close', evt => {\n clearInterval(this._heartbeatInterval)\n clearInterval(this._noteFlushInterval)\n if (!this.hasErrored) this.emit('disconnected')\n })\n\n /* Handles our errors */\n this._ws.addEventListener('error', error => {\n if (error.message === 'WebSocket was closed before the connection was established') return\n this.emit('error', new Error(error))\n this._ws.close()\n })\n\n /* Handles generic messages */\n this._ws.addEventListener('message', evt => {\n if (typeof evt.data !== 'string') return\n try {\n const transmission = JSON.parse(evt.data)\n for (var i = 0; i < transmission.length; i++) {\n var msg = transmission[i]\n if (msg.m === 'hi') {\n this._recieveServerTime(msg.t, msg.e || undefined)\n }\n if (msg.m === 't') {\n this._recieveServerTime(msg.t, msg.e || undefined)\n }\n if (msg.m === 'a') {\n this.emit('message', {\n content: msg.a,\n user: {\n id: msg.p.id,\n name: msg.p.name,\n color: msg.p.color\n },\n time: msg.t\n })\n }\n if (msg.m === 'ch') {\n this.room.name = msg.ch._id\n this._channelHasJoined = true\n if (this.room.users.length !== 0) return\n msg.ppl.forEach(person => {\n this.room.users.push({\n id: person.id,\n name: person.name,\n color: person.color\n })\n })\n }\n if (msg.m === 'p') {\n const formattedUser = {\n id: msg.id,\n name: msg.name,\n color: msg.color\n }\n this.emit('userJoined', formattedUser)\n this.room.users.push(formattedUser)\n }\n if (msg.m === 'bye') {\n const user = this.room.users.filter(e => e.id === msg.p)[0]\n this.room.users = this.room.users.filter(e => e.id !== msg.p)\n this.emit('userLeave', user)\n }\n if (msg.m === 'ls') {\n this.rooms = []\n msg.u.forEach(room => {\n this.rooms.push({\n name: room._id,\n count: room.count\n })\n })\n this._sendArray([{ m: '-ls' }])\n }\n if (msg.m === 'n') {\n this.emit('notePress', {\n note: msg.n,\n user: msg.p\n })\n }\n }\n } catch (error) {\n this.emit('error', error)\n }\n })\n }", "listen()\n\t{\n\t\t//Starts the server/\n\t\tconst server = new Websocket.Server({port: P2P_PORT});\n\t\tserver.on('connection', socket => this.connectSocket(socket));\n\t\t\n\t\t//connects to peers.\n\t\tthis.connectToPeers();\n\n\t\tconsole.log(`Listening for peer-to-peer connections on: ${P2P_PORT}`);\n\t}", "addEventListeners() {\n const self = this;\n\n this.ws.onopen = function() {\n self.onOpen();\n };\n this.ws.onclose = function() {\n self.onClose();\n };\n this.ws.onmessage = function(ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function(e) {\n self.onError(\"websocket error\", e);\n };\n }", "bindSocketListeners() {\n //Remove listeners that were used for connecting\n this.netClient.removeAllListeners('connect');\n this.netClient.removeAllListeners('timeout');\n // The socket is expected to be open at this point\n this.isSocketOpen = true;\n this.netClient.on('close', () => {\n this.log('info', `Connection to ${this.endpointFriendlyName} closed`);\n this.isSocketOpen = false;\n const wasConnected = this.connected;\n this.close();\n if (wasConnected) {\n // Emit only when it was closed unexpectedly\n this.emit('socketClose');\n }\n });\n\n this.protocol = new streams.Protocol({ objectMode: true });\n this.parser = new streams.Parser({ objectMode: true }, this.encoder);\n const resultEmitter = new streams.ResultEmitter({objectMode: true});\n resultEmitter.on('result', this.handleResult.bind(this));\n resultEmitter.on('row', this.handleRow.bind(this));\n resultEmitter.on('frameEnded', this.freeStreamId.bind(this));\n resultEmitter.on('nodeEvent', this.handleNodeEvent.bind(this));\n\n this.netClient\n .pipe(this.protocol)\n .pipe(this.parser)\n .pipe(resultEmitter);\n\n this.writeQueue = new WriteQueue(this.netClient, this.encoder, this.options);\n }", "function onListening() {\n var addr = wss.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n}", "addEventListeners() {\n const self = this;\n\n this.ws.onopen = function() {\n self.onOpen();\n };\n this.ws.onclose = function() {\n self.onClose();\n };\n this.ws.onmessage = function(ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function(e) {\n self.onError(\"websocket error\", e);\n };\n }", "addEventListeners() {\n const self = this;\n\n this.ws.onopen = function() {\n self.onOpen();\n };\n this.ws.onclose = function() {\n self.onClose();\n };\n this.ws.onmessage = function(ev) {\n self.onData(ev.data);\n };\n this.ws.onerror = function(e) {\n self.onError(\"websocket error\", e);\n };\n }", "function onListening() {\n\n var addr = this.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n console.log(\"API Listening on port : \" + addr.port);\n}", "addEventListeners() {\n this.ws.onopen = () => {\n if (this.opts.autoUnref) {\n this.ws._socket.unref();\n }\n this.onOpen();\n };\n this.ws.onclose = closeEvent => this.onClose({\n description: \"websocket connection closed\",\n context: closeEvent\n });\n this.ws.onmessage = ev => this.onData(ev.data);\n this.ws.onerror = e => this.onError(\"websocket error\", e);\n }", "listen (server) {\n // create socket server\n chat = io(server);\n\n chat.on('connection', (socket) => {\n guestNumber = this.assignGuestName(\n socket, guestNumber, nickNames, namesUsed\n );\n this.joinRoom(socket, 'lobby');\n this.handleMessageBroadcast(socket, nickNames);\n this.handleNameChangeAttempts(socket, nickNames, namesUsed);\n this.handleRoomJoining(socket);\n socket.on('rooms', () => {\n let rooms = [];\n \tfor (let s in chat.sockets.sockets) {\n \t rooms = rooms.concat(this.listRooms(chat.sockets.sockets[s]));\n \t}\n rooms = Array.from(new Set(rooms));\n socket.emit('rooms', rooms);\n });\n\n this.handleClientDisconnection(socket);\n });\n }", "async function onListening() {\n\n\tawait InitializeDatabase.initializeDatabase();\n\tawait InitializeDatabase.initializeObjection();\n\tinjectDependencies();\n\tinitializeApp()\n\t/**\n\t * Configure Database\n\t */\n\n\tvar addr = server.address();\n\tvar bind = typeof addr === 'string'\n\t\t? 'pipe ' + addr\n\t\t: 'port ' + addr.port;\n\tdebug('Listening on ' + bind);\n\n}", "async discoverEventsAndListeners () {\n await this.registerUserEvents()\n await this.registerSystemEventListeners()\n }", "async registerSystemEventListeners () {\n await Collect(this.coreEventListener)\n .map(Listener => {\n return new Listener()\n })\n .concat(\n await this.getSystemEventListeners()\n )\n .forEach(listener => {\n this.registerListeners(listener.on(), listener)\n })\n }", "function onListening() {\n _logs('访问地址: ' + _config2.default.secheme + '://ip:' + port + '/');\n _logs('APIDoc: ' + _config2.default.secheme + '://ip:' + apiPort + '/');\n}", "function startUp() {\n io.on('connection', function (socket) {\n io.sockets.setMaxListeners(Infinity);\n if (nextOrder > orderLength - 1) {\n stepCount = 0;\n nextOrder = 0;\n }\n var clients = io.sockets.clients(); \n socketArr = Object.values(Object.keys(io.sockets.sockets)); \n\n socket.on('disconnect', function () { \n });\n socket.on('error', function () {\n \n });\n });\n}", "_createServer() {\n // Listen to the port and save the http native server\n this._server = this._app.listen(this.params.port)\n\n // Keep track of sockets to be able to close \n // all of them when we want to close the server\n this._sockets = {};\n this._nextSocketId = 0;\n this._server.on('connection', (socket) => {\n // Add a newly connected socket\n var socketId = this._nextSocketId++;\n this._sockets[socketId] = socket;\n\n // Remove the socket when it closes\n socket.on('close', () => {\n delete this._sockets[socketId];\n });\n\n });\n }", "function onListening() {\n const addr = server.address()\n const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port\n mainWindow.webContents.send('listening', bind)\n}", "function onListening() {\n\tdebug('Listening on port ' + server.address().port);\n}", "listen() {\n const server = new Websocket.Server({ port: P2P_PORT }); // static class Server present in websocket modules\n server.on('connection', socket => this.connectSocket(socket)); // event listener which listens for incoming messages sent to the websocket server\n this.connecToPeers();\n console.log(`Listening for P2P connections on the port: ${ P2P_PORT}`);\n }", "function onListening() {\n CALLBACK();\n const addr = server.address();\n const bind = typeof addr === 'string' ?\n `pipe ${addr}` :\n `port ${addr.port}`;\n debug(`Listening on ${bind}`);\n }", "onListening() {\n var addr = this.server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n }", "listen() {\n //Server() is statically used, as there is no need to create\n // a Websocket instance to call this function\n const server = new Websocket.Server({ port: P2P_PORT });\n\n //Create an event listener, that listens for incoming types of messages\n // The first argument specifies the type of event we are listening\n // out for. By listening to connection events we can fire specific\n // code whenever a new socket connects to this server\n // In order to interact with that socket we are given a callback function\n // whose parameter is the socket object created due to the connection\n server.on('connection', (socket) => this.connectSocket(socket));\n\n //The following function will handle later instances of the application\n // connecting to peers that are specified when they're started\n this.connectToPeers();\n\n console.log(`Listening for P2P connections on: ${P2P_PORT}`);\n }", "function onListening() {\n debug('Listening on ' + port);\n }", "function setSocketIoListeners(client) {\n\n client.on('GetAds',function(data){\n // making sure that the client sent the 'getAll' parameter\n if (typeof data.getAll === 'undefined') return;\n\n logEvent('GetActiveAds', data);\n onGetAds(client, data.getAll);\n });\n\n client.on('GetAdsByStation',function(data){\n // making sure that the client sent the 'stationId' parameter\n if (typeof data.stationId === 'undefined') return;\n\n logEvent('GetActiveAdsByStation', data);\n onGetAdsByStation(client, data.stationId);\n });\n\n client.on('ValidateAd', function(data) {\n // making sure that the client sent the 'ad' parameter\n if (typeof data.ad === 'undefined') return;\n \n logEvent('ValidateAd', data);\n onValidateAd(client, data.ad);\n });\n\n client.on('CreateAd', function(data) {\n // making sure that the client sent the 'adData' parameter\n if (typeof data.adData === 'undefined') return;\n \n logEvent('CreateAd', data);\n onCreateAd(data.adData);\n });\n\n client.on('DeleteAd', function(data) {\n // making sure that the client sent the 'adId' parameter\n if (typeof data.adId === 'undefined') return;\n \n logEvent('DeleteAd', data);\n onDeleteAd(client , data.adId);\n });\n\n client.on('EditAd', function(data) {\n // making sure that the client sent the 'adId' and 'adData' parameters\n if (typeof data.adId === 'undefined') return;\n if (typeof data.adData === 'undefined') return;\n \n logEvent('EditAd', data);\n onEditAd(data.adId, data.adData);\n });\n\n client.on('GetAllStations', function(data) {\n \n logEvent('GetAllStations', data);\n onLoadAllDisplays(client);\n });\n \n client.on('GetAdCountByStation', function(data) {\n\n logEvent('GetAllStations', data);\n onGetAdCountByStation(client, data.stationId);\n });\n}", "function init(socket) {\n\t\t// when the socket is available pass it for setup listeners\n\t\tsock = socket; // cache our socket plz\n\t\t// actual route db CRUD listeners\n\t\tdebug('socket init routes:', routes);\n\t\tsocket.on(routes.index, index);\n\t\tsocket.on(routes.create, create);\n\t\tsocket.on(routes.read, read);\n\t\tsocket.on(routes.update, update);\n\t\tsocket.on(routes.dleet, dleet);\n\t}", "function onListening() {\n const addr = server.address();\n const bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n }", "function onListening() {\n\tconst addr = server.address();\n\tconst bind = (typeof addr === 'string') ? 'pipe ' + addr : 'port ' + addr.port;\n}", "function onListening() {\n var addr = server.address();\n var bind = (typeof addr === 'string') ? 'pipe ' + addr : 'port ' + addr.port;\n logger.info('>> LISTENING ON ' + bind);\n}", "function onListening() {\n\tvar addr = server.address();\n\tvar bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n\tdebug('Listening on ' + bind);\n}", "start() {\n\t\tthis.registerListeners();\n\t}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n // 'debug', escribe en consola cuando estamos en modo debug para hacer log en consola.\n // cuando en consola escriba \"DEBUG=servidor:server NODE_ENV=production nodemon ./bin/www\"\n // voy a a establecer que la variable de entorno 'NODE_ENV' sea igual a cuando trabajo en producción\n // ('production'), ya que por defecto NODE arranca en modo desarrollo ('development'); con esto consigo\n // añadir los archivos que me interesen, bien a la rama de desarrollo o a la rama de producción.\n // con 'app.get('env') obtengo lo que le pase a la variable de entorno 'NODE_ENV' por consola para establecer esa rama.\n // Podemos comprobarlo en 'app.js' como lo establece por defecto --> \"app.use(logger('dev'));\"\n // Para los errores y su debug por consola tambieén podemos ver como lo establece en 'app.js'--> \"if (app.get('env') === 'development')\"\n // con esto evitamos que al definir nuestro entorno en producción al intentar acceder un malintencionado a través de la web, evitar\n // darle la traza, cosa que en development si nos puede interesar ya que trabajamos nosotros y no tienen acceso otros.\n debug('Listening on ' + bind + ' entorno: ' + app.get('env'));\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n }", "function onListening() {\n\tconst addr = server.address();\n\tdebug(`Listening on http://localhost:${addr.port}`);\n\tappLogger.info('app started');\n}", "function onListening() {\n\tvar addr = server.address();\n\tvar bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n\tdebug(\"Listening on \" + bind);\n}", "function startSocketService() {\n\n sockets = initCameraSocketService(config, socketService);\n\n sockets.forEach(function(socket) {\n if (typeof socket !== 'undefined') {\n socket.on('camera:status', updateCameraStatus);\n }\n });\n\n }", "startListening() {\n\t\tthis.server.listen(this.port, () => {\n\t\t\tconsole.log('Server started listening on port', this.port);\n\t\t});\n\t}", "bindCallbacks() {\n this.socket.onopen = (event) => this.onopen(event);\n this.socket.onmessage = (event) => this.onmmessage(event);\n this.socket.onclose = (event) => this.onclose(event);\n this.socket.onerror = (event) => this.onerror(event);\n }", "function onListening() {\n let addr = server.address();\n let bind = typeof addr === 'string' ?\n 'pipe ' + addr :\n 'port ' + addr.port;\n //debug('Listening on ' + bind);\n console.log('Http server is listening on ' + bind);\n}", "listen() {\n this.server.listen( this.port, () => {\n console.log('Servidor corriendo en puerto', this.port );\n });\n }", "function onListening() {\n debug('Listening on port ' + port);\n}", "function onListening() {\n\tvar addr = server.address();\n\tvar bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n\tdebug( 'Listening on ' + bind );\n}", "function onListening()\n{\n var addr = server.address();\n var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n debug('Listening on ' + bind);\n}", "function main() {\n register_listeners();\n}", "function onListening() {\n\tconst addr = server.address();\n\tconst bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;\n\tdebug(`Listening on ${bind}`);\n}", "function onListening() {\nvar addr = server.address();\nvar bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\ndebug('Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string' ?\n\t\t\t'pipe ' + addr : 'port ' + addr.port;\n\t\n debug('Listening on ' + bind);\n}", "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 // Insert sockets below\n require('../api/thing/thing.socket').register(socket);\n }", "listen() {\n // use a server class inside the ws module, use either the user's port variable or the one we specified up there^\n const server = new WebSocket.Server({ port: P2P_PORT });\n // event listener sent to the server\n // fire callback whenever a new socket connects with this server\n server.on('connection', socket => this.connectSocket(socket));\n // make sure that later instances connect to this and other instances\n this.connectToPeers();\n\n console.log(`listening for peer to peer connections on ${P2P_PORT}`);\n }", "_propagateServerEvents () {\n function socketProperties (socket) {\n const byteSize = require('byte-size')\n const output = {\n bytesRead: byteSize(socket.bytesRead).toString(),\n bytesWritten: byteSize(socket.bytesWritten).toString(),\n remoteAddress: socket.remoteAddress\n }\n if (socket.bufferSize) {\n output.bufferSize = byteSize(socket.bufferSize).toString()\n }\n return output\n }\n\n /* stream connection events */\n const server = this.server\n server.on('connection', socket => {\n this.emit('verbose', 'server.socket.new', socketProperties(socket))\n socket.on('connect', () => {\n this.emit('verbose', 'server.socket.connect', socketProperties(socket))\n })\n socket.on('data', () => {\n this.emit('verbose', 'server.socket.data', socketProperties(socket))\n })\n socket.on('drain', () => {\n this.emit('verbose', 'server.socket.drain', socketProperties(socket))\n })\n socket.on('timeout', () => {\n this.emit('verbose', 'server.socket.timeout', socketProperties(socket))\n })\n socket.on('close', () => {\n this.emit('verbose', 'server.socket.close', socketProperties(socket))\n })\n socket.on('end', () => {\n this.emit('verbose', 'server.socket.end', socketProperties(socket))\n })\n socket.on('error', function (err) {\n this.emit('verbose', 'server.socket.error', err)\n })\n })\n\n server.on('close', () => {\n this.emit('verbose', 'server.close')\n })\n\n /* on server-up message */\n server.on('listening', () => {\n const isSecure = t.isDefined(server.addContext)\n let ipList\n if (this.config.hostname) {\n ipList = [ `${isSecure ? 'https' : 'http'}://${this.config.hostname}:${this.config.port}` ]\n } else {\n ipList = util.getIPList()\n .map(iface => `${isSecure ? 'https' : 'http'}://${iface.address}:${this.config.port}`)\n }\n this.emit('verbose', 'server.listening', ipList)\n })\n\n server.on('error', err => {\n this.emit('verbose', 'server.error', err)\n })\n\n /* emit memory usage stats every 30s */\n const interval = setInterval(() => {\n const byteSize = require('byte-size')\n const memUsage = process.memoryUsage()\n memUsage.rss = byteSize(memUsage.rss).toString()\n memUsage.heapTotal = byteSize(memUsage.heapTotal).toString()\n memUsage.heapUsed = byteSize(memUsage.heapUsed).toString()\n memUsage.external = byteSize(memUsage.external).toString()\n this.emit('verbose', 'process.memoryUsage', memUsage)\n }, 60000)\n interval.unref()\n }", "function onListening(): void {\n const addr = server.address();\n const bind = typeof addr === 'string'\n ? `pipe ${addr}`\n : `port ${addr.port}`;\n debug(`Listening on ${bind}`);\n console.log(`Listening on ${bind}`);\n}", "function onListening() {\n const addr = server.address();\n const bind = typeof addr === 'string' ?\n 'pipe' + addr :\n 'port' + addr.port;\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n debug('Listening on ' + bind);\n}", "Listen() {\n this.server.listen(this.port, () => {\n console.log(` ---> Servidor corriendo en ${Constants_1.HOST}${this.port}`);\n });\n }", "function onListening()\n{\n\tvar addr\t= server.address();\n\tvar bind\t= ('string' === typeof addr) ? 'pipe ' + addr : 'port ' + addr.port;\n\n\tdebug('Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n console.log(\"Listening on \" + bind);\n }", "function registerPeerConnectionListeners() {\n peerConnection.addEventListener('icegatheringstatechange', () => {\n console.log(\n `ICE gathering state changed: ${peerConnection.iceGatheringState}`);\n });\n\n peerConnection.addEventListener('connectionstatechange', () => {\n console.log(`Connection state change: ${peerConnection.connectionState}`);\n if (peerConnection.connectionState === 'disconnected') {\n document.querySelector('#remoteVideo').srcObject = null;\n }\n });\n\n peerConnection.addEventListener('signalingstatechange', () => {\n console.log(`Signaling state change: ${peerConnection.signalingState}`);\n });\n\n peerConnection.addEventListener('iceconnectionstatechange ', () => {\n console.log(\n `ICE connection state change: ${peerConnection.iceConnectionState}`);\n });\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === \"string\" ? \"pipe \" + addr : \"port \" + addr.port;\n debug(\"Listening on \" + bind);\n}", "function onListening() {\n\t\tvar addr = server.address();\n\t\tvar bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;\n\t\tvar fqdn = scheme+\"://\"+host;\n\t\tcrawl.init(fqdn,host,scheme);\n\t}", "function startListening() {\n\tapp.listen(8080, function() {\n\t\tconsole.log(\"Sever started at http://localhost:8080 Start chatting!\");\n\t});\n}", "function onListening () {\n var addr = server.address()\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port\n debug('Listening on', bind)\n }", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug_info('Listening on ' + bind);\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n}", "function onListening() {\r\n var addr = server.address();\r\n var bind = typeof addr === 'string' ?\r\n 'pipe ' + addr :\r\n 'port ' + addr.port;\r\n debug('Listening on ' + bind);\r\n}", "function onListening() {\n var addr = server.address();\n var bind = typeof addr === 'string'\n ? 'pipe ' + addr\n : 'port ' + addr.port;\n debug('Listening on ' + bind);\n }", "function onListening() {\r\n var addr = server.address();\r\n var bind = typeof addr === 'string'\r\n ? 'pipe ' + addr\r\n : 'port ' + addr.port;\r\n debug('Listening on ' + bind);\r\n}" ]
[ "0.7682909", "0.73489237", "0.7195603", "0.7103228", "0.6906652", "0.6882505", "0.6839058", "0.6817593", "0.6777125", "0.6693215", "0.6668203", "0.6564401", "0.6546428", "0.65459555", "0.65360385", "0.65197814", "0.6514997", "0.64507025", "0.6449377", "0.6448341", "0.64393526", "0.64327466", "0.63642126", "0.6348579", "0.63332134", "0.63278794", "0.632664", "0.63045996", "0.62954664", "0.6294072", "0.62869185", "0.6272667", "0.6269919", "0.6267431", "0.62545687", "0.6247628", "0.6238487", "0.6238398", "0.62298673", "0.6220698", "0.62160623", "0.62160623", "0.62146515", "0.6209921", "0.6208777", "0.6186082", "0.6182588", "0.6179705", "0.61792076", "0.6178834", "0.6178595", "0.61719596", "0.6166132", "0.61539686", "0.61504215", "0.61299175", "0.61214393", "0.611153", "0.61045164", "0.61004716", "0.6097218", "0.6090555", "0.6090256", "0.60881054", "0.60835564", "0.60829", "0.6082087", "0.6080222", "0.60669446", "0.6063562", "0.6055151", "0.60543895", "0.6051778", "0.6046785", "0.6041427", "0.60413486", "0.60400903", "0.60263115", "0.6022263", "0.6017179", "0.60141915", "0.60119087", "0.601167", "0.6008715", "0.6005597", "0.6005283", "0.6004001", "0.60024333", "0.5999584", "0.5998474", "0.59978426", "0.5993571", "0.5993545", "0.5991243", "0.5987421", "0.5983061", "0.59820306", "0.5981326", "0.5981057", "0.5978668" ]
0.7165871
3
Our Javascript will go here.
function initTrayPoints(nbPoints, opt, profile, threeDModel) { var points = profile.getPoints(nbPoints, threeDModel); trayDists = distanceMatrix(points); trayTsne = new tsnejs.tSNE(opt); // create a tSNE instance trayTsne.initDataDist(trayDists); if (threeDModel) { for (var i = 0; i < points.length; i++) { var color = points[i].color; var material = new THREE.MeshBasicMaterial({color: color}); var mesh = new THREE.Mesh(trayCubesGeometry, material); mesh.position.x = points[i].coords[0] * trayRatio; mesh.position.y = points[i].coords[1] * trayRatio; mesh.position.z = points[i].coords[2] * trayRatio; trayStars.push(mesh); trayScene.add(mesh); } } else { for (var i = 0; i < points.length; i++) { var star = new THREE.Vector3(); star.x = points[i].coords[0] * trayRatio; star.y = points[i].coords[1] * trayRatio; star.z = 0; trayStarsGeometry.vertices.push(star); var color = points[i].color; var texture = new THREE.TextureLoader().load('textures/circle.png'); var starsMaterial = new THREE.PointsMaterial({ size: 0.5, color: color, map: texture, transparent: true, depthWrite: false }); var starField = new THREE.Points(trayStarsGeometry, starsMaterial); trayStars.push(starField); trayScene.add(starField); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dealers_page_elementsExtraJS() {\n // screen (dealers_page) extra code\n\n }", "function PaginaInicial_elementsExtraJS() {\n // screen (PaginaInicial) extra code\n\n }", "function jsOnLoad(){\n\n}", "function BaixarOrdemTV_elementsExtraJS() {\n // screen (BaixarOrdemTV) extra code\n\n }", "function BaixarOrdemInternet_elementsExtraJS() {\n // screen (BaixarOrdemInternet) extra code\n\n }", "function Introducao_elementsExtraJS() {\n // screen (Introducao) extra code\n\n }", "function javascriptInfo() {\n $(\"#results\").text(\"Javascript\"\n )}", "function BaixarOrdemInternet_TV_elementsExtraJS() {\n // screen (BaixarOrdemInternet_TV) extra code\n\n }", "function HeaderDocumentReadyScripts() {\n\n\tif ($.trim(SearchPageUrl).length > 0) {\n\t\tsessionStorage.setItem('SearchPageUrl', SearchPageUrl);\n\t}\n\n\t$(\"body\").find(\"div\").click(function () {\n\t\tif ($(this).hasClass(\"village-cinema-bg\") == false && $(this).hasClass(\"wrapper\") == false) { //#5322 - To Allow click on main div or body.\n\t\t\tisBodyClicked = false;\n\t\t}\n\t});\n\n\tif ($('#LoginTexthWidget').length > 0) {\n\t\t$('#LoginTexthWidget').hover(function () {\n\t\t\treturn false;\n\t\t});\n\n\t\t$('#LoginTexthWidget').click(function () {\n\t\t\treturn false;\n\t\t});\n\n\t}\n\n\tSetPasswordDefaultText();\n\tWidgetStateChange();\n\tWidgetByMovieFilterChange('All');\n\tWidgetByCinemaFilterChange('All');\n\n\tstyleFormElements();\n\n\tEnableDisableControl('ddlByMovieCinemas', true);\n\tEnableDisableControl('ddlByMovieSessions', true);\n\tEnableDisableControl('ddlByCinemaMovies', true);\n\tEnableDisableControl('ddlByCinemaSessions', true);\n\n\t$('#ddlByMovieCinemas').parent().find('span').html('Select cinema');\n\t$('#ddlByMovieSessions').parent().find('span').html('Select session');\n\t$('#ddlByCinemaMovies').parent().find('span').html('Select movie');\n\t$('#ddlByCinemaSessions').parent().find('span').html('Select session');\n\n\t//code for call cinema page on enter press in CinemaMegaMenu \n\t/* fix for defect #643 */\n\t$('#Cinema-Search').bind('keypress', function (e) {\n\t\tvar code = (e.keyCode ? e.keyCode : e.which);\n\t\tif (code == 13) {\n\t\t\t$('#imgCinemaNavFindCinema').trigger('click');\n\t\t\treturn false;\n\t\t}\n\t});\n\n\t$('#QuickTicketsMenu ul.tabs a').click(function () {\n\n\t\tif ($(this).attr('href') == '#CinemaTab') {\n\t\t\tWidgetTab('bycinema');\n\t\t}\n\t\telse {\n\t\t\tWidgetTab('bymovie');\n\t\t}\n\n\t\t$('#txtCurrentWidgetTab').val($(this).attr('href'));\n\n\t});\n\n\t$('#divHeaderForgotPwdContent').html($('#hidForgotPasswordText').val());\n\t$('#divHeaderMailSentContent').html($('#hidMailSentText').val());\n\n}", "function popupScripts() {\n\t\t\t\tif (!o.dontTouchForm) {\n\t\t\t\t\tformCheck();\n\t\t\t\t}\n\t\t\t}", "function scriptLoadHandler() {\n // Restore jQuery and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n PlannTo.jQuery = jQuery;\n\n // Call our main function\n\n main();\n }", "function TermsServices_elementsExtraJS() {\n // screen (TermsServices) extra code\n\n }", "function TELUGU_elementsExtraJS() {\n // screen (TELUGU) extra code\n }", "function ourBookmarkletCode($)\n {\n // -----------------------------------------------------------------------------------------\n // Custom code goes from here ......\n\n var message = $('<div>').css({\n position: 'fixed',\n top: '2em',\n left: '2em',\n padding: '2em',\n 'background-color': '#ace',\n 'z-index': 100000\n }).text('We have jQuery here!');\n\n $('body').append(message);\n\n message.animate({'font-size': '200%'}, {duration: 1000});\n\n // ... to here.\n // -----------------------------------------------------------------------------------------\n }", "function Screen4_elementsExtraJS() {\n // screen (Screen4) extra code\n\n }", "function setJs() {\n\t\t\tvar body = document.getElementsByTagName(\"body\")[0];\n\t\t\taddClass(body,'js');\n\t\t}", "function BaixarOrdemTelefone_elementsExtraJS() {\n // screen (BaixarOrdemTelefone) extra code\n\n }", "function IntroducaoPros_elementsExtraJS() {\n // screen (IntroducaoPros) extra code\n\n }", "function callScripts() {\n\t\"use strict\";\n\tjsReady = true;\n\tsetTotalSlides();\n\tsetPreviousSlideNumber();\n\tsetCurrentSceneNumber();\n\tsetCurrentSceneSlideNumber();\n\tsetCurrentSlideNumber();\n}", "static viewJs(formfactor) {\n let src;\n switch(formfactor) {\n case 'phone':\n case 'table':\n src = window.rootpath + 'sample/sample-view-phone.js';\n //src = window.rootpath + 'sample-view-desktop.js';\n break;\n case 'desktop':\n default:\n src = window.rootpath + 'sample/sample-view-desktop.js';\n break;\n }\n return src;\n }", "function letsJQuery() {\n get_layout();\n}", "function LiveReloadJsHandler() {\n}", "function searchPage_elementsExtraJS() {\n // screen (searchPage) extra code\n /* useProfileToggle */\n $(\"#searchPage_useProfileToggle\").parent().find(\".ui-flipswitch-on\").attr(\"tabindex\", \"1\");\n /* useLocationToggle */\n $(\"#searchPage_useLocationToggle\").parent().find(\".ui-flipswitch-on\").attr(\"tabindex\", \"4\");\n /* distanceSelect */\n $(\"#searchPage_distanceSelect\").parent().find(\"a.ui-btn\").attr(\"tabindex\", \"9\");\n /* ingredientPopup */\n $(\"#searchPage_ingredientPopup\").popup(\"option\", \"positionTo\", \"window\");\n /* distancePopup */\n $(\"#searchPage_distancePopup\").popup(\"option\", \"positionTo\", \"window\");\n /* ratingPopup */\n $(\"#searchPage_ratingPopup\").popup(\"option\", \"positionTo\", \"window\");\n /* cuisinePopup */\n $(\"#searchPage_cuisinePopup\").popup(\"option\", \"positionTo\", \"window\");\n /* pricePopup */\n $(\"#searchPage_pricePopup\").popup(\"option\", \"positionTo\", \"window\");\n /* dietaryPopup */\n $(\"#searchPage_dietaryPopup\").popup(\"option\", \"positionTo\", \"window\");\n /* loginPopup */\n $(\"#searchPage_loginPopup\").popup(\"option\", \"positionTo\", \"window\");\n }", "function IntroducaoContra_elementsExtraJS() {\n // screen (IntroducaoContra) extra code\n\n }", "function main() {\n // main widget code\n\n jQuery(document).ready(function ($) {\n var rule_id = scriptTag.src.split(\"?id=\")[1];\n var site_path = scriptTag.src.split(\"?id=\")[0];\n var hostname = $('<a>').prop('href', site_path).prop('protocol') + '//' + $('<a>').prop('href', site_path).prop('host');\n var baseURI = window.location.pathname+location.search;\n\n var api_url = hostname+\"/api/check-rule-conditions/\"+rule_id;\n jQuery.getJSON(api_url, {url: baseURI}, function(result) {\n console.log(result);\n if(result.show) {\n alert(result.text)\n }\n });\n\n\n });\n }", "function Facebook_Me_elementsExtraJS() {\n // screen (Facebook_Me) extra code\n\n /* mobiletoggle_28 */\n\n $(\"#Facebook_Me_mobiletoggle_28\").parent().find(\".ui-flipswitch-on\").attr(\"tabindex\", \"4\");\n\n /* mobilelist_36 */\n\n listView = $(\"#Facebook_Me_mobilelist_36\");\n theme = listView.attr(\"data-theme\");\n if (typeof theme !== 'undefined') {\n var themeClass = \"ui-btn-up-\" + theme;\n listItem = $(\"#Facebook_Me_mobilelist_36 .ui-li-static\");\n $.each(listItem, function(index, value) {\n $(this).addClass(themeClass);\n });\n }\n\n /* mobilelistitem_37 */\n\n }", "function detailedReviewPage_elementsExtraJS() {\n // screen (detailedReviewPage) extra code\n }", "function onPageLoad() {\n\n}", "function userscripts()\n{\n //insert code here:\n}", "function main() {\n //your widget code goes here\n jQueryBeacon(document).ready(function () {\n console.log('Realgraph Beacon Loaded');\n var currentURL = window.location.href; // Returns full URL\n pingListener(currentURL);\n getAndRenderEntitiesData(currentURL);\n\n //example load css\n //loadCss(\"http://example.com/widget.css\");\n\n //example script load\n //loadScript(\"http://example.com/anotherscript.js\", function() { /* loaded */ });\n });\n }", "onPageReady () {}", "function my_js_callback(data) {\n\t//send data to be turned into interpretable data\n\t$(\".Alerts\").hide(\"slow\");\n\t$(\".Alerts\").replaceWith('<div class=\"Alerts\">Message</div>');\n\tDisplayDrawingResultPage(data)\n}", "function fewLittleThings(){\r\n\t\r\n\t//document.getElementById('col-dx').childNodes[2].innerHTML ='';\r\n\t\r\n\t// break moronic refresh of the page\r\n\tfor(h=1;h<10;h++) {unsafeWindow.clearTimeout(h);}\r\n\tdocument.body.appendChild(document.createElement('script')).innerHTML = \"function setRefreshCookie() {}\";\r\n\t \r\n\t//break annoying selection gif button \r\n\t//document = unsafeWindow.document;\r\n\t//document.onmouseup = null;\r\n\tdocument.body.appendChild(document.createElement('script')).innerHTML = \"function mostraPulsante() {}\";\r\n\t\r\n\t\r\n\t}", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n }", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n }", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n\n }", "function startScreen_elementsExtraJS() {\n // screen (startScreen) extra code\n\n }", "function letsJQuery() {\r\n\tcreateOptionsMenu();\r\n\tpressthatButton();\r\n }", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n // Call our main function\n surpriseClicked = localStorage.getItem(\"surpriseClicked\");\n if (surpriseClicked == null || surpriseClicked == \"null\") {\n main();\n }\n \n}", "function Comprador_elementsExtraJS() {\n // screen (Comprador) extra code\n /* mobilelist_11 */\n listView = $(\"#Comprador_mobilelist_11\");\n theme = listView.attr(\"data-theme\");\n if (typeof theme !== 'undefined') {\n var themeClass = \"ui-btn-up-\" + theme;\n listItem = $(\"#Comprador_mobilelist_11 .ui-li-static\");\n $.each(listItem, function(index, value) {\n $(this).addClass(themeClass);\n });\n }\n /* mobilelistitem_12 */\n /* mobilelistitem_14 */\n /* mobilelistitem_16 */\n /* mobilelistitem_109 */\n }", "function onPageLoaded() {\n}", "function init() {\n // THIS IS THE CODE THAT WILL BE EXECUTED ONCE THE WEBPAGE LOADS\n }", "function initializePage() {\n\tconsole.log(\"Javascript connected!\");\n\t//$(\"a.nameClick\").click(replaceName);\n}", "function event_onload() {\n alert('*** Bienvenido a Evaluación Final Java Script ***');\n}", "function ConfirmacaoCliente_elementsExtraJS() {\n // screen (ConfirmacaoCliente) extra code\n\n }", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n // Call our main function\n main();\n }", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n // Call our main function\n main();\n }", "function onReady() {\r\n alert( 'Кофе готов!' );\r\n }", "onReady() {\n\n }", "function initScripts() {\n breakpoint();\n lazyload();\n heroSlider();\n categoriesMobile();\n asideLeftMobile();\n scrollRevealInit();\n seoSpoiler();\n mobileMenuOverflowScroll();\n}", "function Scan_elementsExtraJS() {\n // screen (Scan) extra code\n\n }", "function initializePage() {\n //Get the URI decoded URLs.\n hostweburl =\n decodeURIComponent(\n getQueryStringParameter(\"SPHostUrl\")\n );\n appweburl =\n decodeURIComponent(\n getQueryStringParameter(\"SPAppWebUrl\")\n );\n\n\n var scriptbase = hostweburl + \"/_layouts/15/\";\n $.getScript(scriptbase + \"SP.RequestExecutor.js\", getListsFromWeb);\n}", "function TipoServico_elementsExtraJS() {\n // screen (TipoServico) extra code\n\n }", "function JavascriptWriter() {\n}", "function scriptLoader()\n{\n addJavascript(\"phoneticMapper.js\", \"head\");\n addJavascript(\"vedatype.js\", \"head\");\n addJavascript(\"slp01.js\", \"head\"); \n}", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n // Call our main function\n main();\n }", "function initializePage() {\n\t/*$(\"#testjs\").click(function(e) {\n\t\t$('.jumbotron h1').text(\"Javascript is connected\");\n\t\t$(\"#testjs\").text(\"Thanks for clicking me!\");\n\t\t$(\".jumbotron p\").toggleClass(\"active\");\n\t});*/\n\n\t// Add any additional listeners here\n\t// example: $(\"#div-id\").click(functionToCall);\n\t$(\"#submitBtn\").click(addEvent);
\n\t$('#scheduleBtn').click(goBackToSchedule);\n}", "function iniciarJS() {\n Principal.index();\n}", "function loadScripts() {\r\n\t\t\t\twindow._sf_endpt = (new Date()).getTime();\r\n\t\t\t\tvar cbDomain = ((\"https:\"==document.location.protocol)?\"https://a248.e.akamai.net/chartbeat.download.akamai.com/102508/\":\"http://static.chartbeat.com/\");\r\n\t\t\t\tif(loadPubJS) {\r\n\t\t\t\t\t$.getScript(cbDomain+\"js/chartbeat_pub.js\");\r\n\t\t\t\t}\r\n\t\t\t\tif((loadVidJS) || (typeof StrategyInterface !== 'undefined' && (espn && espn.video))) {\r\n\t\t\t\t\t$.getScript(cbDomain+\"js/chartbeat_video.js\");\r\n\t\t\t\t}\r\n\t\t\t\t// load default chartbeat js others are disabled\r\n\t\t\t\tif(!loadVidJS && !loadPubJS) {\r\n\t\t\t\t\t$.getScript(cbDomain+\"js/chartbeat.js\");\r\n\t\t\t\t}\r\n\t\t\t}", "function initializePage() {\n\t/*$(\"#testjs\").click(function(e) {\n\t\t$('.jumbotron h1').text(\"Javascript is connected\");\n\t\t$(\"#testjs\").text(\"Thanks for clicking me!\");\n\t\t$(\".jumbotron p\").toggleClass(\"active\");\n\t});*/\n\n\t// Add any additional listeners here\n\t// example: $(\"#div-id\").click(functionToCall);\n\t//$(\"#submitBtn\").click(addEvent);
\n\t$('#submitBtn').click(addEvent);
\n\t$('#scheduleBtn').click(goBackToSchedule);\n}", "function FrontEnd(){\n}", "function initializePage() {\r\n\tconsole.log(\"Javascript connected!\");\r\n\t$(\".thumbnail\").click(graduateClick);\r\n}", "function scriptLoadHandler() {\n\t\t// Restore jQuery and window.jQuery to their previous values and store the\n\t\t// new jQuery in our local jQuery variable\n\t\tjQuery = window.jQuery.noConflict(true);\n\t\t$ = window.jQuery;\n\t\t// Call our main function\n\t\tmain(); \n\t}", "function enterDesktopJS() {\n window.console && console.log(\"desktop breakpoint active\");\n // Turn off mobile main nav button\n $(\".btn-menu\").off();\n\n // enable main nav menu \n $(\"ul.sf-menu\").superfish();\n\n /* Disable trigger and remove style from submenu */\n if ($(\".sub-navigation-block\").length) {\n var pulli = $('#pull-i');\n menui = $('ul.sub-navigation');\n $(pulli).off();\n if (menui.is(':hidden')) {\n menui.removeAttr('style');\n }\n }\n\n // switch owl slider mobile image to desktop\n $.each($(\"#hero #owl-single-carousel .owl-item img\"), function (e) {\n var desktopImage = $(this).attr(\"data-dt-src\");\n $(this).attr(\"src\", desktopImage);\n });\n }", "function main() {\n if(jQuery.browser.mobile) {\n var $target = jQuery('#survey-target');\n var targetHTML = $target.html();\n var pageurl = window.location.origin + window.location.pathname;\n var popurl = \"https://survey.usa.gov/surveys/291?\";\n popurl = popurl + \"stylesheet=https://www.usa.gov/sites/all/themes/usa/css/popup-survey.css&\";\n popurl = popurl + \"page_url=\" + pageurl;\n\n var aTag = \"<a href='\" + popurl + \"' target='_blank'>\" + targetHTML + \"</a>\";\n\n $target.html(aTag);\n\n } else {\n jQuery('#survey-target').hide();\n var cookieName = 'survey_invitation_291';\n var invitationInterval = 90;\n if(invitationInterval == 0 || readCookie(cookieName) == null) {\n var invite = false;\n invite = Math.random() < 2.0 / 100\n if(invite) {\n loadModal();\n if(invitationInterval > 0) {\n createCookie(cookieName, true, invitationInterval);\n }\n }\n }\n }\n }", "function main() {\n\n(function () {\n 'use strict';\n\n //Page Loader\n //<![CDATA[\n $(window).load(function() { // makes sure the whole site is loaded\n $('#status').fadeOut(); // will first fade out the loading animation\n $('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website.\n $('body').delay(350).css({'overflow':'visible'});\n });\n //]]>\n \n // Contact form toggle hide/show\n $(document).ready(function(){\n $(\"#show\").click(function(){\n $(\"#contact\").slideToggle(\"slow,swing\");\n });\n\n $('.mature').click(function(e){\n \n $('#myModal').attr('destination', String(e.target.hash));\n\n $('#myModal').modal('show');\n return false;\n });\n\n $('.continue').on('click', function() {\n $($('#myModal').attr('destination')).modal('show');\n });\n\n $('.quit').on('click', function() {\n \n });\n\n });\n\n // Wow animation\n new WOW().init();\n\n // Header/Vision carousel slider\n $('.carousel').carousel({\n interval: false\n });\n\n\n // jQuery for page scrolling feature - requires jQuery Easing plugin\n $(function() {\n $('a.page-scroll').bind('click', function(event) {\n var $anchor = $(this);\n $('html, body').stop().animate({\n scrollTop: $($anchor.attr('href')).offset().top - 70\n }, 900, 'easeInOutExpo');\n event.preventDefault();\n });\n });\n\n // Highlight the top nav as scrolling occurs\n $('body').scrollspy({\n target: '.navbar-fixed-top' ,\n offset: 75\n });\n\n\n \n\n}());\n\n}", "function executeScripts() {\r\n\r\n // Accessabiluty changes for SharePoint\r\n webAccessibility($);\r\n checkAccessability();\r\n\r\n // Web part tagging - adds web-part-name attribute and wp-[web part name] to ms-webpartzone-cell\r\n webPartZoneTagging($);\r\n\r\n // Add class for edit mode to HTML tag\r\n markEditMode();\r\n\r\n //Add parallax to a band\r\n $('.rowBand').spParallax({\r\n callBack: null\t\t\t\t\t// Add additional functions to exicute after parallax is run.\r\n });\r\n $('#s4-workspace').stellar({\r\n horizontalScrolling: false, \t// Set scrolling to be in either one or both directions\r\n verticalScrolling: true, \t\t// Set scrolling to be in either one or both directions\r\n horizontalOffset: 0, \t\t\t// Set the global alignment offsets\r\n verticalOffset: 40, \t\t\t// Set the global alignment offsets\r\n responsive: false, \t\t\t\t// Refreshes parallax content on window load and resize\r\n scrollProperty: 'scroll', \t\t// Select which property is used to calculate scroll. Choose 'scroll', 'position', 'margin' or 'transform'.\r\n positionProperty: 'position' \t// Select which property is used to position elements. Choose between 'position' or 'transform'\r\n });\r\n\r\n // Social Media\r\n cdphSocialMedia();\r\n\r\n // EDIT MODE: Run scripts for edit mode\r\n if ($('.ms-SPZoneLabel, .edit-mode-panel, .ewiki-margin').length) {\r\n\r\n // Give web parts a drop down for width, to help with responsive design\r\n responsiveWebPartWidthSelectionEditMode($, {\r\n webPartName: 'Page Content,Content Editor'\t\t\t\t// List out the names of the web parts that should have this added. Coma delimited.\r\n });\r\n\r\n // Make web part tool pane fixed in view\r\n webPartToolPanePlacement($, {\r\n webPartHighlight: '#f2f5a9',\t\t// Color to highlight the web part selected.\r\n webPartContent: '#ffffff',\t\t\t// Color to highlight the content of the web part.\r\n positionLeftRight: 'right',\t\t\t// Position the tool pane either left or right.\r\n distanceLeftRight: '20px',\t\t\t// Distance from the left or right.\r\n distanceTop: '164px',\t\t\t\t// Distance from the top.\r\n heightMax: '500px',\t\t\t\t\t// Height of the tool pane as it will need to scroll.\r\n sideBar: '260px',\t\t\t\t\t// Width to give the area where the tool pane goes.\r\n webPartZIndex: 3000\t\t\t\t\t// Index to ensure the tool pane is above the page.\r\n });\r\n\r\n // Return to web part zone when adding, deleting or returning after saving\r\n webPartZoneJumpTo($);\r\n\r\n // Remove class from web part zone\r\n $('#MSOZone .ms-webpart-cell-horizontal:first-child')\r\n .removeClass('ms-webpart-cell-horizontal')\r\n .addClass('horizontal-webpart-zone');\r\n\r\n // DISPLAY MODE: Run scripts for display mode\r\n } else {\r\n\r\n // Adjusts the coloring of the row bands\r\n $('.rowBand').bandAdjustments({\r\n pageMode: '', //Indicate what mode this should executed in, view or edit. Leave blank for view and add edit for edit mode. Default: ''\r\n contentLength: 0, // Number of characters or less to hide band Default: 0\r\n webPartLength: 0, // Number of web parts or less to hide band Default: 0\r\n imageLength: 0, // Number of images or less to hide band Default: 0\r\n googleMapLength: 0, // Number of google maps or less to hide band Default: 0\r\n parallaxLength: 0 // Number of parallax web parts or less to hide band Default: 0\r\n });\r\n\r\n // Changes the horizontal web parts to be responsive\r\n responsiveWebPartZoneHorizontal($, {\r\n webPartBreakPoint: 'lg' // Bootstrap breakpoint - xs, sm, md, lg\r\n });\r\n\r\n }\r\n\r\n}", "function bindJavascript() {\n\tpjs = Processing.getInstanceById('devarcs');\n\tif(pjs!=null) {\n\t\tpjs.bindJavascript(this);\n\t\tbound = true; }\n\t\tif(!bound) setTimeout(bindJavascript, 250);\n}", "function addJavaScript(){\r\n\tvar customScript = document.createElement(\"script\");\r\n\t\r\n\tcustomScript.type = \"text/javascript\";\r\n\t\r\n\thtmlCode = \"var places = new Array();\\n\";\r\n\t\r\n\tfor (var i = 0; i < places.length; i++){ \r\n\t\thtmlCode += 'places[' + i + '] = [\"' + places[i][0] + '\",\"' + places[i][1] + '\",\"' + places[i][2] + '\",\"' + places[i][3] + '\"];\\n';\r\n\t} \r\n\t\r\n\thtmlCode += \"\\n\\nfunction fillInputs(va,nr){\\n\";\r\n\thtmlCode += \"var vaStr;\\n\";\r\n\thtmlCode += \"var mode = places[nr][1];\\n\";\r\n\thtmlCode += \"\\tif (va=='v'){\\n\";\r\n\thtmlCode += \"\\t\\tvaStr = 'vertrek'\\n\";\r\n\thtmlCode += \"\\t} else {\\n\";\r\n\thtmlCode += \"\\t\\tvaStr = 'aankomst'\\n\";\r\n\thtmlCode += \"\\t};\\n\\n\";\r\n\thtmlCode += \"\\tdocument.getElementById('form1:' + vaStr + 'GemeenteInput').value=places[nr][2];\\n\";\r\n\thtmlCode += \"\\tdocument.getElementById('form1:' + vaStr + 'HalteInput').value=places[nr][3];\\n \";\r\n\thtmlCode += \"}\\n\";\r\n\r\n\tcustomScript.innerHTML = htmlCode;\r\n\t\r\n\telement = document.getElementsByTagName(\"body\")[0];\r\n\telement.appendChild(customScript, element);\r\n\r\n\tvar rp = document.body.getElementsByClassName(\"routeplanner\");\r\n\trp.item(0).id = \"rp_vertrek\";\r\n}", "function applyMultiJs () {\n /* Main script loaded on base.html. Here only function is\n called */\n $('#id_client_id').multi({\n \"search_placeholder\":\n \"Search... (if there are no clients, hit CTRL+R to manually refresh the page)\",\n });\n}", "function itemPage_elementsExtraJS() {\n // screen (itemPage) extra code\n /* menuItemList */\n listView = $(\"#itemPage_menuItemList\");\n theme = listView.attr(\"data-theme\");\n if (typeof theme !== 'undefined') {\n var themeClass = \"ui-btn-up-\" + theme;\n listItem = $(\"#itemPage_menuItemList .ui-li-static\");\n $.each(listItem, function(index, value) {\n $(this).addClass(themeClass);\n });\n }\n /* menuItem */\n }", "function defineAppCode() {\r\n var strCode=\"\";\r\n if (document.location.hostname.length === 0) {\r\n strCode += '<link rel=\"stylesheet\" href=\"datepicker/datepicker.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"static_files/assets/css/bootstrap-multiselect.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"tablesorter/css/theme.blue.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"static_files/assets/validator/bootstrapValidator.min.css\">'; \r\n strCode += '<link rel=\"stylesheet\" href=\"css/safe.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"css/beaches.css\">';\r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/validator/bootstrapValidator.min.js\"></script>'; \r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/multiselect/bootstrap-multiselect.js\"></script>'; \r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/datepicker/bootstrap-datepicker.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"static_files/assets/datepicker/moment-with-locales.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/placeholders/placeholders.min.js\"></script>';\r\n\r\n } else { \r\n strCode += '<link rel=\"stylesheet\" href=\"/datepicker/datepicker.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/assets/multiselect/bootstrap-multiselect.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/tablesorter/css/theme.blue.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/assets/validator/bootstrapValidator.min.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/WebApps/Health/safe/css/safe.css\">';\r\n strCode += '<link rel=\"stylesheet\" href=\"/static_files/WebApps/Health/SwimSafe/css/beaches.css\">';\r\n strCode += '<script type=\"text/javascript\" src=\"/static_files/assets/validator/bootstrapValidator.min.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/static_files/assets/multiselect/bootstrap-multiselect.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/datepicker/bootstrap-datepicker.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/static_files/assets/datepicker/moment-with-locales.js\"></script>';\r\n strCode += '<script type=\"text/javascript\" src=\"/placeholders/placeholders.min.js\"></script>';\r\n }\r\n return strCode;\r\n\r\n}", "function scriptLoadHandler() {\n\t\t // Restore $ and window.jQuery to their previous values and store the\n\t\t // new jQuery in our local jQuery variable\n\t\t jQuery = window.jQuery.noConflict(true);\n\t\t // Call our main function\n\t\t main(); \n\t\t}", "function CollectJS_Hider() {\n\tCollectJS_Hider_called = true;\n\t$('.sidebar, .mix, .navi, .catalogsorter').hide();\n\t$('.catalog .prods').css('marginLeft','0px');\n}", "function initializePage() {\n\tconsole.log(\"Javascript connected!\");\n\t$(\".searchButton\").click(function(e) {\n \n\n \n \n });\n}", "function scriptLoadHandler()\n {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n\n // Call widgets init function\n init(); \n }", "function theme_script(){\n\n}", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n $ = jQuery;\n // Call our main function\n main();\n }", "function UploadAd_elementsExtraJS() {\n // screen (UploadAd) extra code\n\n /* mobileselectmenu_breed */\n\n $(\"#UploadAd_mobileselectmenu_breed\").parent().find(\"a.ui-btn\").attr(\"tabindex\", \"6\");\n\n /* mobileselectmenu_gender */\n\n $(\"#UploadAd_mobileselectmenu_gender\").parent().find(\"a.ui-btn\").attr(\"tabindex\", \"7\");\n\n /* mobiletoggle_known */\n\n $(\"#UploadAd_mobiletoggle_known\").parent().find(\".ui-flipswitch-on\").attr(\"tabindex\", \"8\");\n\n /* mobileselectmenu_age */\n\n $(\"#UploadAd_mobileselectmenu_age\").parent().find(\"a.ui-btn\").attr(\"tabindex\", \"10\");\n\n /* mobileselectmenu_contry */\n\n $(\"#UploadAd_mobileselectmenu_contry\").parent().find(\"a.ui-btn\").attr(\"tabindex\", \"13\");\n\n /* mobileselectmenu_city */\n\n $(\"#UploadAd_mobileselectmenu_city\").parent().find(\"a.ui-btn\").attr(\"tabindex\", \"15\");\n\n }", "function setup() {\n console.log(\"I have linked Javascript!\");\n $(\"#intake\").click(handleRespones);\n $('#signup').click(signUp);\n}", "function readyFunctionCalls() {\n\n\tclickToChatCall();\n\tsetUpTypeHead();\n\tjQuery(\".s7LazyLoad\").unveil();\n\tjQuery(\"input[placeholder]\").placeholder();\n\t\n\t $('#e_footercol8 a').attr('target', '_blank');\n}", "function Account_elementsExtraJS() {\n // screen (Account) extra code\n /* mobilecollapsblock_14_25_26 */\n $(\"#Account_mobilecollapsblock_14_25_26 .ui-collapsible-heading-toggle\").attr(\"tabindex\", \"1\");\n /* mobilecollapsblock_34_45_59_60 */\n $(\"#Account_mobilecollapsblock_34_45_59_60 .ui-collapsible-heading-toggle\").attr(\"tabindex\", \"4\");\n /* mobilecollapsblock_34_45_72_73 */\n $(\"#Account_mobilecollapsblock_34_45_72_73 .ui-collapsible-heading-toggle\").attr(\"tabindex\", \"4\");\n /* mobilecollapsblock_34_45_85_86 */\n $(\"#Account_mobilecollapsblock_34_45_85_86 .ui-collapsible-heading-toggle\").attr(\"tabindex\", \"4\");\n /* mobilecollapsblock_34_45_111_112 */\n $(\"#Account_mobilecollapsblock_34_45_111_112 .ui-collapsible-heading-toggle\").attr(\"tabindex\", \"4\");\n }", "function scriptLoadHandler() {\n\t\tjQuery = window.jQuery.noConflict(true);\n\t\tmain();\n\t}", "function scriptLoadHandler() {\n\t\tjQuery = window.jQuery.noConflict(true);\n\t\tmain();\n\t}", "function main() {\n $(function() {\n // When document has loaded we attach FastClick to\n // eliminate the 300 ms delay on click events.\n FastClick.attach(document.body)\n\n // Event listener for Back button.\n $('.app-back').on('click', function() {\n history.back()\n })\n })\n\n // Event handler called when Cordova plugins have loaded.\n document.addEventListener(\n 'deviceready',\n onDeviceReady,\n false)\n window.onbeforeunload = function(e) {\n rfduinoble.close();\n };\n google.charts.load('current', {\n 'packages': ['corechart', 'controls', 'charteditor']\n });\n //google.setOnLoadCallback(drawChart);\n // google.setOnLoadCallback(function() {\n // genSampleData(generateSamples)\n // });\n }", "function updateScript() {\n\tjsonData[\"language\"] = document.getElementById(\"language\").value;\n\tjsonData[\"minimum required accuracy\"] = document.getElementById(\"minimum-required-accuracy\").value;\n\tjsonData[\"length constant\"] = document.getElementById(\"length-constant\").value;\n\tglobalModal.style.display = \"none\";\n\tsendUpdateJSONRequest();\n}", "function vB_AJAX_QuickEditor_Events()\n{\n}", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n // Call our main function\n main();\n }", "function scriptLoadHandler() {\n // Restore $ and window.jQuery to their previous values and store the\n // new jQuery in our local jQuery variable\n jQuery = window.jQuery.noConflict(true);\n // Call our main function\n main();\n }", "function runScript(){\n\tregisterTab();\t\n\tcurrentQueuePoll();\n\tregisterMsgListener();\n\tinsertAddToQueueOptionOnVideos();\n\tinsertQTubeMastHead();\n\tload(false);\n}", "function main() {\n // Specify jQuery UI easing method\n jQuery.easing.def = 'easeInOutQuad';\n\n // Google+ DOM check\n var $gbar = $(_ID_GBAR);\n var mappingKey = '';\n if ($gbar.length)\n mappingKey = $gbar.parent().attr('class');\n if (! $gbar.length || (' ' + mappingKey + ' ').indexOf(' ' + C_GBAR + ' ') < 0) {\n error(\"Google+ has changed is layout again (DOM CSS), breaking G+me. Please report the problem to http://huyz.us/gpme-release/ and I will fix it right away.\");\n getAppDetailsFromBackground(function(theAppDetails) {\n appDetails = theAppDetails;\n injectNews(mappingKey);\n });\n }\n\n // Listen for when there's a total AJAX refresh of the stream,\n // on a regular page\n var $contentPane = $(_ID_CONTENT_PANE);\n if ($contentPane.length) {\n var contentPane = $contentPane.get(0);\n $contentPane.bind('DOMNodeInserted', function(e) {\n // This happens when a new stream is selected\n if (e.relatedNode.parentNode == contentPane) {\n // We're only interested in the insertion of entire content pane\n onContentPaneUpdated(e);\n return;\n }\n\n var id = e.target.id;\n // ':' is weak optimization attempt for comment editing\n if (id && id.charAt(0) == ':')\n return;\n\n // This happens when posts' menus get inserted.\n // Also Usability Boost's star\n //debug(\"DOMNodeInserted: id=\" + id + \" className=\" + e.target.className);\n if (e.target.className == C_MENU || e.target.className == CF_MENU || e.target.className == C_UBOOST_STAR)\n onItemDivInserted(e);\n // This happens when a new post is added, either through \"More\"\n // or a new recent post.\n // Or it's a Start G+ post\n else if (id && (id.substring(0,7) == 'update-'))\n onItemInserted(e);\n else if (settings.nav_compatSgp && id.substring(0,9) == ID_SGP_POST_PREFIX )\n onSgpItemInserted(e);\n // This happens when switching from About page to Posts page\n // on profile\n else if (e.relatedNode.id.indexOf('-posts-page') > 0)\n onContentPaneUpdated(e);\n });\n } else {\n // This can happen if we're in the settings page for example\n warn(\"main: Can't find content pane\");\n }\n\n // Listen when status change\n // WARNING: DOMSubtreeModified is deprecated and degrades performance:\n // https://developer.mozilla.org/en/Extensions/Performance_best_practices_in_extensions\n var $status = $(_ID_STATUS_FG);\n if ($status.length)\n $status.bind('DOMSubtreeModified', onStatusUpdated);\n else\n // Sometimes this happens with G+ for some reason. Happened at times when I was\n // reloading a profile page.\n debug(\"main: Can't find status node; badges won't work.\");\n\n // Listen to incoming messages from background page\n chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {\n if (request.action == \"gpmeTabUpdateComplete\") {\n // Handle G+'s history state pushing when user clicks on different streams (and back)\n onTabUpdated();\n } else if (request.action == \"gpmeModeOptionUpdated\") {\n // Handle options changes\n onModeOptionUpdated(request.mode);\n } else if (request.action == \"gpmeResetAll\") {\n onResetAll();\n } else if (request.action == \"gpmeBrowserActionClick\") {\n onBrowserActionClick();\n }\n });\n\n // Listen for scrolling events\n //$(window).scroll($.throttle(500, 50, function(e) { onScroll(e); }));\n\n //injectNewFeedbackLink();\n\n // The initial update\n if (isEnabledOnThisPage()) {\n updateAllItems();\n\n // Listen to keyboard shortcuts\n $(window).keydown(onKeydown);\n\n // Set up a lscache cleanup in 5 minutes, keeping 30 days of history\n setTimeout(function() { lscache.removeOld(30 * 24 * 60, LS_HISTORY_); }, 5 * 60000);\n }\n}", "onOpen () {\n // Inject any client scripts\n this.clientScripts.forEach(script => {\n this.page.injectJs(script)\n })\n }", "function initialPages($) {\n\t\t$('.select2').select2();\n\t\tdisabledInput();\n\t\tentityHandler();\n\t\texpiryDateRange('#expiry');\n\t\textendEXpiryDatePicker('#extend_expiry');\n\t\tclickConfirmExtend();\n\t\tclickConfirmTerminate();\n\t\tclickConfirmChangeStatus();\n\t\tclickConfirmChangeGroup();\n\t\tclickConfirmChangePassword();\n\t\tclickConfirmResetPassword();\n\t\tclickModalCloseBtnDone();\n\t}", "function pageDocReady () {\n\n}", "function injectScript() {\n /* globals _jm, _jp */\n\n function updateMedia() {\n var manager, media, sound;\n\n manager = _jp.soundManager;\n media = _jm.song_info;\n sound = manager.sounds[manager.soundIDs[manager.soundIDs.length - 1]];\n\n document.getElementById(\"scroblr-artist\").value = media.artist || \"\";\n document.getElementById(\"scroblr-duration\").value = sound.duration || 0;\n document.getElementById(\"scroblr-elapsed\").value = sound.position || 0;\n document.getElementById(\"scroblr-title\").value = media.song || \"\";\n }\n\n window.setTimeout(function () {\n updateMedia();\n window.setInterval(updateMedia, 5000);\n }, 3000);\n}", "onReady() {}", "function initializePage() {\n\t// Google analytics events\n\t$(\".button-for-inventory\").click(updateLike);\n\n\t// confirmation for delete dialog box\n\t$('.button-for-delete').click(getConfirmation);\n\n\t$('.submit-item').submit(addItem);\n}", "function letsJQuery() {\r\n if (typeof $ == 'function') {\r\n // Your Script Code Here\r\n $('ul.ghnavsub li a').each( function() {\r\n $(this).attr('href', $(this).attr('href') + '&sort=p' );\r\n });\r\n }\r\n }", "function drupalgap_add_js() {\n try {\n var data;\n if (arguments[0]) { data = arguments[0]; }\n jQuery.ajax({\n async: false,\n type: 'GET',\n url: data,\n data: null,\n success: function() {\n if (drupalgap.settings.debug) {\n // Print the js path to the console.\n console.log(data);\n }\n },\n dataType: 'script',\n error: function(xhr, textStatus, errorThrown) {\n console.log(\n 'drupalgap_add_js - error - (' +\n data + ' : ' + textStatus +\n ') ' + errorThrown\n );\n }\n });\n }\n catch (error) {\n console.log('drupalgap_add_js - ' + error);\n }\n}", "function edgtfOnDocumentReady() {\n edgtfHeaderBehaviour();\n edgtfSideArea();\n edgtfSideAreaScroll();\n edgtfFullscreenMenu();\n edgtfInitMobileNavigation();\n edgtfMobileHeaderBehavior();\n edgtfSetDropDownMenuPosition();\n edgtfDropDownMenu(); \n edgtfSearch();\n }", "function documentReadyFunction() {\n onPageLoadOrResize();\n onPageLoad();\n }" ]
[ "0.6575352", "0.6517644", "0.65152514", "0.6373595", "0.6358351", "0.6320792", "0.6314898", "0.6306569", "0.6277005", "0.62477666", "0.62450266", "0.61967206", "0.6184761", "0.61219585", "0.61182165", "0.6116716", "0.6095176", "0.609028", "0.6088533", "0.60817116", "0.6077426", "0.6072832", "0.60679084", "0.6056652", "0.604882", "0.6046385", "0.6030381", "0.6026724", "0.6022375", "0.59696084", "0.5963135", "0.58821845", "0.5878296", "0.58690643", "0.58690643", "0.5863653", "0.5863653", "0.58410525", "0.58409756", "0.5831409", "0.58261716", "0.58227926", "0.5814346", "0.57966614", "0.5794536", "0.57920265", "0.57920265", "0.57649255", "0.5764138", "0.57502586", "0.57429695", "0.5739696", "0.5736289", "0.5734491", "0.57165617", "0.5714692", "0.5710364", "0.57001543", "0.57000816", "0.56995547", "0.5698867", "0.56982905", "0.56904554", "0.56870717", "0.5681737", "0.56798387", "0.5678339", "0.5673848", "0.5669552", "0.5668916", "0.5664523", "0.56511956", "0.5645692", "0.56448203", "0.5631595", "0.56275994", "0.5624842", "0.5619081", "0.56147695", "0.5611285", "0.56106144", "0.56086427", "0.5607821", "0.5607821", "0.5602625", "0.55986655", "0.5592989", "0.5580811", "0.5580811", "0.5577765", "0.556927", "0.55690414", "0.5566557", "0.55570036", "0.55555886", "0.5549214", "0.55424607", "0.5540359", "0.55392474", "0.5529286", "0.55288917" ]
0.0
-1
lodash (Custom Build) < Build: `lodash modularize exports="npm" o ./` Copyright jQuery Foundation and other contributors < Released under MIT license < Based on Underscore.js 1.8.3 < Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
function Unescape(text) { var INFINITY = 1 / 0; var symbolTag = '[object Symbol]'; var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g; var reHasEscapedHtml = RegExp(reEscapedHtml.source); var htmlUnescapes = { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&#39;': "'", '&#96;': '`' }; var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global; var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self; var root = freeGlobal || freeSelf || Function('return this')(); var unescapeHtmlChar = basePropertyOf(htmlUnescapes); var objectProto = Object.prototype; var objectToString = objectProto.toString; var _Symbol = root.Symbol; var symbolProto = _Symbol ? _Symbol.prototype : undefined; var symbolToString = symbolProto ? symbolProto.toString : undefined; function basePropertyOf(object) { return function (key) { return object == null ? undefined : object[key]; }; } function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = value + ''; return result == '0' && 1 / value == -INFINITY ? '-0' : result; } function isObjectLike(value) { return !!value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object'; } function isSymbol(value) { return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag; } function toString(value) { return value == null ? '' : baseToString(value); } function unescape(string) { string = toString(string); return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } return unescape(text); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function baseLodash() {}", "function baseLodash() {}", "function baseLodash() {}", "function baseLodash() {}", "function baseLodash() {}", "function baseLodash(){}", "function baseLodash(){}// No operation performed.", "function baseLodash(){}// No operation performed.", "function baseLodash(){}// No operation performed.", "function baseLodash(){}// No operation performed.", "function baseLodash(){}// No operation performed.", "function baseLodash(){}// No operation performed.", "function baseLodash(){}// No operation performed.", "function baseLodash(){}// No operation performed.", "function baseLodash() {// No operation performed.\n}", "function baseLodash() {// No operation performed.\n}", "function baseLodash() {\n }", "function baseLodash() {// No operation performed.\n }", "function baseLodash(){// No operation performed.\n}", "function baseLodash(){// No operation performed.\n}", "function baseLodash(){\n// No operation performed.\n}", "function baseLodash(){\n// No operation performed.\n}", "function baseLodash(){} // No operation performed.", "function baseLodash(){} // No operation performed.", "function baseLodash() {// No operation performed.\n }", "function baseLodash() {\n // No operation performed.\n}", "function _() { }", "function _() { }", "function _() { }", "function _() { }", "function _() { }", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n}", "function _() { undefined; }", "function baseLodash$3() {\n // No operation performed.\n}", "function baseLodash() {\n // No operation performed.\n }", "function baseLodash() {\n // No operation performed.\n }", "function baseLodash() {\n // No operation performed.\n }", "function baseLodash() {\n\t // No operation performed.\n\t }", "function baseLodash() {\n\t // No operation performed.\n\t }" ]
[ "0.6757005", "0.6757005", "0.6757005", "0.6757005", "0.6757005", "0.6663067", "0.658102", "0.658102", "0.658102", "0.658102", "0.658102", "0.658102", "0.658102", "0.658102", "0.651845", "0.651845", "0.63910526", "0.629258", "0.62772447", "0.62772447", "0.6260932", "0.6260932", "0.6259685", "0.6259685", "0.60420203", "0.59820884", "0.59163177", "0.59163177", "0.59163177", "0.59163177", "0.59163177", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5852257", "0.5709207", "0.56140107", "0.5589277", "0.5589277", "0.5589277", "0.5570987", "0.5570987" ]
0.0
-1
youtube thumbnail (base) quality = empty or : 0, 1, 2, 3, low0, low1, low2, low3, medium0, medium1, medium2, medium3, high0, high1, high2, high3, max0, max1, max2, max3
function get_youtube_thumbnail(url, quality) { if (url) { var video_id, thumbnail, result; result = url.match( /(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/user\/\S+|\/ytscreeningroom\?v=))([\w\-]{10,12})\b/ ); video_id = result[1]; if (video_id) { let quality_key = YTQuality[quality]; if (quality_key == undefined || quality_key == "") { quality_key = "sddefault"; } var thumbnail = "https://img.youtube.com/vi/" + video_id + "/" + quality_key + ".jpg"; return thumbnail; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set quality(value) {}", "get quality() {}", "function getQuality(quality)\n{\n\tquality=decodeURIComponent(quality);\n\tif(quality.toLowerCase()==\"small\")\n\t\treturn \"240p\";\n\tif(quality.toLowerCase()==\"medium\")\n\t\treturn \"360p\";\n\tif(quality.toLowerCase()==\"large\")\n\t\treturn \"480p\";\n\tif(quality.toLowerCase()==\"hd720\")\n\t\treturn \"720p\";\n\tif(quality.toLowerCase()==\"hd1080\")\n\t\treturn \"1080p\";\n}", "static getYoutubeThumb(videoId, size) {\n if (videoId.startsWith(\"http\")) {\n let regExp = /^.*(youtu\\.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=)([^#\\&\\?]*).*/;\n let match = videoId.match(regExp);\n if (match && match[2].length === 11) {\n videoId = match[2];\n }\n else {\n console.log(\"======== ERROR: can not get videoId from: \", videoId);\n }\n }\n if (videoId === null) {\n return \"http://img.youtube.com/vi/noimagefound/default.jpg\";\n }\n size = (size == undefined) ? 'big' : size;\n if (size === 'small') {\n return \"http://img.youtube.com/vi/\" + videoId + \"/default.jpg\";\n }\n return 'http://img.youtube.com/vi/' + videoId + '/0.jpg';\n }", "function a(e){var t=e.file,n=e.thumbnailMaxWidth,r=e.thumbnailMaxHeight,a=e.enableThumbnails;return t.type&&t.type.startsWith(\"image\")?(t=t instanceof Blob?t:new Blob([t]),new s.default(function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=n,r.src=URL.createObjectURL(t)}).then(function(e){var o=(0,c.default)(e,\"height\",\"width\");if(!a)return[null,o,null];var s=i(o,n,r),u=document.createElement(\"canvas\");u.width=s.width,u.height=s.height;var d=u.getContext(\"2d\");(0,l.orient)({orientation:t&&t.image?t.image.orientation:\"\",img:e,x:0,y:0,width:s.width,height:s.height,ctx:d},t);for(var p=u.toDataURL(\"image/png\").split(\",\"),f=atob(p[1]),h=new ArrayBuffer(f.length),m=new DataView(h),v=0;v<f.length;v++)m.setUint8(v,f.charCodeAt(v));return[h,o,s]})):s.default.resolve()}", "function findThumbs(n) {\n\t\t\tif (n > 4 && n <= 8) {\n\t\t\t\treturn 320;\n\t\t\t}\n\t\t\telse if (n > 8) {\n\t\t\t\treturn 640;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}", "determineThumbnail() {\n if (this.props.book.imageLinks && this.props.book.imageLinks.smallThumbnail) {\n return `${this.props.book.imageLinks.smallThumbnail}`;\n } else {\n return `${process.env.PUBLIC_URL + '/images/missing-thumbnail.PNG'}`;\n }\n }", "function getQuality()\r\n {\r\n return quality;\r\n }", "function thumbnail(object) {\nreturn $(\"<div>\")\n .addClass(\"thumb\")\n .css(\"background-image\", \"url(\" + object.webImage.url.replace(\"s0\", \"s128\") +\")\");\n}", "function getImageThumbnail(index_to_get) {\n if((imgur_list.length > 0) && (index_to_get < imgur_list.length)) {\n console.log(\"Getting Image: \" + imgur_list[index_to_get].link);\n var image_url = imgur_list[index_to_get].link;\t// The Full Size Image\n\n var n = image_url.lastIndexOf(\".\");\n var ext = image_url.slice(n).toUpperCase();\n //ext=\".PNG\";\n console.log(\"Extension = '\"+ext+\"'\");\n\n var get_thumbnail = true;\n if(get_thumbnail) {\n // The Medium Thumbnail (320x320 or close to)\n // Also, thumbnails on imgur are always jpg\n image_url = image_url.slice(0, n) + \"m.jpg\";\n console.log(\"Getting Thumbnail: \" + image_url);\n getJpegImage(image_url);\n } else {\n switch (ext) {\n case \".PNG\":\n getPngImage(image_url);\n break;\n case \".JPG\":\n case \".JPEG\":\n getJpegImage(image_url);\n }\n }\n } else {\n console.log(\"Index bigger than array!\");\n }\n}", "function onPlayerReadyHigh(event) {\n\tevent.target.setPlaybackQuality('hd1080');\n}", "function setQuality(\r\n quality_)\r\n {\r\n quality = quality_;\r\n }", "function loadThumbnail(id){\n return '<img class=\"youtube-thumb\" src=\"//i.ytimg.com/vi/' + id + '/hqdefault.jpg\"><div class=\"play-button\"></div>';\n }", "function setThumbnail(args) {\n let slider = page.getViewById(\"thumbnailSlider\");\n thumbnail = viewModel.get(\"sliderValue\");\n let thumbnailVideo = page.getViewById(\"thumbnailVideo\");\n thumbnailVideo.seekToTime(thumbnail);\n}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "is_thumbnail_safe() {\n return true\n }", "function setQuality(quality) {\n spriteLoader.switchQuality(quality)\n .then(()=>{\n // We call this outside of spriteLoader as not all games will use reels, but all should be using CustomSprites\n Reel.redraw();\n });\n}", "getVideoThumbnail(video, w, h, out) {\n nativeTools.getVideoThumbnail(video, w, h, out);\n }", "static GetImageScale(width, height, base)\n {\n if(width > height)\n {\n return [Math.round((width * base) / height), base]\n }\n else\n {\n return [base, Math.round((height * base) / width)]\n }\n }", "setThumbnail(thumbnailURL, useThumbnail) {\n if (useThumbnail) {\n this.loadThumbnail(thumbnailURL, (texture) => {\n this.useThumbnail = useThumbnail;\n this.thumbnailURL = thumbnailURL;\n const thumbnail = this.generateThumbnail(texture);\n this.setThumbnailSprite(thumbnail);\n });\n }\n }", "function decodeQuality(value) {\n assert(typeof value === \"string\");\n return coretypes_1.quality.decode(value).toString();\n}", "function decodeQuality(value) {\n assert(typeof value === \"string\");\n return coretypes_1.quality.decode(value).toString();\n}", "function getThumbnailURL(d){\n if (d.video_id > 0){\n return \"/uploads/\" + d.video_id + \"/thumbnails/\" + d.extracted_frame_number + \".jpg\";\n } else {\n return \"/uploads/refresh_to_load.jpg\";\n }\n }", "function onLowResImageSuccess(e){\n\t// Swap the thumbnail image with the low one\n\t$.media.image = e.data;\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 createResizedImages( resize_url ) {\n\n resize_url = resize_url.replace(/^http:\\/\\//i, 'https://');\n\n return {\n type: 'zoho',\n has_low_quality_versions: true,\n src: resize_url,\n high: resize_url + '=s1920-rj-l85',\n med: resize_url + '=s1200-rj-l85',\n low: resize_url + '=s768-rj-l85'\n };\n\n}", "constructor (storage) {\n this.cache = settings.thumbnails.cache;\n this.sizes = settings.thumbnails.sizes;\n this.storage = storage;\n\n if (this.cache) {\n logging.verbose('Thumbnail cache enabled');\n } else {\n logging.verbose('Thumbnail cache disabled');\n }\n }", "function test_missing_thumb() {\n\n}", "function getThumbnail(videoId) {\n let thumbnail = \"i3.ytimg.com/vi/\" + videoId + \"/hqdefault.jpg\";\n return thumbnail;\n}", "function getThumbnail(book) {\n let thumbnailUrl = book.volumeInfo && book.volumeInfo.imageLinks && book.volumeInfo.imageLinks.smallThumbnail;\n return thumbnailUrl ? thumbnailUrl.replace(/^http:\\/\\//i, 'https://') : '';\n }", "goodPhotoThumbnail(goodId, imageIndex) {\n return `http://${helpers.base}/images/goods/thumbnail/pht_${goodId}_${imageIndex}.jpg`;\n }", "placeholderArtwork(url) {\n if(!url) return \"http://placehold.it/100x100\";\n\n // const regx = /(-large)/;\n // const str = url.replace(regx, \"-crop\");\n\n return url;\n }", "function onPlayerReadyMAD(event) { \n madness.setPlaybackQuality('hd720'); \n}", "function Thumbnail(mediumThumbnailDiv) {\r\n\t\r\n\t// --- Attribute\r\n\t\r\n\tvar element = mediumThumbnailDiv;\r\n\t\r\n\t// --- Funktionen\r\n\t\r\n\tthis.getTitle = function () {\r\n\t\treturn element.childNodes[5].innerHTML;\r\n\t}\r\n\tthis.getUserName = function () {\r\n\t\treturn element.childNodes[1].innerHTML;\r\n\t}\r\n\tthis.getUserURL = function () {\r\n\t\treturn element.childNodes[1].href;\r\n\t}\r\n\tthis.getUserLinkClass = function () {\r\n\t\treturn element.childNodes[1].className;\r\n\t}\r\n\tthis.getImageURL = function () {\r\n\t\treturn element.childNodes[3].childNodes[0].href;\r\n\t}\r\n\tthis.getMediumImagePath = function () {\r\n\t\treturn element.childNodes[3].childNodes[0].childNodes[0].src;\r\n\t}\r\n\tthis.getBigImagePath = function () {\r\n\t\treturn str_replace(\"2.j\",\"3.j\",this.getMediumImagePath());\r\n\t}\r\n\tthis.getSmallImagePath = function () {\r\n\t\treturn str_replace(\"2.j\",\"1.j\",this.getMediumImagePath());\r\n\t}\r\n\t\r\n} // ENDE: Thumbnail", "function mapQualityClassName(qual) {\r\n\tswitch (qual) {\r\n\t\tcase 'veryhigh': return (\"vhigh\");\r\n\t\tcase 'medium': return (\"med\");\r\n\t\tcase 'verylow': return (\"vlow\");\r\n\t\tdefault: return (qual);\r\n\t}\r\n\treturn (\"unknown\");\r\n}", "function generateThumbnail() {\n c = document.createElement(\"canvas\");\n c.width = width;\n c.height = height;\n c.style.width = width;\n c.style.height = height;\n ctx = c.getContext(\"2d\");\n ctx.canvas.width = width;\n ctx.canvas.height = height;\n ctx.drawImage(video, 0, 0, width, height);\n var pixel = ctx.getImageData(x, y, 1, 1);\n var newx = video.currentTime; // or i for frame #?\n var newy = pixel.data[0] + pixel.data[1] + pixel.data[2];\n if (newy > 0) Plotly.extendTraces('plot', { x: [[newx]], y: [[newy]] }, [0])\n}", "function scaleThumb() {\n\n\tjQuery('#thumbBig').remove();\n\n\tvar src\t= jQuery(this).attr('src');\n\n\t\t// dimensions of thumbnail\n\tvar w\t= parseInt(jQuery(this).width());\n\tvar h\t= parseInt(jQuery(this).height());\n\n\t\t// real dimensions of image\n\tvar nw\t= jQuery(this).context.naturalWidth;\n\tvar nh\t= jQuery(this).context.naturalHeight;\n\n\t\t// position of thumbnail\n\tvar x\t= Math.floor(jQuery(this).offset().left);\n\tvar y\t= Math.floor(jQuery(this).offset().top);\n\n\tvar big = jQuery('<img src=\"'+src+'\" width=\"'+w+'\" height=\"'+h+'\" id=\"thumbBig\" style=\"position:absolute; top:'+y+'px; left:'+x+'px;z-index:1000;\" />');\n\tjQuery('body').append(big);\n\n\tjQuery('#thumbBig')\n\t\t.animate({'width':nw+'px','height':nh+'px'},400)\n\t\t.bind('mouseleave',function(){jQuery(this).remove();});\n}", "function mapQuality(qualClassName) {\r\n\tswitch (qualClassName) {\r\n\t\tcase 'very high': return (8);\r\n\t\tcase 'high': return (7);\r\n\t\tcase 'med': return (6);\r\n\t\tcase 'low': return (5);\r\n\t\tcase 'very low': return (4);\r\n\t\tcase 'corrupted': return (3);\r\n\t\tcase 'eyecancer': return (2);\r\n\t\tcase 'unknown': return (1);\r\n\t\t}\r\n\treturn (1);\r\n}", "function getResolution(width, height, resolution, qualities) {\n var result = {\n width: 0, height: 0,\n bitrate: [], fps: 30\n }\n let res;\n switch (resolution) {\n case '144p':\n res = xY(width, height, 256);\n result.width = res.width;\n result.height = res.height;\n qualities.map(x => {\n if (x == 'low') {\n result.bitrate.push({\n value: 80,\n type: x\n });\n } else if (x == 'medium') {\n result.bitrate.push({\n value: 90,\n type: x\n });\n } else if (x == 'high') {\n result.bitrate.push({\n value: 100,\n type: x\n });\n }\n });\n break;\n case '240p':\n res = xY(width, height, 426);\n result.width = res.width;\n result.height = res.height;\n qualities.map(x => {\n if (x == 'low') {\n result.bitrate.push({\n value: 300,\n type: x\n });\n } else if (x == 'medium') {\n result.bitrate.push({\n value: 400,\n type: x\n });\n } else if (x == 'high') {\n result.bitrate.push({\n value: 700,\n type: x\n });\n }\n });\n break;\n case '360p':\n res = xY(width, height, 640);\n result.width = res.width;\n result.height = res.height;\n qualities.map(x => {\n if (x == 'low') {\n result.bitrate.push({\n value: 400,\n type: x\n });\n } else if (x == 'medium') {\n result.bitrate.push({\n value: 750,\n type: x\n });\n } else if (x == 'high') {\n result.bitrate.push({\n value: 1000,\n type: x\n });\n }\n });\n break;\n case '480p':\n res = xY(width, height, 854);\n result.width = res.width;\n result.height = res.height;\n qualities.map(x => {\n if (x == 'low') {\n result.bitrate.push({\n value: 500,\n type: x\n });\n } else if (x == 'medium') {\n result.bitrate.push({\n value: 1000,\n type: x\n });\n } else if (x == 'high') {\n result.bitrate.push({\n value: 2000,\n type: x\n });\n }\n });\n break;\n case '720p':\n res = xY(width, height, 1280);\n result.width = res.width;\n result.height = res.height;\n qualities.map(x => {\n if (x == 'low') {\n result.bitrate.push({\n value: 1500,\n type: x\n });\n } else if (x == 'medium') {\n result.bitrate.push({\n value: 2500,\n type: x\n });\n } else if (x == 'high') {\n result.bitrate.push({\n value: 4000,\n type: x\n });\n }\n });\n break;\n case '1080p':\n res = xY(width, height, 1920);\n result.width = res.width;\n result.height = res.height;\n qualities.map(x => {\n if (x == 'low') {\n result.bitrate.push({\n value: 3000,\n type: x\n });\n } else if (x == 'medium') {\n result.bitrate.push({\n value: 4500,\n type: x\n });\n } else if (x == 'high') {\n result.bitrate.push({\n value: 6000,\n type: x\n });\n }\n });\n break;\n }\n return result;\n}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality$1(spec) {\n return spec.q > 0;\n}", "function isQuality$1(spec) {\n return spec.q > 0;\n}", "function isQuality$2(spec) {\n return spec.q > 0;\n}", "function isQuality$2(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}" ]
[ "0.6840879", "0.6385369", "0.6355864", "0.629729", "0.61170053", "0.59873223", "0.5962237", "0.5956563", "0.5861067", "0.5855809", "0.5819462", "0.5806379", "0.5793285", "0.5788339", "0.573508", "0.573508", "0.573508", "0.573508", "0.5729142", "0.5709786", "0.5707149", "0.5693848", "0.5667745", "0.5660508", "0.5660508", "0.56585926", "0.5647379", "0.56374216", "0.5571199", "0.5570602", "0.5569727", "0.5565504", "0.55607206", "0.55438817", "0.5502647", "0.5497306", "0.54704416", "0.54691815", "0.54625124", "0.5455834", "0.54502773", "0.5438313", "0.5433167", "0.5433167", "0.5433167", "0.5433167", "0.5432102", "0.5432102", "0.5429608", "0.5429608", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684", "0.5418684" ]
0.69274455
0
It is adapted from
function openInfo(evt, tabName) { // Get all elements with class="tabcontent" and hide them tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } // Get all elements with class="tablinks" and remove the class "active" tablinks = document.getElementsByClassName("tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } // Show the current tab, and add an "active" class to the button that opened the tab document.getElementById(tabName).style.display = "block"; evt.currentTarget.className += " active"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "static private internal function m121() {}", "transient final protected internal function m174() {}", "static private protected internal function m118() {}", "static final private internal function m106() {}", "transient final private internal function m170() {}", "static transient final private internal function m43() {}", "static transient private protected internal function m55() {}", "static transient final protected internal function m47() {}", "transient private protected public internal function m181() {}", "__previnit(){}", "transient final private protected internal function m167() {}", "static transient private internal function m58() {}", "static transient final private protected internal function m40() {}", "static protected internal function m125() {}", "obtain(){}", "static transient final protected public internal function m46() {}", "static private protected public internal function m117() {}", "static transient private protected public internal function m54() {}", "transient private public function m183() {}", "function _____SHARED_functions_____(){}", "static final private protected internal function m103() {}", "function Transform$7() {}", "static transient final protected function m44() {}", "static final protected internal function m110() {}", "function AeUtil() {}", "function DWRUtil() { }", "static transient private public function m56() {}", "static private public function m119() {}", "transient final private protected public internal function m166() {}", "function comportement (){\n\t }", "function Utils() {}", "function Utils() {}", "static transient final private protected public internal function m39() {}", "static final private protected public internal function m102() {}", "static final private public function m104() {}", "transient final private public function m168() {}", "function Scdr() {\r\n}", "function o0(stdlib,o1,buffer) {\n try {\nthis.o559 = this.o560;\n}catch(e){}\n var o2 = o254 = [].fround;\n //views\n var charCodeAt =new Map.prototype.keys.call(buffer);\n\n function o4(){\n var o5 = 0.5\n var o35 = { writable: false, value: 1, configurable: false, enumerable: false };\n try {\no849 = o6;\n}catch(e){}\n try {\nreturn +(o0[o1])\n}catch(e){}\n }\n try {\nreturn o4;\n}catch(e){}\n}", "constructor (){}", "function Utils(){}", "function _construct()\n\t\t{;\n\t\t}", "function oi(a){this.Of=a;this.rg=\"\"}", "function Hx(a){return a&&a.ic?a.Mb():a}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "static transient final private protected public function m38() {}", "static transient final private public function m41() {}", "function wR(a,b){this.Fb=[];this.HF=a;this.YE=b||null;this.Pq=this.un=!1;this.ai=void 0;this.Gz=this.AK=this.ez=!1;this.uu=0;this.cb=null;this.az=0}", "get Alpha7() {}", "function miFuncion (){}", "function zd(){this.$b=void 0;this.group=y.i.Sj;this.Kb=y.i.Kb}", "function Adaptor() {}", "setFromXML(boneel) {\nvar bname, brot, btrans, c, pel, rel, xyz, xyzw;\n//---------\nbtrans = null;\nbrot = null;\nbname = boneel.getAttribute(\"name\");\npel = (boneel.getElementsByTagName(\"position\")).item(0);\nrel = (boneel.getElementsByTagName(\"qRotation\")).item(0);\nif (pel) {\nxyz = [\"x\", \"y\", \"z\"];\nbtrans = (function() {\nvar j, len, results;\nresults = [];\nfor (j = 0, len = xyz.length; j < len; j++) {\nc = xyz[j];\nresults.push(Number(pel.getAttribute(c)));\n}\nreturn results;\n})();\n}\nif (rel) {\nxyzw = [\"x\", \"y\", \"z\", \"w\"];\nbrot = (function() {\nvar j, len, results;\nresults = [];\nfor (j = 0, len = xyzw.length; j < len; j++) {\nc = xyzw[j];\nresults.push(Number(rel.getAttribute(c)));\n}\nreturn results;\n})();\n}\nreturn this.setFromStr(bname, brot, btrans);\n}", "static transient protected internal function m62() {}", "function SeleneseMapper() {\n}", "static transform() {}", "function GraFlicUtil(paramz){\n\t\n}", "function FunctionUtils() {}", "function Yielder() {}", "constructor () {\r\n\t\t\r\n\t}" ]
[ "0.6570817", "0.6472148", "0.63644534", "0.5997303", "0.59065104", "0.5903378", "0.5870434", "0.5775662", "0.5651806", "0.56272703", "0.55912364", "0.5484369", "0.54809904", "0.5395695", "0.5394636", "0.5382078", "0.5350636", "0.532121", "0.5320071", "0.5274764", "0.5261436", "0.52371234", "0.52341956", "0.5198914", "0.5094428", "0.50901955", "0.5024837", "0.49944296", "0.49635184", "0.49574387", "0.49384883", "0.49371463", "0.49334258", "0.49320465", "0.49260676", "0.49258876", "0.49204746", "0.49204746", "0.49021262", "0.48881447", "0.48616445", "0.4790601", "0.47777545", "0.4754283", "0.47498935", "0.47363728", "0.4724862", "0.4722218", "0.47142735", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.4711431", "0.47088227", "0.470362", "0.47001293", "0.46963683", "0.46868002", "0.46854824", "0.46774736", "0.46708575", "0.46601906", "0.4653428", "0.4651016", "0.46498454", "0.46487418", "0.4648434", "0.4638957" ]
0.0
-1
generate a checkbox list from a list of products it makes each product name as the label for the checkbos
function populateListProductChoices(slct1, slct2) { var s1 = document.getElementsByName(slct1); var s2 = document.getElementById(slct2); var chosenPrefs = []; for (i = 0; i < s1.length; i ++) { if (s1[i].checked) { chosenPrefs.push(s1[i].value); } } // s2 represents the <div> in the Products tab, which shows the product list, so we first set it empty s2.innerHTML = ""; // obtain a reduced list of products based on restrictions var optionArray = restrictListProducts(products, chosenPrefs); for (let i = 0; i < optionArray.length; i++) { var productName = optionArray[i].name; var productPrice = optionArray[i].price; // create the checkbox and add in HTML DOM var checkbox = document.createElement("input"); checkbox.type = "checkbox"; checkbox.name = "product"; checkbox.value = productName; s2.appendChild(checkbox); // create a label for the checkbox, and also add in HTML DOM var label = document.createElement('label') label.htmlFor = productName; label.appendChild(document.createTextNode(productName + " $" + productPrice)); s2.appendChild(label); // create a breakline node and add in HTML DOM s2.appendChild(document.createElement("br")); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function populateListProductChoices(slct1, slct2) {\n var s1 = document.getElementById(slct1);\n\n var s2 = document.getElementById(slct2);\n\t\n\t// s2 represents the <div> in the Products tab, which shows the product list, so we first set it empty\n s2.innerHTML = \"\";\n\t\t\n\t// obtain a reduced list of products based on restrictions\n var optionArray = restrictListProducts(products, s1.value);\n\n\t// for each item in the array, create a checkbox element, each containing information such as:\n\t// <input type=\"checkbox\" name=\"product\" value=\"Bread\">\n\t// <label for=\"Bread\">Bread/label><br>\n\t\t\n\tfor (i = 0; i < optionArray.length; i++) {\n\t\t\t\n\t\tvar productName = optionArray[i];\n\t\t// create the checkbox and add in HTML DOM\n\t\tvar checkbox = document.createElement(\"input\");\n\t\tcheckbox.type = \"checkbox\";\n\t\tcheckbox.name = \"product\";\n\t\tcheckbox.value = productName;\n\t\t\n\t\t\n\t\ts2.appendChild(checkbox);\n\t\t\n\t\t// create a label for the checkbox, and also add in HTML DOM\n\t\tvar label = document.createElement('label')\n\t\tlabel.htmlFor = productName;\n\t\tlabel.appendChild(document.createTextNode(productName));\n\t\ts2.appendChild(label);\n\t\t\n\t\t// create a breakline node and add in HTML DOM\n\t\ts2.appendChild(document.createElement(\"br\")); \n\t}\n}", "function populateListProductChoices(slct1, slct2) {\r\n var s1 = document.getElementById(slct1);\r\n var s2 = document.getElementById(slct2);\r\n\r\n\t// s2 represents the <div> in the Products tab, which shows the product list, so we first set it empty\r\n\t// check if s2 is empty or not\r\n\t// s2 represents the <div> in the Products tab, which shows the product list, so we first set it empty\r\n\t// check if s2 is empty or not\r\n\r\n\tif (document.getElementsByName(\"product\").length == 0){\r\n\t\ts2.innerHTML = \"\";\r\n\t// obtain a reduced list of products based on restrictions\r\n\tvar optionArray = restrictListProducts(products, s1.value);\r\n\t} else {\r\n\t// obtain a reduced list of products based on restrictions\r\n\tvar ele = document.getElementsByName(\"product\");\r\n\tvar toRestrict = [];\r\n\r\n\tfor (i = 0; i < ele.length; i++) {\r\n\t\t\ttoRestrict.push(ele[i].id);\r\n\t}\r\n\tvar newOptionArray = getProducts(toRestrict);\r\n\r\n\ts2.innerHTML = \"\";\r\n\tvar optionArray = restrictListProducts(newOptionArray, s1.value);\r\n\t}\r\n\r\n\t// for each item in the array, create a checkbox element, each containing information such as:\r\n\t// <input type=\"checkbox\" name=\"product\" value=\"Bread\">\r\n\t// <label for=\"Bread\">Bread/label><br>\r\n\tvar count = document.createElement(\"p\");\r\n\tcount.id= \"ProductCount\";\r\n\tcount.appendChild(document.createTextNode(optionArray.length + \" Products\"));\r\n\ts2.appendChild(count);\r\n\r\n\tfor (i = 0; i < optionArray.length; i++) {\r\n\r\n\t\tvar productName = optionArray[i].name;\r\n\t\tvar productPrice = optionArray[i].price;\r\n\t\tvar productImg = optionArray[i].image;\r\n\t\t// create the checkbox and add in HTML DOM\r\n\t\tvar container = document.createElement(\"div\");\r\n\t\tcontainer.id=\"Container\";\r\n\t\tcontainer.className=\"container\";\r\n\r\n\t\tvar elem = document.createElement(\"img\");\r\n\t\telem.id = productName;\r\n\t\telem.src = productImg;\r\n\t\telem.setAttribute(\"height\",\"150\");\r\n\t\telem.setAttribute(\"width\", \"150\");\r\n\t\telem.setAttribute(\"alt\", productName);\r\n\t\tcontainer.append(elem);\r\n\r\n\t\t// create a label for the checkbox, and also add in HTML DOM\r\n\t\tvar info = document.createElement(\"div\");\r\n\t\tinfo.class = \"displayInfo\";\r\n\t\tvar label = document.createElement('label')\r\n\t\tlabel.htmlFor = productName;\r\n\t\tlabel.appendChild(document.createTextNode(productName));\r\n\t\tlabel.appendChild(document.createElement(\"br\"));\r\n\t\tlabel.appendChild(document.createTextNode(\"$\"+productPrice));\r\n\t\tinfo.appendChild(label);\r\n\t\tcontainer.appendChild(info);\r\n\r\n\t\tvar button = document.createElement(\"button\");\r\n\t\tbutton.innerHTML =\"ADD TO CART\";\r\n\t\tbutton.className = \"block\";\r\n\t\tbutton.id = productName;\r\n\t\tbutton.name=\"product\";\r\n\t\tbutton.type = \"button\";\r\n\t\tbutton.value = String(productPrice);\r\n\t\tbutton.onclick = function(){\r\n\t\t\taddItem(this.id, this.value);\r\n\t\t};\r\n\t\tcontainer.appendChild(button);\r\n\t\t// create a breakline node and add in HTML DOM\r\n\t\ts2.appendChild(container);\r\n\t}\r\n}", "function generateFieldCheckBoxList() {\r\n\t\tlet div_start = '<div class=\"form-check form-check-inline\">';\r\n\t\tlet div_end = '</div>';\r\n\t\tlet html = '';\r\n\t\tgetFieldRefList().forEach(function(field) {\r\n\t\t\tlet input = '<input class=\"form-check-input\" type=\"checkbox\" value=\"'+field.code+'\" name=\"fields\" id=\"id_'+field.code+'\" '+(field.checked?'checked':'')+'>';\r\n\t\t\tlet label = '<label class=\"form-check-label\" for=\"id_'+field.code+'\">'+ field.libelle +'</label>';\r\n\t\t\thtml += div_start + input + label + div_end;\r\n\t\t});\r\n\t\t$('#fieldList').html(html);\r\n\t}", "function displayCheckboxes() {\n $('#checkbox').text('');\n\n for (let i = 0; i < ingredientsArray.length; i++) {\n let pContainer = $(\"<p class=label>\");\n let labelContainer = $(\"<label class=option>\");\n let inputContainer = $(\"<input type=checkbox>\");\n let spanContainer = $('<span>');\n\n pContainer.addClass('col s2')\n inputContainer.addClass('filled-in checked=\"unchecked\"');\n spanContainer.text(ingredientsArray[i]);\n inputContainer.attr('value', ingredientsArray[i]);\n\n $('#checkbox').append(pContainer);\n pContainer.append(labelContainer);\n labelContainer.append(inputContainer);\n labelContainer.append(spanContainer);\n\n }\n}", "function populateListProductChoices(slct2) {\n\tvar s2 = document.getElementById(slct2)\n\n\t// s2 represents the <div> in the Products tab, which shows the product list, so we first set it empty\n\ts2.innerHTML = ''\n\n\t// obtain a reduced list of products based on restrictions\n\tvar optionArray = filterProducts()\n\n\t// for each item in the array, create a checkbox element, each containing information such as:\n\t// <input type=\"checkbox\" name=\"product\" value=\"Bread\">\n\t// <label for=\"Bread\">Bread/label><br>\n\n\tfor (i = 0; i < optionArray.length; i++) {\n\t\tvar productCategory = optionArray[i]\n\n\t\t// If the product category has no products, we don't want to include it\n\t\tif (productCategory.products.length === 0) {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar button = document.createElement('button')\n\t\tbutton.className = 'accordion'\n\t\tbutton.appendChild(document.createTextNode(productCategory.name))\n\t\tbutton.addEventListener('click', function () {\n\t\t\tthis.classList.toggle('active')\n\n\t\t\tvar panel = this.nextElementSibling\n\t\t\tif (panel.style.display === 'block') {\n\t\t\t\tpanel.style.display = 'none'\n\t\t\t} else {\n\t\t\t\tpanel.style.display = 'block'\n\t\t\t}\n\t\t})\n\t\ts2.appendChild(button)\n\n\t\tvar div = document.createElement('div')\n\t\tdiv.className = 'panel'\n\n\t\tproductCategory.products.forEach((p) => {\n\t\t\tvar productDiv = document.createElement('div')\n\t\t\tproductDiv.className = 'productDiv'\n\n\t\t\tvar image = document.createElement('img')\n\t\t\timage.src = 'images/' + p.name + '.JPG'\n\t\t\tdiv.appendChild(image)\n\n\t\t\tvar label = document.createElement('label')\n\t\t\tlabel.htmlFor = p.name\n\t\t\tlabel.id = p.name\n\t\t\tlabel.className = 'productName'\n\t\t\tlabel.appendChild(document.createTextNode(p.name))\n\t\t\tproductDiv.appendChild(label)\n\n\t\t\tproductDiv.appendChild(document.createElement('br'))\n\n\t\t\tvar price = document.createElement('label')\n\t\t\tprice.htmlFor = p.price\n\t\t\tprice.className = 'productPrice'\n\t\t\tprice.appendChild(document.createTextNode('$' + p.price))\n\t\t\tproductDiv.appendChild(price)\n\n\t\t\tproductDiv.appendChild(document.createElement('br'))\n\n\t\t\tvar addToCart = document.createElement('button')\n\t\t\taddToCart.className = 'block'\n\t\t\taddToCart.type = 'button'\n\t\t\taddToCart.id = 'addCart'\n\t\t\taddToCart.appendChild(document.createTextNode('Add to cart'))\n\t\t\taddToCart.addEventListener('click', function () {\n\t\t\t\tif (!cart.includes(p)) {\n\t\t\t\t\tcart.push(p)\n\t\t\t\t\tproductDiv.appendChild(document.createElement('br'))\n\t\t\t\t\tvar success = document.createElement('label')\n\t\t\t\t\tsuccess.appendChild(\n\t\t\t\t\t\tdocument.createTextNode(\n\t\t\t\t\t\t\t'Success, ' + p.name + ' has been added to your cart.'\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t\tproductDiv.appendChild(success)\n\t\t\t\t}\n\t\t\t})\n\t\t\tproductDiv.appendChild(addToCart)\n\n\t\t\tdiv.appendChild(productDiv)\n\n\t\t\tdiv.appendChild(document.createElement('br'))\n\t\t})\n\t\ts2.appendChild(div)\n\t}\n}", "function populateListProductChoices(slct1, slct2) {\n\t\n\tvar s1 = document.getElementById(slct1);\n var s2 = document.getElementById(slct2);\n\t\n\tvar productsFillters = document.getElementsByName(\"restriction\");\n\tvar chosenFillters = [];\n\t\n\t\n\t\tfor (i = 0; i < productsFillters.length; i++) { \n\t\t\tif (productsFillters[i].checked) {\n\t\t\t\tchosenFillters.push(productsFillters[i].value);\n\t\t\t}\n\t\t}\n\t\n\tvar sortedProducts = products.sort(sortByPrice);\n\t var optionArray = restrictListProducts(products, chosenFillters);\n\t\n\t\n\t// s2 represents the <div> in the Products tab, which shows the product list, so we first set it empty\n s2.innerHTML = \"\";\n\t\t\n\t// obtain a reduced list of products based on restrictions\n \n\n\t// for each item in the array, create a checkbox element, each containing information such as:\n\t// <input type=\"checkbox\" name=\"product\" value=\"Bread\">\n\t// <label for=\"Bread\">Bread/label><br>\n\t\t\n\tfor (i = 0; i < optionArray.length; i++) {\n\t\t\t\n\t\tvar productName = optionArray[i].name;\n\t\tvar productPrice = optionArray[i].price.toFixed(2);\n\t\t// create the checkbox and add in HTML DOM\n\t\tvar checkbox = document.createElement(\"input\");\n\t\tcheckbox.type = \"checkbox\";\n\t\tcheckbox.name = \"product\";\n\t\tcheckbox.value = productName;\n\t\ts2.appendChild(checkbox);\n\t\t\n\t\t// create a label for the checkbox, and also add in HTML DOM\n\t\tvar label = document.createElement('label')\n\t\tlabel.htmlFor = productName.name;\n\t\tlabel.appendChild(document.createTextNode(productName));\n\t\tlabel.appendChild(document.createElement('br'));\n\t\tlabel.appendChild(document.createTextNode(\" Price: $\" + productPrice));\n\t\tlabel.appendChild(document.createElement('br'));\n\t\ts2.appendChild(label);\n\t\t\n\t\t// create a breakline node and add in HTML DOM\n\t\ts2.appendChild(document.createElement(\"br\")); \n\t}\n}", "function loadCustomCheckbox() {\n const items = document.getElementById(\"items-checkbox\");\n for (let i = 0; i < beverages.length; i++) {\n const b = beverages[i];\n const element = `\n <div class=\"ck-button\">\n <label class=\"ck-button-checked\">\n <input id=\"cb${i + 1}\" type=\"checkbox\" value=\"${b.Name}\" onclick=\"onClickCheckbox(${i})\">\n <span>${b.Name} Rp. ${b.Price}</span>\n </label>\n </div>\n `;\n\n items.innerHTML += element;\n }\n}", "function displayCheckBoxList(listItemArray) {\n var html =\"\";\n\n listItemArray.forEach(function(listItem){\n html += \"<li><input type='checkbox' name='userList' id='\" + listItem.itemId + \"' checked='checked'><label class='form-check-label' for='\" + listItem.itemId + \"'>\" + listItem.itemName + \"</label></li>\";\n });\n $(\"#listModal output\").append(html);\n}", "function addItems(type, vals){\n var myModel = document.getElementById(type);\n var nameLabel = document.createElement('label');\n nameLabel.innerHTML = \"<b>\"+ type +\"</b><br />\";\n myModel.appendChild(nameLabel);\n \n for(var x=0; x<vals.length; x++){\n var makeLabel = document.createElement('label');\n makeLabel.innerHTML = vals[x];\n var makeCb = document.createElement(\"input\");\n makeCb.name = vals[x];\n makeCb.id = vals[x];\n makeCb.value = type;\n makeCb.type = \"checkbox\";\n myModel.appendChild(makeLabel);\n myModel.appendChild(makeCb);\n }\n myModel.innerHTML += \"<br /><br />\"; \n}", "function processProducts() {\n for (var i=0; i < 4; i++) {\n labels[i].innerHTML=products[i]; \n }\n}", "function listProducts() {\n for (var i=0; i < 5; i++) {\n labels[i].innerHTML=products[i]; \n }\n}", "function populatelist(listItems = [], itemsList) {\n itemsList.innerHTML = listItems.map((item, i) => {\n return `<li class=\"list-group-item\">\n <input type=\"checkbox\" data-index=${i} id=\"item${i}\" ${item.done ? 'checked' : ''} />\n <label for=\"item${i}\" class=\"strikey\">${item.text}</label>`;\n }).join('');\n\n }", "function personalizeProduct(lensOptions) {\n for(let i = 0; i < lensOptions.length; i++) {\n let inputWrapper = document.createElement('div');\n inputWrapper.classList.add('form-check', 'form-check-inline');\n\n let input = document.createElement('input');\n input.setAttribute(\"type\", \"radio\");\n input.setAttribute('id',lensOptions[i]);\n input.setAttribute('name', 'Lenses');\n input.setAttribute('value', lensOptions[i]);\n input.classList.add('form-check-input');\n \n let label = document.createElement('label');\n label.setAttribute('for', lensOptions[i]);\n label.classList.add('form-check-label', 'font-weight-bold');\n \n inputWrapper.append(input, label);\n\n productDetails.appendChild(inputWrapper);\n label.innerText = lensOptions[i];\n }\n}", "function cargarlistaproductos() {\n //posicionarlos dedbajo de la cabezera\n var tabla = document.getElementById('tbl_listaproductos')\n var contador = 0;\n listaproductos = cargarproductos(); //cargo el array\n listaproductos.forEach(producto => {\n contador++;\n var fila = tabla.insertRow(-1); //creo la fila\n var celda0 = fila.insercell(0); //inserto la celada0\n celda0.innerHTML = producto.nombre; //cargo el dato en la\n var celda1 = fila.insercell(1);\n celda1.innerHTML = producto.precio\n var celda2 = fila.insercell(2);\n celda2.innerHTML = 'inpuy type =\"text\"/>';\n var celda3 = fila.insercell(3);\n celda3.innerHTML = '<inpuy tag=\"' + contador + '\"type =\"checkbox onclick=\"javascrip\"/>';\n })\n return;\n}", "function helper_generateListItems(items) {\n\n notesItems = '', notesItems = ''; let checked = '', \n count = 0, allWords = [], chkboxIDs = [];\n \n for (let i=0; i<items.length; i++) {\n \n \n if (items[i][1] === true) { checked = ' checked '; }\n \n notesItems += `\n <LI><label id=\"label${(i+1)}\"><input type=\"checkbox\"\n class=\"chkbox\" id=\"item${(i+1)}\"${checked}/>\n ${items[i][0]}</label></LI>`;\n let id = `item${(i+1)}`;\n }\n \n // rerenders dashboard\n reRenderDashboard();\n \n \n // gets all checkboxes from items\n allWords = notesItems.split(' ');\n \n // 1. get checkboxes IDs\n for (let i=0;i<allWords.length;i++) {\n \n if (allWords[i].indexOf('\"item') !== -1) {\n \n chkboxIDs.push( allWords[i].substring(\n (allWords[i].indexOf('\"')+1),\n allWords[i].lastIndexOf('\"')\n ));\n allWords[i] = '';\n }\n }\n \n // 2. add event listeners to checkboxes\n for (let i=0;i<chkboxIDs.length;i++) {\n document.addEventListener('click', function(e) {\n \n if ((e.target) && \n (e.target.id === chkboxIDs[i])) {\n helper_checkboxChecked(chkboxIDs[i]);\n }\n });\n }\n }", "function populateList(plates=[], platesList) {\n platesList.innerHTML = plates.map((plate, i) => {\n return `\n <li>\n <input type=\"checkbox\" data-index=${i} id=\"item${i}\" ${plate.done ? 'checked': ''} />\n <label for=\"item${i}\">${plate.text}</label>\n </li>\n `\n }).join('')\n}", "function displayItems() {\n const html = items\n .map(\n (item) => `<li class=\"shopping-item\">\n <input value=\"${item.id}\" type=\"checkbox\" ${item.complete && 'checked'}>\n <span class=\"itemName\">${item.name}</span>\n <button aria-label=\"Remove ${item.name}\" value=\"${item.id}\">&times;</button>\n </li>`\n )\n .join('');\n // console.log(html);\n list.innerHTML = html;\n}", "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tvar checkBox1 = document.getElementById(\"lactoseF\");\n\tvar checkBox2 = document.getElementById(\"nutsF\");\n\tvar checkBox3 = document.getElementById(\"organique\");\n\tvar checkBox4 = document.getElementById(\"none\");\n\n\n\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\t/*if ((document.querySelector(\".organiqueCB\").checked)&&(document.querySelector(\".pasDeNoix\").checked) && (document.querySelector(\".lactoseFreeCB\").checked)&& (prods[i].all == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\n\t\t}*/\n\t\tif (checkBox1.checked==true && checkBox2.checked==true && checkBox3.checked==true && prods[i].all==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if(checkBox3.checked==true &&checkBox2.checked==true && prods[i].vegAndNut==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if (checkBox3.checked==true && checkBox1.checked==true && prods[i].vegAndGlu==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\n\t\telse if (checkBox1.checked==true && checkBox2.checked==true && prods[i].nutAndGlu==true){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if(checkBox1.checked==true && checkBox2.checked==false && checkBox3.checked==false && prods[i].glutenFree==true ){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\telse if(checkBox2.checked==true && checkBox1.checked==false && checkBox3.checked==false && prods[i].no_nuts==true){\n\t\t\tproduct_names.push(prods[i].name);\n\n\t\t}\n\t\telse if (checkBox3.checked==true && checkBox1.checked==false&&checkBox2.checked==false && prods[i].vegetarian==true){\n\t\t\tproduct_names.push(prods[i].name);\n\n\t\t\n\t\t}\n\t\telse if (checkBox4.checked==true){\n\t\t\t\n\t\t\tproduct_names.push(prods[i].name);\n\t\t\t\n\t\t\t\n\t\t}\n\t\t/*if (checkBox1.checked==false && checkBox2.checked==false && checkBox3.checked==false && (prods[i].vegetarian==true || prods[i].glutenFree==true || prods[i].no_nuts==true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\n\t\t/*else if ((document.querySelector(\".organiqueCB\").checked)&& (prods[i].vegetarian == true)){\n\n\t\t\tif ((document.querySelector(\".lactoseFreeCB\").checked) && (prods[i].glutenFree == true)){\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}\n\t\t\telse if ((restriction == \"pasDeNoix\")&& (prods[i].no_nuts == true)){\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}else{\n\t\t\tproduct_names.push(prods[i].name);}\n\t\t}\n\t\telse if ((document.querySelector(\".lactoseFreeCB\").checked) && (prods[i].glutenFree == true)){\n\t\t\tif ((restriction == \"pasDeNoix\")&& (prods[i].no_nuts == true)){\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}else{\n\t\t\t\tproduct_names.push(prods[i].name);\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t/*else if ((restriction == \"pasDeNoix\")&& (prods[i].no_nuts == true)){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}\n\t\t\n\t\telse if ((restriction == \"none\")){\n\t\t\tproduct_names.push(prods[i].name);\n\t\t}*/\n\t\t\n\t}\n\treturn product_names;\n}", "function createCheckbox(index) {\n var checkboxList = $(\"<ul>\");\n var item;\n var input = \"\";\n for (var i = 0; i < questions[index].checkboxChoices.length; i++) {\n item = $(\"<li>\");\n input =\n '<label><input class=\"with-gap\" type=\"checkbox\" name=\"answer\" value=' +\n i +\n \" /><span>\";\n input += questions[index].checkboxChoices[i];\n input += \"</span></label>\";\n item.append(input);\n checkboxList.append(item);\n }\n return checkboxList;\n }", "renderItems() {\n var style = {\n marginRight: '10px'\n }\n var lblStyle = {\n fontWeight: 'normal',\n marginLeft: '2px'\n }\n let props = this.props;\n return (\n lodash.map(\n this.data,\n (d, index) =>\n <div key={index} className={'check-btn ' + (props.iHorizontalDirection != null ? 'pull-left' : '')} style={style}>\n <div className=\"checkbox\">\n <label>\n <input type=\"checkbox\"\n id={props.inputProps.name + d[props.valueField]}\n name={props.inputProps.name} value={d[props.valueField]}\n onChange={this.changeInput} />\n <span className=\"checkbox-material\"></span>\n <span className=\"checkbox-material\"></span>\n <b>{d[props.textField]}</b>\n </label>\n </div>\n </div>\n )\n );\n }", "function createCuisineCheckBox(data) {\n //let cuisineArr = getCuisineType(data);\n let dropdownOption = document.querySelector(\".displayCuisine\");\n for (let i of data) {\n let newCheckBox = `\n <input type=\"radio\" class=\"cuisine\" name=\"cuisine\" value=\"${i}\"/>\n <label>${i}</label>\n <p>\n `;\n dropdownOption.innerHTML += newCheckBox;\n }\n}", "renderCheckIn(proj) {\n var hw = this.state.projects[proj].hardware;\n var hwString = [];\n var i;\n for(i=0; i<hw.length; i++) {\n hwString[i] = \"HW\" + hw[i];\n }\n\n return hwString.map((hw, index) => {\n\n return (\n <>\n <input type=\"checkbox\"></input>\n <label>{hw}</label>\n <br></br>\n </>\n )\n })\n }", "function setupOutput(listInput) {\n // <input type=\"checkbox\" id=\"broccoli\" /><span>Broccoli</span><br />\n let splitInput = !Array.isArray(listInput)\n ? listInput.split(\"\\n\")\n : listInput;\n\n let result = \"\";\n let counter = 0;\n splitInput.forEach((i) => {\n i = i.trim();\n if (i !== \"\") {\n itemMap[counter] = i.toLowerCase().trim();\n let item = getRandomAlt(i);\n item = item === null ? i : item;\n result +=\n \"<input type='checkbox' class='output_item' id='\" +\n item +\n \"' /><span>\" +\n item +\n \"</span><br />\";\n counter++;\n }\n });\n\n document.getElementById(\"output_title\").style.display = \"block\";\n document.getElementById(\"shuffle_btn\").style.display = \"inline-block\";\n document.getElementById(\"change_btn\").style.display = \"inline-block\";\n\n document.getElementById(\"output\").innerHTML = result;\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 translateCheckBoxList(code, transMgr)\n{\n\tvar translation = designerMgrTranslate(code, \"\", false, true);\n\tif (translation.useMacRendering)\n\t{\n\t\ttranslation.string = \"<table>\" +\n\t\t\t\t\t\"<tr><td width=50><input type=\\\"checkbox\\\">&nbsp;abc</td></tr>\" +\n\t\t\t\t\t\"<tr><td><input type=\\\"checkbox\\\"> abc</td></tr>\" +\n\t\t\t\t\t\"<tr><td><input type=\\\"checkbox\\\"> abc</td></tr>\" +\n\t\t\t\t\t\"</table>\";\n\t}\n\treturn makeAsIsTranslation(translation.string);\n}", "function renderTags() {\r\n\r\n //Criar o HTML (option) para todos os tags\r\n let strHtml = \"\"\r\n for (let i = 0; i < tags.length; i++) {\r\n strHtml += `<label class=\"form-check-label mr-3\">\r\n <input class=\"form-check-input\" type=\"checkbox\" name=\"\" id=\"\" value=\"${tags[i]._id}\"> ${tags[i]._name}</label><br>`\r\n }\r\n let selTags = document.getElementById(\"idSelTags\")\r\n selTags.innerHTML = strHtml\r\n\r\n}", "function showCheckBox(data) {\n \t// update checkboxes\n \tdojo.forEach(data, function(item){\n \t\t\t\t\titem.chkBoxUpdate = '<input type=\"checkbox\" align=\"center\" id=\"'+item.expdIdentifier+'\" onClick=\"getCheckedRows(this)\" />';\n \t\t\t\t\titem.chkBoxUpdate.id = item.expdIdentifier;\n \t\t\t\t});\n \t\n \t// Standard checkboxes\n \tdojo.forEach(data, function(item){\n \t\tif (item.includesStd == \"Y\"){\n \t\t\titem.chkBoxStd = '<input type=\"checkbox\" disabled align=\"center\" id=\"'+item.expdIdentifier+'cb'+'\" checked=\"checked\"/>';\n\t\t\t\t\t} else{\n\t\t\t\t\titem.chkBoxStd = '<input type=\"checkbox\" disabled align=\"center\" id=\"'+item.expdIdentifier+'cb'+'\"/>';\n\t\t\t\t\t}\n\t\t\t\t\titem.chkBoxStd.id = item.expdIdentifier + 'cb';\n\t\t\t\t});\n }", "function create() {\n\t\tfor (var i = 0; i < dragOptions.length; i++) {\n\n\t\t\toptions.forEach(function(item) {\n\t\t\t\tvar checkbox = document.createElement('input');\n\t\t\t\tvar label = document.createElement('label');\n\t\t\t\tvar span = document.createElement('span');\n\t\t\t\tcheckbox.setAttribute('type', 'checkbox');\n\t\t\t\tspan.innerHTML = item;\n\t\t\t\tlabel.appendChild(span);\n\t\t\t\tlabel.insertBefore(checkbox, label.firstChild);\n\t\t\t\tlabel.classList.add('drag-options-label');\n\t\t\t\tdragOptions[i].appendChild(label);\n\t\t\t});\n\n\t\t}\n\t}", "function restrictListProducts(prods) {\r\n\tlet product_names = [];\r\n\tprods.sort((a,b) => a.price - b.price);\r\n\tfor (let i=0; i<prods.length; i+=1) {\r\n\t\tif (!(((document.getElementById(\"lactoseFree\").checked==true) && (prods[i].lactoseFree == false)) ||\r\n\t\t((document.getElementById(\"nutFree\").checked==true) && (prods[i].nutFree == false)) ||\r\n\t\t((document.getElementById(\"organic\").checked==true) && (prods[i].organic == false)) ))\r\n\t\t{\r\n\t\t\tproduct_names.push(prods[i].name)\r\n\t\t}\r\n\t}\r\n\r\n\treturn product_names;\r\n}", "function UpdateBeerList_Edition_Form() {\n var htmlBeers = '';\n i=0;\n for (var myi in BeerName) {\n if (BeerName.hasOwnProperty(myi)) {\n var TempBeerName = BeerName[myi];\n var TempBeerNameLowercase = myi;\n TempLine = '<div class=\"checkbox\"><label for=\"checkboxes-'+i+'\"><input type=\"checkbox\" name=\"beer\" id=\"checkboxes-'+i+'\" value=\"'+TempBeerNameLowercase+'\">'+TempBeerName+'</label></div>';\n htmlBeers += TempLine;\n i++;\n }\n }\n document.getElementById('beerlist_fromlocalstorage').innerHTML = htmlBeers;\n}", "checkboxList(t, path, ts, args) {\n const name = path[path.length - 1];\n ts.klass.declarations.push(`@Input() ${name}: {_id: string, label:string}[]`);\n return `\n<bb-static label=\"${t.description}\">\n <div *ngFor=\"let row of ${name}\" style=\"position: relative; min-height: 2rem;\">\n <label class=\"custom-control ui-checkbox\">\n <input class=\"custom-control-input\" type=\"checkbox\" [checklist]=\"${path.join(\".\")}\" [value]=\"row._id\">\n <span class=\"custom-control-indicator\"></span>\n <span class=\"custom-control-description\">{{row.label}}</span>\n </label>\n </div>\n</bb-static>\n`;\n }", "function CheckBox() {\n return (\n <div\n css={css`\n display: innli;\n flex-direction: column;\n align-content: center;\n text-align: center;\n `}\n >\n <form class=\"checkList\">\n <ul style={{padding: 0}}>\n {checkboxList.list.map(checkbox => (\n <React.Fragment>\n <input value={checkbox.Cname} style={{margin: '1px', background: 'black', color: 'white'}} id=\"input\" type=\"button\" onClick={(e) => {\n //true or false value\n checkbox.value = !checkbox.value\n categoryName.splice(0, categoryName.length)\n categoryName.push(checkbox.Cname)\n categoryCTag = categoryName \n // console.log(checkboxList) //FOR DEBUGGING\n // console.log(\"checbklsit_: \", categoryName)//FOR DEBUGGING\n }}\n />\n {/* <label>{checkbox.Cname}</label> */}\n </React.Fragment>\n ))\n }\n <input value=\"Clear\" style={{margin: '1px', background: 'black', color: 'white'}} id=\"input\" type=\"button\" onClick={(e) => {\n categoryName = []\n categoryCTag = categoryName\n }}\n />\n </ul>\n </form>\n </div>\n )\n\n}", "function fillBehaviorCheckList ()\n {\n for (var i = 0; i < catLadyBehaviors.length; i++) {\n var description = catLadyBehaviors[i].description;\n var points = catLadyBehaviors[i].pointValue;\n var option = '<div class=\"checkbox\"><label><input type= \"checkbox\" class= \"behavior-checklist\"value=\"' + points +'\">'\n + description + '</label></div>';\n console.log(option);\n $('#checklist').append(option);\n }\n }", "function selectedItems(){\n\t\n\tvar ele = document.getElementsByName(\"product\");\n\tvar chosenProducts = [];\n\t\n\tvar c = document.getElementById('displayCart');\n\tc.innerHTML = \"\";\n\t\n\t// build list of selected item\n\tvar para = document.createElement(\"P\");\n\tpara.innerHTML = \"You selected : \";\n\tpara.appendChild(document.createElement(\"br\"));\n\tpara.appendChild(document.createElement(\"br\"));\n\tfor (let i = 0; i < ele.length; i++) { \n\t\tif (ele[i].checked) {\n\t\t\tpara.appendChild(document.createTextNode(ele[i].value));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tchosenProducts.push(ele[i].value);\n\t\t}\n\t}\n\t\t\n\t// add paragraph and total price\n\tc.appendChild(para);\n\tc.appendChild(document.createTextNode(\"Total Price is $\" + getTotalPrice(chosenProducts)));\n\t\t\n}", "createOptions() {\n const checkboxArray = [];\n searchLabels.map(item => checkboxArray.push(\n <Checkbox\n key={item}\n className=\"madeBoxes\"\n subKey={item}\n checked={item === this.state.selectedItem}\n handleCheck={e => this.handleOptionCheck(e, item)}\n label={item}\n />,\n ));\n return checkboxArray;\n }", "function addCheckbox(name, index, numberContainer) {\n var containerName = \"#genreContainer\" + numberContainer\n var container = $(containerName);\n\n $('<input />', { type: 'checkbox', id: 'genre'+index, value: name }).appendTo(container);\n $('<label />', { 'for': 'genre'+index, text: name }).appendTo(container);\n $('<br >').appendTo(container)\n}", "function populateSearchList(data){\n var countryNames = d3.map(data, function(d){return d.Country;}).keys();\n var countrySearchList = $(\"#countrySearchList\");\n\n for (var i=0; i<countryNames.length; i++){\n countrySearchList.append(`\n <input class=\"countryCheckbox\" type=\"checkbox\" name=\"${countryNames[i]}\" value=\"${countryNames[i]}\"><span>${countryNames[i]}<br></span>`);\n }\n}", "function showArray(ingredientsList) {\n\n\n\n //For loop that runs through the array corresponding with the food group.\n for (var i = 0; i < ingredientsList.length; i++) { \n \n // SCOTT: This creates our checkboxes, as clickable morphing things, for each item.\n var checkbox = $(\"<label>\");\n checkbox.attr(\"for\", ingredientsList[i]);\n var input = $(\"<input>\").attr(\"type\", \"checkbox\");\n input.addClass(\"checkBox\");\n input.attr(\"id\", ingredientsList[i].replace(\" \", \"-\"));\n input.attr(\"name\", ingredientsList[i].replace(\" \", \"-\"));\n //SEAN: checking to see if the ingredient is on the ingredients list, meaning it's already checked.\n var ingredientText = $(\"<span>\");\n ingredientText.text(ingredientsList[i]); // SCOTT: Setting the text equal to each item in the ingredientsList variable. The ingredientsList variable now contains the contents of the precise ingredient array that we want (which we defined at the time that the showArray function was run)\n\n if (selectedIngredients.indexOf(ingredientsList[i]) !== -1) {\n console.log(\"hello\");\n input.prop('checked', true);\n //need to check that the checkbox has already had it's state changed to \"checked\"\n } \n checkbox.append(input);\n checkbox.append(ingredientText); // SCOTT: Appending the text onto the checkbox.\n\n // SCOTT: Getting things to display vertically! This inserts both a Line Break, and the entire Checkbox+Text object we created, onto the webpage.\n // SCOTT: This repeats for each item in the array.\n $(\"#ingredientSection\").append(\"<br>\");\n $(\"#ingredientSection\").append(checkbox);\n\n\n\n }\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 ponerDatosCheckboxHtml(t,nodes){\n var checkboxContainer=document.getElementById('checkboxDiv');\n document.getElementById('tituloCheckbox').innerHTML = t;\n var result = nodes.iterateNext();\n i = 0;\n while (result) {\n \n var input = document.createElement(\"input\");\n var label = document.createElement(\"label\");\n label.innerHTML = result.innerHTML;\n label.setAttribute(\"for\", \"rp_\"+i);\n input.type=\"checkbox\";\n input.name=\"rp\";\n input.id=\"rp\"+i; \n checkboxContainer.appendChild(input);\n checkboxContainer.appendChild(label);\n checkboxContainer.appendChild(document.createElement('br'));\n result = nodes.iterateNext();\n } \n }", "function createCheckbox(london, nyc) {\n\n london.forEach(function(i){\n var checkbox = ('<span class=\"check\"><input type=\"checkbox\" name=\"'+ i.pro + '\" value=\"'+ i.pro + '\" onchange=\"whichCity(value)\">' + i.pro + '</span>')\n $(checkbox).prependTo($(\"#checks\"));\n \n });\n nyc.forEach(function(i){\n var checkbox = ('<span class=\"check\"><input type=\"checkbox\" name=\"'+ i.pro + '\" value=\"'+ i.pro + '\" onchange=\"whichCity(value)\">' + i.pro + '</span>')\n $(checkbox).prependTo($(\"#checks\"));\n \n });\n\n}", "function addCheckBox(variableList, variable) {\n var variableID = removeNonParsingChars(variable);\n \n data_names[variableID] = variable;\n\n var element = '<li>';\n element += '<input type=\"checkbox\" name=\"' + variableID\n + '\" id=\"variable\" >';\n element += '<span>' + variable + '</span>';\n element += '</li>';\n\n variableList.append(element);\n}", "function selectedItems(){\n\t\n\tvar ele = document.getElementsByName(\"product\");\n\tvar chosenProducts = [];\n\t\n\tvar c = document.getElementById('displayCart');\n\tc.innerHTML = \"\";\n\t\n\t// build list of selected item\n\tvar para = document.createElement(\"P\");\n\tpara.innerHTML = \"You selected: \";\n\tpara.appendChild(document.createElement(\"br\"));\n\tpara.appendChild(document.createElement(\"br\"));\n\tfor (i = 0; i < ele.length; i++) { \n\t\tif (ele[i].checked) {\n\t\t\tpara.appendChild(document.createTextNode(ele[i].value));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tchosenProducts.push(ele[i].value);\n\t\t}\n\t}\n\t\t\n\t// add paragraph and total price\n\tc.appendChild(para);\n\tc.appendChild(document.createTextNode(\"Total Price: $\" + getTotalPrice(chosenProducts).toFixed(2)));\n\t\t\n}", "function weightDisplay (arrOfProducts) {\n const htmlSegment = `<div class=\"product-box\" id = ${arrOfProducts[i].prodId}>\n <input type=\"checkbox\" name=\"book\" class = \"delete-checkbox\" id=\"delete-prod\">\n <h2>${arrOfProducts[i].prodSku} </h1>\n <h2>${arrOfProducts[i].prodName}</h2>\n <h2>${arrOfProducts[i].prodPrice} $</h2>\n <h2>Weight: ${arrOfProducts[i].propValue} KG</h2>\n \n</div>`\n i++\n\n return $('.book').slick('slickAdd', htmlSegment)\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 criarListaFiltros() {\n ingredientes.sort().forEach(function (valor, indice) {\n let itemLista = document.createElement('li');\n let checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.value = indice;\n itemLista.appendChild(checkbox);\n itemLista.innerHTML += valor;\n elementoListaFiltro.appendChild(itemLista);\n });\n}", "function updateNameList() {\n // remove old list elements, to make way for updated list\n const oldList = document.getElementsByClassName(\"namesOnList\");\n\n while (oldList.length != 0) {\n listOfNames.removeChild(oldList[0]);\n }\n\n // create updated list\n for (let i = 0; i < names.length; i++) {\n nameDiv = document.createElement(\"div\");\n nameDiv.setAttribute(\"class\", \"namesOnList\");\n listOfNames.appendChild(nameDiv);\n \n const cboxName = document.createElement(\"input\");\n cboxName.setAttribute(\"type\", \"checkbox\");\n cboxName.setAttribute(\"id\", \"cbox\" + i);\n cboxName.setAttribute(\"class\", \"checkboxesOnList\");\n nameDiv.appendChild(cboxName);\n\n const txtName = document.createElement(\"label\");\n txtName.setAttribute(\"for\", \"cbox\" + i);\n txtName.setAttribute(\"class\", \"labelsOnList\");\n txtName.innerText = names[i];\n nameDiv.appendChild(txtName);\n }\n \n // displays or hides the Remove Names button, \n // depending on whether names[] is empty or not\n if (names.length != 0) {\n removeButton.hidden = false;\n }\n else {\n removeButton.hidden = true;\n }\n}", "function setWishlist() {\n for (let i = 0; i < wishlist.length; i++) {\n // to see if the wish is met\n let checked = wishlist[i].done === true ? 'checked': '';\n $('#wishlist-inner').append(`<p class=\"wish-labels\">${wishlist[i].description}</p>`);\n }\n}", "function checkOrder(event){\n event.preventDefault();\n \n var checkBox = document.getElementsByName(\"donut\");\n var donuts = [];\n var list = \"\";\n var chosen = false;\n var cartList = document.getElementById(\"cart\");\n var totalCost = document.getElementById(\"cost\");\n var totalItems = 4;\n \n for(var i = 0; i < checkBox.length; i++){\n if(checkBox[i].checked){\n chosen = true;\n var item = document.getElementById(\"qnt_\"+i);\n donuts.push(checkBox[i].value);\n list += \"<li>\" + checkBox[i].value + \" \" + item.value + \" st</li>\";\n }\n }\n if(chosen){\n cartList.innerHTML = list; \n }else{\n cartList.innerHTML = \"Du måste välja minst en sort!\";\n totalCost.innerHTML = \"\";\n }\n}", "function groceryItem(value){\n \n const product=`<li>\n <span class=\"shopping-item\">${value}</span>\n <div class=\"shopping-item-controls\">\n <button class=\"shopping-item-toggle\">\n <span class=\"button-label\">check</span>\n </button>\n <button class=\"shopping-item-delete\">\n <span class=\"button-label\">delete</span>\n </button>\n </div>\n </li>`;\n\n \n $('.shopping-list').append(product);\n\n}", "function fillProducts(products) {\n \n \n document.getElementById('productsList').innerHTML = ''\n\n products.forEach(element => {\n createProduct(element);\n \n });\n}//end allows for each product to create an element", "function make_checkbox(activity, index){\n return \"<input class=form-check-input type=checkbox value='' id=input\" + index + \">\\\n <label class='form-check-label' for='input'\" + index + \">\" + activity + \"</label><br>\";\n}", "function addCheckboxes(elem, items){\n\t\tvar html=\"<fieldset data-role='controlgroup'>\";\n\t\t_.each(items.features, function(features){\n\t\t\thtml+='<input type=\"checkbox\" name=\"'+features.properties.Route_Type+'\" id=\"'+features.id+'\" class=\"custom\" /><label for=\"'+features.id+'\">'+features.properties.Route_Name+' - '+features.properties.Dist_Miles+' miles</label>';\n\t\t});\n\t\thtml+='</fieldset>';\n\t\t$('#'+elem).html(html);\n\t\t$('#'+elem).trigger(\"create\");\n\t}", "function generateNewTestList() {\r\n\tselectedTestList = [];\r\n $('#testlist input:checkbox').each(function(){\r\n \tif($(this).prop('checked')) {\r\n \t\tselectedTestList.push($(this).prop('value'));\r\n \t}\r\n });\r\n\r\n console.log('new list ist generated: '+selectedTestList.length + ' items');\r\n}", "function show_add_product()\n{\n\t//Unselect all products \n\t$(\".product_picker_check\").prop('checked', false);\n\t//Update the products in the product picker \n\t$.each(order_list, function (product_id, product_details)\n\t{\n\t\t$(\"#product_picker_check_\"+product_id).prop('checked', true);\n\t});\n\t$('.overlay').fadeIn(100); \n\t$('#product_picker').fadeIn(100); \t\n}", "function createCheckList(inputArray){\n inputArray.sort();\n for(var i = 0;i < inputArray.length; i++){\n //This snippet creates an individual task in the checklist. remove \"checked\" VVV to default to unchecked boxes\n document.write(\n \"<label><input type=\\\"checkbox\\\" name=\\\"task\\\" value=\\\"\" + inputArray[i] + \"\\\" checked>\" +\n inputArray[i] +\n \"</label>\"\n )\n }\n}", "function checkBox() {\n var foobar = $('#foobar'),\n checkbox;\n\n for (var key in FamilyGuy) {\n foobar.append('<input type=\"checkbox\" id=\"' + key + '\"/>' +\n '<label for=\"' + key + '\">' + FamilyGuy[key].last_name + '</label>')\n }\n\n foobar.append('<p><a href=\"#\" id=\"enable\">Enable All</a></div><br /><div><a href=\"#\" id=\"disable\">Disable All</a></p>');\n\n $('#enable').on('click', function () {\n en_dis_able(true);\n });\n\n $('#disable').on('click', function () {\n en_dis_able(false);\n });\n\n function en_dis_able(value) {\n checkbox = $('input[type=\"checkbox\"]');\n for (var i = 0, s = checkbox.length; i < s; i++) {\n checkbox[i].checked = value;\n }\n }\n }", "function buildCheckBox(id, name) {\n var html = \"\";\n html += inputCheckbox + inputLabel + lineBreak;\n html = html.replace(inputIDCode, id);\n html = html.replace(inputNameCode, name);\n\n return html;\n}", "function generateFilterItemHTML(item, $filter) {\n $(`\n <div class=\"form-check mr-3\">\n <input class=\"form-check-input\" type=\"checkbox\" id=\"${item}\" name=\"${item}\" value=\"${item}\">\n <label class=\"form-check-label\" for=\"${item}\">${item}</label>\n </div>\n `).appendTo($filter);\n }", "render () {\n var item = this.props.item,\n detail = item.product;\n\n return (\n <li className=\"product\">\n <label className=\"product-img custom-checkbox\" onMouseDown={this.preventSelection}>\n <input\n className=\"product-input\"\n type=\"checkbox\"\n checked={item.status !== 'NEW'}\n onChange={this.handleChange.bind(this)}\n ref=\"checkbox\"\n />\n <span className=\"custom-checkbox-indicator\"></span>\n <img src={detail.imageUrl} />\n </label>\n\n <a href=\"#\" className=\"product-desc\">\n <span className=\"product-arrow arrow\"></span>\n <div className=\"bfc\">\n <h3 className=\"product-title text\">{detail.name}</h3>\n <p className=\"text-help text\">{detail.description}</p>\n </div>\n </a>\n </li>\n );\n }", "function createcheckboxes(num) {\n if (checkboxRecord.indexOf(num) == -1) {\n checkboxRecord.push(num);\n let label = `&ThickSpace;<label for=\"${'val'+num}\">${num}</label>&ThickSpace;`,\n input = `<input type=\"checkbox\" name=${\"val\"+num}\" value=\"${num}\" id=\"${\"val\"+num}\">`;\n $(\"#checkbox\").append(label);\n $(\"#checkbox\").append(input);\n } else {\n alertBox.innerText = \"Value Already Entered\";\n displayAlertBox();\n }\n}", "function restrictListProducts(prods, restriction) {\n\tlet product_names = [];\n\tfor (let i=0; i<prods.length; i+=1) {\n\t\t\tproduct_names.push(prods[i]);\n\t\t}\n\n\t\t\t\n\tlet lactoseFree = document.getElementById(\"lactoseIntolerant\");\n\t\n\tlet Nut = document.getElementById(\"nutFree\");\n\n\tlet isOrganic = document.getElementById(\"organic\");\n\n\tlet isHealthy = document.getElementById(\"healthy\");\n\n\tlet goodForWeightLoss = document.getElementById(\"weightLoss\");\n\n\n\tif(lactoseFree.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.lactoseIntolerant);\n\n\t}\n\n\tif(Nut.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.nutFree);\n\n\t}\n\n\tif(isOrganic.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.organic);\n\n\t}\n\n\tif(isHealthy.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.healthy);\n\n\t}\n\n\tif(goodForWeightLoss.checked) {\n\t\tproduct_names = product_names.filter(product_names => product_names.weightLoss);\n\n\t}\n\n\t\t\t\n\t// Sort the array by price so that the items show in price order\n\n\tproduct_names.sort(function(a, b){\n\t\treturn a.price - b.price\n\t});\n\t\n\n\t\n\treturn product_names;\n}", "function insertCheckboxes() {\n let statBoxes = document.querySelectorAll('div[class^=\"gymContent\"] li');\n statBoxes.forEach(stat => {\n let statName = stat.className.split('_')[0];\n let checkbox = elementCreator('input', { type: 'checkbox', id: statName, name: statName, style: 'margin-right: 5px; vertical-align: middle' });\n let label = elementCreator('label', { for: statName, style: 'vertical-align: middle' }, '<b>Disable this stat?</b>');\n let checkboxWrapper = elementCreator('div', { style: 'margin: 5px' });\n checkboxWrapper.appendChild(checkbox);\n checkboxWrapper.appendChild(label);\n stat.querySelector('[class^=\"description\"]').append(checkboxWrapper);\n });\n}", "updateCheckboxes() {\n for (const id of this.compareList.keys()) {\n this._checkCheckbox(id);\n }\n }", "function createCheckbox() {\n var langCheckbox = document.createElement(\"input\");\n var labeText = document.createTextNode(\"Include Language\");\n var checkboxLabel = document.createElement(\"label\");\n var formEl = document.getElementById(\"languageForm\");\n langCheckbox.id = \"langCheckbox\";\n langCheckbox.type = \"checkbox\";\n checkboxLabel.for = \"langCheckbox\";\n checkboxLabel.id = \"checkboxLabel\";\n formEl.appendChild(langCheckbox);\n formEl.appendChild(checkboxLabel);\n checkboxLabel.appendChild(labeText);\n}", "function populateCountryList() {\n // check if country select box exist\n var existing_country = document.getElementById(\"country\");\n // add list of countries in select box\n if (typeof (existing_country) == 'undefined' || existing_country == null) {\n for (var i = 0; i < country_list.length; i++) {\n country_scroll.append(\"label\")\n .html(\"<input id='country' class='country_checkbox' value='\" + country_list[i] + \"' type='checkbox' onclick='return countryCount()'>\" + country_list[i] + \"<br>\");\n }\n }\n}", "function renderIngredients(list, el) {\n var counter = 0;\n while (counter < list.length) {\n el.insertAdjacentHTML('beforeend', `\n <div class=\"form-group\">\n <img src=\"./assets/img/${list[counter][0]}.svg\"\n <label for=\"${list[counter][0]}\">${list[counter][0].charAt(0).toUpperCase() + list[counter][0].slice(1)}</label>\n <input type=\"checkbox\" name=\"${list[counter][0]}\" id=\"${list[counter][0]} \" data-price=\"${list[counter][1]} \">\n <span>add</span>\n </div >\n `)\n counter++\n }\n}", "function populateDropdownMenu(num, ddMenu, ddCB, ddItems, tags, identifier, term) {\n for (var i = 0; i < num ; i++) {\n ddCB[i] = createCheckBox();\n ddItems[i] = createItem(ddCB[i], tags[i], i, identifier, term);\n ddMenu.append(ddItems[i]);\n }\n }", "function show_product_substitutes(product_id)\n{\n\tvar substitute_html = \"\";\n\t//For each product go throuhg and create the HTML\n\t$.each(products_list, function(product_id, product_details)\n\t{\n\t\tvar img_str = product_details.product_data.image;\n\t\tvar productlabel = product_details.product_data.title;\n\t\tvar checked = \"\";\n\t\tvar padding = \"000000\" ;\n\t\tvar padded_product_id = \"DBAP\" + padding.substring(0, 6 - product_id.length) + product_id;\n\t\tvar productdescription = product_details.product_data.description;\n\t\tif (product_id in order_list[product_id].substitutes) checked = \" checked \";\n\t\t//Add the HTML of this product \n\t\tsubstitute_html = substitute_html + \"<div class='pp-product'><div class='pp-product-selector'><input id='\"+product_id+\"' type='checkbox' \"+checked+\" /></div><div class='pp-product-image'><img class='pp-productimage' src='\"+img_str\n\t\t\t\t\t+\"'/></div><div class='pp-product-description'><div class='pp-product-label'>\"\n\t\t\t\t\t+productlabel+\"</div><div class='pp-product-description'>Product ID-\"\n\t\t\t\t\t+padded_product_id+\" - \"+productdescription+\"</div></div></div>\";\n\t\t//Select only those products which are in the substitutes list of the product in order list \n\t});\n\t//copy html into the modal\n\t$(\"#product_view2\").html(kpr);\n\t//Show the modal box \n\t$('.overlay').fadeIn(100); \n\t$('#product_picker2').fadeIn(100);\n\t//update back array - TBD\n}", "function populateForm() {\n\n //TODO: Add an <option> tag inside the form's select for each product\n const selectElement = document.getElementById('items');\n for (let i in Product.allProducts) {\n let optionsEle = document.createElement('option');\n optionsEle.textContent = Product.allProducts[i].name;\n selectElement.appendChild(optionsEle); \n\n }\n\n}", "function listItems(circuit_id,form){\n if (document.getElementById('todos_'+circuit_id).checked){\n \tfor (i=0;i<form.elements.length;i++) {\n \t\tif (form.elements[i].type == \"checkbox\" && form.elements[i].id == (\"case_\"+circuit_id)){\t\n \t\t\tform.elements[i].checked=true;\n \t\t}\n \t}\n }\n else{\n \tfor (i=0;i<form.elements.length;i++) {\n \t\tif (form.elements[i].type == \"checkbox\" && form.elements[i].id == (\"case_\"+circuit_id)){\n \t\t\tform.elements[i].checked=false;\n \t\t}\n \t}\n }\n}", "function add_filter_options(food_info_dict) {\n var select = document.getElementById(\"drop_down_filter\");\n\n //iterates over all the information for each food and creates a dropdown check box for it.\n for (var i in food_info_dict) {\n var cat_dict = food_info_dict[i];\n var name = cat_dict[\"name\"];\n var option = document.createElement(\"a\");\n\n var checkbox = document.createElement(\"input\");\n checkbox.setAttribute(\"type\", \"checkbox\");\n checkbox.id = \"option\" + cat_dict[\"id\"];\n checkbox.onclick = click_checkbox(checkbox);\n option.value = name.toString();\n option.innerText = name;\n checkbox.checked=true;\n option.appendChild(checkbox);\n option.onclick = update_filter(checkbox);\n\n\n select.appendChild(option)\n }\n\n}", "function init_checklist(obj) {\n $j(\"#\"+obj.id).hide();\n\tvar a = $j(\"#\"+obj.id).val().split(/[, \\t\\r\\n]+/);\n\tvar alen = a.length;\n\tfor (var i = 0; i < alen; i++) {\n\t\tvar val = a[i].replace(/^\\s+|\\s+$/g, '').toLowerCase();\n\t\tif (val != \"\") {\n\t\t\t$j(\".\"+obj.id+\"_list\").each( function() { \n\t\t\t\tif ($j(this).val().toLowerCase() == val) {\n\t\t\t\t\t$j(this).prop('checked', true);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\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 addLenses(product) {\n let lensesChoice = document.getElementById(\"ProductLenses\");\n for (let lenses of product.lenses) {\n lensesChoice.innerHTML += `<option value=\"${lenses}\">${lenses}</option>`\n }\n}", "function renderProducts(products) {\n let options = products.features.map(feature => (\n `<div class=\"card-body w-100\"><p class=\"card-text\">${feature.name}: ${feature.type} Price: $${feature.price}.00.</p></div>`\n ))\n\n return (`<div class=\"card w-100\">\n <div class=\"card-header\">\n <div class=\"row\">\n <div class=\"col-md-6 font-weight-bold\">${products.product.name}</div>\n <div class=\"col-md-6 text-right font-weight-bold\">$${products.total.price}.00</div>\n </div>\n </div>\n <div>\n &nbsp;${products.product.name} Base Price: $${products.product.price}\n </div>\n ${options.join(\" \")}`\n )\n }", "function populateForm() {\n var selectElement = document.getElementById('items');\n for (var i in Product.allProducts) {\n var optionEl = document.createElement('option');\n optionEl.textContent = Product.allProducts[i].name;\n selectElement.appendChild(optionEl);\n }\n}", "function renderProducts(products){\n\n const tagUl=document.querySelector(\".products ul\");\n\n for(const prodctName of products){\n\n const liTag=document.createElement('li')\n\n liTag.appendChild(creatInsideLists(prodctName));\n\n tagUl.appendChild(liTag)\n\n }\n\n\n}", "function createCyclesCheckboxes(cycles) {\n\tvar container = document.getElementById(\"cycles\");\n\tclean(container);\n\tfor (var i=0; i<cycles.length; i++) {\n\t\tvar checkbox = document.createElement(\"input\");\n\t\tcheckbox.type = \"checkbox\";\n\t\tcheckbox.value = cycles[i].id;\n\t\tcheckbox.checked = true;\n\t\tvar descr = document.createElement(\"label\");\n\t\tdescr.innerHTML = cycles[i].name;\n\t\tcontainer.appendChild(checkbox);\n\t\tcontainer.appendChild(descr);\n\t}\n}", "function pwFilterProducts() {\n if($('#filter input[type=checkbox]').is(':checked')) {\n $('#filter').removeClass('has-selection').addClass('has-selection');\n } else {\n $('#filter').removeClass('has-selection');\n }\n pwBuildLayout();\n }", "function buildList(){\n var medOut = '';\n var researchOut = '';\n var academicOut = '';\n var athleticOut = '';\n var adminOut = '';\n \n for(i = 0; i < data.features.length; i++){\n var object = data.features[i];\n var button = '<button class=\"list-group-item building-button\">'+object.properties.name+'</button>';\n switch(object.properties.type){\n case \"medical\" : medOut += button; break;\n case \"research\" : researchOut += button; break;\n case \"athletic\" : athleticOut += button; break;\n case \"academic\" : academicOut += button; break;\n case \"admin\" : adminOut += button; break; \n default: medOut += button;\n }\n \n }\n \n $(\"#medical-list\").html(medOut);\n $(\"#research-list\").html(researchOut);\n $(\"#academic-list\").html(academicOut);\n $(\"#athletic-list\").html(athleticOut); \n $(\"#admin-list\").html(adminOut); \n \n}", "function shoppingListOnPage(motherElement,listArray) {\n for (i = 0; i < listArray.length; i++) {\n var button = document.createElement(\"button\");\n var row = motherElement.insertRow(0);\n var inputElement = document.createElement(\"input\");\n var cell1 = row.insertCell(0);\n var cell2 = row.insertCell(1);\n var cell3 = row.insertCell(2);\n var cell4 = row.insertCell(3);\n cell1.appendChild(inputElement);\n cell2.innerHTML = listArray[i].product;\n cell3.innerHTML = listArray[i].quantity + \" \" + listArray[i].type;\n cell4.appendChild(button);\n // Input Attributes\n inputElement.setAttribute(\"type\", \"checkbox\");\n inputElement.setAttribute(\"data-input\", i);\n // Button Attributes\n button.innerText = \"Delete\";\n button.setAttribute(\"data-button\", i);\n button.setAttribute(\"class\", \"btn btn-danger\");\n }\n}", "function paketitem(){\n $('#pilihitem .checkbox').remove();\n var paket=pilihitem.value;\n $.ajax({ url: server+'.php?id='+paket, data: \"\", dataType: 'json', success: function(rows){\n for (var i in rows){\n var row = rows[i];\n var id_item=row.id;\n var nama_item=row.name;\n $('#pilihitem').append('<div class=\"checkbox\" style=\"color: #f3fff4\"><label><input type=\"checkbox\" name=\"item\" value=\"'+id_item+'\">'+nama_item+'</label></div>');\n }\n }});\n }", "function selChkTodos(form, chkNombre, boo) {\r\n\tfor(i=0; n=form.elements[i]; i++) \r\n\t\tif (n.type == \"checkbox\" && n.name == chkNombre) n.checked = boo;\r\n}", "function renderDropdown(products) {\n\tfor (let product of products) {\n\t\tlet option = document.createElement('option');\n\t\toption.setAttribute('value', product.name);\n\t\toption.textContent = product.name;\n\t\tselect.appendChild(option);\n\t}\n}", "function selectByGroup(){\r\n\r\n var groupcontrol = document.getElementById('groupies');\r\n var group = groupcontrol.options[groupcontrol.selectedIndex].value; \r\n var contacts = sessionhash.get(group);\r\n\r\n var contactcontrol = document.getElementById('contactsList');\r\n contactcontrol.innerHTML = \"\";\r\n\r\n if (contacts != null && !contacts.isEmpty()){\r\n\r\n var check2 = document.createElement(\"input\");\r\n var label2 = document.createElement(\"label\");\r\n var br2 = document.createElement(\"br\");\r\n \r\n var contactkeys = contacts.keys(); \r\n \r\n for (var j = 0; j < contactkeys.length; j++){ \r\n \r\n var check2 = document.createElement(\"input\");\r\n var label2 = document.createElement(\"label\");\r\n var br2 = document.createElement(\"br\");\r\n\r\n check2.setAttribute(\"type\", \"checkbox\"); \r\n check2.setAttribute(\"value\", contactkeys[j]);\r\n check2.setAttribute(\"name\", contacts.get(contactkeys[j])); \r\n label2.innerHTML = contacts.get(contactkeys[j]);\r\n \r\n contactcontrol.appendChild(check2);\r\n contactcontrol.appendChild(label2);\r\n contactcontrol.appendChild(br2);\r\n }\r\n }\r\n}", "function displayInventory() {\n\n var inventory = document.getElementById(\"inventory\");\n inventory.innerHTML = '';\n\n // Loop through the products array, adding each Product\n // to the inventory table in the html.\n for (var i = 0; i < products.length; i++) {\n // Make a new row for the Product i \n var newRow = document.createElement(\"TR\");\n newRow.id = i;\n\n // Make a TD for the checkbox\n var checkbox = document.createElement(\"TD\");\n // Make the actual checkbox\n var innerCheckbox = document.createElement(\"INPUT\");\n // Set the input type to checkbox\n innerCheckbox.type = \"checkbox\";\n // Add the checkbox into the TD\n checkbox.appendChild(innerCheckbox);\n\n // Make a TD for the material name\n var materialName = document.createElement(\"TD\");\n materialName.textContent = products[i].prodName;\n\n // Make a TD for the price\n var price = document.createElement(\"TD\");\n price.textContent = products[i].price;\n\n // Make a TD for the stock toggle\n var inStock = document.createElement(\"TD\");\n // Set the TD's text content to either yes or no,\n // based on the product at index i's inStock property.\n inStock.textContent = (function(inStock) {\n if (inStock) {\n return \"Yes\";\n }\n return \"No\";\n }(products[i].inStock));\n // Set the class name on the td\n inStock.className = products[i].inStock;\n\n // Add all the TD's to the TR\n newRow.appendChild(checkbox);\n newRow.appendChild(materialName);\n newRow.appendChild(price);\n newRow.appendChild(inStock);\n\n // Add the new row to the actual TBODY in the HTML\n inventory.appendChild(newRow);\n\n };\n\n}", "function show(source) {\n\t\tcheckboxes = document.getElementsByName('item[]');\n\t\tfor(var j in checkboxes)\n\t\t\tcheckboxes[j].checked = source.checked;\n\t}", "function addHTML() {\n\n let listItems = '';\n list.forEach(elm => {\n if (elm[1] == 'noCheck') {\n listItems += `<div class=\"app_list_item\"><button class=\"check_button\">&check;</button><p class=\"app_list_item_name\">${elm[0]}</p><button class=\"minus_button\">&#65293;</button></div>`;\n } else {\n listItems += `<div class=\"app_list_item\"><button class=\"check_button\">&check;</button><p class=\"app_list_item_name check\">${elm[0]}</p><button class=\"minus_button\">&#65293;</button></div>`;\n }\n });\n $('#app_list').html(listItems);\n}", "function createCheckBox() {\n return $('<input />', {\n type: 'checkbox'\n }).addClass(\"dd-check-boxes\");\n }", "selections() {\n let nombres = this.props.namesGenes;\n return (\n nombres.map(function (item, i) {\n return <option value={item} key={i}>{item}</option>\n }))\n }", "function createDirectionCheckboxDivHTML(){\r\n\r\n let HTMLString = '';\r\n\r\n MUNIDirectionsList.forEach((direction, i) => {\r\n\r\n if(userSelectedDirectionsList.includes(direction)){\r\n // '<input type=\"checkbox\" class=\"MuniLineCheckbox\" value=\"N\" checked>N Line</br>'\r\n HTMLString += '<input type=\"checkbox\" class=\"MuniDirectionCheckbox\" value=\"' + direction + '\" checked> ' + direction + '</br>';\r\n } else{\r\n // '<input type=\"checkbox\" class=\"MuniLineCheckbox\" value=\"N\">N Line</br>'\r\n HTMLString += '<input type=\"checkbox\" class=\"MuniDirectionCheckbox\" value=\"' + direction + '\"> ' + direction + '</br>';\r\n }\r\n\r\n });\r\n\r\n return HTMLString;\r\n}", "function renderList(state) {\n var buildTheHtmlOutput = \"\";\n\n $.each(state.items, function (itemKey, itemValue) {\n buildTheHtmlOutput += '<li>';\n if (itemValue.checked == false) {\n buildTheHtmlOutput += '<span class=\"shopping-item\">' + itemValue.name + '</span>';\n } else {\n buildTheHtmlOutput += '<span class=\"shopping-item shopping-item__checked\">' + itemValue.name + '</span>';\n }\n buildTheHtmlOutput += '<div class=\"shopping-item-controls\">';\n buildTheHtmlOutput += '<button class=\"shopping-item-toggle\">';\n buildTheHtmlOutput += '<span class=\"button-label\">check</span>';\n buildTheHtmlOutput += '</button>';\n buildTheHtmlOutput += '<button class=\"shopping-item-delete\">';\n buildTheHtmlOutput += '<span class=\"button-label\">delete</span>';\n buildTheHtmlOutput += '</button>';\n buildTheHtmlOutput += '</div>';\n buildTheHtmlOutput += '</li>';\n });\n $('.shopping-list').html(buildTheHtmlOutput);\n /*for when the page loads, there is no value in the input field*/\n $('#shopping-list-entry').val('');\n}", "function generateCountryCheckBoxList(zone) {\r\n\t\tlet div_start = '<div class=\"form-check form-check-inline\">';\r\n\t\tlet div_end = '</div>';\r\n\t\tlet html = '';\r\n\t\tgetCountryRefList(zone).forEach(function(country) {\r\n\t\t\tif (country.img.length>0) {\r\n\t\t\t\tlet input = '<input class=\"form-check-input\" type=\"checkbox\" name=\"countries\" id=\"id_'+country.code+'\" value=\"'+country.code+'\">';\r\n\t\t\t\tlet urlImg = 'https://lipis.github.io/flag-icon-css/flags/4x3/'+country.img+'.svg';\r\n\t\t\t\tlet img = '<img class=\"flag\" src=\"'+urlImg+'\" alt=\"'+country.name+'\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"'+country.name+'\">';\r\n\t\t\t\tlet label = '<label class=\"form-check-label\" for=\"id_'+country.code+'\">'+ img +'</label>';\r\n\t\t\t\thtml += div_start + input + label + div_end;\r\n\t\t\t}\r\n\t\t});\r\n\t\t$('#countryList' + zone).html(html);\r\n\t}", "function populatedStoredListData(parantNodeId,arr,index,arrObj){\n if (listCheck===1){\n console.log(\"list already selected\");\n return;\n }\n listCheck = 1;\n let nodeUl1 = document.getElementById(\"ul\");\n listCountId = 0;checkCountId = 0;selectedList = arrObj.name;\n console.log(arrObj.name);\n for (let ii =0;ii<arr.length;ii++){\n let newLiId = document.createElement(\"li\");\n //let liId = \"lis\"+ii;\n let idTmp = \"list\"+(listCountId++);\n newLiId.setAttribute(\"id\",idTmp);\n newLiId.setAttribute(\"class\",\"lis\");\n console.log(\"arr \",arr[ii][0]);\n nodeUl1.appendChild(newLiId);\n let trmppp = document.getElementById(idTmp);\n trmppp.innerText = arr[ii][0];\n\n ///// for check box ////////////////////\n let checkBox = document.createElement(\"INPUT\");\n checkBox.setAttribute(\"type\",\"checkbox\");\n checkBox.setAttribute(\"class\",\"allCheck\");\n //checkBox.setAttribute(\"id\",\"check\");\n let idchk = \"chk\"+(checkCountId++);\n checkBox.setAttribute(\"id\",idchk);\n trmppp.appendChild(checkBox);\n let check = document.getElementById(idchk);\n check.checked = arr[ii][1];\n\n\n /////\n }\n}", "function displayWishList() {\n if (wishlistItems == null || wishlistItems.length == 0) {\n wishlistItems = []\n wishId = 1\n $(\".wishlist-lightbox .next\").css(\"display\", \"none\")\n $(\".wishlist-lightbox .empty\").css(\"display\", \"block\")\n } else {\n $(\".wishlist-lightbox .next\").css(\"display\", \"block\")\n $(\".wishlist-lightbox .empty\").css(\"display\", \"none\")\n }\n wishcontent = ''\n // added checked class\n wishlistItems.map(function (wishItem) {\n let checkedName = wishItem.productName\n let checkedPrice = wishItem.productPrice\n\n $(\".item\").each(function () {\n if ($(this).find(\".product-name\").text() == checkedName && $(this).find(\".price\").text() == checkedPrice) {\n $(this).find(\".fav\").addClass(\"checked\")\n }\n // else{\n // $(this).find(\".fav\").removeClass(\"checked\")\n\n // }\n })\n wishcontent += `\n <div id=\"${wishItem.id}\" class=\"cart-container d-flex justify-content-start align-content-start\">\n <div class=\"content-img w-25\">\n <img src=\"${wishItem.productImg}\" alt=\"product\">\n </div>\n <div class=\"items\">\n <small>${wishItem.productName}</small>\n <br>\n <small>price:${wishItem.productPrice}</small>\n <br>\n <small>Sold By: ${wishItem.productAuthor}</small>\n </div>\n <p class=\"closewish\">&times;</p>\n \n </div>\n `\n })\n $(\".wishlist-lightbox .next\").html(wishcontent)\n $(\".wish-badge\").text(countCartItems(wishlistItems))\n\n\n}", "function createCheckboxes() {\n let rows = document.querySelectorAll(\"tr\");\n\n //head checkBox for multiple selection\n let checkbox = document.createElement('input');\n checkbox.setAttribute('type', \"checkbox\");\n checkbox.id = \"selectAll\";\n checkbox.value = \"selectAll\";\n checkbox.addEventListener( 'change', function() {\n let checkBoxes = document.querySelectorAll('input[type=\"checkbox\"]');\n if(this.checked) {\n for (let index = 1; index < checkBoxes.length; index++){\n checkBoxes[index].checked = true;\n }\n } else {\n for (let index = 1; index < checkBoxes.length; index++){\n checkBoxes[index].checked = false;\n }\n }\n });\n\n rows[0].appendChild(checkbox);\n\n for (let index = 1; index < rows.length; index++){\n let checkbox = document.createElement('input');\n checkbox.setAttribute('type', \"checkbox\");\n checkbox.id = data[index - 1].id;\n rows[index].appendChild(checkbox);\n }\n}", "function generateExponentCheckbox(){\n let exposant = document.getElementById('exponent');\n exposant.innerHTML = '';\n for(let i = 1; i <= EXP; i++)\n {\n exposant.innerHTML += '<input type=\"checkbox\" id=\"e'+ i +'\" onclick=\"onClicEvent()\">';\n }\n}", "function addChkBx($filterClass) {\n //Creates array from CSS class innerHTML values then removes duplicates\n let mappedArr = $.makeArray($filterClass.map(function(index, item) {\n ///checks if parameter is a number. if true makes integer\n if (!isNaN(item.innerHTML)) { \n return +item.innerHTML;\n }\n\n return item.innerHTML;\n }));\n\n let $filteredArr = mappedArr.filter(function(item, index, self) {\n return self.indexOf(item) === index;\n })\n\n ///checks if array contains num\n var isNumericString = $filteredArr.filter(function(i) {\n return !isNaN(i);\n }).length > 0;\n\n if (isNumericString) { \n $filteredArr = $filteredArr.sort(function(a, b) {\n return a - b; ///if true sort normally\n });\n $filteredArr.forEach(function(item) {\n console.log(item);\n return $fixed.prepend(\"<label>\" + \"<input type='checkbox' name='\" + $filterClass[0].className + \"' value='\" + item + \"'/>\" + item + \"<span style='font-size:10px; padding:0; margin:0;'>(\" + itemCount(mappedArr, item) + \")</span>\" + \"</label>\");\n });\n } else {\n $filteredArr = $filteredArr.sort(function(a, b) {\n if (a < b) { ///if true sort reverse alphabetically\n return 1;\n } else if (a > b) {\n return -1;\n }\n return 0;\n });\n\n $filteredArr.forEach(function(item) {\n console.log(item);\n return $fixed.prepend(\"<label>\" + \"<input type='checkbox' name='\" + $filterClass[0].className + \"' value='\" + item.toLowerCase().replace(/\\s+/g, '-') + \"'/>\" + item + \"<span style='font-size:10px; padding:0; margin:0;'>(\" + itemCount(mappedArr, item) + \")</span>\" + \"</label>\");\n });\n }\n\n //Creates title for checkbox groups\n $fixed.prepend(\"<br /><h2>Filter by \" + $filterClass[0].className.charAt(0).toLocaleUpperCase() + $filterClass[0].className.slice(1) + \"</h2>\");\n}", "function returnTableCheckbox(data) {\n return '<div class=\"checkbox\"><label><input type=\"checkbox\" value=\"' + $('<div/>').text(data).html() + '\"><span class=\"checkbox-material\"><span class=\"check\"></span></span></label></div>';\n }" ]
[ "0.71238345", "0.7002626", "0.6842741", "0.68406904", "0.67195493", "0.66173613", "0.65710497", "0.654006", "0.650278", "0.6398395", "0.6384334", "0.6340262", "0.6336694", "0.62954986", "0.6278523", "0.6227908", "0.62262076", "0.61928904", "0.6191821", "0.6171947", "0.6137044", "0.61316645", "0.61161715", "0.6101839", "0.6080714", "0.60798097", "0.6076904", "0.60509706", "0.6050362", "0.60450745", "0.600101", "0.59989166", "0.5971878", "0.59465766", "0.59449", "0.5901118", "0.5885587", "0.58699703", "0.58583677", "0.5835475", "0.5834313", "0.5811309", "0.58081853", "0.57956827", "0.57760096", "0.5775224", "0.57677615", "0.57576615", "0.57400393", "0.57319176", "0.57293195", "0.57030654", "0.569895", "0.5698857", "0.56985116", "0.56838524", "0.5677488", "0.56661147", "0.56581014", "0.5651788", "0.56453454", "0.563999", "0.56336045", "0.5619163", "0.55953854", "0.55879825", "0.55820185", "0.557349", "0.55705416", "0.55503917", "0.5548656", "0.55384916", "0.55336463", "0.55321896", "0.5528663", "0.5522412", "0.5519616", "0.5511781", "0.5504631", "0.54847026", "0.54843056", "0.5483663", "0.5480696", "0.546975", "0.54620886", "0.54577863", "0.5454173", "0.5450206", "0.5447893", "0.54445356", "0.5442276", "0.54389244", "0.5437049", "0.543679", "0.54294", "0.5424479", "0.5416349", "0.5414803", "0.5413612", "0.54111403" ]
0.6873513
2
This function is called when the "Add selected items to cart" button in clicked The purpose is to build the HTML to be displayed (a Paragraph) We build a paragraph to contain the list of selected items, and the total price
function selectedItems(){ var ele = document.getElementsByName("product"); var chosenProducts = []; var c = document.getElementById('displayCart'); c.innerHTML = ""; // build list of selected item var para = document.createElement("P"); para.innerHTML = "You selected : "; para.appendChild(document.createElement("br")); para.appendChild(document.createElement("br")); for (let i = 0; i < ele.length; i++) { if (ele[i].checked) { para.appendChild(document.createTextNode(ele[i].value)); para.appendChild(document.createElement("br")); para.appendChild(document.createElement("br")); chosenProducts.push(ele[i].value); } } // add paragraph and total price c.appendChild(para); c.appendChild(document.createTextNode("Total Price is $" + getTotalPrice(chosenProducts))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectedItems() {\n\n\tvar c = document.getElementById('displayCart')\n\tc.innerHTML = ''\n\n\n\t// build list of selected item\n\tvar para = document.createElement('P')\n\tpara.innerHTML = 'You selected : '\n\tpara.appendChild(document.createElement('br'))\n\tfor (i = 0; i < cart.length; i++) {\n\t\tpara.appendChild(document.createTextNode(cart[i].name))\n\t\tpara.appendChild(document.createElement('br'))\n\t}\n\n\t// add paragraph and total price\n\tc.appendChild(para)\n\tc.appendChild(\n\t\tdocument.createTextNode('Total Price is ' + getTotalPrice(cart))\n\t)\n}", "function selectedItems(){\n\t\n\tvar ele = document.getElementsByName(\"product\");\n\tvar chosenProducts = [];\n\t\n\tvar c = document.getElementById('displayCart');\n\tc.innerHTML = \"\";\n\t\n\t// build list of selected item\n\tvar para = document.createElement(\"P\");\n\tpara.innerHTML = \"You selected: \";\n\tpara.appendChild(document.createElement(\"br\"));\n\tpara.appendChild(document.createElement(\"br\"));\n\tfor (i = 0; i < ele.length; i++) { \n\t\tif (ele[i].checked) {\n\t\t\tpara.appendChild(document.createTextNode(ele[i].value));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tpara.appendChild(document.createElement(\"br\"));\n\t\t\tchosenProducts.push(ele[i].value);\n\t\t}\n\t}\n\t\t\n\t// add paragraph and total price\n\tc.appendChild(para);\n\tc.appendChild(document.createTextNode(\"Total Price: $\" + getTotalPrice(chosenProducts).toFixed(2)));\n\t\t\n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n // TODO: Add a new element to the cartContents div with that information\n const item = selectElement.options[selectElement.selectedIndex].text;\n const quantity = parseInt(document.getElementById('quantity').value);\n createTheElement('p', `Item: ${item} \\u00A0 \\u00A0 \\u00A0 Quantity: ${quantity}`, cartContents);\n}", "function selectedItems(product){\n\n\n\tvar ele = document.getElementById(\"panier-flex\");\n\tchosenProducts.push(product.price);\n\n\tvar prof = document.createElement(\"div\");\n\tprof.className = \"panier_prod\";\n\n\tvar proff = document.createElement(\"p\");\n\tproff.className = \"prod\";\n\tproff.innerHTML = product.name;\n\n\nvar hre = document.createElement(\"hr\");\n\tprof.appendChild(proff);\n\tprof.appendChild(hre);\n\tconsole.log(ele);\n\tele.appendChild(prof);\n\n\tvar price = document.getElementById(\"prixe\");\n\tprice.innerHTML = getTotalPrice(chosenProducts);\n\n\n\n\n\n\n\t//sc.appendChild(document.createTextNode(\"Total Price is \" + getTotalPrice(chosenProducts)));\n\n}", "function addToCartClicked(e){\n const button = e.target;\n const item = button.closest(\".detalle__compra\");\n const itemPrecio = Number(item.querySelector(\".precio\").textContent.replace(\"$\",\"\"));\n const itemProdId = Number(item.querySelector(\".idProdCarrito\").textContent);\n const precios = item.querySelector(\"#precios\");\n const cantidad = item.querySelector(\"#cantidad\");\n itemCantidad= Number(cantidad.value)+1;\n cantidad.value = itemCantidad;\n nuevasub = nuevasub +itemPrecio;\n sumaItem(itemProdId,itemCantidad);\n precios.innerHTML = `<p>\n $${cantidad.value * itemPrecio}\n </p>`\n subTotal.innerHTML = `<h3>Subtotal</h3>\n <p>$${nuevasub}</p>`\n total.innerHTML = `<h2>Total</h2>\n <p>$${nuevasub}</p>`\n}", "function addProductToCart(buttonID) {\r\n let cart = document.getElementById(\"rightDiv\");\r\n switch (buttonID) {\r\n case \"addSeedmix\":\r\n qty = document.getElementById(\"SeedmixQty\").value;\r\n addHTML = document.createElement(\"p\");\r\n addHTML.className=\"orderedProducts\";\r\n addHTML.innerHTML = \"Seedmix: \"+qty+\" Price: <strong class='price'>\" +(2*Number(qty)) +\"</strong>\";\r\n console.log(addHTML);\r\n cart.insertBefore(addHTML, document.getElementById(\"checkOut\"));\r\n break;\r\n case \"addEnergypellet\":\r\n qty = document.getElementById(\"EnergypelletQty\").value;\r\n addHTML = document.createElement(\"p\");\r\n addHTML.className=\"orderedProducts\";\r\n addHTML.innerHTML = \"Energypellet: \"+qty+\" Price: <strong class='price'>\"+(3*Number(qty)) +\"</strong>\";\r\n console.log(addHTML);\r\n cart.insertBefore(addHTML, document.getElementById(\"checkOut\"));\r\n break;\r\n case \"addTux\":\r\n qty = document.getElementById(\"TuxQty\").value;\r\n addHTML = document.createElement(\"p\");\r\n addHTML.className=\"orderedProducts\";\r\n addHTML.innerHTML = \"Tux: \"+qty+\" Price: <strong class='price'>\"+(3*Number(qty)) +\"</strong>\";\r\n console.log(addHTML);\r\n cart.insertBefore(addHTML, document.getElementById(\"checkOut\"));\r\n break;\r\n }\r\n}", "function addOn() {\n var addItem = document.getElementById(\"addItem\").value;\n var addPrice = document.getElementById(\"addPrice\").value;\n\n// send to html\n\nvar el = document.createElement('li');\nel.textContent = addItem;\ndocument.getElementById(\"list\").appendChild(el);\n\nvar el2 = document.createElement('li');\nel2.textContent = addPrice;\ndocument.getElementById(\"price\").appendChild(el2);\n\nprice += addPrice;\n// var sum = document.createElement('p');\n// sum.textContent = price;\n// document.getElementById(\"total\").appendChild(sum);\n}", "function addItemZero(){\n $(\"#cartItems\").append(\"<ul>\"+purchaseOptions[0]+\"</ul>\");\n myCartTotal = myCartTotal + itemPrices[0];\n $(\"#cartTotal\").text(\"Your new cart total is: $\" + myCartTotal.toFixed(2));\t \n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n let quantity1 = document.getElementById('quantity');\n let iteam1 = document.getElementById('items');\n\n \n // TODO: Add a new element to the cartContents div with that information\n let cartContent = document.getElementById('cartContents');\n let pEle= document.createElement('p');\n pEle.textContent= quantity1.value +\" : \"+ iteam1.value; \n cartContent.appendChild(pEle);\n}", "function renderCart() {\n var prices = [];\n\n cartContent.innerHTML = \"\";\n\n cart.items.forEach(function(item) {\n var itemPrice = parseFloat(item.price.replace(\"$ \", \"\")),\n itemQuantity = parseInt(item.quantity);\n\n prices.push(itemPrice * itemQuantity);\n cartContent.innerHTML += \"<li class='cart-item' id='cart-\" + item.id + \"'><p class='cart-item-name'>\" + item.name + \"</p><img class='cart-item-img' src='http://vignette1.wikia.nocookie.net/clubpenguin/images/5/5f/Red_X.png/revision/latest?cb=20120514130731'><input type='number' class='inset quantity' min='0' max='50' value=\" + item.quantity + \"></li>\";\n })\n\n var totalPrice = prices.reduce(function(a, b) {\n return a + b;\n }, 0);\n\n cart.total = totalPrice.toFixed(2);\n cartTotal.innerHTML = \"$ \" + cart.total;\n }", "function addToCart() {\n if ( inputNameEl.value !== '' ) {\n cartEl.innerHTML += '<li id=\"' + currentIndex + '\"><label class=\"control control--checkbox\">' + inputNameEl.value + '<input type=\"checkbox\"/><div class=\"control__indicator\"></div></label> <button class=\"removeBtn\" onclick=\"removeFromCart(' + currentIndex + ')\">x</button></li>';\n currentIndex += 1;\n //total += parseInt(inputPriceEl.value);\n //totalEl.innerHTML = total ;\n inputNameEl.value = \"\";\n //inputPriceEl.value = \"\";\n }\n}", "function onClickActionAddCartItem(e){\n\t\t\n\t\tvar html = '';\n\t\tlet itemId = parseInt(e.currentTarget.dataset.itemid);\n\t\tvar it = DB.getItemInfo( itemId );\n\t\tvar content = CashShop.ui.find('.container-cart');\n\t\tconst itemCart = CashShop.cartItem.find(i => i.itemId === itemId);\n\t\tvar item = [];\n\t\tvar tab = 0;\n\t\tif(CashShop.activeCashMenu !== 'SEARCH_RESULT'){\n\t\t\titem = CashShop.cashShopListItem[CashShop.activeCashMenu].items.find(i => i.itemId === itemId);\n\t\t\ttab = CashShop.cashShopListItem[CashShop.activeCashMenu].tabNum;\n\t\t} else {\n\t\t\titem = CashShop.csListItemSearchResult.find(i => i.itemId === itemId);\n\t\t\ttab = item.tab;\n\t\t}\n\n\t\tif(content.find('#cart-list .items .no-items').length > 0){\n\t\t\tcontent.find('#cart-list .items .no-items').remove();\n\t\t}\n\n\t\tif(CashShop.cartItem.length > 4 && typeof itemCart === 'undefined'){\n\t\t\t//only 5 item can store in cart\n\t\t\tUIManager.showMessageBox( '5 Item can only stored in cart!', 'ok');\n\t\t\treturn;\n\t\t}\n\n\t\tif(item.amount >= 99){\n\t\t\tUIManager.showMessageBox( 'Max Quantity 99!', 'ok');\n\t\t\tChatBox.addText( 'Max Quantity 99!', ChatBox.TYPE.ERROR);\n\t\t\treturn;\n\t\t}\n\n\t\tif(typeof itemCart === 'undefined'){\n\t\t\titem.amount = 1;\n\t\t\titem.tab = tab;\n\t\t\tCashShop.cartItem.push(item);\n\t\t\thtml = `<li class=\"item\" data-index=\"${itemId}\">\n\t\t\t\t\t<div class=\"inner-item-dt\">\n\t\t\t\t\t\t<div class=\"delete-item\"><button>x</button></div>\n\t\t\t\t\t\t<div class=\"item-dt-img\"></div>\n\t\t\t\t\t\t<div class=\"item-dt-desc\">\n\t\t\t\t\t\t\t<div class=\"item-desc-top\">${it.identifiedDisplayName}</div>\n\t\t\t\t\t\t\t<div class=\"item-counter\">\n\t\t\t\t\t\t\t\t<div class=\"item-cnt\">${item.amount}</div>\n\t\t\t\t\t\t\t\t<button class=\"counter-btn item-cnt-up\" data-index=\"up\"></button>\n\t\t\t\t\t\t\t\t<button class=\"counter-btn item-cnt-down\" data-index=\"down\"></button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"item-desc-price\">\n\t\t\t\t\t\t\t\t<div class=\"icon-gold-coin\"></div>\n\t\t\t\t\t\t\t\t<span>${item.price}</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>`;\n\t\t\tcontent.find('.items').append(html);\n\t\t\tClient.loadFile( DB.INTERFACE_PATH + 'collection/' + ( it.identifiedResourceName ) + '.bmp', function(data){\n\t\t\t\tcontent.find('.item[data-index=\"'+ itemId +'\"] .item-dt-img').css('backgroundImage', 'url('+ data +')');\n\t\t\t});\n\n\t\t\tClient.loadFile( DB.INTERFACE_PATH + 'cashshop/img_shop_itemBg2.bmp', function(data){\n\t\t\t\tcontent.find('.item-counter').css('backgroundImage', 'url('+ data +')');\n\t\t\t});\n\t\t} else {\n\t\t\titemCart.amount += 1;\n\t\t\tcontent.find('.items .item[data-index=\"'+itemId+'\"] .item-cnt').html(itemCart.amount);\n\t\t}\n\t\tCashShop.cartItemTotalPrice = CashShop.cartItem.map(item => item.price * item.amount).reduce((prev, next) => prev + next);\n\t\tCashShop.ui.find('.container-cart-footer .item-desc-price span').html(CashShop.cartItemTotalPrice);\n\t}", "function addToCart(image, name, price, qty, btnAdd_id) {\n\n var unitP = 1 * price.trim().slice(1)\n totalP = totalP + unitP\n updateTotal(totalP)\n\n //if item is already in the cart, just update it\n if (qty > 1) {\n var priceofProduct = qty * price.trim().slice(1)\n document.getElementById(\"item_\" + btnAdd_id).children[1].innerText = qty\n document.getElementById(\"item_\" + btnAdd_id).children[3].innerText = \"$\" + priceofProduct\n }\n\n // else add the item to the cart\n else {\n var listItem = document.createElement('li')\n listItem.style.listStyle = 'none'\n listItem.setAttribute(\"id\", \"item_\" + btnAdd_id)\n listItem.setAttribute(\"class\", \"list-group-item d-flex justify-content-between lh-condensed\")\n\n var detail = `\n <div>\n <span ><img src=${image} style=\"width: 60px; height: 70px;\"><small class=\"my-0\"> ${name}</small></span>\n </div>\n \n <span ><small>${qty}</small></span>\n <span >\n <button class=\"btn\" style=\"background-color:RoyalBlue\" id=\"trash\" onclick=\"trash(this)\"><i class=\"fa fa-trash\" style=\"color: white;\"></i></button>\n <button class=\"btn\" onclick=\"addI(${btnAdd_id})\" style=\"background-color:forestgreen\" ><i class=\"fa fa-plus\" style=\"color: white;\"></i></button>\n <button class=\"btn\" id=\"item_\" onclick=\"removeI(id+${btnAdd_id})\" style=\"background-color:rgb(235, 86, 86)\"><i class=\"fa fa-minus\" style=\"color: white; \"></i></button> \n </span>\n <span ><small>${price}</small></span> \n `\n \n listItem.innerHTML = detail\n var list = document.querySelector('#yourCart')\n list.insertBefore(listItem, list.lastElementChild)\n }\n\n}", "function Products(products) {\n document.getElementById(\"products\").innerHTML = products\n .map((product, index) => {\n let amount = sessionStorage.getItem(product.id);\n if (amount) {\n addToCart(product.id, amount);\n }\n itemQuantity[product.id] = 0;\n\n return `<div class=\"productList\">\n \n <p>${product.name}</p>\n <img src=\"${product.imgUrl}\" alt=\"image of ${product.name}\">\n <p>${product.description}</p>\n\n <button id=\"moreDetailsButton\" onclick = \"moreDetails(${\n product.id\n })\">${detailsButton}</button>\n <br>\n <select id=select-${index} onchange=\"getValue(${index})\">\n <option value=\"0\">--Quantity--</option>\n <option value=\"1\">1</option>\n <option value=\"2\">2</option>\n <option value=\"3\">3</option>\n <option value=\"4\">4</option>\n <option value=\"5\">5</option>\n <option value=\"6\">6</option>\n <option value=\"7\">7</option>\n <option value=\"8\">8</option>\n <option value=\"9\">9</option>\n <option value=\"10\">10</option>\n </select>\n <button onclick=\"addToCartAndStore(${product.id})\">Add to Cart</button>\n \n </div>\n <hr>`;\n })\n .join(\" \");\n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n var product = event.target.items.value;\n var quantity = event.target.quantity.value;\n // TODO: Add a new element to the cartContents div with that information\n var divEl = document.getElementById('cartContents');\n var ulEl = document.createElement('ul');\n divEl.appendChild(ulEl);\n\n var liEl =document.createElement('li');\n liEl.textContent = 'Items Qty';\n ulEl.appendChild(liEl);\n\n for(var i = 0; i < items.length; i ++) {\n console.log(items);\n var liEl = document.createElement('li');\n liEl.textContent = `${product} ${quantity}`; \n }\n ulEl.appendChild(liEl); \n}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n // TODO: get the quantity\n // TODO: using those, add one item to the Cart\n const product = selectElement.options[selectElement.selectedIndex].text;\n const quantity = parseInt(document.getElementById('quantity').value);\n cart.addItem(product, quantity);\n}", "function updateCartPreview() {\n // DONE: Get the item and quantity from the form\n // DONE: Add a new element to the cartContents div with that information\n\n var itemAddedDisplayEl = document.getElementById('cartContents');\n var itemsEl = document.getElementById('items').value;\n var quantityEl = document.getElementById('quantity').value;\n itemAddedDisplayEl.textContent ='Item: ' + itemsEl + ' Quantity: ' + quantityEl;\n}", "function handleCart(eachProduct) {\n var cartItemsContainer = document.querySelector('.cart-container .cart-items');\n var itemToAdd = '<li class=\"list-group-item\"><div class=\"item d-flex justify-content-between\" id=\"%id%\"><div class=\"item-img\"><img src=\"img/%img-path%\" alt=\"item-img\" width=\"40\"></div><div class=\"item-name text-left text-truncate\">%item-name%</div><div class=\"item-price text-left text-muted\">%item-price%</div><div class=\"each-item-numbers w-50\"><select class=\"numberOfItems\"><option value=\"1\">1</option><option value=\"2\">2</option><option value=\"3\">3</option><option value=\"4\">4</option><option value=\"5\">5</option><option value=\"5+\">5+</option></select></div><img src=\"../img/icons/x-circle.svg\" class=\"remove-cart-item\"></div></li>';\n\n console.log(eachProduct)\n\n var item = itemToAdd.replace('%id%', eachProduct.id);\n item = item.replace('%img-path%', eachProduct.img);\n item = item.replace('%item-name%', eachProduct.name);\n item = item.replace('%item-price%', eachProduct.price);\n cartItemsContainer.innerHTML += item;\n }", "function printList(){\n for(var i=0;i<listLength;i++){\n $(\"ul\").append(\"<li>\"+purchaseOptions[i]+\". . . . . . $\" + itemPrices[i].toFixed(2) +\" \"+\"</li></br>\");\n $(\"ul\").append(\"<input type='button' id =\\\"\"+(i)+\"\\\"\"+\"value='Add to Cart'>\");\n }\n}", "function submitNewStuff() {\n \tvar itemAdd = document.getElementById(\"itemInput\").value; //naming an added item to a variable\n \tvar priceAdd = document.getElementById(\"priceInput\").value; //naming an added price to a variable\n\n\n\tvar unorderedList = document.getElementById('shoppinglist'); //creates a variable for the unordered list with the ID 'shoppinglist' in the HTML\n\tvar myList = document.createElement('li'); //creates list items for each grocery item & price, creates a variable of it to call later\n\tvar displayTotal = document.getElementById('totalDisplay'); //creates a variable for the grocery item total from the <p> tag in the HTML\n\n \tpriceAdd = parseInt(priceAdd); //making sure the price is a number\n\n\tmyList.innerHTML=itemAdd + \"- \\$\" + priceAdd; //adds the grocery items and prices into the html in 'li' format\n\tunorderedList.appendChild(myList); //adds the li to the unordered list\n\n\n \ttotal += priceAdd;\n }", "function addSelectedItemToCart() {\n // suss out the item picked from the select list\n let product = document.getElementById('items').value;\n let quantity = document.getElementById('quantity').value;\n cart.addItem(product, quantity);\n\n // console.log(newCartItem);\n // console.log(cart);\n\n // get the quantity\n // using those, add one item to the Cart\n}", "function addItem() {\n // Creating all the items\n let listWrapper = document.createElement(\"div\");\n let productName = document.createElement(\"span\");\n let productPrice = document.createElement(\"span\");\n let productAmount = document.createElement(\"div\");\n let productlabel = document.createElement(\"label\");\n let productInput = document.createElement(\"input\");\n let productTotal = document.createElement(\"div\");\n let subTotal = document.createElement(\"label\");\n let subTotalValue = document.createElement(\"span\"); \n let productDelete = document.createElement(\"div\");\n let deleteButton = document.createElement(\"button\"); \n\n\n // Getting the values from New Items input\n let createName = document.getElementById(\"create-name\");\n let createPrice = document.getElementById(\"create-price\");\n productName.innerHTML = createName.value;\n productPrice.innerHTML = createPrice.value;\n\n\n // Setting classes, IDs and Values to the items\n listWrapper.className = \"list-wrapper\";\n listWrapper.id = \"list-wrapper\";\n productName.className = \"product-name\";\n productPrice.className = \"product-price\";\n productAmount.className = \"product-amount\";\n productlabel.innerHTML = \"Qty\";\n productInput.innerHTML = 0;\n productInput.className = \"quantity\";\n productTotal.className = \"produt-total\";\n subTotal.innerHTML = \"Subtotal: \";\n subTotalValue.className = \"sub-total\";\n subTotalValue.value = 0;\n \n productDelete.className = \"product-delete\"\n deleteButton.className = \"btn btn-delete\"\n deleteButton.innerHTML = \"Delete Row\";\n \n // Adding the structure\n document.getElementById(\"shopping-wrapper\").appendChild(listWrapper);\n listWrapper.appendChild(productName);\n listWrapper.appendChild(productPrice);\n listWrapper.appendChild(productAmount);\n productAmount.appendChild(productlabel);\n productAmount.appendChild(productInput);\n listWrapper.appendChild(productTotal);\n productTotal.appendChild(subTotal);\n productTotal.appendChild(subTotalValue);\n listWrapper.appendChild(productDelete);\n productDelete.appendChild(deleteButton);\n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n let product = document.getElementById('items').value;\n let quantity = document.getElementById('quantity').value;\n // TODO: Add a new element to the cartContents div with that information\n let cartContents = document.querySelector('#cartContents');\n let newContent = document.createElement('p');\n newContent.innerText = `${quantity}: ${product}`;\n cartContents.appendChild(newContent);\n\n}", "function displayCart(teddies) {\n\n // Selection de la classe ou je vais injecter le code HTML\n const positionPanier = document.querySelector(\"#table-produits-panier\")\n\n let html = \"\";\n teddies.forEach(teddy => \n html += `\n <tbody id=\"cart-tablebody\" class=\"font-weight-bold\">\n <tr class=\"\">\n <td class=\"text-center\">\n <span class=\"text-danger font-weight-bold text-center\">${teddy.name}\n </td>\n <td class=\"text-center\">\n ${teddy.qty}\n </td>\n <td class=\"text-center price-teddy\">\n ${price(teddy.price * teddy.qty)}\n </td>\n <td class=\"text-center\">\n <button class=\"btn btn-danger btnDelete\">Supprimer</button>\n </td>\n </tr>\n </tbody>\n `\n )\n \n\n //Injection html dans la page panier\n positionPanier.innerHTML = html \n deleteProduct()\n deleteAllProduct()\n priceTotal(teddies)\n sendForm()\n}", "function addProduct() {\n el('cart').style.display = 'inline-block';\n el('order').style.display = 'none';\n const title = el('products').value;\n const quantity = parseFloat(el('quantity').value);\n cart[title] = (cart[title] || 0) + quantity;\n saveCart();\n showCart();\n}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n // TODO: get the quantity\n // TODO: using those, add one item to the Cart\n var suss = document.getElementById('cartContents');\n var print = document.createElement('p');\n suss.appendChild(print);\n var selectedItem = document.getElementById('items');\n var quantityItem = document.getElementById('quantity');\n print.textContent= `${quantityItem.value} quantities of ${selectedItem.value}`;\n var x =new cart(selectedItem.value,quantityItem.value);\n counter++;\n console.log(counter);\n var setLocalStorage = JSON.stringify(cartArray);\n localStorage.setItem('cartItems', setLocalStorage);\n \n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n // TODO: Add a new element to the cartContents div with that information\n}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n var product = event.target.items.value;\n var quantity = event.target.quantity.value;\n cart.addItem(product, quantity);\n counter++;\n console.log(counter);\n // TODO: get the quantity\n // TODO: using those, add one item to the Cart\n}", "function addItemToCart(myFormObject){\n ////clearing out our total div by using the innerHTML method to reset our div to a blank string so the list doesn't grow exponentially\n document.getElementById(\"yourGrandTotal\").innerHTML = '';\n //clearing out our unordered list by using innerHTML method to reset our UL to a blank string so the list doesn't grow exponentially\n document.getElementById(\"ShoppingList\").innerHTML = '';\n //created variables called \"itemName\" & \"itemPrice\" to store the itemName and itemPrice of the formObj.elements\n var itemName = myFormObject.elements[\"itemName\"].value;\n var itemPrice = myFormObject.elements[\"itemPrice\"].value;\n //created a new variable. set this variable equal to a groceryListItem, taking in as parameters our previously defined itemName and itemPrice variables\n var itemNameAndPrice = new groceryListItem(itemName, itemPrice);\n //used push method to place the itemNameAndPrice inside the array\n shoppingListArray.push(itemNameAndPrice);\n //calls functions to calculate the total and updates HTML list\n calculateTotal();\n updateHTMLList();\n}", "function addToCartClicked(event) {\n document.querySelector(\".custom\").style.display = \"block\";\n var button = event.target;\n var shopItem = button.parentElement.parentElement;\n var title = shopItem.getElementsByClassName(\"shop-item-title\")[0].innerText;\n var price = shopItem.getElementsByClassName(\"shop-item-price\")[0].innerText;\n var imageSrc = shopItem.getElementsByClassName(\"shop-item-image\")[0].src;\n items = {\n title,\n price,\n imageSrc,\n };\n\n // check if the total is updating\n}", "function StoreCart() {\n\n\t//get flavor \n\tvar flavor = document.getElementById('flavor').textContent;\n\tflavor = flavor.toLowerCase();\n\t//console.log(flavor);\n\n\t//get glaze selection \n\tvar glaze_list = document.forms[0].value;\n\tvar glaze_choice = document.getElementsByName('glaze');\n\n var glaze;\n\tfor (var i=0; i < (glaze_choice.length); i++) {\n\t\tif (glaze_choice[i].checked) {\n\t\t\tglaze = glaze_choice[i].value;\n\t\t\t//console.log((glaze_choice[i].value));\n\t\t}\n\n\t}\n\n\tvar images = {\n\t\tnone:'images/product1.jpg', \n\t\tstrawberry:'images/strawberry.jpg', \n\t\tchocolate: 'images/choco.jpg', \n\t\tpear:'images/pear.jpg'\n\t};\n\n\t//get corresponding image to glaze\n\tvar img_source = images[glaze];\n\t//console.log(img_source);\n\n\t//get quantity selected\n\tvar qty1 = document.getElementById('qty1').value;\n\tqty1 = parseInt(qty1);\n\t//console.log(qty1);\n\n\t//get price without dollar sign \n\tvar p1 = document.getElementById('price').textContent;\n\tp1 = p1.substring(1);\n\tp1 = parseFloat(p1);\n\ttotal_price = qty1 * p1;\n\t//console.log(p1);\n \n //create new item object for order\n\tvar item = {\n\t\timg_source: img_source,\n\t\tflavor: flavor, \n\t\tglaze: glaze,\n\t\tquantity: qty1,\n\t\tprice: total_price\n\t}\n\n\tvar item_array = [img_source, flavor, glaze, qty1, total_price];\n\n\t//console.log(item);\n\n\tall_items.push(item_array);\n\t//console.log(all_items);\n\n\t//var item_list = \"\";\n\t//item_list += flavor + \" \" + glaze + \" \" + qty1 + \" \" + p1;\n\t//console.log(item_list);\n\n window.localStorage.setItem('item1', JSON.stringify(all_items));\n item1 = window.localStorage.getItem('item1');\n console.log(item1);\n\n}", "function createQuote(e) {\n var clickedButtonId = e.srcElement.id;\n\n if (clickedButtonId == \"submit\") {\n var total = 0;\n var orderSummary = \"\";\n\n for (let i=0; i< orderList.length; i++) {\n var x = orderList[i];\n\n //To fix formatting of bools\n if (listOfProducts[x].newRelease == true) {\n listOfProducts[x].newRelease = \"Yes\";\n }\n else {\n listOfProducts[x].newRelease = \"No\";\n }\n //Create order summary\n orderSummary += \"Product: \" + listOfProducts[x].productName + \"\\n\" +\n \"New Release: \" + listOfProducts[x].newRelease + \"\\n\" +\n \"Type: \" + listOfProducts[x].productType + \"\\n\" +\n \"Price: $\" + listOfProducts[x].productPrice.toFixed(2) + \"\\n\\n\";\n\n total += listOfProducts[x].productPrice;\n }\n alert(orderSummary + \"\\n\" + \"Total: $\" + total.toFixed(2));\n }\n}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n let selectedItem = event.target.items.value;\n console.log(selectedItem);\n // TODO: get the quantity\n let quantity = event.target.quantity.value;\n // TODO: using those, add one item to the Cart\n \n \n carts.addItem(selectedItem,quantity); \n console.log(carts.items);\n \n}", "function insertItemToDOM(product) {\n cartDOM.insertAdjacentHTML(\"beforeend\", \n `<p class = \"cartItems\">${product.name}<br>${product.price}</p>`);\n}", "addToCartBtn(e){\n\n this.productItem = this.$.productListItem.itemForElement(e.target);\n console.log(this.$.productListItem);\n this.$.selector.select(this.productItem);\n\n //Storing the data in to local storage\n this.productList = JSON.parse(localStorage.getItem(\"setProductItemsInLocalStorage\"));\n console.log('this.productEntries :' + this.productList);\n if (this.productList == null) this.productList = [];\n this.produclistArray = [];\n\n //Getting the Product price value\n var totalprice = this.productItem.price;\n console.log('totalamount :' + totalprice);\n\n //Pushing the productItem to produclistArray\n this.produclistArray.push(this.productItem.img, this.productItem.productName, this.productItem.price,this.productItem.id, totalprice)\n console.log(this.produclistArray);\n\n // Getting current selected values and setting to CurrentProductList\n window.localStorage.setItem('CurrentProductList', JSON.stringify(this.produclistArray));\n\n //Pushing the data to products list Array\n this.productList.push(this.produclistArray);\n\n //Finally store the all products using localstorage setitem\n window.localStorage.setItem(\"setProductItemsInLocalStorage\", JSON.stringify(this.productList));\n\n //reload the page to set the values in shopping-cart\n location.reload();\n\n // adding tot product price amount\n\n this.productPrice = window.localStorage.getItem('totalprice');\n if(this.productPrice != null){\n this.productPrice = parseInt(this.productPrice);\n window.localStorage.setItem(\"totalprice\", this.productPrice + this.productItem.price);\n } else{\n window.localStorage.setItem(\"totalprice\", this.productItem.price);\n }\n\n\n }", "function addSelectedItemToCart() {\n\n let quantityTextbox = document.getElementById('quantity').value;\n let ddlProducts = document.getElementById(\"items\");\n let selectedOption = ddlProducts.value; \n cart.addItem(selectedOption, quantityTextbox);\n \n}", "function addSelectedItemToCart() {\n\n // suss out the item picked from the select list\n var productPicked = document.getElementById('items').value; // why not 'options'? it knows there's something in the dropdown.\n var quantityPicked = document.getElementById('quantity').value; // get the quantity\n //using those, add one item to the Cart\n cart.addItem(productPicked,quantityPicked);\n}", "function addItem(title){\n\tvar node = $(ITEM_TEMPLATE);\n\tnode.attr(\"style\",\"\");\n\n\n\t//add product names in main-box\n\tnode.find(\".product-name\").text(title);\n\n\t//add product names with mark(number) in second-box\n\tvar sideLabel = $(LABEL_TEMPLATE);\n\tsideLabel.find(\".label-text\").text(title);\n\tsideLabel.find(\".mark\").text(1);\n\tLIST_LEFT.append(sideLabel);\n\n\tvar label = node.find(\".label\");\n\n\t//adding function to delete product when delete button pressed\n\tnode.find(\".delete\").click(function(){\n\t\tnode.remove();\n\t\tsideLabel.remove();\n\t});\n\n\n\t//adding function to edit the name of product when you press on it\n\tvar editMode = false;\n\tnode.find(\".product-name\").click(function(){\n\t\tif (!editMode){\n\t\t\teditMode = true;\n\t\t\tvar _this = $(this);\n\t\t\tvar prev = _this.html();\n\t\t\tvar _field = $(\"<input type=\\\"text\\\" value=\\\"\" + _this.html() + \"\\\" />\");\n\t\t\t_this.html(_field);\n\t\t\t_field.select().focus();\n\t\t\t_field.focusout(function(){\n\t\t\t\teditMode = false;\n\t\t\t\tif (isBlank(_field.val())){\n\t\t\t\t\t_this.html(prev);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsideLabel.find(\".label-text\").html(_field.val());\n\t\t\t\t_this.html(_field.val());\n\t\t\t});\n\t\t}\n\t});\n\n\n\t//adding the ability to decrease number of product by pressin red button\n\tnode.find(\".red-button\").attr(\"disabled\",\"disabled\");\n\tnode.find(\".red-button\").click(function(){\n\t\tvar count = parseInt(label.html());\n\t\tcount--;\n\t\tlabel.html(count);\n\t\tsideLabel.find(\".mark\").html(count);\n\t\tif (count < 2){\n\t\t\tnode.find(\".red-button\").attr(\"disabled\",\"disabled\");\n\t\t}\n\t});\n\n\t//adding the ability to increase number of product by pressin green button\n\tnode.find(\".green-button\").click(function(){\n\t\tvar count = parseInt(label.html());\n\t\tcount++;\n\t\tlabel.html(count);\n\t\tsideLabel.find(\".mark\").html(count);\n\t\tif (count > 1){\n\t\t\tnode.find(\".red-button\").removeAttr(\"disabled\",\"disabled\");\n\t\t}\n\t});\n\n\t//adding the ability to mark product as bought by presssing bought button\n\tnode.find(\".bought\").click(function(){\n\t\tsideLabel.remove();\n\t\tsideLabel.addClass(\"strike\");\n\t\tLIST_BOUGHT.append(sideLabel);\n\t\tnode.find(\".green-red-buttons\").addClass(\"hidden\");\n\t\tnode.find(\".buy-del-buttons\").addClass(\"hidden\");\n\t\tnode.find(\".unbuy-buttons\").removeClass(\"hidden\");\n\t});\n\n\n\t//adding the ability to mark product as not bought by presssing unbuy button\n\tnode.find(\".unbuy\").click(function(){\n\t\tsideLabel.remove();\n\t\tsideLabel.removeClass(\"strike\");\n\t\tLIST_LEFT.append(sideLabel);\n\t\tnode.find(\".green-red-buttons\").removeClass(\"hidden\");\n\t\tnode.find(\".buy-del-buttons\").removeClass(\"hidden\");\n\t\tnode.find(\".unbuy-buttons\").addClass(\"hidden\");\t\t\n\t});\n\n\n\tLIST.append(node);\n}", "function buyItem(){\n var amount= $.getElementById(\"userInput\").value;//gets an integer from the user\n var price= p*amount*tax;// takes integer multiply it by two dollars which is the price\n document.getElementById(\"userInput\").value=\"\";//clears the input box\n var total= \"you bought\"+\" \"+\"$\"+price.toFixed(2)+ \" of Banana Lumpia\";//takes price displays it as you bought_ of bana\n \n \n var li= document.createElement('li');//creates a lists\n var newText=document.createTextNode(total);// gets total and saves it as newtext\n li.appendChild(newText);//puts newtext and total together\n var olTag=document.getElementById(\"recipt\");//\n olTag.appendChild(li);\n\n \n }", "function updateCartPreview() {\n\n // Get the item and quantity from the form\n\n var productPicked = document.getElementById('items').value;\n var quantityPicked = document.getElementById('quantity').value;\n \n // Add a new element to the cartContents div with that information\n\n var cartPreview = document.getElementById('cartContents');\n var itemInCart = document.createElement('h4');\n\n itemInCart.textContent= 'Item: ' + productPicked + '. Quantity Selected: ' + quantityPicked;\n\n cartPreview.appendChild(itemInCart);\n\n}", "function add() {\n \"use strict\";\n var choice = Math.floor(Math.random() * itemList.length);\n var table = document.getElementById(\"cart\");\n\n if(table.rows.length > 0) {\n $('#pay').prop('disabled', false);\n }\n\n if(cartContains(itemList[choice])) {\n var row = document.getElementById(itemList[choice]);\n // Get Old Info\n var i = row.rowIndex;\n var q = row.cells[3].innerHTML;\n table.deleteRow(i);\n q++;\n } else {\n var i = table.rows.length;\n q = 1;\n cart.push(itemList[choice]);\n }\n var row = table.insertRow(i);\n row.className = \"active\";\n row.id = itemList[choice];\n\n var checkbox = row.insertCell(0);\n var description = row.insertCell(1);\n var price = row.insertCell(2);\n var quantity = row.insertCell(3);\n var total = row.insertCell(4);\n\n checkbox.innerHTML = '<input type=\"checkbox\" name=\"chk\"/>';\n description.innerHTML = itemList[choice];\n price.innerHTML = priceList[choice];\n quantity.innerHTML = q;\n var t = price.innerHTML * quantity.innerHTML;\n total.innerHTML = parseFloat(t).toFixed(2);\n incTotal(price.innerHTML);\n}", "function viewCart() {\n $(\".modal-body\").empty();\n shoppingCart.forEach(product => {\n $(\".modal-body\").append(\n `<div data-name=\"${product.product_name}\">${product.product_name}</div>\n <div data-quantity=\"${product.stock_quantity}\">${product.stock_quantity}</div>`\n );\n });\n\n const total = getTotal();\n\n $(\".modal-body\").append(`<div><hr>$${total}</div>`);\n }", "function addItems() {\n\t\t\t\tvar form = $(psForms.shift());\n\t\t\t\tvar itemid = form.find(\"input[name='pid']\").val();\n\n\t\t\t\t$.ajax({\n\t\t\t\t\tdataType : \"html\",\n\t\t\t\t\turl: addProductUrl,\n\t\t\t\t\tdata: form.serialize()\n\t\t\t\t})\n\t\t\t\t.done(function (response) {\n\t\t\t\t\t// success\n\t\t\t\t\tminiCartHtml = response;\n\t\t\t\t})\n\t\t\t\t.fail(function (xhr, textStatus) {\n\t\t\t\t\t// failed\n\t\t\t\t\tvar msg = app.resources.ADD_TO_CART_FAIL;\n\t\t\t\t\t$.validator.format(msg, itemid);\n\t\t\t\t\tif(textStatus === \"parsererror\") {\n\t\t\t\t\t\tmsg+=\"\\n\"+app.resources.BAD_RESPONSE;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmsg+=\"\\n\"+app.resources.SERVER_CONNECTION_ERROR;\n\t\t\t\t\t}\n\t\t\t\t\twindow.alert(msg);\n\t\t\t\t})\n\t\t\t\t.always(function () {\n\t\t\t\t\tif (psForms.length > 0) {\n\t\t\t\t\t\taddItems();\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tquickView.close();\n\t\t\t\t\t\tminicart.show(miniCartHtml);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}", "function addElementToPage (storeItems, currencyValue, currencySelected) {\n\tif (!currencySelected) {\n\t\tcurrencySelected == 'CAD';\n\t}\n\n\tlet elementBase = protoItem.innerHTML;\t\t\n\tvar storeItem = storeItems;\t\t\n\tcurrencyValue = parseFloat(currencyValue);\n\n\tvar objKeys = Object.keys(storeItems);\n\n\tfor (let i = 0; i < objKeys.length; i++) {\n\t\tif(objKeys[i] == 'price') {\n\t\t\telementBase = elementBase.split('[' + objKeys[i] + ']').join(currencySelected + '$' + (currencyValue * storeItem[objKeys[i]]).toFixed(2));\n\t\t} else {\n\t\t\telementBase = elementBase.split('[' + objKeys[i] + ']').join(storeItem[objKeys[i]]);\t\t\n\t\t}\n\t}\n\tmainItems.innerHTML += elementBase;\n}", "function printCartItems(array) {\n html = '';\n var total = 0;\n for (let obj of array) {\n total += obj.price * obj.quantity;\n console.log(obj);\n html += `\n <div class=\"col-12\">\n <div class=\"row\">\n <div class=\"col-3 border d-flex justify-content-center align-items-center quantity\">\n <i class=\"far fa-times-circle delete-icon\" onclick=\"return removeFromCart(${\n obj.id\n })\"></i>\n <img src=\"${obj.img}\" alt=\"${obj.name}\" class=\"image-cart\"> \n <p class=\"pt-1\"> ${obj.name}<p> \n </div>\n <div class=\"col-3 border d-flex justify-content-center align-items-center\">\n <h5 class=\"text-center\"> ${obj.price}$ </h5>\n </div>\n <div class=\"col-3 border d-flex justify-content-center align-items-center quantity\">\n <i class=\"fas fa-arrow-left\" onclick=\"return decreseQuantity(${\n obj.id\n })\"></i>\n <h5 class=\"text-center\"> ${obj.quantity} </h5>\n <i class=\"fas fa-arrow-right\" onclick=\"return increaseQuantity(${\n obj.id\n })\"></i>\n </div>\n <div class=\"col-3 border d-flex justify-content-center align-items-center\">\n <h5> ${obj.price * obj.quantity} $ </h5>\n </div>\n </div>\n </div>\n\n \n `;\n }\n html += `\n <div class=\"mt-3\">\n <h2> Total: ${total} $ </h2>\n </div>\n <div class=\"row>\n <div class=\"container\">\n <input type=\"button\" id=\"button-buy\" class=\"btn btn-primary my-4\" value=\"Buy\">\n </div>\n </div>\n `;\n $('#products-cart').html(html);\n $('#button-buy').click(function () {\n alert('Thanks for buying');\n clearCart();\n });\n}", "function showModelBox(){\n let itemValue = \"\", totalPrice = 0;\n \n let sight = document.getElementById(\"modelBox\");\n \n sight.style.display = \"block\";\n \n sight = document.getElementById(\"modelContent\").innerHTML = \"<h1>Item Added to cart \" + '<span class=\"badge badge-success\">' + counter() + \"</span>\" + \"</h1>\";\n \n //displaYing how many item Add to cart.\n for(let i = 0; i < itemPurchase.length; i++){\n if(itemPurchase[i].item != undefined && itemPurchase[i].item != itemValue){\n sight = document.getElementById(\"modelContent\").innerHTML += '<p>' + ' <span class=\"badge badge-success\">' + eachItemCountArray[i] + 'x' +'</span>' + '<img src = \"../images/' + itemPurchase[i].imageName + '\" ' + 'alt = \"HP_Notebook_245_G7\">' + itemPurchase[i].item + ' ' + itemPurchase[i].price + \"Rs\" + '</p>' + \"<br>\";\n totalPrice = totalPrice + (+(itemPurchase[i].price) * eachItemCountArray[i]); //golbal variable\n itemValue = itemPurchase[i].item;\n }\n } \n \n sight = document.getElementById(\"modelContent\").innerHTML += '<p>' + 'Total Price = ' + totalPrice.toLocaleString() + ' Rs' +'</p>' + \"<br>\";\n sight = document.getElementById(\"modelContent\").innerHTML += \"<button class = 'btn btn-primary'>Shop Now!</button>\";\n}", "function addItemsToCart(button, products) {\n button.innerText = 'Added to Bag'; // change button text\n let productId = button.dataset.id; // get the id of the button that was clicked\n let product = products.find(product => { // compare if the array id and the returned id are the same\n return product.id === productId;\n });\n product['quantity'] = 1;\n product['discount'] = 0;\n product['total'] = product.price;\n product['discountedTotal'] = product.price;\n\n //add items to local storage\n let items;\n let cartItems = localStorage.getItem('cartItems');\n if (cartItems) {\n items = JSON.parse(cartItems);\n let itemExists = items.find(item => item.id === product.id);\n if (!itemExists) {\n items.push(product);// add product to the array\n }\n localStorage.setItem('cartItems', JSON.stringify(items));\n } else {\n items = [product];\n localStorage.setItem('cartItems', JSON.stringify(items));// put it in local storage\n }\n //send items to cart ui\n sendItemsToCartUI(items);\n grandTotals(items);\n document.querySelector('.cart-items').innerText = items.length;\n // show cart on the screen\n openCart();\n}", "function addToCart1() {\n if ( inputNameEl1.value !== '' ) {\n cartEl1.innerHTML += '<li id=\"' + currentIndex1 + '\"><label class=\"control control--checkbox\">' + inputNameEl1.value + '<input type=\"checkbox\"/><div class=\"control__indicator\"></div></label> <button class=\"removeBtn\" onclick=\"removeFromCart1(' + currentIndex1 + ')\">x</button></li>';\n currentIndex1 += 1;\n //total1 += parseInt(inputPriceEl1.value);\n //totalEl1.innerHTML = total1 ;\n inputNameEl1.value = \"\";\n //inputPriceEl1.value = \"\";\n }\n}", "function addToCart(e) {\n\n let itemContainer = document.createElement('tr');\n let btn = e.target;\n let btnGrandParent = btn.parentElement.parentElement;\n let btnParent = btn.parentElement;\n let itemImage = btnGrandParent.children[0].src;\n let itemName = btnParent.children[0].innerText;\n let itemPrice = btnParent.children[1].innerText;\n\n\n // check if product already in cart\n cartTitles = cartContainer.getElementsByClassName('item-name');\n for (var i = 0; i < cartTitles.length; i++) {\n if (cartTitles[i].innerText == itemName) {\n alert('Product already added to cart. You can change quantity by clicking the arrow in the basket.');\n return;\n }\n }\n\n //make container new html \n itemContainer.innerHTML = `\n <td><input class=\"uk-checkbox\" type=\"checkbox\"></td>\n <td><img class=\"uk-preserve-width uk-border-circle\" src=${itemImage} width=\"100%\" alt=\"\"></td>\n <td class=\"uk-table-link\">\n <h3 class = \"item-name\">${itemName}</h3>\n </td>\n <td class=\"uk-text-truncate item-price\"><h3>${itemPrice}</h3></td>\n <td><input type = 'number' class = 'num' value = '1'></td>\n <td class=\"uk-text-truncate total-price\"><h3>${itemPrice}</h3></td>\n <td><button class=\"uk-button uk-button-danger\" type=\"button\">Remove</button></td>\n`\n\n cartContainer.append(itemContainer)\n\n\n // Accessing individual quantity fields\n for (let i = 0; i < itemQuantity.length; i++) {\n itemQuantity[i].value = 1\n itemQuantity[i].addEventListener('change', totalCost)\n\n }\n\n // Accessing individual quantity fields\n for (let i = 0; i < delete_buttons.length; i++) {\n delete_buttons[i].addEventListener('click', removeItem)\n }\n\n grandTotal()\n\n}", "function cartDisplay() {\n let cartProduct = localStorage.getItem(\"coffeeInCart\");\n cartProduct = JSON.parse(cartProduct);\n let itemsContainer = document.querySelector(\".items-added\");\n let productTotal = localStorage.getItem(\"costTotal\", items.price);\n\n if (cartProduct && itemsContainer) {\n itemsContainer.innerHTML = '';\n Object.values(cartProduct).map(product => {\n itemsContainer.innerHTML += ` \n <tr> \n <td><span>${product.name}</span><i class=\"fas fa-trash-alt\" id=\"deleteBin\"></i></td>\n <td>€${product.price}</td>\n <td><i class=\"cartDecrement fas fa-minus-square\"></i>&nbsp;<span>${product.insideCart}</span>&nbsp;<i class=\"cartIncrement fas fa-plus-square\"></i></td>\n <td>€${product.insideCart * product.price}</td> \n </tr> \n `;\n });\n\n itemsContainer.innerHTML += `\n <tr>\n <p class=\"cartTotalTitle\">\n Total \n </p>\n <p class=\"cartTotalAmount\">\n €${productTotal}\n </p>\n </tr>\n `;\n }\n deleteButton();\n adjustQuantity();\n}", "function showCart(){\n var parentContainer = document.querySelector('div.container')\n var totalItems = 0;\n var totalPrice = 0;\n if(localStorage.getItem('cart')){\n var cart = JSON.parse(localStorage.getItem('cart'))\n }\n else{\n var msg = document.createElement('p');\n msg.textContent = 'Sorry, cart is empty';\n parentContainer.appendChild(msg)\n var totalItemsSpan = document.querySelector('span.total-items')\n var totalItemsPrice = document.querySelector('span.total-price')\n\n totalItemsSpan.textContent = totalItems;\n totalItemsPrice.textContent = totalPrice;\n return;\n } \n \n\n cart.forEach(function(el){\n var productDiv = document.createElement('div');\n\n //Product Name\n var productName = document.createElement('p');\n productName.innerHTML = \"Product Name: <span class='productName'>\" + el['name'] + \"</span>\";\n productDiv.appendChild(productName);\n\n //Product Price\n var productPrice = document.createElement('p');\n productPrice.innerHTML = \"Price: $ <span class='productPrice'>\" + el['price'] + \"</span>\";\n productDiv.appendChild(productPrice);\n // --- add to total price\n totalItems++;\n totalPrice += Number(el['price']);\n\n //Product URL\n var productImage = document.createElement('p');\n productImage.innerHTML = \"See image at: <span class='productImage'>\" + el['url'] + \"</span>\";\n productDiv.appendChild(productImage);\n\n //Add To Cart Button\n var addToCartBtn = document.createElement('button');\n addToCartBtn.textContent = \"Add To Cart\";\n addToCartBtn.setAttribute('class', 'add-to-cart');\n productDiv.appendChild(addToCartBtn);\n\n parentContainer.appendChild(productDiv);\n })\n\n var totalItemsSpan = document.querySelector('span.total-items')\n var totalItemsPrice = document.querySelector('span.total-price')\n\n totalItemsSpan.textContent = totalItems;\n totalItemsPrice.textContent = totalPrice;\n\n}", "function showItems() {\n const qty = getQty()\n cartQty.innerHTML = `You have ${qty} items in your cart.`\n\n let itemStr = ''\n for (let i = 0; i < cart.length; i +=1 ) {\n // Create 3 variables in one ine of code. Only works because cart[i] is an object matching that exact syntax.\n const {name, price, qty} = cart[i]\n\n itemStr += `<li>\n ${name} ${price} x ${qty} = ${qty * price}\n <button class=\"remove\" data-name=\"${name}\">Remove</button>\n <button class=\"add-one\" data-name=\"${name}\"> + </button>\n <button class=\"remove-one\" data-name=\"${name}\"> - </button>\n <input class=\"update\" type=\"number\" min=\"0\" data-name=\"${name}\">\n </li>`\n }\n itemsList.innerHTML = itemStr\n \n const total = getTotal()\n cartTotal.innerHTML = `Total in cart: $${total}`\n}", "function addtocart(event) {\r\n //create a <div> and save it to variable \"row\" \r\n var row = document.createElement('div')\r\n // inside the div saved in row >> add \"cart-row\"\r\n row.classList.add('cart-row')\r\n // in variable \"cartitems\" save the element with class name \"cart-items\"\r\n var cartitems = document.getElementsByClassName('cart-items')[0]\r\n // in variable \"cartnames\" save the elements with class name \"cart-item-title\" that exist in the element we got above \"cartitems\"\r\n var cartnames = cartitems.getElementsByClassName('cart-item-title')\r\n //####################################\r\n //in btn variable save the event target (object) that called this function\r\n var btn = event.target\r\n // in item save the parent element that contained this button that was clicked >>> which is the whole package with imgsrc, title, price, button\r\n var item = btn.parentElement \r\n //in title save the inner text (content) of the class \"shop-package-name\" of the element as a string value\r\n // if we do not tell it to take the No. 0 element the it gets undefined values\r\n var title = item.getElementsByClassName('shop-package-name')[0].innerText\r\n //in price save the inner text (content) of the class \"shop-package-price\" of the element as a string value (since we also have the euro sign inside that text)\r\n var price = item.getElementsByClassName('shop-package-price')[0].innerText\r\n //in imagesrc save the source inside the class \"shop-item-image\" of the element as a url\r\n var imageSrc = item.getElementsByClassName('shop-package-image')[0].src\r\n //inside cartrowcontent we create a new HTML element which is gonna be the extra new html part to be displayed inside our cart\r\n var cartrowcontent = `\r\n <div class=\"cart-item cart-column\">\r\n <!-- we set the image source in our new html part to be the \"imagesrc\" that we got above as a variable from our package -->\r\n <img class=\"cart-item-image\" src=\"${imageSrc}\" width=\"100\" height=\"100\">\r\n <!-- same as image happens with title -->\r\n <span class=\"cart-item-title\">${title}</span>\r\n </div>\r\n <!-- same as title happens with price --> \r\n <span class=\"cart-price cart-column\">${price}</span>\r\n <div class=\"cart-quantity-input cart-column\">\r\n <input class=\"cart-quantity-input\" type=\"number\" value=1>\r\n <button class=\"btn btn-remove\" type=\"button\">Remove from card</button>\r\n </div>`\r\n //change the html code inside the variable row (we created it at the beginning of the function) and instead put inside the new html part above\r\n row.innerHTML = cartrowcontent\r\n //add the content of \"row\"(the above that now has the new html) to the list of cartitems that holds all cart-items inside our cart\r\n cartitems.append(row)\r\n //call the function \"updatecart\" in order to update the total price after we have added the new item in our cart\r\n updatecart()\r\n //the same way we have done in our main program we now create a new event listener to wait for clicks on btn-remove or change in value of quantity >>\r\n //of our new element that we have created inside our cart that has a button to remove and a quantity to change\r\n row.getElementsByClassName('btn-remove')[0].addEventListener('click', removeitem)\r\n // the change in value of cart-quantity-input can happen either by typing a number inside the box or clicking on up&down arrows (the default quantity is set to 1)\r\n row.getElementsByClassName('cart-quantity-input')[0].addEventListener('change', updatecart)\r\n}", "function addItemToCart() {}", "function addItemToCart() {}", "function addToCart() {\n const open = document.querySelector(\"#open\");\n\n open.addEventListener(\"click\", (e) => {\n //img\n let fullPath =\n e.target.parentElement.parentElement.children[0].children[0].children[0]\n .src;\n let position = fullPath.indexOf(\"img\");\n let partialPath = fullPath.slice(position);\n\n const item = {};\n item.img = partialPath;\n\n //name\n let name =\n e.target.parentElement.parentElement.children[1].children[0].children[0]\n .textContent;\n item.name = name;\n\n //price\n let price =\n e.target.parentElement.parentElement.children[1].children[0].children[1]\n .children[0].textContent;\n item.price = +price;\n\n const cartItem = document.createElement(\"div\");\n cartItem.className = \"cart-item d-flex pb-3\";\n\n cartItem.innerHTML = `\n <img src=\"${item.img}\" class=\"img-fluid mx-3\" alt=\"plant\" style=\"width:70px;height:70px\">\n <div class=\"item-text \">\n <p class=\"text-uppercase font-weight-bold m-0 p-0\" id=\"cart-item-title\">${item.name}</p>\n <p class=\"font-weight-bold m-0 p-0\">$<span id=\"cart-item-price\">${item.price}</span></p>\n <p class=\"m-0 p-0\">qty: <span id=\"cart-item-qty\">1</span>\n </p>\n `;\n\n const cartModal = document.querySelector(\".cart-modal\");\n const total = document.querySelector(\"#cart-subtotal-container\");\n\n cartModal.insertBefore(cartItem, total);\n showTotals();\n });\n}", "function addItem(){\n var item = document.getElementById(\"newItemName\")\n itemsInCart.push(item.value)\n\n var quantity = document.getElementById(\"quantity\")\n quantityPerItem.push(parseInt(quantity.value))\n\n var price = document.getElementById(\"pricePerUnit\")\n var totalPrice = price * quantity\n pricePerItem.push(parseInt(totalPrice.value))\n\n addItemToCart()\n\n}", "function addtoCart() {\n // Get Product Name & Price\n let pName = document.getElementById(\"product-title-name\").textContent;\n let pPrice = document.getElementById(\"product-price\").textContent;\n let pImage = document.getElementById(\"image-src\").src;\n // Dincamicaly create li structure\n let ul = document.getElementById(\"shopping-cart-items\");\n\n const li = document.createElement('li');\n li.className = \"clearfix\";\n\n let img = document.createElement(\"img\");\n img.src = pImage;\n img.height = 70;\n img.width = 90;\n li.appendChild(img);\n\n const item_content = document.createElement('div');\n item_content.className=\"shop-item-content\";\n\n const item_name = document.createElement('span');\n item_name.className = \"item-name\";\n let text_item_name = document.createTextNode(pName);\n item_name.appendChild(text_item_name);\n item_content.appendChild(item_name);\n\n const item_price = document.createElement('span');\n item_price.className = \"item-price\";\n let text_item_price = document.createTextNode(pPrice);\n item_price.appendChild(text_item_price);\n item_content.appendChild(item_price);\n\n const item_remove = document.createElement('a');\n item_remove.onclick = e => {\n e.target.parentNode.parentNode.remove();\n count--;\n updateCount(count);\n };\n\n item_remove.className = \"item-quantity\";\n let text_item_remove = document.createTextNode(\"⊗ Remove\");\n item_remove.appendChild(text_item_remove);\n item_content.appendChild(item_remove);\n\n li.appendChild(item_content);\n ul.appendChild(li);\n\n count++;\n updateCount(count);\n\n window.alert(\"Item added to basket !\");\n}", "function addItemsToUI(products) {\n let productsHtmlString = '';\n products.map((product, index) => {\n let productString = `\n <article class=\"product\">\n <div class=\"img-container\">\n <img src=\"${product.image}\" alt=\"${product.title}\" class=\"product-img\">\n <button class=\"bag-btn\" data-id=\"${product.id}\"><i class=\"fas fa-shopping-cart\"></i>add to bag</button>\n </div>\n <h3>${product.title}</h3>\n <h4>$${product.price}</h4>\n </article>`;\n productsHtmlString += productString;\n });\n // send data to the UI\n document.querySelector('.products-center').innerHTML = productsHtmlString;\n}", "function addFoodList(){\n var pricing = getPrice[0].innerHTML;\n var priceVal = pricing.replace(/[^0-9.]/g, \"\");\n var getting = priceVal * getValue;\n var newLine = '<div class=\"orderBox\">';\n newLine += '\t <p class=\"nameOfFood\">';\n newLine += look[\"0\"].textContent +' x '+ getValue ;\n newLine +=' $ '\n newLine += ' <span class = subtotal>'\n newLine += parseFloat(getting);\n newLine += ' </span>'\n newLine += ' </p>';\n newLine += ' <div class= \"closeBtn\">';\n newLine += ' <i class=\"fa fa-times closing\"></i>'\n newLine += ' </div>'\n newLine += '</div>';\n $('.foodList').append(newLine);\n deleteItem ();\n lengthCheck();\n } // fires in line 44", "function addColours() {\n\n // Remove all objects currently added to cart\n var section = document.getElementById(\"cart\");\n while (section.firstChild) {\n section.removeChild(section.firstChild);\n }\n \n var count = $('.count').val();\n var i ;\n\n for (i = 0; i < count; i++) {\n // Add to shopping cart array\n var newItem = new Item(selectedColour,selectedColourName,count,newPrice,undsicountedPrice)\n shoppingCart.push(newItem);\n }\n\n totalUndiscountedPrice=0;\n totalDiscountedPrice=0;\n\n for (i = 0; i < shoppingCart.length; i++) {\n\n // Add items in cart to details\n var section = document.getElementById(\"cart\");\n var circle = document.createElement(\"SPAN\");\n circle.classList=\"dot outside nohover\";\n var innerCircle = document.createElement(\"SPAN\");\n innerCircle.classList=\"dot inside nohover\";\n\n // innerCircle.style=\"background-color:\"+selectedColour;\n innerCircle.style=\"background-color:\"+shoppingCart[i].colour;\n\n circle.appendChild(innerCircle);\n section.appendChild(circle);\n\n //Change prices to be displayed\n totalDiscountedPrice=totalDiscountedPrice+ Number(shoppingCart[i].newPrice);\n totalUndiscountedPrice=totalUndiscountedPrice+Number(shoppingCart[i].oldPrice);\n }\n\n // Remove decimal spaces\n totalDiscountedPrice=(totalDiscountedPrice).toFixed(2);\n totalUndiscountedPrice=totalUndiscountedPrice.toFixed(2);\n\n // Checkout\n if ($('.count').val() > 0) {\n $(\".discountedPrice\").html(\"$\"+totalDiscountedPrice); // Discounted Price\n $(\".originalPrice\").html(\"$\"+totalUndiscountedPrice); // Undiscounted Price\n $(\".items\").html(shoppingCart.length); // Amount of items in basket\n\n // Add checkout button\n $(\".checkout.btn.cart\").addClass(\"display\");\n }\n\n modal.style.display = \"none\";\n}", "addOnproductPage() {\n let contain = document.getElementById(\"contain-product\")\n\n const insertHTML = \n `<div class=\"card-product card-responsive\">\n <div class=\"picture-box\">\n <img src=\"${this.imageUrl}\" alt=\"${this.name}\" class=\"picture-teddy\">\n </div>\n <div class=\"product-info\">\n <div class=\"product-name\">\n <h2>${this.name}</h2>\n <div>\n <i class=\"fas fa-paw\"></i>\n <i class=\"fas fa-paw\"></i>\n <i class=\"fas fa-paw\"></i>\n <i class=\"fas fa-paw\"></i>\n <i class=\"fas fa-paw\"></i>\n </div>\n </div>\n <p>${this.description}</p>\n <div class=\"contain-color\" class=\"all-colors\">\n <select name=\"colors\" id=\"colors\" required>\n \n </select>\n </div>\n <span>Quantité :\n <input type=\"number\" id=\"quantity\" name=\"quantity\" min=\"1\">\n </span>\n <span class=\"price\">${(Math.round(this.price) / 100).toFixed(2).replace(\".\",\",\")} €</span>\n <button class=\"add-btn\" id=\"confirm-box\">\n <span>Ajouter au panier</span>\n </button>\n </div>\n </div> `\n contain.innerHTML += insertHTML\n let choice = contain.querySelector(\"#colors\");\n this.colors.forEach (function (colors) {\n let option = document.createElement(\"option\");\n option.value = colors;\n option.textContent = colors;\n choice.appendChild(option);\n })\n\n let customerChoise = document.querySelector(\".add-btn\");\n\n customerChoise.addEventListener('click', () => {\n\n //Récupération choix couleur et stockage dans variable global this\n this.colorChoice = document.querySelector(\"#colors\");\n this.colorChoice = this.colorChoice.options[this.colorChoice.selectedIndex].value;\n\n //Récupération quantité et stockage dans variable global this\n this.quantityChoice = parseInt(document.getElementById(\"quantity\").value);\n \n //Appel de la fonction d'ajout au panier si la quantité est suffisante\n if (this.quantityChoice >= 1) {\n addToBasket(this);\n setTimeout(\"messageTeddy()\", 400);\n //Sinon renvoi un message d'erreur \n } \n else {\n messageTeddyError()\n }\n\n }) \n }", "function appendToCart(){\n ui.cartItems.innerHTML = \"\";\n cart.forEach((item)=>{\n ui.appendToCart(item.imgSrc,item.title,item.size,item.price,item.id,item.numberOfUnits);\n })\n}", "function displayCartItems(){\n\n //get cart from local storage\n let cart = localStorage.getItem(\"cart\"); \n \n // split contents of cart local storage into 1d array\n let bookList = cart.split('@@@');\n var quantity = [];\n var cList = \"\";\n \n // Change the 1 outer array into 2 dim array\n // and create a HTML list\n for (let z = 0; z<bookList.length;z++)\n {\n bookList[z] = bookList[z].split('$$$');\n quantity[z] = bookList[z][1]; //count\n let currentBook = StringToJSON(bookList[z][0]);\n cList += \"<p>\";\n cList += currentBook.title;\n cList += \"<span class = 'price'>\"\n cList += quantity[z];\n cList += \" x $\"\n cList += currentBook.price;\n cList += \"</span></p>\"; \n }\n \n // Get total price\n var cartTotal = parseInt(localStorage.getItem(\"cartTotal\"));\n var tax = 0.0635;\n var shipping = 4.99\n \n\t// Display the table\n\tdocument.getElementById(\"checkoutList\").innerHTML = cList; \n document.getElementById(\"checkoutSubtotal\").innerHTML = \"$\" + cartTotal.toFixed(2);\n document.getElementById(\"taxes\").innerHTML = \"$\" + (cartTotal * tax).toFixed(2);\n document.getElementById(\"shipping\").innerHTML = \"$\" + 4.99;\n document.getElementById(\"checkoutTotalPrice\").innerHTML = \"$\" + totalCost();\n localStorage.setItem(\"totalPrice\",((parseInt(cartTotal)* 1.0635)+4.99).toFixed(2));\n \n}", "function addItem() {\r\n // finds the food item (which is the next element after the button)\r\n var foodItem = event.target.nextElementSibling;\r\n // Finds the id of the above foodItem variable\r\n var foodID = foodItem.id;\r\n // Gets all the child nodes the foodItem variable\r\n var foodDescription = foodItem.cloneNode(true);\r\n // Stores the location of the cart in the page\r\n var cartBox = document.getElementById(\"cart\");\r\n // Sets the initial value of whether an item is a duplicate to false\r\n var duplicateOrder = false;\r\n // Will check to see if the foodItem has been clicked before, in which case it will increase the number of orders, rather than add another element.\r\n for (var i = 0; i < cartBox.children.length; i++) {\r\n if (cartBox.children[i].id === foodID) {\r\n cartBox.children[i].firstElementChild.textContent++;\r\n duplicateOrder = true;\r\n break;\r\n }\r\n }\r\n // If duplicateOrder is still false, a span element is added, which includes the foodItem.\r\n if (duplicateOrder == false) {\r\n var orderCount = document.createElement(\"span\");\r\n orderCount.textContent = 1;\r\n foodDescription.prepend(orderCount);\r\n cartBox.appendChild(foodDescription);\r\n }\r\n}", "function loadCartItems() {\n subTotal = 0;\n carts = JSON.parse(sessionStorage.getItem(\"carts\")); //Get the cart object from sessionStorage\n // load the items in cart in the DOM for display on the UI\n let cartElement = document.getElementById(\"itemNos\");\n // Sizing the div to accomodate the no of items in the cart\n let strhtml = '<b>%itemCount%</b>';\n //Display the item count in the cart\n let strhtml2 = strhtml.replace(\"%itemCount%\", carts.length);\n // Insert the item count next to the cart icon in the DOM\n cartElement.insertAdjacentHTML(\"afterend\", strhtml2);\n cartElement = document.getElementById(\"total\");\n //Next, display all the items in the cart\n carts.forEach((itemCart, i) => {\n let strhtml = '<p><a href=\"#\">%itemDescription%</a> <span class=\"price\">%itemTotal%</span></p>'\n // Insert the HTLM statement for the items in the cart\n let strhtml2 = strhtml.replace(\"%itemDescription%\", itemCart.itemDescription);\n strhtml2 = strhtml2.replace(\"%orderQty%\", itemCart.orderQty);\n strhtml2 = strhtml2.replace(\"%itemTotal%\", formatNumber((itemCart.orderQty * itemCart.price)));\n cartElement.insertAdjacentHTML(\"afterbegin\", strhtml2);\n subTotal += Number(itemCart.price * itemCart.orderQty);\n\n }) // end of forEach\n if (document.querySelector(\"#homeDelivery\").checked) {\n deliveryCost = 500;\n } else {\n deliveryCost = 100;\n }\n totalAmt = subTotal + deliveryCost\n vat = totalAmt * 0.17; // VAT at 17%\n totalAmt += vat;\n cartElement = document.getElementById(\"cart\");\n // Sizing the div to accomodate the no of items in the cart\n strhtml = '<p>Delivery Cost <span class=\"price\" id=\"delivery\" style=\"color:black\"><b>%deliveryCost%</b></span></p>';\n //Display the item count in the cart\n strhtml2 = strhtml.replace(\"%deliveryCost%\", formatNumber(deliveryCost.toFixed()));\n // Insert the delivery cost, right after the cart items list\n cartElement.insertAdjacentHTML(\"beforeend\", strhtml2);\n strhtml = '<p>VAT @17% <span class=\"price\" id=\"vat\" style=\"color:black\"><b>%vat%</b></span></p>';\n //Display the item count in the cart\n strhtml2 = strhtml.replace(\"%vat%\", formatNumber(vat.toFixed()));\n // Insert the VAT cost, right after delivery cost\n cartElement.insertAdjacentHTML(\"beforeend\", strhtml2);\n\n cartElement = document.getElementById(\"cart\");\n // Sizing the div to accomodate the no of items in the cart\n strhtml = '<p>Total <span class=\"price\" id=\"totalAmt\" style=\"color:black\"><b>%totalAmt%</b></span></p>';\n //Display the item count in the cart\n strhtml2 = strhtml.replace(\"%totalAmt%\", formatNumber(totalAmt));\n // Insert the total cost, after vat\n cartElement.insertAdjacentHTML(\"beforeend\", strhtml2);\n}", "function updateShoppingCart(addQty) {\n\tvar totalItems = getTotalItemsCart() + addQty;\n\tdocument.getElementById('shopping-cart-text').innerHTML = totalItems + ' items';\n}", "function displayCart() {\n // elements variables\n\tlet newElement,\n\t\tc_tr,\n\t\tc_th,\n\t\tc_td,\n cartDiv,\n cartTable;\n // increament and total variables\n let count = 1,\n subTotal = 0,\n totalPrice = 0;\n\n\tcartDiv = document.getElementById(\"cart\"); // Cart HTML element\n\n\tif (Object.entries(cartItems).length === 0) {\n\t\tcartDiv.innerHTML = \"Cart is empty!\";\n\t} else {\n\t\t// add cart items:\n\t\tcartDiv.innerHTML = \"\";\n\t\tcartTable = document.createElement(\"table\");\n\t\tcartTable.className = \"table table-sm\";\n\t\tcartTable.innerHTML = `\n <thead>\n <tr>\n <th scope=\"col\">No.</th>\n <th scope=\"col\">Item Name</th>\n <th scope=\"col\">Quantity</th>\n <th scope=\"col\">Price</th>\n <th scope=\"col\">Total</th>\n <th scope=\"col\">Action</th>\n </tr>\n </thead> `;\n\n\t\tcartTableBody = document.createElement(\"tbody\");\n // iterating through cartItems to disply in the table body.\n\t\tfor (let key in cartItems) {\n // calculating subTotal and totalPrice\n\t\t\tsubTotal = products[key].price * cartItems[key];\n\t\t\ttotalPrice += subTotal;\n\n\t\t\tc_tr = document.createElement(\"tr\");\n\t\t\tc_th = document.createElement(\"th\");\n\t\t\tc_th.scope = \"row\";\n\t\t\tc_th.innerHTML = count;\n\t\t\tc_tr.appendChild(c_th);\n\n\t\t\tc_td = document.createElement(\"td\");\n\t\t\tc_td.innerHTML = products[key].name; // item name\n\t\t\tc_tr.appendChild(c_td);\n\t\t\t\n\t\t\tc_td = document.createElement(\"td\");\n\t\t\tnewElement = document.createElement(\"input\"); // item quantity element\n\t\t\tnewElement.id = \"itemQuantity\";\n\t\t\tnewElement.type = \"number\";\n\t\t\tnewElement.min = 1;\n\t\t\tnewElement.dataset.id = key;\n\t\t\tnewElement.value = cartItems[key];\n\t\t\tnewElement.addEventListener(\"change\", updateTotals); // updating cart if quantity changes\n\t\t\tnewElement.innerHTML = cartItems[key];\n\t\t\tc_td.appendChild(newElement);\n\t\t\tc_tr.appendChild(c_td);\n\n\t\t\tc_td = document.createElement(\"td\");\n\t\t\tc_td.innerHTML = `$${products[key].price}`; // item price\n\t\t\tc_tr.appendChild(c_td);\n\n\t\t\tc_td = document.createElement(\"td\");\n c_td.id = `subTotal_${key}`;\n\t\t\tc_td.innerHTML = `$${subTotal}`; // item subTotal\n\t\t\tc_tr.appendChild(c_td);\n\n\t\t\tc_td = document.createElement(\"td\");\n\t\t\tnewElement = document.createElement(\"button\");\n\t\t\tnewElement.innerHTML = \"X\";\n\t\t\tnewElement.type = \"button\";\n\t\t\tnewElement.dataset.id = key;\n\t\t\tnewElement.className = \"btn btn-danger btn-sm\";\n\t\t\tnewElement.addEventListener(\"click\", removeFromCart); // removing item from Cart if clicked. \n\t\t\tc_td.appendChild(newElement);\n\t\t\tc_tr.appendChild(c_td);\n\n\t\t\tcartTableBody.appendChild(c_tr);\n\t\t\tcount += 1; // items counter\n\t\t}\n\n\t\tcartTable.appendChild(cartTableBody);\n\t\tcartDiv.appendChild(cartTable);\n\n\t\t//displaying Total\n\t\tnewElement = document.createElement(\"div\");\n newElement.id = `total`;\n\t\tnewElement.className = \"container text-end\";\n\t\tnewElement.innerHTML = `<h5 class=\"me-5\">Total : $${totalPrice}<h5>`;\n\t\tcartDiv.appendChild(newElement);\n\t}\n}", "function showCollectForm() {\r\n\r\n document.getElementById(\"collectChoice\").style.display = \"inline\";\r\n cartPrice.innerHTML = \"Total: R\" + collectSum + \" (R25.00 charge for collection has been added)\";\r\n PriceStyler();\r\n}", "function addToCartClicked(event) {\r\n let button = event.target;\r\n console.log(button);\r\n\r\n let productContentBox =\r\n button.parentElement.parentElement.parentElement.parentElement.parentElement\r\n .parentElement;\r\n console.log(productContentBox);\r\n let name = productContentBox.getElementsByClassName(\"pc_name_price\")[0]\r\n .firstElementChild.innerText;\r\n let size = button.innerText;\r\n let color = productContentBox\r\n .getElementsByClassName(\"pc_details\")[0]\r\n .getElementsByTagName(\"span\")[1].innerText;\r\n let price = productContentBox\r\n .getElementsByClassName(\"pc_details\")[0]\r\n .getElementsByTagName(\"span\")[0].innerText;\r\n let imageSrc = productContentBox.getElementsByTagName(\"img\")[0].src;\r\n addItemToCart(name, color, price, imageSrc, size);\r\n updateCartTotal();\r\n}", "function showItems(){\n const qty = getQty()\n const total = getTot()\n\n cartQty.innerHTML = `you have ${qty} items in your cart`\n \n let itemStr = ''\n for(let i = 0; i < cart.length; i += 1){\n // assigns each of these variables in the curly braces to cart[i]\n const {name, price, qty} = cart[i]\n\n itemStr += `<li>\n ${name} $${price} x ${qty} = ${qty * price}\n <button class=\"remove\" data-name=\"${name}\"> Remove </button>\n <button class=\"add-one\" data-name=\"${name}\"> + </button>\n <button class=\"remove-one\" data-name=\"${name}\"> - </button>\n <input class=\"update\" type=\"number\" data-name=\"${name}\">\n </li>`\n }\n itemList.innerHTML = itemStr\n cartTotal.innerHTML = `Total in cart: $${total}`\n}", "function cartList() {\n getCart();\n let productsId = 0;\n let sum = 0; //the total value in € of the cart\n\n cart.forEach((product) => {\n $(\"#cartList\").prepend(\n `<div id=\"cartProduct${productsId}\" class=\"cartProduct\">\n <img class=\"cartImage\" src=\"${product.image}\" alt=\"cartImage${productsId}\"></img>\n <p class=\"cartName\">${product.title}</p>\n <div class=\"amountBox\">\n <button type=\"button\" id=\"cartProduct${productsId}Plus\" class=\"plusAndMinus, btn\" onclick=\"changeAmount(${productsId},1)\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-plus-circle\" viewBox=\"0 0 16 16\">\n <path d=\"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z\"/>\n <path d=\"M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z\"/>\n </svg></button>\n <p id=\"amount${productsId}\" class=\"amountText\">${product.amount}</p>\n <button type=\"button\" id=\"cartProduct${productsId}Minus\" class=\"plusAndMinus, btn\" onclick=\"changeAmount(${productsId},-1)\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-dash-circle\" viewBox=\"0 0 16 16\">\n <path d=\"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z\"/>\n <path d=\"M4 8a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7A.5.5 0 0 1 4 8z\"/>\n </svg></button></div>\n <p class=\"cartPrice\">${product.price} €</p>\n <button\n type=\"button\"\n class=\"btn btn-primary , removeButton\"\n id=\"removeProduct${productsId}\"\n onclick=\"removeFromCart(${productsId})\">\n REMOVE>\n </button>\n </div>`\n ) && productsId++;\n sum += product.price * product.amount;\n });\n\n totalSum(sum);\n}", "function addItem(e) {\r\n // Gets the description of the food item using the nextElementSibling property \r\n var foodItem = e.target.nextElementSibling;\r\n\r\n // Contains the value of the id attribute for foodItem \r\n var foodID = foodItem.id;\r\n\r\n // Creates a copy of the foodItem \r\n var foodDescription = foodItem.cloneNode(true);\r\n\r\n // Gets the shopping cart by its ID \r\n var cartBox = document.getElementById(\"cart\");\r\n\r\n // Tests whether the customer has already ordered this product \r\n var duplicateOrder = false;\r\n\r\n // Loops through the element child nodes of cartBox \r\n for (var i = 0; i < cartBox.childNodes.length; i++) {\r\n // Checks if the ID of the element node is equal to foodID \r\n if (cartBox.childNodes[i].id === foodID) {\r\n // // Increases the value of the first element child of node by 1 \r\n cartBox.childNodes[i].firstElementChild.textContent++;\r\n\r\n // Changes dupliacteOrder to true so the order isn't added to cartBox twice \r\n duplicateOrder = true;\r\n\r\n break;\r\n }\r\n }\r\n\r\n // Tests whether duplicateOrder is still false \r\n if (duplicateOrder === false) {\r\n // Creates a variable storing a span element node \r\n var orderCount = document.createElement(\"span\");\r\n\r\n // Sets the text content of the orderCount element to 1 \r\n orderCount.textContent = 1;\r\n\r\n // Inserts orderCount as the first child of the foodDescription node \r\n foodDescription.prepend(orderCount);\r\n\r\n // Appends foodDescriptino to cartBox as a new product order \r\n cartBox.appendChild(foodDescription);\r\n }\r\n}", "function calculateTotal(){\n let totalPrice = 0;\n $('#myCart #item').each(function(){\n totalPrice = totalPrice + $(this).data('price');\n })\n $('#price').text(`Total Price:Rs.${totalPrice}/-`)\n }", "function displayCurrentProduct(curTed) {\n\n //add current product information (title, image etc.) to the card.\n let img = document.getElementsByClassName('bImg');\n img[0].src = curTed.imageUrl;\n \n let name = document.getElementsByClassName('bTitle');\n name[0].textContent = curTed.name;\n \n let getText = document.getElementsByClassName('bText');\n getText[0].textContent = curTed.description;\n\n let price = document.getElementsByClassName('bPrice');\n price[0].textContent = curTed.price / 100 + \" €\";\n\n let getOpt = document.getElementsByClassName('bOption');\n\n //Add options to customize the product\n AddColorOption(curTed, getOpt[0]); \n AddQtyOption(stock, getOpt[1]);\n\n //add the product if user click on the add product button\n let getCart = document.getElementById(\"btnAddCart\");\n getCart.addEventListener('click', () =>{\n\n StoreProductInCart(curTed, getOpt); \n });\n \n}", "function updateDisplay() {\r\n fields = new Array();\r\n var cartArray = cart.getCartArray();\r\n var shipping = 5;\r\n var itemQty = 0;\r\n var productPr = 0;\r\n var total = 0;\r\n var tax = 0.0775;\r\n \r\n // var ProductPrice = 0;\r\n if(cart.size()==0){\r\n var toWrite = \"<div class='container jumbotron'>\";\r\n toWrite += \"<hr/>\";\r\n toWrite += \"<div><p id='no_items'> There are no items in your cart. Shop Now!</p></div><br>\";\r\n //toWrite += \"<input type='button' class='buttonshop' id='buttonShop' value='Shop Now!'>\";\r\n toWrite += \"<a href='http://jadran.sdsu.edu/jadrn030/list.html'><button class='button' type='button'>Shop Now!</button></a><br><br><br><br>\";\r\n toWrite += \"</div>\";\r\n \r\n $('#cartsummary').html(toWrite); \r\n $('#count').text(cart.size()); \r\n } // end of if\r\n\r\n else {\r\n var toWrite = \"<div class='container'>\";\r\n toWrite += \"<table class='table'>\";\r\n toWrite += \"<thead><tr><th>Product</th><th>SKU</th><th>Quantity</th><th>Total Cost</tr></thead>\";\r\n var cartArray = cart.getCartArray();\r\n for(var i=0; i < cartArray.length; i++) {\r\n var sku = cartArray[i][0];\r\n itemQty += parseInt(cartArray[i][2]);\r\n var costPrice;\r\n smallSKU = cartArray[i][0];\r\n toLowerCase = smallSKU.toLowerCase();\r\n proj4_data[i] =\r\n costPrice=parseFloat(cartArray[i][1]/itemQty);\r\n var costProduct = cartArray[i][2] * costPrice;\r\n total += costProduct;\r\n \r\n toWrite += \"<tbody>\";\r\n toWrite += \"<tr>\";\r\n toWrite += \"<td><img src=/~jadrn030/abccba/\"+toLowerCase+\" width=120px height=auto></td>\";\r\n toWrite += \"<td>\"+cartArray[i][0]+\"</td>&nbsp;\";\r\n //toWrite += \"<td>\"+costPrice+\"</td>\";\r\n toWrite += \"<td>\"+cartArray[i][2]+\"</td>\";\r\n toWrite += \"<td>\"+costProduct.toFixed(2)+\"</td>\";\r\n \r\n } // end of for\r\n \r\n var totalTax = total * tax;\r\n var finalPrice = total + shipping + totalTax;\r\n \r\n toWrite += \"</tr><br>\";\r\n toWrite += \"<td><span><b> Total: $\"+total.toFixed(2)+\"</b></span></td></tr>\";\r\n toWrite += \"<tr><td><span><b>Shipping Charges: $5.00</b></span></td>\";\r\n toWrite += \"<td><span><b> Tax (7.75%): $\"+totalTax.toFixed(2)+\"</b></span></td>\";\r\n toWrite += \"<td><span><b> Order Total(including shipping Charge and tax): $\"+finalPrice.toFixed(2)+\"</b></span></td></tr>\";\r\n //toWrite += \"<tr><td><a href='http://jadran.sdsu.edu/jadrn030/list.html'><button type='button' class='button'>Add more items</button></a>&nbsp;&nbsp;&nbsp;&nbsp;<button type='button' class='button' id='check_out'>Proceed to Checkout</button></td></tr>\";\r\n toWrite += \"<tbody>\";\r\n toWrite += \"</table>\"; \r\n toWrite += \"</div><br><br>\";\r\n\r\n $('#cartsummary').html(toWrite); \r\n $('#count').text(cart.size()); \r\n\r\n localStorage.setItem('imageSKU', toLowerCase);\r\n localStorage.setItem('sku', smallSKU);\r\n localStorage.setItem('total', total);\r\n localStorage.setItem('shippingcost', shipping);\r\n localStorage.setItem('tax', tax);\r\n localStorage.setItem('total', total);\r\n\r\n $( \"#check_out\").click(function() {\r\n window.location.href =\"http://jadran.sdsu.edu/jadrn030/checkoutpage.html\";\r\n }); // end of click \r\n\r\n } // end of else\r\n\r\n }", "function updateProductDisplay() {\r\n let displayEl = document.getElementById(\"display-row\");\r\n displayEl.innerHTML = \"\"; \r\n\r\n shopProducts.forEach(function(itemsInProductStorage){\r\n displayProductDetails(itemsInProductStorage, displayEl);\r\n });\r\n\r\n //to add from product display to cart\r\n const addToCart = document.querySelectorAll(\".btn-center\");\r\n\r\n addToCart.forEach(element => { \r\n element.addEventListener(\"click\", function() {\r\n let secondChild = element.parentNode.children[1];\r\n productName = secondChild.children[0].textContent;\r\n productPrice = secondChild.children[1].textContent;\r\n let formattedPrice = productPrice.replace('#','').replace(',','');\r\n let priceInNumber = parseFloat(formattedPrice);\r\n let productId = secondChild.children[2].getAttribute('data-id');\r\n \r\n const product = {\r\n 'name': productName,\r\n 'price': priceInNumber,\r\n 'id': productId,\r\n 'quantity' : 1\r\n \r\n }\r\n \r\n addProductToStorage(product);\r\n setCartItemsLS();\r\n updateCart();\r\n updateSubTotal();\r\n \r\n \r\n console.log(cartItems); \r\n \r\n });\r\n \r\n \r\n });\r\n}", "addToCart(product) {\n let tr = document.createElement(\"tr\");\n tr.className = \"text-center item\";\n tr.innerHTML = `\n <th scope=\"row\">${(item_no += 1)}</th>\n <td><img class=\"img-table\" src=\"${\n product.product_img\n }\" alt=\"\"></td>\n <td class=\"item-name\">${product.product_name}</td>\n <td>${product.product_price}</td>\n <td id = \"p-quantity\"><input type=\"button\" id=\"quantity-minus\" value=\"-\"> <span class=\"item-quantity\">1</span> <input type=\"button\" id=\"quantity-plus\" value=\"+\"></td>\n <td id=\"updated-price\">${product.product_price}</td>\n <td><a class=\"link-danger text-decoration-none\" href=\"#\">X</a></td>\n `;\n\n let total = product.product_price;\n table.appendChild(tr);\n\n this.totalPricePlus(total);\n }", "function addToCart(){\n//the function to add chosen door to a cart\n//and put it to a LOCAL STORAGE\nvar chosenItem = this.getAttribute('data-button-propName'); // chosen item is an unique item, chosen with a button click and added to CARTFORITEMS object\n if(cartForItems[chosenItem] != undefined){\n cartForItems[chosenItem] = cartForItems[chosenItem]+1;\n }else{\n cartForItems[chosenItem] = 1;\n }\n totalPrice += priceCollector[chosenItem].price;\nlocalStorage.setItem('addedToCartItems', JSON.stringify(cartForItems));\nlocalStorage.setItem('addedTotalPrice', JSON.stringify(totalPrice));\nconsole.log(cartForItems[chosenItem]);\nconsole.log(totalPrice);\nshowItemsInCart();\nrenderDiv();\n}", "function addSelectedItemToCart() { \n var itemsEl = document.getElementById('items').value;\n var quantityEl = document.getElementById('quantity').value;\n cart.addItem(itemsEl, parseInt(quantityEl));\n // console.log(cart.items[0].product);\n // console.log(cart.items[0].quantity); \n}", "function resToCartClicked(e){\n const button = e.target;\n const item = button.closest(\".detalle__compra\");\n const itemPrecio = Number(item.querySelector(\".precio\").textContent.replace(\"$\",\"\"));\n const itemProdId = Number(item.querySelector(\".idProdCarrito\").textContent);\n const precios = item.querySelector(\"#precios\");\n const cantidad = item.querySelector(\"#cantidad\");\n itemCantidad= Number(cantidad.value)-1;\n if(cantidad.value >= 1 & nuevasub > 0){\n cantidad.value = itemCantidad;\n }\n if(itemCantidad >= 0){\n sumaItem(itemProdId,itemCantidad);\n nuevasub = nuevasub - itemPrecio;\n precios.innerHTML = `<p>\n $${cantidad.value * itemPrecio}\n </p>`\n \n subTotal.innerHTML = `<h3>Subtotal</h3>\n <p>$${nuevasub}</p>`\n total.innerHTML = `<h2>Total</h2>\n <p>$${nuevasub}</p>`\n };\n}", "function calculateTotal() {\n\t if(validQuantities == false)\n\t\t\treturn; \n\t var totalPrice = 0;\n\t\tfor (var i = 0; i< items.length; i++){\n\t\t\tvar size = document.forms[formName][sizeName[i]].value;\n\t\t\tvar quantity= parseInt(document.forms[formName][numberName[i]].value, 10);\n\t\t\tvar itemPrice = 0;\n\t\t\tconsole.log(size + \",\" + quantity.toString() +\",\" + i.toString());\n\t\t\tif(size==\"small\") {\n\t\t\t\titemPrice = quantity * smallPrices[i];\n\t\t\t}\n\t\t\tif(size == \"medium\") {\n\t\t\t\titemPrice = quantity * mediumPrices[i];\n\t\t\t}\n\t\t\tif(size == \"large\") {\n\t\t\t\titemPrice = quantity * largePrices[i];\n\t\t\t}\n\t\t\ttotalPrice += itemPrice;\n\t\t}\n\t\ttotalPrice += mayoCost + seasoningCost + ketchupCost;\n\t\tdocument.getElementById(\"total\").innerHTML = \"<strong><u>Your Total is $\" + totalPrice.toString() + \"</strong></u>\";\n\t\treturn totalPrice;\n}", "function estructuraPrincipalCarrito() {\n estructuraGeneral = \"\";\n for (i = 0; i < carrito.length; i++){\n estructuraGeneral += '<div id=\"itemID-' + carrito[i].id + '\" class=\"chopping-item\">'+ estructuraPrincipalItem(carrito[i]) +'</div>';\n }\n document.getElementById(\"shopping-body\").innerHTML = estructuraGeneral;\n if (carrito.length == 0) noItem();\n printPriceCart();\n}", "function appendpro() {\r\n let data = JSON.parse(localStorage.getItem(\"offers\"));\r\n let mainDiv = document.getElementById(\"products\");\r\n data.forEach(function (el) {\r\n //target this\r\n let div = document.createElement(\"div\");\r\n div.setAttribute(\"class\", \"offersbox\");\r\n\r\n /* //product name\r\n let p_name = document.createElement(\"p\");\r\n p_name.innerHTML = el.name; */\r\n\r\n /* //product price\r\n let p_Price = document.createElement(\"p\");\r\n p_Price.innerHTML = ` ${\r\n 100 - (p_Price.innerHTML % Math.floor(Math.random() * 10))\r\n } `;\r\n //console.log(p_Price.innerHTML/2)\r\n \r\n //discount data\r\n disdata = p_Price.innerHTML % Math.floor(Math.random() * 10);\r\n \r\n let discount = document.createElement(\"p\");\r\n discount.innerHTML = `<del>${el.price}</del>`; */\r\n\r\n //code\r\n let code = document.createElement(\"p\");\r\n code.innerHTML = `CODE: <strong>${el.code}</strong>`;\r\n code.setAttribute(\"class\", \"codetext\");\r\n\r\n //meta data\r\n let meta = document.createElement(\"p\");\r\n meta.innerHTML = el.metadata;\r\n meta.style.fontWeight = \"lighter\";\r\n\r\n //button\r\n let btn = document.createElement(\"button\");\r\n btn.textContent = \"Add to cart\";\r\n btn.addEventListener(\"click\", function () {\r\n addToCart(el);\r\n });\r\n let img = document.createElement(\"img\");\r\n img.src = el.img;\r\n div.append(img, meta, code);\r\n mainDiv.append(div);\r\n img.addEventListener(\"click\", function () {\r\n window.location.href = \"producdetail.html\";\r\n });\r\n });\r\n}", "function updateTotal() {\n var total = 0;\n $('.cart-item-price').each(function() {\n total += parseInt($(this).text());\n });\n $('#shoppingcart-items').append('<hr><span>Total: ' + total + '$ <a href=\"/checkout\">Go to checkout</a></span>');\n }", "function showShoppingCartList() {\r\n let totalPrice = 0\r\n let getLocalStoragee = localStorage.getItem(\"shoppingCartListItem\");\r\n if(getLocalStoragee == null) {\r\n shoppingCartListItem = [];\r\n } else {\r\n shoppingCartListItem = JSON.parse(getLocalStoragee);\r\n }\r\n let newElement = '';\r\n\r\n shoppingCartListItem.forEach((element, index)=>{\r\n totalPrice += parseInt(element.price);\r\n newElement += '<div class=\"shopping-cart-item\">'+\r\n `<h3 class=\"title\">${element.name}</h3>`+\r\n `<p class=\"price\">Price: ${element.price}$</p>`+\r\n `<div class=\"close-btn\" onclick = \"deleteItemFromShoppingCart(${index})\">`+\r\n '<svg height=\"15px\" viewBox=\"0 0 329.26933 329\" width=\"15px\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m194.800781 164.769531 128.210938-128.214843c8.34375-8.339844 8.34375-21.824219 0-30.164063-8.339844-8.339844-21.824219-8.339844-30.164063 0l-128.214844 128.214844-128.210937-128.214844c-8.34375-8.339844-21.824219-8.339844-30.164063 0-8.34375 8.339844-8.34375 21.824219 0 30.164063l128.210938 128.214843-128.210938 128.214844c-8.34375 8.339844-8.34375 21.824219 0 30.164063 4.15625 4.160156 9.621094 6.25 15.082032 6.25 5.460937 0 10.921875-2.089844 15.082031-6.25l128.210937-128.214844 128.214844 128.214844c4.160156 4.160156 9.621094 6.25 15.082032 6.25 5.460937 0 10.921874-2.089844 15.082031-6.25 8.34375-8.339844 8.34375-21.824219 0-30.164063zm0 0\"/></svg>'+\r\n '</div>'+\r\n '</div>';\r\n });\r\n document.getElementById(\"shopping-cart-container\").innerHTML = newElement;\r\n document.getElementById(\"total-price\").innerHTML = `Total price: ${totalPrice} $`;\r\n}", "function displayCart() {\n if (localStorage.getItem('cartProducts') !== null) {\n var products = JSON.parse(localStorage.getItem('cartProducts'));\n total = 0; // Réinitialisation du total à 0\n\n section.insertAdjacentHTML(\"afterbegin\", \"\\n <h2>Panier</h2>\\n <table class=\\\"cart-section__table\\\" style=\\\"margin-top:50px;display:flex;flex-direction:column;align-items:center;\\\">\\n <thead>\\n <tr>\\n <th>Image</th> \\n <th>D\\xE9signation</th>\\n <th>Lense</th>\\n <th>Quantit\\xE9</th>\\n <th>Prix</th>\\n <th>Supprimer</th>\\n </tr>\\n </thead>\\n <tbody class=\\\"cart-section__commande\\\">\\n </tbody>\\n </table>\\n \\n \");\n var commande = document.querySelector(\".cart-section__commande\");\n products.forEach(function (product, index) {\n total = total + product.price * product.quantity;\n commande.insertAdjacentHTML(\"beforeend\", \"\\n <tr>\\n <td><img src=\\\"\".concat(product.imageUrl, \"\\\" alt=\\\"photo camera\\\" style=\\\"width:70px;border: 2px solid black;\\\"></td>\\n <td>\").concat(product.name, \"</td>\\n <td>\").concat(product.selectedLense, \"</td>\\n <td><button class=\\\"cart-section__remove product-\").concat(index, \"\\\">-</button>\").concat(product.quantity, \"<button class=\\\"cart-section__add product-\").concat(index, \"\\\">+</button></td>\\n <td>\").concat((product.price * product.quantity / 100).toFixed(2).replace(\".\", \",\"), \" \\u20AC</td>\\n <td><button class=\\\"cart-section__delete product-\").concat(index, \"\\\">X</button></td>\\n </tr>\\n \\n \"));\n });\n section.insertAdjacentHTML(\"beforeend\", \"\\n <div class=\\\"total\\\">\\n <p class=\\\"cart-section__total\\\">Total : \".concat((total / 100).toFixed(2).replace(\".\", \",\"), \" \\u20AC</p>\\n <button class=\\\"cart-section__cancelCart\\\">Annuler le panier</button>\\n </div>\\n \"));\n /*formulaire de contact pour valider la commande*/\n\n section.insertAdjacentHTML(\"beforeend\", \"\\n <div class=\\\"formulaire\\\" style=\\\"text-align:start;\\\">\\n <p class=\\\"\\\">Formulaire \\xE0 remplir pour valider la commande : </p>\\n <form class=\\\"cart-form\\\" action=\\\"post\\\" type=\\\"submit\\\">\\n <div class=\\\"cart-form__group\\\">\\n <label for=\\\"firstname\\\">Pr\\xE9nom : </label>\\n <input id=\\\"firstname\\\" type=\\\"text\\\" placeholder=\\\"Votre pr\\xE9nom\\\" maxlength=\\\"30\\\" pattern=\\\"[A-Za-z]{2,}\\\" required />\\n </div>\\n <div class=\\\"cart-form__group\\\">\\n <label for=\\\"name\\\">Nom : </label>\\n <input id=\\\"name\\\" type=\\\"text\\\" placeholder=\\\"Votre nom\\\" maxlength=\\\"50\\\" pattern=\\\"[A-Za-z]{2,}\\\" required />\\n </div>\\n <div class=\\\"cart-form__group\\\">\\n <label for=\\\"address\\\">Adresse : </label>\\n <input id=\\\"address\\\" type=\\\"text\\\" placeholder=\\\"Votre adresse\\\" maxlength=\\\"200\\\" required />\\n </div>\\n <div class=\\\"cart-form__group\\\">\\n <label for=\\\"city\\\">Ville : </label>\\n <input id=\\\"city\\\" type=\\\"text\\\" placeholder=\\\"Votre ville\\\" maxlength=\\\"30\\\" required />\\n </div>\\n <div class=\\\"cart-form__group\\\">\\n <label for=\\\"email\\\">Email : </label>\\n <input id=\\\"email\\\" type=\\\"email\\\" pattern=\\\"[a-z0-9._%+-]+@[a-z0-9.-]+[.][a-z]{2,4}\\\" placeholder=\\\"exemple@email.com\\\" maxlength=\\\"30\\\" required />\\n </div>\\n <button id=\\\"submit-btn\\\" style=\\\"border:2 solid black;border-radius:2rem;padding:2px;margin:10px;background-color:#c20aa3;color:#fff;\\\">Valider le panier</button>\\n </form>\\n </div>\\n \");\n var removeOneBtn = document.querySelectorAll(\".cart-section__remove\");\n removeOneBtn.forEach(function (btn) {\n btn.addEventListener('click', function (e) {\n removeOneProduct(e, products);\n });\n });\n var addOneBtn = document.querySelectorAll(\".cart-section__add\");\n addOneBtn.forEach(function (btn) {\n btn.addEventListener('click', function (e) {\n addOneProduct(e, products);\n });\n });\n var deleteBtn = document.querySelectorAll(\".cart-section__delete\");\n deleteBtn.forEach(function (btn) {\n btn.addEventListener('click', function (e) {\n deleteProduct(e, products);\n });\n });\n var cancelCartBtn = document.querySelector(\".cart-section__cancelCart\");\n cancelCartBtn.addEventListener('click', function () {\n cancelCart();\n });\n var form = document.querySelector(\".cart-form\");\n form.addEventListener('submit', function (e) {\n e.preventDefault();\n submitForm();\n });\n } else {\n section.insertAdjacentHTML(\"afterbegin\", \"\\n <h2>Panier</h2>\\n <p class=\\\"cart-section__vide\\\">\\n Votre panier est vide ! \\n <br/>\\n <a href=\\\"./index.html\\\">Revenir \\xE0 la page d'accueil</a>\\n </p>\\n \");\n }\n}", "function displayItem(item, itemQuantity, container){\n //create Div container \n var div = document.createElement(\"DIV\");\n div.className = \"item\";\n \n //Displays item's name\n var nameContainer = document.createElement(\"P\")\n var name = document.createTextNode(item.name);\n nameContainer.className = \"item-name\";\n nameContainer.appendChild(name);\n div.appendChild(nameContainer); \n\n //Displays \"Price $: \"\n var priceContainer = document.createElement(\"p\");\n var priceText = document.createTextNode(\"Price: $\")\n priceContainer.appendChild(priceText);\n\n //Displays price amount\n var priceNumberContainer = document.createElement(\"span\");\n var priceNumber = document.createTextNode((item.price).toFixed(2)+\"\");\n priceNumberContainer.className = \"ppu\"\n priceNumberContainer.appendChild(priceNumber);\n priceContainer.appendChild(priceNumberContainer);\n div.appendChild(priceContainer);\n\n //Displays \"Quantity: \"\n var quantityContainer = document.createElement(\"p\");\n var quantityText = document.createTextNode(\"Quantity: \") \n quantityContainer.appendChild(quantityText);\n\n //Displays \"Total Price: $\"\n var totalPriceContainer = document.createElement(\"p\");\n var totalPriceText = document.createTextNode(\"Total Price: $\")\n totalPriceContainer.appendChild(totalPriceText);\n\n //Displays total price amount \n var totalPriceNumberContainer = document.createElement(\"span\"); \n totalPriceNumberContainer.className = \"total-price\";\n var totalPriceNumber = document.createTextNode((item.price).toFixed(2))\n totalPriceNumberContainer.appendChild(totalPriceNumber); \n totalPriceContainer.appendChild(totalPriceNumberContainer);\n div.appendChild(totalPriceContainer); \n\n //If function is called to displayInventory: sets quantity placeholder to 1 \n //If function is called to addItemToCart: select quantity chosen by user, and add quantity to user's cart \n var quantityInput = document.createElement(\"input\");\n quantityInput.className = \"quantity-input\"\n quantityContainer.appendChild(quantityInput);\n div.appendChild(quantityContainer);\n if(itemQuantity === 1){\n quantityInput.placeholder = 1;\n \n } else {\n quantityInput.value = itemQuantity; \n totalPriceNumberContainer.innerHTML = (itemQuantity*item.price).toFixed(2)\n }\n\n\n document.querySelector(container).appendChild(div); \n calcTotalPriceListener(); \n\n //If function is called to addItemToCart: create ID for div using the name of item (apples, bananas, etc.)\n //AND, add a \"remove\" button so user can remove item from cart \n if(container === \".cart-container\"){\n div.setAttribute(\"id\", \"cart-item-\"+item.name)\n displayRemoveButton(div); \n }\n}", "function addItem(){\r\n totalAmount = 0;\r\n totalItems = 0;\r\n totalSaving = 0;\r\n var clrNode = document.getElementById('item-body');\r\n clrNode.innerHTML = '';\r\n cartList.map((cart)=>{\r\n var cartCont =document.getElementById('item-body');\r\n totalAmount = totalAmount + cart.price;\r\n totalSaving = totalSaving + cart.save;\r\n totalItems = totalItems + 1;\r\n\r\n var temCart = document.createElement('div')\r\n tempCart.setAttribute('class','cart-list');\r\n temCart.setAttribute('id',cart.id);\r\n\r\n var listImg = document.createElement('img');\r\n listImg.setAttribute('id','list-img');\r\n listImg.src =cart.img;\r\n temCart.appendChild(listImg);\r\n\r\n var listName = document.createElement('h3');\r\n listName.setAttribute('class', 'list-name');\r\n listName.innerHTML = cart.name;\r\n temCart.appendChild(listName);\r\n\r\n var listPay = document.createElement('h3');\r\n listPay.setAttribute('class','Pay');\r\n listPay.innerHTML = cart.price;\r\n tempCart.appendChild('listPay');\r\n\r\n var listQuantity = document.createElement('h3');\r\n listQuantity.setAttribute('class','quantity');\r\n listQuantity.innerHTML = '1';\r\n tempCart.appendChild(listQuantity);\r\n\r\n var listTrash = document.createElement('i');\r\n listTrash.setAttribute('class','fa fa-trash');\r\n listTrash.setAttribute('id','remove');\r\n tempCart.appendChild(listTrash);\r\n\r\n cartCont.appendChild(tempCart);\r\n })\r\n document.getElementById('total-amount').innerHTML = 'Total Amount : $ ' + totalAmount;\r\n document.getElementById('total-item').innerHTML = 'Total Items : $ ' + totalItems;\r\n document.getElementById('you-saved').innerHTML = 'You Saved : $ ' + totalSaving;\r\n document.getElementById('total').style.display = 'block';\r\n}", "function addToCart(itemName, itemPrice, itemQuantity, itemImgSrc, itemHref, itemDesc) {\r\n\r\n // Default verify to true\r\n var verify = true;\r\n\r\n // Check if item is already added to cart\r\n document.querySelectorAll('.cart-item-name a').forEach(el => {\r\n if (el.textContent == itemName) {\r\n alert(\"This item is already in your cart. \");\r\n verify = false; // Verify = false if the item is already in the cart\r\n }\r\n })\r\n\r\n // Only if the item is not yet in the cart\r\n if (verify == true) {\r\n // Create new element for the new cart item and assign its values to it\r\n var newCartItem = document.createElement('li');\r\n newCartItem.classList.add('cart-item');\r\n var cartList = document.querySelector('#cart-item-list ul');\r\n var cartItemTemplate = `\r\n <table>\r\n <tr>\r\n <td class=\"cart-item-img\" rowspan=\"3\">\r\n <a href=\"${itemHref}\">\r\n <div alt=\"Product Image\"\r\n style=\"background-image: url(${itemImgSrc});\">\r\n </div>\r\n </a>\r\n </td>\r\n <td class=\"cart-item-name\"><a href=\"${itemHref}\" title=\"${itemName}\" class=\"pgTransOnClick\">${itemName}</a></td>\r\n </tr>\r\n <tr>\r\n <td class=\"cart-item-desc\">\r\n <p>${itemDesc}</p>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td rowspan=\"2\" style=\"vertical-align: bottom;\">\r\n <span class=\"cart-item-price\">Price: $<span>${itemPrice.toFixed(2)}</span></span>\r\n <br />\r\n <span class=\"cart-item-subtotal\">Subtotal: $<span>0.00</span></span>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class=\"cart-item-count\">\r\n <button class=\"count-btn-minus\">-</button>\r\n <input class=\"count-field\" type=\"number\" value=\"${itemQuantity}\" min=\"0\" max=\"100\" />\r\n <button class=\"count-btn-plus\">+</button>\r\n </td>\r\n </tr>\r\n </table>\r\n <div>\r\n <a class=\"notJumping cart-item-del\" title=\"Delete Item\">\r\n <img src=\"pics/cart-delete.png\" />\r\n </a>\r\n </div>\r\n `\r\n\r\n // Append item to cart list\r\n newCartItem.innerHTML = cartItemTemplate;\r\n cartList.appendChild(newCartItem);\r\n\r\n // Variables assigned to current cart item\r\n var liElem = cartList.lastChild;\r\n var cartMinusNew = liElem.querySelector(\".count-btn-minus\");\r\n var cartPlusNew = liElem.querySelector(\".count-btn-plus\");\r\n var cartQuantity = liElem.querySelector(\".count-field\");\r\n var cartDelBtn = liElem.querySelector('.cart-item-del')\r\n var itemName = liElem.querySelector('.cart-item-name a').textContent;\r\n\r\n // Give functionality to the buttons in the item (eg: Quantity [+/-] Buttons, Delete button)\r\n // Minus quantity button\r\n cartMinusNew.addEventListener(\"click\", function () {\r\n var quantity = parseInt(cartMinusNew.nextElementSibling.value);\r\n if (quantity > 1) {\r\n cartMinusNew.nextElementSibling.value = quantity - 1;\r\n }\r\n updateQuantityField(cartQuantity);\r\n });\r\n\r\n // Plus quantity button\r\n cartPlusNew.addEventListener(\"click\", function () {\r\n var quantity = parseInt(cartPlusNew.previousElementSibling.value);\r\n if (quantity < 99) {\r\n cartPlusNew.previousElementSibling.value = quantity + 1;\r\n }\r\n updateQuantityField(cartQuantity);\r\n });\r\n\r\n // Quantity number input field\r\n cartQuantity.addEventListener('change', function () {\r\n updateQuantityField(cartQuantity);\r\n });\r\n\r\n // Delete item button\r\n cartDelBtn.addEventListener('click', function () {\r\n // Get the current session storage\r\n var cartContents = JSON.parse(sessionStorage.getItem('cart-contents'));\r\n\r\n // Find and delete the item from session storage\r\n cartContents.forEach(item => {\r\n // Get all values\r\n var arr = Object.entries(item)\r\n\r\n // Delete the item of the same name in the session storage\r\n arr.forEach(el => {\r\n if (el[0] == 'name' && el[1] == itemName) {\r\n var index = cartContents.indexOf(item)\r\n cartContents.splice(index, 1)\r\n // Update to the session storage\r\n sessionStorage.setItem('cart-contents', JSON.stringify(cartContents))\r\n }\r\n });\r\n });\r\n\r\n // Remove the item from cart\r\n liElem.remove();\r\n\r\n // Update all cart values\r\n updateCartSubtotal();\r\n updateCartTotal();\r\n cartCheckoutBlank();\r\n })\r\n\r\n // Create and append the new item into session storage\r\n var newObj = { name: itemName, price: itemPrice, quantity: itemQuantity, imgsrc: itemImgSrc, href: itemHref, desc: itemDesc }\r\n var cartContents = JSON.parse(sessionStorage.getItem('cart-contents'))\r\n cartContents[cartContents.length] = newObj\r\n sessionStorage.setItem('cart-contents', JSON.stringify(cartContents))\r\n\r\n // Give page transition feature to new hyperlinks\r\n pageTransitionOut();\r\n }\r\n\r\n // Update cart values\r\n cartCheckoutBlank();\r\n updateCartSubtotal();\r\n updateCartTotal();\r\n}", "function matchCartArraytoCartDisplay(){\n for (var item =0; item<cart.length; item++) {\n //add html\n $('.order').append(\"\\\n <div id='item'>\\\n <h3></h3>\\\n <p></p>\\\n </div>\\\n <div>\\\n <p></p>\\\n <p id='editor'> x </p>\\\n <p id='editor'> Edit </p>\\\n <p>\\\n </div>\");\n }\n}", "function addProduct(id) {\n var btn = $('.addProduct-' + id);\n var branch = btn.data(\"branch\");\n var name = btn.data(\"name\");\n var price_branch = btn.data(\"price-branch\");\n var code = btn.data(\"code\");\n var quantity = btn.data(\"quantity\");\n var price = btn.data(\"price\");\n var finder = $('.select').find('#item-qty-' + code);\n\n if (finder.length > 0) {\n $('#item-qty-' + code).val(parseInt($('#item-qty-' + code).val()) + 1);\n countSubtotal(code);\n } else {\n $(\"#items2\").append(\n '<div class=\"card mb-0\" id=\"product-' + code + '\">' +\n ' <div class=\"card-body\">' +\n ' <div class=\"row\">' +\n ' <div class=\"col-lg-6\">' +\n ' <h5><b>' + name + ' (' + branch + ')</b></h5>' +\n ' <p class=\"mb-0\" id=\"price-' + code + '\">Harga Jual: Rp ' + price_branch + '</p>' +\n ' <p id=\"price-pusat-' + code + '\">Harga Pusat: Rp ' + price + '</p>' +\n ' <input type=\"hidden\" value=\"' + code + '\" name=\"item[' + items_count + '][stock_id]\">' +\n ' <span class=\"btn btn-outline-danger\" onclick=\"return removeProduct(' + \"'\" + code + \"'\" + ');\"><i class=\"fa fa-trash\"></i>' +\n ' Hapus' +\n ' </span>' +\n ' </div>' +\n ' <div class=\"col-lg-6\">' +\n ' <div class=\"pb-2 form-row\">' +\n ' <label for=\"item-qty-' + code + '\"' +\n ' class=\"col-sm-4 col-form-label text-right\">Qty</label>' +\n ' <div class=\"col-sm-8\">' +\n ' <span class=\"select\">' +\n ' <input type=\"number\" class=\"form-control item-qty-' + code + '\" id=\"item-qty-' + code + '\"' +\n ' min=\"1\" value=\"1\" name=\"item[' + items_count + '][qty]\" onchange=\"countSubtotal(' + \"'\" + code + \"'\" + ')\">' +\n ' </span>' +\n ' </div>' +\n ' </div>' +\n ' <div class=\"pb-2 form-row\">' +\n ' <label for=\"item-price-' + code + '\"' +\n ' class=\"col-sm-4 col-form-label text-right\">Harga Pusat</label>' +\n ' <div class=\"col-sm-8\">' +\n ' <span class=\"select\">' +\n ' <input type=\"text\" disabled class=\"form-control item-price-' + code + '\" id=\"item-price-' + code + '\"' +\n ' value=\"' + price + '\" name=\"item[' + items_count + '][purchase_price]\">' +\n ' </span>' +\n ' </div>' +\n ' </div>' +\n ' <div class=\"pb-2 form-row\">' +\n ' <label for=\"item-price-branch-' + code + '\"' +\n ' class=\"col-sm-4 col-form-label text-right\">Harga Jual</label>' +\n ' <div class=\"col-sm-8\">' +\n ' <span class=\"select\">' +\n ' <input type=\"text\" class=\"form-control item-price-branch' + code + '\" id=\"item-price-branch-' + code + '\"' +\n ' value=\"' + price_branch + '\" name=\"item[' + items_count + '][price]\" onchange=\"countSubtotal(' + \"'\" + code + \"'\" + ')\">' +\n ' </span>' +\n ' </div>' +\n ' </div>' +\n ' <div class=\"pb-2 form-row\">' +\n ' <label for=\"item-disc-\"' +\n ' class=\"col-sm-4 col-form-label text-right\">Diskon</label>' +\n ' <div class=\"col-sm-8\">' +\n ' <div class=\"input-group\">' +\n ' <input type=\"number\" class=\"form-control item-disc\" onchange=\"countSubtotal(' + \"'\" + code + \"'\" + ')\"' +\n ' id=\"item-disc-' + code + '\"' +\n ' min=\"0\" max=\"15\" value=\"0\" step=\"any\" name=\"item[' + items_count + '][discount]\">' +\n ' <div class=\"input-group-append\">' +\n ' <span class=\"input-group-text bg-dark text-light\"' +\n ' id=\"customer-name\">%</span>' +\n ' </div>' +\n ' </div>' +\n ' </div>' +\n ' </div>' +\n ' <div class=\"form-row\">' +\n ' <label for=\"item-total\"' +\n ' class=\"col-sm-4 col-form-label text-right\">Subtotal</label>' +\n ' <div class=\"col-sm-8\">' +\n ' <div class=\"input-group\">' +\n ' <div class=\"input-group-prepend\">' +\n ' <span class=\"input-group-text bg-dark text-light\"' +\n ' id=\"rp\">Rp' +\n ' </span>' +\n ' </div>' +\n ' <input type=\"text\" class=\"form-control subtotal\" value=\"' + price_branch + '\"' +\n ' id=\"item-subtotal-' + code + '\"' +\n ' readonly name=\"item[' + items_count + '][total]\">' +\n ' </div>' +\n ' </div>' +\n ' </div>' +\n ' </div>' +\n ' </div>' +\n ' </div>' +\n '</div>'\n );\n\n items_count++;\n setButtonState();\n countTotal();\n $('.count').text(items_count + \" barang dalam keranjang\");\n\n }\n $(\"#branches\").val(null).trigger('change');\n $(\"#categories\").val(null).trigger('change');\n $(\"#brands\").val(null).trigger('change');\n}", "function addItemBtnOnClick () { \n\n let itemStatus = PRODUCT_CONTAINER.querySelectorAll('.item_status')\n let remainingItems = PRODUCT_CONTAINER.querySelectorAll('.remaining_item')\n let addItemBtns = PRODUCT_CONTAINER.querySelectorAll('.add_btn')\n let nameOfItems = PRODUCT_CONTAINER.querySelectorAll('H3')\n let priceOfItems = PRODUCT_CONTAINER.querySelectorAll('.price_of_item')\n\nfor (let i = 0; i < addItemBtns.length; i++) {\n // Add this to stop repeating [i]\n let addItemBtn = addItemBtns[i]\n let status = itemStatus[i]\n let nameOfItem = nameOfItems[i]\n let remainingItem = remainingItems[i]\n let priceOfItem = priceOfItems[i]\n\n addItemBtn.addEventListener('click', () => {\n \n if (status.innerHTML == 'NOT AVAILABLE') return alert('Item is not available')\n \n if (status.innerHTML == 'AVAILABLE') { \n var itemNames = document.querySelectorAll('.item_name')\n\n for (let i = 0; i < itemNames.length; i++) {\n let itemName = itemNames[i]\n\n if (itemName.innerText == nameOfItem.innerText) { \n return alert('Item Has Been Added To Cart, You can increase the amount you want') \n } \n } \n remainingItem.value--\n checkStatus() \n\n USER_OUTPUT_TABLE.innerHTML +=\n ` <li> \n <span class=\"item_name\">${nameOfItem.innerText}</span>\n <input type=\"number\" class=\"item_price\" value=\"${priceOfItem.value}\" readonly>\n <input type=\"number\" class=\"number_of_item\" value=\"1\" >\n <input type=\"number\" class=\"total_price_per_item\" readonly>\n <span class=\"del_item\" title=\"Remove Item From Cart\">&times;</span>\n </li> `\n \n displayContent('user_output', 'block') \n amountBounghtPerItem() \n\n\n // Delete Item after it is added to the cart\n var delItems = document.querySelectorAll('.del_item')\n for (let i = 0; i < delItems.length; i++) {\n let delItem = delItems[i] \n\n delItem.addEventListener('click', (e) => {\n USER_OUTPUT_TABLE.removeChild(e.target.parentElement)\n amountBounghtPerItem()\n if (TOTAL_PRICE.value == '$ 0.00') {\n displayContent('user_output', 'none')\n }\n })\n }\n }\n })\n }\n}", "function createTotal(cost) {\n let total_container = document.querySelector(\".cart\");\n total_container.innerHTML += `<div class=\"total-div\">\n <p class=\"total-p\">Total : R${cost}.00</p>\n </div>`;\n }", "function addPrToCarrt() {\n var model = { prid: prid, total: parseInt($(\"#numb\").text()) };\n addToCart(model);\n}", "function addToCartClicked(event) {\r\n var button = event.target;\r\n var shopItem = button.parentElement.parentElement.parentElement.parentElement;\r\n var title = shopItem.getElementsByClassName(\"shop-item-title\")[0].innerText;\r\n var price = shopItem.getElementsByClassName(\"shop-item-price\")[0].innerText;\r\n var imageSrc = shopItem.getElementsByClassName(\"shop-item-image\")[0].src;\r\n addItemToCart(title, price, imageSrc);\r\n updateCartTotal();\r\n }", "function addToCart(e){\n cart.style.display = \"block\";\n\n let li = document.createElement(\"li\");\n\n if(e.target === starter){\n li.textContent = \"Starter Plan - £150\";\n } else if(e.target === advanced) {\n li.textContent = \"Advanced Plan - £250\";\n } else {\n li.textContent = \"Professional Plan - £350\";\n }\n\n cartList.appendChild(li);\n\n e.preventDefault();\n}", "function showItems() {\n\tconst qty = getQty()\n\tcartQty.innerHTML = `You have ${qty} items in your cart.`\n\t//console.log(`You have ${qty} items in your cart.`)\n\n\tlet itemStr = ''\n\tfor (let i = 0; i < cart.length; i++) {\n\t\tlet itemTotal = cart[i].price * cart[i].qty\n\t\t//console.log(`- ${cart[i].name} - ${cart[i].price} x ${cart[i].qty}`)\n\t\titemStr += `<li class=\"cart-list\"><div class=\"checkout-item\">\n\t\t${cart[i].name} - ${cart[i].price} x ${cart[i].qty} = ${itemTotal.toFixed(2)}</div>\n\t\t<button class=\"remove\" data-name=\"${cart[i].name}\">Remove</button>\n\t\t<button class=\"decrease change\" data-name=\"${cart[i].name}\">-</button>\n\t\t<button class=\"increase change\" data-name=\"${cart[i].name}\">+</button>\n\t\t</li>`\n\t}\n\n\t// make a list of all the items in the cart\n\titemList.innerHTML = itemStr\n\t\n\tconst total = getTotal()\n\tcartTotal.innerHTML = `Your cart total is: $${total}`\n\t//console.log(`Your cart total is: $${total}`)\n}", "function addItem(){\n let container = document.getElementById('sl__body');\n let container2 = document.getElementById('extra__list');\n let count = container.childElementCount + 1;\n let item_name = document.getElementById('input_add-item');\n document.getElementById('--extra__list').style.display = \"block\";\n\n //create element on list\n let box = document.createElement('div');\n box.setAttribute('class', 'sl-input-field');\n box.setAttribute('id', 'box-item-'+count);\n\n let box_span = document.createElement('span');\n box_span.setAttribute('class', 'product-name');\n box_span.textContent = item_name.value;\n\n let hidden_inp_name = document.createElement('input');\n hidden_inp_name.setAttribute('type', 'hidden');\n hidden_inp_name.setAttribute('style', 'display: none');\n hidden_inp_name.setAttribute('name', 'product-name-'+count);\n hidden_inp_name.setAttribute('value', item_name.value);\n\n let hidden_inp_extra = document.createElement('input');\n hidden_inp_extra.setAttribute('type', 'hidden');\n hidden_inp_extra.setAttribute('style', 'display: none');\n hidden_inp_extra.setAttribute('name', 'is-extra-'+count);\n hidden_inp_extra.setAttribute('value', 1);\n\n let box_inp_nb = document.createElement('input');\n box_inp_nb.setAttribute('type', 'number');\n box_inp_nb.setAttribute('onchange', 'countValue(this)');\n box_inp_nb.setAttribute('id', 'quant-item-'+count);\n box_inp_nb.setAttribute('class', 'input-item quant-input');\n box_inp_nb.setAttribute('name', 'product-quant-'+count);\n box_inp_nb.setAttribute('value', 1);\n\n let box_inp_tx = document.createElement('input');\n box_inp_tx.setAttribute('type', 'text');\n box_inp_tx.setAttribute('onchange', 'countValue(this)');\n box_inp_tx.setAttribute('onkeyup', 'checkInput(this);currencyChecker(this)');\n box_inp_tx.setAttribute('id', 'input-item-'+count);\n box_inp_tx.setAttribute('name', 'product-price-'+count);\n box_inp_tx.setAttribute('class', 'input-item price-input');\n\n let box_sec_span = document.createElement('span');\n box_sec_span.setAttribute('class', 'placeholder-text');\n box_sec_span.setAttribute('onclick', 'inputFocus(this)');\n box_sec_span.textContent = \"valor\";\n\n box.appendChild(box_span);\n box.appendChild(hidden_inp_name);\n box.appendChild(hidden_inp_extra);\n box.appendChild(box_inp_nb);\n box.appendChild(box_inp_tx);\n box.appendChild(box_sec_span);\n \n //create element on desc list\n\n let abox = document.createElement('div');\n abox.setAttribute('class', 'product extra');\n\n let box2 = document.createElement('div');\n box2.setAttribute('class', 'left');\n\n let abox_span = document.createElement('span');\n abox_span.setAttribute('class', 'product-name');\n abox_span.setAttribute('id', 'product-name-'+count);\n abox_span.textContent = item_name.value;\n\n let box3 = document.createElement('div');\n box3.setAttribute('class', 'right');\n\n let box_span2 = document.createElement('span');\n box_span2.setAttribute('id', 'product-quant-'+count);\n box_span2.textContent = 1;\n\n let box_span3 = document.createElement('span');\n box_span3.setAttribute('class', 'pr-subtitle');\n box_span3.textContent = \"R$ \";\n\n let box_span4 = document.createElement('span');\n box_span4.setAttribute('class', 'product-price');\n box_span4.setAttribute('id', 'product-price-'+count);\n box_span4.textContent = \"---\";\n\n abox.appendChild(box2);\n box2.appendChild(abox_span);\n abox.appendChild(box3);\n box3.appendChild(box_span2);\n box3.innerHTML += \" x \";\n box3.appendChild(box_span3);\n box_span3.appendChild(box_span4);\n\n container2.appendChild(abox);\n container.appendChild(box);\n\n toggleAddItemModal(false);\n}", "function addConfirmOrderElements(){\n\tvar totalCost = 0;\n\n\tvar confirmOrderDiv = document.createElement(\"div\");\n\tconfirmOrderDiv.setAttribute(\"id\", \"confirmOrderDiv\");\n\n\n\tconfirmOrderDiv.style.borderColor = \"#ff4d4d\";\n\n\tvar customerHeader = document.createElement(\"H1\");\n\tcustomerHeader.style.marginTop = \"0px\";\n\tcustomerHeader.appendChild(document.createTextNode(nameInput.value));\n\tconfirmOrderDiv.appendChild(customerHeader);\n\n\tfor(var i = 0; i < coffeeLiArray.length; i++)\n\t{\n\t\tif(coffeeLiArray[i].checked)\n\t\t{\n\t\t\tfor(var a = 0; a < Number(coffeeLiArray[i].quantityElement.value); a++)\n\t\t\t{\n\t\t\t\tvar orderElement = document.createElement(\"div\");\n\t\t\t\torderElement.style.display = \"inline-block\";\n\t\t\t\torderElement.style.padding = \"10px\";\n\t\t\t\torderElement.style.borderRadius = \"10px\";\n\t\t\t\torderElement.style.borderStyle = \"solid\";\n\t\t\t\torderElement.style.borderWidth = \"2.5px\";\n\t\t\t\torderElement.style.fontFamily = \"Nunito\", \"sans-serif\";\n\n\t\t\t\torderElement.appendChild(document.createTextNode(coffeeLiArray[i].innerHTML));\n\t\t\t\torderElement.appendChild(document.createElement(\"br\"));\n\t\t\t\tvar priceTextNode;\n\n\n\t\t\t\t//update with db <-------------------------------------------\n\n\n\t\t\t\tif(coffeeLiArray[i].sizeSelector.checked)\n\t\t\t\t{\n\t\t\t\t\torderElement.style.borderColor = \"#ff9966\";\n\t\t\t\t\tpriceTextNode = document.createTextNode(\"$3.80\");\n\t\t\t\t\ttotalCost += 3.8;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\torderElement.style.borderColor = \"#66b3ff\";\n\t\t\t\t\tpriceTextNode = document.createTextNode(\"$3\");\n\t\t\t\t\ttotalCost += 3;\n\t\t\t\t}\n\n\n\n//an attempt to parse php vars into js lmao\n/*\nif(coffeeLiArray[i].sizeSelector.checked)\n{\n\torderElement.style.borderColor = \"#ff9966\";\n\tpriceTextNode = document.createTextNode( ); //php var pls don't kill me\n\ttotalCost += 3.8;\n}\nelse\n{\n\torderElement.style.borderColor = \"#66b3ff\";\n\tpriceTextNode = document.createTextNode(\"$3\");\n\ttotalCost += 3;\n}\n*/\n//end this godawful code that i really should be using ajax for but i'm too lazy\n\n\t\t\t\torderElement.appendChild(priceTextNode);\n\n\t\t\t\tconfirmOrderDiv.appendChild(orderElement);\n\n\t\t\t}\n\t\t}\n\n\t}\n\n\t//What's happening above: essentially checks which elements in coffeeLiArray\n\t//are selected and outputs the orderElements according to the corresponding\n\t// quantityElement.value\n\n\tvar deliveryDetailsHeader = document.createElement(\"H1\");\n\tvar totalHeader = document.createElement(\"H2\");\n\n\t\tdeliveryDetailsHeader.appendChild(document.createTextNode(\"Pick Up at Cart\"));\n\t\tconfirmOrderDiv.appendChild(deliveryDetailsHeader);\n\n\n\n\t//If delivery was chosen then show the delivery cost and details\n\n\ttotalHeader.appendChild(document.createTextNode(\"Total: $\" + totalCost.toFixed(2).toString()));\n\ttotalHeader.style.fontFamily = \"Nunito\", \"sans-serif\";\n\tconfirmOrderDiv.appendChild(totalHeader);\n\n\tvar confirmOrderButton = document.createElement(\"BUTTON\");\n\tconfirmOrderButton.setAttribute(\"class\", \"orderElementButton\");\n\tconfirmOrderButton.setAttribute(\"id\", \"confirmOrderButton\");\n\tconfirmOrderButton.appendChild(document.createTextNode(\"Confirm\"));\n\tvar cancelOrderButton = document.createElement(\"BUTTON\");\n\tcancelOrderButton.setAttribute(\"class\", \"orderElementButton\");\n\tcancelOrderButton.setAttribute(\"id\", \"cancelOrderButton\");\n\tcancelOrderButton.appendChild(document.createTextNode(\"Cancel\"));\n\tconfirmOrderDiv.appendChild(cancelOrderButton);\n\tconfirmOrderDiv.appendChild(confirmOrderButton);\n\n\tdocument.body.appendChild(confirmOrderDiv);\n\n\tconfirmOrderButton.onclick = function(){orderDivConfirmation(true);};\n\tcancelOrderButton.onclick = function(){orderDivConfirmation(false);};\n\t//sets up the rest of confirmOrderDiv\n}" ]
[ "0.7670149", "0.7193816", "0.7171806", "0.70372707", "0.6934285", "0.68798023", "0.6806421", "0.67738956", "0.67636615", "0.66968435", "0.6645513", "0.6634592", "0.6633475", "0.66128176", "0.6612306", "0.66095614", "0.66038877", "0.65893686", "0.6585778", "0.65762156", "0.6572341", "0.65569574", "0.65496916", "0.65485746", "0.6545333", "0.65340143", "0.6530901", "0.6522865", "0.6521562", "0.6517936", "0.65134233", "0.65052485", "0.64852864", "0.64837134", "0.64676535", "0.6456256", "0.644509", "0.64324033", "0.643228", "0.64275175", "0.64231765", "0.64164734", "0.6415292", "0.63942975", "0.6388297", "0.63721544", "0.63671434", "0.63463026", "0.6342864", "0.6335169", "0.63244563", "0.63134", "0.63125837", "0.63102794", "0.63102794", "0.63046247", "0.6304", "0.63014114", "0.62975746", "0.6296663", "0.6283926", "0.6277565", "0.6277503", "0.6277196", "0.62705976", "0.6264156", "0.62585306", "0.62568873", "0.6250185", "0.6249038", "0.6247279", "0.62444526", "0.6225681", "0.6223887", "0.6220132", "0.6217733", "0.6215507", "0.6213665", "0.6213443", "0.6210981", "0.62093776", "0.6206757", "0.6203982", "0.6199815", "0.61983985", "0.61933875", "0.61921394", "0.6190554", "0.61873305", "0.6187079", "0.61841863", "0.6183419", "0.6183349", "0.6181865", "0.6180249", "0.6165993", "0.61647373", "0.6163193", "0.61569", "0.6153556" ]
0.7303101
1
capitalizes a sentence passed to it
function capitalize(string) { if (string.indexOf(" ") !== -1) { var arr = string.split(" "); var capitals = arr.map(capitalizeWord); return capitals.join(" "); } else { return capitalizeWord(string); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wordToUpper(strSentence) {\r\n return strSentence.toLowerCase().replace(/\\b[a-z]/g, convertToUpper);\r\n\r\n function convertToUpper() { \r\n\t\treturn arguments[0].toUpperCase(); \r\n\t} \r\n}", "function sentenceCapitalizer(text) {\n let words = text.toLowerCase().split(' ');\n let capitalized = words.map( word => {\n return word[0].toUpperCase() + word.slice(1);\n });\n\n return capitalized.join(' ');\n}", "static capitalize(sentence){\n let a= sentence.toUpperCase().charAt(0);\n return a+sentence.substr(1);\n }", "function sentenceCapitalizer1(text) {\n text = text.toLowerCase();\n let output = \"\";\n text.split(\" \").forEach( sentence => {\n output += sentence.slice(0, 1).toUpperCase();\n output += sentence.slice(1, sentence.length)+\" \";\n } );\n return output.trim();\n}", "function capSentence(text) {\n let wordsArray = text.toLowerCase().split(\" \");\n let capsArray = wordsArray.map((word) => {\n //We use .map() function to loop through every word in the array and execute the same function as before to create capsArray.\n return word[o].toUpperCase() + word.slice(1);\n });\n\n return capsArray.join(\" \");\n}", "function capitalize(str) {}", "function sentence(str) {\n return str.replace(/^\\S/, function(t) { return t.toUpperCase() });\n}", "function sentenceCase(str){\n\t str = toString(str);\n\n\t // Replace first char of each sentence (new line or after '.\\s+') to\n\t // UPPERCASE\n\t return lowerCase(str).replace(/(^\\w)|\\.\\s+(\\w)/gm, upperCase);\n\t }", "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}", "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 capitalizeAll (sentence) {\n let sentenceSplit = sentence.toLowerCase().split(' ');\n for (var i=0; i < sentenceSplit.length; i++) {\n sentenceSplit[i] = sentenceSplit[i][0].toUpperCase() + sentenceSplit[i].slice(1);\n }\n return sentenceSplit.join(' ');\n}", "function sentenceCase(word) {\n return `${word[0].toUpperCase()}${word.substring(1)}`;\n}", "function sentenceCase(word) {\n return `${word[0].toUpperCase()}${word.substring(1)}`;\n}", "function capitalize(s) {\n\t\t\treturn s.toLowerCase().replace( /\\b./g, function(a){ return a.toUpperCase(); } );\n\t\t}", "function capitalizer(str, position) {\r\n}", "function capitalizeAll (sentence) {\n\n var sentenceArray = sentence.split(' ')\n\tvar capitalizedArray = []\n\n sentenceArray.forEach( (word, i) => {\n\t\tcapitalizedArray[i] = word.charAt(0).toUpperCase() + word.substring(1)\n }) \n\n return capitalizedArray.join(' ')\n\n}", "function capitalizeWords(sentence) {\n var sentenceArr = sentence.split(' ');\n var result = [];\n sentenceArr.forEach(function(word) {\n result.push(word[0].toUpperCase() + word.slice(1));\n })\n return result.join(' ');\n}", "function capitalize() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utInTransform,\n sp: utilitymanager_1.um.TIXSelPolicy.Word,\n pat: /\\b(_*\\w)/g, repl: function (_match, p1) { return p1.toUpperCase(); },\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 capSentence(text) {\n let wordsArray = text.toLowerCase().split(\" \");\n //We use toLowercase() to convert the entire sentence in lowercase. We chain it with .split() to divide the lowercase sentence into an array of words.\n let capsArray = [];\n //The array is stored is capsArray.\n\n wordsArray.forEach((word) => {\n capsArray.push(word[0].toUpperCase() + word.slice(1));\n //We iterate through every word in the array, and we take the first letter with slice(1) and turn it to uppercase with toUpperCase().\n });\n\n return capsArray.join(\" \");\n //We combine the transformed first letter (New string from slice()) and the sliced lowercase section with the method join() and push it into our capsArray.\n}", "function toTitleCase(x) {\n var smalls = [];\n var articles = [\"A\", \"An\", \"The\"].forEach(function(d){ smalls.push(d); })\n var conjunctions = [\"And\", \"But\", \"Or\", \"Nor\", \"So\"].forEach(function(d){ smalls.push(d); })\n var prepositions = [\"As\", \"At\", \"By\", \"Into\", \"It\", \"In\", \"For\", \"From\", \"Of\", \"Onto\", \"On\", \"Out\", \"Per\", \"To\", \"Up\", \"Upon\", \"With\"].forEach(function(d){ smalls.push(d); });\n \n x = x.split(\"\").reverse().join(\"\") + \" \"\n\n x = x.replace(/['\"]?[a-z]['\"]?(?= )/g, function(match){return match.toUpperCase();})\n\n x = x.split(\"\").slice(0, -1).reverse().join(\"\")\n\n x = x.replace(/ .*?(?= )/g, function(match){\n if(smalls.indexOf(match.substr(1)) !== -1)\n return match.toLowerCase()\n return match\n })\n\n x = x.replace(/: .*?(?= )/g, function(match){return match.toUpperCase()})\n\n //smalls at the start of sentences shouldbe capitals. Also includes when the sentence ends with an abbreviation.\n x = x.replace(/(([^\\.]\\w\\. )|(\\.[\\w]*?\\.\\. )).*?(?=[ \\.])/g, function(match) {\n var word = match.split(\" \")[1]\n var letters = word.split(\"\");\n\n letters[0] = letters[0].toUpperCase();\n word = letters.join(\"\");\n\n if(smalls.indexOf(word) !== -1) {\n return match.split(\" \")[0] + \" \" + word;\n }\n\n return match\n })\n \n return x\n }", "function convToUpperCase(sentence) {\n var perkata = sentence.toLowerCase().split(' ');\n for (var i = 0; i < perkata.length; i++) {\n perkata[i] = perkata[i].charAt(0).toUpperCase() +\n perkata[i].substring(1);\n }\n return perkata.join(' ');\n }", "function capsSentence(text) {\n let wordsArray = text.toLowerCase().split(\" \");\n\n let capsArray = wordsArray.map((word) => {\n return word.replace(word[0], word[0].toUppercase());\n //We replace the first letter of each word (word[0]) with an uppercase version of the same letter using word.[0].toUppercase as the second parameter of the .replace() method.\n });\n\n return capsArray.join(\" \");\n}", "static capitalize(word){\n let arr;\n arr = word.split(\"\")\n arr[0] = arr[0].toUpperCase()\n return arr.join(\"\")\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 titleCase(str) {return str.toLowerCase().replace(/^[a-z]|\\s[a-z]/g,\nfunction(m){return m.toUpperCase();\n });\n }", "function sentenceToCamelCase(str){\n //const m = /[0-9]*\\.?[0-9]+%\\s/ig;\n //const m2 = /^[a-zA-Z]/;\n // const m2 = /^[a-z]|[A-Z]/g; \n // const m3 = /\\s[a-zA-Z]/g;\n const m3 = /^[a-zA-Z]|\\s[a-zA-Z]/g;\n // let matchArr = str.match(m3);\n return str.replace(m3,(el,idx)=>{\n return el.trim().toUpperCase();\n })\n}", "function makeIntoTitle(sentence) {\n sentence = sentence.toLowerCase().split(' ');\n for (let i = 0; i < sentence.length; i++) {\n sentence[i] = sentence[i].charAt(0).toUpperCase() + sentence[i].slice(1);\n }\n return sentence.join(' ');\n}", "function titleCases(arg){\n return arg.charAt(0).toUpperCase() + arg.substring(1);\n }", "function capitalise(word) {\n var lowerCase = word.toLowerCase();\n return lowerCase.charAt(0).toUpperCase() + lowerCase.slice(1).trim();\n}", "makeCapital(word) {\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n }", "function capitalizeAll(sentence){\n // since the string is what we need to convert, we use an array.\n var sentenceArray = sentence.split(\" \");\n\n for (var i = 0; i < sentenceArray.length; i++) {\n\n var wordArray = sentenceArray[i].split(\"\");\n\n var capitalizedLetter = wordArray[0].toUpperCase();\n\n wordArray[0] = capitalizedLetter;\n\n var joinedWord = wordArray.join(\"\");\n\n sentenceArray[i] = joinedWord;\n\n }\n var joinedSentence = sentenceArray.join(\" \")\n return joinedSentence;\n}", "function camelCase(text){\n let words = text.split(\" \");\n var ans=\"\";\n for(var j=0;j<words.length;j++){\n ans += words[j].substr(0,1).toUpperCase();\n ans += words[j].substr(1,)\n ans += \" \";\n }\n return ans;\n}", "function uppercase(input) {}", "function allTitleCase(inStr, cb) { \n\tcb(null, inStr.replace(/\\w\\S*/g, \n\t\tfunction(tStr) {\n\t\treturn tStr.charAt(0).toUpperCase() + tStr.substr(1).toLowerCase();\n\t\t})\n\t);\n}", "function capitalize(str) {\n str = str.toLowerCase();\n return finalSentence = str.replace(/(^\\w{1})|(\\s+\\w{1})/g, letter => letter.toUpperCase());\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 CapitalizeWord(str)\n {\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n }", "function titleCase(txt) {\r\n\r\n var arrTxt = txt.split(' ');\r\n \r\n var newStr = '';\r\n \r\n for (var i = 0; i < arrTxt.length; i++) {\r\n var lower = arrTxt[i].toLowerCase();\r\n newStr += lower.charAt(0).toUpperCase() + lower.slice(1) + ' ';\r\n }\r\n \r\n return newStr.trim();\r\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 titleCase(s){\n s=s.toLowerCase().trim();\n \n l = s.split(\" \");\n for(i=0; i<l.length; i++){\n l[i] = l[i][0].toUpperCase() + l[i].slice(1);\n };\n s = l.join(\" \");\n return s;\n}", "function capitalize(s){\n\t\t\treturn s[0].toUpperCase() + s.slice(1);\n\t\t}", "function everyWordCapitalized(aPhrase) {\n var becomeAnArray = aPhrase.split(\" \");\n \n for (var i=0; i<becomeAnArray.length; i++){\n var firstChar = becomeAnArray[i].charAt(0);\n var rest = becomeAnArray[i].substring(1);\n \n \n \n firstChar = firstChar.toUpperCase();\n rest = rest.toLowerCase();\n becomeAnArray[i] = firstChar + rest;\n \n }\n \n return becomeAnArray.join(\" \");\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 convToUpperCase(mySentence)\n{\n let sentence = mySentence.split(\" \");\n\n for(let i=0; i < sentence.length; i++)\n {\n sentence[i] = sentence[i][0].toUpperCase() + sentence[i].substr(1);\n }\n const res = sentence.join(\" \")\n return res;\n}", "function caps(a) {return a.substring(0,1).toUpperCase() + a.substring(1,a.length);}", "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 capitalizeTitle(str) {\n let ar = str.split(\" \");\n const wordExceptions = [\"the\", \"in\", \"as\", \"per\", \"a\", \"of\", \"an\", \"for\", \"nor\", \"or\", \"yet\", \"so\", \"at\", \"from\", \"on\", \"to\", \"with\", \"without\"]\n ar.forEach((word, i) => {\n if (i == 0 || !wordExceptions.includes(word))\n ar[i] = word.charAt(0).toUpperCase() + word.substring(1);\n });\n return ar.join(\" \");\n}", "function sentenceCase (str) {\n return str.replace(/[a-z]/i, letter => letter.toUpperCase()).trim()\n }", "function capitalize(word) { // capitalizes word\n return word[0].toUpperCase() + word.slice(1).toLowerCase();\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 titleCase(str) {\nreturn str.replace(/\\w\\S*/g, function(txt) { // Checks for a character then zero or more non-white space\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // replaces the first char with a CAP letter\n}", "function capitalise(str) {\n return str.toLowerCase().replace(/^\\S/, function(t) { return t.toUpperCase() });\n}", "function toTitleCase(str)\n //Make string words start with caps. hello world = Hello World.\n{\n return str.replace(/\\w\\S*/g,\n function(txt){\n return txt.charAt(0).toUpperCase() +\n txt.substr(1).toLowerCase();\n });\n}", "function titleCase(str) {\n str = str.toLowerCase().split(' '); // will split the string delimited by space into an array of words\n\n for(var i = 0; i < str.length; i++){ // str.length holds the number of occurrences of the array...\n str[i] = str[i].split(''); // splits the array occurrence into an array of letters\n str[i][0] = str[i][0].toUpperCase(); // converts the first occurrence of the array to uppercase\n str[i] = str[i].join(''); // converts the array of letters back into a word\n }\n return str.join(' '); // converts the array of words back to a sentence\n}", "function titlecase(str){\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\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 titleCase(str) {\nreturn str.replace(/\\w\\S*/g, function(txt) { // Checks for a character then zero or more non-white space\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // Replaces the first char with a CAP letter\n}", "function camelCase (userInput) {\n // let shouldCapitalize = true;\n // let result = \"\";\n // for (let i = 0; i < userInput.length; i++) {\n // // Check for the first letter in a word, if it is, then Capitalize\n // if (userInput.charAt(i) === \" \") {\n // result += userInput.charAt(i);\n // shouldCapitalize = true;\n // }\n // else if (shouldCapitalize == true) {\n // result += userInput.charAt(i).toUpperCase();\n // shouldCapitalize = false;\n // } \n // else if (shouldCapitalize == false) {\n // result += userInput.charAt(i);\n // shouldCapitalize = false;\n // } \n // }\n let result = capitalizeWords(userInput);\n let newString = result.replaceAll( \" \", \"\");\n return newString;\n\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 capitalize(text){\n // in: \"some_string\"\n // out: \"Some_string\"\n return text.charAt(0).toUpperCase() + text.slice(1);\n}", "function ucfirst(str,force){\n str=force ? str.toLowerCase() : str;\n return str.replace(/(\\b)([a-zA-Z])/,\n function(firstLetter){\n return firstLetter.toUpperCase();\n });\n }", "function capitalize(word) {\n\treturn word[0].toUpperCase() + word.slice(1).toLowerCase();\n}", "function titleCase(str) {\n // Mutating str (oh no!) to an array of lowercase words using split() by a space \n str = str.toLowerCase().split(' ');\n // Iterating through str\n for (var i = 0; i < str.length; i++){\n // capitalLetter is first letter of current word -> made uppercase \n capitalLetter = str[i].charAt(0).toUpperCase();\n // replacing the first letter in current word with capitalLetter\n str[i] = str[i].replace(/[a-z]/, capitalLetter);\n }\n // str = str array joined into a single string\n str = str.join('');\n return str;\n }", "toTitleCase(phrase) {\n return phrase\n .toLowerCase()\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\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 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 titleCase(str) {\n //put each word in array\n let lowerCase = str.toLowerCase().split(' ');\n //capitalize each word in array\n let capitalized = lowerCase.map(function(value) {\n return value.substring(0,1).toUpperCase() + value.substring(1);\n });\n //convert array back to string\n return capitalized.join(' ');\n \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 capitalize(inputString){\r\n\t\t\t\tif(inputString == null){\r\n\t\t\t\t\treturn \"There is no text\";\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\treturn inputString.charAt(0).toUpperCase() + inputString.slice(1);\r\n\t\t\t\t}\r\n\t\t\t}", "function titleCase(text) {\n if(text) {\n let output = \"\";\n let stringArray = text.split(\" \");\n for(let i = 0; i < stringArray.length; i ++) {\n for(let j = 0; j < stringArray[i].length; j ++) {\n let chr = stringArray[i][j];\n if(j === 0) {\n output += chr.toUpperCase();\n } else {\n output += chr.toLowerCase();\n }\n }\n if(i < stringArray.length - 1) {\n output += \" \";\n }\n }\n return output;\n } else {\n return text;\n }\n}", "function capitalize(word) {\n return word[0].toUpperCase() + word.slice(1).toLowerCase();\n }", "function camelCasizza(s) {\r\r\n s = s.toLowerCase()\r\r\n var c = s[0].toUpperCase();\r\r\n return c + s.substring(1, s.length);\r\r\n}", "function applyCapitalLetter(str){\r\n \r\n var arr = str.split(\" \");\r\n for (var i=0; i < arr.length; i++){\r\n arr[i] = arr[i].replace(arr[i][0], arr[i][0].toUpperCase()); \r\n }\r\n return arr.join(\" \");\r\n}", "function titleCase(word) {\n var splitStr = word.toLowerCase().split(\"the quick brown fox\");\n \n for (var i = 0; i < splitStr.length; i++) {\n if (splitStr.length[i] < splitStr.length) {\n splitStr[i].charAt(0).toUpperCase();\n }\n document.write(splitStr)\n }\n \n return word;\n }", "function makeIntoTitle(sentence) {\n // Your code here\n if (typeof sentence === \"string\") {\n let newSentence = \"\";\n sentenceArray = sentence.split(\" \");\n for (let j = 0; j < sentenceArray.length; j++) {\n let wordArray = sentenceArray[j].split(\"\");\n wordArray[0] = wordArray[0].toUpperCase();\n for (let i = 1; i < sentenceArray[j].length; i++) {\n wordArray[i] = wordArray[i].toLowerCase();\n }\n if (j < sentenceArray.length - 1) {\n newSentence = newSentence.concat(wordArray.join(\"\"), \" \");\n } else {\n newSentence = newSentence.concat(wordArray.join(\"\"));\n }\n }\n return newSentence;\n }\n return undefined;\n}", "function capitalize_Words(str) {\n return str.replace(/\\w\\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "static toTitleCase(text) {\n if (text) {\n if (text.length > 1) {\n return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();\n } else {\n return text.toUpperCase();\n }\n }\n }", "function capitalizeEachWord(str) {\n return str.toUpperCase();\n}", "function titleCase(str) {\n var wordsCap = str.split(\" \");\n var newArr = wordsCap.map(function(x){\n var ltrs = x.split('');\n var newWord = \"\"\n for (var i = 0; i < ltrs.length; i++){\n if (i==0){\n newWord += ltrs[i].toUpperCase()\n } else {\n newWord += ltrs[i].toLowerCase();\n }\n\n }\n return newWord;\n });\n return newArr.join(\" \");\n}", "capitalize(word){\n let char = word.charAt(0).toUpperCase();\n let remainder = word.slice(1);\n return char + remainder;\n }", "function captialize(word){\n\treturn word.charAt(0).toUpperCase() + word.slice(1);\n}", "function toTitleCase(str)\n{\nreturn str.replace(/\\w\\S*/g, function(txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "function capitalizeAllWords(words){\n return words.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function titleCase(str) {\n //The map() method creates a new array with the results of calling a provided function on every element in the calling array.\n return str.toLowerCase().split(\" \").map(function(word) {\n //The replace() method returns a new string with some or all matches of a pattern replaced by a replacement.\n return word.replace(word[0], word[0].toUpperCase());\n}).join(\" \");\n }", "function capitalizeWord(word){\n return word[0].toUpperCase() + word.substr(1);\n}", "function titleCase(str) {\n\n\n\n\t\t// make entire string lower case\n\t\tvar myString = str.toLowerCase();\n\t\t// split words in string into array elements\n\t\tvar myArray = myString.split(\" \");\n\t\t// find last array element\n\t\tvar last = myArray[myArray.length - 1];\n\t\tvar capArrayValue = \"\";\n\t\tvar finalString = \"\";\n\n\n\t\tfor (var i=0; i < myArray.length; i++)\n\t\t{\n\t\t\t// capitalize first character of array element\n\t\t\tcapArrayValue = myArray[i].charAt(0).toUpperCase() + myArray[i].slice(1);\n\n\t\t\tif (myArray[i] == last) {\n\t\t\t\tfinalString = finalString.concat(capArrayValue);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tcapArrayValue += \" \";\n\t\t\t\tfinalString = finalString.concat(capArrayValue);\n\t\t\t}\n\n\t\t}\n\n\n\t\treturn finalString;\n\t}", "function Capitalize(str){\n\tvar arr = str.split(\"\");\n\n\tfor(var i= 0;i< arr.length; i++){\n\t\tif(i === 0 ){\n\t\t\tarr[i] = arr[i].toUpperCase();\n\t\t} \n\t}\n\treturn arr.join(\"\"); \n\n}", "function capitalizeWord(word) {\n return word[0].toUpperCase() + word.slice(1);\n}", "function uncapitalize(text) {\n if (!text || typeof text !== \"string\") {\n return '';\n }\n return text.charAt(0).toLowerCase() + text.substr(1);\n }", "function titleCaseSentence(str) {\n return str.toLowerCase().split(\" \").map(item => {\n return item.replace(item.charAt(0), item.charAt(0).toUpperCase());\n }).join(\" \");\n}", "function convToUpperCase(sentence) {\r\n firstChart = sentence.split(\" \")\r\n\r\n for (let index = 0; index < firstChart.length; index++) {\r\n ubah = firstChart[index].toUpperCase()\r\n firstChart[index] = ubah.charAt(0) + firstChart[index].substring(1)\r\n }\r\n\r\n let firstChart1 = \"\";\r\n for (let index = 0; index < firstChart.length; index++) {\r\n firstChart1 = firstChart1 + firstChart[index] + \" \" \r\n }\r\n\r\n return firstChart1\r\n}", "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 titlecase(str) {\n return str.split(' ').map((word) => word[0].toUpperCase() + word.slice(1)).join(' ');\n}", "function titleCase(str) {\n var arr = str.split(' ');\n \n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i].toLowerCase();\n var upper = arr[i].charAt(0);\n arr[i] = arr[i].replace(upper, upper.toUpperCase());\n }\n \n jaydenSpeak = arr.join(' ');\n \n return jaydenSpeak;\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 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 titleCase(str){\n\n var titlecased=str.split(\" \");\n \n for(var i=0;i<titlecased.length;i++){\n \n titlecased[i]=titlecased[i].toLowerCase().replace(titlecased[i][0].toLowerCase(),titlecased[i][0].toUpperCase());\n \n }\n\n titlecased=titlecased.join(' ');\n\n return titlecased;\n}", "static capitalize(string){\n let array = string.split(\"\")\n array[0] = string[0].toUpperCase()\n return array.join(\"\")\n }", "function sentenceCase (str) {\n return lowerCase(stringify(str)).replace(/(^\\w)|\\.\\s+(\\w)/gm, upperCase)\n}", "function titleLize (word) { // 将开头字母转化为大写\n return word.replace(/^\\w/, function (match) {\n return match.toUpperCase();\n })\n }" ]
[ "0.779856", "0.7724027", "0.75484776", "0.7546282", "0.7521908", "0.7505793", "0.7475641", "0.742737", "0.741969", "0.73814964", "0.73811716", "0.73753524", "0.73753524", "0.7375128", "0.73459774", "0.73022485", "0.72983915", "0.7291631", "0.72837454", "0.72716814", "0.7269874", "0.72297245", "0.7208535", "0.7205184", "0.7203045", "0.7175921", "0.71743715", "0.71716", "0.71646607", "0.71398747", "0.7129691", "0.7118193", "0.7114211", "0.71079224", "0.71000534", "0.70855016", "0.70789003", "0.70596945", "0.70392823", "0.703247", "0.70301545", "0.70298904", "0.70066065", "0.70011574", "0.69987077", "0.69961756", "0.69944036", "0.69882995", "0.6965367", "0.69590175", "0.69587743", "0.69586664", "0.69536597", "0.69492686", "0.69392014", "0.6937147", "0.6936198", "0.69342196", "0.69220984", "0.6916781", "0.69106454", "0.69101775", "0.6909565", "0.69066554", "0.6904213", "0.6902854", "0.69010925", "0.6899847", "0.68931735", "0.68863916", "0.6881752", "0.6878204", "0.6874619", "0.6865539", "0.6854123", "0.6842534", "0.68421817", "0.6839001", "0.6838872", "0.6837564", "0.6837327", "0.6829257", "0.6818728", "0.6809716", "0.6808598", "0.6803848", "0.68030494", "0.68027633", "0.6799837", "0.6799405", "0.67966616", "0.67962486", "0.6791451", "0.67899626", "0.678855", "0.6781061", "0.67800057", "0.6771038", "0.6768699", "0.6765524", "0.67647684" ]
0.0
-1
capitalizes a single word
function capitalizeWord(string) { return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function capitalize(str) {}", "function capitalise(word) {\n var lowerCase = word.toLowerCase();\n return lowerCase.charAt(0).toUpperCase() + lowerCase.slice(1).trim();\n}", "function CapitalizeWord(str)\n {\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n }", "makeCapital(word) {\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n }", "function wordToUpper(strSentence) {\r\n return strSentence.toLowerCase().replace(/\\b[a-z]/g, convertToUpper);\r\n\r\n function convertToUpper() { \r\n\t\treturn arguments[0].toUpperCase(); \r\n\t} \r\n}", "function capitalize(word) {\n\treturn word[0].toUpperCase() + word.slice(1).toLowerCase();\n}", "function capitalize() {\n utilitymanager_1.um.utilityManager({\n utilType: utilitymanager_1.um.TIXUtilityType.utInTransform,\n sp: utilitymanager_1.um.TIXSelPolicy.Word,\n pat: /\\b(_*\\w)/g, repl: function (_match, p1) { return p1.toUpperCase(); },\n });\n }", "function capitalize(word) {\n return word[0].toUpperCase() + word.slice(1).toLowerCase();\n }", "function allCaps(word){\n return word.toUpperCase()\n}", "static capitalize(word){\n let arr;\n arr = word.split(\"\")\n arr[0] = arr[0].toUpperCase()\n return arr.join(\"\")\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(word) { // capitalizes word\n return word[0].toUpperCase() + word.slice(1).toLowerCase();\n}", "function capitalizeEachWord(str) {\n return str.toUpperCase();\n}", "function capitalizeWord(word){\n return word[0].toUpperCase() + word.substr(1);\n}", "function capitalizeWord(word) {\n return word[0].toUpperCase() + word.substr(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(word) {\n return word[0].toUpperCase() + word.slice(1);\n}", "function caps(a) {return a.substring(0,1).toUpperCase() + a.substring(1,a.length);}", "function capitalize_Words(str) {\n return str.replace(/\\w\\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "function ucfirst(str,force){\n str=force ? str.toLowerCase() : str;\n return str.replace(/(\\b)([a-zA-Z])/,\n function(firstLetter){\n return firstLetter.toUpperCase();\n });\n }", "function capitalizeWord(word) {\n var loweredString = word.toLowerCase();\n\n if (loweredString === 'javascript') return 'JavaScript';\n\n var newString = '';\n newString = loweredString[0].toUpperCase();\n\n for (var i = 1; i < loweredString.length; i++) {\n newString += loweredString[i];\n }\n\n return newString;\n}", "function capitalize(word) {\n return word.charAt(0).toUpperCase() + word.slice(1);\n}", "function captialize(word){\n\treturn word.charAt(0).toUpperCase() + word.slice(1);\n}", "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 sentenceCase(word) {\n return `${word[0].toUpperCase()}${word.substring(1)}`;\n}", "function sentenceCase(word) {\n return `${word[0].toUpperCase()}${word.substring(1)}`;\n}", "function titlecase(str){\n return str.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function titleCase(str) {\nreturn str.replace(/\\w\\S*/g, function(txt) { // Checks for a character then zero or more non-white space\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // replaces the first char with a CAP letter\n}", "capitalize(word){\n let char = word.charAt(0).toUpperCase();\n let remainder = word.slice(1);\n return char + remainder;\n }", "function capitalize(s) {\n\t\t\treturn s.toLowerCase().replace( /\\b./g, function(a){ return a.toUpperCase(); } );\n\t\t}", "function titleCase(str) {\nreturn str.replace(/\\w\\S*/g, function(txt) { // Checks for a character then zero or more non-white space\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); // Replaces the first char with a CAP letter\n}", "function titleCase(str) {return str.toLowerCase().replace(/^[a-z]|\\s[a-z]/g,\nfunction(m){return m.toUpperCase();\n });\n }", "function capitalizeWord(word){\n return word.charAt(0).toUpperCase() + word.slice(1);\n}", "function LetterCapitalize(str) {\n return str.replace(/\\w\\S*/g, function(txt) {\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n });\n}", "function capitalizeAllWords(string) {\n return string.replace(/\\b\\w/g, function(string){ \n return string.toUpperCase(); \n });\n}", "function stringCapitalize(new_word) {\n return new_word.charAt(0).toUpperCase() + new_word.slice(1);\n}", "function capitalise(str) {\n return str.toLowerCase().replace(/^\\S/, function(t) { return t.toUpperCase() });\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 applyCapitalLetter(str){\r\n \r\n var arr = str.split(\" \");\r\n for (var i=0; i < arr.length; i++){\r\n arr[i] = arr[i].replace(arr[i][0], arr[i][0].toUpperCase()); \r\n }\r\n return arr.join(\" \");\r\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 xCapitalize(str)\r\n{\r\n var i, c, wd, s='', cap = true;\r\n \r\n for (i = 0; i < str.length; ++i) {\r\n c = str.charAt(i);\r\n wd = isWordDelim(c);\r\n if (wd) {\r\n cap = true;\r\n } \r\n if (cap && !wd) {\r\n c = c.toUpperCase();\r\n cap = false;\r\n }\r\n s += c;\r\n }\r\n return s;\r\n\r\n function isWordDelim(c)\r\n {\r\n // add other word delimiters as needed\r\n // (for example '-' and other punctuation)\r\n return c == ' ' || c == '\\n' || c == '\\t';\r\n }\r\n}", "function capitalizeWord(word) {\n const newWord = word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase();\n return newWord;\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 uppercase_word(str) {\n return str.replace(/\\w\\S*/g, \n function(txt){\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n }\n );\n}", "function capitalizeEachWord(str) {\n return str.replace(/\\w\\S*/g, function(txt) {\n if (txt.length >3) {\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n }\n else {\n return txt;\n }\n });\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 capitalizeAllWords(words){\n return words.replace(/\\w\\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});\n}", "function titleLize (word) { // 将开头字母转化为大写\n return word.replace(/^\\w/, function (match) {\n return match.toUpperCase();\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 camelCase(text){\n let words = text.split(\" \");\n var ans=\"\";\n for(var j=0;j<words.length;j++){\n ans += words[j].substr(0,1).toUpperCase();\n ans += words[j].substr(1,)\n ans += \" \";\n }\n return ans;\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 firstLetterCapital (word) {\n var wordArray = word.split(' ');\n var newWordArray = [];\n for (var i = 0; i < wordArray.length; i++) {\n newWordArray.push(wordArray[i].charAt(0).toUpperCase() + wordArray[i].slice(1));\n }\n return newWordArray.join(' ');\n}", "capitalizeFirstLetter(word) {\n return (word.charAt(0).toUpperCase() + word.substring(1));\n }", "function titleCases(arg){\n return arg.charAt(0).toUpperCase() + arg.substring(1);\n }", "function capitalizeWord(string) {\n return string[0].toUpperCase() + string.substring(1);\n}", "function capitalizer(str, position) {\r\n}", "function ucwords(str,force){\n str=force ? str.toLowerCase() : str;\n return str.replace(/(^([a-zA-Z\\p{M}]))|([ -][a-zA-Z\\p{M}])/g,\n function(firstLetter){\n return firstLetter.toUpperCase();\n });\n}", "function titlecase(str) {\n return str.split(' ').map((word) => word[0].toUpperCase() + word.slice(1)).join(' ');\n}", "function toTitleCase(str)\n //Make string words start with caps. hello world = Hello World.\n{\n return str.replace(/\\w\\S*/g,\n function(txt){\n return txt.charAt(0).toUpperCase() +\n txt.substr(1).toLowerCase();\n });\n}", "function capitalize(name) {\n return name.replace(/^\\w/, function (m) {\n return m.toUpperCase();\n });\n }", "function capitalize(name) {\n return name.replace(/^\\w/, function (m) {\n return m.toUpperCase();\n });\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 uppercase(input) {}", "function titleLize(word) {\n // 将开头字母转化为大写\n return word.replace(/^\\w/, function (match) {\n return match.toUpperCase();\n });\n }", "function capitalizeWords(str) {\n\treturn str.replace(/\\w\\S*/g, function (txt) {\n\t\treturn txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n\t});\n}", "function toUpperCase(word) {\n return word.toUpperCase();\n}", "function capitalizeWord(word) {\n let words = word.trim().replace(/^\\w/, (c) => c.toUpperCase());\n return words;\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 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 capitalizeString(term){\n\treturn term.charAt(0).toUpperCase() + term.substr(1);\n}", "function everyWordCapitalized(aPhrase) {\n var becomeAnArray = aPhrase.split(\" \");\n \n for (var i=0; i<becomeAnArray.length; i++){\n var firstChar = becomeAnArray[i].charAt(0);\n var rest = becomeAnArray[i].substring(1);\n \n \n \n firstChar = firstChar.toUpperCase();\n rest = rest.toLowerCase();\n becomeAnArray[i] = firstChar + rest;\n \n }\n \n return becomeAnArray.join(\" \");\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 sentenceCapitalizer(text) {\n let words = text.toLowerCase().split(' ');\n let capitalized = words.map( word => {\n return word[0].toUpperCase() + word.slice(1);\n });\n\n return capitalized.join(' ');\n}", "function capitalizeWord (string) {\n var firstLetter = string[0];\n var restOfWord = string.substring(1); \n return firstLetter.toUpperCase() + restOfWord;\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(s){\n\t\t\treturn s[0].toUpperCase() + s.slice(1);\n\t\t}", "function LetterCapitalize(str) { \n return str\n .split(' ')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n}", "function titleCase(word) {\n var splitStr = word.toLowerCase().split(\"the quick brown fox\");\n \n for (var i = 0; i < splitStr.length; i++) {\n if (splitStr.length[i] < splitStr.length) {\n splitStr[i].charAt(0).toUpperCase();\n }\n document.write(splitStr)\n }\n \n return word;\n }", "function capitalizeWord(string) {\n return string[0].toUpperCase() + string.slice(1);\n}", "function toTitleCase(str) {\n \t\t\t\tstr = str.replace(/_/g, \" \");\n \t\t\t\treturn str.replace(/(?:^|\\s)\\w/g, function(match) {\n\n \t\t\t\t\treturn match = match.toUpperCase();\n \t\t\t\t});\n\n \t\t\t}", "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 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 }", "cap(lower) {\n return lower.replace(/^\\w/, c => c.toUpperCase());\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 upperCaseWord(word) {\n return word.toUpperCase();\n}", "function toTitleCase(str)\n{\nreturn str.replace(/\\w\\S*/g, function(txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });\n}", "function allTitleCase(inStr, cb) { \n\tcb(null, inStr.replace(/\\w\\S*/g, \n\t\tfunction(tStr) {\n\t\treturn tStr.charAt(0).toUpperCase() + tStr.substr(1).toLowerCase();\n\t\t})\n\t);\n}", "camelize(s){\n return s.replace (/(?:^|[-_])(\\w)/g, function (_, c) {\n return c ? c.toUpperCase () : '';\n })\n }", "function titleCase(txt) {\r\n\r\n var arrTxt = txt.split(' ');\r\n \r\n var newStr = '';\r\n \r\n for (var i = 0; i < arrTxt.length; i++) {\r\n var lower = arrTxt[i].toLowerCase();\r\n newStr += lower.charAt(0).toUpperCase() + lower.slice(1) + ' ';\r\n }\r\n \r\n return newStr.trim();\r\n }", "function firstWordCapitalize(word){\n let firstCharcter = word[0].toUpperCase();\n return firstCharcter + word.slice(1);\n \n}", "static capitalize(sentence){\n let a= sentence.toUpperCase().charAt(0);\n return a+sentence.substr(1);\n }", "function capitalizedName(name) {\n const arrName = name.split(''); \n let capName = '';\n capName = name.charAt(0).toUpperCase(); \n capName += arrName.slice(1).join(''); \n return capName; \n }", "function capitalizeWord(string) {\n var lowerCase = '';\n var upperCaseLetter = '';\n var javaScript = 'JavaScript';\n\n if (string.toLowerCase() === 'javascript') {\n return javaScript;\n } else {\n lowerCase = string.slice(1).toLowerCase();\n upperCaseLetter = string.charAt(0).toUpperCase();\n upperCaseLetter = upperCaseLetter.concat(lowerCase);\n return upperCaseLetter;\n }\n\n}", "function titleCase(str) {\n // Mutating str (oh no!) to an array of lowercase words using split() by a space \n str = str.toLowerCase().split(' ');\n // Iterating through str\n for (var i = 0; i < str.length; i++){\n // capitalLetter is first letter of current word -> made uppercase \n capitalLetter = str[i].charAt(0).toUpperCase();\n // replacing the first letter in current word with capitalLetter\n str[i] = str[i].replace(/[a-z]/, capitalLetter);\n }\n // str = str array joined into a single string\n str = str.join('');\n return str;\n }", "function capitalize(words) {\n const separateWord = words.toLowerCase().split(' ');\n for (let i = 0; i < separateWord.length; i++) {\n separateWord[i] =\n separateWord[i].charAt(0).toUpperCase() + separateWord[i].substring(1);\n }\n return separateWord.join(' ');\n}", "function wordCap(string) {\n return string.split(' ')\n .map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase())\n .join(' ');\n}", "function titleCase(s){\n s=s.toLowerCase().trim();\n \n l = s.split(\" \");\n for(i=0; i<l.length; i++){\n l[i] = l[i][0].toUpperCase() + l[i].slice(1);\n };\n s = l.join(\" \");\n return s;\n}", "function titleCase(str) {\n //put each word in array\n let lowerCase = str.toLowerCase().split(' ');\n //capitalize each word in array\n let capitalized = lowerCase.map(function(value) {\n return value.substring(0,1).toUpperCase() + value.substring(1);\n });\n //convert array back to string\n return capitalized.join(' ');\n \n}" ]
[ "0.8070783", "0.800358", "0.79591554", "0.78803617", "0.7834327", "0.7818528", "0.780849", "0.7802649", "0.77650654", "0.7759977", "0.7739598", "0.77263695", "0.7724416", "0.77139807", "0.7688254", "0.7677595", "0.7665198", "0.7629969", "0.76225066", "0.7563027", "0.75520056", "0.7547411", "0.74991834", "0.7495935", "0.7492495", "0.7492495", "0.7486682", "0.7485115", "0.747858", "0.74652874", "0.7458764", "0.7457755", "0.7446333", "0.7445636", "0.7435944", "0.7429674", "0.7425427", "0.7422499", "0.742196", "0.7419633", "0.74095035", "0.7406419", "0.74024487", "0.74024177", "0.73884475", "0.73868686", "0.73814327", "0.73743993", "0.73723286", "0.73714495", "0.7368924", "0.7362564", "0.7356138", "0.73495334", "0.7341816", "0.7339663", "0.73392195", "0.7331538", "0.73311496", "0.7327957", "0.7327957", "0.7317158", "0.73118407", "0.73105454", "0.730906", "0.730395", "0.73022133", "0.7301368", "0.7299574", "0.72968364", "0.7290632", "0.7288264", "0.72869533", "0.72841036", "0.7275292", "0.7266112", "0.725949", "0.7252499", "0.72521985", "0.7250263", "0.72445744", "0.7243697", "0.7235156", "0.7234688", "0.722815", "0.722601", "0.72170854", "0.7216152", "0.72104186", "0.7208135", "0.7208119", "0.71978295", "0.7196004", "0.7182003", "0.7177175", "0.7177165", "0.7166097", "0.71648806", "0.7160638", "0.71597713" ]
0.7354588
53
Rotates a color through the color wheel
function Gradient(){ this.name = "Gradient" this.config = { color1: { type: 'color', value: { r: 255, g: 233, b: 61 } }, color2: { type: 'color', value: { r: 0, g: 16, b: 94 } }, speed: { name: 'Speed', type: 'range', value: 300, min: 100, max: 50000 } } this.frame = 0; this.duration = -1; this.complete = false; this.rgb = false; this.color3 = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function colorwheel(a,theta,x){return a*(1+cos(theta+x))}", "function colorwheel(pos) {\n pos = 255 - pos;\n if (pos < 85) { return rgb2Int(255 - pos * 3, 0, pos * 3); }\n else if (pos < 170) { pos -= 85; return rgb2Int(0, pos * 3, 255 - pos * 3); }\n else { pos -= 170; return rgb2Int(pos * 3, 255 - pos * 3, 0); }\n }", "function changeColor(color)\n{\n\n if (color.direction==1)\n {\n if(color.color<255)\n {\n color.color+=(color.speed);\n \n \n }\n else\n {\n color.direction=0;\n }\n \n }\n else if(color.direction==0)\n {\n if(color.color>0)\n {\n color.color-=(color.speed);\n \n \n }\n else\n {\n color.direction=1;\n }\n }\n \n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n } // Combination Functions", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function rotateColors(display) {\n var red = 0;\n var green = 0;\n var blue = 0;\n display.setColor(red, green, blue);\n setInterval(function() {\n blue += 64;\n if (blue > 255) {\n blue = 0;\n green += 64;\n if (green > 255) {\n green = 0;\n red += 64;\n if (red > 255) {\n red = 0;\n }\n }\n }\n display.setColor(red, green, blue);\n display.setCursor(0,0);\n //display.write('red=' + red + ' grn=' + green + ' ');\n display.setCursor(1,0);\n //display.write('blue=' + blue + ' '); // extra padding clears out previous text\n display.write('and cute');\n }, 1000);\n}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (mathRound(hsl.h) + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}", "function spin(color, amount) {\n\t var hsl = tinycolor(color).toHsl();\n\t var hue = (hsl.h + amount) % 360;\n\t hsl.h = hue < 0 ? 360 + hue : hue;\n\t return tinycolor(hsl);\n\t}", "function spin(color, amount) {\n\t var hsl = tinycolor(color).toHsl();\n\t var hue = (hsl.h + amount) % 360;\n\t hsl.h = hue < 0 ? 360 + hue : hue;\n\t return tinycolor(hsl);\n\t}", "shiftColor() {\n\t\t// parse color into numbers\n\t\tvar colArr = [\n parseInt(this.color.substr(1,2),16),\n parseInt(this.color.substr(3,2),16),\n parseInt(this.color.substr(5,2),16)\n ];\n var colStr = '#';\n var val;\n const shift = Math.floor((Math.random() - 0.5) * this.colVar * this.colRange);\n\t\tfor (val of colArr) {\n\t\t\tval += shift;\n\t\t\tcolStr += val.toString(16);\n\t\t}\n\t\tthis.color = colStr;\n\t}", "function rotateColors(display) {\nvar red = 0;\nvar green = 0;\nvar blue = 0;\ndisplay.setColor(red, green, blue);\nsetInterval(function() {\nblue += 64;\nif (blue > 255) {\n blue = 0;\n green += 64;\n if (green > 255) {\n green = 0;\n red += 64;\n if (red > 255) {\n red = 0;\n }\n }\n}\ndisplay.setColor(red, green, blue);\ndisplay.setCursor(0, 0);\ndisplay.write(' Hackster.io');\ndisplay.setCursor(1,1);\ndisplay.write('Intel Edison');\n // extra padding clears out previous text\n}, 1000);\n}", "function spin(color, amount) {\n\t\t\tvar hsl = tinycolor(color).toHsl();\n\t\t\tvar hue = (mathRound(hsl.h) + amount) % 360;\n\t\t\thsl.h = hue < 0 ? 360 + hue : hue;\n\t\t\treturn tinycolor(hsl);\n\t}", "function spin(color, amount) {\n\t\t\tvar hsl = tinycolor(color).toHsl();\n\t\t\tvar hue = (mathRound(hsl.h) + amount) % 360;\n\t\t\thsl.h = hue < 0 ? 360 + hue : hue;\n\t\t\treturn tinycolor(hsl);\n\t}", "function spin(color, amount) {\n\t var hsl = tinycolor(color).toHsl();\n\t var hue = (mathRound(hsl.h) + amount) % 360;\n\t hsl.h = hue < 0 ? 360 + hue : hue;\n\t return tinycolor(hsl);\n\t}", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (mathRound(hsl.h) + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (mathRound(hsl.h) + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (mathRound(hsl.h) + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (mathRound(hsl.h) + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }", "function spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (mathRound(hsl.h) + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }", "function _spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n } // Combination Functions", "changeColor() {\n // If the key \"Z\" is down, decrease the red value\n if (keyIsDown(90)) {\n if (this.red > 0) {\n this.red -= 1;\n // If the red value is less than or equal to 0, set it to 255\n } else if (this.red <= 0) {\n this.red = 255;\n }\n }\n // If the key \"X\" is down, decrease the green value\n if (keyIsDown(88)) {\n if (this.green > 0) {\n this.green -= 1;\n // If the green value is less than or equal to 0, set it to 255\n } else if (this.green <= 0) {\n this.green = 255;\n }\n }\n // If the key \"C\" is down, decrease the blue value\n if (keyIsDown(67)) {\n if (this.blue > 0) {\n this.blue -= 1;\n // If the blue value is less than or equal to 0, set it to 255\n } else if (this.blue <= 0) {\n this.blue = 255;\n }\n }\n }", "function _spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }", "rotateClockwise()\r\n {\r\n this.rotation += Math.PI / 180;\r\n }", "function rotateSlider(event) {\n if (event.deltaY >= 0) {\n rotate += 10;\n this.style.transform = \"rotate(\" + rotate + \"deg)\";\n this.style.filter = \"hue-rotate(\" + rotate + \"deg)\";\n }\n else {\n rotate -= 10;\n this.style.transform = \"rotate(\" + rotate + \"deg)\";\n this.style.filter = \"hue-rotate(\" + rotate + \"deg)\";\n }\n}", "set color(c){\n this.currentColor = this.findPalRGB(c);\n }", "set elbowRotationDegree(value) { this._elbowRotation = (value / 180.0 * Math.PI); }", "function _spin(color, amount) {\n\t var hsl = tinycolor(color).toHsl();\n\t var hue = (hsl.h + amount) % 360;\n\t hsl.h = hue < 0 ? 360 + hue : hue;\n\t return tinycolor(hsl);\n\t}", "updateColor() {\n if (this.colorToLerpTo == 0) {\n if (this.r != 255) {\n this.r++;\n if (this.g != 20) this.g--;\n if (this.b != 147) this.b--;\n this.color = makeColor(this.r, this.g, this.b);\n } else {\n this.g = 20;\n this.b = 147;\n this.colorToLerpTo = 1;\n this.color = makeColor(this.r, this.g, this.b);\n }\n } else if (this.colorToLerpTo == 1) {\n if (this.g != 255) {\n this.g++;\n if (this.b != 20) this.b--;\n if (this.r != 147) this.r--;\n this.color = makeColor(this.r, this.g, this.b);\n } else {\n this.r = 147;\n this.b = 20;\n this.colorToLerpTo = 2;\n this.color = makeColor(this.r, this.g, this.b);\n }\n } else if (this.colorToLerpTo == 2) {\n if (this.b != 255) {\n this.b++;\n if (this.r != 20) this.r--;\n if (this.g != 147) this.g--;\n this.color = makeColor(this.r, this.g, this.b);\n } else {\n this.g = 147;\n this.r = 20;\n this.colorToLerpTo = 0;\n this.color = makeColor(this.r, this.g, this.b);\n }\n }\n }", "WheelRotation (inner, outer, wp, i, wheel, r){\n if(!r){\n for(let j = 1; j < wp[wheel]; j++){\n inner.push(inner.shift());\n }\n }\n return this.WheelOutput(inner, outer, i, r);\n }", "function colormatch(){\n\n\nreminder = Math.abs(change % (2*Math.PI));\n\nif (reminder > 0 && reminder < quarter) obcolor= (by-b > 0)? paint[1]: paint[3];\nelse if (reminder > quarter && reminder < quarter*2) obcolor= (by-b > 0)? paint[2]: paint[0];\nelse if (reminder > quarter*2 && reminder < quarter*3 ) obcolor= (by-b > 0)? paint[3]: paint[1];\nelse if (reminder > quarter*3 && reminder < quarter*4) obcolor= (by-b > 0)? paint[0]: paint[2];\n\nif (bcolor == obcolor) return 0;\nelse return 1;\n}", "function victoryColorShift() {\n victRed += victRedShift;\n victGreen += victGreenShift;\n victBlue += victBlueShift;\n victRedShift = random(-maxShift, maxShift);\n victGreenShift = random(-maxShift, maxShift);\n victBlueShift = random(-maxShift, maxShift);\n}", "set elbowRotation(value) { this._elbowRotation = value; }", "function hueMod(h) {\n return h % 360;\n}", "changeColor() {\n // wrap around, but should be 7?\n\t\tvar nxtColorIdx = this.current + 1 > 6 ? 0 : this.current + 1;\n var curColorIdx = this.current;\n // color transition, set old color invisible\n var esta = this;\n\t\tANIM.customAnimation.to(this.materials[curColorIdx], 5, {\n\t\t\topacity: 0,\n\t\t\tonComplete: function() {\n\t\t\t\testa.obj.children[curColorIdx].visible = false\n\t\t\t}\n\t\t});\n // set next color visible and gradually switch to new color\n this.obj.children[nxtColorIdx].visible = true\n ANIM.customAnimation.to(this.materials[nxtColorIdx], 4, {\n\t\t\topacity: 1\n\t\t});\n\n this.current = nxtColorIdx;\n }", "function colourWheelFunctionality( it ){\n $(it).fadeOut(100); //hide colorwheel\n\n var picked = $(it).colorwheel('value');\n var targetId = $(it).attr('data-hex-id');\n\n\n //set hex color to picked color\n var hexGroup = paper.project.getItem( {id: parseInt(targetId) } );\n hexGroup.children['hexbody'].fillColor = '#' + picked;\n\n\n //set controls and text fillColor to a contrasty colour\n var contrastyColour = getContrastyColour(picked);\n console.log( contrastyColour );\n\n hexGroup.children['colorControl'].fillColor = contrastyColour;\n hexGroup.children['delControl'].fillColor = contrastyColour;\n hexGroup.children['textControl'].fillColor = contrastyColour;\n hexGroup.children['label'].fillColor = contrastyColour\n\n paper.view.draw();\n}", "stopRotateWheel() {\r\n let { startAngle, arc } = this.state;\r\n const { baseSize } = this.props;\r\n const canvas = this.refs.canvas;\r\n const ctx = canvas.getContext('2d');\r\n const degrees = startAngle * 180 / Math.PI + 90;\r\n const arcd = arc * 180 / Math.PI;\r\n const index = Math.floor((360 - degrees % 360) / arcd);\r\n ctx.save();\r\n ctx.font = 'bold 25px Roboto, Arial';\r\n ctx.fillStyle = 'white';\r\n const text = this.state.cuisineArr[index]\r\n ctx.fillText(text, baseSize - ctx.measureText(text).width / 2, baseSize);\r\n ctx.restore();\r\n if(this.state.spinTime === 2820){\r\n this.setState({cuisine: text, spinTime: 0})\r\n this.props.changeCuisine(text)\r\n this.toggleSpinState();\r\n }\r\n }", "function rainbowCycle(state, color, speed) {\n var rgb = hexToRgb(color);\n var r = rgb.r;\n var g = rgb.g;\n var b = rgb.b;\n if(state == 0){\n g = g + speed;\n if(g >= 255) {\n g = 255; \n state = 1;\n }\n }\n if(state == 1){\n r = r - speed;\n if(r <= 0) {\n r = 0; \n state = 2;\n }\n }\n if(state == 2){\n b = b + speed;\n if(b >= 255) {\n b = 255; \n state = 3;\n }\n }\n if(state == 3){\n g = g - speed;\n if(g <= 0) {\n g = 0; \n state = 4;\n }\n }\n if(state == 4){\n r = r + speed;\n if(r >= 255) {\n r = 255;\n state = 5;\n }\n }\n if(state == 5){\n b = b - speed;\n if(b <= 0) {\n b = 0; \n state = 0;\n }\n }\n return [state, rgbToHex(r, g, b)];\n}", "function cellColorYaxisRotationFunction(cL, cellLocation, matrixDimension, topArr, frontArr, bottomArr, backArr, colorFace) {\n \t //Define variables and array\n var i, j, k, temp, tempVar;\n \nfor (k=0; k< 6; k++) {\t\n // put color for each cell j is row and i is cols of matrix first cell is 0,0\n\ttempVar = -1;\n for (j = 0; j < matrixDimension; j++) {\n for (i = 0; i < matrixDimension; i++) {\n temp = (j+1)*10+(i+1);\n\t\t \n\t\t\t\t\t tempVar = tempVar + 1;\t\t\t\t\t\n\t\t\t\t\t if(k==0) tempColor= backArr[tempVar];\n\t\t\t\t\t\t else\n\t\t\t\t\t\t if(k==1) continue;\n\t\t\t\t\t\t else if(k==2) tempColor= frontArr[tempVar];\n\t\t\t\t\t\t else if(k==3) continue;\n\t\t\t\t\t\t else if(k==4) tempColor= topArr[tempVar];\n\t\t\t\t\t\t\t else tempColor = bottomArr[tempVar];\n\t\t\t\t\t\t\t \n\t\t\t\t\t $(\"#\"+cL[k]+temp).css(\"background-color\", colorFace[tempColor]); \n } \n }\t\t\t\t\t\t\t\t\t\n }\n \n\t\t\t\t\t\t\t\t\t\t }", "rotateLight(x, y, z) {\n var cycle = new Vector3([x, y, z]);\n this.pos = this.pos.add(cycle);\n }", "RotateWheels(w){\n w[2]++;\n\n if(w[2]>26){\n w[2] = 1;\n w[1]++;\n }\n\n if(w[1]>26){\n w[1] = 1;\n w[0]++;\n }\n\n if(w[0]>26){\n w[0] = 1;\n }\n\n return (w);\n }", "rotate(rotateAmount) {\n }", "function shiftColour( hexColor, factor ){\n if ( factor < 0 ) {\n \tfactor = 0;\n }\n\n var c = hexColor;\n if ( c.substr(0,1) == \"#\" ){\n c = c.substring(1);\n }\n\n if ( c.length == 3 || c.length == 6 )\n {\n var i = c.length / 3;\n\n var f; // the relative distance from white\n\n var r = parseInt( c.substr(0, i ), 16 );\n //\tAllow shift up from 0\n if(factor > 1 && r == 0) {\n \tr = 11;\n }\n f = ( factor * r / (256-r) );\n r = Math.floor((256 * f) / (f+1));\n r = r.toString(16);\n if ( r.length == 1 ) r = \"0\" + r;\n\n var g = parseInt( c.substr(i, i), 16);\n //\tAllow shift up from 0\n if(factor > 1 && g == 0) {\n \tg = 11;\n }\n f = ( factor * g / (256-g) );\n g = Math.floor((256 * f) / (f+1));\n g = g.toString(16);\n if ( g.length == 1 ) g = \"0\" + g;\n\n var b = parseInt( c.substr( 2*i, i),16 );\n //\tAllow shift up from 0\n if(factor > 1 && b == 0) {\n \tb = 11;\n }\n f = ( factor * b / (256-b) );\n b = Math.floor((256 * f) / (f+1));\n b = b.toString(16);\n if ( b.length == 1 ) b = \"0\" + b;\n\n c = r+g+b;\n\t\t} \n\t\treturn \"#\" + c;\n }", "shift(id, amnt){\n let available = [0, 1, 2];\n available = available.filter((v, i, a) => {return v!=id;});\n // positive shift\n this.color[id] = Math.floor(this.color[id] * (1+amnt));\n\n for(let x = 0; x < available.length; ++x){\n this.color[available[x]] = Math.floor(this.color[available[x]] * (1-amnt));\n }\n\n // clamping colors\n for(let x = 0; x < 3; ++x){\n if(this.color[x] > 255) this.color[x] = 255;\n }\n /* Change color based on highest color in RGB spectrum */\n let max = 0;\n for(let x = 1; x < 3; ++x){\n if(this.color[x] > this.color[max]){\n max = x;\n }\n }\n this.id = max;\n }", "function rotarFigura() {\n ctx.rotate(0.17);\n ctx.restore(); //dibuja la figura\n\n }", "changeWaveColor(e) {\n if (e.pageY < 1500) {\n var colors = [\"purple\", \"blue\"]; // color array to rotate between\n let nextColor = this.state.waveColorIndex < colors.length -1 ? this.state.waveColorIndex + 1 : 0;\n this.setState({waveColorIndex: nextColor});\n let currColor = colors[this.state.waveColorIndex];\n if (currColor === \"blue\") {\n this.setState({lightestWave: \"#282F6B\"});\n this.setState({mediumWave: \"#151755\"});\n this.setState({darkestWave: \"#0c0a4a\"});\n } else if (currColor === 'purple') {\n this.setState({lightestWave: \"#9754CA\"});\n this.setState({mediumWave: \"#6337A1\"});\n this.setState({darkestWave: \"#280F4F\"});\n }\n\n document.getElementById(\"under-ocean\").style.background = this.state.darkestWave;\n }\n }", "function rotateKnob(knob) {\n var interval = setInterval(function () {\n knob.angle += 1;\n if (knob.angle >= -36 && knob.angle <= -34) {\n clearInterval(interval);\n }\n }, 4);\n}", "function updateForFrame() {\r\n rotatingComponents.rotation.y += rotateSpeed;\r\n}", "function colorStep(c1, c2, t) {\n if (t < 0) {\n t = 0;\n } else if (t > 1) {\n t = 1;\n }\n\n return {\n r: parseInt(c1['r'] + (c2['r'] - c1['r']) * t),\n g: parseInt(c1['g'] + (c2['g'] - c1['g']) * t),\n b: parseInt(c1['b'] + (c2['b'] - c1['b']) * t)\n };\n }", "function rightsideCellColorYaxisRotationFunction(cL, cellLocation, matrixDimension, rightsideArr, colorFace){\n \t //Define variables and array\n var i, j, k, temp, tempVar;\n k = 1;\n//for (k=0; k< 6; k++) {\t\n\n // put color for each cell j is row and i is cols of matrix first cell is 0,0\n\ttempVar = -1;\n for (j = 0; j < matrixDimension; j++) {\n for (i = 0; i < matrixDimension; i++) {\n temp = (j+1)*10+(i+1);\n\t\t \n\t\t\t\t\t tempVar++;\t\t\t\t\t\n\t\t\t\t\t tempColor = rightsideArr[tempVar];\t\t\t\t\t\t \n\t\t\t\t\t $(\"#\"+cL[k]+temp).css(\"background-color\", colorFace[tempColor]); \n } \n }\t\t\t\t\t\t\t\t\t\n //}\n \t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t }", "function cellColorZaxisRotationFunction(cL, cellLocation, matrixDimension, backArr, rightsideArr,frontArr, leftsideArr, colorFace){\n // k represent the face\n var k, j, i, temp, tempVar,tempColor;\n for (k=0; k< 4; k++) {\t\n // put color for each cell j is row and i is cols of matrix first cell is 0,0\n j = cellLocation-1;\n for (i = 0; i < matrixDimension; i++) {\n temp = (j+1)*10+(i+1);\n\n\t\t\t\t\t tempVar = i + j*matrixDimension;\n\t\t\t\t\t //tempVar = i;\n\t\t\t\t\t if(k==0) tempColor= backArr[tempVar];\n\t\t\t\t\t\telse if(k==1) tempColor= rightsideArr[tempVar];\n\t\t\t\t\t\t else if(k==2) tempColor= frontArr[tempVar];\n\t\t\t\t\t\t\telse tempColor = leftsideArr[tempVar];\n\t\t\n\t\t\t\t\t $(\"#\"+cL[k]+temp).css(\"background-color\", colorFace[tempColor]);\t\t\t\t \n } \t\t\t\t\t\t\t\t\t\t\n }\n\t\t\t\t\t\t }", "rotate(){\r\n if(this.state.spinTime > 2800) {\r\n clearTimeout(this.spinTimer);\r\n this.stopRotateWheel();\r\n } else {\r\n const spinAngle = this.rngSpinAngle - this.easeOut(this.state.spinTime, 0, this.rngSpinAngle, this.rngSpinTime);\r\n \r\n this.setState({\r\n startAngle: this.state.startAngle + spinAngle * Math.PI / 180,\r\n spinTime: this.state.spinTime + 30,\r\n }, () => {\r\n this.drawRouletteWheel();\r\n clearTimeout(this.spinTimer);\r\n this.spinTimer = setTimeout(() => this.rotate(), 30);\r\n })\r\n }\r\n }", "function ColorTweener (rgb0, rgb1, nSteps) {\n\n var sRGB = parse (rgb0), cRGB = sRGB, eLab = rgbToLab (parse (rgb1)), n = nSteps, i = 1;\n\n // Marks whether the color was completely faded through the first time\n this.done = function () {\n return i === (n + 1);\n };\n\n // Returns whether the animation is at the starting point or not\n this.atStart = function () {\n return i <= 0;\n };\n\n // Fades the current RGB one step (over n steps) closer to the ending RGB\n this.step = function () {\n if (i < 0) i = 0;\n if (i++ <= n) cRGB = labToRGB (interpolate (rgbToLab (cRGB), eLab, i / n));\n\n return this;\n };\n\n this.undo = function () {\n if (i > n) i = n;\n if (--i >= 0) cRGB = labToRGB (interpolate (rgbToLab (cRGB), eLab, i / n));\n\n return this;\n };\n\n // Same as toString ()\n this.color = function () {\n return this.toString ();\n };\n\n // Linearly interpolates two arrays of 3 values\n function interpolate (arr0, arr1, p) {\n var q = 1 - p;\n return [q * arr0[0] + p * arr1[0], q * arr0[1] + p * arr1[1], q * arr0[2] + p * arr1[2]];\n }\n\n // Wrapper function for the chain that's required to convert an RGB array to a CIE-L*ch array\n function rgbToLab (rgb) {\n return xyzToLab (rgbToXYZ (rgb));\n }\n\n // Wrapper function for the chan that's required to convert a CIE-L*ch array to an RGB array\n function labToRGB (lab) {\n return xyztoRGB (labToXYZ (lab));\n }\n\n // Converts an XYZ array to an RGB array\n function xyztoRGB (xyz) {\n var X = xyz[0] / 100, Y = xyz[1] / 100, Z = xyz[2] / 100;\n\n var R = X * 3.2406 + Y * -1.5372 + Z * -0.4986,\n G = X * -0.9689 + Y * 1.8758 + Z * 0.0415,\n B = X * 0.0557 + Y * -0.2040 + Z * 1.0570;\n\n R = R > 0.0031308? 1.055 * Math.pow(R, 1 / 2.4) - 0.055 : 12.92 * R,\n G = G > 0.0031308? 1.055 * Math.pow(G, 1 / 2.4) - 0.055 : 12.92 * G,\n B = B > 0.0031308? 1.055 * Math.pow(B, 1 / 2.4) - 0.055 : 12.92 * B;\n\n R *= 255;\n G *= 255;\n B *= 255;\n\n return [R, G, B];\n }\n\n // Converts an RGB array to an XYZ array\n function rgbToXYZ (rgb) {\n var R = rgb[0] / 255, G = rgb[1] / 255, B = rgb[2] / 255;\n\n R = R > 0.04045? Math.pow((R + 0.055) / 1.055, 2.4) : R / 12.92;\n G = G > 0.04045? Math.pow((G + 0.055) / 1.055, 2.4) : G / 12.92;\n B = B > 0.04045? Math.pow((B + 0.055) / 1.055, 2.4) : B / 12.92;\n\n R *= 100;\n G *= 100;\n B *= 100;\n\n var X = R * 0.4124 + G * 0.3576 + B * 0.1805,\n Y = R * 0.2126 + G * 0.7152 + B * 0.0722,\n Z = R * 0.0193 + G * 0.1192 + B * 0.9505;\n\n return [X, Y, Z];\n }\n\n // Converts a CIE-L*ab array to an XYZ array\n function labToXYZ (lab) {\n var Y = (lab[0] + 16) / 116, X = lab[1] / 500 + Y, Z = Y - lab[2] / 200;\n\n X = Math.pow(X, 3) > 0.008856? Math.pow(X, 3) : (X - (16 / 116)) / 7.787;\n Y = Math.pow(Y, 3) > 0.008856? Math.pow(Y, 3) : (Y - (16 / 116)) / 7.787;\n Z = Math.pow(Z, 3) > 0.008856? Math.pow(Z, 3) : (Z - (16 / 116)) / 7.787;\n\n X *= 95.047;\n Y *= 100;\n Z *= 108.883;\n\n return [X, Y, Z];\n }\n\n // Converts an XYZ array to a CIE-L*ab array\n function xyzToLab (xyz) {\n var X = xyz[0] / 95.047, Y = xyz[1] / 100, Z = xyz[2] / 108.883;\n\n X = X > 0.008856? Math.pow(X, 1 / 3) : (7.787 * X) + (16 / 116);\n Y = Y > 0.008856? Math.pow(Y, 1 / 3) : (7.787 * Y) + (16 / 116);\n Z = Z > 0.008856? Math.pow(Z, 1 / 3) : (7.787 * Z) + (16 / 116);\n\n var L = (116 * Y) - 16,\n a = 500 * (X - Y);\n b = 200 * (Y - Z);\n\n return [L, a, b];\n }\n\n // Returns an array of 3 numeric values from an 'rgb(val1, val2, val3)' string\n function parse (rgbStr) {\n var strs = rgbStr.match (/\\d+/g);\n return [+strs[0], +strs[1], +strs[2]];\n }\n\n // Returns the 'rgb()' string of the current state of the tweener\n this.toString = function () {\n return 'rgb(' + Math.floor (cRGB[0]) + ', ' + Math.floor (cRGB[1]) + ', ' + Math.floor (cRGB[2]) + ')';\n };\n }", "setRotation(r) {\n // console.log('setrotation', r)\n this.a = Math.cos(r)\n this.b = -Math.sin(r)\n this.d = Math.sin(r)\n this.e = Math.cos(r)\n // console.log(this)\n }", "function drawColorCycle() {\r\n\r\n\t// Set color cycling on or off:\r\n\tif (document.form.cycle[0].checked) {\r\n\t\tcolorCycle = true;\r\n\t\tdocument.form.direction[0].disabled = false;\r\n\t\tdocument.form.direction[1].disabled = false;\t\r\n\t}\r\n\telse if (document.form.cycle[1].checked) {\r\n\t\tcolorCycle = false;\r\n\t\tdocument.form.direction[0].disabled = true;\r\n\t\tdocument.form.direction[1].disabled = true;\t\t\r\n\t}\r\n\t\r\n\t// Set color cycling in or out\r\n\tif (document.form.direction[0].checked) {\r\n\t\tcolorCycleIn = true;\r\n\t}\r\n\telse if (document.form.direction[1].checked) {\r\n\t\tcolorCycleIn = false;\r\n\t}\r\n\t\r\n\tif (colorCycle) {\r\n\t\r\n\t\tvar imageData = image.data; // detach the pixel array from DOM\r\n\r\n\t\t// iterate trhough all pixels\r\n\t\tfor (var x = 0; x < CANVAS_WIDTH; x++) {\r\n\t\t\tfor (var y = 0; y < CANVAS_HEIGHT; y++) {\r\n\t\t\t\r\n\t\t\t\tvar i = y * CANVAS_WIDTH + x;\t\t// index of the pixel in imageData array\r\n\r\n\r\n\t\t\t\t// if the pixel is outside of the set, cycle its color by colorStep\r\n\t\t\t\tif (\"rgb(\" + imageData[4*i+0] + \", \" + imageData[4*i+1] + \", \" + imageData[4*i+2] + \")\" != \"rgb(0, 0, 0)\") {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (colorCycleIn == false) { \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// cyan to blue:\r\n\t\t\t\t\t\tif (imageData[4*i+0] == 0 && imageData[4*i+1] > 0 && imageData[4*i+2] == 255) {\r\n\t\t\t\t\t\t\timageData[4*i+1] -= colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+1] < 0){\r\n\t\t\t\t\t\t\t\talert(\"green is < 0\");\r\n\t\t\t\t\t\t\t\timageData[4*i+1] = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// blue to magenta:\r\n\t\t\t\t\t\telse if (imageData[4*i+0] < 255 && imageData[4*i+1] == 0 && imageData[4*i+2] == 255) {\r\n\t\t\t\t\t\t\timageData[4*i+0] += colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+0] > 255) {\r\n\t\t\t\t\t\t\t\timageData[4*i+0] = 255;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// magenta to red:\r\n\t\t\t\t\t\telse if (imageData[4*i+0] == 255 && imageData[4*i+1] == 0 && imageData[4*i+2] > 0) {\r\n\t\t\t\t\t\t\timageData[4*i+2] -= colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+2] < 0) \r\n\t\t\t\t\t\t\t\timageData[4*i+2] = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// red to yellow:\r\n\t\t\t\t\t\telse if (imageData[4*i+0] == 255 && imageData[4*i+1] < 255 && imageData[4*i+2] == 0) {\r\n\t\t\t\t\t\t\timageData[4*i+1] += colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+1] > 255) \r\n\t\t\t\t\t\t\t\timageData[4*i+1] = 255;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// yellow to green:\r\n\t\t\t\t\t\telse if (imageData[4*i+0] > 0 && imageData[4*i+1] == 255 && imageData[4*i+2] == 0) {\r\n\t\t\t\t\t\t\timageData[4*i+0] -= colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+0] < 0) \r\n\t\t\t\t\t\t\t\timageData[4*i+0] = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// green to cyan:\r\n\t\t\t\t\t\telse if (imageData[4*i+0] == 0 && imageData[4*i+1] == 255 && imageData[4*i+2] < 255) {\r\n\t\t\t\t\t\t\timageData[4*i+2] += colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+2] > 255) \r\n\t\t\t\t\t\t\t\timageData[4*i+2] = 255;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\timageData[4*i+3] = 255; // Alpha value\r\n\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\r\n\t\t\t\t\telse { // color cycle in\r\n\r\n\t\t\t\t\t\t// cyan to green:\r\n\t\t\t\t\t\tif (imageData[i*4+0] == 0 && imageData[4*i+1] == 255 && imageData[i*4+2] > 0) {\r\n\t\t\t\t\t\t\timageData[i*4+2] -= colorStep;\r\n\t\t\t\t\t\t\tif (imageData[i*4+2] < 0)\r\n\t\t\t\t\t\t\t\timageData[i*4+2] = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// green to yellow:\r\n\t\t\t\t\t\telse if (imageData[i*4+0] < 255 && imageData[4*i+1] == 255 && imageData[i*4+2] == 0) {\r\n\t\t\t\t\t\t\timageData[i*4+0] += colorStep;\r\n\t\t\t\t\t\t\tif (imageData[i*4+0] > 255) \r\n\t\t\t\t\t\t\t\timageData[i*4+0] = 255;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// yellow to red:\r\n\t\t\t\t\t\telse if (imageData[i*4+0] == 255 && imageData[4*i+1] > 0 && imageData[i*4+2] == 0) {\r\n\t\t\t\t\t\t\timageData[4*i+1] -= colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+1] < 0) \r\n\t\t\t\t\t\t\t\timageData[4*i+1] = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// red to magenta:\r\n\t\t\t\t\t\telse if (imageData[i*4+0] == 255 && imageData[4*i+1] == 0 && imageData[i*4+2] < 255) {\r\n\t\t\t\t\t\t\timageData[i*4+2] += colorStep;\r\n\t\t\t\t\t\t\tif (imageData[i*4+2] > 255) \r\n\t\t\t\t\t\t\t\timageData[i*4+2] = 255;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// magenta to blue:\r\n\t\t\t\t\t\telse if (imageData[i*4+0] > 0 && imageData[4*i+1] == 0 && imageData[i*4+2] == 255) {\r\n\t\t\t\t\t\t\timageData[i*4+0] -= colorStep;\r\n\t\t\t\t\t\t\tif (imageData[i*4+0] < 0) \r\n\t\t\t\t\t\t\t\timageData[i*4+0] = 0;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// blue to cyan:\r\n\t\t\t\t\t\telse if (imageData[4*i+0] == 0 && imageData[4*i+1] < 255 && imageData[i*4+2] == 255) {\r\n\t\t\t\t\t\t\timageData[4*i+1] += colorStep;\r\n\t\t\t\t\t\t\tif (imageData[4*i+1] > 255) \r\n\t\t\t\t\t\t\t\timageData[4*i+1] = 255;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\timageData[4*i+3] = 255; // Alpha value\r\n\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\timage.data = imageData; // attach image data object back to DOM \r\n\t\tcontext.putImageData(image, 0, 0);\r\n\r\n\t}\r\n\t\r\n}", "incrementRotor(){if(this.bias<25){this.bias+=1;}else{this.bias=0;}}", "function bottomCellColorZaxisRotationFunction(cL, cellLocation, matrixDimension, bottomArr, colorFace){\n \t //Define variables and array\n var i, j, k, temp, tempVar;\n k = 5;\n//for (k=0; k< 6; k++) {\t\n\n // put color for each cell j is row and i is cols of matrix first cell is 0,0\n\ttempVar = -1;\n for (j = 0; j < matrixDimension; j++) {\n for (i = 0; i < matrixDimension; i++) {\n temp = (j+1)*10+(i+1);\n\t\t \n\t\t\t\t\t tempVar++;\t\t\t\t\t\n\t\t\t\t\t tempColor = bottomArr[tempVar];\t\t\t\t\t\t \n\t\t\t\t\t $(\"#\"+cL[k]+temp).css(\"background-color\", colorFace[tempColor]); \n } \n }\t\t\t\t\t\t\t\t\t\n //}\n \t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t }", "function colorSpin1() {\n\tvar colorTimer1 = setInterval(colorChange, 20);\n\tsetTimeout(function(){clearInterval(colorTimer1);}, 1000);\n}", "function moveFromRed() {\n if (getColor() == \"red\") {\n right();\n if (remainingDots() > 0){\n right();\n }\n reverseDirection = !reverseDirection;\n\t}\n}", "function getNextColor() {\n\tvar _color = new THREE.Color();\n\t_color.setHSL(_h, 1.00, 0.50 + 0.30 * _v);\n\t_h = (_h + GOLDEN_RATIO_CONJUGATE) % 1;\n\t_v = (_v + GOLDEN_RATIO_CONJUGATE) % 1;\n\treturn _color;\n }", "animate() {\n this.graphics.rotation = this.rotateClockwise\n ? this.graphics.rotation + this.rotateSpeed\n : this.graphics.rotation - this.rotateSpeed\n }", "function rotate(rotval)\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 // Perform x and y calculation based on affine matrix values\n x = x * Math.cos(rotval) - y * (Math.sin(rotval));\n y = x * Math.sin(rotval) + y * Math.cos(rotval);\n\n // Set position values\n positions[i] = x;\n positions[i+1] = y;\n }\n\n // Redraw image\n loadImage();\n}", "rotate(dir) {\n\n if (dir === 'rotateright') {\n\n if (this.rotation === 3){\n this.rotation = -1\n }\n this.rotation ++;\n this.checkGhost();\n this.render();\n\n } else {\n\n if (this.rotation === 0){\n this.rotation = 4;\n }\n this.rotation --;\n this.checkGhost();\n this.render();\n\n }\n\n }", "counterRotation() {\n let OffsetX = this.x + (this.width/2);\n let OffsetY = this.y + (this.height/2);\n ctx.translate(OffsetX,OffsetY);\n ctx.rotate(-this.spin * Math.PI/180);\n ctx.translate(-OffsetX,-OffsetY);\n }", "function handleRotorSpeed(newValue)\n{\n rot = newValue;\n r = rot * 0.8;\t\n PIErender();\n}", "get elbowRotationDegree() { return this._elbowRotation * 180.0 / Math.PI; }", "spin(amount) {\n const hsl = this.toHsl();\n const hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return new TinyColor(hsl);\n }", "point(deg){\r\n this.direction = deg % 360;\r\n if(this.image) this.image.style.transform ='rotate(' + deg % 360 + 'deg)';\r\n }", "onColorChange (event) {\n let color = event.get('vec');\n\n this.setColor([color.v, color.e, color.c, 1]);\n }", "function topCellColorZaxisRotationFunction(cL, cellLocation, matrixDimension, topArr, colorFace){\n \t //Define variables and array\n var i, j, k, temp, tempVar;\n k = 4;\n//for (k=0; k< 6; k++) {\t\n\n // put color for each cell j is row and i is cols of matrix first cell is 0,0\n\ttempVar = -1;\n for (j = 0; j < matrixDimension; j++) {\n for (i = 0; i < matrixDimension; i++) {\n temp = (j+1)*10+(i+1);\n\t\t \n\t\t\t\t\t tempVar++;\t\t\t\t\t\n\t\t\t\t\t tempColor = topArr[tempVar];\t\t\t\t\t\t \n\t\t\t\t\t $(\"#\"+cL[k]+temp).css(\"background-color\", colorFace[tempColor]); \n } \n }\t\t\t\t\t\t\t\t\t\n //}\n \t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t }" ]
[ "0.7527692", "0.68551666", "0.6577385", "0.64627516", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.6375109", "0.63026845", "0.6295989", "0.62958753", "0.62958753", "0.62594056", "0.6252031", "0.62456983", "0.62456983", "0.6226811", "0.61651665", "0.61651665", "0.61651665", "0.61651665", "0.61651665", "0.6080844", "0.5979059", "0.59341913", "0.5907112", "0.5878897", "0.58595425", "0.5858979", "0.5848362", "0.5847157", "0.581407", "0.57901275", "0.57749134", "0.5758808", "0.57488084", "0.57239527", "0.571308", "0.57113254", "0.5680577", "0.566562", "0.5649083", "0.56487393", "0.5641536", "0.5638081", "0.56302357", "0.5630136", "0.5613737", "0.56067526", "0.5602046", "0.55603653", "0.5554568", "0.55493265", "0.55443925", "0.5543554", "0.5539602", "0.55297536", "0.5523533", "0.5518086", "0.5500019", "0.5495554", "0.54905236", "0.5481558", "0.547965", "0.54770964", "0.54696864", "0.54632074", "0.54582924", "0.5449505", "0.544608", "0.54439086", "0.5439027" ]
0.0
-1
Middleware / This function gets latest 25 comments from a subreddit. After it serperates the string by spaces and removes any special characters it then iterates through every word and counts the frequency. Results are stored in a dictionary where the key is the word and the value is the words frequency. Then the result is stored in a database/updated existing documents.
function insertData(){ let words = new Array(); let commentlist = r.getSubreddit('wallstreetbets').getNewComments(); let cleanData = async () => { let result = await (commentlist); return result; }; cleanData().then(function(result) { let stopwords = ["still","We","You","going","like","I'm",'would','it','get','Im','dont','The','I','i','me','my','myself','we','our','ours','ourselves','you','your','yours','yourself','yourselves','he','him','his','himself','she','her','hers','herself','it','its','itself','they','them','their','theirs','themselves','what','which','who','whom','this','that','these','those','am','is','are','was','were','be','been','being','have','has','had','having','do','does','did','doing','a','an','the','and','but','if','or','because','as','until','while','of','at','by','for','with','about','against','between','into','through','during','before','after','above','below','to','from','up','down','in','out','on','off','over','under','again','further','then','once','here','there','when','where','why','how','all','any','both','each','few','more','most','other','some','such','no','nor','not','only','own','same','so','than','too','very','s','t','can','will','just','don','should','now']; for(i=0;i<=result.length-1;i++){ let currentData = JSON.stringify(result[i].body).split(' '); for(j=0;j<=currentData.length;j++){ if (currentData[j]!=undefined && !stopwords.includes(currentData[j])){ currentData[j].toLowerCase(); currentData[j] = currentData[j].replace(/[?.,"'\/#!$%\^&\*;:{}=\-_`~()]/g,"", ''); currentData[j] = currentData[j].replace(/\s{2,}/g,""); currentData[j] = currentData[j].replace(/[0-9]/g,""); if(currentData[j]!="" && currentData[j] != "I"){ words.push(currentData[j]); } } } } for(i=0;i<=words.length-1;i++){ words[i] = words[i].replace(/[?.,"'\/#!$%\^&\*;:{}=\-_`~()]/g,"", ''); words[i] = words[i].replace(/\s{2,}/g,""); words[i] = words[i].replace(/[0-9]/g,""); } }).then(()=>{ var wordsMap = {}; words.forEach(function (key) { if (wordsMap.hasOwnProperty(key)) { wordsMap[key]++; } else { wordsMap[key] = 1; } }); words = wordsMap; MongoClient.connect(process.env.MONGODB_URI || process.env.DB_CONNECTION, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { if (err) throw err; const dbo = db.db("heroku_4s2n14p0"); const messageTable = dbo.collection("comments"); let closeDBpromises = []; for(var key in words){ let promise = messageTable.findOneAndUpdate({ "_id" : key },{$set: { "_id" : key}, $inc : { "frequency" : words[key] }},{upsert: true}).then(() => words[Object.keys(words)[Object.keys(words).length - 1]] == key) closeDBpromises.push(promise); } Promise.all(closeDBpromises).then(()=>{ db.close(); console.log("entry finished"); }); }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getWordCounts(inputString){\n if(inputString !== \"\"){\n var words = inputString.split(' ');\n words.forEach(function(w) {\n if (!wordDict[w]) {\n wordDict[w] = 0;\n }\n wordDict[w] += 1;\n });\n if(showStats===1){\n dispatch(newDictionary(wordDict));\n }\n return wordDict;\n }\n \n}", "function wordCountEngine(doc) {\n const map = new Map();\n const wordList = doc.split(' ');\n let largestCount = 0;\n\n// for i from 0 to wordList.length-1:\n// # convert each token to lowercase\n// word = wordList[i].toLowerCase()\n for (let i = 0; i < wordList.length; i++) {\n const word = wordList[i].toLowerCase();\n const charArray = [];\n for (let char of word) {\n if (char >= 'a' && char <= 'z') {\n charArray.push(char);\n }\n \n }\n const cleanWord = charArray.join('');\n let count = 0;\n if (map.has(cleanWord)) {\n count = map.get(cleanWord);\n count++;\n } else {\n count = 1;\n }\n if (count > largestCount) {\n largestCount = count\n }\n map.set(cleanWord,count);\n }\n // const result = [];\n // for (let key of map) {\n // key[1] = key[1].toString()\n // result.push(key);\n \n // }\n // // result.sort((a,b) => b[1] - a[1])\n // return result;\n const counterList = new Array(largestCount + 1);\n for (word of map.keys()) {\n counter = map.get(word);\n wordCounterList = counterList[counter]\n console.log(counterList)\n if (wordCounterList == null) {\n wordCounterList = [];\n }\n wordCounterList.push(word);\n counterList[counter] = wordCounterList;\n }\n// # init the word counter list of lists.\n// # Since, in the worst case scenario, the\n// # number of lists is going to be as\n// # big as the maximum occurrence count,\n// # we need counterList's size to be the\n// # same to be able to store these lists.\n// # Creating counterList will allow us to\n// # “bucket-sort” the list by word occurrences\n// counterList = new Array(largestCount+1)\n// for j from 0 to largestCount:\n// counterList[j] = null\n\n// # add all words to a list indexed by the\n// # corresponding occurrence number.\n// for word in wordMap.keys():\n// counter = wordMap[word]\n// wordCounterList = counterList[counter]\n\n// if (wordCounterList == null):\n// wordCounterList = []\n\n// wordCounterList.push(word)\n// counterList[counter] = wordCounterList\n\n// # iterate through the list in reverse order\n// # and add only non-null values to result\n// result = []\n// for l from counterList.length-1 to 0:\n// wordCounterList = counterList[l]\n// if (wordCounterList == null):\n// continue\n\n// stringifiedOccurrenceVal = toString(l)\n// for m from 0 to wordCounterList.length-1:\n// result.push([wordCounterList[m], stringifiedOccurrenceVal])\n\n// return result\n\n}", "function populate_posts(parsed_json)\n{\n let post_counter = 0;\n const REDDIT_HOST = 'https://www.reddit.com';\n\n $.each(parsed_json, function (jsonkey, jsonval) {\n let media_html = '';\n let epoch_date = parsed_json[jsonkey]['date_created'];\n let date_object = new Date(epoch_date*1000);\n let string_date = date_object.getMonth() + '/' + date_object.getDate() + '/' + date_object.getFullYear() + ' ' + date_object.getHours() + ':' + date_object.getMinutes();\n post_counter++;\n\n if (typeof parsed_json[jsonkey]['author']['media'] !== 'undefined' && typeof parsed_json[jsonkey]['author']['media']['url'] !== 'undefined')\n {\n media_html = '<img src=\"' + parsed_json[jsonkey]['author']['media']['url'] + '\">';\n }\n\n $('.post_score', $('#thread>ul:nth-child(' + post_counter + ')')).text(\n parsed_json[jsonkey]['score']\n );\n $('.post_title', $('#thread>ul:nth-child(' + post_counter + ')')).html(\n '<div><a href=\"#\" onclick=\"call_external_url(\\'' + REDDIT_HOST + parsed_json[jsonkey]['permalink'] + '\\')\" class=\"button large\" target=\"_blank\">' + parsed_json[jsonkey]['title'] + '</a></div>'\n );\n $('.post_details', $('#thread>ul:nth-child(' + post_counter + ')')).html(\n 'Posted on ' + string_date + ' by ' + parsed_json[jsonkey]['author'] + '<br>' + media_html\n );\n });\n\n return post_counter;\n}", "function get_words_stats()\n{\n\tvar message={\"type\": \"words_stats\",\n\t\t\t\t\"thread_id\": decodeURI(window.location.href).substr(decodeURI(window.location.href).search(\"\\\\?\")+1)\n\t\t\t\t}\n\tsend(JSON.stringify(message));\n}", "function getPosts(subreddit, processFunction){\n\n let done = 0;\n while(done <= pageLimit){\n\n }\n parser.parseURL(`https://www.reddit.com/r/${subreddit}/.rss?count=25&after=t3_87u4di`, (err, feed) => {\n if(err){\n throw err;\n }\n\n feed.items.forEach(item => {\n // TODO Massage the thing a bit so that we just have markdown in the content\n processFunction(item);\n });\n });\n}", "if (tweet.entities != null) {\n // If the tweet contains hashtags, aggregate them.\n if (tweet.entities.hashtags.length > 0) {\n // increment the total hashtag count\n this.counts.category['hashtag'].measure++; \n for (var i = 0; i < tweet.entities.hashtags.length; i++) {\n var key = tweet.entities.hashtags[i].text;\n if ( this.dataset.group['hashtag'].category[key] != null ) {\n this.dataset\n .group['hashtag']\n .category[key]++; // increment the count for this hashtag\n } else {\n this.dataset\n .group['hashtag']\n .category[key] = 1; // or set it to 1, if it doesn't exist\n };\n };\n }; \n // If the tweet contains URLs, aggregate them.\n if (tweet.entities.urls.length > 0) {\n this.url_count++; // increment the total URL count\n for (let i = 0; i < tweet.entities.urls.length; i++) {\n let key = tweet.entities.urls[i].display_url;\n /*\n if ( URL.parse(key).hostname == \"pics.twitter.com\" || ) {\n \n } else if ( ) {\n \n } else if ( ) {\n \n } */\n if ( key in this.urls ) {\n this.urls[key]++; //increment the count for this url\n } else {\n this.urls[key] = 1; // or add it, if it doesn't exist\n };\n };\n };\n // Even if the tweet doesn't contain any entities, it may have emojis.\n var matches = tweet.text.match(/([\\uE000-\\uF8FF]|\\uD83C[\\uDF00-\\uDFFF]|\\uD83D[\\uDC00-\\uDDFF])/g);\n if (matches) { \n this.emoji_count++; // Noticing a pattern here? :)\n for (let match of matches) {\n if (match in this.emojis) {\n this.emojis[match]++;\n } else {\n this.emojis[match] = 1;\n }\n }\n };\n }", "function wordCountEnginePt2(document) {\n // your code goes here\n const frequencyCnt = {};\n document\n .toLowerCase()\n .split(' ')\n .forEach((word, index) => {\n word = word.replace(/[^a-z]/gi, '');\n if (word) {\n if (frequencyCnt[word]) {\n frequencyCnt[word] = {\n count: frequencyCnt[word].count + 1,\n index: Math.min(index, frequencyCnt[word].index),\n };\n } else {\n frequencyCnt[word] = { count: 1, index };\n }\n }\n });\n\n // [[word, {index, count}]]\n const returnArr = Object.keys(frequencyCnt).map(key => [\n key,\n frequencyCnt[key],\n ]);\n returnArr.sort(([_a, a], [_b, b]) => {\n if (b.count === a.count) {\n return a.index - b.index;\n } else {\n return b.count - a.count;\n }\n });\n\n return returnArr\n .map(innerArr => innerArr)\n .map(([key, { count }]) => [key, `${count}`]);\n}", "function setupCharCtr(){\n let comment = document.getElementById(\"comment\");\n comment.addEventListener('keyup', function(e){\n let commentWords = comment.value;\n //let commentText = comment.value.length;\n let count = commentWords.trim().split(/\\s+/).length;\n \n document.getElementById(\"wordCount\").value = count;\n //document.getElementById(\"wordCount\").value = commentText+ \"/1000\";\n });\n\n}", "function process(opts, callback) {\n\n callback = (opts instanceof Function ? opts : null) ||\n callback ||\n opts.callback ||\n function(){return [];};\n\n var date_query = {};\n\n // get collections from context\n var posts = this.posts;\n var meta = this.meta;\n\n // if no date query given, get all tweets in database before now\n if (!opts.min_date && !opts.max_date) {\n opts.max_date = new Date();\n }\n\n if (opts.min_date) {\n date_query.$gte = opts.min_date;\n }\n\n if (opts.max_date) {\n date_query.$lte = opts.max_date;\n }\n\n // build aggregation query\n var agg = [\n {\n $match : {date : date_query }\n },\n {\n $group: {\n _id: \"$url\",\n mentions: { $sum: 1 },\n weighted_mentions : { $sum : \"$followers\" },\n first: { $min: \"$date\" },\n last: { $max: \"$date\" }\n }\n }\n ];\n\n posts.aggregate(agg, function(err, results) {\n\n if (err) console.log(err);\n\n var vals = _.chain(results)\n .sortBy('mentions')\n .takeRight(opts.num || 20)\n .map(function(r) {\n return {\n \"url\" : r._id,\n \"count\" : r.mentions\n };\n })\n .reverse()\n .value();\n\n meta.find({_id : { $in: _.pluck(vals, 'url') }}).toArray(function(err, docs){\n\n if (err) console.log(err);\n\n var meta_dict = {};\n\n docs.forEach(function(d) { meta_dict[d.url] = d; })\n\n callback(\n vals.map(function(r) {\n r.meta = meta_dict[r.url] || {};\n return r;\n })\n );\n\n });\n\n });\n\n}", "function countCensoredWords(sentence, words){\n if (typeof sentence === 'string' && typeof words === 'object'){\n const results = {}\n for (const key of words){\n results[key] = 0\n }\n results.total = 0\n sentence.toLowerCase().replace(/[^a-z\\s]/g, '').split(' ').map(item => {\n words.map(word => {\n if (item === word){\n results[word]++\n results.total++\n }\n })\n })\n return results\n } else {\n console.log('Please provide a string as the first parameter and a array as the second parameter')\n }\n}", "function getFrequency(emotions, tweetData, type) {\n\n for (var feeling in emotions) {\n var frequency = [];\n emotions[feeling].forEach(function (word) {\n if (frequency[word.toString()] == undefined) {\n frequency[word.toString()] = 1;\n } else {\n frequency[word.toString()]++;\n }\n });\n var topWords = [];\n var one = 0;\n var word = '';\n\n //This loop finds the first most used word\n for (var each in frequency) {\n if (frequency[each] > one) {\n one = frequency[each];\n\n word = each;\n }\n }\n if (word != '') {\n topWords[0] = word;\n }\n one = 0;\n word = '';\n //This loop finds the second most used word\n for (var each in frequency) {\n if (frequency[each] > one) {\n if (each != topWords[0]) {\n one = frequency[each];\n word = each;\n }\n }\n }\n if (word != '') {\n topWords[1] = word;\n }\n one = 0;\n word = '';\n\n //This loop finds the third most used word\n for (var each in frequency) {\n if (frequency[each] > one) {\n if (each != topWords[1] && each != topWords[0]) {\n one = frequency[each];\n word = each;\n }\n if (word != '') {\n topWords[2] = word;\n }\n }\n }\n\n tweetData[feeling][type.toString()] = topWords;\n }\n\n return tweetData;\n\n}", "function getRedditPosts(subreddit, category, clientResponse) {\n var queryCount = 10;\n var url = \"https://www.reddit.com/r/\" + subreddit + \"/\" + category + \"/.json?limit=\" + queryCount;\n\n var request = https.get(url, function(response) {\n var json = '';\n response.on('data', function(chunk) {\n console.log(\"processing...\")\n json += chunk;\n });\n\n response.on('end', function() {\n var redditResponse = JSON.parse(json);\n\n var returnedCount = redditResponse.data.children.length;\n if (typeof redditResponse.data != 'undefined') {\n\n redditResponse.data.children.forEach(function(child) {\n\n if (child.data.domain !== 'self.node') {\n console.log('-------------------------------');\n console.log('Author : ' + child.data.author);\n console.log('Domain : ' + child.data.domain);\n console.log('Title : ' + child.data.title);\n console.log('URL : ' + child.data.url);\n\n // if (child.data.domain === \"i.imgur.com\" || child.data.domain === \"i.reddituploads.com\" || child.data.domain == \"i.redd.it\" || child.data.domain === \"imgur.com\" ||\n // child.data.url.includes(\"jpg\") || child.data.url.includes(\"jpeg\") || child.data.url.includes(\"png\")) {\n var sanitizedURL = sanitizeURL(child.data.url) // removes &amp; and appends .jpeg if none exists\n //removes &amp; and removes '.' to prevent problems with file extension\n //also removes \" and , \n var sanitizedTitle = sanitizeTitle(child.data.title)\n\n var shortenedTitle = shortenTitle(sanitizedTitle);\n var filePath = \"images/\" + shortenedTitle;\n fetchImage(sanitizedURL, filePath, clientResponse, returnedCount)\n // }\n // else{\n // \t//different domain \n // }\n\n } else\n console.log(child.data.domain);\n });\n }\n\n //if reddit gave no posts bacl\n else {\n sendBackXMLHTTPResponse(clientResponse);\n\n }\n }) // end request on end\n }); // end http get\n\n request.on('error', function(err) {\n console.log(err.description);\n });\n}", "function setCommentCount(element, reddit_id) {\r\n\t$.ajax({\r\n\t\turl: \"http://www.reddit.com/comments/\" + reddit_id + \".json\",\r\n\t\tdataType: \"json\",\r\n\t\tasync: true,\r\n\t\tsuccess: function(data) {\r\n\t\t\telement.text(data[0].data.children[0].data.num_comments + \" Comments\");\r\n\t\t},\r\n\t\terror: function(xhr, textStatus, error) {\r\n\t\t\telement.text(\"Comments\");\r\n\t\t}\r\n\t});\r\n}", "function wordsRepetition(words) {\n let uniqueWords = [...new Set(words)];\n let wordRepetition = [];\n // Finding how many times each word repeat in quaries\n function frequency(word) {\n let counter = 0;\n for (let i = 0; i < words.length; i++) {\n if (words[i] === word) counter++;\n }\n return counter;\n }\n // Calculate impr/click of the word\n function imprOrClick(type, word) {\n let value = 0;\n for (let i = 0; i < inputData.length; i++) {\n if (inputData[i].query.includes(word) === true) value += inputData[i][type];\n }\n return value;\n }\n\n // Calculate total impr/click of the URL\n function totalImprOrClick(type) {\n let value = 0;\n for (let i = 0; i < inputData.length; i++) {\n value += inputData[i][type];\n }\n return value;\n }\n \n let totalImpr = totalImprOrClick(\"impr\");\n let totalClick = totalImprOrClick(\"click\");\n let inputDataLen = inputData.length;\n\n\n for (let i = 0; i < uniqueWords.length; i++) {\n wordRepetition[i] = {\n word: uniqueWords[i],\n weight: (frequency(uniqueWords[i]) * imprOrClick(\"impr\", uniqueWords[i]) * Math.pow(uniqueWords[i].length, 2)),\n freq: frequency(uniqueWords[i]),\n freqPercent: frequency(uniqueWords[i]) / inputDataLen,\n impr: imprOrClick(\"impr\", uniqueWords[i]),\n imprPercent: imprOrClick(\"impr\", uniqueWords[i]) / totalImpr,\n click: imprOrClick(\"click\", uniqueWords[i]),\n clickPercent: imprOrClick(\"click\", uniqueWords[i]) / totalClick,\n wordsInPhrase: uniqueWords[i].split(\" \").length\n }\n }\n\n function weightSum(arr) {\n let sum = 0;\n for (let i = 0; i < arr.length; i++) {\n sum += arr[i][\"weight\"];\n }\n return sum;\n }\n\n let totalWeight = weightSum(wordRepetition);\n\n for (let i = 0; i < wordRepetition.length; i++) {\n wordRepetition[i][\"weightPercent\"] = wordRepetition[i][\"weight\"] / totalWeight;\n }\n\n return wordRepetition;\n}", "function getNewSearchTerm(searchTerm,count) {\n var requestUrl = \"https://www.reddit.com/search.json?q=\" + searchTerm + \"&type=link&limit=\"+count;\n fetch(requestUrl)\n .then(function (response) {\n if (response.ok) {\n response.json().then(function (data) {\n displayListings(data);\n });\n }\n\n else if (response.status === 404) {\n displayError(\"This does not exist\");\n }\n })\n .catch(function (error) {\n displayError(\"Cannot connect to Reddit\");\n });\n\n}", "function getTweets(res, bearerToken, userTopic) {\n var url = 'https://api.twitter.com/1.1/search/tweets.json';\n request({\n url: url + \"?q=\" + userTopic + \"&count=50&lang=en&result_type=mixed\",\n method: 'GET',\n headers: {\n \"Authorization\": \"Bearer \" + bearerToken,\n \"Content-Type\": \"application/json\"\n },\n json: true\n }, function(err, jsonResponse, body) {\n tweetStrings = parseTweets(body);\n //tweetStrings = tweetStrings.join(\"\\n\");\n\n wordCounts = twitterAnalysis.getWordCountFromTweets(tweetStrings);\n\n res.render('twitter', { //Only render the website when we are finished writing to it\n title: 'Twitter Feed',\n topic: userTopic,\n tweets: tweetStrings\n });\n });\n}", "function sunsetGetCommentsCount() {\r\n const url = sunset_ajax_params.ajaxurl;\r\n let postID = $('#comments').data('postid');\r\n //postID = (postID != '') ? postID.toString() : '';\r\n let data = {\r\n action: 'sunset_comments_count',\r\n post_id: postID\r\n }\r\n\r\n $.post(url, data, function(response) {\r\n console.log(response)\r\n let commentsCount = response;\r\n $('.comments-title #comment_num').html(commentsCount);\r\n });\r\n }", "function wordcount() {\n var matches = writing_data().match(/\\w\\w+/g);\n if(!matches) return 0;\n return matches.length;\n}", "function updateCounter() {\n var charCount = tweetBody().length;\n $('#counter').html(140 - charCount);\n }", "function getStats(txt) {\n let txtInfo = {\n nChars: txt.length,\n nWords: 0,\n nLines: 0,\n nNonEmptyLines: 0,\n maxLineLength: 0,\n averageWordLength: 0,\n palindromes: [],\n longestWords: [],\n mostFrequentWords: [],\n };\n\n (function getLineInfo() {\n let lines = txt.split('\\n');\n txtInfo.nLines = txt.length === 0 ? 0 : lines.length;\n for(let l of lines) {\n if(l.trim().length !== 0) {\n txtInfo.nNonEmptyLines++;\n }\n if(l.length > txtInfo.maxLineLength) {\n txtInfo.maxLineLength = l.length;\n }\n }\n })();\n\n (function getWordInfo() {\n let wordDict = {};\n let wordLengths = [];\n let uniqueWords = [];\n let word = \"\";\n let c;\n if(txtInfo.nChars !== 0) {\n for (c of txt) {\n if (c.match(/^[0-9a-zA-Z]+$/)) {\n word += c;\n }\n else {\n if (word.length > 0) {\n addToVars();\n }\n }\n }\n //add the last word in the txt\n //if the txt doesn't end with non alphanumeric\n if (c.match(/^[0-9a-zA-Z]+$/)) {\n addToVars();\n }\n }\n\n //helper function to populate variables\n function addToVars() {\n wordLengths.push(word.length);\n txtInfo.nWords++;\n word = word.toLowerCase();\n if (uniqueWords.indexOf(word) === -1) {\n uniqueWords.push(word);\n }\n if (isNaN(wordDict[word])) {\n wordDict[word] = 1;\n }\n else {\n wordDict[word]++;\n }\n word = \"\";\n }\n\n //average word length\n if(wordLengths.length !== 0) {\n (function getAvgWordLength() {\n for (let len of wordLengths) {\n txtInfo.averageWordLength += len;\n }\n txtInfo.averageWordLength /= wordLengths.length;\n })();\n }\n\n //palindromes\n (function getPalindromes() {\n for (let w of uniqueWords) {\n if (w.length > 2) {\n if (w.split(\"\").reverse().join(\"\") === w) {\n txtInfo.palindromes.push(w);\n }\n }\n }\n })();\n\n //longest words\n (function getLongestWords() {\n uniqueWords.sort(function(a, b) {\n return b.length - a.length || a.localeCompare(b);\n });\n txtInfo.longestWords = uniqueWords.slice(0, 10);\n })();\n\n //word frequency\n (function getWordFreq() {\n let wordFreq = Object.keys(wordDict).map(function(key) {\n return [key, wordDict[key]];\n });\n wordFreq.sort(function(a, b) {\n return b[1] - a[1] || a[0].localeCompare(b[0]);\n });\n wordFreq = wordFreq.slice(0, 10);\n for (let i = 0; i < wordFreq.length; i++) {\n txtInfo.mostFrequentWords.push(wordFreq[i][0] + \"(\" + wordFreq[i][1] + \")\");\n }\n })();\n })();\n\n return txtInfo;\n}", "function alphamatiseComment(url) {\n reddit.get(\n url,\n {},\n function (error, response, body) {\n console.log(error);\n let info = JSON.parse(body);\n console.log(info[1].data.children[0]);\n const commentId = 't1_' + info[1].data.children[0].data.id;\n const alphaComment = alphabetChecker(info[1].data.children[0].data.body);\n const username = info[1].data.children[0].data.author;\n console.log(username);\n getUserTopComments(commentId, alphaComment, username);\n })\n}", "function occurrencesFuzzysort ( string, subStrings ) {\n if (minSimilarity > 0) minSimilarity = FUZZY_SORT_MIN_SIMILARITY;\n var words = (!!string && string != '') ? string.replace(/([^\\w\\d\\s]+)/g, '').replace(/\\s(\\s+)/g, ' ').split(/\\s/) : [];\n var counter = 0;\n var occurrences = [];\n words.forEach ( function ( entry ) {\n if (entry.length > 2) {\n var entryPrepared = fuzzysort.prepare(entry)\n subStrings.forEach ( function ( subString ) {\n var value = fuzzysort.single(subString, entryPrepared);\n if (!!value && value.score >= minSimilarity) {\n counter++;\n var index = -1;\n for ( var i = 0; i < occurrences.length; i++ ) {\n if (occurrences[i].name == entry) {\n index = i;\n break;\n }\n }\n if (index < 0) occurrences.push({name: entry, value: 1});\n else occurrences[index].value++;\n }\n });\n }\n });\n return {value: counter, occurrences: occurrences};\n }", "function getUserTopComments(commentId, alphaComment, username) {\n reddit.get(\n '/user/' + username + '/comments/?limit=100&sort=top',\n {},\n function (error, response, body) {\n console.log(error);\n let info = JSON.parse(body);\n\n let top100Comments = '';\n\n for(let property in info.data.children) {\n top100Comments += info.data.children[property].data.body + '\\n';\n }\n const checkedTopComments = topCommentsChecker(top100Comments);\n const finalComment = alphaComment + '\\n\\n' + checkedTopComments;\n console.log(finalComment);\n\n postComment(commentId, finalComment);\n })\n}", "function redditRequests(cb) {\n const redditHeaders = {\n 'User-Agent': redditUserAgent,\n 'Authorization': 'Bearer ' + process.env.REDDIT_BEARER_TOKEN\n },\n subredditsOptions = {\n url: redditUrl + `/subreddits/popular?limit=${subredditCount}`,\n headers: redditHeaders,\n json: true,\n };\n\n /**\n * Dates generated used for 24 hour filtration\n * @type {Date}\n */\n const d = new Date(),\n endTime = Math.floor(Date.parse(d) / 1000),\n startTime = Math.floor(d.setDate(d.getDate() - 1) / 1000);\n\n rp(subredditsOptions)\n .then((body) => {\n let subs = [];\n // subs = body.data.children;\n // subs.sort((a, b) => {return b.data.subscribers - a.data.subscribers});\n body.data.children.forEach((item) => subs.push(item.data.display_name));\n return subs;\n })\n .then((subs) => {\n let calls = [];\n subs.forEach((sub) => {\n let threadOptions = {\n url: redditUrl + `/r/${sub}/search?g=GLOBAL&limit=${threadCount}&sort=top&rank=hot&q=timestamp:${startTime}..${endTime}&restrict_sr=on&syntax=cloudsearch`,\n headers: redditHeaders,\n json: true,\n };\n\n calls.push((callback) => {\n rp(threadOptions)\n .then((body) => {\n let cleanedThreads = [];\n body.data.children.forEach((item) => {\n cleanedThreads.push({\n \"subreddit\": item.data.subreddit,\n \"id\": item.data.id,\n \"title\": item.data.title,\n \"score\": item.data.score,\n \"over_18\": item.data.over_18,\n \"subreddit_id\": item.data.subreddit_id,\n \"name\": item.data.name,\n \"subreddit_type\": item.data.subreddit_type,\n \"url\": item.data.url,\n \"created_utc\": item.data.created_utc,\n \"author\": item.data.author,\n \"ups\": item.data.ups,\n \"num_comments\": item.data.num_comments\n })\n });\n callback(null, cleanedThreads);\n })\n .catch((err) => {\n callback(err);\n });\n });\n });\n\n async.parallel(calls, (err, result) => {\n if (err) return console.error(err);\n result.forEach((item) => {\n threads = threads.concat(item);\n });\n cb(null, threads);\n });\n })\n .catch(console.error);\n}", "function wordCount(data, numBuckets) {\n\twordCounter = [];\n\tsortedWords = [];\n\ttotalWordCount = {};\n\tkeyArr = {};\n\tfor(i=0; i<numBuckets; i++) {\n\t\twordCounter[i] = {};\n\t\tsortedWords[i] = {};\n\t}\n\tfor(i in data) {\n\t\ttweet = data[i]\n\t\tmyBucket = Math.floor((1443300192 - parseInt(tweet[\"timestamp\"]))/3600);\n\t\tconsole.log(myBucket)\n\t\tfor(j in tweet.keywords) {\n\t\t\tmyWord = tweet.keywords[j];\n\t\t\tif (totalWordCount[myWord]) {\n\t\t\t\ttotalWordCount[myWord]++;\n\t\t\t} else {\n\t\t\t\ttotalWordCount[myWord] = 1;\n\t\t\t}\n\t\t\tif(wordCounter[myBucket][myWord]) {\n\t\t\t\twordCounter[myBucket][myWord]++;\n\t\t\t} else {\n\t\t\t\twordCounter[myBucket][myWord] = 1;\n\t\t\t}\n\t\t}\n\t}\n\tfor (bucket = 0; bucket < numBuckets; bucket++) {\n\t\tkeys = Object.keys(wordCounter[bucket]).sort(function(a,b) {\n\t\t\treturn wordCounter[bucket][b] - wordCounter[bucket][a];\n\t\t});\n\t\t//console.log(keys);\n\t\tkeyArr[bucket] = keys;\n\t}\n\t//console.log(keyArr);\n\tfor (index in keyArr) {\n\t\tkeys = keyArr[index];\n\t\tcounter = 0;\n\t\tfor (key in keys) {\n\t\t\tword = keys[key];\n\t\t\tif (counter < 20) {\n\t\t\t\t//$(\"body\").append(word +\"->\"+wordCounter[index][word] + \" \");\n\t\t\t\tcounter++;\n\t\t\t\tsortedWords[index][word] = wordCounter[index][word];\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t//$(\"body\").append(\"<br><br>\");\n\t}\n\t//$(\"body\").append(\"topWords: \");\n\ttopWordKeys = Object.keys(totalWordCount).sort(function(a,b) {\n\t\treturn totalWordCount[b]-totalWordCount[a];\n\t});\n\t//console.log(topWordKeys)\n\ttopWords = [];\n\tcounter = 0;\n\tfor(topwordkey in topWordKeys) {\n\t\tword = topWordKeys[topwordkey];\n\t\tif (counter < 20) {\n\t\t\tcounter++;\n\t\t\t//$(\"body\").append(word + \"->\"+totalWordCount[word]);\n\t\t\ttopWords.push(word);\n\t\t} else {\n\t\t\tbreak;\n\t\t}\n\t}\n\tconsole.log(topWords);\n\t// keysSorted = Object.keys(wordCounter).sort(function(a,b) {\n\t// \treturn wordCounter[b] - wordCounter[a];\n\t// });\n\t\n\t// for(index in keysSorted) {\n\t// \tword = keysSorted[index]\n\t// \t$('body').append(\"<p>\" + word + \"->\" + wordCounter[word] + '</p>')\n\t// }\n\tdrawStackedGraph();\n\n}", "_fetchComments(post, callback) {\n\n let comments = [];\n var isFormattedComment = true;\n\n // textFormat=plainText required due to http://stackoverflow.com/questions/35281771/youtube-api-textdisplay-is-blank-for-all-comments (once resolved by Google may remove)\n let options = this._generateOptionsPath('GET', ('/youtube/v3/commentThreads?part=snippet&videoId=' + post.id + '&order=time&textFormat=plainText'));\n\n let commentFilter = (item) => (item.kind === 'youtube#commentThread');\n let parseUser = (item) => {\n if (item.authorDisplayName === undefined || item.authorProfileImageUrl === undefined) {\n isFormattedComment = false;\n return false;\n }\n return new User({\n id: (item.authorChannelId ? item.authorChannelId.value : (item.channelId ? item.channelId : 'ERROR')),\n name: item.authorDisplayName,\n photoUrl: item.authorProfileImageUrl,\n vendor: this.identity.vendor\n });\n };\n let parseComment = (item) => {\n if (!item || typeof item !== 'object' || item.id === undefined ||\n\t\t\t\titem.snippet === undefined ||\n\t\t\t\titem.snippet.topLevelComment === undefined ||\n\t\t\t\titem.snippet.topLevelComment.snippet === undefined ||\n\t\t\t\titem.snippet.topLevelComment.snippet.updatedAt === undefined) {\n isFormattedComment = false;\n\t\t\t\treturn null;\n } \n\t\t\treturn new Comment({\n\t\t\t\tcreator: (parseUser(item.snippet.topLevelComment.snippet) ? parseUser(item.snippet.topLevelComment.snippet) : new User()),\n\t\t\t\tid: item.id,\n\t\t\t\tmessage: (item.snippet.topLevelComment.snippet.textDisplay ? this.htmlparser.decode(item.snippet.topLevelComment.snippet.textDisplay) : ''),\n\t\t\t\trawTimestamp: item.snippet.topLevelComment.snippet.updatedAt,\n\t\t\t\ttimestamp: this._epochinator(item.snippet.topLevelComment.snippet.updatedAt),\n\t\t\t\tvendor: this.identity.vendor,\n\t\t\t});\n\t\t\t\n\t\t};\n\n\t\tthis._issueRequest(options, 'loadPosts', (response, headers) => {\n\t\t\t\tcomments = response.items.filter(commentFilter).map(parseComment).filter(item => !!item);\n if (isFormattedComment === false) {\n callback(response.items);\n }\n\n\t\t\t\tif (comments.length > 0) {\n\t\t\t\t\tthis.broadcast('postUpdated', {\n\t\t\t\t\t\tcomments: comments,\n\t\t\t\t\t\tid: post.id,\n\t\t\t\t\t\tidentity: this.identity\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.broadcast('postFailed',{\n\t\t\t\t\t\tid: post.id\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t\t(response) => {\n\t\t\t\tif (response.error) {\n\t\t\t\t\tif (response.error.errors[0].reason === \"commentsDisabled\") {\n\t\t\t\t\t\tvar actions = [\n\t\t\t\t\t\t\tnew Action({\n\t\t\t\t\t\t\t\ttype: 'Like'\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tnew Action({\n\t\t\t\t\t\t\t\ttype: 'Share'\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t];\n\t\t\t\t\t\tthis.broadcast('postUpdated', {\n\t\t\t\t\t\t\tactions: actions,\n\t\t\t\t\t\t\tid: post.id,\n\t\t\t\t\t\t\tidentity: this.identity,\n\t\t\t\t\t\t\tproperty: 'actions'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}", "function getPostsForSubreddit(subredditName) {\n //limits to top 50 post \n\tvar url = `https://www.reddit.com/r/${subredditName}.json?limit=50`;\n\treturn request(url)\n\t\t.then(response => {\n\t\t\tvar result = JSON.parse(response);\n\t\t\treturn result.data.children\n\t\t\t\t.filter(response => {\n\t\t\t\t //filter returns a new array, removing entries that return false\n\t\t\t\t //this filters all self-posts from the request result\n\t\t\t\t\tif(response.data.is_self === false) {\n\t\t\t\t\t\treturn response.data;\n\t\t\t\t\t}\n\t\t\t\t\treturn false; //return false other wise\n\t\t\t\t})\n\t\t\t\t//this maps a new array which contains only necessary information for data creation\n\t\t\t\t.map(response => {\n\t\t\t\t\tvar mapped = {\n\t\t\t\t\t\tuser : response.data.author,\n\t\t\t\t\t\ttitle: response.data.title,\n\t\t\t\t\t\turl: response.data.url\n\t\t\t\t\t};\n\t\t\t\t\treturn mapped; // returning title,url & user objects only\n\t\t\t\t}); \n\t\t});\n}", "function analyzeTweets(tweets) {\n var tweetData = { 'positive': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'trust': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'anticipation': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'joy': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'surprise': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'negative': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'sadness': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'disgust': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'fear': { 'percent': 0, 'frequency': [], 'hashtags': [] }, 'anger': { 'percent': 0, 'frequency': [], 'hashtags': [] } };\n var text = '';\n tweets.forEach(function (tweet) {\n text = text + (tweet['text'] + \" \");\n });\n\n var wordList = extractWords(text);\n var emotions = findSentimentWords(wordList);\n console.log(emotions);\n for (var key in emotions) {\n tweetData[key]['percent'] = ((emotions[key].length / wordList.length) * 100);\n }\n\n tweetData = getFrequency(emotions, tweetData, \"frequency\");\n var hashtags = findHashtags(tweets, emotions, tweetData);\n}", "function countWords() {\n reset();\n\n let text = document.getElementById(\"text\").value.toLowerCase();\n\n if (text === \"\") {\n // Show an alert if text field is empty\n alert(\"Text field is empty.\");\n } else {\n // Split by white space\n wordsArr = text.split(\" \");\n // Remove punctuation\n wordsArr.forEach((val, index, arr) => {\n arr[index] = val.replace(/[.!?,;:]/g, \"\");\n });\n // Capitalize first letters\n wordsArr.forEach((val, index, arr) => {\n arr[index] = val.charAt(0).toUpperCase() + val.slice(1);\n });\n // Create unique array\n wordsArr.forEach(w => {\n if (!uniqueArr.includes(w)) {\n uniqueArr.push(w);\n }\n });\n // Find occurences\n for (let i = 0; i < uniqueArr.length; i++) {\n let obj = {};\n let word = uniqueArr[i];\n let freq = 0;\n for (let j = 0; j < wordsArr.length; j++) {\n if (uniqueArr[i] === wordsArr[j]) {\n freq++;\n }\n }\n\n obj.key = word;\n obj.value = freq;\n freqArr.push(obj);\n }\n // Sort the array by descending order\n freqArr.sort(function(a, b) {\n return b.value - a.value;\n });\n\n // Print the result\n print();\n }\n}", "function findTopPost() {\n reddit.get(\n '/r/all/.json', //Edit this to the subreddit of your choosing\n {},\n function (error, response, body) {\n let info = JSON.parse(body);\n const subreddit = info.data.children[0].data.subreddit;\n const id = info.data.children[0].data.id;\n const url = '/r/' + subreddit + '/comments/' + id + '.json';\n alphamatiseComment(url);\n })\n}", "_extractMessagesWords(messages, filter = null, minimumWordLength = 0, strictFilter = true){\n var messagesWords = []\n var progress = 1\n\n messages.map((m, index) => {\n\n // certainly improvable progress bar\n if(Math.ceil(messages.length / 100) * progress == index){\n progress++\n process.stdout.clearLine();\n process.stdout.cursorTo(0);\n process.stdout.write(progress + '%');\n }\n\n // no need to parse media or system messages\n if(!m.isMedia && m.isUserMessage){\n m.message.split(\" \").forEach(e => {\n\n var messageWord = e.toLowerCase();\n var matchesRequirement = !filter ? true : strictFilter ? messageWord == filter : messageWord.includes(filter);\n\n // parses the message if there's no filter or the message matches it and the message also meets the length\n if((!filter || matchesRequirement) && (messageWord.length >= minimumWordLength)){\n\n var newWord = true;\n \n // if the word exists in the array we're going to return, just add to the count\n messagesWords.map(function(words_item){\n var word = words_item.word.toLowerCase()\n if(word == messageWord){\n\n newWord = false;\n words_item.total_count++\n\n if(words_item.hasOwnProperty([m.user])){\n words_item[m.user]++\n } else {\n words_item[m.user] = 1\n }\n\n }\n })\n \n // else create the object and push it into the array\n if(newWord){\n messagesWords.push({word: messageWord, total_count: 1, [m.user]: 1})\n }\n }\n \n });\n }\n })\n\n // remove the progress bar\n process.stdout.clearLine();\n\n messagesWords = messagesWords.sort((a, b) => {\n return b.total_count - a.total_count;\n })\n\n return messagesWords;\n }", "function wordFreq(songLyrics) {\n //set all lyrics to lowerCase to Capital letters do not create duplicates\n let words = songLyrics.toLowerCase().replace(/[.]/g, '').split(/\\s/);\n\n words.forEach(function (lyric) {\n //check for two character or less and 'the\n if (lyric.length <= 3) {\n }\n else {\n if (!freqLyric[lyric]) {\n freqLyric[lyric] = 0; \n }\n freqLyric[lyric] += 1;\n }\n });\n return freqLyric;\n }", "function updateWordCount(count) {\n if (count % 25 !== 0) return;\n document.querySelector('#words').innerHTML = count;\n}", "function countKeyWords(input) {\n console.log('processing3!' + site.page.key());\n\n // console.log('here');\n var rank = [];\n var wordList = [];\n\n // For each word in the input array, lets count how many times each word has occured\n for(i in input) {\n\n var word = input[i];\n var duplicate = false;\n // Check for duplicates\n for (j in rank){\n\n if(rank[j].word === word){\n duplicate = true;\n rank[j].count ++;\n\n }\n }\n\n // If no duplicate found\n if(!duplicate){\n // New word\n rank.push({word: word, count: 1});\n\n }\n }\n\n // Remove all the words what apeae only once\n for(i in rank) {\n if(rank[i].count <= 1) {\n rank.splice(i, 1);\n }\n }\n // Reorder the words (objects) in the array so that they are ordered from highest to lowest count\n console.log('processing4!' + site.page.key());\n var output = {};\n if(rank.length > 1) {\n var orderedRank = [rank[0]];\n\n // console.log('rank: ');\n for(i in rank) {\n // console.log(rank[i]);\n }\n for(var i = 1; i < rank.length; i++) {\n var position = 0;\n\n for(j in orderedRank) {\n position = j;\n if(rank[i].count > orderedRank[j].count) {\n break;\n }\n }\n orderedRank.splice(position, 0, rank[i]);\n\n }\n\n // Convert the array to an object because Friebase prefers it that way\n for(i in orderedRank) {\n output[i] = orderedRank[i];\n }\n\n }\n\n // var convertedName = site.hostname.replace(/\\./g, \" \");\n // ref.child('websites/' + convertedName + \"/pages\").push({page: site.page.val().URL, keyWords: output});\n //\n // asyncBack();\n\n}", "function computeWordsDocumentsFrequency(documents) {\n let documentMaps = documents.map((document)=>{\n let documentMap = new Map();\n document.split(\" \").forEach((rawWord)=>{\n let word = purgeWord(rawWord);\n let nrOfOccurances = documentMap.get(word);\n if(nrOfOccurances === undefined) {\n documentMap.set(word, 1);\n } else {\n documentMap.set(word, ++nrOfOccurances);\n }\n });\n return documentMap;\n });\n return documentMaps;\n}", "function getCommonWords(list) {\n\n // create array of arrays of words by splitting tweet strings\n let tweets = list.map(tweet => {\n return tweet.split(' ');\n });\n\n // Flatten array via apply, one array of words remains\n let words = [].concat.apply([], tweets);\n\n // Removing wily characters\n words = words.map(word => {\n return word.replace(/[^A-Za-z0-9\\n\\s]/g,\"\").replace(/\\s{2,}/g, \" \")\n\n });\n\n // Using 'stopword' library to filter out stopwords\n let filteredWords = stopword.removeStopwords(words);\n\n // create object with key/value of word/count from all strings\n let obj = filteredWords.reduce(function(number, word) {\n number[word] = number.hasOwnProperty(word) ? number[word] + 1 : 1;\n return number;\n }, {});\n\n let sortable = Object.entries(obj).map(([k, v]) => {\n return { x: k, y: v }\n });\n\n // Remove space, RT, and IoT values from filtered array\n for (let i = sortable.length - 1; i >= 0; --i) {\n // Not proud of this hack\n if (\n sortable[i].x === '' ||\n sortable[i].x === ' ' ||\n sortable[i].x === 'RT' ||\n sortable[i].x === 'IoT' ||\n sortable[i].x === 'iot'\n ) {\n sortable.splice(i, 1);\n }\n }\n\n // Sort the array and reverse to orient data correctly\n sortable.sort(function(a, b) {\n return a.y - b.y;\n }).reverse();\n\n // Return first 20 results\n return sortable.slice(0, 20);\n}", "async frontPageContent(accessToken, subreddit) {\n const urlBase = 'https://oauth.reddit.com'\n const urlPost = '/hot'\n let searchParams = new URLSearchParams();\n searchParams.set('limit', 27)\n let urlSubreddit = ''\n if (subreddit) {\n urlSubreddit = '/r/' + subreddit\n }\n const url = urlBase + urlSubreddit + urlPost + '?' + searchParams.toString();\n let headers = new Headers()\n headers.set('Authorization', 'Bearer ' + accessToken)\n return fetch(url, {\n method: 'GET',\n headers,\n }).then(res => res.json())\n .catch(error => error)\n }", "function stringFrequency(){\n for(var i = 0; i < strLength; i++){\n frequencyMap.set(splitStrings[i], 0);\n }\n \n for(var i = 0; i < strLength; i++){\n if(frequencyMap.get(splitStrings[i]) === 0){\n uniqueWords.push(splitStrings[i]);\n }\n frequencyMap.set(splitStrings[i],\n frequencyMap.get(splitStrings[i]) + 1);\n }\n \n console.log(frequencyMap);\n return null;\n }", "function processTweets(tweets) {\n var count = 0;\n tweets.forEach((tweet, index) => {\n var word = pickWord(tweet.text),\n wordIndex, correctWord, correction;\n if (count >= MAX_CYCLE_TWEETS) {\n // Don't go over the limit\n return;\n }\n if (tweet.text.indexOf(\"RT\") === 0) {\n // Skip retweets\n console.log(\"Rejecting tweet because: retweet\");\n return;\n }\n if (word === null){ \n // Skip this tweet\n console.log(\"Rejecting tweet because: no matching words\");\n return;\n }\n if (engagementHistory.indexOf(tweet.id_str) !== -1) {\n // Skip tweet if we've already messed with this one\n console.log(\"Rejecting tweet because: already engaged\");\n return;\n }\n if (tweetInappropriate(tweet)) {\n // Skip tweets with inappropriate content or from inappropriate accounts\n console.log(\"Rejecting tweet because: inappropriate\");\n return;\n }\n wordIndex = tweet.text.indexOf(word);\n correctWord = getCorrectWord(word, wordIndex, tweet.text);\n \n correction = pickCorrection(correctWord);\n \n logCorrection(tweet, correction);\n tweetCorrection(tweet, correction);\n \n count++;\n engagementHistory.push(tweet.id_str);\n });\n}", "function countWords(string){\n if( string.trim() == \"\" ) return console.log(\"text empty\");\n let list = {} ;\n\nfunction addCount(ele){\n if( ele.trim() == \"\" ) return ;\n if( ele == \" \" ) return ;\n if(list.hasOwnProperty(ele) === true ){\n list[ele]++ ;\n }else{\n list[ele] = 1 ; \n }\n return list \n}\n let brokenSerie = string.replace(/[.*+\\-?^${}()|[\\]%$&¬↵€\"'’«»–\\\\¿!:;¡,=”\\<>/≠]/g,\" \")\n .replace(/(\\r\\n|\\n|\\r)/gm, \"\")\n .split(\" \") ;\n\n let results = brokenSerie.map( e => addCount(e.toLowerCase()) );\n let numberOfWords = Object.values( list ).reduce((cu, e)=> cu +e )\n let sortedList = Object.entries( list ).sort( \n (a, b) =>{ return b[1] - a[1] }\n );\n\n\n // creates a table with the results \n function resultTable(data){\n \n let tableRow = document.createElement(\"div\") ;\n tableRow.classList.add(\"tr\");\n tableRow.setAttribute(\"id\", \"trKing\");\n let dataWord = document.createElement(\"div\") ;\n dataWord.classList.add(\"td\")\n let dataNum = document.createElement(\"div\") ;\n dataNum.classList.add(\"td\")\n let dataPer = document.createElement(\"div\") ;\n dataPer.classList.add(\"td\")\n dataWord.innerText = data[0] ;\n dataNum.innerText = data[1] ;\n dataPer.innerText = ((data[1] * 100)/numberOfWords).toFixed(2) +\"%\" ;\n\n\t\t\t\t\ttableRow.appendChild(dataWord);\n\t\t\t\t\ttableRow.appendChild(dataNum);\n\t\t\t\t\ttableRow.appendChild(dataPer);\n\n\t\t\t\t\twordList.appendChild(tableRow);\n \n }\n\n sortedList.forEach( (e)=>{ resultTable(e) } )\n\n function refreshValues(){\n // sets values of tr, th, total number of words \n total__num.innerText = \"TOTAL: \"+ numberOfWords ;\n form.reset()\n }\n refreshValues() \n}", "function updateCount() {\r\n var commentText = document.getElementById(\"comment\").value;\r\n // this variable is created using a function as its value with the parameters of the commentText variable\r\n var charCount = countCharacters(commentText);\r\n\r\n var wordCountBox = document.getElementById(\"wordCount\");\r\n // The variable will be update the visible at the bottom of the page so as you type it changes to match how many characters have been typed\r\n wordCountBox.value = charCount + \"/1000\";\r\n // this changes the input box if 1000 chars are exceeded so that its a red background and the font is white\r\n if (charCount > 1000) {\r\n wordCountBox.style.backgroundColor = \"red\";\r\n wordCountBox.style.color = \"white\";\r\n } else {\r\n wordCountBox.style.backgroundColor = \"black\";\r\n wordCountBox.style.color = \"white\";\r\n }\r\n}", "function charFreq(word) {\n var freqListing = {};\nvar charArray=word.split('');\nfor (var i = 0; i<charArray.length; i ++){\n if (freqListing[charArray[i]]){\n freqListing[charArray[i]]+=1;\n }else{\n freqListing[charArray[i]]=1;\n }\n}\nreturn freqListing;\n}", "function getWordFrequency(word) {\n let request = {\n method: 'GET',\n dataType: 'json',\n url: 'http://api.datamuse.com/words',\n data: {\n sp: word, // Spelled like word\n md: \"f\", // Get frequency metadata\n max: 1 // Return max 1 result\n }\n };\n return Promise.resolve($.ajax(request));\n}", "function occurrencesDice ( string, subStrings ) {\n var words = (!!string && string != '') ? string.replace(/([^\\w\\d\\s]+)/g, '').replace(/\\s(\\s+)/g, ' ').split(/\\s/) : [];\n var counter = 0;\n var occurrences = [];\n words.forEach ( function ( entry ) {\n if (entry.length > 2) {\n subStrings.forEach ( function ( subString ) {\n var value = compareTwoStrings(entry, subString);\n if (value >= minSimilarity) {\n counter++;\n var index = -1;\n for ( var i = 0; i < occurrences.length; i++ ) {\n if (occurrences[i].name == entry) {\n index = i;\n break;\n }\n }\n if (index < 0) occurrences.push({name: entry, value: 1});\n else occurrences[index].value++;\n }\n });\n }\n });\n return {value: counter, occurrences: occurrences};\n }", "function getSingleWordFrequency(word) {\n let request = {\n method: 'GET',\n dataType: 'json',\n url: 'http://api.datamuse.com/words',\n data: {\n sp: word, // Spelled like word\n md: \"f\", // Get frequency metadata\n max: 1 // Return max 1 result\n }\n };\n return $.ajax(request);\n}", "function filterTweet(tweet) {\n let compiledTweet = new String\n let tweetParsedArr = tweet.match(/[A-Za-z0-9 _.!/$]+/g)\n\n function blankspace() { return '' }\n function percent20() { return '%20' }\n\n //extracts every basic character so Watson doesn't break\n tweetParsedArr.forEach( miniString => {\n compiledTweet += miniString\n })\n return compiledTweet.replace(/[h][t][t][p]+[^\\s]+/g, blankspace).replace(/[\\s]+/g, percent20)\n}", "countBigWords(input) {\n // Split the input\n let arr = input.split(\" \");\n // Start counter from 0\n let count = 0;\n //if array contains more than 6 lettes word, add 1 otherwise neglect word and keep moving further\n //until whole string input is completed\n arr.forEach(word =>{\n if (word.length > 6){\n count++;\n }\n \n });\n\n // return the count of all words with more than 6 letters\n return count;\n }", "async function scrapeData(subreddits) {\n\t// build reddit url\n\tlet url = \"https://old.reddit.com/r/\";\n\tfor (let i = 0; i < subreddits.length; i++) {\n\t\turl += \"+\" + subreddits[i];\n\t}\n\turl += '/top/?sort=top&t=day';\n\n\tlet scrapedData = {'data': []};\n\n\tconst response = await request({\n\t\turi: url,\n\t\tresolveWithFullResponse: true\n\t});\n\n\tconsole.log(\"Status code: \" + response.statusCode);\n\tconst body = response.body;\n\tlet $ = cheerio.load(body);\n\n\t$('div#siteTable > div.link').each(function(index) {\n\t\tlet title = $(this).find('p.title > a.title').text().trim();\n\t\tlet href = $(this).find('p.title > a.title').attr('href').trim();\n\t\tif (href.slice(0, 3) === \"/r/\") {\n\t\t\thref = 'https://old.reddit.com'.concat(href);\n\t\t}\n\t\tscrapedData.data.push({\"text\": title, \"link\": href})\n\t});\n\n\treturn scrapedData;\n}", "function processData(input) {\n console.log(input.match(/[#|@]*hackerrank/ig).length);\n}", "async function fetchComments (post, callback) {\n // Get this post's comments\n const comments = await r.getSubmission(post).expandReplies({ limit: 10, depth: 3 })\n\n // Add the comment bodies to list\n const AllComments = []\n // console.log('comment0: ', comments.comments[0])\n for (const comment of comments.comments) {\n var com = {}\n com.author = comment.author.name\n com.body = comment.body\n com.body_html = comment.body_html\n com.permalink = comment.permalink\n com.score = comment.score\n com.subreddit = comment.subreddit_name_prefixed\n com.timestamp = comment.created_utc // .created also an optino\n com.depth = comment.depth\n com.guildings = comment.guildings\n\n AllComments.push(com)\n }\n return AllComments\n}", "function countCategoryTweets(data) {\n data.forEach( function(item) {\n switch(item.category){\n case 'democratic presidential candidates': return Data.categories[0].count++\n case 'republican presidential candidates': return Data.categories[1].count++\n case 'journalists and other media figures': return Data.categories[2].count++\n case 'television shows': return Data.categories[3].count++\n case 'republican politicians': return Data.categories[4].count++\n case 'places': return Data.categories[5].count++\n case 'other people': return Data.categories[6].count++\n case 'other': return Data.categories[7].count++\n case 'media organizations': return Data.categories[8].count++\n case 'groups and political organizations': return Data.categories[9].count++\n case 'democratic politicians': return Data.categories[10].count++\n case 'celebrities': return Data.categories[11].count++\n }\n })\n sortingFunction()\n}", "function getWordCounts(text) {\n\n}", "function wordCount(){\n var wom = $(\"#essay\").html().replace( /[^a-z0-9\\s]/g, \"\" ).split( /\\s+/ ).length;\n $(\"#demo11\").html(wom + \" word count\")\n}", "function countWords(str) {\n // your code here\n var x = {};\n if (str !== \"\") {\n var arr = str.split(\" \");\n for (var i = 0; i < arr.length; i++) {\n if (typeof x[arr[i]] != \"undefined\") {\n x[arr[i]] += 1;\n } else {\n x[arr[i]] = 1;\n }\n }\n } else {\n return x = {};\n }\n return x;\n }", "function get_hn_comments() {\n\n // try {\n // http://www.hunlock.com/blogs/Howto_Dynamically_Insert_Javascript_And_CSS\n var headID = document.getElementsByTagName(\"head\")[0];\n var newScript = document.createElement('script');\n newScript.type = 'text/javascript';\n newScript.src = 'https://cdn.firebase.com/v0/firebase.js';\n headID.appendChild(newScript);\n\n var subtext = document.getElementsByClassName('subtext')[0];\n var main_id = \"000-\";// ex: \"http://news.ycombinator.com/item?id=4947963\"\n\n try {\n main_id += subtext.getElementsByTagName('a')[subtext.getElementsByTagName('a').length-1].href.replace(\"http://news.ycombinator.com/item?id=\",\"\");\n } catch (e) { main_id += document.location.href.replace(\"http://news.ycombinator.com/item?id=\",\"\"); }\n\n var main_user = subtext.getElementsByTagName('a')[0].text;\n var main_title = subtext.parentNode.previousSibling.getElementsByClassName('title')[0].getElementsByTagName('a')[0].text;\n\n var hackernews_comments = new Firebase('https://hackernews.firebaseIO.com/comments');\n var main_comments = hackernews_comments.child(\"thread-\" + main_id); // hackernews_comments.child(\"long\"); // hackernews_comments.child(main_id);\n \n main_comments.remove();\n\n var main_ref = main_comments.child(main_id);\n main_ref.set({name:main_user, comment:main_title});\n\n var comments = document.getElementsByClassName('comment');\n var parents = [];\n for (var i=0; i<comments.length; i++) {\n\n var comment_deleted = comments[i].parentNode.getElementsByClassName('comhead')[0].children.length == 0;\n\n var comment = comments[i].innerHTML;\n var comment_user = comment_deleted ? '[deleted]' : comments[i].parentNode.getElementsByClassName('comhead')[0].getElementsByTagName('a')[0].text;\n var comment_id = comment_deleted ? (\"00\" + i).slice(-3) + '-deleted-' + main_id : (\"00\" + i).slice(-3) + '-' + comments[i].parentNode.getElementsByClassName('comhead')[0].getElementsByTagName('a')[1].href.replace(\"http://news.ycombinator.com/item?id=\",\"\");;\n var comment_level = comments[i].parentNode.parentNode.getElementsByTagName('img')[0].width / 40;\n var comment_ref = main_comments.child(comment_id);\n\n parents[comment_level] = comment_id;\n \n comment_ref.set({name:comment_user, comment:comment});\n \n if (comment_level == 0) {\n main_ref.child(\"children\").child(comment_id).set(true);\n comment_ref.child(\"parent\").set(main_id);\n comment_ref.child(\"parents\").child(main_id).set(true);\n main_ref.child(\"children_all\").child(comment_id).set(true);\n } else { \n main_comments.child(parents[comment_level-1]).child(\"children\").child(comment_id).set(true);\n comment_ref.child(\"parent\").set(parents[comment_level-1]);\n\n comment_ref.child(\"parents\").child(main_id).set(true);\n main_ref.child(\"children_all\").child(comment_id).set(true);\n for (var ii=0; ii<comment_level; ii++) {\n comment_ref.child(\"parents\").child(parents[ii]).set(true);\n main_comments.child(parents[ii]).child(\"children_all\").child(comment_id).set(true);\n }\n }\n }\n // } catch (e) {\n // console.log(\"failed\", e)\n // }\n\n // http://stackoverflow.com/a/10073761/202448\n // (\"000\" + i).slice(-3)\n}", "function parseJSON(jsonData, category) {\n var dataStorage = {}; //create an array to hold information from reddit\n\n //now store the information obtained from the URL array, looping through all 25(default value) posts\n for (var i = 0; i < 25; i++)\n {\n if (category === \"All Categories\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n else if (category === \"Case\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/case/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"Controller\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/controller/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"Cooler\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/cooler/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"CPU\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/cpu/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"FAN\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/fan/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"GPU\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/gpu/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"HDD\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/hdd/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"Headphones\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/headphone/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"Keyboard\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/keyboard/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category == \"Monitor\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/monitor/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"Mouse\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/mouse/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"PSU\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/psu/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"RAM\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/ram/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"SSD\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/ssd/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n else if (category === \"MOBO\")\n {\n //get the title and url of each post\n var title = JSON.stringify(jsonData.data.children[i].data.title);\n var result = title.match(/mobo/gi);\n if (result)\n {\n var url = JSON.stringify(jsonData.data.children[i].data.url);\n var thumbnail = JSON.stringify(jsonData.data.children[i].data.thumbnail);\n //store the title and its respective url in each index of the array\n dataStorage[title] = url;\n }\n }\n\n }\n\n chrome.storage.local.set({ data: dataStorage });\n}", "function parseCollectComments(comment) {\n\t\n var parsed = \"\";\n parsed += '<div class=\"text\">\\n';\n parsed += '<table class=\"table table-bordered\"><tbody>';\n \n\tvar count = 0;\n\tvar allComments = JSON.parse(comment);\n\t\n for (var i in allComments) {\n\t\tvar entry = allComments[i];\n var name = entry[0];\n var comment = entry[1];\n\t\t\n\t\tif(count == 0){\n\t\t\tparsed += '<tr class=\"info\">';\n\t\t}\n//Creating rows\n parsed += '<td><center>' + name + '<br><br><h5>' + comment + '</h5></center></td>';\n\t\tcount += 1;\n\t\t\n\t\tif(count == 1){\n\t\t\tparsed += '</tr>'\n\t\t\tcount = 0;\n\t\t}\n }\n\t\n\tif(parsed > 0){\n\t\tparsed += '</tr>'\n\t}\n\t\n parsed += '</table>';\n parsed += '</div>\\n\\n';\n return parsed;\n}", "function countComments(tasks) {\n //period = period || 'all';\n let hashNumberOfComments = {}; //just a count of comments\n $scope.hashComments = {}; //a hash of the actual comment\n tasks.forEach(function (iTask) {\n hashNumberOfComments[iTask.path] = hashNumberOfComments[iTask.path] || 0\n hashNumberOfComments[iTask.path] ++\n\n $scope.hashComments[iTask.path] = $scope.hashComments[iTask.path] || []\n $scope.hashComments[iTask.path].push(iTask)\n });\n return hashNumberOfComments\n }", "function addToWordCount(string) {\r\n // Split words, names, or terms in titles\r\n var words = string.toLowerCase().replace(/[^\\w#$\\'\\’\\-]+/g,'.').split('.');\r\n g_words = g_words.concat(words);\r\n}", "function processData(n, t0, w) {\n\tconsole.log('processing W'+n+\n\t\t' ('+t0.toLocaleDateString()+':'+t0.toLocaleTimeString()+')'\n\t);\n\tvar badThema = {};\n\n\tfor(var a = 0, aZ = w.length; a < aZ; a++) {\n\t\tif (a % 1000 === 0) {\n\t\t\tconsole.log('Tweet: '+a+' / '+aZ + ' Users: '+Object.keys(users).length);\n\t\t}\n\t\tvar d = w[a];\n\n\t\tif (!themaK[d.thema]) {\n\t\t\tbadThema[d.thema] = 1;\n\t\t\td.thema = themaK['0'];\n\t\t} else {\n\t\t\td.thema = themaK[d.thema];\n\t\t}\n\n\t\td.casename = d.username;\n\t\td.username = d.username.toLowerCase();\n\t\tvar mentions = getMentions(d.tweet);\n\t\td.good = isGoodTweet(d.username, mentions);\n\t\tvar date = (new Date(Date.parse(d.date)));\n\t\td.timestamp = date.getTime();\n\t\td.day = (n * 10 + 1) +\n\t\t\t(Math.floor((date.getTime() - t0.getTime()) / (24 * 60 * 60 * 1000)));\n\t\td.hour = date.getHours();\n\n\t\tif (!d.good) continue;\n\n\t\tvar user = users[d.username];\n\t\tif (!user) {\n\t\t\tuser = users[d.username] = initUser(d.username, d.casename, 0, 0, 0);\n\t\t} else if (user.casename === null) {\n\t\t\tuser.casename = d.casename;\n\t\t}\n\n\t\tuser.w.a .tweets[themaK.a]++;\n\t\tuser.w[n].tweets[themaK.a]++;\n\n\t\tuser.w.a .tweets[d.thema]++;\n\t\tuser.w[n].tweets[d.thema]++;\n\n\t\tfor (var b = 0, bZ = mentions.length; b < bZ; b++) {\n\t\t\tif (bZ > 20) { console.log('BZ '+bz); }\n\t\t\tvar mention = mentions[b];\n\n\t\t\tswitch (mention.type) {\n\t\t\tcase 1 : d.mention = true; break;\n\t\t\tcase 2 : d.directAddress = true; break;\n\t\t\tcase 3 : d.retweet = true; d.simpleRetweet = true; break;\n\t\t\tcase 4 : d.retweet = true; d.commentRetweet = true; break;\n\t\t\tdefault : throw new Error('invalid mention type');\n\t\t\t}\n\n\t\t\tvar muser = users[mention.username];\n\t\t\tif (!muser) {\n\t\t\t\tmuser = users[mention.username] =\n\t\t\t\t\tinitUser(mention.username, null, 0, 0, 0);\n\t\t\t}\n\n\t\t\tif (d.mention || d.directAddress) {\n\t\t\t\tmuser.w.a .mentionsIn[themaK.a]++;\n\t\t\t\tmuser.w[n].mentionsIn[themaK.a]++;\n\t\t\t\tmuser.w.a .mentionsIn[d.thema]++;\n\t\t\t\tmuser.w[n].mentionsIn[d.thema]++;\n\n\t\t\t\tmuser.w.a. mentionsInUsers[themaK.a][d.username] = true;\n\t\t\t\tmuser.w[n].mentionsInUsers[themaK.a][d.username] = true;\n\t\t\t\tmuser.w.a .mentionsInUsers[d.thema][d.username] = true;\n\t\t\t\tmuser.w[n].mentionsInUsers[d.thema][d.username] = true;\n\n\t\t\t\tuser.w.a. mentionsOutUsers[themaK.a][mention.username] = true;\n\t\t\t\tuser.w[n].mentionsOutUsers[themaK.a][mention.username] = true;\n\t\t\t\tuser.w.a .mentionsOutUsers[d.thema][mention.username] = true;\n\t\t\t\tuser.w[n].mentionsOutUsers[d.thema][mention.username] = true;\n\t\t\t}\n\n\t\t\tif (d.retweet) {\n\t\t\t\tmuser.w.a .retweetsIn[themaK.a]++;\n\t\t\t\tmuser.w[n].retweetsIn[themaK.a]++;\n\t\t\t\tmuser.w.a .retweetsIn[d.thema]++;\n\t\t\t\tmuser.w[n].retweetsIn[d.thema]++;\n\t\t\t}\n\t\t}\n\n\t\tif (d.mention || d.directAddress) {\n\t\t\tuser.w.a. mentionsOut[themaK.a]++;\n\t\t\tuser.w[n].mentionsOut[themaK.a]++;\n\t\t\tuser.w.a .mentionsOut[d.thema]++;\n\t\t\tuser.w[n].mentionsOut[d.thema]++;\n\n\t\t}\n\n\t\tif (d.retweet) {\n\t\t\tuser.w.a .retweetsOut[themaK.a]++;\n\t\t\tuser.w[n].retweetsOut[themaK.a]++;\n\t\t\tuser.w.a .retweetsOut[d.thema]++;\n\t\t\tuser.w[n].retweetsOut[d.thema]++;\n\t\t}\n\t}\n\n\tfor (var k in badThema) {\n\t\tconsole.log('BAD THEMAS: '+util.inspect(badThema));\n\t\tbreak;\n\t}\n}", "parseComments(redditResponse) {\n const posts = redditResponse.data.children;\n const allComments = [];\n // Parse Posts\n posts.forEach((post) => {\n const data = post.data;\n // TODO: We should recurse and collect replies to this comment.\n const newComment = new _shared_classes__WEBPACK_IMPORTED_MODULE_3__[\"Comment\"](data.id, data.body_html);\n allComments.push(newComment);\n });\n return allComments;\n }", "function get_latest_posts(subreddit_name, received_posts_callback)\n{\n var request = http.request(\n {\n host : 'www.reddit.com',\n path : '/r/' + subreddit_name + '/new.json',\n method : 'GET'\n },\n function (response)\n {\n var page_string = ''; \n response.on('data', chunk => page_string += chunk);\n response.on('end', () => \n {\n try\n { \n received_posts_callback(JSON.parse(page_string));\n }\n catch (e)\n {\n return {};\n }\n });\n }\n );\n\n request.on('error', error => console.error('Getting reddit posts failed:\\n' + error));\n\n request.end();\n}", "function getNewListings(subredditName,count) {\n var fetchUrl = \"https://www.reddit.com/r/\" + subredditName + \"/new.json?limit=\"+count;\n\n fetch(fetchUrl)\n .then(function (response) {\n if (response.ok) {\n response.json().then(function (data) {\n displayListings(data);\n });\n }\n\n else if (response.status === 404) {\n displayError(\"This does not exist\")\n }\n })\n .catch(function (error) {\n displayError(error + \". cannot connect to Reddit\");\n });\n\n}", "function reportStats() {\n\n // Set initial.\n var wordStarted = false;\n\n // Get text from element with id value.\n reportMy.text = document.getElementById(\"sample\").value;\n\n // Through the entire text length, check char. Update stats as appropriately.\n for ( i = 0; i < reportMy.text.length; i++) {\n\n switch ( reportMy.text[i]) {\n\n // If PERIOD, QUESTION, EXCLAMATIONPT, update number of sentences.\n case Punctuation.PERIOD:\n case Punctuation.QUEST:\n case Punctuation.EXC:\n if ( wordStarted === true) {\n reportMy.numOfSents++;\n }\n // break;\n\n // If either or COMMA, update number of words,\n case Punctuation.COMMA:\n if ( wordStarted === true) {\n reportMy.numOfWords++;\n wordStarted = false;\n }\n break;\n\n // If COMMA, update number of spaces.\n case Punctuation.SPACE:\n reportMy.numOfSpaces++;\n if ( wordStarted === true) {\n reportMy.numOfWords++;\n wordStarted = false;\n }\n break;\n\n // Assumes otherwise we are char in a word.\n default: {\n if ( wordStarted === false) {\n wordStarted = true;\n }\n }\n }\n }\n\n // Once text length has been reached, update average words per sentence.\n reportMy.aveWordsPerSent = parseInt(reportMy.numOfWords / reportMy.numOfSents);\n\n // Return reportMy object.\n return reportMy;\n}", "function charFreq(string){\n //...\n}", "function charFreq(string){\n //...\n}", "function getWordLengthFromCollection( string, collection, dateObject ) { // 5711\n // 5712\n // Grab the first word from the string. // 5713\n var word = string.match( /\\w+/ )[ 0 ] // 5714\n // 5715\n // If there's no month index, add it to the date object // 5716\n if ( !dateObject.mm && !dateObject.m ) { // 5717\n dateObject.m = collection.indexOf( word ) + 1 // 5718\n } // 5719\n // 5720\n // Return the length of the word. // 5721\n return word.length // 5722\n } // 5723", "function wordFrequency(txt, n) {\n if (!txt) return [];\n txt = txt.split(\" \");\n let words = {}, length = txt.length;\n for (let i = 0; i < length; i++) {\n const word = txt[i].toLowerCase();\n if (words[word]) {\n words[word] += 1;\n continue;\n };\n words[word] = 1;\n };\n words = Object.entries(words);\n words.sort((a, b) => b[1] - a[1]);\n return words.slice(0, n);\n}", "function tenMil(writer, encode, cb) {\r\n let numOfReviews = 10000000;\r\n let id = 0;\r\n function write() {\r\n let ok = true;\r\n do {\r\n numOfReviews -= 1;\r\n id += 1;\r\n // const gameId = ;\r\n // const date = ;\r\n // const overall = ;\r\n // const title = ;\r\n // const review = ;\r\n // const recommend = ;\r\n // const nickname = ;\r\n // const location = ;\r\n // const email = ;\r\n // const buyForSelf = ;\r\n // const ageBracket = ;\r\n // const gender =;\r\n // const graphics = ;\r\n // const gameplay =;\r\n // const appeal = ;\r\n // const ownershipBracket = ;\r\n // const purchaseOnline = ;\r\n // const readReviews = ;\r\n // const recommendBGS = ;\r\n // const helpful = ;\r\n // const unhelpful = ;\r\n\r\n const data = `${Math.ceil(Math.random() * 100)},${faker.date.recent(90)},${Math.ceil(Math.random() * 5)},${faker.fake('{{company.catchPhraseAdjective}} {{commerce.productAdjective}} {{company.bsNoun}}')},${faker.lorem.paragraph()},${faker.random.boolean()},${faker.internet.userName()},${faker.fake('{{address.city}} {{address.state}}')},${faker.internet.email()},${faker.random.boolean()},${Math.ceil(Math.random() * 8)},${ Math.ceil(Math.random() * 4)},${Math.ceil(Math.random() * 5)},${ Math.ceil(Math.random() * 5)},${Math.ceil(Math.random() * 5)},${Math.ceil(Math.random() * 5)},${faker.random.boolean()},${faker.random.boolean()},${Math.ceil(Math.random() * 10)},${Math.floor(Math.random() * 101)},${Math.floor(Math.random() * 101)},${id}\\n`;\r\n if (numOfReviews === 0) {\r\n writer.write(data, encode, cb);\r\n } else {\r\n ok = writer.write(data, encode);\r\n }\r\n } while (numOfReviews > 0 && ok);\r\n if (numOfReviews > 0) {\r\n writer.once('drain', write);\r\n }\r\n }\r\n write();\r\n}", "function charFreq(string) {\n //...\n}", "function charFreq(string) {\n //...\n}", "function getComments(post_id){\n\tvar commentsURL = fbBaseURL + post_id + \"/comments?summary=true&access_token=\" + fbAccessToken;\n\tvar count = 0;\n\t\t\t\n\t$.ajax({\n\t\ttype : \"get\",\n\t\turl : commentsURL, \n\t\tsuccess : function(response){\n\t\t\tcount = getDataFromElement(response.summary).total_count;\t\n\t\t\t$(\"#comments_\" + post_id).text(count);\n\t\t},\n\t\ttimeout : timeout,\n\t\terror : function(response){\n\t\t\tconsole.log(\"Failed to get comments for post: \" + post_id);\n\t\t}\n\t});\n}", "function authorCount() {\n var counts = {};\n for (var key in comments) {\n properties = comments[key]\n name = properties[\"myName\"]\n if (counts[name] === undefined){\n counts[name] = 1;\n } else {\n counts[name] = counts[name] + 1;\n }\n }\n return counts\n }", "function more_tweets(start_inx=0){\n for (tweet=start_inx; tweet<start_inx+10; tweet++){\n if(tweet == tweets_array.length-1){\n return \n }\n\n if(tweets_array[tweet].includes('[')){\n tweets_array[tweet] = tweets_array[tweet].replace('[', '');\n }\n\n if(tweets_array[tweet].includes(']')){\n tweets_array[tweet] = tweets_array[tweet].replace(']', '');\n }\n\n tweets_array[tweet] = tweets_array[tweet].replace('\"', '');\n tweets_array[tweet] = tweets_array[tweet].replace('\"', '');\n \n var blockquote = document.createElement(\"blockquote\");\n blockquote.setAttribute(\"class\", \"twitter-tweet\");\n var a = document.createElement(\"a\");\n a.setAttribute(\"href\", \"https://twitter.com/x/status/\" + tweets_array[tweet]);\n blockquote.append(a);\n var script = document.createElement(\"script\");\n script.async = true;\n script.setAttribute(\"src\", \"https://platform.twitter.com/widgets.js\");\n script.setAttribute(\"charset\", \"utf-8\");\n feed = document.getElementById('feed')\n feed.appendChild(blockquote);\n feed.appendChild(script);\n }\n\n start_inx = start_inx + 10;\n setTimeout(function(){\n counter = counter + 10;\n if(counter < 40){\n more_tweets(start_inx);\n }\n }, 5000);\n }", "async function runScraper(UN,PW,celebChoice){\r\n let returnedComments = await main_scrape_func(UN,PW,celebChoice)\r\n return returnedComments\r\n }", "_fiterByWordCount() {\n let entitesCopy = [...this.state.entities];\n let filteredArray = [];\n let { pfa, cfa } = this.state;\n if(!pfa && !cfa) {\n filteredArray = entitesCopy;\n } else {\n let secondFilterArray = [];\n entitesCopy.forEach( entrie => {\n let titleLength = entrie.title.split(' ').length;\n if(cfa && titleLength > 5) {\n secondFilterArray.push(entrie);\n } else if(pfa && titleLength <= 5) {\n secondFilterArray.push(entrie);\n }\n });\n filteredArray = this._fiterByPoitsOrComm( cfa, secondFilterArray );\n };\n return filteredArray;\n }", "function findMostFrequentWords(txt) {\n let words = getWords(txt);\n let wordCount = {};\n let result = [];\n let highestCount = 0;\n\n // Convert all words to lowercase\n for (let i = 0; i < words.length; i++) {\n \twords[i] = words[i].toLowerCase();\n }\n\n // Sort words alphabetically\n words.sort();\n\n // Count how often each word appears\n for (let i = 0; i < words.length; i++) {\n \tif (!(words[i] in wordCount)) {\n \t\twordCount[words[i]] = 1;\n \t} else {\n \t\twordCount[words[i]]++;\n \t}\n }\n\n // Find highest word count\n for (let i = 0; i < words.length; i++) {\n \tif (wordCount[words[i]] > highestCount) {\n \t \thighestCount = wordCount[words[i]];\n \t}\n }\n\n // Find 10 most frequent words in order\n while (highestCount > 0 && result.length < 10) {\n \tfor (let i = 0; i < words.length; i++) {\n \t if (wordCount[words[i]] === highestCount && \n \t \tresult.indexOf(words[i] + \"(\" + wordCount[words[i]] + \")\") <= -1) {\n \t\tresult.push(words[i] + \"(\" + wordCount[words[i]] + \")\");\n \t }\n \t}\n \thighestCount--;\n }\n\n // If there are more than 10, remove items until there are only 10\n while (result.length > 10) {\n \tresult.pop();\n }\n\n return result;\n}", "function countWords(text){\n //characters with spaces\n characters.innerText=text.length;\n \n displayMessage(text);\n\n text=text.split(' ');\n let wordCount=0;\n\n for(let i=0;i<text.length;i++){\n if(text[i]!=' ' && isWord(text[i])){\n wordCount++;\n }\n }\n \n words.innerText=wordCount;\n calculateReadingTime(wordCount);\n}", "getAllcomments(slug) {\n return HelperClass.getRequest(`/articles/comments/${slug}`);\n }", "function usuarioStats (comments) {\n return yo`<div class=\"Usuario_main_comments-stats\">\n <div class=\"Usuario_main_comments-stats-comments\">\n <h3 class=\"Usuario_main_comments-stats-comments-counter\">${comments.length}</h3>\n <span class=\"Usuario_main_comments-stats-comments-text\">Comentarios</span>\n </div>\n <div class=\"Usuario_main_comments-stats-thumbsup\">\n <h3 class=\"Usuario_main_comments-stats-thumbsup-counter\">${getLikes(comments)}</h3>\n <span class=\"Usuario_main_comments-stats-thumbsup-text\">Valoraciones</span>\n </div>\n </div>`\n}", "function searchTweets(twit) {\n \n if(!twit) {\n var props = PropertiesService.getScriptProperties();\n twit = new Twitterlib.OAuth(props); \n }\n \n var tweets = twit.fetchTweets(\n SEARCH_QUERY,\n function(tweet) {\n var question = decodeTweet(tweet.text);\n var answer = question.replace(REPLACEMENT_FROM, REPLACEMENT_TO);\n \n if(question !== answer \n && answer.length < 140\n && !tweet.possibly_sensitive\n && (!BAD_REGEX || !BAD_REGEX.test(answer))\n && !isTweetADupe(answer)) {\n addToCache(answer);\n answer = answer.replace(/@/g, \".\"); //remove @-mentions. You should almost never @-mention people with bots. It's annoying and it *will* get your bot banned.\n answer = answer.replace(/#/g, \"\"); //remove hashtags as well to avoid spamming a trending hashtag\n return { id_str: tweet.id_str, text: answer };\n }\n }, \n { \n count: 10, \n since_id: PropertiesService.getScriptProperties().getProperty(\"MAX_TWITTER_ID\"),\n multi: true\n }\n );\n\n if(tweets && tweets.length > 0) {\n Logger.log(\"Tweets with successful replacement:\");\n tweets.forEach(function(t) {\n Logger.log(t.text);\n });\n } else {\n Logger.log(\"There were no tweets with successful replacement.\"); \n }\n \n return tweets;\n}", "function GradeComments (posts) {\n var scores = []\n for (const post of posts) {\n var baseline = post.score * (1 / 5)\n for (const comment of post.comments) {\n comment.body.replace(/[\\t\\n\\\\]+/g, ' ')\n var reasons = []\n var score = 0\n var wordCount = comment.body.split(' ').length\n\n // // Question posts could be marked seperately?\n // if (post.body.includes('?')) {\n // score += 1\n // }\n var scoreDiff = comment.body.score - baseline\n if (scoreDiff > 0) {\n score += scoreDiff\n reasons.push('upvotes')\n }\n if (wordCount > 20) {\n score += LEN_BONUS\n reasons.push('length: ' + wordCount)\n }\n for (const w in WordList) {\n if (comment.body.includes(WordList[w])) {\n score += WORD_BONUS\n reasons.push('word: ' + WordList[w])\n }\n }\n // Questions probably wont be as useful\n if (comment.body.includes('?')) {\n score = score - (WORD_BONUS * 5)\n reasons.push('question')\n }\n comment.computedScore = score\n comment.reasons = reasons\n scores.push(score)\n }\n }\n getStats(scores)\n}", "function wordCount() {\n\n var example = document.getElementById(\"target\").textContent;\n //Splits into array\n tokens = example.split(/\\W+/);\n //Cycles through array and counts words\n for (var i = 0; i < tokens.length; i++) {\n var word = tokens[i];\n // It's a new word!\n if (concordance[word] === undefined) {\n concordance[word] = 1;\n // We've seen this word before!\n } else {\n concordance[word]++;\n }\n }\n return concordance;\n }", "function wordCount() {\n\n var example = document.getElementById(\"target\").textContent;\n //Splits into array\n tokens = example.split(/\\W+/);\n //Cycles through array and counts words\n for (var i = 0; i < tokens.length; i++) {\n var word = tokens[i];\n // It's a new word!\n if (concordance[word] === undefined) {\n concordance[word] = 1;\n // We've seen this word before!\n } else {\n concordance[word]++;\n }\n }\n return concordance;\n }", "function frequencyMap(words) {\n var frequencyMap = {};\n\n function addToFrequencyMap(word) {\n if (frequencyMap[word]) {\n frequencyMap[word] += 1;\n }\n else {\n frequencyMap[word] = 1;\n }\n }\n\n words.forEach(function(w) {\n var i;\n var one, two, three;\n\n if (w.length < 5) {\n return;\n }\n\n for (i = 0; i < w.length; i += 1) {\n var newChar = w.charAt(i);\n\n // TODO: I can generalize this past 3\n if (i > 1) {\n three = two + newChar;\n addToFrequencyMap(three);\n }\n if (i > 0) {\n two = one + newChar;\n addToFrequencyMap(two);\n }\n one = newChar\n addToFrequencyMap(one);\n }\n });\n\n return frequencyMap;\n}", "function cmtxUpdateCommentCounter() {\n if (jQuery('#cmtx_comment').length) {\n var length = jQuery('#cmtx_comment').val().length;\n\n var maximum = jQuery('#cmtx_comment').attr('maxlength');\n\n jQuery('#cmtx_counter').html(maximum - length);\n }\n}", "function countComments($subtree) {\n if (typeof $subtree === 'undefined' || ! $subtree.length)\n return 0;\n\n var commentCount = 0, text;\n var $comments = $subtree.find(_C_COMMENTS_BUTTON_COUNT);\n if ($comments.length) {\n commentCount += parseTextCount($comments.html().replace(/<.*/, ''));\n } else {\n commentCount += countShownComments($subtree);\n $comments = $subtree.find(_C_COMMENTS_OLDER_COUNT);\n if ($comments.length)\n commentCount += parseTextCount($comments.text());\n }\n\n //debug(\"countComments: \" + commentCount);\n return commentCount;\n}", "function getComment() {\n let count = 0;\n let children = Array.from(post.children);\n children.forEach(child=> {\n let arrayedItem2 = Array.from(child.classList)\n if(arrayedItem2.includes('post-comment')) {\n count++;\n }\n });\n children.forEach(child=> {\n let arrayedItem2 = Array.from(child.classList)\n if(arrayedItem2.includes('totalComment')) {\n child.children[0].innerHTML = `${count} comment(s)`;\n }\n });\n // return console.log();\n return count;\n }", "function scraper(pagestogo, things) {\n // cut things off if we've scraped npages\n if (pagestogo === 0) {\n q_2.resolve(things);\n }\n else {\n // construct the url to scrape\n url = 'https://www.reddit.com/r/' + subreddit;\n url += (pagestogo !== npages) ? '/?count=25&after=t3_' + things[things.length - 1].unique : \"\";\n // commence scraping\n x(url, 'div.thing', [{\n link: 'a.comments@href',\n author: '@data-author',\n classes: '@class',\n flair: 'span.flair@class',\n score: 'div.score.unvoted'\n }])(function (err, data) {\n if (err)\n console.log(err);\n // data cleanup\n data.forEach(function (item) {\n // get the unique post name from the classes string\n item.unique = item.classes.match(/t3_([a-z0-9]+) /)[1];\n // convert item.flair to a boolean (does this flair match any goodFlair?)\n item.flair = item.flair || '';\n item.flair = item.flair.split(' ');\n item.flair = item.flair.some(function (good) {\n return goodFlair.indexOf(good) != -1;\n });\n // get rid of those stupid bullet points\n item.score = parseInt(item.score, 10) || 0;\n // identify sticky posts\n item.stickied = item.classes.indexOf('stickied') !== -1;\n });\n // add to our accumulation, one less page to go\n scraper(pagestogo - 1, things.concat(data));\n });\n }\n return q_2.promise;\n }", "countBigWords(input) {\n // code goes here\n //break string into separate words\n let words = input.split(\" \");\n //create a count\n let counter = 0;\n //iterate through each word in the string\n for (let i = 0; i < words.length; i++) {\n //check if each word's length is greater that 6\n //if it is increase the counter by 1\n if (words[i].length > 6) {\n counter++;\n }\n }\n\n //return the counter\n\n return counter;\n }", "function preprocessLyrics (lyrics) {\n var wordCountMap = {}\n\n for (var song of lyrics) {\n var songLyric = song['lyrics']\n var language = song['language']['language']\n // musixmatch remove free version tags in lyrics\n // songLyric = songLyric.split('...')[0]\n\n // remove line breaks\n songLyric = songLyric.replace(/(\\r\\n|\\n|\\r)/gm, ' ')\n\n // song_lyric = song_lyric.replace(/\\s+/g,' ')\n songLyric = songLyric.replace('?', '')\n songLyric = songLyric.replace('`', ' ')\n\n // lower case\n songLyric = songLyric.toString().toLowerCase()\n\n // stem (combine stems of the words likes/like = like)\n\n // tokenize (split into single words)\n songLyric = songLyric.split(' ')\n\n // remove stopwords in the respective language\n songLyric = sw.removeStopwords(songLyric, selectStopwordLanguage(language))\n\n for (var word of songLyric) {\n if (word in wordCountMap) {\n wordCountMap[word].count += 1\n } else {\n wordCountMap[word] = {'count': 1}\n }\n }\n }\n return wordCountMap;\n}", "function loadAndProcessTweets(/*days*/) {\n //https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets\n //https://codeburst.io/build-a-simple-twitter-bot-with-node-js-in-just-38-lines-of-code-ed92db9eb078\n \n var T = new Twitter(config);\n var params = {\n q: '#Nike', //q is the only required parameter, and is looking for tweets with Nike\n count: 1, //only want X number of results\n result_type: 'recent', //only most recent results\n lang: 'en' //only English results\n }\n return;\n T.get('search/tweets', params, function(err, data, response){\n if(!err){\n for(let i = 0; i < data.statuses.length; i++){\n // Get the tweet Id from the returned data\n let id = { id: data.statuses[i].id_str }\n //console.log(data.statuses[i]);\n var text = data.statuses[i].text;\n var timestamp = data.statuses[i].created_at;\n var adjusted_timestamp = moment(timestamp, 'ddd MMM DD HH:mm:ss +ZZ YYYY').format('YYYY-MM-DD h:mm:ss');\n // console.log(adjusted_timestamp);\n var sentiment = getSentiment(data.statuses[i]); //this might change as getSentiment changes\n // storeTweets(text, adjusted_timestamp, sentiment, positive, negative, neutral, mixed);\n }\n } else {\n console.log(err);\n }\n })\n}", "function fetchPosts(subreddit) { \n // Thunk middleware knows how to handle functions.\n // It passes the dispatch method as an argument to the function,\n // thus making it able to dispatch actions itself.\n\n return function (dispatch) { \n // First dispatch: the app state is updated to inform\n // that the API call is starting.\n dispatch(requestPosts(subreddit));\n\n // The function called by the thunk middleware can return a value,\n // that is passed on as the return value of the dispatch method.\n\n // In this case, we return a promise to wait for.\n // This is not required by thunk middleware, but it is convenient for us.\n return fetch(`http://www.reddit.com/r/${subreddit}.json`)\n .then(response => response.json())\n .then(json => {\n // We can dispatch many times!\n // Here, we update the app state with the results of the API call.\n console.log('***Get Api Data Success-Action***');\n console.log(json);\n dispatch(receivePosts(subreddit, json));\n }).catch(error =>{\n console.log('***Get Api Data Error***');\n console.log(error);\n });\n\n // In a real world app, you also want to\n // catch any error in the network call.\n }\n}", "function countSubmissions(){\n\n\t\t$.ajax({\n\t\ttype: \"GET\",\n\t\turl: baseUrl + '/topics',\n\t\tsuccess: function(data){\n\t\t\tdisplaySubmissionscount(data.length)\n\t\t},\n\t\terror: function(data){\n\t\t\tconsole.log('Did not count submissions')\n\t\t}\n\t});\t\n}", "function wordFreq(string) {\n var words = string.replace(/[.]/g, '').split(/\\s/);\n var freqMap = {};\n words.forEach(function(w) {\n if (!freqMap[w]) {\n freqMap[w] = 0;\n }\n freqMap[w] += 1;\n });\n\n return freqMap;\n}", "async getTweets(query) {\n var client = new Twitter({\n consumer_key: this.consumerApiKey,\n consumer_secret: this.consumerSecret,\n access_token_key: this.accessToken,\n access_token_secret: this.accessSecret\n });\n\n const count = {\n new: 0,\n repeat: 0\n };\n\n const self = this;\n\n client.get('search/tweets', {\n q: query,\n result_type: 'mixed',\n count: 100,\n lang: 'pt',\n tweet_mode: 'extended'\n }, async function (error, tweets, response) {\n if (tweets && tweets.statuses) {\n for (let i = 0; i < tweets.statuses.length; i++) {\n const item = tweets.statuses[i];\n\n const tweet = {};\n tweet['status'] = 'raw';\n tweet['query'] = query;\n tweet['id'] = item['id_str'];\n tweet['created_at'] = item['created_at'];\n tweet['text'] = item['full_text'];\n tweet['entities'] = item['entities'];\n tweet['language'] = item['lang'];\n tweet['user_id'] = item['user']['id_str'];\n tweet['followers_count'] = item['user']['followers_count'];\n tweet['friends_count'] = item['user']['friends_count'];\n tweet['place'] = item['place'];\n tweet['verified'] = item['user']['verified'];\n tweet['retweet_count'] = item['retweet_count'];\n tweet['favorite_count'] = item['favorite_count'];\n\n const exists = await self.tweets.countDocuments({ id: tweet.id });\n\n if (exists) {\n count.repeat += 1;\n } else {\n count.new += 1;\n await self.tweets.create(tweet);\n }\n }\n } else {\n self.logger.warn('[Twitter] No tweets found', tweets);\n }\n count.query = query;\n\n self.logger.info('[Twitter]', count);\n\n if (error) {\n self.logger.error(error);\n }\n });\n }", "function getWordLengthFromCollection(string, collection, dateObject) {\r\n\r\n // Grab the first word from the string.\r\n var word = string.match(/\\w+/)[0];\r\n\r\n // If there's no month index, add it to the date object\r\n if (!dateObject.mm && !dateObject.m) {\r\n dateObject.m = collection.indexOf(word) + 1;\r\n }\r\n\r\n // Return the length of the word.\r\n return word.length;\r\n }", "function updateTweetSample() {\n var getParams = {\n q: 'movie since:2011-11-11',\n count: 1\n }\n function gotData(err, data, response) {\n var MongoClient = mongodb.MongoClient;\n var mongoDB_URL = config.mongodb.url;\n var tweets = data.statuses;\n\n MongoClient.connect(mongoDB_URL,function(err, db){\n if(err){\n console.log(\"Unable to connect, error: \", err);\n res.send(err);\n\n } else {\n var collection = db.collection('movies');\n collection.update({}, data, {upsert:true});\n db.close();\n }\n });\n };\n T.get('search/tweets', getParams, gotData);\n}", "function groupBy(group_by, words, limit, multiple) {\n\n // Find out what groupings are involved using these parts of speech\n var groupings = {};\n words.forEach(function(currVal, currIndex, listObj) {\n // Get the word itself\n var word = currVal.innerHTML.trim();\n\n // Get the grouping described in the metadata for this word\n var texthead = currVal.parentNode.previousElementSibling; \n var meta_grouping = texthead.querySelector(\"[metaclass=\\\"\"+groupings_metaclass[group_by]+\"\\\"]\");\n var grouping = \"\";\n if (meta_grouping != null) grouping = meta_grouping.innerHTML.split(\":\")[1].trim();\n\n // If there are multiple parts to this grouping criterion, separated by commas,\n // split them up and iterate over them\n if (multiple) {\n parts = grouping.split(\",\");\n for (var i = 0; i < parts.length; i++) {\n groupings = countFreqForWord(word, groupings, parts[i]);\n }\n } else {\n groupings = countFreqForWord(word, groupings, grouping);\n }\n\n });\n\n // Sort descending by the groupings with the most words\n var groupingsSorted = Object.keys(groupings).sort(function(a, b) {return -(groupings[a].sit_count - groupings[b].sit_count);});\n \n var group_html = \"\";\n for (var i = 0; i < groupingsSorted.length; i++) { \n var grouping = groupingsSorted[i];\n group_html += \"<h3>\"+grouping+\" (\"+groupings[grouping].sit_count+\" matches)\"+\"</h3><br>\" \n var freq_list_i = buildFreqList(groupings[grouping].freq_dict,\n groupings[grouping].sit_count,\n limit);\n group_html += freq_list_i;\n group_html += \"<br>\"; \n };\n\n return group_html;\n}", "function announcements_getCommentsFromDocument() {\n\n var document_id = config.files.announcements.twoWeeks;\n var comments_list = Drive.Comments.list(document_id);\n var comments = \"\";\n var lastTimeScriptRun = getLastTimeScriptRun();\n \n for (var i = 0; i < comments_list.items.length; i++) {\n \n var nextComment = comments_list.items[i] \n var modifiedDate = new Date(nextComment.modifiedDate)\n \n if (nextComment.content.indexOf(config.announcements.scriptLastRunText) === -1 &&\n nextComment.status == \"open\" && \n !nextComment.deleted && \n modifiedDate > lastTimeScriptRun) {\n \n comments += \" \" + (nextComment.content)\n }\n }\n \n if (comments === '') {\n log('No emails to be sent - no comments')\n }\n \n return comments;\n \n // Private Functions\n // -----------------\n \n function getLastTimeScriptRun() {\n \n var datetime = new Date(0); // 1970 - not run yet\n var comments = Drive.Comments.list(document_id);\n \n if (comments.items && comments.items.length > 0) {\n \n for (var i = 0; i < comments.items.length; i++) {\n \n var content = comments.items[i].content;\n \n if (content.indexOf(config.announcements.scriptLastRunText) !== -1) { \n datetime = new Date(content.slice(config.announcements.scriptLastRunTextLength));\n }\n }\n } \n \n return datetime\n \n } // getLastTimeScriptRun()\n \n}" ]
[ "0.5637976", "0.5623303", "0.5490218", "0.5443297", "0.5422858", "0.5367084", "0.5342306", "0.5306612", "0.52853423", "0.5262503", "0.5219673", "0.51815236", "0.5155438", "0.5144042", "0.51004237", "0.50947946", "0.50794876", "0.50735694", "0.5048024", "0.5044307", "0.5043653", "0.50406754", "0.50275064", "0.50172424", "0.50019395", "0.49828836", "0.49817684", "0.49742627", "0.495544", "0.49469858", "0.49415556", "0.4941421", "0.4932214", "0.4921072", "0.49158716", "0.49100637", "0.49033245", "0.48875707", "0.48804933", "0.4874489", "0.48487088", "0.48452368", "0.48379007", "0.48329976", "0.48321947", "0.48269102", "0.48194894", "0.48067456", "0.4804356", "0.4776805", "0.47699806", "0.4767327", "0.4766759", "0.4757515", "0.47571772", "0.47561377", "0.47546384", "0.47533384", "0.47533256", "0.4750041", "0.47418168", "0.47412294", "0.4729595", "0.47266096", "0.47055703", "0.47055703", "0.47024268", "0.47002465", "0.46984255", "0.4698362", "0.4698362", "0.46964613", "0.4692453", "0.46875036", "0.46859792", "0.46803644", "0.46776628", "0.46742186", "0.46683654", "0.46681732", "0.4666229", "0.46657607", "0.46624357", "0.46624357", "0.46498278", "0.4647847", "0.46431994", "0.46394596", "0.4629147", "0.46289176", "0.46274215", "0.46222222", "0.4615537", "0.46138883", "0.4613864", "0.46030742", "0.4602253", "0.4600034", "0.45999497", "0.4599561" ]
0.55298334
2
sort stocks by price
render() { let portfolioStocks = this.state.portfolio.map(id => this.state.stocks.find(stock => stock.id === id)) let displayStocks = this.sortStocks() return ( <div> <SearchBar sorted={this.state.sorted} changeSort={this.changeSort} changeFilter={this.changeFilter}/> <div className="row"> <div className="col-8"> <StockContainer stocks={displayStocks} addToPortfolio={this.addToPortfolio}/> </div> <div className="col-4"> <PortfolioContainer stocks={portfolioStocks} removeStock={this.removeStock}/> </div> </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sortQuotes(){\n /**\n * sort all the prices from cheaper to expensive\n */\n quotes.sort(function(a, b) {\n return unformatNumber(a.price) - unformatNumber(b.price);\n });\n}", "static byPrice() {\n // how to sort in descending order\n // var points = [40, 100, 1, 5, 25, 10];\n // points.sort(function(a, b){return b-a});\n return store.meals.sort(function(a, b) {return b.price - a.price});\n }", "function comparePrice(a,b){\r\n return a.price - b.price; console.log(hats.sort(comparePrice));\r\n }", "function itemByPrice(){\n var init = [];\n for(var i=0; i<cart.length; i++){\n for(var j=i; j<cart.length-1; j++){\n if(cart[j].price<cart[j+1].price){\n init=cart[j];\n cart[j]=cart[j+1];\n cart[j+1]=init;\n }\n }\n }\n cart.sort(function(a, b){\n return (b.price)-(a.price);\n });\n return cart;\n}", "function sortByPriceAsc(a,b)\n{\n console.log(a.price - b.price);\n return a.price - b.price\n}", "static byPrice(){\n return store.meals.sort((a, b) => b.price - a.price)\n }", "sortByPriceAsc() {\n const sortAsc = [...this.state.data]\n const sorted = sortAsc.sort((a, b) => (\n parseFloat(b.price_usd) - parseFloat(a.price_usd)\n ));\n\n this.setState({\n data: sorted,\n query: ''\n });\n }", "static byPrice(){\n return store.meals.sort(function(a,b){\n return b.price-a.price\n });\n }", "function sortByPriceDesc(a,b)\n{\n return b.price - a.price\n}", "priceBasedSort(a, b) {\n if (this.state.sortOrder === \"Descending\") {\n return (\n b.price - a.price\n );\n } else {\n return (\n a.price - b.price\n );\n }\n }", "function sortFruitMarketTableByFruitNameAndPrice() {\n\n}", "sortByPriceDesc() {\n const sortDesc = [...this.state.data]\n const sorted = sortDesc.sort((a, b) => (\n parseFloat(a.price_usd) - parseFloat(b.price_usd)\n ));\n this.setState({\n data: sorted,\n query: ''\n });\n }", "function ascendProducts(data){\n //returns a sorted array based on comparing elements a and b \n data.sort(function(a, b) {\n return a.price - b.price;\n });\n show(data);\n}", "static byPrice() {\n return store.meals.sort((meal1, meal2) => {\n return meal1.price < meal2.price;\n });\n }", "function sortProductList() {\n var stock_status = \"0\";\n var order = $(\"#select-choice-1\").val();\n var results = JSON.parse(localStorage[config.data[0].storage_key+\"_last_products_list\"]);\n var sorted_product_list = '';\n var temp;\n if (order == \"PriceL2H\") {\n for (var i = 0; i < results.length; i++) {\n for (var j = 0; j < results.length - i; j++) {\n try {\n if (parseFloat(results[j][\"price\"].replace(/\\,/g, '')) > parseFloat(results[j + 1][\"price\"].replace(/\\,/g, ''))) {\n temp = results[j];\n results[j] = results[j + 1];\n results[j + 1] = temp;\n }\n } catch (ex) {}\n }\n }\n } else if (order == \"PriceH2L\") {\n for (var i = 0; i < results.length; i++) {\n for (var j = 0; j < results.length - i; j++) {\n try {\n if (parseFloat(results[j][\"price\"].replace(/\\,/g, '')) < parseFloat(results[j + 1][\"price\"].replace(/\\,/g, ''))) {\n temp = results[j];\n results[j] = results[j + 1];\n results[j + 1] = temp;\n }\n } catch (ex) {}\n }\n }\n } else if (order == \"NameA2Z\") {\n for (var i = 0; i < results.length; i++) {\n for (var j = 0; j < results.length - i; j++) {\n try {\n if (results[j][\"name\"] > results[j + 1][\"name\"]) {\n temp = results[j];\n results[j] = results[j + 1];\n results[j + 1] = temp;\n }\n } catch (ex) {}\n }\n }\n } else if (order == \"NameZ2A\") {\n for (var i = 0; i < results.length; i++) {\n for (var j = 0; j < results.length - i; j++) {\n try {\n if (results[j][\"name\"] < results[j + 1][\"name\"]) {\n temp = results[j];\n results[j] = results[j + 1];\n results[j + 1] = temp;\n }\n } catch (ex) {}\n }\n }\n } else if (order == \"Date\") {\n for (var i = 0; i < results.length; i++) {\n for (var j = 0; j < results.length - i; j++) {\n try {\n if (parseInt(results[j][\"id\"]) < parseInt(results[j + 1][\"id\"])) {\n temp = results[j];\n results[j] = results[j + 1];\n results[j + 1] = temp;\n }\n } catch (ex) {}\n }\n }\n } else {\n for (var i = 0; i < results.length; i++) {\n for (var j = 0; j < results.length - i; j++) {\n try {\n if (results[j][\"id\"] > results[j + 1][\"id\"]) {\n temp = results[j];\n results[j] = results[j + 1];\n results[j + 1] = temp;\n }\n } catch (ex) {}\n }\n }\n }\n var i = 0;\n while (i < results.length) {\n var productName = results[i][\"name\"];\n var pid = results[i][\"id\"];\n var price = results[i][\"price\"];\n price = CurrencyFormatted(price);\n price = addThousandsSeparator(price);\n var imageURL = results[i][\"imageurl\"];\n var SKU = results[i][\"sku\"];\n var sprice = results[i][\"spclprice\"];\n var dirPath = dirname(location.href);\n var is_stock = '';\n if (parseInt(results[i][\"is_in_stock\"]) > 0 && results[i][\"stock_quantity\"] > 0) {\n is_stock = locale.message.text[\"in_stock\"];\n stock_status = \"1\";\n } else {\n is_stock = locale.message.text[\"out_of_stock\"];\n stock_status = \"0\";\n }\n var fullPath = \"'\" + dirPath + \"/product_details.html?id=\" + pid + \"stock_status\" + stock_status + \"'\";\n /* if (config.data[0].default_currency == \"INR\") {\n if(stock_status == \"1\"){\n sorted_product_list += '<div class=\"product_outer_div\"><div class=\"product_inner_div\"><div class=\"product_img_container\"><img src=\"'+imageURL+'\" class=\"product_main_img\" onerror=\"bad_image(this);\"/></div><div class=\"product_name_div\">'+productName+'</div> <div class=\"product_name_div\"><img class=\"productPrize\" src=\"images/rupee_symbol.png\" width=\"10px\" height=\"12px\"> '+price+'</div><div style=\"width:100%\"><div class=\"detail_div\" id=\"details\"><input type=\"button\" data-theme=\"c\" value=\"Details\" onclick=\"parent.location=' + fullPath + '\" /></div><div class=\"cart_div\" id=\"cart\"><input type=\"button\" data-theme=\"b\" value=\"'+locale.message.button[\"add_to_cart\"]+'\" onclick=\"addDirectToCart('+pid+','+stock_status+')\" /> </div></div></div></div>';\n }\n else{\n sorted_product_list += '<div class=\"product_outer_div\"><div class=\"product_inner_div\"><div class=\"product_img_container\"><img src=\"'+imageURL+'\" class=\"product_main_img\" onerror=\"bad_image(this);\"/></div><div class=\"product_name_div\">'+productName+'</div> <div class=\"product_name_div\"><img class=\"productPrize\" src=\"images/rupee_symbol.png\" width=\"10px\" height=\"12px\"> '+price+'</div><div style=\"width:100%\"><div class=\"detail_div\" id=\"details\"><input type=\"button\" data-theme=\"c\" value=\"Details\" onclick=\"parent.location=' + fullPath + '\" /></div><div class=\"cart_div\" id=\"cart\"><input type=\"button\" data-theme=\"b\" value=\"'+locale.message.button[\"add_to_cart\"]+'\" onclick=\"addDirectToCart('+pid+','+stock_status+')\" /> </div></div></div></div>';\n }\n }\n else {*/\n if (stock_status == \"1\") {\n sorted_product_list += '<div class=\"product_outer_div\"><div class=\"product_inner_div\"><div class=\"product_img_container\"><img src=\"' + imageURL + '\" class=\"product_main_img\" onerror=\"bad_image(this);\"/></div><div class=\"product_name_div\">' + productName + '</div><div class=\"product_name_div\">' + app_curr_symbol + price + '</div><div style=\"width:100%\"><div class=\"detail_div\" id=\"details\"><input type=\"button\" data-theme=\"c\" value=\"Details\" onclick=\"parent.location=' + fullPath + '\" /></div><div class=\"cart_div\" id=\"cart\"><input type=\"button\" data-theme=\"b\" value=\"' + locale.message.button[\"add_to_cart\"] + '\" onclick=\"addDirectToCart(' + pid + ',' + stock_status + ')\" /></div></div></div></div>';\n } else {\n sorted_product_list += '<div class=\"product_outer_div\"><div class=\"product_inner_div\"><div class=\"product_img_container\"><img src=\"' + imageURL + '\" class=\"product_main_img\" onerror=\"bad_image(this);\"/></div><div class=\"product_name_div\">' + productName + '</div><div class=\"product_name_div\">' + app_curr_symbol + price + '</div><div style=\"width:100%\"><div class=\"detail_div\" id=\"details\"><input type=\"button\" data-theme=\"c\" value=\"Details\" onclick=\"parent.location=' + fullPath + '\" /></div><div class=\"cart_div\" id=\"cart\"><input type=\"button\" data-theme=\"b\" value=\"' + locale.message.button[\"add_to_cart\"] + '\" onclick=\"addDirectToCart(' + pid + ',' + stock_status + ')\" /></div></div></div></div>';\n }\n // }\n i++;\n }\n $(\"#category\").html(sorted_product_list);\n $(\"#category\").trigger(\"create\");\n}", "function sortClose(data) {\r\n const sortedClose = data.sort((a, b) => {\r\n if (sortBool)\r\n return a.close < b.close ? -1 : 1;\r\n else\r\n return a.close > b.close ? -1 : 1;\r\n });\r\n swapBool();\r\n createStockTable(sortedClose);\r\n }", "sortByPrice() {\r\n get('#app > div > div.MrQ4g > div > div._3pSVv._19-Sz.F0sHG._1eAL0 > div > div > div._1V_Pj > div.izVGc').contains('Sort by').click();\r\n get('[id^=price_asc]').click({ multiple: true, force: true });\r\n }", "function sort_by_price_asc (a, b) { // as a user I want to see cheapest holidays\n return (a.paxPrice < b.paxPrice)\n ? 1 : ((b.paxPrice < a.paxPrice) ? -1 : 0);\n}", "static byPrice () {\n console.log(store.meals)\n console.log(store.meals.sort(compare))\n return store.meals.sort(compare)\n }", "function sortByPriceUp(array){\n renderItem(array.sort(function(a,b){\n return parseInt(a.price.replace(/\\D/g,\"\")) - parseInt(b.price.replace(/\\D/g,\"\"));\n }));\n}", "sortByPrice() {\n // Define variable\n const sortedEvents = Object.assign([], this.state.events);\n\n // Sort based on the state of the application\n if (this.state.currentSort === \"price\") {\n // If already sorted ascending, reverse to show descending\n sortedEvents.reverse();\n\n // Set the state\n this.setState({\n events: sortedEvents,\n isAscending: !this.state.isAscending,\n });\n } else {\n // Sort articles based off price\n sortedEvents.sort((a, b) => {\n return a.price.length - b.price.length;\n });\n\n // Set the state\n this.setState({\n events: sortedEvents,\n isAscending: false,\n currentSort: \"price\",\n });\n }\n }", "function descendProducts(data){\n data.sort((a, b) => (b.price) - (a.price));\n show(data);\n}", "function priceSortLowTop(array){\n\tarray.sort(function(a, b){\n\t\tvar price1= a.price, price2= b.price;\n\t\tif(price1== price2) return 0;\n\t\treturn price1> price2? 1: -1;\n\t\t});\n\t\t\n\t\t\n}", "function sortLessMoney() {\r\n data.sort((a, b) => a.money - b.money);\r\n updateDOM();\r\n}", "function sortVolume(data) {\r\n const sortedVolume = data.sort((a, b) => {\r\n if (sortBool)\r\n return a.volume < b.volume ? -1 : 1;\r\n else\r\n return a.volume > b.volume ? -1 : 1;\r\n });\r\n swapBool();\r\n createStockTable(sortedVolume);\r\n }", "function priceSortHighTop(array){\n\tarray.sort(function(a, b){\n\t\tvar price1= a.price, price2= b.price;\n\t\tif(price1== price2) return 0;\n\t\treturn price1> price2? 1: -1;\n\t\t});\n\tarray.reverse();\n\t\t\n}", "function sortdisheslowtohigh(o) {\r\n\tvar swapped=true;\r\n\twhile (swapped==true){\r\n\t\tswapped=false;\r\n\t\tfor (var i= 0; i<o.length-1; i++){\r\n\t\t\tif (o[i].price>o[i+1].price){\r\n\t\t\t\tvar temp = o[i];\r\n\t\t\t\to[i]=o[i+1];\r\n\t\t\t\to[i+1]=temp;\r\n\t\t\t\tswapped=true;\r\n\t\t\t}\r\n\t\t\r\n\t\t}\r\n\t}\r\n // alert(\"You have to sort the dishes by price!\");\r\n return o;\r\n}", "function sortOpen(data) {\r\n const sortedOpen = data.sort((a, b) => {\r\n if (sortBool)\r\n return a.open < b.open ? -1 : 1;\r\n else\r\n return a.open > b.open ? -1 : 1;\r\n });\r\n swapBool();\r\n createStockTable(sortedOpen);\r\n }", "function price_asc(a,b){\nif (a.price<b.price){\n return -1;}\nif (a.price>b.price){\n return 1;}\nreturn 0\n}", "function sortByRichestAsc() {\n data.sort((a, b) => a.money - b.money);\n updateDOM();\n}", "sortProducts() {}", "function sortdisheshightolow(o) {\r\n\tvar swapped=true;\r\n\twhile (swapped==true){\r\n\t\tswapped=false;\r\n\t\tfor (var i= 0; i<o.length-1; i++){\r\n\t\t\tif (o[i].price<o[i+1].price){\r\n\t\t\t\tvar temp = o[i];\r\n\t\t\t\to[i]=o[i+1];\r\n\t\t\t\to[i+1]=temp;\r\n\t\t\t\tswapped=true;\r\n\t\t\t}\r\n\t\t\r\n\t\t}\r\n\t}\r\n\r\n return o;\r\n}", "function sortSongs (songs) {\n\n\t\treturn songs.sort(function compare (a, b) {\n\n\t\t\tif (a.number > b.number) {\n\t\t\t\treturn 1;\n\t\t\t} else if (a.number < b.number) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\treturn 0;\n\n\t\t});\n\n\t}", "function sortArray(){\n\n /*Uses the built in sort -method that can accept a function that specifies\n how the array should be sorted. In this case we want the array to be sorted\n based on the object's price. Lower priced cars go first.*/\n function compare(a,b) {\n if (a.price < b.price) return -1;\n if (a.price > b.price) return 1;\n return 0;\n }\n listOfCars.sort(compare);\n console.table(listOfCars);\n\n }", "function sortRichest() {\r\n data.sort((a, b) => b.money - a.money);\r\n updateDOM();\r\n}", "function compare(a,b) {\n if (a.price < b.price) return -1;\n if (a.price > b.price) return 1;\n return 0;\n }", "function sortByRichest() {\n console.log(data);\n data.sort((a, b) => b.money - a.money);\n updateDOM();\n}", "function sortLow(data) {\r\n const sortedLow = data.sort((a, b) => {\r\n if (sortBool)\r\n return a.low < b.low ? -1 : 1;\r\n else\r\n return a.low > b.low ? -1 : 1;\r\n });\r\n swapBool();\r\n createStockTable(sortedLow);\r\n }", "function sortByRichest() {\n data.sort((a, b) => b.money - a.money);\n updateDOM();\n}", "function sortProducts() {\n // OrderBy ascending [reorder]\n tempNearReorder.remove(function (item) { return item.closeReorder() === 0; });\n tempNearReorder.sort(function (left, right) {\n return left.closeReorder() === right.closeReorder() ? 0 : (left.closeReorder() < right.closeReorder() ? -1 : 1);\n });\n\n // Get not selling products\n var tempMovingHiQuantity = tempTurnOverRate.remove(function (product) {\n return product.turnOverRate() === 0;\n });\n\n // OrderBy Desc [slow moving]\n tempMovingHiQuantity.sort(function (left, right) {\n return left.quantity() === right.quantity() ? 0 : (left.quantity() > right.quantity() ? -1 : 1);\n });\n\n // OrderBy Desc [Turnover rate]\n tempTurnOverRate.sort(function (left, right) {\n return left.turnOverRate() === right.turnOverRate() ? 0 : (left.turnOverRate() > right.turnOverRate() ? -1 : 1);\n });\n\n nearReorder(tempNearReorder.splice(0, 3)); // Take closest 3 [reorder]\n slowMovingHiQuantity(tempMovingHiQuantity.splice(0, 3)); // Take worst 3 [slow moving]\n highTurnOver(tempTurnOverRate.splice(0, 3)); // Take highest 3 [Turnover rate]\n tempTurnOverRate.reverse(); // Reverse order\n lowTurnOver(tempTurnOverRate.splice(0, 3)); // Take lowest 3 [Turnover rate]\n\n // Sort slow moving sales items for desc\n ko.utils.arrayFilter(slowMovingHiQuantity(), function (product) {\n return product.salesItems.sort(function (left, right) {\n return left.saleID() === right.saleID() ? 0 : (left.saleID() > right.saleID() ? -1 : 1);\n });\n });\n\n return true;\n }", "function sortHigh(data) {\r\n const sortedHigh = data.sort((a, b) => {\r\n if (sortBool)\r\n return a.high < b.high ? -1 : 1;\r\n else\r\n return a.high > b.high ? -1 : 1;\r\n });\r\n swapBool();\r\n createStockTable(sortedHigh);\r\n }", "function compare(a,b) {\n if (a.price < b.price)\n return -1;\n if (a.price > b.price)\n return 1;\n return 0;\n}", "function handleSortButton() {\n let list = document.getElementById('stocksDiv')\n let items = document.querySelectorAll('#stocksDiv li')\n let checkButton = $(this).attr('data-sort')\n let sorted = [...items].sort(function (a, b) {\n if (checkButton === \"sortDown\") {\n return b.getAttribute('rating') - a.getAttribute('rating');\n }\n return a.getAttribute('rating') - b.getAttribute('rating');\n })\n list.innerHTML = ''\n for (let li of sorted) {\n list.appendChild(li)\n }\n}", "function sortPrice () {\n ispisArtikla.innerHTML = '';\n article.sort(compare);\n for (var i=0; i<article.length; i++) {\n if (article[i].stanje == true) {\n for (j=0; j<articleCategory.length; j++) {\n for (var k=0; k<articleCategory[j].podCategory.length; k++) {\n if (article[i].type == articleCategory[j].podCategory[k].id) {\n writeElement(i,j,k);\n }\n }\n }\n }\n }\n}", "function pr_asc(){\n console.log('Sort by Price Asc');\n myLibrary.sortByPriceAsc();\n}", "function compareByPrice(prod1, prod2)\n{\n return prod1.price - prod2.price;\n}", "function sortingChanged(event) {\r\n var input = event.target\r\n\r\n var produs = document.getElementsByClassName('product')\r\n var shoppingSection = produs.parentElement\r\n\r\n var array = []\r\n\r\n var children = shoppingSection.children;\r\n for (var i = 0; i < children.length; i++) {\r\n array.push(children[i])\r\n \r\n }\r\n\r\n while (shoppingSection.hasChildNodes()) {\r\n shoppingSection.removeChild(shoppingSection.firstChild)\r\n }\r\n\r\n if (input.value == \"default\") {\r\n for (var j = 0; j < array.length; j++)\r\n shoppingSection.appendChild(array[j])\r\n }\r\n\r\n if (input.value == \"orderByPriceAsc\") {\r\n\r\n var clonedArray = JSON.parse(JSON.stringify(array))\r\n\r\n clonedArray.sort(function (a, b) {\r\n var price1 = a.getElementsByClassName('shop-item-price')\r\n var price2 = b.getElementsByClassName('shop-item-price')\r\n return parseFloat(price1.innerText.replace('$', '')) - parseFloat(price2.innerText.replace('$', ''));\r\n });\r\n\r\n for (var j = 0; j < array.length; j++)\r\n shoppingSection.appendChild(clonedArray[j])\r\n }\r\n\r\n if (input.value == \"orderByPriceDesc\") {\r\n\r\n var clonedArray = JSON.parse(JSON.stringify(array))\r\n\r\n clonedArray.sort(function (a, b) {\r\n var price1 = a.getElementsByClassName('shop-item-price')\r\n var price2 = b.getElementsByClassName('shop-item-price')\r\n return parseFloat(price2.innerText.replace('$', '')) - parseFloat(price1.innerText.replace('$', ''));\r\n });\r\n\r\n for (var j = 0; j < array.length; j++)\r\n shoppingSection.appendChild(clonedArray[j])\r\n }\r\n\r\n \r\n}", "function sortSongsByScores(song1, song2){\n\treturn song2.getScore() - song1.getScore();\n}", "function sortHighest(){\n //Added compare function in the parameter of the sort method because we are working with numbers\n data = data.sort(function(a, b){\n return b.money - a.money\n //descending order. Will show the richest first\n })\n updateDOM()\n}", "function sortByRichestDesc() {\n data.sort((a, b) => b.money - a.money);\n updateDOM();\n}", "function sortCompare(a, b) {\n return (a.volume - b.volume) * -1;\n }", "sort () {\r\n this._data.sort((a, b) => a.sortOrder !== b.sortOrder ? b.sortOrder - a.sortOrder : a.value.localeCompare(b.value))\r\n }", "function priceSorter(a, b, rowA, rowB) {\n\tif(a > b)\n\t\treturn 1;\n\tif(a < b)\n\t\treturn -1;\n\n\treturn 0;\n}", "sortData(monthData, lowPriceFilter = true) {\n let sortData = [];\n let max = monthData[0];\n monthData.forEach(e => {\n max = parseInt(e.date.split('/')[2]) > parseInt(max.date.split('/')[2]) ? e : max\n });\n for(var i =0; i < monthData.length; i++) {\n let first = max;\n monthData.filter(e => !sortData.includes(e)).forEach(e => {first = parseInt(first.date.split('/')[2]) < parseInt(e.date.split('/')[2]) ? first : e;})\n sortData.push(first)\n }\n return(lowPriceFilter ? this.filterData(sortData) : sortData)\n }", "async sortGtPrice(req, res) {\r\n try { \r\n const products = await Product.find().sort({price: -1});\r\n res.send({message: 'Successful search', products});\r\n } catch (error) {\r\n console.error(500) \r\n res.send({message:'There was a problem trying to get products'});\r\n }\r\n }", "function filterList(index, stocks) {\r\n switch (index) {\r\n case \"Date\":\r\n const dateList = stocks.sort(function (a, b) {\r\n if (a.date < b.date) {\r\n return -1;\r\n } else if (a.date > b.date) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n makeHeaders(stocks);\r\n showStocks(dateList);\r\n\r\n break;\r\n case \"Open\":\r\n const openList = stocks.sort(function (a, b) {\r\n if (a.open < b.open) {\r\n return -1;\r\n } else if (a.open > b.open) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n makeHeaders(stocks);\r\n showStocks(openList);\r\n\r\n break;\r\n\r\n case \"Close\":\r\n const closeList = stocks.sort(function (a, b) {\r\n if (a.close < b.close) {\r\n return -1;\r\n } else if (a.close > b.close) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n makeHeaders(stocks);\r\n showStocks(closeList);\r\n break;\r\n case \"Low\":\r\n const lowList = stocks.sort(function (a, b) {\r\n if (a.low < b.low) {\r\n return -1;\r\n } else if (a.low > b.low) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n makeHeaders(stocks);\r\n showStocks(lowList);\r\n break;\r\n case \"High\":\r\n const highList = stocks.sort(function (a, b) {\r\n if (a.high < b.high) {\r\n return -1;\r\n } else if (a.high > b.high) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n makeHeaders(stocks);\r\n showStocks(highList);\r\n break;\r\n case \"Volume\":\r\n const volumeList = stocks.sort(function (a, b) {\r\n if (a.volume < b.volume) {\r\n return -1;\r\n } else if (a.volume > b.volume) {\r\n return 1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n makeHeaders(stocks);\r\n showStocks(volumeList);\r\n break;\r\n }\r\n }", "async rank(){\r\n // Starts by obtaining the percent change of all the stocks then waits for all promises to be resolved.\r\n var promStocks = this.getPercentChanges(this.allStocks);\r\n await Promise.all(promStocks);\r\n /*\r\n * Sorts the array of stocks based on their precent change, the algorithm will later take\r\n * long positions on the better perfomring stocks and short the worse ones.\r\n */\r\n this.allStocks.sort((a, b) => {return a.pc - b.pc;});\r\n }", "function FilterPrice(listingsArray) {\n setPulled(listingsArray.sort((a, b) => a.price > b.price));\n }", "async sortLtPrice(req, res) {\r\n try { \r\n const products = await Product.find().sort({price: 1});\r\n res.send({message: 'Successful search', products});\r\n } catch (error) {\r\n console.error(500) \r\n res.send({message:'There was a problem trying to get products'});\r\n }\r\n }", "function sort(typeOfSort, brands) {\n if(typeOfSort=='price-asc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(price_asc);\n });}\n else if (typeOfSort=='price-desc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(price_desc);\n });}\n else if (typeOfSort=='date-asc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(date_asc);\n });}\n else if (typeOfSort=='date-desc'){\n Object.keys(brands).forEach((brand, i) => {\n brands[brand].sort(date_desc);\n });}\n return brands;\n}", "function sortDate(data) {\r\n const sortedDate = data.sort((a, b) => {\r\n if (sortBool)\r\n return a.date < b.date ? -1 : 1;\r\n else\r\n return a.date > b.date ? -1 : 1;\r\n });\r\n swapBool();\r\n createStockTable(sortedDate);\r\n }", "function pr_desc(){\n console.log('Sort by Price Desc: ');\n myLibrary.sortByPriceDesc();\n}", "function sortProducts(criterio, array) {\n let result = [];\n if (criterio === ORDER_ASC_BY_COST) {\n result = array.sort(function (a, b) {\n if (a.cost < b.cost) {\n return -1;\n }\n if (a.cost > b.cost) {\n return 1;\n }\n return 0;\n });\n } else if (criterio === ORDER_DESC_BY_COST) {\n result = array.sort(function (a, b) {\n if (a.cost > b.cost) {\n return -1;\n }\n if (a.cost < b.cost) {\n return 1;\n }\n return 0;\n });\n } else if (criterio === ORDER_BY_PROD_REL) {\n result = array.sort(function (a, b) {\n let aSold = parseInt(a.soldCount);\n let bSold = parseInt(b.soldCount);\n\n if (aSold > bSold) {\n return -1;\n }\n if (aSold < bSold) {\n return 1;\n }\n return 0;\n });\n }\n\n return result;\n}", "sortBy(field) {\n var sortedItems = this.props.itemsFromParent.sort( (a, b) => {\n if(field === \"price\") {\n if (a.item.price > b.item.price) {\n return 1;\n }\n if (a.item.price < b.item.price) {\n return -1;\n }\n return 0;\n }\n if(field === \"title\") {\n if (a.item.title > b.item.title) {\n return 1;\n }\n if (a.item.title < b.item.title) {\n return -1;\n }\n return 0;\n }\n if(field === \"location\") {\n if (a.dist > b.dist) {\n return 1;\n }\n if (a.dist < b.dist) {\n return -1;\n }\n return 0;\n }\n });\n this.updateData(sortedItems);\n }", "function sortData (data) {\n ...\n}", "function sortGamesByReleaseOrder() {\r\n khGames.sort(function(a,b) {\r\n // Comparator function to tell JS how to compare the items when sorting\r\n // Compare by release year, then if both the same then give bundled game priority (higher up list)\r\n var order = a.releaseOrder - b.releaseOrder;\r\n if (order == 0) {\r\n if (!b.games) {\r\n return -1;\r\n } else if (!a.games) {\r\n return 1;\r\n } else if (!a.games && !b.games) {\r\n return 0;\r\n }\r\n }\r\n return order;\r\n });\r\n return khGames;\r\n}", "function sortByScore()\n {\n newsItems.sort(function(a,b) {return a.points<b.points});\n console.log(newsItems);\n\n addNewsListItems();\n\n }", "function sortByFunc() {\n switch (sortBy.field) {\n case 'name':\n case 'ticker':\n if (sortBy.desc === 0) {\n return (a, b) => a[sortBy.field].localeCompare(b[sortBy.field])\n }\n return (a, b) => b[sortBy.field].localeCompare(a[sortBy.field])\n case 'price':\n case 'changes':\n case 'marketCapitalization':\n default:\n if (sortBy.desc === 0) {\n return (a, b) => (a[sortBy.field] - b[sortBy.field])\n }\n return (a, b) => (b[sortBy.field] - a[sortBy.field])\n }\n }", "sortPrice(e) {\n if (e.target.value === \"descending\") {\n let sortedDesc = sortDescending(this.state.cardData);\n this.setState({ cardData: sortedDesc });\n } else {\n let sortedDesc = sortAscending(this.state.cardData);\n this.setState({ cardData: sortedDesc });\n }\n }", "function sortData(data) {\n displayComic(data.comics);\n //displayManga(data.manga);\n //displayGNovel(data.graphicNovels);\n readyComicFunctions();\n}", "function _sortDeck () {\n deck.sort ( (a, b) => {\n let cardA = getCardById(a);\n let cardB = getCardById(b);\n if (cardA[\"cost\"] > cardB[\"cost\"]) {\n return 1;\n }\n else if (cardA[\"cost\"] < cardB[\"cost\"]) {\n return -1;\n }\n else {\n return cardA[\"name\"] > cardB[\"name\"];\n }\n });\n}", "sort() {\n this.genePool.sort(function (a, b) {\n return (a.cost - b.cost);\n });\n }", "sortAndReduceOrderBook() {\n const asks = ptoHelper.sortOrders(this.asks, 'ascending');\n const bids = ptoHelper.sortOrders(this.bids, 'descending');\n this.asks = ptoHelper.reduceOrders(asks);\n this.bids = ptoHelper.reduceOrders(bids);\n }", "function sortTrackName()\n{\n\ttracks.sort( function(a,b) { if (a.name < b.name) \nreturn -1; else return 1; } );\n\tclearTable();\n\tfillTracksTable();\n}", "function Sort() {}", "function kartenSortieren() {\n hand.sort(sortByvalue);\n hand.sort(sortBybild);\n handkarten();\n}", "sortData() {\n this.data.sort(($val1, $val2 ) => {\n const a = JSON.stringify($val1[this.sortBy]);\n const b = JSON.stringify($val2[this.sortBy]);\n if ( a < b ){\n return -this.sortDir;\n }\n if ( a > b ){\n return this.sortDir;\n }\n return 0;\n });\n }", "function sortByOrder(values) {\n let vals = [...values]\n return vals.sort((a, b) => Math.sign(a.data.order - b.data.order))\n }", "function price_desc(a,b){\nif (a.price<b.price){\n return 1;}\nif (a.price>b.price){\n return -1;}\nreturn 0\n}", "function sortOrder(a,b) {\n return b.size - a.size;\n }", "function sortOrder(a, b) {\n return b.size - a.size;\n }", "function sortSectionsPriceArray(singleRowData) {\n sectionsPriceArray.push(parseInt(singleRowData.gsx$skipass.$t));\n sectionsPriceArray.sort((a, b) => {\n return a - b;\n });\n\n //remove duplicates\n uniqueSectionsPriceArray = [...new Set(sectionsPriceArray)];\n}", "function sortServices(arr) {\n return arr.sort( function(prev, next) {\n\n if ( next.costs == prev.costs) {\n return prev.name.localeCompare(next.name);\n }\n\n return next.costs - prev.costs;\n });\n }", "function sortByOrder(a, b)\n{\n return (a.order - b.order);\n}", "function budgetFilter (price , ls) {\n\n const result = [];\n let count = 0;\n\n for (let i = 0; i < ls.length; i++) {\n if (price >= ls[i]) {\n result[count] = ls[i];\n count++\n }\n }\n\n return result\n}", "function sortOrder(a,b) {\n return b.size - a.size;\n }", "placeOrder() {\n var cartItems = this.state.itemList.filter((e)=> (e.isChecked == true))\n console.log('cartItems :', JSON.stringify(cartItems));\n\n if(cartItems.length) {\n var numOfPackage = this.findNumOfPackage(cartItems);\n console.log('numOfPackage :', numOfPackage);\n\n if(numOfPackage == 1) {\n this.createCartList(cartItems, numOfPackage);\n } else {\n cartItems.sort((a, b) => parseInt(b.Weight) - parseInt(a.Weight));\n console.log('cartItems :', JSON.stringify(cartItems));\n\n var Package = [];\n cartItems.forEach((val, index) => {\n if(index < numOfPackage) {\n for(var i=0; i<numOfPackage; i++) {\n if(i == index) {\n Package[i] = [];\n Package[i].push(val);\n return;\n }\n }\n } else {\n Package.sort(this.sortFunction);\n for(var i=0; i<numOfPackage; i++) {\n var TPRIZE = 0;\n for(var j=0; j<Package[i].length; j++) {\n TPRIZE += Package[i][j].Price;\n }\n\n if (TPRIZE + val['Price'] <= maxOrderPrice) {\n Package[i].push(val);\n return;\n }\n }\n }\n })\n\n this.createCartList(Package, numOfPackage);\n }\n } else {\n alert(\"choose any item to place order\");\n }\n }", "function sortTracksByPopularity(tracks) {\n return tracks.sort((trackA, trackB) => {\n if (trackA.popularity > trackB.popularity) {\n return -1\n }\n if (trackA.popularity < trackB.popularity) {\n return 1\n }\n return 0\n })\n}", "function sortOrder(a, b) {\n return b.size - a.size;\n }", "function sortOrder(a, b) {\n return b.size - a.size;\n }", "function sortOrder(a, b) {\n\t return b.size - a.size;\n\t }", "function FilterByPrice(price) {\n return products.filter(function (item) {\n return item.price <= price;\n });\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}", "function listFilterHandler(listingsArray) {\n //setListing(listingsArray.sort((a, b) => a.price < b.price))\n listingsArray.sort((a, b) => a.price < b.price);\n }", "function sortArtistName()\n{\n\tartists.sort( function(a,b) { if (a.name < b.name) return -1; else return 1; } );\n\tclearTable();\n\tfillArtistsTable();\n}", "sortTheCard() {\n this.sort = this.cards.sort((currentCard, nextCard) => currentCard.value - nextCard.value);\n }", "sortByCalories() {\n this.setState({\n foodData: getAllfoods().sort((a, b) => Number(b.calories.totalCalories) - Number(a.calories.totalCalories))\n });\n }", "function sortScores() {\n\n\t\t\tstoredScores = storedScores.sort(function(score1,score2) {\n\n\t\t\t\t// If Score is tied, sort by Time Remaining...\n\t\t\t\tif (score1[1]-score2[1] == 0) {\n\t\t\t\t\treturn score2[2]-score1[2];\n\t\t\t\t}\n\t\t\t\t// ...otherwise sort by score.\n\t\t\t\telse {\n\t\t\t\t\treturn score2[1]-score1[1];\n\t\t\t\t}\n\n\t\t\t});\n\t\t\t\n\t\t}", "function sortProduct(){ \r\n\r\n var compare = document.product.filter.value;\r\n \r\n var container = document.getElementById('item-container');\r\n// if(compare == 'price') {\r\n// console.log(hats.sort(comparePrice));\r\n// } else if(compare == 'name') {\r\n// console.log(hats.sort(compareName));\r\n// }else {\r\n// console.log('Nothing selected!');\r\n// }\r\n\r\n// THE ABOVE IF/ELSE statment works as well, but I prefer to use switch statements for they are easier to read.\r\n \r\n switch(compare){\r\n case 'price':\r\n console.log(hats.sort(compareName));\r\n break;\r\n \r\n case 'name':\r\n console.log(hats.sort(comparePrice));\r\n break;\r\n \r\n default:\r\n console.log('ERROR: Code is broken somewhere');\r\n break;\r\n \r\n }\r\n \r\n event.preventDefault();\r\n}", "_sort (a, b) {\n return this.members.sort((a, b) => a.cost - b.cost);\n }", "_orderSort(l, r) {\n return l.order - r.order;\n }" ]
[ "0.77467066", "0.7579732", "0.7475155", "0.7466622", "0.7318676", "0.7292306", "0.72474754", "0.7224767", "0.72093093", "0.71159804", "0.7086753", "0.7059093", "0.70556825", "0.70179665", "0.6978014", "0.6960935", "0.6940291", "0.6936307", "0.6790045", "0.6771037", "0.67695355", "0.674976", "0.6749137", "0.66913664", "0.6673059", "0.66331047", "0.66281575", "0.66279036", "0.6515637", "0.6496217", "0.64706534", "0.64185166", "0.6405638", "0.6393171", "0.6385444", "0.6367348", "0.63664377", "0.6351494", "0.6302203", "0.6290573", "0.6275134", "0.6243137", "0.6226475", "0.6206251", "0.6167753", "0.61572665", "0.61489743", "0.6123415", "0.6106097", "0.6087826", "0.60741675", "0.599529", "0.59913796", "0.5939232", "0.5921801", "0.591787", "0.591669", "0.5910365", "0.59074384", "0.5880443", "0.587034", "0.5820148", "0.58022434", "0.57731384", "0.5751672", "0.57410026", "0.5728729", "0.57181096", "0.5707841", "0.5675434", "0.56677073", "0.56668055", "0.5658724", "0.5657717", "0.5634613", "0.5587027", "0.55759335", "0.5569857", "0.5567416", "0.5563874", "0.55494523", "0.55493766", "0.5547767", "0.5544376", "0.5542644", "0.55401087", "0.55250156", "0.55187744", "0.55138034", "0.55138034", "0.5506986", "0.55063236", "0.550111", "0.5497106", "0.54937226", "0.5486532", "0.548481", "0.5477164", "0.5459606", "0.54447705", "0.5444273" ]
0.0
-1
creates a type object for the contract the function was defined in
function functionTableEntryToType(functionEntry) { if (functionEntry.contractNode === null) { //for free functions return null; } return { typeClass: "contract", kind: "native", id: import_1.makeTypeId(functionEntry.contractId, functionEntry.compilationId), typeName: functionEntry.contractName, contractKind: functionEntry.contractKind, payable: functionEntry.contractPayable }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _makeBaseContract_(type) {\n if(type == \"number\") return (typeOfNumber);\n else if(type == \"string\") return (typeOfString);\n else if(type == \"boolean\") return (typeOfBoolean);\n else if(type == \"undefined\") return (typeOfUndefined);\n else if(type == \"object\") return (typeOfObject);\n else if(type == \"function\") return (typeOfFunction);\n else return (any);\n // throw Error(\"Undefined Type\");\n}", "function _makeContract_ (funID) {\n var calls = _TYPES_[(funID)];\n var contract = _makeIntersectionContract_(calls);\n return contract;\n}", "createType (typedefinition, id) {\n var structname = typedefinition[0].struct\n id = id || this.getNextOpId(1)\n var op = Y.Struct[structname].create(id)\n op.type = typedefinition[0].name\n\n this.requestTransaction(function * () {\n if (op.id[0] === '_') {\n yield* this.setOperation(op)\n } else {\n yield* this.applyCreatedOperations([op])\n }\n })\n var t = Y[op.type].typeDefinition.createType(this, op, typedefinition[1])\n this.initializedTypes[JSON.stringify(op.id)] = t\n return t\n }", "function Type() {}", "function getContractObject(){\n let abiPath = path.join(__dirname + '/bin/DataStorageEvent.abi');\n let abi = fs.readFileSync(abiPath);\n\n // Replace the contract address with the contract you want to invoke.\n // let contractAddress = '0xadb1e7fea9a24daee48492c3523721ea6b42f271'; // address of the deployed contract\n let options = {\n from: '0x96b6E861698DfBA5721a3Ccd9AfBCa808e360bf3',\n gasPrice: 1000,\n gas: 300000\n };\n let deployedContract = new web3.eth.Contract(JSON.parse(abi),contractAddress,options);\n return deployedContract;\n}", "function _makeFunctionContract_(call) {\n var args = [];\n for(var i in call) {\n if(i!=-1) {\n args[i] = _makeBaseContract_(call[i]);\n }\n }\n var map = TreatJS.Map.StringMap(args);\n var domain = TreatJS.Contract.Object(map);\n var range = _makeBaseContract_(call[-1]);\n var contract = TreatJS.Contract.Function(domain, range);\n\n return contract;\n}", "createTypes(){\n }", "function Type() {\n}", "function contractKind(definition) {\n return typeString(definition).split(\" \")[0];\n}", "function definitionToStoredType(definition, compilationId, compiler, referenceDeclarations) {\n switch (definition.nodeType) {\n case \"StructDefinition\": {\n let id = import_1.makeTypeId(definition.id, compilationId);\n let definingContractName;\n let typeName;\n if (definition.canonicalName.includes(\".\")) {\n [definingContractName, typeName] = definition.canonicalName.split(\".\");\n }\n else {\n typeName = definition.canonicalName;\n //leave definingContractName undefined\n }\n let memberTypes = definition.members.map(member => ({\n name: member.name,\n type: definitionToType(member, compilationId, compiler, null)\n }));\n let definingContract;\n if (referenceDeclarations) {\n let contractDefinition = Object.values(referenceDeclarations).find(node => node.nodeType === \"ContractDefinition\" &&\n node.nodes.some((subNode) => import_1.makeTypeId(subNode.id, compilationId) === id));\n if (contractDefinition) {\n definingContract = (definitionToStoredType(contractDefinition, compilationId, compiler)); //can skip reference declarations\n }\n }\n if (definingContract) {\n return {\n typeClass: \"struct\",\n kind: \"local\",\n id,\n typeName,\n definingContractName,\n definingContract,\n memberTypes\n };\n }\n else {\n return {\n typeClass: \"struct\",\n kind: \"global\",\n id,\n typeName,\n memberTypes\n };\n }\n }\n case \"EnumDefinition\": {\n let id = import_1.makeTypeId(definition.id, compilationId);\n let definingContractName;\n let typeName;\n debug(\"typeName: %s\", typeName);\n if (definition.canonicalName.includes(\".\")) {\n [definingContractName, typeName] = definition.canonicalName.split(\".\");\n }\n else {\n typeName = definition.canonicalName;\n //leave definingContractName undefined\n }\n let options = definition.members.map(member => member.name);\n let definingContract;\n if (referenceDeclarations) {\n let contractDefinition = Object.values(referenceDeclarations).find(node => node.nodeType === \"ContractDefinition\" &&\n node.nodes.some((subNode) => import_1.makeTypeId(subNode.id, compilationId) === id));\n if (contractDefinition) {\n definingContract = (definitionToStoredType(contractDefinition, compilationId, compiler)); //can skip reference declarations\n debug(\"contractDefinition: %o\", contractDefinition);\n debug(\"definingContract: %o\", definingContract);\n }\n }\n if (definingContract) {\n return {\n typeClass: \"enum\",\n kind: \"local\",\n id,\n typeName,\n definingContractName,\n definingContract,\n options\n };\n }\n else {\n return {\n typeClass: \"enum\",\n kind: \"global\",\n id,\n typeName,\n options\n };\n }\n }\n case \"ContractDefinition\": {\n let id = import_1.makeTypeId(definition.id, compilationId);\n let typeName = definition.name;\n let contractKind = definition.contractKind;\n let payable = Utils.isContractPayable(definition);\n return {\n typeClass: \"contract\",\n kind: \"native\",\n id,\n typeName,\n contractKind,\n payable\n };\n }\n }\n}", "static newType(spec) {\n return allTypes.newType(spec);\n }", "function Type() {\r\n}", "function contract(address, abi, pipe) {\n\tvar self = this;\n\tthis.address = address;\n\tthis.abi = abi;\n\tthis.pipe = pipe;\n\n\tthis.functions = {}\n\tthis.abi.filter(function (json) {\n\t \treturn (json.type === 'function')\n\t\t}).forEach(function (json) {\n\t\t\tconst solidityFunction = new SolidityFunction(null, json, address)\n\t\t\tself.functions[json.name] = solidityFunction; \n\t\t})\n\n}", "function type(name) {\n if (isundefined(name))\n throw new TypeError('Invalid arguments: %s'.subs(arguments));\n var args = Array.prototype.slice.call(arguments).slice(1);\n if (args.length == 0) {\n if (name === null) return Object;\n return name.constructor;\n }\n if (args[0] && isinstance(args[0], Array) && args[0].length > 0)\n var bases = args.shift();\n else if (args[0] && !isinstance(args[0], Array) && isinstance(args[0], Function))\n var bases = [args.shift()];\n else\n throw new TypeError('Invalid arguments: %s'.subs(arguments));\n if (args[0] && isinstance(args[0], Object) && args.length == 2) {\n var classAttrs = args.shift();\n var instanceAttrs = args.shift();\n } else if (args.length == 1) {\n var classAttrs = {};\n var instanceAttrs = args.shift();\n } else if (args.length == 0) {\n var classAttrs = {};\n var instanceAttrs = {};\n } else new TypeError('Invalid arguments: %s'.subs(arguments));\n\n var new_type = eval('(function ' + name + '() { this.__init__.apply(this, arguments); })');\n\n //Jerarquia\n new_type.__base__ = bases[0];\n new_type.__bases__ = bases;\n new_type.__subclasses__ = [];\n new_type.__static__ = {};\n for each (var base in bases.reverse()) {\n base.__subclasses__.push(new_type);\n __extend__(true, new_type.__static__, base.__static__);\n new_type.__new__ = base.__new__;\n }\n //Decorando los atributos\n classAttrs['__name__'] = instanceAttrs['__name__'] = name;\n classAttrs['__module__'] = instanceAttrs['__module__'] = this['__name__'] || 'window';\n\n //Construyendo el tipo\n __extend__(true, new_type.__static__, classAttrs);\n __extend__(true, new_type, new_type.__static__);\n\n //Constructor de instancia\n new_type = new_type.__new__(new_type.__name__, new_type.__bases__, instanceAttrs);\n return new_type;\n }", "getType() {}", "function createFromType(nativeType, onto) {\n clrTypeTarget = clrTypeTarget || nativeType;\n isPublicProperty = isPublicProperty || dotnet.getPropertyObject(nativeType, \"IsPublic\");\n nameProperty = nameProperty || dotnet.getPropertyObject(nativeType, \"Name\");\n nameSpaceProperty = nameSpaceProperty || dotnet.getPropertyObject(nativeType, \"Namespace\");\n isEnumProperty = isEnumProperty || dotnet.getPropertyObject(nativeType, \"IsEnum\");\n isClassProperty = isClassProperty || dotnet.getPropertyObject(nativeType, \"IsClass\");\n isValueTypeProperty = isValueTypeProperty || dotnet.getPropertyObject(nativeType, \"IsValueType\");\n if(dotnet.getProperty(isPublicProperty, nativeType)) {\n var space = dotnet.getProperty(nameSpaceProperty, nativeType);\n var name = dotnet.getProperty(nameProperty, nativeType);\n var info = { onto:onto, type:nativeType, name:name };\n \n if(space) {\n var spl = space.split('.');\n for(var i=0; i < spl.length; i++) {\n info.onto[spl[i]] = info.onto[spl[i]] || {};\n info.onto = info.onto[spl[i]];\n }\n }\n\n Object.defineProperty(info.onto, name, {\n configurable:true, enumerable:true,\n get:function() { \n delete this.onto[this.name];\n if(dotnet.getProperty(isEnumProperty, this.type)) {\n this.onto[this.name] = createEnum(this.type,this.name);\n } else if (dotnet.getProperty(isClassProperty, this.type) || dotnet.getProperty(isValueTypeProperty, this.type)) {\n this.onto[this.name] = createClass(this.type,this.name);\n }\n return this.onto[this.name];\n }.bind(info)\n });\n }\n}", "function wrapContract(abi, byteCode) {\n if (!abi)\n throw new Error(\"The contract's Application Binary Interface is required\");\n else if (typeof byteCode == \"undefined\")\n throw new Error(\"The contract's bytecode parameter is required\");\n\n return class WrappedContract {\n constructor(address) {\n this.$address = address;\n this.$abi = abi;\n this.$byteCode = byteCode;\n\n const web3 = getCurrentWeb3();\n this.$contract = new web3.eth.Contract(this.$abi, this.$address);\n\n this.defineContractMethods();\n }\n\n // Populate contract methods\n defineContractMethods() {\n this.$abi.forEach(({ /*constant,*/ name, inputs, type }) => {\n if (type !== \"function\") return; // type == 'constructor' => skip\n\n // TODO overloaded functions?\n\n // Function\n const self = this;\n this[name] = (...args) => {\n var opts = argsToOpts(args, inputs);\n return {\n call: () => {\n // constant\n return sendContractConstantTransaction(\n self.$contract,\n self.$abi,\n name,\n opts\n );\n },\n send: () => {\n // transaction\n return sendContractTransaction(\n self.$contract,\n self.$abi,\n name,\n opts\n );\n },\n estimateGas: () => {\n return estimateContractTransactionGas(\n self.$contract,\n self.$abi,\n name,\n opts\n );\n }\n };\n };\n });\n }\n\n static new(...args) {\n const func = abi.find(func => func && func.type === \"constructor\");\n var constructorInputs = [];\n if (func) constructorInputs = func.inputs;\n\n var opts = argsToOpts(args, constructorInputs);\n\n opts.$abi = abi;\n opts.$byteCode = byteCode;\n\n return deployContract(opts).then(contract => {\n if (!contract) throw new Error(\"Empty contract\");\n\n return new WrappedContract(\n (contract.options && contract.options.address) ||\n contract._address ||\n contract.address\n );\n });\n }\n };\n}", "function Contract(contract) {\n var constructor = this.constructor;\n this.abi = constructor.abi;\n\n if (typeof contract == \"string\") {\n var address = contract;\n var contract_class = constructor.web3.eth.contract(this.abi);\n contract = contract_class.at(address);\n }\n\n this.contract = contract;\n\n // Provision our functions.\n for (var i = 0; i < this.abi.length; i++) {\n var item = this.abi[i];\n if (item.type == \"function\") {\n if (item.constant == true) {\n this[item.name] = Utils.promisifyFunction(contract[item.name], constructor);\n } else {\n this[item.name] = Utils.synchronizeFunction(contract[item.name], this, constructor);\n }\n\n this[item.name].call = Utils.promisifyFunction(contract[item.name].call, constructor);\n this[item.name].sendTransaction = Utils.promisifyFunction(contract[item.name].sendTransaction, constructor);\n this[item.name].request = contract[item.name].request;\n this[item.name].estimateGas = Utils.promisifyFunction(contract[item.name].estimateGas, constructor);\n }\n\n if (item.type == \"event\") {\n this[item.name] = contract[item.name];\n }\n }\n\n this.allEvents = contract.allEvents;\n this.address = contract.address;\n this.transactionHash = contract.transactionHash;\n }", "function addObjectType(name, onlyOne, mustExist, sprite, constr){\n\tvar objType = {\n\t\tname: name,\n\t\tonlyOne: onlyOne,\n\t\tmustExist: mustExist,\n\t\tproperties: [],\n\t\tspr: sprite,\n\t\tconstr: constr,\n\t\tconstrName: constr.toString().match(/function (\\w*)/)[1]//Extracts the name of the constructor from the constructor function code text\n\t};\n\t\n\tobjectTypes.push(objType);\n\treturn objType;\n}", "function FunctionContract(domain, range) {\n if(!(this instanceof FunctionContract)) return new FunctionContract(domain, range);\n\n if(!(domain instanceof Contract)) error(\"Wrong Contract\", (new Error()).fileName, (new Error()).lineNumber);\n if(!(range instanceof Contract)) error(\"Wrong Contract\", (new Error()).fileName, (new Error()).lineNumber);\n\n Object.defineProperties(this, {\n \"domain\": {\n get: function () { return domain; } },\n \"range\": {\n get: function () { return range; } }\n });\n\n this.toString = function() { return \"(\" + domain.toString() + \"->\" + range.toString() + \")\"; };\n }", "function Type(typeFunction, options) {\n return function (target, key) {\n var type = Reflect.getMetadata(\"design:type\", target, key);\n var metadata = new TypeMetadata_1.TypeMetadata(target.constructor, key, type, typeFunction, options);\n storage_2.defaultMetadataStorage.addTypeMetadata(metadata);\n };\n }", "function showContract() {\n console.log(miniERC20);\n /*\n {\n constructor: [Function: bound call],\n abi: ContractABICoder { * },\n address: '0x8fad845b67532204a20bd54481a819fe6d0df02e',\n allowance: [Function: bound call],\n allowed: [Function: bound call],\n approve: [Function: bound call],\n balanceOf: [Function: bound call],\n balances: [Function: bound call],\n decimals: [Function: bound call],\n name: [Function: bound call],\n symbol: [Function: bound call],\n totalSupply: [Function: bound call],\n transfer: [Function: bound call],\n transferFrom: [Function: bound call],\n Approval: [Function: bound call],\n Transfer: [Function: bound call],\n 'allowance(address,address)': [Function: bound call],\n '0xdd62ed3e': [Function: bound call],\n 'allowed(address,address)': [Function: bound call],\n '0x5c658165': [Function: bound call],\n 'approve(address,uint256)': [Function: bound call],\n '0x095ea7b3': [Function: bound call],\n 'balanceOf(address)': [Function: bound call],\n '0x70a08231': [Function: bound call],\n 'balances(address)': [Function: bound call],\n '0x27e235e3': [Function: bound call],\n 'decimals()': [Function: bound call],\n '0x313ce567': [Function: bound call],\n 'name()': [Function: bound call],\n '0x06fdde03': [Function: bound call],\n 'symbol()': [Function: bound call],\n '0x95d89b41': [Function: bound call],\n 'totalSupply()': [Function: bound call],\n '0x18160ddd': [Function: bound call],\n 'transfer(address,uint256)': [Function: bound call],\n '0xa9059cbb': [Function: bound call],\n 'transferFrom(address,address,uint256)': [Function: bound call],\n '0x23b872dd': [Function: bound call],\n 'Approval(address,address,uint256)': [Function: bound call],\n '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925': [Function: bound call],\n 'Transfer(address,address,uint256)': [Function: bound call],\n '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef': [Function: bound call]\n }\n */\n}", "function Type(typeFunction, options = {}) {\n return function (target, propertyName) {\n const reflectedType = Reflect.getMetadata('design:type', target, propertyName);\n storage_1.defaultMetadataStorage.addTypeMetadata({\n target: target.constructor,\n propertyName: propertyName,\n reflectedType,\n typeFunction,\n options,\n });\n };\n}", "function ContractConstructor(constructor, binding, name) {\n if(!(this instanceof ContractConstructor)) return new ContractConstructor(constructor, binding, name);\n\n if(!(constructor instanceof Function)) error(\"Wrong Contract\", (new Error()).fileName, (new Error()).lineNumber);\n\n Object.defineProperties(this, {\n \"constructor\": {\n get: function () { return constructor; } },\n \"name\": {\n get: function () { return name; } },\n \"binding\": {\n get: function () { return binding; } },\n \"build\": {\n get: function () { return function() {\n return _.construct(this, arguments);\n } } },\n \"ctor\": {\n get: function () { return this.build.bind(this);\n } }\n });\n\n this.toString = function() { return \"[*\" + ((name!=undefined) ? name : constructor.toString()) + \"*]\"; };\n }", "function create() {\n /**\n * Get a type test function for a specific data type\n * @param {string} name Name of a data type like 'number' or 'string'\n * @returns {Function(obj: *) : boolean} Returns a type testing function.\n * Throws an error for an unknown type.\n */\n function getTypeTest(name) {\n var test;\n for (var i = 0; i < typed.types.length; i++) {\n var entry = typed.types[i];\n if (entry.name === name) {\n test = entry.test;\n break;\n }\n }\n\n if (!test) {\n var hint;\n for (i = 0; i < typed.types.length; i++) {\n entry = typed.types[i];\n if (entry.name.toLowerCase() == name.toLowerCase()) {\n hint = entry.name;\n break;\n }\n }\n\n throw new Error('Unknown type \"' + name + '\"' +\n (hint ? ('. Did you mean \"' + hint + '\"?') : ''));\n }\n return test;\n }\n\n /**\n * Retrieve the function name from a set of functions, and check\n * whether the name of all functions match (if given)\n * @param {Array.<function>} fns\n */\n function getName (fns) {\n var name = '';\n\n for (var i = 0; i < fns.length; i++) {\n var fn = fns[i];\n\n // merge function name when this is a typed function\n if (fn.signatures && fn.name != '') {\n if (name == '') {\n name = fn.name;\n }\n else if (name != fn.name) {\n var err = new Error('Function names do not match (expected: ' + name + ', actual: ' + fn.name + ')');\n err.data = {\n actual: fn.name,\n expected: name\n };\n throw err;\n }\n }\n }\n\n return name;\n }\n\n /**\n * Create an ArgumentsError. Creates messages like:\n *\n * Unexpected type of argument (expected: ..., actual: ..., index: ...)\n * Too few arguments (expected: ..., index: ...)\n * Too many arguments (expected: ..., actual: ...)\n *\n * @param {String} fn Function name\n * @param {number} argCount Number of arguments\n * @param {Number} index Current argument index\n * @param {*} actual Current argument\n * @param {string} [expected] An optional, comma separated string with\n * expected types on given index\n * @extends Error\n */\n function createError(fn, argCount, index, actual, expected) {\n var actualType = getTypeOf(actual);\n var _expected = expected ? expected.split(',') : null;\n var _fn = (fn || 'unnamed');\n var anyType = _expected && contains(_expected, 'any');\n var message;\n var data = {\n fn: fn,\n index: index,\n actual: actualType,\n expected: _expected\n };\n\n if (_expected) {\n if (argCount > index && !anyType) {\n // unexpected type\n message = 'Unexpected type of argument in function ' + _fn +\n ' (expected: ' + _expected.join(' or ') + ', actual: ' + actualType + ', index: ' + index + ')';\n }\n else {\n // too few arguments\n message = 'Too few arguments in function ' + _fn +\n ' (expected: ' + _expected.join(' or ') + ', index: ' + index + ')';\n }\n }\n else {\n // too many arguments\n message = 'Too many arguments in function ' + _fn +\n ' (expected: ' + index + ', actual: ' + argCount + ')'\n }\n\n var err = new TypeError(message);\n err.data = data;\n return err;\n }\n\n /**\n * Collection with function references (local shortcuts to functions)\n * @constructor\n * @param {string} [name='refs'] Optional name for the refs, used to generate\n * JavaScript code\n */\n function Refs(name) {\n this.name = name || 'refs';\n this.categories = {};\n }\n\n /**\n * Add a function reference.\n * @param {Function} fn\n * @param {string} [category='fn'] A function category, like 'fn' or 'signature'\n * @returns {string} Returns the function name, for example 'fn0' or 'signature2'\n */\n Refs.prototype.add = function (fn, category) {\n var cat = category || 'fn';\n if (!this.categories[cat]) this.categories[cat] = [];\n\n var index = this.categories[cat].indexOf(fn);\n if (index == -1) {\n index = this.categories[cat].length;\n this.categories[cat].push(fn);\n }\n\n return cat + index;\n };\n\n /**\n * Create code lines for all function references\n * @returns {string} Returns the code containing all function references\n */\n Refs.prototype.toCode = function () {\n var code = [];\n var path = this.name + '.categories';\n var categories = this.categories;\n\n for (var cat in categories) {\n if (categories.hasOwnProperty(cat)) {\n var category = categories[cat];\n\n for (var i = 0; i < category.length; i++) {\n code.push('var ' + cat + i + ' = ' + path + '[\\'' + cat + '\\'][' + i + '];');\n }\n }\n }\n\n return code.join('\\n');\n };\n\n /**\n * A function parameter\n * @param {string | string[] | Param} types A parameter type like 'string',\n * 'number | boolean'\n * @param {boolean} [varArgs=false] Variable arguments if true\n * @constructor\n */\n function Param(types, varArgs) {\n // parse the types, can be a string with types separated by pipe characters |\n if (typeof types === 'string') {\n // parse variable arguments operator (ellipses '...number')\n var _types = types.trim();\n var _varArgs = _types.substr(0, 3) === '...';\n if (_varArgs) {\n _types = _types.substr(3);\n }\n if (_types === '') {\n this.types = ['any'];\n }\n else {\n this.types = _types.split('|');\n for (var i = 0; i < this.types.length; i++) {\n this.types[i] = this.types[i].trim();\n }\n }\n }\n else if (Array.isArray(types)) {\n this.types = types;\n }\n else if (types instanceof Param) {\n return types.clone();\n }\n else {\n throw new Error('String or Array expected');\n }\n\n // can hold a type to which to convert when handling this parameter\n this.conversions = [];\n // TODO: implement better API for conversions, be able to add conversions via constructor (support a new type Object?)\n\n // variable arguments\n this.varArgs = _varArgs || varArgs || false;\n\n // check for any type arguments\n this.anyType = this.types.indexOf('any') !== -1;\n }\n\n /**\n * Order Params\n * any type ('any') will be ordered last, and object as second last (as other\n * types may be an object as well, like Array).\n *\n * @param {Param} a\n * @param {Param} b\n * @returns {number} Returns 1 if a > b, -1 if a < b, and else 0.\n */\n Param.compare = function (a, b) {\n // TODO: simplify parameter comparison, it's a mess\n if (a.anyType) return 1;\n if (b.anyType) return -1;\n\n if (contains(a.types, 'Object')) return 1;\n if (contains(b.types, 'Object')) return -1;\n\n if (a.hasConversions()) {\n if (b.hasConversions()) {\n var i, ac, bc;\n\n for (i = 0; i < a.conversions.length; i++) {\n if (a.conversions[i] !== undefined) {\n ac = a.conversions[i];\n break;\n }\n }\n\n for (i = 0; i < b.conversions.length; i++) {\n if (b.conversions[i] !== undefined) {\n bc = b.conversions[i];\n break;\n }\n }\n\n return typed.conversions.indexOf(ac) - typed.conversions.indexOf(bc);\n }\n else {\n return 1;\n }\n }\n else {\n if (b.hasConversions()) {\n return -1;\n }\n else {\n // both params have no conversions\n var ai, bi;\n\n for (i = 0; i < typed.types.length; i++) {\n if (typed.types[i].name === a.types[0]) {\n ai = i;\n break;\n }\n }\n\n for (i = 0; i < typed.types.length; i++) {\n if (typed.types[i].name === b.types[0]) {\n bi = i;\n break;\n }\n }\n\n return ai - bi;\n }\n }\n };\n\n /**\n * Test whether this parameters types overlap an other parameters types.\n * Will not match ['any'] with ['number']\n * @param {Param} other\n * @return {boolean} Returns true when there are overlapping types\n */\n Param.prototype.overlapping = function (other) {\n for (var i = 0; i < this.types.length; i++) {\n if (contains(other.types, this.types[i])) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Test whether this parameters types matches an other parameters types.\n * When any of the two parameters contains `any`, true is returned\n * @param {Param} other\n * @return {boolean} Returns true when there are matching types\n */\n Param.prototype.matches = function (other) {\n return this.anyType || other.anyType || this.overlapping(other);\n };\n\n /**\n * Create a clone of this param\n * @returns {Param} Returns a cloned version of this param\n */\n Param.prototype.clone = function () {\n var param = new Param(this.types.slice(), this.varArgs);\n param.conversions = this.conversions.slice();\n return param;\n };\n\n /**\n * Test whether this parameter contains conversions\n * @returns {boolean} Returns true if the parameter contains one or\n * multiple conversions.\n */\n Param.prototype.hasConversions = function () {\n return this.conversions.length > 0;\n };\n\n /**\n * Tests whether this parameters contains any of the provided types\n * @param {Object} types A Map with types, like {'number': true}\n * @returns {boolean} Returns true when the parameter contains any\n * of the provided types\n */\n Param.prototype.contains = function (types) {\n for (var i = 0; i < this.types.length; i++) {\n if (types[this.types[i]]) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Return a string representation of this params types, like 'string' or\n * 'number | boolean' or '...number'\n * @param {boolean} [toConversion] If true, the returned types string\n * contains the types where the parameter\n * will convert to. If false (default)\n * the \"from\" types are returned\n * @returns {string}\n */\n Param.prototype.toString = function (toConversion) {\n var types = [];\n var keys = {};\n\n for (var i = 0; i < this.types.length; i++) {\n var conversion = this.conversions[i];\n var type = toConversion && conversion ? conversion.to : this.types[i];\n if (!(type in keys)) {\n keys[type] = true;\n types.push(type);\n }\n }\n\n return (this.varArgs ? '...' : '') + types.join('|');\n };\n\n /**\n * A function signature\n * @param {string | string[] | Param[]} params\n * Array with the type(s) of each parameter,\n * or a comma separated string with types\n * @param {Function} fn The actual function\n * @constructor\n */\n function Signature(params, fn) {\n var _params;\n if (typeof params === 'string') {\n _params = (params !== '') ? params.split(',') : [];\n }\n else if (Array.isArray(params)) {\n _params = params;\n }\n else {\n throw new Error('string or Array expected');\n }\n\n this.params = new Array(_params.length);\n this.anyType = false;\n this.varArgs = false;\n for (var i = 0; i < _params.length; i++) {\n var param = new Param(_params[i]);\n this.params[i] = param;\n if (param.anyType) {\n this.anyType = true;\n }\n if (i === _params.length - 1) {\n // the last argument\n this.varArgs = param.varArgs;\n }\n else {\n // non-last argument\n if (param.varArgs) {\n throw new SyntaxError('Unexpected variable arguments operator \"...\"');\n }\n }\n }\n\n this.fn = fn;\n }\n\n /**\n * Create a clone of this signature\n * @returns {Signature} Returns a cloned version of this signature\n */\n Signature.prototype.clone = function () {\n return new Signature(this.params.slice(), this.fn);\n };\n\n /**\n * Expand a signature: split params with union types in separate signatures\n * For example split a Signature \"string | number\" into two signatures.\n * @return {Signature[]} Returns an array with signatures (at least one)\n */\n Signature.prototype.expand = function () {\n var signatures = [];\n\n function recurse(signature, path) {\n if (path.length < signature.params.length) {\n var i, newParam, conversion;\n\n var param = signature.params[path.length];\n if (param.varArgs) {\n // a variable argument. do not split the types in the parameter\n newParam = param.clone();\n\n // add conversions to the parameter\n // recurse for all conversions\n for (i = 0; i < typed.conversions.length; i++) {\n conversion = typed.conversions[i];\n if (!contains(param.types, conversion.from) && contains(param.types, conversion.to)) {\n var j = newParam.types.length;\n newParam.types[j] = conversion.from;\n newParam.conversions[j] = conversion;\n }\n }\n\n recurse(signature, path.concat(newParam));\n }\n else {\n // split each type in the parameter\n for (i = 0; i < param.types.length; i++) {\n recurse(signature, path.concat(new Param(param.types[i])));\n }\n\n // recurse for all conversions\n for (i = 0; i < typed.conversions.length; i++) {\n conversion = typed.conversions[i];\n if (!contains(param.types, conversion.from) && contains(param.types, conversion.to)) {\n newParam = new Param(conversion.from);\n newParam.conversions[0] = conversion;\n recurse(signature, path.concat(newParam));\n }\n }\n }\n }\n else {\n signatures.push(new Signature(path, signature.fn));\n }\n }\n\n recurse(this, []);\n\n return signatures;\n };\n\n /**\n * Compare two signatures.\n *\n * When two params are equal and contain conversions, they will be sorted\n * by lowest index of the first conversions.\n *\n * @param {Signature} a\n * @param {Signature} b\n * @returns {number} Returns 1 if a > b, -1 if a < b, and else 0.\n */\n Signature.compare = function (a, b) {\n if (a.params.length > b.params.length) return 1;\n if (a.params.length < b.params.length) return -1;\n\n // count the number of conversions\n var i;\n var len = a.params.length; // a and b have equal amount of params\n var ac = 0;\n var bc = 0;\n for (i = 0; i < len; i++) {\n if (a.params[i].hasConversions()) ac++;\n if (b.params[i].hasConversions()) bc++;\n }\n\n if (ac > bc) return 1;\n if (ac < bc) return -1;\n\n // compare the order per parameter\n for (i = 0; i < a.params.length; i++) {\n var cmp = Param.compare(a.params[i], b.params[i]);\n if (cmp !== 0) {\n return cmp;\n }\n }\n\n return 0;\n };\n\n /**\n * Test whether any of the signatures parameters has conversions\n * @return {boolean} Returns true when any of the parameters contains\n * conversions.\n */\n Signature.prototype.hasConversions = function () {\n for (var i = 0; i < this.params.length; i++) {\n if (this.params[i].hasConversions()) {\n return true;\n }\n }\n return false;\n };\n\n /**\n * Test whether this signature should be ignored.\n * Checks whether any of the parameters contains a type listed in\n * typed.ignore\n * @return {boolean} Returns true when the signature should be ignored\n */\n Signature.prototype.ignore = function () {\n // create a map with ignored types\n var types = {};\n for (var i = 0; i < typed.ignore.length; i++) {\n types[typed.ignore[i]] = true;\n }\n\n // test whether any of the parameters contains this type\n for (i = 0; i < this.params.length; i++) {\n if (this.params[i].contains(types)) {\n return true;\n }\n }\n\n return false;\n };\n\n /**\n * Test whether the path of this signature matches a given path.\n * @param {Param[]} params\n */\n Signature.prototype.paramsStartWith = function (params) {\n if (params.length === 0) {\n return true;\n }\n\n var aLast = last(this.params);\n var bLast = last(params);\n\n for (var i = 0; i < params.length; i++) {\n var a = this.params[i] || (aLast.varArgs ? aLast: null);\n var b = params[i] || (bLast.varArgs ? bLast: null);\n\n if (!a || !b || !a.matches(b)) {\n return false;\n }\n }\n\n return true;\n };\n\n /**\n * Generate the code to invoke this signature\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns code\n */\n Signature.prototype.toCode = function (refs, prefix) {\n var code = [];\n\n var args = new Array(this.params.length);\n for (var i = 0; i < this.params.length; i++) {\n var param = this.params[i];\n var conversion = param.conversions[0];\n if (param.varArgs) {\n args[i] = 'varArgs';\n }\n else if (conversion) {\n args[i] = refs.add(conversion.convert, 'convert') + '(arg' + i + ')';\n }\n else {\n args[i] = 'arg' + i;\n }\n }\n\n var ref = this.fn ? refs.add(this.fn, 'signature') : undefined;\n if (ref) {\n return prefix + 'return ' + ref + '(' + args.join(', ') + '); // signature: ' + this.params.join(', ');\n }\n\n return code.join('\\n');\n };\n\n /**\n * Return a string representation of the signature\n * @returns {string}\n */\n Signature.prototype.toString = function () {\n return this.params.join(', ');\n };\n\n /**\n * A group of signatures with the same parameter on given index\n * @param {Param[]} path\n * @param {Signature} [signature]\n * @param {Node[]} childs\n * @param {boolean} [fallThrough=false]\n * @constructor\n */\n function Node(path, signature, childs, fallThrough) {\n this.path = path || [];\n this.param = path[path.length - 1] || null;\n this.signature = signature || null;\n this.childs = childs || [];\n this.fallThrough = fallThrough || false;\n }\n\n /**\n * Generate code for this group of signatures\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns the code as string\n */\n Node.prototype.toCode = function (refs, prefix) {\n // TODO: split this function in multiple functions, it's too large\n var code = [];\n\n if (this.param) {\n var index = this.path.length - 1;\n var conversion = this.param.conversions[0];\n var comment = '// type: ' + (conversion ?\n (conversion.from + ' (convert to ' + conversion.to + ')') :\n this.param);\n\n // non-root node (path is non-empty)\n if (this.param.varArgs) {\n if (this.param.anyType) {\n // variable arguments with any type\n code.push(prefix + 'if (arguments.length > ' + index + ') {');\n code.push(prefix + ' var varArgs = [];');\n code.push(prefix + ' for (var i = ' + index + '; i < arguments.length; i++) {');\n code.push(prefix + ' varArgs.push(arguments[i]);');\n code.push(prefix + ' }');\n code.push(this.signature.toCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n else {\n // variable arguments with a fixed type\n var getTests = function (types, arg) {\n var tests = [];\n for (var i = 0; i < types.length; i++) {\n tests[i] = refs.add(getTypeTest(types[i]), 'test') + '(' + arg + ')';\n }\n return tests.join(' || ');\n }.bind(this);\n\n var allTypes = this.param.types;\n var exactTypes = [];\n for (var i = 0; i < allTypes.length; i++) {\n if (this.param.conversions[i] === undefined) {\n exactTypes.push(allTypes[i]);\n }\n }\n\n code.push(prefix + 'if (' + getTests(allTypes, 'arg' + index) + ') { ' + comment);\n code.push(prefix + ' var varArgs = [arg' + index + '];');\n code.push(prefix + ' for (var i = ' + (index + 1) + '; i < arguments.length; i++) {');\n code.push(prefix + ' if (' + getTests(exactTypes, 'arguments[i]') + ') {');\n code.push(prefix + ' varArgs.push(arguments[i]);');\n\n for (var i = 0; i < allTypes.length; i++) {\n var conversion_i = this.param.conversions[i];\n if (conversion_i) {\n var test = refs.add(getTypeTest(allTypes[i]), 'test');\n var convert = refs.add(conversion_i.convert, 'convert');\n code.push(prefix + ' }');\n code.push(prefix + ' else if (' + test + '(arguments[i])) {');\n code.push(prefix + ' varArgs.push(' + convert + '(arguments[i]));');\n }\n }\n code.push(prefix + ' } else {');\n code.push(prefix + ' throw createError(name, arguments.length, i, arguments[i], \\'' + exactTypes.join(',') + '\\');');\n code.push(prefix + ' }');\n code.push(prefix + ' }');\n code.push(this.signature.toCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n }\n else {\n if (this.param.anyType) {\n // any type\n code.push(prefix + '// type: any');\n code.push(this._innerCode(refs, prefix));\n }\n else {\n // regular type\n var type = this.param.types[0];\n var test = type !== 'any' ? refs.add(getTypeTest(type), 'test') : null;\n\n code.push(prefix + 'if (' + test + '(arg' + index + ')) { ' + comment);\n code.push(this._innerCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n }\n }\n else {\n // root node (path is empty)\n code.push(this._innerCode(refs, prefix));\n }\n\n return code.join('\\n');\n };\n\n /**\n * Generate inner code for this group of signatures.\n * This is a helper function of Node.prototype.toCode\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns the inner code as string\n * @private\n */\n Node.prototype._innerCode = function (refs, prefix) {\n var code = [];\n var i;\n\n if (this.signature) {\n code.push(prefix + 'if (arguments.length === ' + this.path.length + ') {');\n code.push(this.signature.toCode(refs, prefix + ' '));\n code.push(prefix + '}');\n }\n\n for (i = 0; i < this.childs.length; i++) {\n code.push(this.childs[i].toCode(refs, prefix));\n }\n\n // TODO: shouldn't the this.param.anyType check be redundant\n if (!this.fallThrough || (this.param && this.param.anyType)) {\n var exceptions = this._exceptions(refs, prefix);\n if (exceptions) {\n code.push(exceptions);\n }\n }\n\n return code.join('\\n');\n };\n\n\n /**\n * Generate code to throw exceptions\n * @param {Refs} refs\n * @param {string} prefix\n * @returns {string} Returns the inner code as string\n * @private\n */\n Node.prototype._exceptions = function (refs, prefix) {\n var index = this.path.length;\n\n if (this.childs.length === 0) {\n // TODO: can this condition be simplified? (we have a fall-through here)\n return [\n prefix + 'if (arguments.length > ' + index + ') {',\n prefix + ' throw createError(name, arguments.length, ' + index + ', arguments[' + index + ']);',\n prefix + '}'\n ].join('\\n');\n }\n else {\n var keys = {};\n var types = [];\n\n for (var i = 0; i < this.childs.length; i++) {\n var node = this.childs[i];\n if (node.param) {\n for (var j = 0; j < node.param.types.length; j++) {\n var type = node.param.types[j];\n if (!(type in keys) && !node.param.conversions[j]) {\n keys[type] = true;\n types.push(type);\n }\n }\n }\n }\n\n return prefix + 'throw createError(name, arguments.length, ' + index + ', arguments[' + index + '], \\'' + types.join(',') + '\\');';\n }\n };\n\n /**\n * Split all raw signatures into an array with expanded Signatures\n * @param {Object.<string, Function>} rawSignatures\n * @return {Signature[]} Returns an array with expanded signatures\n */\n function parseSignatures(rawSignatures) {\n // FIXME: need to have deterministic ordering of signatures, do not create via object\n var signature;\n var keys = {};\n var signatures = [];\n var i;\n\n for (var types in rawSignatures) {\n if (rawSignatures.hasOwnProperty(types)) {\n var fn = rawSignatures[types];\n signature = new Signature(types, fn);\n\n if (signature.ignore()) {\n continue;\n }\n\n var expanded = signature.expand();\n\n for (i = 0; i < expanded.length; i++) {\n var signature_i = expanded[i];\n var key = signature_i.toString();\n var existing = keys[key];\n if (!existing) {\n keys[key] = signature_i;\n }\n else {\n var cmp = Signature.compare(signature_i, existing);\n if (cmp < 0) {\n // override if sorted first\n keys[key] = signature_i;\n }\n else if (cmp === 0) {\n throw new Error('Signature \"' + key + '\" is defined twice');\n }\n // else: just ignore\n }\n }\n }\n }\n\n // convert from map to array\n for (key in keys) {\n if (keys.hasOwnProperty(key)) {\n signatures.push(keys[key]);\n }\n }\n\n // order the signatures\n signatures.sort(function (a, b) {\n return Signature.compare(a, b);\n });\n\n // filter redundant conversions from signatures with varArgs\n // TODO: simplify this loop or move it to a separate function\n for (i = 0; i < signatures.length; i++) {\n signature = signatures[i];\n\n if (signature.varArgs) {\n var index = signature.params.length - 1;\n var param = signature.params[index];\n\n var t = 0;\n while (t < param.types.length) {\n if (param.conversions[t]) {\n var type = param.types[t];\n\n for (var j = 0; j < signatures.length; j++) {\n var other = signatures[j];\n var p = other.params[index];\n\n if (other !== signature &&\n p &&\n contains(p.types, type) && !p.conversions[index]) {\n // this (conversion) type already exists, remove it\n param.types.splice(t, 1);\n param.conversions.splice(t, 1);\n t--;\n break;\n }\n }\n }\n t++;\n }\n }\n }\n\n return signatures;\n }\n\n /**\n * Filter all any type signatures\n * @param {Signature[]} signatures\n * @return {Signature[]} Returns only any type signatures\n */\n function filterAnyTypeSignatures (signatures) {\n var filtered = [];\n\n for (var i = 0; i < signatures.length; i++) {\n if (signatures[i].anyType) {\n filtered.push(signatures[i]);\n }\n }\n\n return filtered;\n }\n\n /**\n * create a map with normalized signatures as key and the function as value\n * @param {Signature[]} signatures An array with split signatures\n * @return {Object.<string, Function>} Returns a map with normalized\n * signatures as key, and the function\n * as value.\n */\n function mapSignatures(signatures) {\n var normalized = {};\n\n for (var i = 0; i < signatures.length; i++) {\n var signature = signatures[i];\n if (signature.fn && !signature.hasConversions()) {\n var params = signature.params.join(',');\n normalized[params] = signature.fn;\n }\n }\n\n return normalized;\n }\n\n /**\n * Parse signatures recursively in a node tree.\n * @param {Signature[]} signatures Array with expanded signatures\n * @param {Param[]} path Traversed path of parameter types\n * @param {Signature[]} anys\n * @return {Node} Returns a node tree\n */\n function parseTree(signatures, path, anys) {\n var i, signature;\n var index = path.length;\n var nodeSignature;\n\n var filtered = [];\n for (i = 0; i < signatures.length; i++) {\n signature = signatures[i];\n\n // filter the first signature with the correct number of params\n if (signature.params.length === index && !nodeSignature) {\n nodeSignature = signature;\n }\n\n if (signature.params[index] != undefined) {\n filtered.push(signature);\n }\n }\n\n // sort the filtered signatures by param\n filtered.sort(function (a, b) {\n return Param.compare(a.params[index], b.params[index]);\n });\n\n // recurse over the signatures\n var entries = [];\n for (i = 0; i < filtered.length; i++) {\n signature = filtered[i];\n // group signatures with the same param at current index\n var param = signature.params[index];\n\n // TODO: replace the next filter loop\n var existing = entries.filter(function (entry) {\n return entry.param.overlapping(param);\n })[0];\n\n //var existing;\n //for (var j = 0; j < entries.length; j++) {\n // if (entries[j].param.overlapping(param)) {\n // existing = entries[j];\n // break;\n // }\n //}\n\n if (existing) {\n if (existing.param.varArgs) {\n throw new Error('Conflicting types \"' + existing.param + '\" and \"' + param + '\"');\n }\n existing.signatures.push(signature);\n }\n else {\n entries.push({\n param: param,\n signatures: [signature]\n });\n }\n }\n\n // find all any type signature that can still match our current path\n var matchingAnys = [];\n for (i = 0; i < anys.length; i++) {\n if (anys[i].paramsStartWith(path)) {\n matchingAnys.push(anys[i]);\n }\n }\n\n // see if there are any type signatures that don't match any of the\n // signatures that we have in our tree, i.e. we have alternative\n // matching signature(s) outside of our current tree and we should\n // fall through to them instead of throwing an exception\n var fallThrough = false;\n for (i = 0; i < matchingAnys.length; i++) {\n if (!contains(signatures, matchingAnys[i])) {\n fallThrough = true;\n break;\n }\n }\n\n // parse the childs\n var childs = new Array(entries.length);\n for (i = 0; i < entries.length; i++) {\n var entry = entries[i];\n childs[i] = parseTree(entry.signatures, path.concat(entry.param), matchingAnys)\n }\n\n return new Node(path, nodeSignature, childs, fallThrough);\n }\n\n /**\n * Generate an array like ['arg0', 'arg1', 'arg2']\n * @param {number} count Number of arguments to generate\n * @returns {Array} Returns an array with argument names\n */\n function getArgs(count) {\n // create an array with all argument names\n var args = [];\n for (var i = 0; i < count; i++) {\n args[i] = 'arg' + i;\n }\n\n return args;\n }\n\n /**\n * Compose a function from sub-functions each handling a single type signature.\n * Signatures:\n * typed(signature: string, fn: function)\n * typed(name: string, signature: string, fn: function)\n * typed(signatures: Object.<string, function>)\n * typed(name: string, signatures: Object.<string, function>)\n *\n * @param {string | null} name\n * @param {Object.<string, Function>} signatures\n * @return {Function} Returns the typed function\n * @private\n */\n function _typed(name, signatures) {\n var refs = new Refs();\n\n // parse signatures, expand them\n var _signatures = parseSignatures(signatures);\n if (_signatures.length == 0) {\n throw new Error('No signatures provided');\n }\n\n // filter all any type signatures\n var anys = filterAnyTypeSignatures(_signatures);\n\n // parse signatures into a node tree\n var node = parseTree(_signatures, [], anys);\n\n //var util = require('util');\n //console.log('ROOT');\n //console.log(util.inspect(node, { depth: null }));\n\n // generate code for the typed function\n // safeName is a conservative replacement of characters \n // to prevend being able to inject JS code at the place of the function name \n // the name is useful for stack trackes therefore we want have it there\n var code = [];\n var safeName = (name || '').replace(/[^a-zA-Z0-9_$]/g, '_')\n var args = getArgs(maxParams(_signatures));\n code.push('function ' + safeName + '(' + args.join(', ') + ') {');\n code.push(' \"use strict\";');\n code.push(' var name = ' + JSON.stringify(name || '') + ';');\n code.push(node.toCode(refs, ' ', false));\n code.push('}');\n\n // generate body for the factory function\n var body = [\n refs.toCode(),\n 'return ' + code.join('\\n')\n ].join('\\n');\n\n // evaluate the JavaScript code and attach function references\n var factory = (new Function(refs.name, 'createError', body));\n var fn = factory(refs, createError);\n\n //console.log('FN\\n' + fn.toString()); // TODO: cleanup\n\n // attach the signatures with sub-functions to the constructed function\n fn.signatures = mapSignatures(_signatures);\n\n return fn;\n }\n\n /**\n * Calculate the maximum number of parameters in givens signatures\n * @param {Signature[]} signatures\n * @returns {number} The maximum number of parameters\n */\n function maxParams(signatures) {\n var max = 0;\n\n for (var i = 0; i < signatures.length; i++) {\n var len = signatures[i].params.length;\n if (len > max) {\n max = len;\n }\n }\n\n return max;\n }\n\n /**\n * Get the type of a value\n * @param {*} x\n * @returns {string} Returns a string with the type of value\n */\n function getTypeOf(x) {\n var obj;\n\n for (var i = 0; i < typed.types.length; i++) {\n var entry = typed.types[i];\n\n if (entry.name === 'Object') {\n // Array and Date are also Object, so test for Object afterwards\n obj = entry;\n }\n else {\n if (entry.test(x)) return entry.name;\n }\n }\n\n // at last, test whether an object\n if (obj && obj.test(x)) return obj.name;\n\n return 'unknown';\n }\n\n /**\n * Test whether an array contains some item\n * @param {Array} array\n * @param {*} item\n * @return {boolean} Returns true if array contains item, false if not.\n */\n function contains(array, item) {\n return array.indexOf(item) !== -1;\n }\n\n /**\n * Returns the last item in the array\n * @param {Array} array\n * @return {*} item\n */\n function last (array) {\n return array[array.length - 1];\n }\n\n // data type tests\n var types = [\n { name: 'number', test: function (x) { return typeof x === 'number' } },\n { name: 'string', test: function (x) { return typeof x === 'string' } },\n { name: 'boolean', test: function (x) { return typeof x === 'boolean' } },\n { name: 'Function', test: function (x) { return typeof x === 'function'} },\n { name: 'Array', test: Array.isArray },\n { name: 'Date', test: function (x) { return x instanceof Date } },\n { name: 'RegExp', test: function (x) { return x instanceof RegExp } },\n { name: 'Object', test: function (x) { return typeof x === 'object' } },\n { name: 'null', test: function (x) { return x === null } },\n { name: 'undefined', test: function (x) { return x === undefined } }\n ];\n\n // configuration\n var config = {};\n\n // type conversions. Order is important\n var conversions = [];\n\n // types to be ignored\n var ignore = [];\n\n // temporary object for holding types and conversions, for constructing\n // the `typed` function itself\n // TODO: find a more elegant solution for this\n var typed = {\n config: config,\n types: types,\n conversions: conversions,\n ignore: ignore\n };\n\n /**\n * Construct the typed function itself with various signatures\n *\n * Signatures:\n *\n * typed(signatures: Object.<string, function>)\n * typed(name: string, signatures: Object.<string, function>)\n */\n typed = _typed('typed', {\n 'Object': function (signatures) {\n var fns = [];\n for (var signature in signatures) {\n if (signatures.hasOwnProperty(signature)) {\n fns.push(signatures[signature]);\n }\n }\n var name = getName(fns);\n\n return _typed(name, signatures);\n },\n 'string, Object': _typed,\n // TODO: add a signature 'Array.<function>'\n '...Function': function (fns) {\n var err;\n var name = getName(fns);\n var signatures = {};\n\n for (var i = 0; i < fns.length; i++) {\n var fn = fns[i];\n\n // test whether this is a typed-function\n if (!(typeof fn.signatures === 'object')) {\n err = new TypeError('Function is no typed-function (index: ' + i + ')');\n err.data = {index: i};\n throw err;\n }\n\n // merge the signatures\n for (var signature in fn.signatures) {\n if (fn.signatures.hasOwnProperty(signature)) {\n if (signatures.hasOwnProperty(signature)) {\n if (fn.signatures[signature] !== signatures[signature]) {\n err = new Error('Signature \"' + signature + '\" is defined twice');\n err.data = {signature: signature};\n throw err;\n }\n // else: both signatures point to the same function, that's fine\n }\n else {\n signatures[signature] = fn.signatures[signature];\n }\n }\n }\n }\n\n return _typed(name, signatures);\n }\n });\n\n /**\n * Find a specific signature from a (composed) typed function, for\n * example:\n *\n * typed.find(fn, ['number', 'string'])\n * typed.find(fn, 'number, string')\n *\n * Function find only only works for exact matches.\n *\n * @param {Function} fn A typed-function\n * @param {string | string[]} signature Signature to be found, can be\n * an array or a comma separated string.\n * @return {Function} Returns the matching signature, or\n * throws an errror when no signature\n * is found.\n */\n function find (fn, signature) {\n if (!fn.signatures) {\n throw new TypeError('Function is no typed-function');\n }\n\n // normalize input\n var arr;\n if (typeof signature === 'string') {\n arr = signature.split(',');\n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i].trim();\n }\n }\n else if (Array.isArray(signature)) {\n arr = signature;\n }\n else {\n throw new TypeError('String array or a comma separated string expected');\n }\n\n var str = arr.join(',');\n\n // find an exact match\n var match = fn.signatures[str];\n if (match) {\n return match;\n }\n\n // TODO: extend find to match non-exact signatures\n\n throw new TypeError('Signature not found (signature: ' + (fn.name || 'unnamed') + '(' + arr.join(', ') + '))');\n }\n\n /**\n * Convert a given value to another data type.\n * @param {*} value\n * @param {string} type\n */\n function convert (value, type) {\n var from = getTypeOf(value);\n\n // check conversion is needed\n if (type === from) {\n return value;\n }\n\n for (var i = 0; i < typed.conversions.length; i++) {\n var conversion = typed.conversions[i];\n if (conversion.from === from && conversion.to === type) {\n return conversion.convert(value);\n }\n }\n\n throw new Error('Cannot convert from ' + from + ' to ' + type);\n }\n\n // attach types and conversions to the final `typed` function\n typed.config = config;\n typed.types = types;\n typed.conversions = conversions;\n typed.ignore = ignore;\n typed.create = create;\n typed.find = find;\n typed.convert = convert;\n\n // add a type\n typed.addType = function (type) {\n if (!type || typeof type.name !== 'string' || typeof type.test !== 'function') {\n throw new TypeError('Object with properties {name: string, test: function} expected');\n }\n\n typed.types.push(type);\n };\n\n // add a conversion\n typed.addConversion = function (conversion) {\n if (!conversion\n || typeof conversion.from !== 'string'\n || typeof conversion.to !== 'string'\n || typeof conversion.convert !== 'function') {\n throw new TypeError('Object with properties {from: string, to: string, convert: function} expected');\n }\n\n typed.conversions.push(conversion);\n };\n\n return typed;\n }", "function buildType(type) {\n switch (type.kind) {\n case _introspection.TypeKind.SCALAR:\n return buildScalarDef(type);\n case _introspection.TypeKind.OBJECT:\n return buildObjectDef(type);\n case _introspection.TypeKind.INTERFACE:\n return buildInterfaceDef(type);\n case _introspection.TypeKind.UNION:\n return buildUnionDef(type);\n case _introspection.TypeKind.ENUM:\n return buildEnumDef(type);\n case _introspection.TypeKind.INPUT_OBJECT:\n return buildInputObjectDef(type);\n default:\n throw new Error('Invalid or incomplete schema, unknown kind: ' + type.kind + '. Ensure ' + 'that a full introspection query is used in order to build a ' + 'client schema.');\n }\n }", "function buildType(type) {\n switch (type.kind) {\n case _introspection.TypeKind.SCALAR:\n return buildScalarDef(type);\n case _introspection.TypeKind.OBJECT:\n return buildObjectDef(type);\n case _introspection.TypeKind.INTERFACE:\n return buildInterfaceDef(type);\n case _introspection.TypeKind.UNION:\n return buildUnionDef(type);\n case _introspection.TypeKind.ENUM:\n return buildEnumDef(type);\n case _introspection.TypeKind.INPUT_OBJECT:\n return buildInputObjectDef(type);\n default:\n throw new Error('Invalid or incomplete schema, unknown kind: ' + type.kind + '. Ensure ' + 'that a full introspection query is used in order to build a ' + 'client schema.');\n }\n }", "async function createNewContract() {\n var deploy = await LANDMARK.new()\n LANDMARK_instance = LANDMARK.at(deploy.address);\n}", "function build_jsonrpc_body(type, func, args, chaincode_hash, enrollId){\n\treturn \t{\n\t\t\t\t\t'jsonrpc': '2.0',\n\t\t\t\t\t'method': type,\n\t\t\t\t\t'params': {\n\t\t\t\t\t\t'type': 1,\n\t\t\t\t\t\t'chaincodeID': {\n\t\t\t\t\t\t\t'name': chaincode_hash\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'ctorMsg': {\n\t\t\t\t\t\t\t'function': func,\n\t\t\t\t\t\t\t\t'args': args\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'secureContext': enrollId\n\t\t\t\t\t},\n\t\t\t\t\t'id': Date.now()\n\t\t\t\t};\n}", "type() { }", "function tryGetCustomObjectType(input){if(input.constructor){var funcNameRegex=/function\\s+([^\\s(]+)\\s*\\(/;var results=funcNameRegex.exec(input.constructor.toString());if(results&&results.length>1){return results[1];}}return null;}", "function buildType(type) {\n\t switch (type.kind) {\n\t case _introspection.TypeKind.SCALAR:\n\t return buildScalarDef(type);\n\t case _introspection.TypeKind.OBJECT:\n\t return buildObjectDef(type);\n\t case _introspection.TypeKind.INTERFACE:\n\t return buildInterfaceDef(type);\n\t case _introspection.TypeKind.UNION:\n\t return buildUnionDef(type);\n\t case _introspection.TypeKind.ENUM:\n\t return buildEnumDef(type);\n\t case _introspection.TypeKind.INPUT_OBJECT:\n\t return buildInputObjectDef(type);\n\t default:\n\t throw new Error('Invalid or incomplete schema, unknown kind: ' + type.kind + '. Ensure ' + 'that a full introspection query is used in order to build a ' + 'client schema.');\n\t }\n\t }", "function buildType(type) {\n switch (type.kind) {\n case _typeIntrospection.TypeKind.SCALAR:\n return buildScalarDef(type);\n case _typeIntrospection.TypeKind.OBJECT:\n return buildObjectDef(type);\n case _typeIntrospection.TypeKind.INTERFACE:\n return buildInterfaceDef(type);\n case _typeIntrospection.TypeKind.UNION:\n return buildUnionDef(type);\n case _typeIntrospection.TypeKind.ENUM:\n return buildEnumDef(type);\n case _typeIntrospection.TypeKind.INPUT_OBJECT:\n return buildInputObjectDef(type);\n default:\n throw new Error('Invalid or incomplete schema, unknown kind: ' + type.kind + '. Ensure ' + 'that a full introspection query is used in order to build a ' + 'client schema.');\n }\n }", "static initialize(obj, contractStateType) { \n obj['contractStateType'] = contractStateType;\n }", "function buildType(type) {\n\t switch (type.kind) {\n\t case _typeIntrospection.TypeKind.SCALAR:\n\t return buildScalarDef(type);\n\t case _typeIntrospection.TypeKind.OBJECT:\n\t return buildObjectDef(type);\n\t case _typeIntrospection.TypeKind.INTERFACE:\n\t return buildInterfaceDef(type);\n\t case _typeIntrospection.TypeKind.UNION:\n\t return buildUnionDef(type);\n\t case _typeIntrospection.TypeKind.ENUM:\n\t return buildEnumDef(type);\n\t case _typeIntrospection.TypeKind.INPUT_OBJECT:\n\t return buildInputObjectDef(type);\n\t default:\n\t throw new Error('Invalid or incomplete schema, unknown kind: ' + type.kind + '. Ensure ' + 'that a full introspection query is used in order to build a ' + 'client schema.');\n\t }\n\t }", "function Contract(contract) {\n var self = this;\n var constructor = this.constructor;\n this.abi = constructor.abi;\n\n if (typeof contract == \"string\") {\n var address = contract;\n var contract_class = constructor.web3.eth.contract(this.abi);\n contract = contract_class.at(address);\n }\n\n this.contract = contract;\n\n // Provision our functions.\n for (var i = 0; i < this.abi.length; i++) {\n var item = this.abi[i];\n if (item.type == \"function\") {\n if (item.constant == true) {\n this[item.name] = Utils.promisifyFunction(contract[item.name], constructor);\n } else {\n this[item.name] = Utils.synchronizeFunction(contract[item.name], this, constructor);\n }\n\n this[item.name].call = Utils.promisifyFunction(contract[item.name].call, constructor);\n this[item.name].sendTransaction = Utils.promisifyFunction(contract[item.name].sendTransaction, constructor);\n this[item.name].request = contract[item.name].request;\n this[item.name].estimateGas = Utils.promisifyFunction(contract[item.name].estimateGas, constructor);\n }\n\n if (item.type == \"event\") {\n this[item.name] = contract[item.name];\n }\n }\n\n this.sendTransaction = Utils.synchronizeFunction(function(tx_params, callback) {\n if (typeof tx_params == \"function\") {\n callback = tx_params;\n tx_params = {};\n }\n\n tx_params.to = self.address;\n\n constructor.web3.eth.sendTransaction.apply(constructor.web3.eth, [tx_params, callback]);\n }, this, constructor);\n\n this.send = function(value) {\n return self.sendTransaction({value: value});\n };\n\n this.allEvents = contract.allEvents;\n this.address = contract.address;\n this.transactionHash = contract.transactionHash;\n }", "function Contract(contract) {\n var self = this;\n var constructor = this.constructor;\n this.abi = constructor.abi;\n\n if (typeof contract == \"string\") {\n var address = contract;\n var contract_class = constructor.web3.eth.contract(this.abi);\n contract = contract_class.at(address);\n }\n\n this.contract = contract;\n\n // Provision our functions.\n for (var i = 0; i < this.abi.length; i++) {\n var item = this.abi[i];\n if (item.type == \"function\") {\n if (item.constant == true) {\n this[item.name] = Utils.promisifyFunction(contract[item.name], constructor);\n } else {\n this[item.name] = Utils.synchronizeFunction(contract[item.name], this, constructor);\n }\n\n this[item.name].call = Utils.promisifyFunction(contract[item.name].call, constructor);\n this[item.name].sendTransaction = Utils.promisifyFunction(contract[item.name].sendTransaction, constructor);\n this[item.name].request = contract[item.name].request;\n this[item.name].estimateGas = Utils.promisifyFunction(contract[item.name].estimateGas, constructor);\n }\n\n if (item.type == \"event\") {\n this[item.name] = contract[item.name];\n }\n }\n\n this.sendTransaction = Utils.synchronizeFunction(function(tx_params, callback) {\n if (typeof tx_params == \"function\") {\n callback = tx_params;\n tx_params = {};\n }\n\n tx_params.to = self.address;\n\n constructor.web3.eth.sendTransaction.apply(constructor.web3.eth, [tx_params, callback]);\n }, this, constructor);\n\n this.send = function(value) {\n return self.sendTransaction({value: value});\n };\n\n this.allEvents = contract.allEvents;\n this.address = contract.address;\n this.transactionHash = contract.transactionHash;\n }", "function Contract(contract) {\n var self = this;\n var constructor = this.constructor;\n this.abi = constructor.abi;\n\n if (typeof contract == \"string\") {\n var address = contract;\n var contract_class = constructor.web3.eth.contract(this.abi);\n contract = contract_class.at(address);\n }\n\n this.contract = contract;\n\n // Provision our functions.\n for (var i = 0; i < this.abi.length; i++) {\n var item = this.abi[i];\n if (item.type == \"function\") {\n if (item.constant == true) {\n this[item.name] = Utils.promisifyFunction(contract[item.name], constructor);\n } else {\n this[item.name] = Utils.synchronizeFunction(contract[item.name], this, constructor);\n }\n\n this[item.name].call = Utils.promisifyFunction(contract[item.name].call, constructor);\n this[item.name].sendTransaction = Utils.promisifyFunction(contract[item.name].sendTransaction, constructor);\n this[item.name].request = contract[item.name].request;\n this[item.name].estimateGas = Utils.promisifyFunction(contract[item.name].estimateGas, constructor);\n }\n\n if (item.type == \"event\") {\n this[item.name] = contract[item.name];\n }\n }\n\n this.sendTransaction = Utils.synchronizeFunction(function(tx_params, callback) {\n if (typeof tx_params == \"function\") {\n callback = tx_params;\n tx_params = {};\n }\n\n tx_params.to = self.address;\n\n constructor.web3.eth.sendTransaction.apply(constructor.web3.eth, [tx_params, callback]);\n }, this, constructor);\n\n this.send = function(value) {\n return self.sendTransaction({value: value});\n };\n\n this.allEvents = contract.allEvents;\n this.address = contract.address;\n this.transactionHash = contract.transactionHash;\n }", "function Contract(contract) {\n var self = this;\n var constructor = this.constructor;\n this.abi = constructor.abi;\n\n if (typeof contract == \"string\") {\n var address = contract;\n var contract_class = constructor.web3.eth.contract(this.abi);\n contract = contract_class.at(address);\n }\n\n this.contract = contract;\n\n // Provision our functions.\n for (var i = 0; i < this.abi.length; i++) {\n var item = this.abi[i];\n if (item.type == \"function\") {\n if (item.constant == true) {\n this[item.name] = Utils.promisifyFunction(contract[item.name], constructor);\n } else {\n this[item.name] = Utils.synchronizeFunction(contract[item.name], this, constructor);\n }\n\n this[item.name].call = Utils.promisifyFunction(contract[item.name].call, constructor);\n this[item.name].sendTransaction = Utils.promisifyFunction(contract[item.name].sendTransaction, constructor);\n this[item.name].request = contract[item.name].request;\n this[item.name].estimateGas = Utils.promisifyFunction(contract[item.name].estimateGas, constructor);\n }\n\n if (item.type == \"event\") {\n this[item.name] = contract[item.name];\n }\n }\n\n this.sendTransaction = Utils.synchronizeFunction(function(tx_params, callback) {\n if (typeof tx_params == \"function\") {\n callback = tx_params;\n tx_params = {};\n }\n\n tx_params.to = self.address;\n\n constructor.web3.eth.sendTransaction.apply(constructor.web3.eth, [tx_params, callback]);\n }, this, constructor);\n\n this.send = function(value) {\n return self.sendTransaction({value: value});\n };\n\n this.allEvents = contract.allEvents;\n this.address = contract.address;\n this.transactionHash = contract.transactionHash;\n }", "function contract_create(request, response, next) {\n console.log('Contract create');\n}", "function createData(params) {\n\t var solidityFunction = new _function2.default('', (0, _find3.default)(params.contractObject ? params.contractObject.abi : contract, { name: params.function }), '');\n\t return solidityFunction.toPayload(params.payload).data;\n\t}", "function CreateIDEObjectType()\r\n{\r\n\treturn new IDEObjectType();\r\n}", "async function compileScript(type) {\n\n //SriptBUilding Tools\n const sb = new ScriptBuilder();\n\n switch (type) {\n case 'transaction':\n\n //Gas Stuff for transaction fees\n const minimumFee = '100000';\n const gasLimit = '900';\n\n //Builds Script \n scriptConfig.compiledScript = sb\n .callContract('gas', 'AllowGas', [link.account.address, sb.nullAddress(), minimumFee, gasLimit]) //Just for good measure (optional)\n .callContract(scriptConfig.contractName, scriptConfig.methodName, scriptConfig.inputArguments) //The Meat of the Script\n .callContract('gas', 'SpendGas', [link.account.address]) //Just for good measure (optional)\n .endScript();\n\n break;\n\n case 'invoke':\n \n //Builds Script\n scriptConfig.compiledScript = sb\n .callContract(scriptConfig.contractName, scriptConfig.methodName, scriptConfig.inputArguments) //The Meat of the Script\n .endScript();\n\n break;\n }\n\n}", "function Type(typeFunction, options) {\n if (options === void 0) { options = {}; }\n return function (target, propertyName) {\n var reflectedType = Reflect.getMetadata('design:type', target, propertyName);\n defaultMetadataStorage.addTypeMetadata({\n target: target.constructor,\n propertyName: propertyName,\n reflectedType: reflectedType,\n typeFunction: typeFunction,\n options: options,\n });\n };\n}", "async instantiate(ctx) {\n console.log(\"Smart Contract Instantiated\");\n }", "function loadContract(){\n // we know the abi of the contract\n var abriStr = '[ { \"constant\": false, \"inputs\": [ { \"name\": \"newSellPrice\", \"type\": \"uint256\" }, { \"name\": \"newBuyPrice\", \"type\": \"uint256\" } ], \"name\": \"setPrices\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"name\", \"outputs\": [ { \"name\": \"\", \"type\": \"string\", \"value\": \"Rodrigo\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"_spender\", \"type\": \"address\" }, { \"name\": \"_value\", \"type\": \"uint256\" } ], \"name\": \"approve\", \"outputs\": [ { \"name\": \"success\", \"type\": \"bool\" } ], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [ { \"name\": \"\", \"type\": \"address\" } ], \"name\": \"fabricBalanceOf\", \"outputs\": [ { \"name\": \"\", \"type\": \"uint256\", \"value\": \"0\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"totalSupply\", \"outputs\": [ { \"name\": \"\", \"type\": \"uint256\", \"value\": \"2e+24\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"_from\", \"type\": \"address\" }, { \"name\": \"_to\", \"type\": \"address\" }, { \"name\": \"_value\", \"type\": \"uint256\" } ], \"name\": \"transferFrom\", \"outputs\": [ { \"name\": \"success\", \"type\": \"bool\" } ], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"decimals\", \"outputs\": [ { \"name\": \"\", \"type\": \"uint8\", \"value\": \"18\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"_value\", \"type\": \"uint256\" } ], \"name\": \"burn\", \"outputs\": [ { \"name\": \"success\", \"type\": \"bool\" } ], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"sellPrice\", \"outputs\": [ { \"name\": \"\", \"type\": \"uint256\", \"value\": \"0\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [ { \"name\": \"\", \"type\": \"address\" } ], \"name\": \"balanceOf\", \"outputs\": [ { \"name\": \"\", \"type\": \"uint256\", \"value\": \"0\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"target\", \"type\": \"address\" }, { \"name\": \"mintedAmount\", \"type\": \"uint256\" } ], \"name\": \"mintToken\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"_from\", \"type\": \"address\" }, { \"name\": \"_value\", \"type\": \"uint256\" } ], \"name\": \"burnFrom\", \"outputs\": [ { \"name\": \"success\", \"type\": \"bool\" } ], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"buyPrice\", \"outputs\": [ { \"name\": \"\", \"type\": \"uint256\", \"value\": \"0\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"owner\", \"outputs\": [ { \"name\": \"\", \"type\": \"address\", \"value\": \"0x567ec4d3a5506e76066bb6999474c48f810dc2f3\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [], \"name\": \"symbol\", \"outputs\": [ { \"name\": \"\", \"type\": \"string\", \"value\": \"rod\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [], \"name\": \"buy\", \"outputs\": [], \"payable\": true, \"stateMutability\": \"payable\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"_to\", \"type\": \"address\" }, { \"name\": \"_value\", \"type\": \"uint256\" } ], \"name\": \"transfer\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [ { \"name\": \"\", \"type\": \"address\" } ], \"name\": \"frozenAccount\", \"outputs\": [ { \"name\": \"\", \"type\": \"bool\", \"value\": false } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"_spender\", \"type\": \"address\" }, { \"name\": \"_value\", \"type\": \"uint256\" }, { \"name\": \"_extraData\", \"type\": \"bytes\" } ], \"name\": \"approveAndCall\", \"outputs\": [ { \"name\": \"success\", \"type\": \"bool\" } ], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"_number\", \"type\": \"uint8\" } ], \"name\": \"setFabricRequiredSignatures\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": true, \"inputs\": [ { \"name\": \"\", \"type\": \"address\" }, { \"name\": \"\", \"type\": \"address\" } ], \"name\": \"allowance\", \"outputs\": [ { \"name\": \"\", \"type\": \"uint256\", \"value\": \"0\" } ], \"payable\": false, \"stateMutability\": \"view\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"amount\", \"type\": \"uint256\" } ], \"name\": \"sell\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"from\", \"type\": \"address\" }, { \"name\": \"value\", \"type\": \"uint256\" } ], \"name\": \"fabricTransfer\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"target\", \"type\": \"address\" }, { \"name\": \"freeze\", \"type\": \"bool\" } ], \"name\": \"freezeAccount\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"constant\": false, \"inputs\": [ { \"name\": \"newOwner\", \"type\": \"address\" } ], \"name\": \"transferOwnership\", \"outputs\": [], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"function\" }, { \"inputs\": [ { \"name\": \"initialSupply\", \"type\": \"uint256\", \"index\": 0, \"typeShort\": \"uint\", \"bits\": \"256\", \"displayName\": \"initial Supply\", \"template\": \"elements_input_uint\", \"value\": \"2000000\" }, { \"name\": \"tokenName\", \"type\": \"string\", \"index\": 1, \"typeShort\": \"string\", \"bits\": \"\", \"displayName\": \"token Name\", \"template\": \"elements_input_string\", \"value\": \"Rodrigo\" }, { \"name\": \"tokenSymbol\", \"type\": \"string\", \"index\": 2, \"typeShort\": \"string\", \"bits\": \"\", \"displayName\": \"token Symbol\", \"template\": \"elements_input_string\", \"value\": \"rod\" }, { \"name\": \"_fabricRequiredSignatures\", \"type\": \"uint8\", \"index\": 3, \"typeShort\": \"uint\", \"bits\": \"8\", \"displayName\": \"&thinsp;<span class=\\\\\"punctuation\\\\\">_</span>&thinsp;fabric Required Signatures\", \"template\": \"elements_input_uint\", \"value\": \"2\" } ], \"payable\": false, \"stateMutability\": \"nonpayable\", \"type\": \"constructor\" }, { \"anonymous\": false, \"inputs\": [ { \"indexed\": false, \"name\": \"owner\", \"type\": \"address\" }, { \"indexed\": false, \"name\": \"value\", \"type\": \"uint256\" } ], \"name\": \"FabricTransfer\", \"type\": \"event\" }, { \"anonymous\": false, \"inputs\": [ { \"indexed\": false, \"name\": \"target\", \"type\": \"address\" }, { \"indexed\": false, \"name\": \"frozen\", \"type\": \"bool\" } ], \"name\": \"FrozenFunds\", \"type\": \"event\" }, { \"anonymous\": false, \"inputs\": [ { \"indexed\": true, \"name\": \"from\", \"type\": \"address\" }, { \"indexed\": false, \"name\": \"value\", \"type\": \"uint256\" } ], \"name\": \"Burn\", \"type\": \"event\" }, { \"anonymous\": false, \"inputs\": [ { \"indexed\": true, \"name\": \"from\", \"type\": \"address\" }, { \"indexed\": true, \"name\": \"to\", \"type\": \"address\" }, { \"indexed\": false, \"name\": \"value\", \"type\": \"uint256\" } ], \"name\": \"Transfer\", \"type\": \"event\" } ]';\n var abi = JSON.parse(abriStr);\n var contract = web3.eth.contract(abi);\n\n // we know the address of the contract\n var ethContract = contract.at(\"0xA760C64DfDB1EE168f2CB7873759d917d919cfb1\");\n return ethContract;\n}", "function of(typeRep) {\n return function(x) {\n return Z.of (typeRep, x);\n };\n }", "async function createContract(client, fromPrivateKey, fromPublicKey, toPublicKey) {\n const web3 = new Web3(client.url)\n // web3Quorum in quorum mode (web3 client, enclave options, isQuorum)\n // https://consensys.github.io/web3js-quorum/latest/Web3Quorum.html\n const web3quorum = new Web3Quorum(web3, {privateUrl: client.privateUrl}, true);\n\n // unlock the account so you can sign the tx; uses web3.eth.accounts.decrypt(keystoreJsonV3, password);\n const accountKeyPath = path.resolve(__dirname, '../../','config/quorum/networkFiles', client.name ,'accountkey');\n const accountKey = JSON.parse(fs.readFileSync(accountKeyPath));\n const signingAccount = web3.eth.accounts.decrypt(accountKey, \"\");\n\n // get the nonce for the accountAddress\n const accountAddress = client.accountAddress;\n const txCount = await web3.eth.getTransactionCount(`0x${accountAddress}`);\n\n const txOptions = {\n nonce: txCount,\n gasPrice: 0, //ETH per unit of gas\n gasLimit: 0x24A22, //max number of gas units the tx is allowed to use\n value: 0,\n data: '0x'+contractBin+contractConstructorInit,\n from: signingAccount,\n isPrivate: true,\n privateKey: fromPrivateKey,\n privateFrom: fromPublicKey,\n privateFor: [toPublicKey]\n };\n console.log(\"Creating contract...\");\n // Generate and send the Raw transaction to the Besu node using the eea_sendRawTransaction JSON-RPC call\n const txHash = await web3quorum.priv.generateAndSendRawTransaction(txOptions);\n console.log(\"Getting contractAddress from txHash: \", txHash);\n return txHash\n}", "function createType(m) {\n var typeDef = 'type ' + m.modelName + ' { \\n';\n //console.log(m);\n Object.keys(m.definition.properties).forEach((k, index) => {\n var p = m.definition.properties[k];\n var s = null;\n if (k === 'id' && p.id && p.generated) {\n s = k + ': ID' + '\\n';\n }\n else {\n s = k + ': ' + convertFromLoopbackType(p) + '\\n';\n }\n typeDef += s;\n });\n typeDef += ' }\\n\\n';\n return typeDef;\n}", "async instantiate(ctx){\n console.log('Pharmanet Contract instantiated')\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function Contract() {\n if (this instanceof Contract) {\n instantiate(this, arguments[0]);\n } else {\n var C = mutate(Contract);\n var network_id = arguments.length > 0 ? arguments[0] : \"default\";\n C.setNetwork(network_id);\n return C;\n }\n }", "function behId( type ) {\r\n var result = {};\r\n result.inType = type;\r\n result.outType = type;\r\n result.install = function ( context, inWires, outWires ) {\r\n eachTypeLeafNodeOver( inWires, outWires,\r\n function ( type, inWire, outWire ) {\r\n \r\n if ( type.op === \"atom\" ) {\r\n outWire.readSigFrom( inWire );\r\n } else if ( type.op === \"anytimeFn\" ) {\r\n outWire.readFrom( inWire );\r\n } else {\r\n throw new Error();\r\n }\r\n } );\r\n };\r\n return result;\r\n}", "create_contract() {\n var mission = \"Destroy one debris\";\n var success_rate = this.get_successrate();\n var reward = this.get_reward(success_rate);\n var expiration = null; // TODO not implemented yet\n return new Contract(mission, reward, success_rate, expiration);\n }", "function definitionToType(definition, compilationId, compiler, forceLocation) {\n let typeClass = Utils.typeClass(definition);\n let typeHint = Utils.typeStringWithoutLocation(definition);\n switch (typeClass) {\n case \"bool\":\n return {\n typeClass,\n typeHint\n };\n case \"address\": {\n switch (Compiler.Utils.solidityFamily(compiler)) {\n case \"unknown\": //I guess?\n case \"pre-0.5.0\":\n return {\n typeClass,\n kind: \"general\",\n typeHint\n };\n case \"0.5.x\":\n case \"0.8.x\":\n return {\n typeClass,\n kind: \"specific\",\n payable: Utils.typeIdentifier(definition) === \"t_address_payable\"\n };\n }\n break; //to satisfy typescript\n }\n case \"uint\": {\n let bytes = Utils.specifiedSize(definition);\n return {\n typeClass,\n bits: bytes * 8,\n typeHint\n };\n }\n case \"int\": {\n //typeScript won't let me group these for some reason\n let bytes = Utils.specifiedSize(definition);\n return {\n typeClass,\n bits: bytes * 8,\n typeHint\n };\n }\n case \"fixed\": {\n //typeScript won't let me group these for some reason\n let bytes = Utils.specifiedSize(definition);\n let places = Utils.decimalPlaces(definition);\n return {\n typeClass,\n bits: bytes * 8,\n places,\n typeHint\n };\n }\n case \"ufixed\": {\n let bytes = Utils.specifiedSize(definition);\n let places = Utils.decimalPlaces(definition);\n return {\n typeClass,\n bits: bytes * 8,\n places,\n typeHint\n };\n }\n case \"string\": {\n if (forceLocation === null) {\n return {\n typeClass,\n typeHint\n };\n }\n let location = forceLocation || Utils.referenceType(definition);\n return {\n typeClass,\n location,\n typeHint\n };\n }\n case \"bytes\": {\n let length = Utils.specifiedSize(definition);\n if (length !== null) {\n return {\n typeClass,\n kind: \"static\",\n length,\n typeHint\n };\n }\n else {\n if (forceLocation === null) {\n return {\n typeClass,\n kind: \"dynamic\",\n typeHint\n };\n }\n let location = forceLocation || Utils.referenceType(definition);\n return {\n typeClass,\n kind: \"dynamic\",\n location,\n typeHint\n };\n }\n }\n case \"array\": {\n let baseDefinition = Utils.baseDefinition(definition);\n let baseType = definitionToType(baseDefinition, compilationId, compiler, forceLocation);\n let location = forceLocation || Utils.referenceType(definition);\n if (Utils.isDynamicArray(definition)) {\n if (forceLocation !== null) {\n return {\n typeClass,\n baseType,\n kind: \"dynamic\",\n location,\n typeHint\n };\n }\n else {\n return {\n typeClass,\n baseType,\n kind: \"dynamic\",\n typeHint\n };\n }\n }\n else {\n let length = new bn_js_1.default(Utils.staticLengthAsString(definition));\n if (forceLocation !== null) {\n return {\n typeClass,\n baseType,\n kind: \"static\",\n length,\n location,\n typeHint\n };\n }\n else {\n return {\n typeClass,\n baseType,\n kind: \"static\",\n length,\n typeHint\n };\n }\n }\n }\n case \"mapping\": {\n let keyDefinition = Utils.keyDefinition(definition);\n //note that we can skip the scopes argument here! that's only needed when\n //a general node, rather than a declaration, is being passed in\n let keyType = (definitionToType(keyDefinition, compilationId, compiler, null));\n //suppress the location on the key type (it'll be given as memory but\n //this is meaningless)\n //also, we have to tell TypeScript ourselves that this will be an elementary\n //type; it has no way of knowing that\n debug(\"definition: %O\", definition);\n let valueDefinition = Utils.valueDefinition(definition);\n let valueType = definitionToType(valueDefinition, compilationId, compiler, forceLocation);\n if (forceLocation === null) {\n return {\n typeClass,\n keyType,\n valueType\n };\n }\n return {\n typeClass,\n keyType,\n valueType,\n location: \"storage\"\n };\n }\n case \"function\": {\n //WARNING! This case will not work unless given the actual\n //definition! It should return something *roughly* usable, though.\n let visibility = Utils.visibility(definition); //undefined if bad node\n let mutability = Utils.mutability(definition); //undefined if bad node\n let [inputParameters, outputParameters] = Utils.parameters(definition) || [[], []]; //HACK\n //note: don't force a location on these! use the listed location!\n let inputParameterTypes = inputParameters.map(parameter => definitionToType(parameter, compilationId, compiler));\n let outputParameterTypes = outputParameters.map(parameter => definitionToType(parameter, compilationId, compiler));\n switch (visibility) {\n case \"internal\":\n return {\n typeClass,\n visibility,\n mutability,\n inputParameterTypes,\n outputParameterTypes\n };\n case \"external\":\n return {\n typeClass,\n visibility,\n kind: \"specific\",\n mutability,\n inputParameterTypes,\n outputParameterTypes\n };\n }\n break; //to satisfy typescript\n }\n case \"struct\": {\n let id = import_1.makeTypeId(Utils.typeId(definition), compilationId);\n let qualifiedName = Utils.typeStringWithoutLocation(definition).match(/struct (.*)/)[1];\n let definingContractName;\n let typeName;\n if (qualifiedName.includes(\".\")) {\n [definingContractName, typeName] = qualifiedName.split(\".\");\n }\n else {\n typeName = qualifiedName;\n //leave definingContractName undefined\n }\n if (forceLocation === null) {\n if (definingContractName) {\n return {\n typeClass,\n kind: \"local\",\n id,\n typeName,\n definingContractName\n };\n }\n else {\n return {\n typeClass,\n kind: \"global\",\n id,\n typeName\n };\n }\n }\n let location = forceLocation || Utils.referenceType(definition);\n if (definingContractName) {\n return {\n typeClass,\n kind: \"local\",\n id,\n typeName,\n definingContractName,\n location\n };\n }\n else {\n return {\n typeClass,\n kind: \"global\",\n id,\n typeName,\n location\n };\n }\n }\n case \"enum\": {\n let id = import_1.makeTypeId(Utils.typeId(definition), compilationId);\n let qualifiedName = Utils.typeStringWithoutLocation(definition).match(/enum (.*)/)[1];\n let definingContractName;\n let typeName;\n if (qualifiedName.includes(\".\")) {\n [definingContractName, typeName] = qualifiedName.split(\".\");\n }\n else {\n typeName = qualifiedName;\n //leave definingContractName undefined\n }\n if (definingContractName) {\n return {\n typeClass,\n kind: \"local\",\n id,\n typeName,\n definingContractName\n };\n }\n else {\n return {\n typeClass,\n kind: \"global\",\n id,\n typeName\n };\n }\n }\n case \"contract\": {\n let id = import_1.makeTypeId(Utils.typeId(definition), compilationId);\n let typeName = Utils.typeStringWithoutLocation(definition).match(/(contract|library|interface) (.*)/)[2]; //note: we use the type string rather than the type identifier\n //in order to avoid having to deal with the underscore problem\n let contractKind = Utils.contractKind(definition);\n return {\n typeClass,\n kind: \"native\",\n id,\n typeName,\n contractKind\n };\n }\n case \"magic\": {\n let typeIdentifier = Utils.typeIdentifier(definition);\n let variable = (typeIdentifier.match(/^t_magic_(.*)$/)[1]);\n return {\n typeClass,\n variable\n };\n }\n }\n}", "function createType(type) {\n return new Promise((fullfill, reject) => {\n ARGS.type = type;\n client.create(ARGS, (err, res) => {\n if(err) {\n LOG.info(\"Unable to create type %s, because of %s\", type, err);\n reject(err); \n } else {\n LOG.info(\"type %s created.\", type);\n fullfill(res);\n } \n });\n }); \n}", "function getType(fn){var match=fn&&fn.toString().match(/^\\s*function (\\w+)/);return match?match[1]:'';}", "function getType(fn){var match=fn&&fn.toString().match(/^\\s*function (\\w+)/);return match?match[1]:'';}", "getHaxJSONSchemaType(inputMethod){return this.HAXWiring.getHaxJSONSchemaType(inputMethod)}", "function StructType() {}", "'getType'() {\n\t\tthrow new Error('Not implemented.');\n\t}", "function ATNType() {\n\n}", "function create(contractFactory, address) {\n const web3Instance = global.web3;\n const provider = new ethers_1.ethers.providers.Web3Provider(web3Instance.currentProvider);\n const signer = provider.getSigner(address);\n const factory = new contractFactory(signer);\n return factory;\n}", "function CType (type, _name) {\n var name = arguments.length >=2 ? _name : type.name;\n\n if (typeof this !== 'function')\n return createFunction(name, null, CType, arguments);\n\n inherits(this, CData);\n\n this.type = type;\n\n if (isVoid(type)) {\n this[invoke] = function () {\n throw new Error('cannot construct from void_t');\n };\n } else {\n var constructor = this;\n this[invoke] = function (value) {\n if (!(this instanceof constructor))\n return new constructor(value);\n CData.call(this, value);\n };\n }\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "function CreateIDEObjectType()\n{\n\treturn new IDEObjectType();\n}", "get type() {\n\t\tconst { constructor } = this;\n\t\tconst { type } = constructor;\n\n\t\treturn type;\n\t}", "function Shape(get_type){\n\tthis.get_type = function(){\n\t\treturn this.constructor;\n\t\tconsole.log(this.constructor);\n\t\t// return get_type;\n\t\t// console.log(get_type);\n\t}\n\treturn get_type;\n\tconsole.log(\"get\");\n\tconsole.log(get_type);\n\t}", "function createTypeStyle(target) {\n var instance = new typestyle_1.TypeStyle({ autoGenerateTag: false });\n if (target) {\n instance.setStylesTarget(target);\n }\n return instance;\n}", "function getType(fn){var match=fn&&fn.toString().match(/^\\s*function (\\w+)/);return match&&match[1];}", "TypeSignature(clauses) {\n\t\t\treturn { pattern: \"lambda\", innerType: Lambda, clauses };\n\t\t}", "function createStandardContract(standardContract,callback) {\n\tconsole.log(\"create standard contract object\", standardContract);\n\tvar contract = nforce.createSObject('Contract');\n\tcontract.set('Name', standardContract.Name);\n\tcontract.set('ContractNumber', standardContract.ContractNumber);\n\tcontract.set('Status', standardContract.Status);\n\n\torg.insert({ sobject: contract, oauth: oauth }, function(err, resp){\n\t\tif(!err) {\n\t\t\tconsole.log('Contract Object Created');\n\t\t\taddressId = resp.id;\n\t\t\tcallback(addressId);\n\t\t}else{\n\t\t\tcallback(err);\n\t\t}\n\n\t});\n\n}" ]
[ "0.6744115", "0.6345683", "0.6112678", "0.6010924", "0.5800416", "0.5783162", "0.57617193", "0.5748591", "0.5701726", "0.56932753", "0.56841224", "0.566529", "0.5630398", "0.555061", "0.5545096", "0.5542358", "0.5505796", "0.54023504", "0.53929186", "0.53514946", "0.5346587", "0.5329956", "0.5315863", "0.52925926", "0.5283396", "0.5272166", "0.5272166", "0.52667606", "0.5265784", "0.5262751", "0.5257475", "0.5249488", "0.5249416", "0.52488023", "0.5236263", "0.5223447", "0.5223447", "0.5223447", "0.5223447", "0.52192235", "0.52094626", "0.5204742", "0.5201884", "0.51974446", "0.51898724", "0.5189619", "0.5174959", "0.5164722", "0.51629484", "0.5161001", "0.5158851", "0.5158851", "0.5158851", "0.5158851", "0.5158851", "0.5158851", "0.5158851", "0.5158851", "0.51552564", "0.5133349", "0.513082", "0.51277477", "0.51190656", "0.51190656", "0.5118008", "0.5117475", "0.51096517", "0.5103787", "0.5099022", "0.5067325", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5066317", "0.5061995", "0.50543433", "0.50523436", "0.5022768", "0.5017644", "0.50056213" ]
0.5997338
5
Adds disables cards so they cannot be clicked
function disable(){ Array.prototype.filter.call(cards, function(card){ card.classList.add('disabled'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function disable() {\n openCards[0].classList.add('disabled');\n openCards[1].classList.add('disabled');\n allCards.forEach(function(card) {\n card.classList.add('disabled');\n });\n}", "function disable() {\n Array.prototype.filter.call(cards, function(cards) {\n card.classList.add(\"disable\");\n });\n }", "function disable() {\n Array.prototype.filter.call(cards, function (card) {\n if (card.className === 'card') {\n card.className += ' disabled';\n }\n });\n}", "function disable() {\n cardsArray.forEach(function(card) {\n card.classList.add('disabled');\n });\n}", "function disable() {\n document.addEventListener(\"click\",handler,true);\n function handler(e){\n /*if matches two cards on click*/\n if(openCards.length == 2) {\n /* avoids clicking a third card when 2 cards are open*/\n e.stopPropagation();\n }\n }\n}", "function enable() {\n Array.prototype.filter.call(cards, function (card) {\n if (card.className === 'card disabled') {\n card.className = 'card';\n }\n });\n}", "function onDisableCards(e) {\n\t\tuserInterface.disableRestartBtn();\n\n\t\tcards.forEach(card => {\n\t\t\tcard.disableMe();\n\t\t});\n\t}", "function enable() {\n Array.prototype.filter.call(cards, function (card) {\n card.classList.remove(\"disabled\");\n for (var i = 0; i < matchedCard.length; i++) {\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function enable() {\n Array.prototype.filter.call(cards, function(card) {\n card.classList.remove(\"disabled\");\n for (var i = 0; i < matchedCard.length; i++) {\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function disable(){\n [].filter.call(allCardsGame, function(card) {\n card.classList.add('disabled');\n });\n}", "function disableCard(cardToDisable){\n cardToDisable.classList.add(\"disabled\");\n}", "function disableCLick() {\n openCards.forEach(function (card) {\n card.off('click');\n });\n}", "function disable(){\n Array.prototype.filter.call(cards, function(card){\n card.classList.add(\"disabled\");\n });\n}", "function disableCards(){\n // removes ability to flip the cards back over.\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n // add to matched cards counter\n matchedCards++;\n // reset the board \n resetBoard();\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n\n resetBoard();\n }", "function disableClick() {\n for (let x = 0; x < allCards.length; x++) {\n allCards[x].classList.add(\"stop-event\");\n }\n}", "function enable() {\n Array.prototype.filter.call(cards, function (card) {\n card.classList.remove('disabled');\n for (var i = 0; i < matchedCard.length; i++) {\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function disableCards() {\n\n\tfirstCard.removeEventListener('click', flipCard);\n\tsecondCard.removeEventListener('click', flipCard);\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n}", "function enableCard(cardToEnable){\n cardToEnable.classList.remove('disabled');\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n winner();\n }", "function disableCards() {\n app.lockBoard = true;\n setTimeout(() => {\n app.firstCard.style.pointerEvents = \"none\";\n app.secondCard.style.pointerEvents = \"none\";\n resetBoard();\n }, 500);\n}", "function disable() {\n for (let shuffledCard of shuffledCards) {\n shuffledCard.classList.add('disable');\n };\n}", "function disableCards() {\r\n firstCard.removeEventListener('click', flipCard);\r\n secondCard.removeEventListener('click', flipCard);\r\n resetBoard();\r\n}", "function restrictClick(card) {\n for (card=0; card < cardArray.length; card++) {\n if (cardArray[card].classList.contains(\"card-image\")) {\n cardArray[card].classList.add(\"unclickable\");\n }\n }\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n\n resetBoard();\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n }", "function enable() {\n for (let shuffledCard of shuffledCards) {\n shuffledCard.classList.remove('disable');\n };\n for (let matchedCard of matchedCards) {\n matchedCard.classList.add('disable');\n }\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard());\n secondCard.removeEventListener('click', flipCard());\n resetBoard();\n}", "function disable(){\n cards.filter(card=>{\n card.classList.add('disabled');\n });\n}", "function disableCards() {\r\n firstCard.removeEventListener(\"click\", flipCard);\r\n secondCard.removeEventListener(\"click\", flipCard);\r\n\r\n resetBoard();\r\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n ++score;\n checkForWin();\n resetBoard();\n}", "function disableCards()\n{\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n}", "function enable(){\n Array.prototype.filter.call(cards, function(card){\n card.classList.remove('disabled');\n for(var i = 0; i < matchedCard.length; i++){\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "enableAll(){\n let guessedCards = this.state.guessedCards;\n guessedCards = guessedCards.flat();\n let clickedCards = this.state.clickedCards;\n clickedCards = clickedCards.flat();\n $('button').each(function(){\n this.disabled = false;\n });\n }", "disableCards() {\n this.matchCount = this.matchCount + 1;\n this.counter.innerHTML = this.matchCount;\n this.firstCard.removeEventListener('click', this.flipCard);\n this.secondCard.removeEventListener('click', this.flipCard);\n this.resetBoard();\n }", "function enable(){\n Array.prototype.filter.call(cards, function(card){\n card.classList.remove('disabled');\n for(var i = 0; i < matchedCards.length; i++){\n matchedCards[i].classList.add(\"disabled\");\n }\n });\n}", "function disable() {\n firstCard.removeEventListener(\"click\", flipCard);\n secondCard.removeEventListener(\"click\", flipCard);\n matches++;\n match.innerHTML = `${matches}`;\n remains--;\n remaining.innerHTML = `${remains}`;\n\n reset();\n}", "function enableClick() {\n for (let x = 0; x < allCards.length; x++) {\n allCards[x].classList.remove(\"stop-event\");\n }\n}", "function disableAll(){\n Array.prototype.filter.call(deckOfCards, function(card){\n //Add disabled class to card div\n card.parentElement.classList.add('disabled');\n });\n}", "function enable(){\n var cards = document.querySelectorAll('.card-class');\n\n cards.forEach(cards => {\n cards.classList.remove('disable')\n for(var i = 0; i < cardMatch.length; i++){\n cardMatch[i].classList.add('disable')\n }\n })\n}", "function notMatching(){\n\t\t\t\t\t\t\t\n\tselectedCard.className += ' down';\n\t\t\t\t\t\n\tstoredCard.className += ' down';\n\t\n\t//enable all cards again \n\tfor(var i = 0;i<16;i++){\n\t\t\t\t\n\t\tdocument.getElementById(i).style.pointerEvents = 'auto';\n\t\t\t\t\n\t}\n\t\n\tclickCount+=2;\n\t\n\t\n}", "function disableCardClick() {\n setTimeout(() => {\n $(\".matched\").off(\"click\", clearCardInPlay);\n }, 500);\n }", "function disableCorrectCards(){\n $(selectedCards[0]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[1]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[0]).find('.card-front').removeClass('active');\n $(selectedCards[1]).find('.card-front').removeClass('active');\n $(selectedCards[0]).off('click');\n $(selectedCards[1]).off('click');\n flipCardsBackDown();\n}", "function enable(){\n Array.prototype.filter.call(cards, function(kaart){\n kaart.classList.remove('disabled');\n for(var i = 0; i < dezelfdeKaarten.length; i++){\n dezelfdeKaarten[i].classList.add(\"disabled\");\n }\n\n });}", "function enable(){\n cards.filter(card=>{\n card.classList.remove('disabled');\n for(let i = 0; i < matchedCard.length; i++){\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function disableCards(){\n let name = secondCard.dataset.name;\n player.innerHTML = name;\n firstCard.removeEventListener(\"click\", flipCard);\n secondCard.removeEventListener(\"click\", flipCard);\n player.classList.add(\"active\");\n resetBoard();\n setTimeout(gameFinished,1000);\n setTimeout(()=>{\n player.classList.remove(\"active\");\n },2000)\n}", "function enableUnmatched(){\n Array.prototype.filter.call(deckOfCards, function(card){\n // removes disabled class from card div\n card.parentElement.classList.remove('disabled');\n });\n //Call disableMatched function to permantly disable matched cards\n disableMatched();\n}", "function enableClick() {\n openCards[0].click(toggleCard);\n}", "function disableGame() {\n cards.forEach(card => {\n card.removeEventListener('click', flipCard);\n });\n resetBoard();\n}", "function disableActions() {\r\n hit.disabled = true;\r\n holdHand.disabled = true;\r\n newgame.disabled = false;\r\n }", "function disableCards()\n{\n $(document).off(\"click\", \".divs\");\n}", "function buttondisable1 () {\n $('#playcard').prop('disabled', false)\n}", "function displayCard(card) {\n card.className = \"card open show disable\";\n}", "function onlyTwo() {\n cards.classList.add(\"unclickable\");\n}", "disableCardChooseButton() {\n let choiceButtonIsDisabled = this.choiceButton.nativeElement.classList.contains('disabled');\n if ((this.currMode == _entity_data_structures_card_modes__WEBPACK_IMPORTED_MODULE_1__[\"cardMode\"].voting && !choiceButtonIsDisabled) ||\n (this.currMode == _entity_data_structures_card_modes__WEBPACK_IMPORTED_MODULE_1__[\"cardMode\"].myTurn && choiceButtonIsDisabled) ||\n (this.currMode == _entity_data_structures_card_modes__WEBPACK_IMPORTED_MODULE_1__[\"cardMode\"].waiting && !choiceButtonIsDisabled)) {\n this.choiceButton.nativeElement.classList.toggle('disabled');\n }\n }", "function onEnableCards(e) {\n\t\tuserInterface.enableRestartBtn();\n\n\t\tcards.forEach(card => {\n\t\t\tcard.enableMe();\n\t\t});\n\n\t\t// If game is resetting or over reset the card positions and run start game\n\t\tif (currentState == gameState.resetting || currentState == gameState.over) {\n\t\t\tcardCount++;\n\n\t\t\tif (cardCount == 17) {\n\t\t\t\tcardCount = 1;\n\t\t\t\tresetCardPositions();\n\t\t\t\tonStartGame(e);\n\t\t\t}\n\t\t}\n\t}", "function disableMatchedCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n }", "function clickedCard() {\n$('li.card').on('click', function() {\n\tlet openCard = $(this);\n\ttoggleOpenShow(openCard);\n\tif(openCard.hasClass('open show disabled')\n\t\t&& allOpenedCards.length < 2) {\n\t\tallOpenedCards.push(openCard);\t\t\n\t}\t\t\n\tmatchedCard();\n\t});\n}", "function showCardSymbol(card){\n \tcard.addClass(\"show\");\n \tcard.addClass(\"disabled\"); // This will ensure the card is not clickable when it is showed and is facing up.\n}", "function SetImageDisabled(card)\n{\n if (card.length > 0)\n {\n let id = \"div#cardImages #\" + card + \" img\";\n $(id).attr('src', '/images/' + card + 'Disabled.png');\n }\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n pairs++;\n document.getElementById('pairs').innerHTML = pairs;\n resetBoard();\n setTimeout(() => {\n if (pairs == num_matches) {\n postToServer();\n }\n }, 2000);\n}", "function cardsEventListener() {\n // remove EventListener\n $('li').off();\n\n //add EventListener\n\n $('.card').not('.open').not('.show').not('.match').not('.fa').on('click', open);\n}", "function disableButtons()\n {\n $.PercDataList.disableButtons(container);\n }", "function flipCards(){\n\t\t\t\n\tfor(var i = 0;i<16;i++){\n\t\t\t\t\n\t\tcards[i].className += ' down';\n\t\t\t\t\n\t}\n\t\n\t//enable all cards\n\tfor(var i = 0;i<16;i++){\n\t\t\t\n\t\tdocument.getElementById(i).style.pointerEvents = 'auto';\n\t\t\t\n\t}\n\t\t\t\n}", "function toggle_card(div, enable) {\n div.style.opacity = enable ? 1 : 0.3;\n}", "function clickOff() {\n openedCards.forEach(function(card) {\n card.off('click');\n });\n}", "function enable_discard(){\n\tif(dbg){\n\t\tdebug(\"enable discard\");\n\t}\n\tvar x = document.getElementsByClassName(\"discard\");\n\tfor (i=0; i < x.length; i++){\n\t\tx[i].disabled = false;\n\t}\n}", "function turnOver(card) {\n for (card=0; card < cardArray.length; card++) {\n if (cardArray[card].classList.contains(\"match\") === false) {\n cardArray[card].classList.remove(\"card-image\");\n cardArray[card].classList.remove(\"unclickable\");\n cards.classList.remove(\"unclickable\");\n }\n }\n}", "function showCard() {\n if (openCards.length < 2) {\n this.classList.toggle(\"open\");\n this.classList.toggle(\"show\");\n this.classList.toggle(\"disable\");\n } else {\n return false;\n }\n }", "function setClickOffOnClickedCards()\n{\n speelveld[cards_clicked[FIRST_CARD_CLICKED]].parentElement.removeEventListener('click', clickOnCard);\n speelveld[cards_clicked[LAST_CARD_CLICKED]].parentElement.removeEventListener('click', clickOnCard);\n}", "function turnOverAny(card) {\n for (card=0; card < cardArray.length; card++) {\n cardArray[card].classList.remove(\"card-image\");\n cardArray[card].classList.remove(\"unclickable\");\n cards.classList.remove(\"unclickable\");\n }\n}", "function whenClicked(card){ \r\n \r\n card.addEventListener(\"click\", function(){\r\n \r\n \r\n if (openedCards.length===1){\r\n \r\n \r\n const currentCard=this;\r\n const previousCard=openedCards[0];\r\n\r\n \r\n card.classList.add(\"open\", \"show\", \"disable\");\r\n openedCards.push(this);\r\n\r\n compare(currentCard,previousCard);\r\n\r\n \r\n }else{\r\n card.classList.add(\"open\", \"show\", \"disable\");\r\n openedCards.push(this);\r\n }\r\n }\r\n\r\n );\r\n\r\n}", "function cardOpen() {\n openedCards.push(this);\n openedCards[0].classList.add(\"disabled\");\n var length = openedCards.length;\n if (length === 2) {\n moveFunction();\n if (openedCards[0].dataset.name === openedCards[1].dataset.name) {\n scoreFunction();\n matched();\n } else {\n unmatched();\n }\n }\n}", "function lockCard() {\n\tif (listOfOpenCards.length === 2){\n\t\tlistOfOpenCards.map(x => x.className = 'card match');\n\t\tlistOfOpenCards = [];\n\t}\n}", "function addToggleCard(clickedCard) {\n flipCards.push(clickedCard);\n}", "function flipCard(card, cards_list){\n cardOpen.push(card)\n\n var crd = cards_list.filter(cards =>{\n return cards.id == card.id\n })\n\n card.src = crd[0].src\n\n if(cardOpen.length == 2){\n disable()\n check()\n count()\n }\n}", "function preventFurtherClicks() {\n const cards = document.querySelectorAll('.card:not(.match)');\n cards.forEach(card => {\n card.onclick = null;\n });\n}", "_clickCard(e) {\n if (this.editMode) {\n // do not do default\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n }", "function click (card){\n card.addEventListener(\"click\",function(){\n const presentCard = this;\n const previousCard = openCard[0];\n if(openCard.length === 1){\n\n card.classList.add(\"open\",\"show\",\"disabled\");\n openCard.push(this);\n compare(presentCard,previousCard);\n }else{\n presentCard.classList.add('open','show','disabled');\n openCard.push(this);\n }\n }\n )\n\n }", "_enableDisableHandler() {\n const that = this;\n\n if (that.disabled) {\n for (let i = 0; i < that._items.length; i++) {\n that._items[i].disabled = true;\n }\n }\n else {\n for (let i = 0; i < that._items.length; i++) {\n that._items[i].disabled = false;\n }\n }\n }", "function removePreventClick() {\n $('.card').each(function( index ) {\n $('.card').removeClass('preventclick');\n });\n}", "function toggleCards() {\n\n // if the currently selected card was clicked, nothing to do; ignore click.\n if ($(this).parent().hasClass('pure-menu-selected')) {\n console.log('ignoring useless click');\n event.preventDefault();\n return;\n }\n\n $('#cards .card').hide();\n var selected = $(this).attr('data-card');\n $('#' + selected).show();\n\n $(this).parent().parent().find('.pure-menu-selected').removeClass('pure-menu-selected');\n $(this).parent().addClass('pure-menu-selected');\n\n\tevent.preventDefault();\n}", "function cardClicked(event) {\n openCardsList.push(this);\n this.classList.add('open', 'show', 'disable');\n if (openCardsList.length === 2 && openCardsList[0].innerHTML === openCardsList[1].innerHTML) {\n match();\n addMoves();\n }\n if (openCardsList.length === 2 && openCardsList[0].innerHTML != openCardsList[1].innerHTML) {\n noMatch();\n addMoves();\n }\n if (!watch.isOn) {\n watch.start();\n }\n}", "function clickOnCards(card){\n\n//Create card click event\ncard.addEventListener(\"click\", function(){\t\n\n//Add an if statement so that we can't open more than two cards at the same time\n\tif (openedCards.length === 0 || openedCards.length === 1){\n\tsecondCard = this;\n\tfirstCard = openedCards[0];\n\n\t//We have opened card\n\tif(openedCards.length === 1){\n\tcard.classList.add(\"open\",\"show\",\"disable\");\n\topenedCards.push(this);\n\n\t//We invoke the function to compare two cards\n\tcheck(secondCard, firstCard);\n\n\t}else {\n //We don't have opened cards\n\tcard.classList.add(\"open\",\"show\",\"disable\");\n\topenedCards.push(this);\n }\n\t}\n});\n}", "cardButtons() {\n\t\t$(`.pcm-pandaCard`).unbind('click').click( e => {\n\t\t\tlet card = $(e.target).closest('.card'), theButton = card.find('.pcm-deleteButton'), myId = card.data('myId');\n\t\t\tif (e.ctrlKey) {\n\t\t\t\tif (this.ctrlDelete.includes(myId)) { theButton.removeClass('pcm-btn-selected'); this.ctrlDelete = arrayRemove(this.ctrlDelete,myId); }\n\t\t\t\telse { theButton.addClass('pcm-btn-selected'); this.ctrlDelete.push(myId); }\n\t\t\t} else if (e.altKey) { this.ctrlDelete.length = 0; $('.pcm-deleteButton').removeClass('pcm-btn-selected'); }\n\t\t\ttheButton = null; card = null;\n }).unbind('contextmenu').contextmenu( async e => {\n let card = $(e.target).closest('.card'), myId = card.data('myId'), data = await MyPanda.dataObj(myId); e.preventDefault();\n data.mute = !data.mute; MyPanda.updateDbData(myId, data); this.pandaMute(myId, data.mute); card = null; return false;\n }).mousedown( e => { $(`.pcm-tooltipData`).tooltip('dispose'); $(e.target).closest('.pcm-pandaCard').find('.pcm-tooltipData').addClass('pcm-tooltipDisable');\n }).mouseup( e => { $(e.target).closest('.pcm-pandaCard').find('.pcm-tooltipData').removeClass('pcm-tooltipDisable'); });\n\t\t$(`.pcm-collectButton, .pcm-collectButton1`).unbind('click').click( async e => {\n let theButton = $(e.target).closest('.pcm-hitButton'), card = $(e.target).closest('.card');\n if (theButton.data('longClicked')) theButton.removeData('longClicked');\n else {\n let myId = card.data('myId'), stopped = card.data('stopped'), info = MyPanda.options(myId);\n if (stopped === 'noQual' || stopped === 'blocked') { if (MyPandaUI.pandaStats[myId].collecting) await MyPandaUI.stopCollecting(myId, 'manual'); }\n else if (info.disabled) await this.pandaEnabled(myId);\n else if (theButton.is('.pcm-buttonOff:not(.pcm-btnSearching), .pcm-searchDisable')) {\n info.autoAdded = false; await this.pandaEnabled(myId);\n if (info.search !== 'rid') await MyPandaUI.startCollecting(myId, false, (info.search === 'gid') ? 10000 : 0);\n else if (info.search === 'rid') {\n $(`#pcm-collectButton-${myId}`).removeClass('pcm-buttonOff pcm-searchDisable').addClass('pcm-buttonOn');\n $(`#pcm-collectButton1-${myId}`).removeClass('pcm-buttonOff pcm-searchDisable').addClass('pcm-buttonOn');\n MyPandaUI.pandaGStats.addCollecting(); MyPandaUI.pandaGStats.collectingOn();\n MyPanda.doSearching(myId, null, 10000);\n }\n } else if (info.search === 'rid') MyPanda.disableSearching(myId);\n else MyPandaUI.stopCollecting(myId, 'manual');\n }\n e.preventDefault(); e.stopPropagation(); theButton = null, card = null;\n\t\t}).unbind('long-press').on('long-press', async e => {\n let theButton = $(e.target).closest('.pcm-hitButton'), card = $(e.target).closest('.card');\n if (!card.is('.jobSearch')) {\n let myId = card.data('myId'); theButton.data('longClicked', true);\n if (theButton.is('.pcm-collectDisable')) { this.pandaEnabled(myId); }\n else { if (MyPandaUI.pandaStats[myId].collecting) await MyPandaUI.stopCollecting(myId, 'manual'); this.pandaDisabled(myId); }\n e.preventDefault(); e.stopPropagation();\n }\n theButton = null; card = null;\n });\n\t\t$(`.pcm-hamButton, .pcm-hamButton1`).unbind('click').click( async e => {\n\t\t\tlet theButton = $(e.target).closest('.pcm-hitButton'), myId = $(e.target).closest('.card').data('myId');\n\t\t\tif (theButton.data('longClicked')) theButton.removeData('longClicked');\n\t\t\telse { MyPandaUI.hamButtonClicked(myId, theButton,_, true); }\n\t\t\te.preventDefault(); e.stopPropagation(); theButton = null; return false;\n\t\t}).unbind('long-press').on('long-press', async e => {\n\t\t\tlet theButton = $(e.target).closest('.pcm-hitButton'), myId = $(e.target).closest('.card').data('myId');\n\t\t\tlet info = MyPanda.options(myId), data = await MyPanda.dataObj(myId); theButton.data('longClicked', true);\n\t\t\tif (theButton.hasClass('pcm-delayedHam')) { theButton.removeClass('pcm-delayedHam').addClass('pcm-noDelay'); info.autoTGoHam = (data.autoGoHam) ? 'disable' : 'off'; }\n else { info.autoTGoHam = 'on'; theButton.removeClass('pcm-noDelay').addClass('pcm-delayedHam'); }\n if (!MyPandaUI.pandaStats[myId].collecting) MyPandaUI.startCollecting(myId, false, 0);\n\t\t\te.preventDefault(); e.stopPropagation(); theButton = null; return false;\n\t\t});\n\t\t$(`.pcm-deleteButton, .pcm-deleteButton1`).unbind('click').click( e => {\n let card = $(e.target).closest('.card'), theButton = card.find('.pcm-deleteButton'), myId = card.data('myId');\n if (this.ctrlDelete.length > 0) theButton.addClass('pcm-btn-selected');\n if (!this.ctrlDelete.includes(myId)) this.ctrlDelete.push(myId);\n\t\t\tMyPandaUI.removeJobs(this.ctrlDelete, (response) => {\n if ((response === 'NO' && this.ctrlDelete.length === 1) || response === 'CANCEL' ) { this.ctrlDelete = []; $('.pcm-deleteButton').removeClass('pcm-btn-selected'); }\n else if (response === 'YES') this.ctrlDelete = [];\n }, 'manual', () => {}, 'Unselect All');\n e.preventDefault(); e.stopPropagation(); theButton = null; card = null;\n\t\t});\n\t\t$(`.pcm-detailsButton , .pcm-detailsButton1`).unbind('click').click( async e => {\n\t\t\tlet myId = $(e.target).closest('.card').data('myId'); e.preventDefault(); e.stopPropagation();\n MyPandaUI.modalJob = new ModalJobClass(); MyPandaUI.modalJob.showDetailsModal(myId,_, () => { MyPandaUI.modalJob = null; MyModal = null; });\n\t\t});\n\t\t$(`.pcm-groupId`).unbind('click').click( e => {\n\t\t\tconst double = parseInt( $(e.target).data('double'), 10 );\n\t\t\tif (double === 2) $(e.target).data('double', 0);\n\t\t\tsetTimeout( () => {\n\t\t\t\tconst double = parseInt( $(e.target).data('double'), 10 );\n\t\t\t\tif (double !== 2) {\n\t\t\t\t\tlet myId = $(e.target).data('myId'), info = MyPanda.options(myId);\n\t\t\t\t\tnavigator.clipboard.writeText((info.search === 'rid') ? MyPanda.pandaUrls[myId].reqUrl : MyPanda.pandaUrls[myId].accept);\n\t\t\t\t}\n\t\t\t}, 250);\n\t\t});\n $(`.pcm-groupId`).unbind('dblclick').on('dblclick', e => {\n $(e.target).data('double', 2);\n let myId = $(e.target).data('myId'), info = MyPanda.options(myId), theHeight = window.outerHeight-80, theWidth = window.outerWidth-10;\n let theUrl = (info.search === 'rid') ? MyPanda.pandaUrls[myId].reqUrl : MyPanda.pandaUrls[myId].accept;\n window.open(theUrl,'_blank','width=' + theWidth + ',height=' + theHeight + ',scrollbars=yes,toolbar=yes,menubar=yes,location=yes');\n });\n\t\t$(`.pcm-nameGroup1`).unbind('click').click( e => {\n let myId = $(e.target).closest('.card').data('myId'), reqName = $(`#pcm-hitReqName1-${myId}`), stats = $(`#pcm-hitStats1-${myId}`);\n if (reqName.is(':visible')) { reqName.hide(); stats.show(); } else { stats.hide(); reqName.show(); }\n });\n $('.pcm-requesterButton').unbind('click').click( e => {\n let myId = $(e.target).closest('.card').data('myId'); MyPanda.toggleReqSearch(myId).then( toggled => {\n if (toggled) $(e.target).closest('.pcm-hitButton').removeClass('pcm-buttonOff').addClass('pcm-buttonOn');\n else $(e.target).closest('.pcm-hitButton').removeClass('pcm-buttonOn').addClass('pcm-buttonOff');\n });\n });\n if (MyOptions.doGeneral().advancedSearchJobs) $('.pcm-requesterButton').show(); else $('.pcm-requesterButton').hide();\n\t}", "function disableButtons() {\n $(\".hit\").prop(\"disabled\", true);\n $(\".stick\").prop(\"disabled\", true);\n}", "function remove_hide_Cards() {\n\tlistOfOpenCards.map(x => x.className = 'card');\n\tlistOfOpenCards = [];\n}", "disable() {\n\t // leave empty in Widget.js\n\t }", "function preventClick() {\n $('.card').each(function( index ) {\n $('.card').addClass('preventclick');\n });\n /* $('.card').click(function( event ) {\n event.stopImmediatePropagation();\n }); */\n}", "function onDealCardsClicked(){\n\t\tif(poker._bet > 0){\n\t\t\t$(\"#commandbutton_2\").off(\"click\").addClass(\"disabled\");\n\t\t\t$(\"#commandbutton_3\").off(\"click\").addClass(\"disabled\");\n\t\t\t$(\"#commandbutton_4\").off(\"click\").addClass(\"disabled\");\n\t\t\tcardsFliped = false;\n\t\t\tswitch (draw){\n\t\t\t\tcase 0:\n\t\t\t\t\t\n\t\t\t\t\tpoker.cards.shuffle();\n\t\t\t\t\tresetHeld();\n\t\t\t\t\tfirstCard = poker.cards.dealCard();\n\t\t\t\t\tsecondCard = poker.cards.dealCard();\n\t\t\t\t\tthirdCard = poker.cards.dealCard();\n\t\t\t\t\tfourthCard = poker.cards.dealCard();\n\t\t\t\t\tfifthCard = poker.cards.dealCard();\n\t\t\t\t\tdraw++;\n\t\t\t\t\tWinner.html(\"Draw \" + draw);\n\t\t\t\t\tbreak;\n\t\t\t\t/*case 1:\n\t\t\t\t\tif(!_firstCardHold)\n\t\t\t\t\t\tfirstCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_secondCardHold)\n\t\t\t\t\t\tsecondCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_thirdCardHold)\n\t\t\t\t\t\tthirdCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_fourthCardHold)\n\t\t\t\t\t\tfourthCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_fifthCardHold)\n\t\t\t\t\t\tfifthCard = poker.cards.dealCard();\n\t\t\t\t\tdraw++;\n\t\t\t\t\tWinner.html(\"Draw \" + draw);\n\t\t\t\t\tbreak;*/\n\t\t\t\tcase 1:\n\t\t\t\t\tcardsFliped = false;\n\t\t\t\t\tif(!_firstCardHold)\n\t\t\t\t\t\tfirstCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_secondCardHold)\n\t\t\t\t\t\tsecondCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_thirdCardHold)\n\t\t\t\t\t\tthirdCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_fourthCardHold)\n\t\t\t\t\t\tfourthCard = poker.cards.dealCard();\n\t\t\t\t\tif(!_fifthCardHold)\n\t\t\t\t\t\tfifthCard = poker.cards.dealCard();\n\t\t\t\t\tdraw = 0;\n\t\t\t\t\tresetHeld();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\trefresh();\n\t\t}else{\n\t\t\talert(\"no bet\");\n\t\t}\n\t}", "function allowClick() {\r\n $(\".card\").removeClass(\"notouch\");\r\n}", "function disableButtons (p1Attack,p1Heal,p1Yield,p2Attack,p2Heal,p2Yield){\n\n p1Attack.disabled = true;\n p1Heal.disabled = true;\n p1Yield.disabled = true;\n\n p2Attack.disabled = false;\n p2Heal.disabled = false;\n p2Yield.disabled =false;\n \n\n}", "function enableCards()\n{\n window.setTimeout(function ()\n {\n $(document).on(\"click\", \".divs\", function (e)\n {\n proceedCard(e);\n });\n }, 800);\n}", "function addStudentActions() {\n if (allStudents.includes(student)) {\n clone.querySelector(\".prefect\").addEventListener(\"click\", prefectClick);\n function prefectClick() {\n checkPrefectStatus(student);\n }\n\n clone.querySelector(\".inquisitorial\").addEventListener(\"click\", inquisitorialClick);\n function inquisitorialClick() {\n toggleInquisitorial(student);\n }\n\n clone.querySelector(\".expel\").addEventListener(\"click\", expelClick);\n function expelClick() {\n document.querySelector(\".info-container\").classList.add(\"fade-out\");\n document.querySelector(\".info-container\").addEventListener(\"animationend\", () => {\n modal.style.display = \"none\";\n document.querySelector(\"body\").style.overflow = \"visible\";\n document.querySelector(\"body\").style.overflowX = \"hidden\";\n });\n expelStudent(student);\n }\n } else {\n clone.querySelectorAll(\".student-actions button\").forEach((button) => {\n button.classList.add(\"disabled\");\n button.disabled = true;\n });\n }\n }", "function handleCardClick(event) {\n event.target.classList.toggle(\"hide\"); // hides color. Turns card to white\n event.target.classList.add(\"clicked\"); // adds class of 'clicked' to cards\n openCards.push(event.target); // push cards to array\n if (openCards.length === 2) {\n // if array = 2 cards\n if (\n // if both cards in array are the same color\n openCards[0].getAttribute(\"data-color\") ===\n openCards[1].getAttribute(\"data-color\")\n ) {\n counter++; // add click to counter if both cards are the same color\n setTimeout(function () {\n if (counter === 5) {\n // counter = 5 clicks (all same cards are clicked)\n alert(\"You won the game!\"); // module alert saying you won\n }\n }, 500); // do the above after .5 seconds so all code executes\n\n openCards[0].style.pointerEvents = \"none\"; //disable click on each open card\n openCards[1].style.pointerEvents = \"none\"; // since they match\n } else {\n //disable click\n let firstUnmatched = openCards[0]; // 1st card in array if they dont match\n let secondUnmatched = openCards[1]; // 2nd card in array if they dont match\n firstUnmatched.classList.remove(\"clicked\"); // remove class on 1st card\n secondUnmatched.classList.remove(\"clicked\"); // remove class on 2nd card\n gameContainer.style.pointerEvents = \"none\"; // disable click\n setTimeout(function () {\n // unmatched = white\n firstUnmatched.classList.toggle(\"hide\"); // hide toggle between color/white\n secondUnmatched.classList.toggle(\"hide\"); // hide toggle between color/white\n gameContainer.style.pointerEvents = \"auto\"; //enable click...\n }, 1000); // ...after 1 second so player can click again\n }\n openCards = []; // reset array to take in new cards\n }\n}", "function enableCardOrNot(){\n let transferenciaELEM = document.getElementById(\"selectorDatosCuenta\");\n let sel = document.getElementById(\"selectorTarjeta\");\n let tarjetaELEM = document.getElementById(\"tarjeta\");\n let esTarjeta = tarjetaELEM.checked;\n if(esTarjeta){\n transferenciaELEM.disabled = true;\n sel.disabled = false;\n } else {\n transferenciaELEM.disabled = false;\n sel.disabled = true;\n }\n}", "function addToggleCard(clickTarget) {\n toggledCards.push(clickTarget);\n}", "function disableBet() {\n amountBet(\"#place-bet\").attr(\"disabled\", true);\n}" ]
[ "0.79090816", "0.7895395", "0.7769206", "0.77558255", "0.7754847", "0.7651944", "0.75493187", "0.7502452", "0.7501851", "0.7492654", "0.74841756", "0.74680257", "0.7446873", "0.7397985", "0.7361252", "0.7357954", "0.7344112", "0.7286452", "0.72707963", "0.7255122", "0.7228226", "0.7222536", "0.7216229", "0.72122806", "0.7204923", "0.7195213", "0.7187988", "0.71871173", "0.71829957", "0.7163316", "0.7157549", "0.7156284", "0.7154664", "0.7149195", "0.7134568", "0.7104944", "0.71047646", "0.7095041", "0.7093729", "0.70909595", "0.7078741", "0.7045836", "0.70337164", "0.69807535", "0.6933165", "0.69161034", "0.67919403", "0.677916", "0.67566055", "0.6720059", "0.66743356", "0.667381", "0.66720366", "0.6642369", "0.6616273", "0.65924275", "0.6553972", "0.6540699", "0.65019995", "0.64004356", "0.639364", "0.63542134", "0.6328175", "0.6322623", "0.63026464", "0.6290296", "0.6274523", "0.62717956", "0.62580526", "0.6247692", "0.6247303", "0.6208325", "0.6208103", "0.6203533", "0.61839914", "0.6150037", "0.6145365", "0.6121038", "0.61151505", "0.61043763", "0.61023515", "0.60838956", "0.6077563", "0.6071948", "0.6071104", "0.6065549", "0.6054862", "0.60403883", "0.6029231", "0.60257125", "0.6025542", "0.6017141", "0.6001317", "0.5998988", "0.5981994", "0.59657407", "0.59642196", "0.5960554", "0.59465355", "0.59423137" ]
0.7510241
7
enable cards and disable matched cards
function enable(){ Array.prototype.filter.call(cards, function(card){ card.classList.remove('disabled'); for(var i = 0; i < matchedCards.length; i++){ matchedCards[i].classList.add("disabled"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function enable() {\n Array.prototype.filter.call(cards, function(card) {\n card.classList.remove(\"disabled\");\n for (var i = 0; i < matchedCard.length; i++) {\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function enable() {\n Array.prototype.filter.call(cards, function (card) {\n card.classList.remove(\"disabled\");\n for (var i = 0; i < matchedCard.length; i++) {\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function enable() {\n Array.prototype.filter.call(cards, function (card) {\n card.classList.remove('disabled');\n for (var i = 0; i < matchedCard.length; i++) {\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function enableUnmatched(){\n Array.prototype.filter.call(deckOfCards, function(card){\n // removes disabled class from card div\n card.parentElement.classList.remove('disabled');\n });\n //Call disableMatched function to permantly disable matched cards\n disableMatched();\n}", "function enable() {\n for (let shuffledCard of shuffledCards) {\n shuffledCard.classList.remove('disable');\n };\n for (let matchedCard of matchedCards) {\n matchedCard.classList.add('disable');\n }\n}", "function enable(){\n Array.prototype.filter.call(cards, function(card){\n card.classList.remove('disabled');\n for(var i = 0; i < matchedCard.length; i++){\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function enable(){\n cards.filter(card=>{\n card.classList.remove('disabled');\n for(let i = 0; i < matchedCard.length; i++){\n matchedCard[i].classList.add(\"disabled\");\n }\n });\n}", "function enable() {\n Array.prototype.filter.call(cards, function (card) {\n if (card.className === 'card disabled') {\n card.className = 'card';\n }\n });\n}", "function enable(){\n var cards = document.querySelectorAll('.card-class');\n\n cards.forEach(cards => {\n cards.classList.remove('disable')\n for(var i = 0; i < cardMatch.length; i++){\n cardMatch[i].classList.add('disable')\n }\n })\n}", "function disableCards(){\n // removes ability to flip the cards back over.\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n // add to matched cards counter\n matchedCards++;\n // reset the board \n resetBoard();\n}", "function disable() {\n openCards[0].classList.add('disabled');\n openCards[1].classList.add('disabled');\n allCards.forEach(function(card) {\n card.classList.add('disabled');\n });\n}", "function disable() {\n Array.prototype.filter.call(cards, function(cards) {\n card.classList.add(\"disable\");\n });\n }", "function disable() {\n Array.prototype.filter.call(cards, function (card) {\n if (card.className === 'card') {\n card.className += ' disabled';\n }\n });\n}", "function enable(){\n Array.prototype.filter.call(cards, function(kaart){\n kaart.classList.remove('disabled');\n for(var i = 0; i < dezelfdeKaarten.length; i++){\n dezelfdeKaarten[i].classList.add(\"disabled\");\n }\n\n });}", "function disable(){\n Array.prototype.filter.call(cards, function(card){\n card.classList.add('disabled');\n });\n}", "enableAll(){\n let guessedCards = this.state.guessedCards;\n guessedCards = guessedCards.flat();\n let clickedCards = this.state.clickedCards;\n clickedCards = clickedCards.flat();\n $('button').each(function(){\n this.disabled = false;\n });\n }", "function onDisableCards(e) {\n\t\tuserInterface.disableRestartBtn();\n\n\t\tcards.forEach(card => {\n\t\t\tcard.disableMe();\n\t\t});\n\t}", "function disable(){\n [].filter.call(allCardsGame, function(card) {\n card.classList.add('disabled');\n });\n}", "function disable() {\n cardsArray.forEach(function(card) {\n card.classList.add('disabled');\n });\n}", "function disable(){\n Array.prototype.filter.call(cards, function(card){\n card.classList.add(\"disabled\");\n });\n}", "disableCards() {\n this.matchCount = this.matchCount + 1;\n this.counter.innerHTML = this.matchCount;\n this.firstCard.removeEventListener('click', this.flipCard);\n this.secondCard.removeEventListener('click', this.flipCard);\n this.resetBoard();\n }", "function notMatching(){\n\t\t\t\t\t\t\t\n\tselectedCard.className += ' down';\n\t\t\t\t\t\n\tstoredCard.className += ' down';\n\t\n\t//enable all cards again \n\tfor(var i = 0;i<16;i++){\n\t\t\t\t\n\t\tdocument.getElementById(i).style.pointerEvents = 'auto';\n\t\t\t\t\n\t}\n\t\n\tclickCount+=2;\n\t\n\t\n}", "function disableMatchedCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n }", "function doCardsMatch() {\n if(firstCard.dataset.icon === secondCard.dataset.icon) {\n cardArray.push(firstCard);\n cardArray.push(secondCard);\n disable();\n return;\n };\n unflippingCards(); \n}", "function disable() {\n firstCard.removeEventListener(\"click\", flipCard);\n secondCard.removeEventListener(\"click\", flipCard);\n matches++;\n match.innerHTML = `${matches}`;\n remains--;\n remaining.innerHTML = `${remains}`;\n\n reset();\n}", "function disable() {\n for (let shuffledCard of shuffledCards) {\n shuffledCard.classList.add('disable');\n };\n}", "function disable(){\n cards.filter(card=>{\n card.classList.add('disabled');\n });\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n winner();\n }", "function disableCorrectCards(){\n $(selectedCards[0]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[1]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[0]).find('.card-front').removeClass('active');\n $(selectedCards[1]).find('.card-front').removeClass('active');\n $(selectedCards[0]).off('click');\n $(selectedCards[1]).off('click');\n flipCardsBackDown();\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n\n resetBoard();\n }", "function disableAll(){\n Array.prototype.filter.call(deckOfCards, function(card){\n //Add disabled class to card div\n card.parentElement.classList.add('disabled');\n });\n}", "function onEnableCards(e) {\n\t\tuserInterface.enableRestartBtn();\n\n\t\tcards.forEach(card => {\n\t\t\tcard.enableMe();\n\t\t});\n\n\t\t// If game is resetting or over reset the card positions and run start game\n\t\tif (currentState == gameState.resetting || currentState == gameState.over) {\n\t\t\tcardCount++;\n\n\t\t\tif (cardCount == 17) {\n\t\t\t\tcardCount = 1;\n\t\t\t\tresetCardPositions();\n\t\t\t\tonStartGame(e);\n\t\t\t}\n\t\t}\n\t}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n}", "function matchCard() {\n\tif(openedCards[0].firstElementChild.getAttribute('class') === openedCards[1].firstElementChild.getAttribute('class')) {\n\t\topenedCards.map(function(card) {\n\t\t\tcard.className = 'card match disable';\n\t\t\tdeck.className = 'deck disable';\n\t\t\tsetTimeout(function(){\n\t\t\t\tdeck.classList.remove('disable');\t\n\t\t\t},850);\n\t\t\tmatchedCards.push(card);\n\t\t});\n\t\topenedCards = [];\n\t} else {\n\t\topenedCards.map(function(card) {\n\t\t\tcard.className = 'card fail disable';\n\t\t\tdeck.className = 'deck disable';\n\t\t\tsetTimeout(function(){\n\t\t\t\tcard.classList.remove('open','show','disable','fail');\n\t\t\t\tdeck.classList.remove('disable');\t\n\t\t\t},700);\n\t\t});\n\t\topenedCards = [];\n\t}\n}", "function checkForMatch () {\n let isMatch = firstCard.dataset.framework === secondCard.dataset.framework; \n \n isMatch ? disableCards() : unflipCards(); \n\n }", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n\n resetBoard();\n}", "function disableCards() {\n app.lockBoard = true;\n setTimeout(() => {\n app.firstCard.style.pointerEvents = \"none\";\n app.secondCard.style.pointerEvents = \"none\";\n resetBoard();\n }, 500);\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard());\n secondCard.removeEventListener('click', flipCard());\n resetBoard();\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n}", "function match() {\n let selected = document.querySelectorAll('.selected');\n selected.forEach(function(card) {\n card.classList.add('match');\n disable();\n });\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n ++score;\n checkForWin();\n resetBoard();\n}", "function disableCards() {\r\n firstCard.removeEventListener('click', flipCard);\r\n secondCard.removeEventListener('click', flipCard);\r\n resetBoard();\r\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n }", "function flipCard(card, cards_list){\n cardOpen.push(card)\n\n var crd = cards_list.filter(cards =>{\n return cards.id == card.id\n })\n\n card.src = crd[0].src\n\n if(cardOpen.length == 2){\n disable()\n check()\n count()\n }\n}", "function disableCardClick() {\n setTimeout(() => {\n $(\".matched\").off(\"click\", clearCardInPlay);\n }, 500);\n }", "function checkMatch() {\n // if firstCard equals secondCard then disable both cards click events else remove flip class.\n if (firstCard.dataset.card === secondCard.dataset.card){\n disableCards();\n } else {\n unflipCards();\n }\n}", "function disableCards() {\r\n firstCard.removeEventListener(\"click\", flipCard);\r\n secondCard.removeEventListener(\"click\", flipCard);\r\n\r\n resetBoard();\r\n}", "function enableCard(cardToEnable){\n cardToEnable.classList.remove('disabled');\n}", "function disableCLick() {\n openCards.forEach(function (card) {\n card.off('click');\n });\n}", "function matched() {\n openCards[0].classList.add(\"match\", \"disabled\");\n openCards[1].classList.add(\"match\", \"disabled\");\n openCards = [];\n}", "function unmatched() {\n openCards[0].classList.add('unmatched');\n openCards[1].classList.add('unmatched');\n disable();\n setTimeout(function() {\n enable();\n openCards = [];\n }, 1100);\n}", "function disableCards() {\n\n\tfirstCard.removeEventListener('click', flipCard);\n\tsecondCard.removeEventListener('click', flipCard);\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n pairs++;\n document.getElementById('pairs').innerHTML = pairs;\n resetBoard();\n setTimeout(() => {\n if (pairs == num_matches) {\n postToServer();\n }\n }, 2000);\n}", "function disableCards()\n{\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n}", "disableCardChooseButton() {\n let choiceButtonIsDisabled = this.choiceButton.nativeElement.classList.contains('disabled');\n if ((this.currMode == _entity_data_structures_card_modes__WEBPACK_IMPORTED_MODULE_1__[\"cardMode\"].voting && !choiceButtonIsDisabled) ||\n (this.currMode == _entity_data_structures_card_modes__WEBPACK_IMPORTED_MODULE_1__[\"cardMode\"].myTurn && choiceButtonIsDisabled) ||\n (this.currMode == _entity_data_structures_card_modes__WEBPACK_IMPORTED_MODULE_1__[\"cardMode\"].waiting && !choiceButtonIsDisabled)) {\n this.choiceButton.nativeElement.classList.toggle('disabled');\n }\n }", "function disableMatched(){\n for(let i = 0; i < finalArray.length; i++){\n let parentCard = finalArray[i].closest('.card');\n //Add the disabled class to the elements within the finalArray\n parentCard.classList.add('disabled');\n }\n}", "function lockCard() {\n\tif (listOfOpenCards.length === 2){\n\t\tlistOfOpenCards.map(x => x.className = 'card match');\n\t\tlistOfOpenCards = [];\n\t}\n}", "function disableCards(){\n let name = secondCard.dataset.name;\n player.innerHTML = name;\n firstCard.removeEventListener(\"click\", flipCard);\n secondCard.removeEventListener(\"click\", flipCard);\n player.classList.add(\"active\");\n resetBoard();\n setTimeout(gameFinished,1000);\n setTimeout(()=>{\n player.classList.remove(\"active\");\n },2000)\n}", "function check(){\n if(cardOpen[0].id == cardOpen[1].id){\n cardMatch.push(cardOpen[0])\n cardMatch.push(cardOpen[1])\n setTimeout(function(){\n cardOpen = []\n enable()\n },1000);\n }\n else{\n setTimeout(function(){\n cardOpen[0].src = \"cards/card.png\"\n cardOpen[1].src = \"cards/card.png\"\n cardOpen = []\n enable()\n },1000);\n }\n}", "function checkForMatch(){\n let isMatch = firstCard.dataset.name === secondCard.dataset.name\n\n isMatch ? disableCards() : unflipCards();\n }", "function noMatch(openCardsList) {\n setTimeout(function() {\n let cardTwo = openCardsList.pop();\n let cardOne = openCardsList.pop();\n\n\n for(let i = 0; i < deckSize; i++) {\n if(cardOne == deck[i].firstElementChild.className) {\n if(deck[i].className == \"card open show disable\") {\n deck[i].className = \"card enable\";\n }\n }\n else if(cardTwo == deck[i].firstElementChild.className) {\n if(deck[i].className == \"card open show disable\") {\n deck[i].className = \"card enable\";\n }\n }\n }\n },200);\n}", "function lockMatchedCards(){\n openedCards.forEach(function(card) {\n card.classList.remove('open', 'show');\n card.classList.add('match');\n });\n openedCards = [];\n }", "function checkForMatch()\n{\n if(firstCard.dataset.card===secondCard.dataset.card)\n {\n disableCards();\n return true;\n \n \n \n }\n else\n {\n unFlipCards();\n return false;\n \n }\n}", "function buttondisable1 () {\n $('#playcard').prop('disabled', false)\n}", "function checkForMatch() {\n let isMatch = firstCard.dataset.framework === secondCard.dataset.framework;\n isMatch ? disableMatchedCards() : unflipCards();\n }", "function enableCardOrNot(){\n let transferenciaELEM = document.getElementById(\"selectorDatosCuenta\");\n let sel = document.getElementById(\"selectorTarjeta\");\n let tarjetaELEM = document.getElementById(\"tarjeta\");\n let esTarjeta = tarjetaELEM.checked;\n if(esTarjeta){\n transferenciaELEM.disabled = true;\n sel.disabled = false;\n } else {\n transferenciaELEM.disabled = false;\n sel.disabled = true;\n }\n}", "function disableCard(cardToDisable){\n cardToDisable.classList.add(\"disabled\");\n}", "function checkForMatch(){\n let itsMatch = firstCard.dataset.name === secondCard.dataset.name;\n itsMatch ? disableCards() : unflipCards();\n}", "function matched() {\n openedCards[0].classList.add(\"match\", \"disabled\");\n openedCards[1].classList.add(\"match\", \"disabled\");\n openedCards[0].classList.remove(\"show\", \"open\", \"no-event\");\n openedCards[1].classList.remove(\"show\", \"open\", \"no-event\");\n openedCards = [];\n}", "function checkForMatch() {\n ++moves;\n let isMatch = firstCard.dataset.value === secondCard.dataset.value;\n isMatch ? disableCards() : unFlipCards();\n}", "function lockCards() {\n cardOpen[0].setAttribute('class', 'card match');\n cardOpen[1].setAttribute('class', 'card match');\n cardOpen = [];\n moves();\n stars();\n cardsEventListener();\n}", "function activateCards() {\n\tconst cardsElement = document.querySelectorAll('.card');\n\tcanFlip = true;\n\topenCards = [];\n\tmatch = 0;\n\n\tfor (const card of cardsElement) {\n\t\tcard.addEventListener('click', function() {\n\t\t\tstartClock();\n\t\t\tshowCard(card);\n\t\t});\n\t}\n}", "canFlipCard(card) {\n return !this.busy && !matchedCards.includes(card) && card !== this.cardToCheck;\n }", "function disable() {\n document.addEventListener(\"click\",handler,true);\n function handler(e){\n /*if matches two cards on click*/\n if(openCards.length == 2) {\n /* avoids clicking a third card when 2 cards are open*/\n e.stopPropagation();\n }\n }\n}", "function isMatch(card1, card2){\n $(card1).off(\"click\");\n $(card2).off(\"click\");\n}", "function matched(){\n displayDeck[0].classList.add(\"match\", \"disabled\");\n displayDeck[1].classList.add(\"match\", \"disabled\");\n displayDeck[0].classList.remove(\"show\", \"open\", \"no-event\");\n displayDeck[1].classList.remove(\"show\", \"open\", \"no-event\");\n displayDeck = [];\n}", "function cardsMatched(){\n openCards[0].classList.add(\"match\", \"disabled\");\n openCards[1].classList.add(\"match\", \"disabled\");\n openCards[0].classList.remove(\"show\", \"open\", \"no-event\");\n openCards[1].classList.remove(\"show\", \"open\", \"no-event\");\n openCards = [];\n}", "function unmatched() {\n openedCards[0].classList.add(\"unmatched\");\n openedCards[1].classList.add(\"unmatched\");\n disable();\n setTimeout(function () {\n openedCards[0].classList.remove(\"show\", \"open\", \"no-event\", \"unmatched\");\n openedCards[1].classList.remove(\"show\", \"open\", \"no-event\", \"unmatched\");\n enable();\n openedCards = [];\n }, 1100);\n}", "allowedToFlip(card) {\n return !this.busy && !this.matchedCards.includes(card) && card !== this.verifyCard;\n }", "function unmatched() {\n openedCards[0].classList.add('unmatched');\n openedCards[1].classList.add('unmatched');\n disable();\n setTimeout(function() {\n openedCards[0].classList.remove('show', 'open', 'no-event', 'unmatched');\n openedCards[1].classList.remove('show', 'open', 'no-event', 'unmatched');\n enable();\n openedCards = [];\n }, 1100);\n}", "function match(openCardsList) {\n let cardTwo = openCardsList.pop();\n let cardOne = openCardsList.pop();\n\n for(let i = 0; i < deckSize; i++) {\n if(deck[i].firstElementChild.className === cardOne) {\n deck[i].className = \"card match disable\";\n }\n else if (deck[i].firstElementChild.className === cardTwo) {\n deck[i].className = \"card match disable\";\n }\n }\n\n return matchCounter++;\n}", "function checkPairs(card) {\n counts++;\n stars();\n disable();\n if (card.getElementsByTagName('i')[0].className === cardPairsArray[0].getElementsByTagName('i')[0].className) {\n card.className = 'card match disabled';\n cardPairsArray[0].className = 'card match disabled';\n cardPairsArray = [];\n matchedCards++;\n enable();\n } else {\n setTimeout(function () {\n card.className = 'card';\n cardPairsArray[0].className = 'card';\n cardPairsArray = [];\n enable();\n }, 750);\n count.innerText = counts;\n }\n}", "function checkForMatch() {\r\n let isMatch = firstCard.dataset.framework === secondCard.dataset.framework;\r\n isMatch? disableCards() : unflipCards();\r\n\r\n function disableCards () {\r\n firstCard.removeEventListener('click', flipCard);\r\n secondCard.removeEventListener('click', flipCard);\r\n\r\n resetBoard();\r\n // console.log(\"Function was executed!\")\r\n }\r\n function unflipCards() {\r\n lockedBoard = true;\r\n setTimeout(() => {\r\n firstCard.classList.remove('flip');\r\n secondCard.classList.remove('flip');\r\n resetBoard();\r\n }, 1500);\r\n }\r\n }", "function handleMatchedCards() {\r\n let matchCardsArray = Array.prototype.slice.call(matchCardsHC);\r\n matchCardsArray.forEach(function(card) {\r\n card.classList.remove('open', 'show');\r\n });\r\n}", "function enableTwo() {\n $(\"#attackTwo\").prop(\"disabled\", false);\n $(\"#strAttackTwo\").prop(\"disabled\", false);\n $(\"#defendTwo\").prop(\"disabled\", false);\n $(\"#counterTwo\").prop(\"disabled\", false);\n}", "function flipCards(){\n\t\t\t\n\tfor(var i = 0;i<16;i++){\n\t\t\t\t\n\t\tcards[i].className += ' down';\n\t\t\t\t\n\t}\n\t\n\t//enable all cards\n\tfor(var i = 0;i<16;i++){\n\t\t\t\n\t\tdocument.getElementById(i).style.pointerEvents = 'auto';\n\t\t\t\n\t}\n\t\t\t\n}", "function handleMatchedCards() {\n let matchCardsArray = Array.prototype.slice.call(matchCardsHC);\n matchCardsArray.forEach(function (card) {\n card.classList.remove('open', 'show');\n });\n}", "function turnOver(card) {\n for (card=0; card < cardArray.length; card++) {\n if (cardArray[card].classList.contains(\"match\") === false) {\n cardArray[card].classList.remove(\"card-image\");\n cardArray[card].classList.remove(\"unclickable\");\n cards.classList.remove(\"unclickable\");\n }\n }\n}", "function SetImageDisabled(card)\n{\n if (card.length > 0)\n {\n let id = \"div#cardImages #\" + card + \" img\";\n $(id).attr('src', '/images/' + card + 'Disabled.png');\n }\n}", "function checkMatch(currentCard, previousCard) {\n setTimeout(function() {\n if (toggledCards[0].innerHTML === toggledCards[1].innerHTML) {\n toggledCards[0].classList.toggle(\"match\", \"disabled\");\n toggledCards[1].classList.toggle(\"match\", \"disabled\");\n matchedCards.push(toggledCards[0]);\n matchedCards.push(toggledCards[1]);\n } else {\n toggledCards[0].classList.remove(\"open\", \"show\", \"unclick\", \"disabled\");\n toggledCards[1].classList.remove(\"open\", \"show\", \"unclick\", \"disabled\");\n }\n enable();\n if (matchedCards.length == 16) {\n checkGameOver();\n }\n toggledCards = [];\n }, 500);\n}", "function checkForMatch() {\n let isMatch = firstCard.dataset.word === secondCard.dataset.word;\n isMatch ? disableCards() : unflipCards();\n\n}", "function enableClick() {\n openCards[0].click(toggleCard);\n}", "checkMatch (card)\r\n {\r\n if (this.getCardType (card) == this.getCardType (this.cardToCheck))\r\n {\r\n //console.log (\"checked\");\r\n this.matchedCards.push(card);\r\n this.matchedCards.push(this.cardToCheck);\r\n //card.classList.add(\"revealed\");\r\n //this.cardToCheck.classList.add(\"revealed\");\r\n if (this.matchedCards.length == 16)\r\n {\r\n this.overlayOn ();\r\n }\r\n }\r\n else\r\n {\r\n //console.log (\"busy: \" + this.busy);\r\n this.misMatched (card, this.cardToCheck);\r\n //setTimeout (function () {console.log (\"go!\");}, 500);\r\n }\r\n }", "function disableGame() {\n cards.forEach(card => {\n card.removeEventListener('click', flipCard);\n });\n resetBoard();\n}", "function enableClick() {\n for (let x = 0; x < allCards.length; x++) {\n allCards[x].classList.remove(\"stop-event\");\n }\n}", "function unmatched(){\n\n //timeout function to add miss-match class after 800ms\n setTimeout(function(){\n firstCard.parentElement.classList.add('miss-match');\n secondCard.parentElement.classList.add('miss-match');\n }, 800);\n\n disableAll();\n //timeout function to remove miss-match class after 1200ms\n setTimeout(function(){\n firstCard.parentElement.classList.remove('miss-match');\n secondCard.parentElement.classList.remove('miss-match');\n\n }, 1300);\n\n //timeout function to remove flipped class after 1000ms\n setTimeout(function(){\n firstGrandParent = firstCard.closest('.card-body');\n secondGrandParent = secondCard.closest('.card-body');\n\n //call enableUnmatched function to re-enable diabled cards\n enableUnmatched();\n\n //Remove flip from the card so it rotates back to the back side\n firstGrandParent.classList.remove('flipped');\n secondGrandParent.classList.remove('flipped');\n }, 1000);\n //clear array\n matchCards = [];\n}", "function toggle_card(div, enable) {\n div.style.opacity = enable ? 1 : 0.3;\n}", "function checkForMatch() {\n let isMatch = firstCard.dataset.dice === secondCard.dataset.dice;\n isMatch ? disableCards() : unflipCards();\n}", "function notMatch() {\n setTimeout(function() {\n toggleCard(openCards[0]);\n toggleCard(openCards[1]);\n openCards = [];\n }, 700)\n}", "function openCard() {\n if (clockStatus == 0) {\n beginTimer();\n clockStatus = clockStatus + 1;\n }\n\n this.classList.add(\"card\");\n this.classList.add(\"open\");\n this.classList.add(\"show\");\n this.classList.add(\"disable\");\n cardMemory.push(this);\n if (cardMemory.length == 2) {\n moves = moves + 1;\n moveSection.innerHTML = moves;\n rating();\n if (cardMemory[0].children[0].classList.item(1) == cardMemory[1].children[0].classList.item(1)) {\n console.log(\"matched\");\n cardMemory[0].classList.add(\"match\", \"disable\");\n cardMemory[1].classList.add(\"match\", \"disable\");\n // all cards are matched the automatically stop the time here\n if (colliedCards.length == 16) {\n clearInterval(clock);\n Swal.fire({\n title: \"Completed\",\n html: 'you won two stars <strong style=\"color:#ff9f33; test-shadow:3px 3px 3px #000\">' + starNoof + '<i class=\"fa fa-star\"></i> </strong><br>you completed this game with the time of <br>' + sec + 'Seconds' + min + 'minutes' + hour + 'hour:',\n confirmButtonText: '<i class=\"fa fa-thumbs-up\"></i> PlayAgain',\n }).then(() => {\n document.location.reload();\n });\n }\n cardMemory = [];\n } else {\n console.log(\"notMatchd\");\n cardMemory[0].classList.add(\"unmatch\");\n cardMemory[1].classList.add(\"unmatch\");\n cardMemory.map((son) => {\n setTimeout(() => {\n son.classList.remove(\"unmatch\", \"open\", \"show\", \"disable\");\n }, 200)\n\n cardMemory = [];\n })\n }\n }\n}" ]
[ "0.82927895", "0.8286131", "0.81580585", "0.8155706", "0.80238324", "0.79862046", "0.7738137", "0.7726482", "0.7612761", "0.74629796", "0.7360714", "0.7322394", "0.72261035", "0.72146314", "0.71507835", "0.7141866", "0.7128677", "0.7127913", "0.7119836", "0.71009874", "0.70933974", "0.7088405", "0.70778346", "0.7053002", "0.701868", "0.6994864", "0.69753844", "0.6974267", "0.6970931", "0.6945061", "0.6923196", "0.6905873", "0.68345606", "0.6804939", "0.680421", "0.67818004", "0.6771516", "0.67677623", "0.67650336", "0.67586863", "0.6751947", "0.6741357", "0.6737073", "0.6719062", "0.6701502", "0.66921604", "0.6686897", "0.6681585", "0.6678615", "0.6671765", "0.6671624", "0.6655059", "0.66174084", "0.65850496", "0.65559816", "0.65536183", "0.65248305", "0.65245885", "0.65129995", "0.6510217", "0.650728", "0.6505424", "0.65021807", "0.6500247", "0.64667875", "0.6458983", "0.6458276", "0.6413653", "0.6411457", "0.6339749", "0.6331654", "0.63306063", "0.632227", "0.63181984", "0.63059455", "0.6305528", "0.63034403", "0.62822527", "0.62797195", "0.626686", "0.62639934", "0.62523144", "0.6249934", "0.6226763", "0.6226287", "0.6211523", "0.620758", "0.61925375", "0.6178604", "0.6173354", "0.6167144", "0.6160302", "0.6154714", "0.6145364", "0.612353", "0.6118548", "0.6114543", "0.6111366", "0.60898155", "0.60718644" ]
0.7960289
6
Check to see if cards are a match, if they are, adds match properties and if they are not, returns the cards back face down
function checkMatch(currentCard, previousCard) { setTimeout(function() { if (toggledCards[0].innerHTML === toggledCards[1].innerHTML) { toggledCards[0].classList.toggle("match", "disabled"); toggledCards[1].classList.toggle("match", "disabled"); matchedCards.push(toggledCards[0]); matchedCards.push(toggledCards[1]); } else { toggledCards[0].classList.remove("open", "show", "unclick", "disabled"); toggledCards[1].classList.remove("open", "show", "unclick", "disabled"); } enable(); if (matchedCards.length == 16) { checkGameOver(); } toggledCards = []; }, 500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkForMatch() {\n let isMatch = (firstCard.dataset.name === secondCard.dataset.name); \n if (isMatch) {\n disableCards();\n matchCount += 2; \n } else {\n unFlipCards(); \n }\n}", "function cardMatch() {\n if(cardSelections[0].firstElementChild.className === cardSelections[1].firstElementChild.className) {\n // If a match adds the match class to each card in array\n cardSelections.forEach(function(card){\n card.classList.add('match');\n });\n matchCount++;\n cardSelections = [];\n } else {\n // If no match sets timeout on card flipping via toggle.\n setTimeout(function() {\n displayCard(cardSelections[0]);\n displayCard(cardSelections[1]);\n cardSelections = [];\n }, 400 );\n }\n }", "function match() {\n\t\tfor(card of chosenCards) {\n\t\t\t\tcard.classList.add('match');\n\t\t\t\tgotRight(card);\n\t\t};\n\t\tpairsRemain--;\n\t\tcheckWin();\n\t\tempty();\n}", "function matching (){\n\t openCards[0].classList.add(\"match\");\n openCards[1].classList.add(\"match\");\n openCards[0].classList.remove(\"show\", \"open\");\n openCards[1].classList.remove(\"show\", \"open\"); \n //save matched cards in an array \n matchCards.push(openCards[0],openCards[1]);\n //clear open cards array\n \topenCards = [];\n \treturn matchCards;\n}", "cardMatch(card1, card2) {\n matchedCards.push(card1); \n matchedCards.push(card2);\n card1.classList.add(\"matched\");\n card2.classList.add(\"matched\");\n this.audioController.match();\n if (matchedCards.length === cardCount[difficulty]) {\n this.victory();\n }\n }", "cardMatch(card1, card2) {\n this.matchedCards.push(card1);\n this.matchedCards.push(card2);\n card1.classList.add('matched');\n card2.classList.add('matched');\n this.AudioFiles.match();\n if(this.matchedCards.length === this.cardsArray.length)\n this.victory();\n }", "cardMatch(card1, card2) {\n this.matchedCards.push(card1);\n this.matchedCards.push(card2);\n card1.classList.add('matched');\n card2.classList.add('matched');\n this.calculateScore();\n if (this.matchedCards.length === this.cardArray.length)\n this.victory();\n }", "function matchCards() {\r\n if (cardOneVal === cardTwoVal) { // if the values of the data-card attribute are the same add class match.\r\n console.log('they match');\r\n cardOne.className += ' match';\r\n cardTwo.className += ' match';\r\n cardOne, cardTwo = undefined;\r\n } else if (cardOneVal != cardTwoVal && cardTwoVal != undefined) {\r\n console.log(\"they don't match\");\r\n cardOneVal = undefined;\r\n cardTwoVal = undefined;\r\n\r\n setTimeout(function() { //add a slight timer for the cards to be shown before they are flipped back when they don't match\r\n if (cardOneVal == undefined && cardTwoVal == undefined) {\r\n setTimeout(function() {\r\n cardTwo.classList.remove('show');\r\n cardOne.classList.remove('show');\r\n }, 250);\r\n\r\n setTimeout(function() {\r\n // console.log(\"card one: \" + cardOne + \" cardTwo: \" + cardTwo);\r\n cardOne.classList.remove('open');\r\n cardTwo.classList.remove('open');\r\n }, 600);\r\n }\r\n }, 600);\r\n }\r\n }", "function cardMatch() {\n //add 2 to the tally of matched cards\n matched += 2;\n openCards[0].classList.add('match');\n openCards[0].classList.add('open');\n openCards[0].classList.add('show');\n\n openCards[1].classList.add('match');\n openCards[1].classList.add('open');\n openCards[1].classList.add('show');\n //empty array\n openCards = [];\n}", "function checkMatch() {\n if (app.firstCard.dataset.avenger === app.secondCard.dataset.avenger) {\n disableCards();\n cardMatchSound();\n app.matchedCards.push(app.firstCard.dataset.avenger);\n gameComplete();\n return;\n }\n unflipCards();\n}", "function checkForMatch()\n{\n if(firstCard.dataset.card===secondCard.dataset.card)\n {\n disableCards();\n return true;\n \n \n \n }\n else\n {\n unFlipCards();\n return false;\n \n }\n}", "function matchCard() {\n\tif(openedCards[0].firstElementChild.getAttribute('class') === openedCards[1].firstElementChild.getAttribute('class')) {\n\t\topenedCards.map(function(card) {\n\t\t\tcard.className = 'card match disable';\n\t\t\tdeck.className = 'deck disable';\n\t\t\tsetTimeout(function(){\n\t\t\t\tdeck.classList.remove('disable');\t\n\t\t\t},850);\n\t\t\tmatchedCards.push(card);\n\t\t});\n\t\topenedCards = [];\n\t} else {\n\t\topenedCards.map(function(card) {\n\t\t\tcard.className = 'card fail disable';\n\t\t\tdeck.className = 'deck disable';\n\t\t\tsetTimeout(function(){\n\t\t\t\tcard.classList.remove('open','show','disable','fail');\n\t\t\t\tdeck.classList.remove('disable');\t\n\t\t\t},700);\n\t\t});\n\t\topenedCards = [];\n\t}\n}", "function matchedCard() {\n\tlet firstCard = allOpenedCards[0];\n\tlet secondCard = allOpenedCards[1];\n\tif(allOpenedCards.length === 2) {\n\t\tmoveCounter();\n\t\tscoreCheck();\n\t\tif(firstCard.children().attr('class') === secondCard.children().attr('class')) {\n\t\t\tfirstCard.addClass('match');\n\t\t\tsecondCard.addClass('match');\n\t\t\tallOpenedCards.length = 0;\n\t\t\tmatchCount++;\n\t\t\tif(matchCount === matchedPairs) {\n\t\t\t\tgameOver();\n\t\t\t}\n\t\t} else {\n\t\t\tsetTimeout(function() {\n\t\t\t\tfirstCard.removeClass('open show disabled');\n\t\t\t\tsecondCard.removeClass('open show disabled');\n\t\t\t\tallOpenedCards.length = 0;\n\t\t}, 300);\t\n\t\t}\n\t}\n}", "function checkForMatch() { //use in the flipCard function\n //Cards match - using data attribute in HTML\n if (firstCard.dataset.type === secondCard.dataset.type) {\n //dataset.type: to access to the data attribute that I called type in the HTML\n disableCards();\n } else {\n unflipCards();\n }\n }", "function checkForCardMatch(){\r\n\r\n //CHECK TO SEE IF CARDS MATCH VIA MATCHING DATASETS\r\n let isCardMatch = firstCard.dataset.carmaker === secondCard.dataset.carmaker;\r\n\r\n //ADD SCORE TO PLAYERS\r\n if( isCardMatch === true ){\r\n matchedCards.push(firstCard,secondCard);\r\n checkTurn();\r\n disableCards();\r\n return updateScore();\r\n } else if ( isCardMatch !== true ){\r\n //IF CARDS DO NOT MATCH RUN UNCLIPCARD FUNCTION\r\n checkTurn();\r\n return unflipCards();\r\n } \r\n \r\n gameFinished();\r\n\r\n}", "function isMatch() {\n // With the HTML 5 data atrribute if the 2 cards has the same Data name || value\n // if true call the keepFlipped() Function\n firstCard.dataset.ico === secondCard.dataset.ico ? keepFlipped() : recoverCards(); // And if false call the recoverCards() function\n}", "function matchingCards (flippedCards) {\n flippedCards[0].classList.toggle('match');\n flippedCards[1].classList.toggle('match');\n flippedCards[0].classList.toggle('open');\n flippedCards[0].classList.toggle('show');\n flippedCards[1].classList.toggle('open');\n flippedCards[1].classList.toggle('show');\n matchedCards.push(flippedCards[0], flippedCards[1]);\n flippedCards.length = 0;\n}", "function checkMatch() {\n if (facedCards[0].firstElementChild.className == facedCards[1].firstElementChild.className) {\n for (let card of facedCards) {\n card.classList.add(\"match\");\n }\n /*Once match is made facedCards array is emptied. */\n facedCards = [];\n /*Match is added to match total*/\n matches++;\n /*Updates the wait variable to false so that users can click cards for the next try*/\n wait = false;\n } else {\n /*Flips cards that are not a match back over after a short delay. */\n setTimeout(clearFacedCards, 1000);\n }\n}", "function cardMatch(card1, card2)\n\t{\n\t\tcard1.addClass('match');\n\t\tcard2.addClass('match');\n\t\tpreviousCard = null;\n\t}", "cardMatch(card1, card2) {\n this.matchedCards.push(card1);\n this.matchedCards.push(card2);\n card1.classList.add('matched');\n card2.classList.add('matched');\n this.soundControl.matched();\n if(this.matchedCards.length === this.cardsArray.length)\n \n this.winner();\n }", "function checkForMatch () {\n let isMatch = firstCard.dataset.framework === secondCard.dataset.framework; \n \n isMatch ? disableCards() : unflipCards(); \n\n }", "function assignMatch() {\n for (card=0; card < cardArray.length; card++) {\n if ((cardArray[card].classList.contains(\"match\") === false) && (cardArray[card].classList.contains(\"card-image\"))) {\n cardArray[card].classList.add(\"match\");\n }\n }\n}", "function addToMatched() {\n\n const matchedCards = []; //new array for matched cards\n\n //add matched cards to the array\n for (let i = 0; i < cards.length; i++) {\n if (cards[i].classList.contains('match') === true) {\n matchedCards.push(cards[i]);\n }\n }\n\n //check if all cards have matched to end the game\n if (matchedCards.length === 16) {\n endGame();\n }\n}", "function match() {\n\n\tpairs++;\n\tcount = 0;\n\tdisableCards();\n\tresetCards();\n\tscoreKeeper();\n\n}", "function checkForMatch() {\r\n let isMatch = firstCard.dataset.framework === secondCard.dataset.framework;\r\n\r\n if (isMatch) {\r\n disableCards();\r\n correct_flips += 1;\r\n } else {\r\n unflipCards();\r\n }\r\n}", "function match(openCardsList) {\n let cardTwo = openCardsList.pop();\n let cardOne = openCardsList.pop();\n\n for(let i = 0; i < deckSize; i++) {\n if(deck[i].firstElementChild.className === cardOne) {\n deck[i].className = \"card match disable\";\n }\n else if (deck[i].firstElementChild.className === cardTwo) {\n deck[i].className = \"card match disable\";\n }\n }\n\n return matchCounter++;\n}", "function matched(){\r\n\r\n /* Get Cards from numId Array */\r\n let i = document.getElementById(numId[0]);\r\n let x = document.getElementById(numId[1]);\r\n\r\n /* If Flipped Cards Match */\r\n if(cardIDs[0] === cardIDs[1]){\r\n /* Change First Card to Matched */\r\n i.parentElement.classList.add('matched');\r\n i.parentElement.children[1].style.backgroundColor = `#46B1C9`;\r\n i.parentElement.children[1].style.boxShadow = `inset 3px 3px 6px black`;\r\n /* Change Second Card to Matched */\r\n x.parentElement.classList.add('matched');\r\n x.parentElement.children[1].style.backgroundColor = `#46B1C9`;\r\n x.parentElement.children[1].style.boxShadow = `inset 3px 3px 6px black`;\r\n /* Add to Paired Count */\r\n paired++;\r\n /* Check if Won */\r\n setTimeout(won, 500);\r\n }\r\n\r\n /* If Not */\r\n else {\r\n i.parentElement.classList.toggle('is-flipped');\r\n x.parentElement.classList.toggle('is-flipped');\r\n starRating();\r\n }\r\n\r\n /* Reset Variables to Check */\r\n cardFlip = 0;\r\n cardIDs = [];\r\n numId = [];\r\n}", "function match() {\n openCards[0].classList.add('match');\n openCards[1].classList.add('match');\n matchedCards.push(openCards);\n openCards = [];\n win();\n}", "function isMatch(card){\n \n if(openedCard.length==0){\n openedCard.push(card);\n incrementMoves();\n starCounter();\n }else{\n openedCard.push(card);\n\n if(openedCard[0].children[0].getAttribute('class')==openedCard[1].children[0].getAttribute('class')){ \n matched(openedCard);\n openedCard=[];\n }else{\n noMatched(openedCard);\n openedCard=[];\n } \n } \n}", "function checkForMatch() {\n let isMatch = firstCard.dataset.framework === secondCard.dataset.framework;\n isMatch ? disableMatchedCards() : unflipCards();\n }", "function checkForMatch() {\n ++moves;\n let isMatch = firstCard.dataset.value === secondCard.dataset.value;\n isMatch ? disableCards() : unFlipCards();\n}", "function matched(activeCards) {\n for (var i = 0; i < activeCards.length; i++) {\n activeCards[i].classList.add(\"match\");\n activeCards[i].classList.add(\"animated\");\n activeCards[i].classList.add(\"flip\");\n }\n}", "function checkForMatch() {\n let cardsMatch = firstCard.dataset.pokemon === secondCard.dataset.pokemon;\n cardsMatch ? correctMatch() : resetCards();\n}", "function matchCards() {\n for (const openCard of openCards) {\n openCard.addClass('match bounce');\n }\n}", "function addMatched(card) {\n matchedCards.push(card);\n }", "function cardMatch () {\n if (cardsShow[0].querySelector('i').classList.value == cardsShow[1].querySelector('i').classList.value) {\n cardsShow[0].classList.add('match');\n cardsShow[1].classList.add('match');\n cardsShow[0].classList.remove('show', 'open');\n cardsShow[1].classList.remove('show', 'open');\n cardsMatched.push(cardsShow[0].innerHTML);\n cardsMatched.push(cardsShow[1].innerHTML);\n }\n}", "function match(twoCards) {\n shown = [];\n for (const card of twoCards) {\n card.classList.add('match');\n card.classList.remove('show', 'open');\n }\n matched += 2;\n if(matched == cards.length){\n finishGame();\n }\n}", "function cardMatch(listOfCards) {\n $(\".open\").removeClass(\"noDuplicate\");\n let cardOne = $(listOfCards[0]).html();\n let cardTwo = $(listOfCards[1]).html();\n if (cardOne === cardTwo) {\n $(\".open\").addClass(\"match\");\n cardMatchCounter ++;\n gameFinishCheck(cardMatchCounter);\n } else {\n /** counts how many failed attempts have been made to match cards */\n numberOfMisses ++;\n moveCounter(numberOfMisses);\n /** if the cards do not match, remove the cards from the list and hide\n * the card's symbol (put this functionality in another function\n * that you call from this one) */\n allFaceDown();\n }\n}", "function cardsShownMatch(openCardPair) {\n while (openCardPair.length > 0){\n let c = openCardPair.pop();\n c.classList.add(\"match\");\n c.classList.remove(\"open\");\n c.classList.remove(\"show\");\n }\n cardsMatched += 2; // track how many pairs of cards have matched\n return openCardPair;\n}", "function checkCardMatch() {\n\tif (activeCards[0].getAttribute('data-symbol') === activeCards[1].getAttribute('data-symbol')) {\n\t\tfor (let card of activeCards) {\n\t\t\tcard.classList.add('card--matched');\n\t\t}\n\t\tcorrectMatches += 1;\n\t\tupdateLogo();\n\t\tactiveCards = [];\n\n\t\tif (correctMatches === 8) {\n\t\t\tendGame();\n\t\t}\n\n\t} else {\n\t\tsetTimeout(clearActiveCards, 1000);\n\t}\n\n\tupdateMovesCounter();\n\n\tsetTimeout(function() {\n\t\tgameBoard.classList.remove('game-board--disabled');\n\t}, 1000);\n}", "function checkForMatch(){\n let isMatch = firstCard.dataset.name === secondCard.dataset.name\n\n isMatch ? disableCards() : unflipCards();\n }", "function matchCards(previousCard, currentCard) {\n previousCard.status = \"match\";\n $(previousCard.dom).toggleClass(\"open match squash-card\");\n $(currentCard.dom).toggleClass(\"open match squash-card\");\n\n setTimeout(function () {\n $(previousCard.dom).toggleClass(\"squash-card\");\n $(currentCard.dom).toggleClass(\"squash-card\");\n previousCard.dom = null;\n }, 500);\n}", "checkMatch() {\n let newCard = {};\n if (this.state.first.letter == this.state.second.letter) {\n newCard = {isMatched: true, color: 'green'};\n let newState = _.assign({}, this.state, {numMatches: this.state.numMatches + 1});\n this.setState(newState);\n } else {\n newCard = {isFlipped: false, color: 'gray'};\n }\n\n let updatedCards = _.map(this.state.cards, (card) => {\n if (card.key == this.state.first.key || card.key == this.state.second.key) {\n return _.extend(card, newCard);\n } else {\n return card;\n }\n });\n\n let newState = _.assign({}, this.state, {\n first: null,\n second: null,\n cards: updatedCards\n });\n this.setState(newState);\n }", "function doCardsMatch() {\n if(firstCard.dataset.icon === secondCard.dataset.icon) {\n cardArray.push(firstCard);\n cardArray.push(secondCard);\n disable();\n return;\n };\n unflippingCards(); \n}", "function matchedCard(cardElem) {\n cardElem.classList.remove(FLIP);\n cardElem.classList.add(MATCH);\n }", "function match() {\n console.log('funciton match active');\n openCards[0].classList.add('open', 'match');\n openCards[1].classList.add('open', 'match');\n matchedCards.push(openCards);\n openCards = [];\n if (matchedCards.length === 8) {\n gameOver();\n } else {\n console.log('number of cards matched' + matchedCards);\n }\n}", "function isMatch() {\n if (cardOne.dataset.title === cardTwo.dataset.title) {\n keepShowing();\n pairs = pairs + 1;\n checkIfWon();\n return;\n }\n unflipCards();\n decreaseHealth();\n}", "function compareCards(event) {\n if (symbolArray[0] == symbolArray[1]) {\n cardArray[0].classList.add('match');\n cardArray[1].classList.add('match');\n\n matchList += 2;\n }\n}", "function doCardsMatch(){\n if (firstCard === secondCard) {\n console.log(\"they match\");\n //create function\n firstCard = \"\";\n secondCard = \"\";\n firstCardIndex = 0;\n secondCardIndex = 0;\n } else {\n //create function\n $($(\"img\")[firstCardIndex]).css({\"height\": \"100%\", \"width\": \"100%\"});\n $($(\"p\")[firstCardIndex]).css(\"visibility\", \"hidden\");\n $($(\"img\")[secondCardIndex]).css({\"height\": \"100%\", \"width\": \"100%\"});\n $($(\"p\")[secondCardIndex]).css(\"visibility\", \"hidden\");\n firstCard = \"\";\n secondCard = \"\";\n firstCardIndex = 0;\n secondCardIndex = 0;\n }\n }", "function checkForMatch(){\n let itsMatch = firstCard.dataset.name === secondCard.dataset.name;\n itsMatch ? disableCards() : unflipCards();\n}", "function cardsMatched() {\n openedCards[0].classList.add(\"match\", \"disable\");\n openedCards[1].classList.add(\"match\", \"disable\");\n matched++;\n if (matched == 8) { //set at 1 for testing purposes\n congratsPopup();\n }\n openedCards = [];\n console.log(\"Match function working\");\n console.log(matched);\n }", "checkMatch (card)\r\n {\r\n if (this.getCardType (card) == this.getCardType (this.cardToCheck))\r\n {\r\n //console.log (\"checked\");\r\n this.matchedCards.push(card);\r\n this.matchedCards.push(this.cardToCheck);\r\n //card.classList.add(\"revealed\");\r\n //this.cardToCheck.classList.add(\"revealed\");\r\n if (this.matchedCards.length == 16)\r\n {\r\n this.overlayOn ();\r\n }\r\n }\r\n else\r\n {\r\n //console.log (\"busy: \" + this.busy);\r\n this.misMatched (card, this.cardToCheck);\r\n //setTimeout (function () {console.log (\"go!\");}, 500);\r\n }\r\n }", "function checkForMatch() {\n let isMatch = firstCardFlip.dataset.name === secondCardFlip.dataset.name;\n isMatch ? disableCards() : unflipCards();\n if (isMatch) {\n counter++;\n console.log(\"isMatch: \", counter);\n if (counter === levelMatches) {\n window.location = nextUrl;\n }\n disableCards();\n } else {\n console.log(\"notMatch: \", counter);\n }\n\n}", "function checkMatch() {\n if (openedCards[0][0].firstChild.className == openedCards[1][0].firstChild.className) {\n console.log('This is a match!');\n openedCards[0].addClass('match');\n openedCards[1].addClass('match');\n clickOff();\n clearOpenCards();\n setTimeout(checkForWin, 900);\n } else {\n openedCards[0].toggleClass('open show').animateCss('flipInY');\n setTimeout(flipDelay, 600); //2nd card closes after the first\n clickOn();\n }\n}", "function matchCards() {\r\n\r\n // Function Call to flip 'this' particular Card\r\n flipCard(this);\r\n\r\n // Storing Id and Src of Clicked Cards\r\n id = $(this).attr('id');\r\n src = $($($(this).children()[1]).children()[0]).attr(\"src\");\r\n\r\n // Counting Number of Moves\r\n count += 1;\r\n if (count % 2 == 0) {\r\n moves = count / 2;\r\n $(\"#moves\").html(moves);\r\n // Function call to set stars as number of moves changes\r\n setRating();\r\n }\r\n\r\n // Pushing values in Array if less than 2 Cards are open\r\n if (hasSrc.length < 2 && hasId.length < 2) {\r\n hasSrc.push(src);\r\n hasId.push(id);\r\n\r\n // Turning off Click on first Card\r\n if (hasId.length == 1)\r\n $(this).off('click');\r\n }\r\n\r\n // Matching the two opened Cards\r\n if (hasSrc.length == 2 && hasId.length == 2) {\r\n if (hasSrc[0] == hasSrc[1] && hasId[0] != hasId[1]) {\r\n // Counting Pairs\r\n pair += 1;\r\n\r\n // Turning off Click on matched Cards\r\n $.each(hasId, function(index) {\r\n $('#' + hasId[index] + '').off(\"click\");\r\n });\r\n\r\n } else {\r\n // Flipping back unmatched Cards with a bit of delay\r\n $.each(hasId, function(index, open) {\r\n setTimeout(function() {\r\n flipCard('#' + open + '');\r\n }, 600);\r\n });\r\n\r\n // Turing on Click on first unmatched Card\r\n $('#' + hasId[0] + '').on(\"click\", matchCards);\r\n }\r\n\r\n // Emptying the Arrays \r\n hasSrc = [];\r\n hasId = [];\r\n }\r\n\r\n // Checking if all Cards are matched\r\n if (pair == 8) {\r\n endGame();\r\n }\r\n\r\n }", "function isMatch() {\n const openCard = document.getElementsByClassName(\"open show\");\n\n clickCounter++;\n\n //accesses the first and second cards as they're clicked\n const firstCard = openCard[0];\n const secondCard = openCard[1];\n\n /* compares everything about the cards to each other (comparing the node would\n * probably not be the best solution in the wild, but because the whole card * will be identical here, I think it's fine) */\n const matchedCards = firstCard.isEqualNode(secondCard);\n\n /* if the cards match, open & show classes are removed, match class is added\n * if the cards don't match, open & show classes are removed and the cards\n * can be accessed again */\n if (matchedCards) {\n firstCard.classList.remove(\"open\", \"show\");\n secondCard.classList.remove(\"open\", \"show\");\n firstCard.classList.add(\"match\");\n secondCard.classList.add(\"match\");\n\n clickCounter = 0;\n moves++;\n\n } else if (clickCounter === 2) {\n // closes both cards after a delay if they're not a match\n window.setTimeout(function() {\n firstCard.classList.remove(\"open\", \"show\");\n secondCard.classList.remove(\"open\", \"show\");\n }, 500);\n\n clickCounter = 0;\n moves++;\n\n } else {\n //// do nothing\n }\n\n /* victory condition which stops the timer and pops open a modal that\n * displays the player's stats */\n const allCardsMatched = document.querySelectorAll(\".match\");\n if (allCardsMatched.length === 16) {\n clearInterval(Interval);\n victoryModal();\n }\n}", "function cardsMatch() {\n\n // add match class\n openCards[0].classList.add('match');\n openCards[1].classList.add('match');\n\n // allow clicks again & remove 'open', 'show' classes\n for (let i = 0; i <= initialArray.length - 1; i++) {\n \tlistOfCards[i].classList.remove('no-click', 'open', 'show');\n }\n\n // empty openCards array\n openCards = [];\n\n // count the number of card pairs matched\n correctPairs++\n\n // if all cards are matched, show this success message\n if (correctPairs == initialArray.length / 2) {\n \tcongratulations();\n }\n}", "function checkForMatch(){\n let isMatch = firstCard.dataset.name === secondCard.dataset.name;\n if(isMatch){\n disableCards();\n } else{\n unflipCards();\n }\n document.getElementById(\"totalpoints\").innerHTML = \"Total Points = \"+points+\" Chances Left = \"+chances\n}", "function compare() {\n if (card[0].firstElementChild.classList.value == card[1].firstElementChild.classList.value) {\n //adding match class\n card[0].classList = 'card match';\n card[0].classList = 'card match';\n win();\n } else {\n unflip();\n }\n count();\n rating();\n}", "function checkIfMatching() {\r\n let openCardsArray = Array.prototype.slice.call(openCardsHC);\r\n if (openCardsArray[0].classList[1] === openCardsArray[1].classList[1]) {\r\n openCardsArray.forEach(function(card) {\r\n card.classList.add('match');\r\n });\r\n handleMatchedCards();\r\n incrementMatchedCouples();\r\n setTimeout(checkIfGameOver, 1200);\r\n } else {\r\n openCardsArray.forEach(function(card) {\r\n card.classList.add('toBeReflipped');\r\n });\r\n setTimeout(flipOpenCards, 1200);\r\n }\r\n incrementMovesNumber();\r\n setTimeout(checkMovesNumber, 1200);\r\n }", "function verifyCards() {\n if (openCards.length === 2) {\n if (checkCard()) {\n match.push(...openCards);\n for (let card of openCards) {\n card.className = 'card match';\n }\n openCards = [];\n } else {\n //animates the cards then close them.\n animate();\n setTimeout(closeCards, 1000);\n\n }\n countMoves();\n }\n}", "function checkMatch() {\n const firstCardClass = openCards[0].firstElementChild.className;\n const secondCardClass = openCards[1].firstElementChild.className;\n if (firstCardClass === secondCardClass) {\n //locks cards in open position\n doMatch();\n } else {\n //flips cards over again\n setTimeout(removeCards, 1000);\n }\n //increases move and star counter\n moveCount();\n starCount();\n}", "function twoCards (list) {\n if (matchTest(list)) {\n list[0].classList.add('match');\n list[1].classList.add('match');\n } else {\n console.log(\"They don't match!\")\n list[0].classList.remove('open', 'show');\n list[1].classList.remove('open', 'show');\n }\n}", "function matchCards() {\n openCards.forEach(function (card) {\n card.classList.add(\"match\");\n card.classList.add(\"open\");\n card.classList.remove(\"show\");\n openCards = [];\n })\n numOfMatches++;\n}", "function checkIfMatching() {\n let openCardsArray = Array.prototype.slice.call(openCardsHC);\n if (openCardsArray[0].classList[1] === openCardsArray[1].classList[1]) {\n openCardsArray.forEach(function (card) {\n card.classList.add('match');\n });\n handleMatchedCards();\n incrementMatchedCouples();\n setTimeout(checkIfGameOver, 1200);\n } else {\n openCardsArray.forEach(function (card) {\n card.classList.add('toBeReflipped');\n });\n setTimeout(flipOpenCards, 1200);\n }\n incrementMovesNumber();\n setTimeout(checkMovesNumber, 1200);\n}", "function matched(first_card, second_card) {\r\n first_card.addClass('match');\r\n second_card.addClass('match');\r\n pairs = pairs + 1; //added\r\n\r\n if(pairs === 8){\r\n endGame();\r\n }\r\n }", "function doesCardMatch(card) {\n\tif (card.length === 2) {\n\t\tif (openCards[0][0].firstChild.className === openCards[1][0].firstChild.className) {\n\t\t\topenCards[0].addClass('match animated bounce');\n\t\t\topenCards[1].addClass('match animated bounce');\n\t\t\topenCards = [];\n\t\t\tplayerMatches++;\n\t\t\t // if all cards have matched, display a modal with the final score\n\t\t\tif (playerMatches === totalMatches) {\n\t\t\t\tgameEnd();\n\t\t\t\tconsole.log('Game Finish');\n\t\t\t}\n\t\t} else { \n\t\t\topenCards[0].addClass('animated shake wrong');\n\t\t\topenCards[1].addClass('animated shake wrong');\n\t\t\tsetTimeout(function() \n\t\t\t\t{ openCards[0].removeClass('open show wrong animated shake'); \n\t\t\t\t openCards[1].removeClass('open show wrong animated shake');\n\t\t\t\t openCards = [];}, 700);\n\t\t}\n\t\tdisplayMoves();\n\t}\n}", "function checkforMatch(){\n if (toggledCards[0].firstElementChild.className === toggledCards[1].firstElementChild.className){\n toggledCards[0].classList.toggle('match');\n toggledCards[1].classList.toggle('match');\n toggledCards = [];\n matched++;\n console.log(matched);\n if (matched === cardPairs) {\n\t\t\tgameOver();\n\t\t\t}\n } else {\n setTimeout(() => {\n toggleCard(toggledCards[0]);\n toggleCard(toggledCards[1]);\n toggledCards = [];\n }, 1500);\n }\n}", "function checkForMatch(card1, card2) {\n\tif (card1.dataset.card == card2.dataset.card) {\n\t\tcard1.classList.add('match');\n\t\tcard1.classList.add('open');\n\t\tcard1.classList.add('show');\n\n\t\tcard2.classList.add('match');\n\t\tcard2.classList.add('open');\n\t\tcard2.classList.add('show');\n\n\t\tmatch += 1;\n\n\t\t// Check if the game is won\n\t\tif (match == 8) {\n\t\t\tstopClock();\n\t\t\tlet stats = `In ${time} with ${moves} moves`;\n\n\t\t\tif(rating == 3) {\n\t\t\t\tstats = `${stats} and ${rating} stars!`;\n\t\t\t} else if (rating == 2) {\n\t\t\t\tstats = `${stats} and ${rating} stars!`;\n\t\t\t} else {\n\t\t\t\tstats = `${stats} and ${rating} star!`;\n\t\t\t}\n\n\t\t\tstatsElement.innerText = stats;\n\t\t\tmodalElement.style.display = \"block\";\n\t\t}\n\t} else {\n\t\t// Change background color if not match\n\t\tcard1.classList.add('not-match');\n\t\tcard2.classList.add('not-match');\n\t}\n}", "function checkMatching (flippedCards) {\n if ( flippedCards[0].firstElementChild.className === flippedCards[1].firstElementChild.className ) {\n //leave cards flipped over since they match, empty flippedCards array to signal new turn\n matchingCards(flippedCards);\n } else { \n //flip cards back over since no match, empty flippedCards array to signal new turn\n nonMatchingCards(flippedCards); \n }\n}", "function is_matched(k, v) {\n $('.restart').attr(\"disabled\", false);\n counter += 1;\n if (counter == 1) {\n timer();\n }\n $('.moves').html(counter);\n if (matched_cards.length < 2) {\n // change front img with img to compare\n $('#' + k.id).children().attr('src', 'img/' + v + '.png');\n if (matched_cards.length == 0) {\n matched_cards.push(v);\n memory.push(k.id);\n }\n else if (matched_cards.length == 1) {\n matched_cards.push(v);\n memory.push(k.id);\n if (matched_cards[0] == matched_cards[1]) {\n no_of_matches += 2;\n matched_cards = [];\n memory = [];\n // if all cards are flipped\n if (no_of_matches == cards.length) {\n rating();\n $('.modal').fadeIn().show();\n $('.overlay').show();\n clearInterval(interval);\n }\n }\n //if 2 cards unmatched\n else {\n $('#' + k.id).children().attr('src', 'img/' + matched_cards[1] + '.png');\n setTimeout(rest_unmatched, 1000);\n }\n }\n \n }\n console.log(no_of_matches);\n console.log(counter);\n}", "function setMatch() {\n open.forEach(function(card) {\n card.addClass('match');\n });\n open = [];\n matched += 2;\n if (Won()) {\n stopTimer();\n gameOver();\n }\n}", "function theyMatch() {\n cardsOpen[0].classList.add('match', 'match-grow');\n cardsOpen[1].classList.add('match', 'match-grow');\n cardsOpen[0].lastChild.classList.add('match', 'match-grow');\n cardsOpen[1].lastChild.classList.add('match', 'match-grow');\n\n cardsOpen[0].firstChild.classList.add('match', 'match-grow');\n cardsOpen[1].firstChild.classList.add('match', 'match-grow');\n console.dir(cardsOpen);\n cardsOpen = [];\n matchedSets++;\n winGame();\n}", "function checkForMatch() {\n let isMatch\n if ( isMatch = firstCard.dataset.framework === secondCard.dataset.framework) {\n playerscore();\n }\n\n isMatch ? disableCards() : unflipCards();\n}", "function handleMatchedCards() {\n let matchCardsArray = Array.prototype.slice.call(matchCardsHC);\n matchCardsArray.forEach(function (card) {\n card.classList.remove('open', 'show');\n });\n}", "isMatch(value, id) {\n\n if (this.state.hold) return;\n\n const cards = this.state.cards;\n cards[id].flipped = true;\n this.setState({cards, hold: true});\n const lastCard = this.state.lastCard;\n if (lastCard) {\n if (value === lastCard.value) {\n const lastP1MatchesTime = this.state.p1MatchesTime;\n const p1MatchesTime = this.state.player1? lastP1MatchesTime + 1 : lastP1MatchesTime;\n const lastP2MatchesTime = this.state.p2MatchesTime;\n const p2MatchesTime = this.state.player1? lastP2MatchesTime : lastP2MatchesTime + 1;\n const bestScore = this.state.bestScore;\n cards[id].matched = true;\n cards[lastCard.id].matched = true;\n cards[lastCard.id].flipped = true;\n this.setState({\n cards,\n lastCard: null,\n hold: false,\n p1MatchesTime: p1MatchesTime,\n p2MatchesTime: p2MatchesTime,\n bestScore: Math.max(p1MatchesTime, p2MatchesTime, bestScore)\n });\n } else {\n setTimeout(() => {\n cards[id].flipped = false;\n cards[lastCard.id].flipped = false;\n this.setState({\n cards,\n lastCard: null,\n hold: false,\n player1: !this.state.player1\n });\n }, 1000);\n }\n } else {\n this.setState({\n lastCard: {value, id},\n hold: false\n });\n }\n }", "function match() {\n numMoves++;\n numMatch++;\n opened = [];\n\n document.querySelectorAll(\".show\").forEach((matchedCard) => {\n matchedCard.classList.add('match','animated','flip')\n matchedCard.classList.remove('show')\n });\n\n}", "function checkForMatch() {\n if (firstCard.dataset.framework === secondCard.dataset.framework) {\n countMatch ++;\n // In case all of the matches are found ==> Congratulation you win the game\n if( countMatch === 8){\n //if the matches are 8 then popUp the messagge of win!\n congratulation();\n\n }\n disableCards();\n return;\n }\n\n unflipCards();\n }", "function handleMatchedCards() {\r\n let matchCardsArray = Array.prototype.slice.call(matchCardsHC);\r\n matchCardsArray.forEach(function(card) {\r\n card.classList.remove('open', 'show');\r\n });\r\n}", "function checkForMatch(card1, card2){\n CARDS.canFlip = false;\n setTimeout(()=> { \n if(card1.dataset.id === card2.dataset.id){ \n card1.classList.add('matched');\n card2.classList.add('matched'); \n CARDS.paired++;\n } else {\n card1.classList.remove('visible');\n card2.classList.remove('visible');\n } \n CARDS.canFlip = true;\n }, 1000);\n CARDS.currentCardToPair = null;\n}", "function matched() {\n deck.find('.open').addClass('match');\n setTimeout(function() {\n deck.find('.match').removeClass('open');\n }, 500);\n matchCards++;\n matchedCards = [];\n}", "function matched() {\n openedCards[0].classList.add(\"match\", \"disabled\");\n openedCards[1].classList.add(\"match\", \"disabled\");\n openedCards[0].classList.remove(\"show\", \"open\", \"no-event\");\n openedCards[1].classList.remove(\"show\", \"open\", \"no-event\");\n openedCards = [];\n}", "function checkForMatch() {\n\tif ( openCards[0][0].innerHTML === openCards[1][0].innerHTML \n\t\t) {\n\t\topenCards[0][0].classList.toggle('match');\n\t\topenCards[1][0].classList.toggle('match');\n\t\tmatchedCards.push(openCards[0][0]);\n\t\tmatchedCards.push(openCards[0][1]);\n\t\topenCards = [];\n\t\tconsole.log('Match!');\n\t} else\t{\n\t\tsetTimeout(() => {\n\t\t\topenCards[0][0].classList.toggle('open');\n\t\t\topenCards[0][0].classList.toggle('show');\n\t\t\topenCards[1][0].classList.toggle('open');\n\t\t\topenCards[1][0].classList.toggle('show');\n\t\t\topenCards = [];\n\t\t}, 800);\n\t\t\n\t}\n\n\n}", "function checkForMatch() {\n\tif (\n\t\ttoggledCards[0].firstElementChild.className === toggledCards[1].firstElementChild.className\n\t) {\n\t\t// if the cards do match, lock the cards in the open position (put this functionality in another function that you call from this one)\n\t\ttoggleMatchCard(toggledCards[0]);\n\t\ttoggleMatchCard(toggledCards[1]);\n\t\ttoggledCards = [];\n\t\tmatched++;\n\t\t// stop the game if TOTAL_PAIRS reached with a timeout of 1000\n\t\tsetTimeout(() => {\n\t\t\tif (matched === TOTAL_PAIRS) {\n\t\t\t\tgameOver();\n\t\t\t}\n\t\t}, 1000);\n\t}else{\n\t\t//setTimeOut is a callback function that runs after the designated time expires.\n\t\tsetTimeout(() => {\n\t\t\t// if the cards do not match, remove the cards from the list and hide the card's symbol (put this functionality in another function that you call from this one)\n\t\t\ttoggleCard(toggledCards[0]);\n\t\t\ttoggleCard(toggledCards[1]);\n\t\t\ttoggledCards = [];\n\t\t}, 1000);\n\n\t}\n}", "function makeMatch(openedCards) {\n\topenedCards[1].classList.add('match');\n\topenedCards[0].classList.add('match');\n matchCount += 1;\n\tif (matchCount === 8) {\n\t\t//end game: stop timer, pop-up with stats\n\t};\n}", "Match() {\n // if there are two cards with the classes clicked\n if ($('.clicked').length === 2) {\n// Than seeing if they match\n if ($('.clicked').first().data('value') == $('.clicked').last().data('value')){\n $('.clicked').each(function() {\n $(this).css({\"background-color\": \"green\",}).animate({ opacity: 0 }).removeClass('unmatched');\n });\n $('.clicked').each(function() {\n $(this).removeClass('clicked');\n });\n\n game.checkWin();\n // using a time out function to make the to flip the cards back \n } else {\n setTimeout(function() {\n $('.clicked').each(function() {\n $(this).html('').removeClass('clicked');\n \n });\n }, 1000);\n }\n }\n }", "function checkMatch(){\n // variable for card matching\n const open = document.getElementsByClassName(\"open\");\n const openCards = Array.from(open);\n\n // add conditional statements to check if there is another card open:\n // if there are two cards open, check if they match:\n if (openCards.length < 2) {\n showCard(event.target);\n } else if (openCards.length = 2) {\n if (openCards[0].firstElementChild.className === openCards[1].firstElementChild.className) {\n for (let i = 0; i < openCards.length; i ++) {\n matchCards(openCards[i]);\n matchedCards.push(openCards[i]);\n }\n } else if (openCards[0].firstElementChild.className !== openCards[1].firstElementChild.className){\n for (let i = 0; i < openCards.length; i ++) {\n hideCards(openCards[i]);\n }\n }\n }\n}", "function match(){\n setTimeout(function(){\n //card icons assigned to variables\n let firstGreatGrandParent = firstCard.closest('.card');\n let secondGreatGrandParent = secondCard.closest('.card');\n\n //Add matched class to front-side div\n firstCard.parentElement.classList.add('matched');\n secondCard.parentElement.classList.add('matched');\n\n //Add diabled class to card divs\n firstGreatGrandParent.classList.add('disabled');\n secondGreatGrandParent.classList.add('disabled');\n }, 800);\n\n}", "function comparedCard() {\n\n if (opened.length == 2) {\n\n let cardOne = $(opened[0]).children().attr('class'),\n cardTwo = $(opened[1]).children().attr('class');\n\n if (cardOne === cardTwo) {\n opened[0].addClass('match') && opened[1].addClass('match');\n opened = [];\n match++;\n\n } else {\n setTimeout(function() {\n opened[0].removeClass('open show') && opened[1].removeClass('open show');\n opened = [];\n\n }, delay / 1.5);\n moves++;\n setRating(moves);\n $moveCount.html(moves);\n }\n if (deckSize === match) {\n setRating(moves);\n var score = setRating(moves).score;\n setTimeout(function () {\n endGame(moves,score);\n },500);\n resetTimer(currentTimer);\n }\n }\n}", "function checkForMatch() {\n let isMatch = firstCard.dataset.word === secondCard.dataset.word;\n isMatch ? disableCards() : unflipCards();\n\n}", "function checkMatch(clickedCard) {\n if (openedCards[0].firstElementChild.HTMLImageElement.src === openedCards[1].firstElementChild.HTMLImageElement.src) {\n makeMatch(openedCards);\n } else {\n clearOpened(openedCards);\n };\n}", "function matchCheck() {\n\tif (openedCard[0].lastElementChild.classList.item(1) === openedCard[1].lastElementChild.classList.item(1)){\n\t\topenedCard[0].classList.add('match');\n\t\topenedCard[1].classList.add('match');\n\t\tmatchedCount++;\n\t\topenedCard = []; //to clear the openedCard array...\n\t\tanimationFinished = true;\n\t\t\n\t\tif (matchedCount == 8) {\n\t\tsetTimeout(function(){gameWon()},400); //you won...\n\t\t}\n\t} else {\n\t\tfailedCount ++;\n\t\tstars();\n\t\tsetTimeout(function() {turnBack()},500); //to delay time to turn the card...\n\t}\n}", "function doCardsMatch(event) {\n if (clickedCards.length === 2) {\n if (clickedCards[0].innerHTML === clickedCards[1].innerHTML) {\n clickedCards[0].classList.add('match');\n clickedCards[0].classList.remove('open', 'show');\n clickedCards[1].classList.add('match');\n clickedCards[1].classList.remove('open', 'show');\n matchedCards.push(clickedCards);\n clickedCards.length = 0;\n moveCounter();\n gameComplete();\n } else {\n setTimeout(function() {\n clickedCards[0].classList.remove('open', 'show');\n clickedCards[1].classList.remove('open', 'show');\n clickedCards.length = 0;\n moveCounter();\n }, 800);\n }\n }\n}", "function matched(openCards) {\n // Loop through each card and add new class to indicate match\n openCards.forEach(function(openCard) {\n openCard.parentElement.classList.add('match', 'animated', 'tada');\n });\n openCards.splice(0, 2);\n moveCounter();\n starRating();\n\n // Add two open matched cards to the matched cards array\n matchedCards.push(openCards[0], openCards[1]);\n\n // Check if all cards matched by comparing length matched cards array to cards array\n if (matchedCards.length === cards.length) {\n clearInterval(timer);\n winGame();\n }\n}", "function matchingCards (array) {\n const firstCard = array[0].firstElementChild.classList.value;\n const secondCard = array[1].firstElementChild.classList.value;\n if (firstCard === secondCard) {\n array[0].classList.remove('open', 'show');\n array[0].classList.add('match');\n array[1].classList.remove('open', 'show');\n array[1].classList.add('match');\n // set animation for right match\n } else {\n // set animation for wrong match\n array[0].classList.add('unmatch');\n array[1].classList.add('unmatch');\n setTimeout(function wait() {\n array[0].classList.remove('open', 'show', 'unmatch');\n array[1].classList.remove('open', 'show', 'unmatch');\n }, 600)};\n}", "function addCardsToMatchedCardsList() {\n\tfor (const q of openCards) {\n\t\tmatchedCards.push(q);\n\t\t//empty the openCards List\n\t\topenCards = [];\n\t}\n\n}", "function checkMatch() {\n\t\t// Matching cards case\n\t\tif (chosenCards[0].innerHTML === chosenCards[1].innerHTML) {\n\t\t\t\tmatch();\n\t\t} else { // No match case\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\tfor(card of chosenCards){\n\t\t\t\t\t\t\t\tcard.classList.add('wrong');\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetTimeout(noMatch, 1000);\n\t\t\t\t}, 300);\n\n\t\t}\n}", "function checkMatch () {\n if (selectedCards[0].getAttribute('id') == selectedCards[1].getAttribute('id')) {\n console.log('found a pair')\n paired.push(selectedCards[0]) //push into new array to use in win argument\n paired.push(selectedCards[1])\n selectedCards.shift(); //reset array\n selectedCards.shift();\n } else {\n console.log('this is not a match')\n selectedCards[0].setAttribute('src', './images/cardBack.png'); //set cards back down\n selectedCards[1].setAttribute('src', './images/cardBack.png');\n selectedCards.shift(); //remove from 'selectedCards' array\n selectedCards.shift();\n }\n}", "function compare(viewCard, previousCard) {\n // when 2 cards matched\n if(viewCard.innerHTML === previousCard.innerHTML){\n viewCard.classList.add('match');\n previousCard.classList.add('match');\n matchedCards.push(viewCard, previousCard);\n openedCards = [];\n // when all cards match\n completeCards();\n // when 2 cards not matched\n } else {\n // show the second card for a 900s\n setTimeout(function () {\n viewCard.classList.add('unmatch');\n viewCard.classList.remove('open');\n previousCard.classList.add('unmatch');\n previousCard.classList.remove('open');\n setTimeout(function() {\n viewCard.classList.remove('unmatch', 'show', 'remove');\n previousCard.classList.remove('unmatch', 'show', 'remove');\n }, 500);\n }, 500);\n openedCards = [];\n }\n}", "function checkMatch() {\n let deck = document.querySelector('.deck');\n let openCard = deck.querySelectorAll('.show > i');\n let x = openCard[0].className;\n let y = openCard[1].className;\n\n if (x === y) {\n $(\".open\").removeClass(\"open\");\n $(\".show\").addClass(\"match\");\n totalMatches++\n gameCompleted();\n }\n}", "function checkmatch(){\n for (i=0; i<cardlist.length;i++){\n if(cardlist[0].outerHTML != cardlist[1].outerHTML){\n cardlist[i].parentElement.setAttribute('class','card');\n cardlist[i].parentElement.addEventListener('click',clicktarget);\n }\n else{\n cardlist[i].parentElement.setAttribute('class','card'+' '+'match');\n }\n }\n cardlist= [];\n addOnetoCounter();\n setmatchscreen();\n}" ]
[ "0.73003346", "0.7269484", "0.7195039", "0.7188889", "0.7164889", "0.71636474", "0.7160941", "0.71304715", "0.7124965", "0.7103338", "0.7077882", "0.7072709", "0.7051769", "0.70117855", "0.7006389", "0.6997816", "0.69925463", "0.6977488", "0.6972607", "0.6961681", "0.6961133", "0.6959895", "0.69585454", "0.6948236", "0.6935235", "0.69259816", "0.6923517", "0.6918999", "0.69124395", "0.6904807", "0.6889266", "0.68866885", "0.6882596", "0.6879386", "0.68697965", "0.6858049", "0.68576", "0.68433315", "0.6843068", "0.68414015", "0.68397945", "0.68322146", "0.68318045", "0.68295133", "0.68173534", "0.681585", "0.680905", "0.68046755", "0.68033", "0.6801646", "0.67719096", "0.67715603", "0.6769051", "0.6768578", "0.67653126", "0.6763805", "0.67560846", "0.6755464", "0.67491835", "0.6747067", "0.6744039", "0.673629", "0.6729679", "0.67279345", "0.67213523", "0.67076683", "0.6686965", "0.668318", "0.66806775", "0.66617566", "0.66512424", "0.6650939", "0.6649084", "0.66424954", "0.6640672", "0.6636484", "0.6631861", "0.6619383", "0.6616196", "0.66110766", "0.6608909", "0.66072226", "0.66063654", "0.66028845", "0.6594251", "0.6593146", "0.65881306", "0.6585826", "0.65834445", "0.65738165", "0.65599805", "0.65563625", "0.6552158", "0.65465873", "0.6544", "0.6535292", "0.65278566", "0.6527069", "0.65164226", "0.6500139", "0.6496302" ]
0.0
-1
Count up timer provided from StackOverflow
function timeInterval() { interval = setInterval(displayTime, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countUp() {\n time = time + 1\n timer.innerHTML = time\n }", "function timer() {\n setInterval(() => {countUp();}, 1000);\n}", "function counter() {\n\ttimerNow = Math.floor(Date.now() / 1000);\n\tcurrentTimer = timerNow - timerThen;\n\treturn currentTimer;\n}", "function count() {\n timer --;\n var theTime = timer;\n var t = timeConvert(theTime);\n \n $(\".theTimer\").html(t);\n \n if (timer <= 0) {\n timeOut();\n }\n}", "function timedCount() {\n\tdocument.querySelector('.timer').innerHTML = `${c}s`;\n\tc = c + 1;\n\tt = setTimeout(\"timedCount()\", 1000);\n}", "function countDownTimer(num) {\n if (num === 0) return \"Happy New Year!\";\n const _count = () => {\n num -= 1;\n if (num <= 0) {\n return \"Happy New Year!\";\n } else {\n return _count;\n }\n };\n return _count;\n}", "function countUp() {\n // Add system milliseconds and let it out\n timer++;\n THETIMER.innerHTML = timer;\n}", "function countDownTimer() {\n if (countDown != 0) {\n --countDown;\n } else {\n //when timer hits 0, exits function (avoids infinite counting)\n return;\n }\n //calls function to insert countdown timer into DOM\n domCountDown();\n }", "function countdown() {\n runtime();\n}", "counter(i) {\n // call a decrement function for the seconds\n this.count()\n // check if seconds is = 0\n this.checkIfTimeIsZero(i)\n }", "function timeTrack() {\r\n timer++;\r\n }", "function countDown() {\n setTimeout('Decrement()', 60);\n }", "function countup() {\n setTimeout('Increment()', 60);\n}", "function countDownTimer() {\n\n // Figure out the time to launch\n timeToLaunch();\n\n // Write to countdown component\n $(\"#days .timer-number\").text(days);\n $(\"#hours .timer-number\").text(hrs);\n $(\"#minutes .timer-number\").text(min);\n $(\"#seconds .timer-number\").text(sec);\n\n // Repeat the check every second\n setTimeout(countDownTimer, 1000);\n }", "function countDown() {\n counter--;\n $('#timer').html(counter);\n if (counter === 0){\n timeUp()\n }\n}", "function timer() {\n clock = setInterval(countDown, 1000);\n function countDown() {\n if (time < 1) {\n clearInterval(clock);\n timeUp();\n }\n if (time > 0) {\n time--;\n }\n $(\"#timer\").html(\"<strong>\" + time + \"</strong>\");\n }\n }", "function timer() {\n return setInterval(function() {\n let timeInt = parseInt(counter.innerText);\n counter.innerText = timeInt + timeHop;\n }, 1000);\n }", "function shortTimer(){\n\tvar count = 6;\n\n\tvar counter = setInterval(timer, 1000);\n\tfunction timer(){\n\t\tcount = count-1;\n\t\tif (count <= 0){\n\t\t\tclearInterval(counter);\n\t\t}\n\t\tconsole.log(count)\n\t\t$(\"#timerDisplay\").html(count)\n\t}\n}", "function countDownTimer() {\n\n // Figure out the time to launch\n timeToLaunch();\n\n // Write to countdown component\n $(\"#days .number\").text(days);\n $(\"#hours .number\").text(hrs);\n $(\"#minutes .number\").text(min);\n $(\"#seconds .number\").text(sec);\n\n // Repeat the check every second\n setTimeout(countDownTimer, 1000);\n }", "function timer() {\n\t\tclock = setInterval(countDown, 1000);\n\t\tfunction countDown() {\n\t\t\tif (time < 1) {\n\t\t\t\tclearInterval(clock);\n\t\t\t\tuserTimeout();\n\t\t\t}\n\t\t\tif (time > 0) {\n\t\t\t\ttime--;\n\t\t\t}\n\t\t\t$(\"#timer\").html(\"<strong>\" + time + \"</strong>\");\n\t\t}\n\t}", "function timer() {\n\t\tclock = setInterval(countDown, 1000);\n\t\tfunction countDown() {\n\t\t\tif (time < 1) {\n\t\t\t\tclearInterval(clock);\n\t\t\t\tuserTimeout();\n\t\t\t}\n\t\t\tif (time > 0) {\n\t\t\t\ttime--;\n\t\t\t}\n\t\t\t$(\"#timer\").html(\"<strong>\" + time + \"</strong>\");\n\t\t}\n\t}", "function timer() {\n\t\tclock = setInterval(countDown, 1000);\n\t\tfunction countDown() {\n\t\t\tif (time < 1) {\n\t\t\t\tclearInterval(clock);\n\t\t\t\tuserTimeout();\n\t\t\t}\n\t\t\tif (time > 0) {\n\t\t\t\ttime--;\n\t\t\t}\n\t\t\t$(\"#timer\").html(\"<strong>\" + time + \"</strong>\");\n\t\t}\n\t}", "function countDown() {\n counter--;\n\n $('#time').html(`\n <h5>:${counter}</h5><p>\n `)\n if (counter === 0) {\n timeUp();\n }\n}", "function inc_timer(){\n timer++;\n}", "startCountDown() {\n return setInterval(() => {\n this.timeRemaining--;\n this.time.innerText = this.timeRemaining\n if (this.timeRemaining === 0)\n this.gameOver();\n }, 1000);\n }", "function countDown(time){\n var timer = setInterval(function(){\n time--;\n if(time <= 0){\n clearInterval(timer);\n console.log('DONE!');\n }\n else {\n console.log(time);\n }\n \n },1000)\n }", "function countUp() {\n timeCounter = setInterval(function() {\n second++;\n if (second == 59) {\n second = 00;\n min++;\n }\n if (second > 9) {\n zeroPlaceholder = '';\n } else if (second < 9) {\n zeroPlaceholder = 0;\n }\n timer.innerText = `Your time is: ${min}:${zeroPlaceholder}${second}`;\n }, 1000);\n}", "function timer() {\n clock = setInterval(countDown, 1000);\n function countDown() {\n if (time < 1) {\n clearInterval(clock);\n userTimeout();\n }\n if (time > 0) {\n time--;\n }\n $(\"#timer\").html(\"<strong>\" + time + \"</strong>\");\n }\n }", "function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }", "function timer(){\n const timerValue = document.querySelector(\".timerCount\");\n if(!paused){\n time++;\n timerValue.textContent = time;\n }\n setTimeout(timer,1000);\n}", "function countDown() {\r\n tick();\r\n var countDownString = numToString(min) + \" : \" +\r\n numToString(sec);\r\n const printTimer = document.getElementById(\"timer\");\r\n timer.innerText = countDownString;\r\n}", "function countItDown(){\n startTime -= 1\n $el.text(startTime);\n App.doTextFit('#hostWord');\n\n if( startTime <= 0 ){\n // console.log('Countdown Finished.');\n\n // Stop the timer and do the callback.\n clearInterval(timer);\n callback();\n return;\n }\n }", "function countDown() {\n counter--;\n $(\"#timer\").html(\"<h2> Timer: 00:\" + counter + \"</h2>\");\n timeOut();\n }", "function timecounting(time) {\n myTime = setInterval(() => {\n if (time === 0) {\n return;\n }\n time -= 1\n document.getElementById('timecount').innerHTML = time\n }, 1000)// every 1 second, it will add 1 into time variable (computer use millisecond so 1000 is 1 second)\n}", "function countDown() {\n counter--;\n // puts the numbers on the users screen\n $(\"#time\").html(\"Timer: \" + counter);\n // if the counter reaches 0, run the timeUp function\n if (counter === 0) {\n timeUp();\n };\n }", "function countDown() {\n interval = setInterval(function () {\n countDownLength--\n countDownWrapper.innerHTML = \"Time \" + countDownLength\n stopCountDown()\n }, 1000)\n}", "function domCountDown() {\n $(`.timer`).text(`Game Begins in: ${countDown} Seconds`);\n }", "function timer () {\n \n timerId = setInterval(triviaCount, 1000);\n function triviaCount () {\n if (timerCounter === 0) {\n clearInterval(timerId);\n timeRunsOut();\n }\n else {\n $(\".timer-number\").html(timerCounter);\n timerCounter--;\n }\n\n }\n // console.log(timer);\n \n }", "function Timer_Count() {\n\t \t/* Decrement total count and check if we have reached the maximum time. */\n\t \t_Count--;\n\n\t \tif( _Count == 0 ) {\n\t \t \t/* Stop the recording. */\n\t \t \tstop();\n\t \t \treturn;\n\t \t}\n\n\t \t/* Update button text. */\n\t \tupdateText();\n\n\t \t/* Let's continue the timer. */\n\t \t_Timer = setTimeout(\"Timer_Count()\", 1000);\n\t}", "function startTimer() {\n \n intervalId = setInterval(function () { \n timerCnt--;\n if (timerCnt >= 0) {\n $(\"#counter\").text(timerCnt);\n } else {\n clearInterval(intervalId);\n missedTimer();\n }\n }, 1000);\n\n } //ends startTimer", "function countDown(){\n\t\t\ttime--;\n\t\t\tupdate($timer, time);\n\t\t\tif(time <= 0){\n\t\t\t\tgameOver();\n\t\t\t}\t\t\n\t\t}", "function countDown() {\n seconds -= 1;\n\n if (seconds < 0 && minutes > 0) {\n seconds += 60;\n minutes -= 1;\n }\n else if (seconds === -1 && minutes === 0) {\n // Timer is done. Call relevant functions\n stopTimer();\n PEvents.timerDone(currentTimerType);\n loadTimer();\n }\n \n render();\n }", "function createTimer1() {\n\ttimer = setTimeout(function() {\n\t\ttime--;\n\t\t$(\"#timer-count\").html(time);\n\t\tcreateTimer1();\n\t\tif (time <= 0) {\n\t\t\tgame.wrongAnswer(\"Time's up!\");\n\t\t}\n\t}, 1000);\n}", "function startCountDown() {\n countdownTime--;\n questionCounter.innerHTML = countdownTime;\n}", "function timer(){\n clock = setInterval(countDown,1000);\n function countDown() {\n if( time < 1) {\n clearInterval(clock);\n userTimeout();\n \n }\n if (time > 0) {\n time --;\n }\n \n\n $(\"#timer\").html(\"<stong>\" + time + \"</stong>\");\n }\n\t\t\t\n\t}", "function countDown(){\n window.setTimeout(function(){\n toggleClickable();\n nextLink.style.display = 'block';\n facit.className = \"facitF2\";\n facit.innerHTML = \"Time's up!\";\n console.log(\"Time's up!\");\n }, 15000);\n }", "function countDown(seconds) {\n if (seconds < 0) return;\n setTimeout(function () {\n console.log(seconds);\n countDown(seconds - 1);\n }, 1000);\n}", "function timer() {\n counter--; \n $('.counter').text('Time: ' + counter);\n }", "function countDown() {\n counter--;\n $(\"#time\").html(\"Timer: \" + counter);\n\n if (counter === 0) {\n timeReset();\n \n \n\n\n }\n}", "function start_counting(){\n\tvar counter = hours + \":\" + minutes + \":\" + seconds;\n\tseconds += 1;\n\tif (seconds == 60) {\n\t\tminutes += 1;\n\t\tseconds = 0;\n\t\tif (minutes == 60){\n\t\t\thours += 1;\n\t\t\tminutes = 0;\n\t\t}\n\t}\n\tdocument.getElementById(\"counter\").innerHTML = counter;\n}", "function countDown(){\n timeCounter.textContent = quizTimer.toLocaleString(undefined, {minimumIntegerDigits: 2}); \n quizTimer --;\n if (quizTimer <= -1) {\n quizStatus.textContent = \"Times Up!\";\n logScores();\n stopCountDown();\n }\n}", "function countdown() {\n\n\t//get count from onscreen\n\tcount = document.getElementById('countdownClock').innerHTML;\n\tcount = parseInt(count);\n\n\t//if count is finished, add Time Up message and reveal solution\n\tif (count == 1) {\n\t \tvar stopCount = document.getElementById('countdownClock');\n\t \tstopCount.innerHTML = \"TIME UP!\";\n\t \trevealSolution(word);\n\t \treturn;\n\t}\n\t//reduce count on screen every 1 second\n\tcount--;\n\ttemp = document.getElementById('countdownClock');\n\ttemp.innerHTML = count;\n\ttime = setTimeout(countdown, 1000);\n}", "function timer()\n{\n count = count + 1;\n $(\"#elapsedtime\").html(count);\n}", "function startCountingUpEveryTenth(){\n tenths++;\n if (tenths === 9) {\n seconds++\n tenths = 0 \n }\n if (seconds === 59) { \n minutes++ \n seconds = 0 \n }\n}", "function timedCount() {\r\n // context.fillText(c,60,30);\r\n if(c>0 && patient_saved<10 && health>0){\r\n\tc = c - 1;\r\n\t t = setTimeout(function(){ timedCount() }, 1000);\r\n\t }\r\n\telse{\r\n\t\tstopCount();\r\n // t = setTimeout(function(){ timedCount() }, 1000);\r\n\t\t\r\n\t}\r\n}", "function timer() {\n disableExitButton();\n var counter = 10;\n var interval = setInterval(function() {\n counter--;\n countdown.html(counter);\n if (counter == 0 && colorsClicked == false) {\n incorrectSound.play();\n clearInterval(interval);\n status.html(`\n <div class=\"font\">Time Up! </div>\n <p>You scored <span class=\"red\"> ${scores} </span>\n <br> ${playAgain}</p>`);\n enableModeButton();\n enableStartButton();\n }\n else if (colorsClicked == true) {\n clearInterval(interval);\n countdown.html(\"-\");\n }\n }, 1200) // 1.2s used instead of 1s to slightly slow down the timer\n }", "function timerCountDownTrigger() {\n\n timerMinutes = parseInt($clockTimer.text());\n\n return window.setInterval(function() {\n displayTimeOnClock(timerMinutes, timerSeconds);\n timerSeconds -= 1;\n \n // subtrack minute when seconds hit 0\n if (timerSeconds < 00) { \n // timerSeconds = 59;\n timerMinutes -= 1;\n timerSeconds = 3;\n }\n switchBetweenSessionAndBreak();\n }, 1000);\n } // end timerCountDownTrigger", "function timer() {\n footballCrowd();\n timerId = setInterval(() => {\n time--;\n $timer.html(time);\n\n if(time === 0) {\n restart();\n lastPage();\n }\n }, 1000);\n highlightTiles();\n }", "function countdown(times) {\n\tconst delay = 1000;\n\twhile(times){\n\t\tsetTimeout(counter.tick, delay*times);\n\t\ttimes--;\n\t}\n}", "function zähler (){\r\n\tnew countdown(1200, 'counter'); //alle Zeiten werden in Sekunden angegeben, rechnet selbst auf Minuten und Stunden um\r\n}", "function answerTimer(number1) {\n intervalId = setInterval(function countDown() {\n $('#time-left').text(number1);\n number1 --;\n if (number1 === 0) {\n stopTimer();\n }; \n }, 1000);\n }", "function countDownTimer(){\n\tweatherAPI();\n\tsetTimeout(count3,1000);\n\tsetTimeout(count2,2000);\n\tsetTimeout(count1,3000);\n\tsetTimeout(returnVideo,3500);\n\t//Put the third page\n/*\n\tsetTimeout(resultsPage,3700);\n\tsetTimeout(countReady,10000);\n*/\n\t\n}", "function countDownV2() {\r\n var count = 10;\r\n for (var i = 1; i < 10; i++) {\r\n setTimeout(function () {\r\n document.getElementById(\"countDownTimer\").innerHTML = count;\r\n count--;\r\n }, 1000 * i);\r\n }\r\n setTimeout(function () {\r\n document.getElementById(\"countDownTimer\").innerHTML = \"Blastoff\";\r\n count--;\r\n }, 10000);\r\n}", "function countDown(){\n\t\ttime --;\n\t\tupdate($timer, time);\n\n\t\tif (time <= 0){\n\t\t\thide($timer);\n\t\t\tgameOver();\n\t\t}\n\t}", "function timesUp() {\n timer--;\n\n $(\"#timer\").text(timer);\n if (timer === 0) {\n // clearInterval(countDown);\n // i++;\n timerTwo = 8;\n unanswered++;\n $(\"#gap-time\").show();\n // i++;\n gifTimer();\n booYou();\n }\n}", "function start_counting(){\r\n\tvar counter = hours + \":\" + minutes + \":\" + seconds;\r\n\tseconds += 1;\r\n\tif (seconds == 60) {\r\n\t\tminutes += 1;\r\n\t\tseconds = 0;\r\n\t\tif (minutes == 60){\r\n\t\t\thours += 1;\r\n\t\t\tminutes = 0;\r\n\t\t}\r\n\t}\r\n\tdocument.getElementById(\"counter\").innerHTML = counter;\r\n}", "function countUpTimer(){\n let t = document.getElementById(\"timerText\");\n\n seconds = timeCounter % 60;\n if (seconds<10){\n seconds = \"0\" + seconds ;\n }\n minutes = parseInt(timeCounter / 60);\n if (minutes<10){\n minutes = \"0\" + minutes ;\n }\n\n t.textContent = minutes + \":\" + seconds ;\n timeCounter++;\n}", "function setupTimer() {\n timeCount = setInterval(function () {\n timer--;\n var timeReset = timeElement.textContent = \"Time:\" + \" \" + timer;\n timer = timer;\n if (timer <= 0) { \n clearInterval(timeCount);\n \n timeElement.textContent = timeReset;\n \n }\n }, 1000)\n}", "function timerWrapper () {}", "function reset(){\n setTimeout(get_count,checkInterval)\n }", "function countTimer() {\n ++totalSeconds;\n let minute = Math.floor(totalSeconds/60);\n let seconds = totalSeconds - (minute*60);\n let time = minute + \":\" + seconds;\n document.getElementById(\"timer\").innerHTML = time;\n }", "function timer(){\n countStartGame -= 1;\n console.log(countStartGame);\n if (countStartGame === 0){\n console.log (\"time's up\");\n //need to clear interval - add stop\n }\n}", "function timer() {\n time = 10;\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 0\n });\n clock = setInterval(countdown, 1000);\n function countdown() {\n if (time > 1) {\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 0\n });\n time--;\n } else {\n clearInterval(clock);\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 1\n });\n publishCorrectAnswer(index)\n };\n };\n}", "function countdownTimer() {\n // reduce countdown timer by 1 second\n timer--;\n if (timer === 0) {\n // timer expired\n endTest();\n } else if (timer < 10) {\n // prefix times less than ten seconds with 0\n // update timer on web page\n $('#timer').text('0' + timer);\n } else {\n // update timer on web page\n $('#timer').text(timer);\n }\n }", "function startTimer() {\n timerInterval = setInterval(() => {\n timePassed = timePassed += 1;\n timeLeft = TIME_LIMIT - timePassed;\n document.getElementById(\"base-timer-label\").innerHTML = formatTime(\n timeLeft\n );\n\n if (timeLeft <= 0) {\n onTimesUp();\n }\n }, 1000);\n}", "function countDown() {\n // decrease time by 1\n time--;\n // update the time displayed\n update($timer, time);\n // the game is over if the timer has reached 0\n if (time <= 0) {\n gameOver();\n }\n }", "function countDownStart() {\n if (timer == 0) {\n that.gameLoop = setInterval(that.update, interval);\n that.status = State.RUN;\n }\n else {\n drawElements();\n that.gameArea.paintTimer(that.contex, timer);\n timer--;\n setTimeout(countDownStart, 1500);\n }\n \n }", "function countdown(initialCount) {\n var count = initialCount || 10;\n window.gate = 1;\n var recur = function() {\n (count === 0) ? console.log(\"Happy New Year!\") : console.log(count);\n if(gate) {\n count -= 1;\n count = (count === -1) ? initialCount: count;\n setTimeout(recur, 1000);\n }\n }\n recur();\n}", "function timer(arg){\n var nIntervId;\n var count = arg;\n\n function changeText() {\n nIntervId = setInterval(updateText, 1000);\n }\n\n function updateText() {\n if (count > -1) {\n $('#time').html(count);\n count--;\n } else {\n stopTimer();\n outOfTime();\n }\n }\n\n function stopTimer() {\n clearInterval(nIntervId);\n }\n // changeText();\n\n return {\n startTimer:changeText,\n stopTimer:stopTimer\n };\n }", "function countDown() {\n counter--;\n $('#time').html('Timer: ' + counter);\n if (counter === 0) {\n resetTimer();\n alert(\"times up\")\n }\n}", "function timer()\n{\n\tcount=count-1;\n\tdocument.getElementById(\"timer\").innerHTML=count + \" secs\"; // watch for spelling\n\tif (count == 0)\n\t\tclearInterval(counter);\t\n}", "function timeCount() {\n secondsLeft--;\n timerEl.textContent = secondsLeft;\n if (secondsLeft == 0) {\n clearInterval(timerNum);\n initialPage();\n } \n}", "function countDown() {\n timerTime--;\n $(\".time-left\").html(timerTime);\n}", "function counterFunc() {\n //check if seconds has reached zero to enable alarm sound\n if (timer < 0) {\n clearInterval(countDown); //stop the setInterval method\n playAlarm();\n } else {\n //convert the seconds to time and extract the relevant portion\n const timerVal = new Date(timer * 1000).toISOString().substr(14, 5); //.substr(11,8) to include hr\n counter.innerText = `Time Remaining: ${timerVal}`;\n timer -= 1; //decrement the seconds counter by one\n }\n }", "function timesUp() {\n timerInterval = 5; //needs to be here so that timer stays above 5 (only counts 1 instance of 'timesUp')\n timeoutCounter++;\n $('#sectionQuestions').addClass('hidden');\n $('#sectionResults').removeClass('hidden');\n $('#feedback').html('Times Up!!');\n $('#feedbackDetail').html('You took too long, the correct answer was \"' + response.results[questionNum].correct_answer + '\"');\n setTimeout(nextQuestion, 3000);//loads next question after 3 seconds\n }", "function startTimer(){\n $('.countDown').fadeIn('fast');\n $('.countDown').html('&nbsp;');\n\n\t\tvar timeRemain = 11;\n\n\t\tfunction run(){\n\t\t\tintervalId = setInterval(decrement, 1000);\n\t\t}\n\t\t\n \tfunction decrement() {\n\t\t\ttimeRemain--;\n\t\t\t$(\".countDown\").html(timeRemain);\n\t\t\tif (timeRemain === 0) {\n\t\t\t\t$('.countDown').html('0');\n\t\t\t\tstop();\n\t\t\t\ttimeUp();\n\t\t\t}\n\t\t\t\n \t}\n \tfunction stop() {\n\t\t\tclearInterval(intervalId);\n \t}\n run();\n \n }", "function stopwatch() {\n\ttimerDigits = setInterval(seconds, 1000);\n\tfunction seconds() {\n\t\tif (counter === 0) {\n\t\t\tclearInterval(timerDigits);\n\t\t\ttimeoutLoss();\n\t\t}\n\t\tif (counter > 0) {\n\t\t\tcounter--;\n\t\t}\n\n\t\t$(\".timer\").html(counter);\n\n\t\t//test\n\t\tconsole.log(\"timer started\");\n\t}\n}", "function countTimer() {\n const time_shown = document.getElementById('realtime').textContent;\n const time_chunks = time_shown.split(\":\");\n let mins, secs;\n mins = Number(time_chunks[0]);\n secs = Number(time_chunks[1]);\n secs++;\n if (secs == 60) {\n secs = 0;\n mins = mins + 1;\n }\n if (mins == 60) {\n mins = 0;\n }\n document.getElementById('realtime').textContent =\n format(mins) + \":\" + format(secs);\n}", "function onGameTimerCount(){\n gameTimeCount++;\n $('.time').text(\" (\" + gameTimeCount + \" seconds)\");\n}", "function countDown() {\n counter--;\n var converted = timeConverter(counter);\n $(\"#time-display\").text(converted);\n\n //tell player time is up and delay long enough for them to see it\n if (counter === 0) {\n $(\"#time-display\").text(\"Time's Up!!\");\n setTimeout(gameResults(), 1500)\n }\n }", "function startCountdown() {\r\n\r\n stopCountdown();\r\n\r\n resumeTimer = Object.assign({}, timers);\r\n resumeTimer.secs = toSecs(resumeTimer.sessionTime);\r\n\r\n setCountDown(getMins(resumeTimer.secs), getSecs(resumeTimer.secs));\r\n countdown(resumeTimer);\r\n}", "function start() {\n\n count = 5;\n\n // questionCounter += 1;\n intervalId = setInterval(countDown, 1000);\n\n}", "function timer() {\n count = count - 1;\n if (count <= 0) {\n clearInterval(counter);\n //counter ended, do something here\n\n $('#runadvert').prop('disabled', false);\n $('#runadvert').text('Run Advert');\n return;\n }\n\n //Do code for showing the number of seconds here\n $('#runadvert').text(count);\n }", "function timer() {\n count--;\n if (count === 0) {\n stop();\n }\n\n document.getElementById(\"timer\").innerHTML = count + \" secs\";\n }", "function timer() {\n function countSeconds() {\n if (moves !== 0 && matched < 16) {\n seconds++\n document.querySelector('.timer').innerHTML = seconds;\n }\n } setInterval(countSeconds, 1000);\n}", "function coreTimer()\n{\n\t// If the document.hidden property doesn't work, this timer doesn't function\n\tif(typeof(document.hidden) != \"undefined\")\n\t{\n\t\tif(document.hidden != true)\n\t\t{\n\t\t\tcoreTimeCount++;\n\t\t}\n\t}\n\t\n\t// If you're logged in, run the user's update handlers\n\tif(typeof(JSUser) == \"string\")\n\t{\n\t\t// Notifications Updater\n\t\tif(coreTimeCount >= timers.notifications.next)\n\t\t{\n\t\t\ttimers.notifications.next = coreTimeCount + timers.notifications.interval;\n\t\t\trunNotifications();\n\t\t}\n\t\t\n\t\t// Friend Updater\n\t\tif(coreTimeCount >= timers.friends.next)\n\t\t{\n\t\t\ttimers.friends.next = coreTimeCount + timers.friends.interval;\n\t\t\trunFriendList();\n\t\t}\n\t\t\n\t\t// User Chat Updater\n\t\tif(coreTimeCount >= timers.userchat.next)\n\t\t{\n\t\t\ttimers.userchat.next = coreTimeCount + timers.userchat.interval;\n\t\t\trunUserChat();\n\t\t}\n\t}\n\t\n\t// Chat Updater\n\tif(coreTimeCount >= timers.chat.next)\n\t{\n\t\ttimers.chat.next = coreTimeCount + timers.chat.interval;\n\t\trunChatUpdate();\n\t}\n}", "function timer() {\n if (timerState.style.zIndex == \"1\") {\n count -= 1;\n if (count === 0) {\n alertSound.play();\n clearInterval(counter);\n var breakCounter = setInterval(breakTimer);\n }\n timerState.innerHTML = count;\n if (Math.floor(count / 60) > 10) {\n if (count % 60 >= 10) {\n timerState.innerHTML = Math.floor(count / 60) + \":\" + count % 60;\n } else {\n timerState.innerHTML =\n Math.floor(count / 60) + \":\" + \"0\" + count % 60;\n }\n } else {\n if (count % 60 >= 10) {\n timerState.innerHTML =\n \"0\" + Math.floor(count / 60) + \":\" + count % 60;\n } else {\n timerState.innerHTML =\n \"0\" + Math.floor(count / 60) + \":\" + \"0\" + count % 60;\n }\n }\n\n // Format break timer to minutes and seconds\n function breakTimer() {}\n } else {\n clearInterval(counter);\n }\n }", "function timer() {\n\t count = count - 1;\n\t if (count == -1) {\n\t clearInterval(counter);\n\t return;\n\t }\n\t var seconds = count % 60;\n\t var minutes = Math.floor(count / 60);\n\t var hours = Math.floor(minutes / 60);\n\t minutes %= 60;\n\t hours %= 60;\n\t document.getElementById(\"timer\").innerHTML = hours + \":\" + minutes + \":\" + seconds + \" seconds left!\"; // watch for spelling\n\t}", "function timeTrack() {\r\n tracker++;\r\n time = tracker / 50;\r\n}", "function timerInit(){\n\t\ttimer = setTimeout(timeUp, timeToAnswer*1000);\n\t}", "updateRemainingTime() {\n\n this.callsCounter++;\n //cada 25 llamadas, quito un segundo\n if (this.callsCounter % 25 == 0) {\n if (this.time.seconds == 0) {\n this.time.minutes -= 1;\n this.time.seconds = 60;\n }\n this.time.seconds -= 1;\n }\n //Se activa el hurryUp\n if (this.callsCounter == this.hurryUpStartTime) {\n this.hurryUpTime = true;\n }\n //Se llama al metodo cada 5 llamadas \n if (this.callsCounter >= this.hurryUpStartTime\n && this.callsCounter % 5 == 0) {\n this.hurryUp();\n }\n\n }" ]
[ "0.74421453", "0.74304867", "0.7253707", "0.7228401", "0.71877944", "0.7177126", "0.7152808", "0.7103036", "0.705113", "0.7005871", "0.69851816", "0.69643825", "0.69495153", "0.68879944", "0.68807155", "0.6870092", "0.6867448", "0.68415177", "0.68358934", "0.6816967", "0.6816967", "0.6816967", "0.6804221", "0.6791567", "0.6791567", "0.67812383", "0.6771689", "0.6770408", "0.6767461", "0.67594403", "0.67576104", "0.6734102", "0.6731005", "0.67246073", "0.6720905", "0.67031425", "0.6669018", "0.6654519", "0.66438687", "0.66389626", "0.6637245", "0.6614951", "0.6614162", "0.6610391", "0.6598181", "0.65965444", "0.6592786", "0.6589267", "0.6587062", "0.6586335", "0.65858424", "0.6569755", "0.65691876", "0.6560726", "0.6553027", "0.6538506", "0.6536838", "0.6532795", "0.65257174", "0.65027666", "0.6498835", "0.64963025", "0.6494432", "0.6492104", "0.6489149", "0.6488062", "0.64857066", "0.6478172", "0.64776254", "0.64664394", "0.6465892", "0.6447867", "0.6447471", "0.64388007", "0.6438071", "0.643199", "0.6426211", "0.6425188", "0.6420515", "0.6419997", "0.6417813", "0.64166147", "0.6416129", "0.64131206", "0.64094263", "0.6408588", "0.64036405", "0.6399977", "0.6398494", "0.63972986", "0.63966703", "0.6394524", "0.63919944", "0.63919383", "0.63890195", "0.63866025", "0.63777244", "0.6374967", "0.6372317", "0.6371738", "0.63662446" ]
0.0
-1
Displays modal after winning
function checkGameOver() { if (matchedCards.length == 16) { gameOverText(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameDraw(){\n $(\"#winMsg\").html(\"Game is a draw!! Play Again!\");\n $(\"#winModal\").modal(\"show\");\n }", "function showModalGameOver(){\n var stringGameOverModal=\"Felicidades! Su puntuación final es: \"+juego.getScore();\n var p=document.getElementById(\"gameOverModalP\");\n p.innerHTML=stringGameOverModal;\n $('#gameOverModal').modal('show');\n}", "function triggerModal () {\n modal.style.display = 'block';\n\n if (turn !== 1) {\n winner.innerHTML = 'Player 1 Wins!';\n console.log ('Player 1 Wins!');\n }\n if (turn === 1) {\n winner.innerHTML = 'Player 2 Wins!';\n console.log ('Player 2 Wins!');\n }\n }", "function showModal(modalForWin) {\n var elModal = document.querySelector(\".modal\");\n elModal.style.display = 'block'\n var resString = (modalForWin) ? `Well Done ` : 'Try again..'\n elModal.innerHTML = `${resString} <button onclick=\"init()\">Play again</button>`\n}", "function displayModal() {\n\t\t\t\t$(\"#user-name\").text(newPerson.name);\n\t\t\t\t$(\"#match-name\").text(matchName);\n\t\t\t\t$(\"#match-img\").attr(\"src\", matchImage);\n\t\t\t\t$(\"#myModal\").modal();\n\t\t\t}", "function displayWin() {\n $(\"#winner-message\").show();\n }", "function openModal() {\n modal.style.display = \"block\";\n passTheScore();\n}", "function winMessage() {\n \tMODAL.style.display = 'block';\n }", "function compWinner() {\n //Player can't click on any more squares //\n $(\".box\").css({\n \"pointer-events\": \"none\"\n});\n //\n $(\".modal-content p\").append(\"Computer wins!\");\n $(\"#myModal\").delay(1400).fadeIn(600);\n}", "function openModal(player) {\n modal.style.display = \"block\";\n modal_text.innerHTML = `<b>Player ${player}</b> won the game!!!`\n}", "function modalShown(o){\n\t\t/*\n\t\tif(o.template){\n\t\t\t//show spinner dialogue\n\t\t\t//render o.template into o.target here\n\t\t}\n\t\t*/\n\t\tsaveTabindex();\n\t\ttdc.Grd.Modal.isVisible=true;\n\t}", "function gameWinPopup(){\n var modalGameWin = document.getElementById('modalGameWin');\n var rePlay = document.getElementById(\"replayBtnWin\");\n var img = document.querySelectorAll(\"img\")[0];\n\n modalGameWin.style.display = \"block\";\n $(\"#scoreWin\").html(\"Final score: \" + finalScore);\n // When the user clicks button replay, close it\n rePlay.onclick = function() {\n window.location.assign(\"../start.html\");\n }\n }", "function gameOver() {\n $('#winnerText').text(`Your final score is ${score}`);\n $('#winnerModal').modal('toggle');\n}", "function showModal() {\n\tdocument.querySelector('.backdrop').style.display = 'block';\n\tdocument.querySelector('.modal').style.display = 'block';\n\tdocument.querySelector('.total').textContent = moves;\n\tdocument.querySelector('.time-taken').textContent = totalTimeString();\n\tdocument.querySelector('.star-rating').innerHTML = checkStarRating();\n}", "function gameIsOver() {\n \n // Append the message in the modal dialog respectively\n if(player1 > player2)\n {\n $(\"#winner\").text(\"Winner!!Player1 catched more Pokemons\");\n }\n if(player2 > player1){\n $(\"#winner\").text(\"Winner!!Player2 catched more Pokemons\");\n }\n if(player1 === player2)\n {\n $(\"#winner\").text(\"Both players catched equal Pokemons\");\n }\n // show modal dialog \n $(\"#myModal\").modal('show');\n\n}", "function dealerWin() {\n dealerWinModal.style.display = \"block\";\n}", "function modalStart(e) {\n e.preventDefault();\n document.querySelector('p.numbers span').textContent = game.numbers = 0;\n document.querySelector('p.wins span').textContent = game.wins = 0;\n document.querySelector('p.losses span').textContent = game.losses = 0;\n document.querySelector('p.draws span').textContent = game.draws = 0;\n document.querySelector('[data-summary=\"who-win\"]').textContent = '';\n document.querySelector('[data-summary=\"your-choice\"]').textContent = '';\n document.querySelector('[data-summary=\"ai-choice\"]').textContent = '';\n if (!isNaN(params.playerName = document.querySelector('input[name=\"firstname\"]').value)){\n return alert('You Have To Give Your Name!!!')\n };\n params.numberRounds = document.querySelector('input[name=\"rounds\"]').value;\n infoRounds.innerHTML = `${params.numberRounds} Rounds to the End of the Game`\n params.play = true;\n document.querySelector('#modal-overlay').classList.remove('show');\n choice.innerHTML = params.playerName.toUpperCase();\n}", "function gameOver() {\n stopMusic();\n loose.play();\n modal.style.display = \"block\";\n modalContent.innerHTML = `<h1 class=\"centered\">Game Over!</h1><h3 class=\"centered\">You have lost all lives and collected ${player.score} points!</h3><button class=\"restart button centered\">RESTART!</button>`;\n}", "function gameWonMessage() {\n $('.play-again').click(gameStart);\n $('#gameWon').modal(\"show\");\n}", "showGameWonModal() {\n let modalView = document.getElementById(\"modal-container-view\");\n let modalCloseBtn = document.getElementById(\"modal-close-btn\");\n modalView.style.display = \"flex\";\n\n // Allows user to dimiss the modal message\n modalCloseBtn.onclick = function () {\n modalView.style.display = \"none\";\n }\n\n // When the user clicks anywhere outside of the modal, close it\n window.onclick = function (event) {\n if (event.target == modalView) {\n modalView.style.display = \"none\";\n }\n }\n console.log(\"game won!\");\n }", "function showModal(){\n gamePaused=true;\n let container=$QS('.gameDisplayDiv');\n let modal=$CESC('div', 'msg-modal');\n \n let h2=$CESC('h2', 'modal-heading');\n h2.innerText='pause';\n //continue game , restart, quit game\n let continueBtn=$CESC('button', 'modal-btn continue-btn');\n continueBtn.innerText='continue game';\n continueBtn.onclick=continueGame;\n\n let resetBtn=$CESC('button', 'modal-btn reset-btn');\n resetBtn.innerText='Restart';\n resetBtn.onclick=resetGame;\n\n let quitBtn=$CESC('button', 'modal-btn quit-btn');\n quitBtn.innerText='quit btn';\n quitBtn.onclick=goToHomePage;\n \n $ACP(modal, h2);\n $ACP(modal, continueBtn);\n $ACP(modal, resetBtn);\n $ACP(modal, quitBtn);\n\n $ACP(container, modal);\n}", "function winTwentyOne() {\n winTwentyOneModal.style.display = \"block\";\n}", "function gameOverPopup(){\n var modalGameOver = document.getElementById('modalGameOver');\n var rePlay = document.getElementById(\"replayBtn\");\n var img = document.querySelectorAll(\"img\")[0];\n\n modalGameOver.style.display = \"block\";\n $(\"#score\").html(\"Final score: \" + finalScore);\n // When the user clicks button replay, close it\n rePlay.onclick = function() {\n window.location.assign(\"../start.html\");\n }\n }", "function winner() {\n if (game.wins > game.losses) {\n document.querySelector('#modal-show .content p').innerHTML = `<span style= \"color: green\"> ${params.playerName} ( ${game.wins} - ${game.losses} ) Computer </span><br><p style= \"color: green\">${params.playerName} WON THE GAME!!! :)</p>`\n } else if (game.wins < game.losses) {\n document.querySelector('#modal-show .content p').innerHTML = `<span style= \"color: #FF0000\"> ${params.playerName} ( ${game.wins} - ${game.losses} ) Computer </span><br><p style= \"color: #FF0000\">${params.playerName} LOST THE GAME!!! :( </p>`\n } else {\n document.querySelector('#modal-show .content p').innerHTML = `<span style= \"color: gray\"> ${params.playerName} ( ${game.wins} - ${game.losses} ) Computer </span><br><p style= \"color: gray\"> IT IS A DRAW!!! :| TRY AGAIN !</p>`\n }\n\n}", "function playerWinner(){\n $(\".box\").css({\n \"pointer-events\": \"none\"\n});\n $(\".modal-content p\").append(\"You win!\");\n $(\"#myModal\").delay(600).fadeIn(600);\n}", "function showWhoWonModal() {\n let modal =\n $(\"<div class='modal fade' role='dialo'></div>\").append(\n $(\"<div class='modal-dialog' role='document' ></div>\").append(\n $(\"<div class='modal-content' role='document'></div>\").append(\n $(\"<div class='modal-header'></div>\").append(\n '<h5 class=\"modal-title\">'+tr(\"Who won this round?\")+'</h5> <button id=\"closeModal\" type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"> <span aria-hidden=\"true\">&times;</span> </button>'\n ),\n $(\"<div class='modal-body'></div>\").append(\n $(\"<button class='btn btn-outline-success padded form-control' data-dismiss='modal'>\"+tr(\"The civillians\")+\"</button>\")\n .click(function () {addScore('c'); startNextRound()}),\n $(\"<button class='btn btn-outline-danger padded form-control' data-dismiss='modal'>\"+tr(\"Spy\")+\"</button>\")\n .click(function () {addScore('s'); startNextRound()}),\n )\n )\n )\n );\n modal.modal();\n}", "function announceWinner() {\n if (checkWin()) {\n clock.stop();\n //retrieve the star element from the page\n const starGame = document.querySelector('.stars');\n //star element in the modal\n const starFinal = document.querySelector('#starfinal');\n //retrieve the move element\n const movesFinal = document.querySelector('.movesFinal');\n //retrieve the time element\n const time = document.querySelector('#time');\n time.textContent = getTime();\n //show the stars earned on the modal\n starFinal.innerHTML = starGame.outerHTML;\n // show the moves on the modal\n movesFinal.textContent = `${moveCount} Moves`;\n $('#myModal').modal('show');\n\n //show the score table after the first game\n if (gameCount !== 0) {\n tBody.parentElement.setAttribute('style', '');\n let tRow = `<tr>\n <th scope=\"row\">${gameCount}</th>\n <td>${score}</td>\n <td>${moveCount}</td>\n <td>${time.textContent}</td>\n </tr>`;\n tBody.insertAdjacentHTML('beforeend', tRow);\n\n }\n\n }\n}", "function displayModal() {\n let gameTime = calcTime(numSeconds);\n const modalBody = document.querySelector('.modal-body');\n const modalMovesHTML = \"<h3>Moves: \" + moves + \" </h3>\";\n const modalTimerHTML = \"<h3>Time: \" + gameTime + \" </h3>\";\n const modalHeading = \"<h2>Congratulations! You won!</h2>\";\n const modalTrophy = \"<i class='fas fa-trophy'></i>\";\n let stars = \"<h3>Star Rating: \";\n stars += generateStars();\n stars += \"</h3>\";\n modalBody.innerHTML += modalTrophy;\n modalBody.innerHTML += modalHeading;\n modalBody.innerHTML += modalMovesHTML;\n modalBody.innerHTML += modalTimerHTML;\n modalBody.innerHTML += stars;\n $('.modal').modal('show');\n}", "function showModal(){\n let modalWinner = document.getElementById('modal-winner')\n $('#modal-winner').modal('show')\n}", "function showGameResult () {\n if ($( \".flippable\" ).length === 2 && $('.show').length === 12) { // we pop up a winner modal\n $('.modal-body').html(\n `\n <div class=\"score-item\">Your Time: ${$('.Timer').text()}</div>\n <div class=\"score-item\">Your Score: ${$('.stars').html()}<div>\n `\n );\n $('#endGameModalLabel').text('You Win!');\n $('#endGameModal').modal('show');\n clearInterval(timer);\n resetBoard();\n } else if (moves === 0) { // else we pop up a loser modal\n $('.modal-body').html(\n `\n <div class=\"score-item\">Your Time: ${$('.Timer').text()}</div>\n `\n );\n $('#endGameModalLabel').text('You Lose!');\n $('#endGameModal').modal('show');\n clearInterval(timer);\n resetBoard();\n } else { // not the end of the game!\n return;\n }\n}", "function showModal() {\n setVisible(true);\n setSignUp(false);\n }", "modalShow() {\n\t\tlet modal = document.getElementById(\"myModal\");\n\t\tlet restartBtn = document.getElementsByClassName(\"close\")[0];\n\n\t\tthis.scene.pause(); // pause timer & game When colliding with a bomb\n\t\tmodal.style.display = \"block\"; // show modal\n\n\t\trestartBtn.addEventListener(\"click\", (e) => {\n\t\t\te.preventDefault();\n\t\t\tmodal.style.display = \"none\"; // hide modal on clicking 'RESTART' button\n\n\t\t\t// restart after clicking 'restart' - clear all events & set game in initial point\n\t\t\tthis.restartGame();\n\t\t});\n\t}", "win() {\n modal.style.display = 'block';\n playAgainButton.focus();\n this.clear();\n }", "function guessedAllCharacters() {\n modelState = \"win\";\n document.getElementById(\"modal-text\").append(\"You got that!\");\n modal.style.display = \"block\";\n modalisDisplayed = true;\n }", "function guessedAllCharacters() {\n modelState = \"win\";\n document.getElementById(\"modal-text\").append(\"You got that!\");\n modal.style.display = \"block\";\n modalisDisplayed = true;\n }", "function win() {\n if (cardList.length === liMatch.length) {\n stopTimer();\n displayModal();\n }\n}", "function leaderBoardScreen() {\n $('#endModal').modal('hide');\n $('#leaderBoardModal').modal('show');\n\n}", "function showCongratulationModal() {\n let template = `\n were ${scorePanel.playTime} seconds on a ${deckConfig.numberOfcards === difficulty.easy ? 'easy' : 'hard'} level, \n with ${scorePanel.moveCounter} moves and ${scorePanel.starCounter} star(s).`;\n\n $(\"#congratulationScore\").text(template);\n $(\"#congratulationModal\").modal({ show: true, backdrop: 'static', keyboard: false });\n}", "function winMC() {\r\n console.log('You Win');\r\n \r\n setTimeout(function () {\r\n $('#gameoverMC h1').html(\"You Win!\");\r\n $('#gameoverMC div.ui-content p').html(\"Congratulations You Win! <br/> You Scored \" + score + \" Out Of \" + totalPts + \" Points!\");\r\n $(\"#gameoverMC\").popup(\"open\");\r\n }, 600);\r\n }", "function winner(){\n gameMode = false;\n $('.pop-up').html(curPlayer + \" is victorious! <br><br> Press 'New Game' to play again\");\n $('.pop-up').css(\"visibility\", \"visible\");\n}", "function openModal () {\n\t\tmodalMoves.innerHTML = moves;\n\t\tmodalSecs.innerHTML = pad(totalTime%60);\n\t\tmodalMins.innerHTML = pad(parseInt(totalTime/60));\n\t\tmodal.style.display = 'block';\n}", "function whoWon(){\n\tif(gameOver() == true){\n\t\tmodal.style.display = \"block\";\n\t\t$(\".modalContent\").removeClass(\"closeModal\");\n\t\t$(\".modalContent\").addClass(\"openModal\");\n\n\t\tif(playerScores[0] > playerScores[1]){\n\t\t\t$(\".modalBody\").empty().append(\"Player 1 has won!\");\n\t\t\t// $(\".modalBody\").append(\"Player 1 has won!\");\n\t\t} \n\n\t\telse if(playerScores[1] > playerScores[0]){\n\t\t\t$(\".modalBody\").empty().append(\"Player 2 has won!\");\n\t\t\t// $(\".modalBody\").append(\"Player 2 has won!\");\n\t\t} \n\n\t\telse{\n\t\t\t$(\".modalBody\").empty().append(\"It's a draw...\");\n\t\t\t// $(\".modalBody\").append(\"It's a draw...\");\n\t\t}\n\t}\n}", "update() {\n this.scoreHTML.innerText = this.score;\n // show modal if you score 12\n if(this.score == 12){\n this.win();\n }\n }", "function modalWindow() {\n $(\"#modal\").css('display', 'block');\n }", "function display_winner(win_code) {\r\n var modal_message;\r\n\r\n switch(win_code) {\r\n case 1: // X won\r\n\r\n if (p.player_move == \"X\") {\r\n modal_message = \"Congrats, you win!\";\r\n $.post(\"play.php\", {player_wins: 1});\r\n $(\"#wins\").html(parseInt($(\"#wins\").text()) + 1);\r\n }\r\n else {\r\n modal_message = \"Sorry, you lost. Better luck next time!\";\r\n $.post(\"play.php\", {player_losses: 1});\r\n $(\"#losses\").html(parseInt($(\"#losses\").text()) + 1);\r\n }\r\n\r\n break;\r\n case 2:\r\n\r\n if (p.player_move == \"O\") {\r\n modal_message = \"Congrats, you win!\";\r\n $.post(\"play.php\", {player_wins: 1});\r\n $(\"#wins\").html(parseInt($(\"#wins\").text()) + 1);\r\n }\r\n else {\r\n modal_message = \"Sorry, you lost. Better luck next time!\";\r\n $.post(\"play.php\", {player_losses: 1});\r\n $(\"#losses\").html(parseInt($(\"#losses\").text()) + 1);\r\n }\r\n\r\n break;\r\n case 3:\r\n modal_message = \"It's a draw!\";\r\n $.post(\"play.php\", {player_draws: 1});\r\n $(\"#draws\").html(parseInt($(\"#draws\").text()) + 1);\r\n break;\r\n }\r\n\r\n $(\"#modal_message\").html(modal_message);\r\n $(\"#winner_modal\").modal(\"show\");\r\n}", "function gameModal() {\r\n $(\"#myModal\").modal();\r\n winMoves.innerHTML = movesCounter.innerHTML;\r\n winTime.innerHTML = timer.innerHTML;\r\n winStars.innerHTML = stars.innerHTML;\r\n console.log(winTime, winMoves, winStars);\r\n}", "function endGameModal() {\n $('#endGameModal').modal(\"show\");\n\n}", "function showModal() {\n\t\tcurrent_username = this.textContent;\n\t\tno_of_friends = this.getAttribute(\"data-friends\");\n\t\tcurrent_modal = document.getElementsByClassName(\"modal\")[0];\n\t\tdocument.getElementsByClassName(\"modal__title\")[0].textContent = current_username;\n\t\tdocument.getElementsByClassName(\"modal__body\")[0].textContent = \"Number of friends: \" + no_of_friends;\n\t\tcurrent_modal.style.display = \"block\";\n\t\tcurrent_modal.nextElementSibling.style.display = \"block\";\n\t\tdocument.getElementsByClassName(\"modal__close\")[0].childNodes[0].addEventListener(\"click\", hideModalButton);\n\t\tdocument.getElementsByClassName(\"modal\")[0].addEventListener(\"click\", hideModalScreen);\n\t}", "function congratsPopup() {\n stopTimer();\n\n popup.style.visibility = 'visible'; //popup will display with game details//\n //display moves taken on the popup//\n document.getElementById(\"totalMoves\").innerHTML = moves;\n //display the time taken on the popup//\n finishTime = timer.innerHTML;\n document.getElementById(\"totalTime\").innerHTML = finishTime;\n //display the star rating on the popup//\n document.getElementById(\"starRating\").innerHTML = stars;\n console.log(\"Modal should show\"); //testing comment for console//\n }", "function winGame() {\n if (matchList === 8) {\n pause();\n openModal();\n timerModal.innerText = `Final time is: ${min}:${zeroPlaceholder}${second}`;\n playTimer.style.display = 'none';\n gameStarted = false;\n }\n if (moves < 20 && moves > 12) {\n starCount[5].style.display = 'none';\n } else if (moves > 20) {\n starCount[4].style.display = 'none';\n }\n countModal.innerHTML = moves;\n}", "function checkWin() {\n if (matchFound === 8) {\n $(\"#runner\").css(\"display\",\"none\")\n $(\".win-modal\").css(\"display\",\"block\");\n $(\".win-modal .stars\").text(stars);\n $(\".win-modal .moves\").text(moves);\n $(\".win-modal .runner\").text(minute + \":\" + second);\n }\n }", "function checkForWin() {\n if (score > score2){\n $('#player1WinModal').show();\n $('#player1WinModalClose').click(function(){\n $('#player1WinModal').hide();\n });\n } else if (score < score2){\n $('#player2WinModal').show();\n $('#player2WinModalClose').click(function(){\n $('#player2WinModal').hide();\n });\n } else if (score = score2) {\n $('#drawModal').show();\n $('#drawModalClose').click(function(){\n $('#drawModal').hide();\n });\n }\n }", "function renderGameOverModal(state) {\n let gameOverStatus = document.getElementById('game-over-status');\n \n if(state.user.isWinner) {\n gameOverStatus.innerText = \"You won!\";\n gameOverStatus.classList.add(\"text-success\");\n } else {\n gameOverStatus.innerText = \"You lost!\";\n gameOverStatus.classList.add('text-danger');\n }\n\n gameOverModal.show();\n}", "function display_modal() {\n document.getElementById('welcome_modal').style.display = \"block\";\n}", "function display() {\n swal({\n title: \"😊congratulations successfully completion of Game\\n😁👍\",\n type: \"success\",\n confirmButtonText: \"play again\"\n },\n //we reload the game after game completion wee use reload function\n function reload() {\n window.location.reload();\n\n }\n )\n}", "function finishedGame() {\n timer.pause();\n let pText = document.querySelector(\"#resultFinished\");\n let iStars = parseInt(countStars);\n let middle = countStars > iStars ? 'and a half' : '';\n pText.innerHTML = `You won with ${countMoves} moves and ${iStars} ${middle} stars in ${timer.getTimeValues().toString()}.`;\n $('#myModal').modal();\n}", "function win(){\n if (match_list.length === 16){\n clearInterval(timer);\n let newP = document.createElement('p');\n modals.style.display = 'block';\n newP.textContent = \"You Win in \" + document.getElementById(\"numberMoves\").innerText + \" moves. With a star rating of \" + $(\".fa.fa-star\").length + \" in \" + document.getElementById(\"minutes\").innerText + \" minutes and \"+ document.getElementById(\"seconds\").innerText + \" seconds. Do you want to play again...? Click OK to continue.\";\n open_modal.appendChild(newP);\n modal();\n }\n}", "function openNewWishDialog() {\n console.log(\"New wish button clicked\")\n \n let modal = document.getElementById('new-wish-modal')\n modal.style.display = \"block\"\n}", "function matchedGame() {\n if (totalMatched === 16) {\n stop();\n setTimeout(() => {\n const modal = document.createElement('div');\n modal.classList.add('modal');\n modal.innerHTML = `<div class='modal-content'>\n <h1>Congratulations!</h1>\n <p>Thank's for playing the Brilliant Economists Memory Game.</p>\n <p>You completed the game in <span>${totalClicks}</span> Moves with a time of <span>${myStopWatch.textContent}</span> minutes</p><br>\n <div id='modal-stars'>Your Star Rating is: <ul>${starRating.innerHTML}</ul> \n </div><br>\n <p>If you would like to play again click the button below.</p>\n <button id='modal-reset' type =\"button\" onclick=\"window.location.reload()\">Play Again</button>\n </div>`;\n document.body.appendChild(modal);\n }, 2000);\n }\n }", "function showModal(points) {\n modal.style.display = \"block\";\n console.log(points);\n //lost points\n if (parseInt(points) < 0) {\n document.getElementById(\"result\").textContent = \"You have lost \" + points + \" points.\";\n document.getElementsByClassName(\"modal-header\")[0].style.backgroundColor = \"red\";\n document.getElementById(\"endImg\").setAttribute(\"src\", \"./images/lost.png\");\n } else {\n document.getElementById(\"result\").textContent = \"You have gained \" + Math.abs(parseInt(points)) + \" points.\";\n document.getElementsByClassName(\"modal-header\")[0].style.backgroundColor = \"green\";\n document.getElementById(\"endImg\").setAttribute(\"src\", \"./images/win.png\");\n }\n}", "function displayWinner(name) {\n const winnerModal = document.getElementById(\"winnerModal\");\n const restartGame = document.getElementById(\"restartGame\");\n document.getElementById('winner').innerHTML = name;\n gameStarted = false;\n winnerModal.style.display = \"block\";\n restartGame.onclick = (e) => {\n e.preventDefault();\n player1.score = 0;\n player2.score = 0;\n newGame();\n }\n}", "function gameOver(moves, score) {\n $('#winText').text(`You got a score of ${score} ` +\n `with ${ moves} moves in ${second} seconds.`);\n $('#winModal').modal('toggle');\n}", "function showScoreBoard() {\n\t$(\"#scoreboardspinner\").show();\n\t$('#scoreboardModal').modal('show');\n}", "function winGame() {\n var finalScore = document.querySelector('.score');\n var finalTime = document.querySelector('.time');\n\n /* Display modal box after a 1.2 seconds delay to give time for the last matched cards animation to run\n and inserts the player game stats to the DOM */\n setTimeout(function() {\n modal.style.display = 'block';\n finalScore.innerHTML = `You finished the game with ${moves} moves and ${stars} star(s)!!!`;\n if (minutes >= 1) {\n finalTime.innerHTML = `Time completed: ${minutes} minutes and ${seconds} seconds.`;\n } else {\n finalTime.innerHTML = `Time completed: ${seconds} seconds.`;\n }\n }, 1200);\n}", "fillWinnerModal (text) {\n const div = document.createElement('div');\n const p = document.createElement('p');\n p.setAttribute('id', 'winnerP');\n p.innerText = text;\n const btn = document.createElement('button');\n btn.innerText = \"Play Again?\";\n btn.setAttribute('class', 'button');\n btn.addEventListener('click', () => {\n this.startGame();\n winnerModal.style.display = 'none';\n })\n div.append(p);\n div.append(btn);\n document.querySelector('#winner').appendChild(div);\n }", "function popup(player) {\n\t\tconst popupWindow = document.querySelector('.popup');\n\t\t// Update the winner paragraph\n\t\tdocument.querySelector('.winner').textContent = `Winner: ${player}`;\n\t\tpopupWindow.style.visibility = 'visible';\n\t\tdocument.querySelector('.app').style.visibility = 'hidden';\n\t}", "function showQuiz() {\n // show the quiz pop up\n document.getElementById('modal-wrapper').style.display='block'\n}", "function showWinMessage() {\n playerMoney += winnings;\n playerCredit = playerCredit + winnings;\n messageLabel.text = \"You win \\n$\" + winnings + \"\";\n winningsLabel.text = \"\" + playerMoney + \"\";\n creditLabel.text = \"\" + playerCredit + \"\";\n resetFruitTally();\n checkJackPot();\n }", "function openModal() {\n if (matchedCards === 8){\n modal.style.display = \"block\";\n clearInterval(interval);\n finalTime = timer.innerHTML;\n finalMove = moves.textContent;\n finalMove++;\n const starRating = document.querySelector(\".stars\").innerHTML;\n document.getElementById(\"finalMove\").innerHTML = finalMove;\n document.getElementById(\"starRating\").innerHTML = starRating;\n document.getElementById(\"totalTime\").innerHTML = finalTime;\n }\n }", "function getModal(showModal, isVictory) {\r\n\r\n if (showModal) {\r\n document.querySelector('.modal').style.visibility = \"visible\";\r\n } else {\r\n document.querySelector('.modal').style.visibility = \"hidden\";\r\n }\r\n\r\n if (isVictory) {\r\n document.querySelector('.game-over-txt').innerText = 'Game Done';\r\n } else {\r\n document.querySelector('.game-over-txt').innerText = 'Game Over';\r\n }\r\n\r\n}", "function winGame(event){\n\tif(numMatches === 8){\n\t\twindow.clearInterval(timer);\n\t\tendTime = document.getElementById('time').innerText;\n\t\tstarRating = document.querySelector('.stars').cloneNode(true);\n\t\tdocument.querySelector('.modal').style.display = 'block';\n\t\tdocument.querySelector('.win-text').innerText = 'It took you ' + endTime + ' to find all matches in ' + countMoves + ' moves.';\n\t\tdocument.querySelector('.modal-footer').innerText = 'FINAL STAR RATING ';\n\t\tdocument.querySelector('.modal-footer').appendChild(starRating);\n\t}\n}", "function openNewRankTaskModal() {\n newRankTaskModal.style.display = \"block\";\n }", "function ouvrir() {\n creationModal();\n }", "function gameCompleted() {\n if (totalMatches === 8) {\n stopTimer();\n modal.style.display = \"block\";\n document.getElementById('modalText').innerHTML = \"Game finished, congratulations!\\n \" + \" \";\n $(\"#modalText\").append('<i class=\"fa fa-sign-language\"></i>');\n document.getElementById('modalText1').innerHTML = \"Your rating is: \" +\n stars + \" star(s)\\n\";\n document.getElementById('modalText2').innerHTML = \"Total time: \" + dHour + hour + \":\" +\n dMin + min + \":\" + dSec + sec + \"\";\n document.getElementById('modalText3').innerHTML = 'If you want to play again click \"Restart\"' + \"!\";\n }\n}", "function confirmUser() {\n resetOutput();\n let confirmDialogID = document.getElementById(\"confirmCustomDialog\");\n confirmDialogID.showModal();\n}", "function gameOver(moves, score) {\n $('#winnerText').text(`You've completed the game in ${second} seconds with a total of ${moves} moves and a score of ${score}.`);\n $('#winnerModal').modal('toggle');\n}", "function gameOver() {\n document.getElementById(\"win-modal\").style.display = \"flex\";\n\n let finalStars = document.querySelector(\".stars\").innerHTML;\n\n document.getElementById(\"numMoves\").innerHTML = moves + \" Moves\";\n document.getElementById(\"finalStars\").innerHTML = finalStars;\n displayDiffOnModal(timer);\n}", "function victoryModal(typeOfVictory) {\r\n if (typeOfVictory === \"draw\") {\r\n $(\"#game\").css(\"display\", \"none\");\r\n $(\"#draw\").css(\"display\", \"block\");\r\n let counter = 5;\r\n let int3 = setInterval(() => {\r\n if (counter === 1) {\r\n\r\n $(\"#draw\").fadeOut(\"slow\", () => {\r\n $(\"#modal\").css(\"display\", \"block\");\r\n $(\"#draw\").css(\"display\", \"none\");\r\n });\r\n }\r\n else if (counter === 0) {\r\n clearInterval(int3);\r\n }\r\n $(\"#countdown\").text(counter);\r\n counter--;\r\n }, 1000);\r\n }\r\n else if (typeOfVictory === \"win\") {\r\n $(\"#displayWinner\").text(\"Winner is: \" + winner);\r\n $(\"#currentPlayer\").css(\"display\", \"none\");\r\n $(\"#game\").css(\"margin-top\", \"35px\");\r\n\r\n let counter = 5;\r\n let int4 = setInterval(() => {\r\n if (counter === 1) {\r\n $(\"#game\").fadeOut(\"slow\", () => {\r\n $(\"#modal\").css(\"display\", \"block\");\r\n $(\"#game\").css(\"display\", \"none\");\r\n });\r\n }\r\n else if (counter === 0) {\r\n clearInterval(int4);\r\n }\r\n $(\"#restartCounter\").css(\"display\", \"block\");\r\n $(\"#restartCounter\").text(\"Restarting in : \" + counter);\r\n counter--;\r\n }, 1000);\r\n }\r\n }", "function tieGame() {\n $(\".box\").css({\n \"pointer-events\": \"none\"\n});\n $(\".modal-content p\").append(\"It's a tie!\");\n $(\"#myModal\").delay(700).fadeIn(600);\n}", "function showModal () {\n $modal = $('<div class=\"modal-test\"><h1>Your result:</h1></div>');\n $overlay = $('<div class=\"modal-overlay\" title=\"Close results!\"></div>');\n $body.append($overlay);\n $body.append($modal);\n $modal.animate({ top: \"50%\" }, 800);\n }", "activateModalPanel() {\n this.modalPanel = atom.workspace.addModalPanel({\n item: this.warnBeforeQuittingView.getElement(),\n visible: false\n });\n }", "function showMessage() {\n modal.style.display = \"block\";\n }", "function gameOver() {\n stopClock();\n writeModalStats();\n toggleModal();\n}", "function continueGame() {\n // clear modal\n $(\".modal\").removeClass(\"bg-modal\");\n $(\".modal-inner\").removeClass(\"modal-content\").html(\"\");\n // has endgame condition been reached\n if (selectedGlyphs.length === numQuestionsPerGame) {\n endCondition_gameOver();\n } else {\n selectGlyph();\n }\n }", "function gameWin(player){\n var playerColor = player.toUpperCase();\n $(\"#winMsg\").html(playerColor + \" WINS!!!\");\n $(\"#winModal\").modal(\"show\");\n if(player == \"red\"){\n redWins++;\n $(\".redWins\").html(redWins);\n turn = \"red\";\n }else{\n blackWins++;\n $(\".blackWins\").html(blackWins);\n turn = \"black\";\n }\n }", "function displayTutorials() {\r\n tutModal.style.visibility = \"visible\";\r\n tutModal.style.opacity = \"1\";\r\n console.log(\"The modal was opened\");\r\n}", "function cardboard() {\n modal1.style.display = \"block\";\n}", "function gameOver() {\n\tstopClock();\n\twriteModalStats();\n\ttoggleModal();\n}", "function won() {\n stopTimer();\n let rating = document.getElementById(\"stars\").innerHTML;\n let ratingModal = document.getElementById(\"stars-modal\");\n ratingModal.innerHTML = rating;\n let time = document.getElementById(\"timerLabel\").textContent;\n let timeModal = document.getElementById(\"time-modal\");\n timeModal.textContent = \"Time: \" + time;\n // I can break it to min sec and ms later\n modal.style.display = \"block\";\n\n let replay = document.getElementById('replay');\n\n replay.addEventListener('click', function() {\n modal.style.display = \"none\";\n restartGame();\n });\n\n // When the user clicks on <span> (x), close the modal\n closeModal.onclick = function() {\n modal.style.display = \"none\";\n }\n\n // When the user clicks anywhere outside of the modal, close it\n window.onclick = function(event) {\n if (event.target == modal) {\n modal.style.display = \"none\";\n }\n }\n\n }", "function launchModal(){\n modal.style.display = \"block\";\n}", "function displayWinner(winner) {\n document.getElementById('overlay').classList.remove('hide');\n // let winContainer = document.getElementsByClassName('win-container');\n // winContainer[0].classList.add('win');\n // couldn't ever get this animation to work - there's something I haven't learned yet\n // about how to apply transition timing to javascript css changes.\n document.getElementById('win-dialog').textContent = `${winner} the winner!`;\n}", "function win(){\n massHide();\n //increment correct answer\n ansCorrect++;\n nextQuestion();\n $(\"#answers\").html(\"\");\n $(\"#question\").html(\"<h2 class='text-center'>Awwww YEEE!</h2>\");\n $(\"#picture\").html(\"<img width='400px'height='auto' class='img-fluid' src=\"+currQues.picSrc+\" />\");\n $(\"#gameMessage\").html(\"<h2>\"+currQues.comment+\"</h2>\");\n massFadeIn();\n}", "function displayGameOverModal() {\n document.getElementById('gameOverModal').style.display = 'table';\n let moves = document.getElementsByClassName('moves')[0].textContent;\n let noOfStars = document.getElementsByClassName('stars')[0].children.length;\n let timeTaken = document.querySelector('.timeElapsed').textContent;\n document.getElementsByClassName('para2-gameover')[0].textContent = `With ${moves} moves, ${noOfStars} stars and in ${timeTaken}`;\n}", "function roller(){\n var modal = document.getElementById('roller');\n\n modal.style.display = 'block';\n}", "function openModal(){\n modal.style.display = 'block';\n modalp.innerHTML = `Congrats! You saved ${moveCount} stars in ${min} minutes and ${second} seconds. Click on &times; to close modal box and <i class=\"fas fa-redo-alt\"></i> button on the top right side of the page to replay` ;\n }", "function welcomeMessage(){\n $('#introModal').show();\n }", "function updateInfo() {\n const updatedInfoModal = document.getElementById('updatedInfoModal');\n\n updatedInfoModal.style.display = \"block\";\n\n $(\".okay\").on(\"click\", function () {\n updatedInfoModal.style.display = \"none\";\n })\n}", "function findWinner() {\n \n if (matchFound === 8) {\n timer.pause();\n\n var modal = document.getElementById(\"winner-popup\");\n var span = document.getElementsByClassName(\"close\")[0];\n\n $(\"#total-moves\").text(moves);\n $(\"#total-stars\").text(starRating);\n $(\".minutes\").text(timer.getTimeValues().minutes);\n $(\".seconds\").text(timer.getTimeValues().seconds);\n \n modal.style.display = \"block\";\n \n // When the user clicks on <span> (x), close the modal\n span.onclick = function() {\n modal.style.display = \"none\";\n }\n\n $(\"#play-again\").on(\"click\", function() {\n location.reload()\n });\n \n clearInterval(timer);\n }\n}", "function gameOverModal(starRating) {\n modal.style.display = \"block\";\n finalSeconds = document.getElementById(\"seconds\").innerText;\n finalMinutes = document.getElementById(\"minutes\").innerText;\n // modal message\n modalInner.textContent ='Congratulations! You have finished the game in ' +\n finalMinutes + ' minutes and ' + finalSeconds +\n ' seconds and your star rating is: ' + starRating;\n}", "function gameOver() {\n\tstopTimer();\n\tupdateModal();\n\ttoggleModal();\n}", "function gameOver() {\n // Clear the interval\n clearInterval(info.timeout);\n // Display the modal\n divs.modal_div.style.display = \"block\";\n // Update the final score element\n divs.final_score.innerText = \"Your final score is: \" + info.score;\n}" ]
[ "0.7775623", "0.76638955", "0.75036275", "0.74830043", "0.7405139", "0.7398907", "0.73937726", "0.7374621", "0.73305446", "0.72710156", "0.7241142", "0.7210416", "0.7180967", "0.7168", "0.7163231", "0.7126503", "0.711756", "0.7103465", "0.7099139", "0.7092228", "0.70862067", "0.70839155", "0.6974296", "0.69569534", "0.69507277", "0.69277", "0.6920788", "0.6898934", "0.68811005", "0.6880955", "0.68808377", "0.68791187", "0.68647116", "0.68646747", "0.68646747", "0.68600315", "0.6852201", "0.68478847", "0.68471855", "0.6844775", "0.68420535", "0.6817078", "0.6812101", "0.6800606", "0.6794371", "0.6782447", "0.67734414", "0.6767088", "0.67616814", "0.67505485", "0.6744781", "0.6743852", "0.67405725", "0.6724151", "0.67193705", "0.67118984", "0.6708632", "0.6698603", "0.6695261", "0.669205", "0.6690582", "0.6690535", "0.6674036", "0.66739935", "0.6663208", "0.66523844", "0.6647936", "0.66445607", "0.66434824", "0.6643181", "0.66417646", "0.6639545", "0.66382915", "0.662478", "0.6617401", "0.6614299", "0.66141707", "0.66117585", "0.66060394", "0.6602308", "0.6592464", "0.65865713", "0.6584718", "0.6583713", "0.6575387", "0.6561222", "0.65542156", "0.65521747", "0.6550731", "0.6550717", "0.6537366", "0.65337616", "0.6529454", "0.6525954", "0.6523776", "0.6518325", "0.6510994", "0.6509363", "0.6500605", "0.64999735", "0.6498604" ]
0.0
-1
Rating system to show three stars and then removes stars after a certain amount of moves
function rating () { if (moves < maxStars) { ratingStar = "<i class= 'star fas fa-star'></i><i class= 'star fas fa-star'></i><i class='star fas fa-star'></i>"; } else if (moves < minStars) { stars[2].style.color = "#444"; ratingStar = "<i class='star fas fa-star'></i><i class= 'star fas fa-star'></i>"; } else { stars[1].style.color = "#444"; ratingStar = "<i class='star fas fa-star'></i>"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function starRating() {\n if (moves > 13 && moves < 16) {\n starCounter = 3;\n } else if (moves > 17 && moves < 27) {\n starCounter = 2;\n } else if (moves > 28) {\n starCounter = 1;\n }\n showStars(starCounter);\n }", "function recalcStars() {\n const stars = document.querySelector(\".stars\");\n if ((countStars===3 && countMoves === 11) || (countStars===2 && countMoves === 17) ) {\n stars.children[countStars-1].firstElementChild.classList.replace('fa-star','fa-star-half-o');\n countStars -= 0.5;\n }\n if ((parseInt(countStars)===2 && countMoves === 14) || (parseInt(countStars)===1 && countMoves === 20)) {\n countStars -= 0.5;\n stars.children[countStars].firstElementChild.classList.replace('fa-star-half-o','fa-star-o');\n }\n}", "function starsRating() {\n if (moves === 14 || moves === 17 || moves === 24 || moves === 28\n ) { hideStar();\n }\n}", "function adjustRating() {\n const oneStar = document.querySelector(\".fa-star\").parentNode;\n if (moveCount == 28) {\n oneStar.parentNode.removeChild(oneStar);\n } else if (moveCount == 38) {\n oneStar.parentNode.removeChild(oneStar);\n }\n}", "function starRating () {\n if ( moveCount === 20 || moveCount === 30 ) {\n decrementStar();\n }\n}", "function rating() {\n\tconst star1 = document.getElementById(\"one-star\");\n\tconst star2 = document.getElementById(\"two-star\");\n\tconst star3 = document.getElementById(\"three-star\");\n\t// change stars style depending on number of moves\n\tif (moveCounter == 18) {\n\t\tstar1.classList.remove(\"fas\");\n\t\tstar1.classList.add(\"far\");\n\t} else if (moveCounter == 16){\n\t\tstar2.classList.remove(\"fas\");\n\t\tstar2.classList.add(\"far\");\n\t} else if (moveCounter == 14) {\n\t\tstar3.classList.remove(\"fas\");\n\t\tstar3.classList.add(\"far\");\n\t} else {\n\t\t\n\t}\n}", "function updateRating() {\n //Rating game based on move count\n if (numMoves == (moves_to_two_stars)) {\n stars[2].classList.remove(\"fa-star\");\n stars[2].classList.add(\"fa-star-o\");\n rating = 2;\n }\n else if (numMoves == (moves_to_one_star)) {\n stars[1].classList.remove(\"fa-star\");\n stars[1].classList.add(\"fa-star-o\");\n rating = 1;\n }\n}", "function rating() {\n 'use strict'; // turn on Strict Mode\n if (moves > 10 && moves < 19) {\n stars[2].classList.remove('fa-star');\n stars[2].classList.add('fa-star-o');\n starsRating = 2;\n } else if (moves > 20) {\n stars[1].classList.remove('fa-star');\n stars[1].classList.add('fa-star-o');\n starsRating = 1;\n }\n}", "function ratings() {\n\tif(moveCounter > 12 && moveCounter <= 16) {\n\t\tsStar[0].style.cssText = 'opacity: 0';\n\t\tcStar[0].style.cssText = 'display: none';\n\t}\n\tif(moveCounter > 16) {\n\t\tsStar[1].style.cssText = 'opacity: 0';\n\t\tcStar[1].style.cssText = 'display: none';\t\n\t}\n}", "function updateStarRating() {\n const numCards = deckConfig.numberOfcards;\n\n if (scorePanel.moveCounter === 0) {\n scorePanel.starCounter = 3;\n $(\".star-disabled\").toggleClass(\"star-enabled star-disabled\");\n } else if (scorePanel.moveCounter === Math.trunc(numCards / 2 + numCards / 4)) {\n scorePanel.starCounter = 2;\n $($(\".stars\").children()[0]).toggleClass(\"star-enabled star-disabled\");\n } else if (scorePanel.moveCounter === (numCards)) {\n scorePanel.starCounter = 1;\n $($(\".stars\").children()[1]).toggleClass(\"star-enabled star-disabled\");\n }\n}", "function starRating() {\n if (moves === 15) {\n starChanger[0].classList.add('hide');\n starChanger[3].classList.add('hide');\n starChanger[1].classList.add('silver');\n starChanger[4].classList.add('silver');\n starChanger[2].classList.add('silver');\n starChanger[5].classList.add('silver');\n\n } if (moves === 20) {\n starChanger[1].classList.add('hide');\n starChanger[4].classList.add('hide');\n starChanger[2].classList.add('bronze');\n starChanger[5].classList.add('bronze');\n }\n}", "function setStars() {\n /*Grabs the section in the html that has the moves count and updates it based on moves variable. */\n document.getElementById(\"moves\").textContent = moves;\n /*Conditional used to determine what stars to display depending on the number of moves/2clicks occur. */\n if (moves <= 10){\n starsRating = 3;\n return;\n } \n /*Grabs stars elements so that later the classes can be manipulated to display clear starts instead of full stars. */\n let stars = document.getElementById(\"stars\").children;\n /*If the user has taken over 10 moves/2 clicks, then one star is replaced with a star outline. */\n stars[2].firstElementChild.classList.remove(\"fa-star\");\n stars[2].firstElementChild.classList.add(\"fa-star-o\");\n if (moves <= 20){\n starsRating = 2;\n return;\n } \n /*If the user has taken over 20 moves/2 clicks, then an addional star is repalced with a star outline. */\n stars[1].firstElementChild.classList.remove(\"fa-star\");\n stars[1].firstElementChild.classList.add(\"fa-star-o\");\n if (moves <= 30) {\n starsRating = 1;\n return;\n } \n}", "function adjustStarRating(moves) {\n if (moves === 16) {\n stars.children[0].remove();\n }\n else if (moves === 22) {\n stars.children[0].remove();\n }\n else if (moves === 32) {\n stars.children[0].remove();\n }\n else if (moves === 42) {\n stars.children[0].remove();\n }\n}", "function reduceStars() {\n let starList = document.querySelectorAll('.fa-star');\n\n // determine whether star should be removed\n if(turns % STAR_REDUCTION === 0 && stars!== 1) {\n // change the rightmost star to an empty star\n let starLost = starList[starList.length-1];\n starLost.setAttribute('class', 'fa fa-star-o');\n stars--;\n }\n}", "function stars() {\n starsNumber = 3;\n if (moves >= 10 && moves < 18) {\n thirdStar.classList.remove('fa-star', 'starColor');\n thirdStar.classList.add('fa-star-o');\n starsNumber = 2;\n } else if (moves >= 18) {\n secondStar.classList.remove('fa-star', 'starColor');\n secondStar.classList.add('fa-star-o');\n starsNumber = 1;\n }\n}", "function handleStarRating(){\n\t// setting the rates based on moves\n if (numberOfMoves > 30){\n stars[1].style.visibility = \"collapse\";\n } else if (numberOfMoves > 25){\n stars[2].style.visibility = \"collapse\";\n } else if (numberOfMoves > 20){\n stars[3].style.visibility = \"collapse\";\n } else if (numberOfMoves > 16){\n stars[4].style.visibility = \"collapse\";\n }\n}", "function starRating() {\n if((score > 9) && (score <= 16)) {\n star3.style.visibility = 'hidden';\n starTally = 2;\n }\n if((score >16) && (score <=28)) {\n star3.style.visibility = 'hidden';\n star2.style.visibility = 'hidden';\n tarTally = 1;\n }\n if(score >28) {\n star3.style.visibility = 'hidden';\n star2.style.visibility = 'hidden';\n star1.style.visibility = 'hidden';\n starTally = 0;\n }\n}", "function manageStars(noOfMoves) {\n if (noOfMoves > 16 && noOfMoves <= 32) {\n let fifthStar = document.getElementsByClassName('stars')[0]\n .getElementsByTagName('li')[4];\n if (fifthStar != null)\n fifthStar.remove();\n }\n if (noOfMoves > 32 && noOfMoves <= 48) {\n let fourthStar = document.getElementsByClassName('stars')[0]\n .getElementsByTagName('li')[3];\n if (fourthStar != null)\n fourthStar.remove();\n }\n if (noOfMoves > 48 && noOfMoves <= 64) {\n let thirdStar = document.getElementsByClassName('stars')[0]\n .getElementsByTagName('li')[2];\n if (thirdStar != null)\n thirdStar.remove();\n }\n if (noOfMoves > 64 && noOfMoves <= 80) {\n let secondStar = document.getElementsByClassName('stars')[0]\n .getElementsByTagName('li')[1];\n if (secondStar != null)\n secondStar.remove();\n }\n if (noOfMoves > 80) {\n let firstStar = document.getElementsByClassName('stars')[0]\n .getElementsByTagName('li')[0];\n if (firstStar != null)\n firstStar.remove();\n }\n}", "function setRating() {\r\n // Assigning Stars according to number of moves\r\n if (moves <= 12) {\r\n var stars = '<i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star\" aria-hidden=\"true\"></i>';\r\n } else if (moves <= 14) {\r\n var stars = '<i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-half-o\" aria-hidden=\"true\"></i>';\r\n } else if (moves <= 16) {\r\n var stars = '<i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-o\" aria-hidden=\"true\"></i>';\r\n } else if (moves <= 18) {\r\n var stars = '<i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-half-o\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-o\" aria-hidden=\"true\"></i>';\r\n } else if (moves <= 20) {\r\n var stars = '<i class=\"fa fa-star\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-o\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-o\" aria-hidden=\"true\"></i>';\r\n } else {\r\n var stars = '<i class=\"fa fa-star-half-o\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-o\" aria-hidden=\"true\"></i> <i class=\"fa fa-star-o\" aria-hidden=\"true\"></i>';\r\n }\r\n // Appending Stars\r\n $('.starsB').html(stars);\r\n }", "function starRatings() {\n if (moves === 12) {\n const star1 = stars.firstElementChild;\n stars.removeChild(star1);\n result = stars.innerHTML;\n } else if (moves === 16) {\n const star2 = stars.firstElementChild;\n stars.removeChild(star2);\n result = stars.innerHTML;\n }\n}", "function starScore () {\n if (moves >= 12) {\n stars[3].setAttribute('style', 'visibility: hidden');\n finalStarScore = 3;\n } \n if (moves >= 18) {\n stars[2].setAttribute('style', 'visibility: hidden');\n finalStarScore = 2;\n }\n if (moves >= 25) {\n stars[1].setAttribute('style', 'visibility: hidden');\n finalStarScore = 1;\n }\n}", "function rating(){\n //// TODO: Bug has been fixed\n if (!cardCouple[0].classList.contains('match') && !cardCouple[1].classList.contains('match')){\n moves.innerText++;\n }\n if (moves.innerText > 14){\n document.querySelector('.stars li:nth-child(1)').classList.add('starDown');\n }\n else if (moves.innerText > 20){\n document.querySelector('.stars li:nth-child(2)').classList.add('starDown');\n }\n}", "function updateScore() {\n $('.moves').text(movesCounter);\n if (movesCounter > 10 && movesCounter <= 15 ) {\n $('#thirdStar').removeClass('fa fa-star');\n $('#thirdStar').addClass('fa fa-star-o');\n starsCounter = 2;\n }\n else if (movesCounter > 15) {\n $('#secondStar').removeClass('fa fa-star');\n $('#secondStar').addClass('fa fa-star-o');\n starsCounter = 1;\n }\n // you should have at least 1 star\n}", "function updateStarCount()\n\t{\n\t\tif ( previousCard == null )\n\t\t{\n\t\t\tif ( movesCounter == 20 || movesCounter == 30 )\n\t\t\t{\n\t\t\t\t$('ul.stars li').first().remove();\n\t\t\t}\n\t\t}\t\t\t\t\n\t}", "function starRating() {\n var starsTracker = starsPanel.getElementsByTagName('i');\n\n // If game finished in 11 moves or less, return and star rating remains at 3\n if (moves <= 11) {\n return;\n // If finished between 11 to 16 moves, 3rd colored star is replaced with empty star class\n } else if (moves > 11 && moves <= 16) {\n starsTracker.item(2).className = 'fa fa-star-o';\n // If finished with more than 16 moves, 2nd colored star is replaced with empty star class\n } else {\n starsTracker.item(1).className = 'fa fa-star-o';\n }\n\n // Update stars variable by counting length of remaining colored star elements\n stars = document.querySelectorAll('.fa-star').length;\n}", "function updateStars() {\n if (moves > 10 && moves < 20) {\n starsList[4].setAttribute('class', 'fa fa-star-o');\n stars = 4;\n }\n if (moves >= 20 && moves < 30) {\n starsList[3].setAttribute('class', 'fa fa-star-o');\n stars = 3;\n }\n if (moves >= 30 && moves < 40) {\n starsList[2].setAttribute('class', 'fa fa-star-o');\n stars = 2;\n }\n if (moves >= 40) {\n starsList[1].setAttribute('class', 'fa fa-star-o');\n stars = 1;\n }\n }", "function rateTheStars(moves){\n if (moves > 24) {\n console.log(\"1 star\");\n starRating = 1;\n } else if (moves > 20) {\n console.log(\"2 stars\");\n starRating = 2;\n } else if (moves > 16){\n console.log(\"3 stars\");\n starRating = 3;\n } else if (moves > 12){\n console.log(\"4 stars\");\n starRating = 4;\n } else {\n starRating=5;\n }\n starColors(starRating);\n }", "function starRating() {\n let lastStar;\n let lastModalStar;\n const deckStars = document.querySelectorAll('.stars .fa-star')\n const modalStars = document.querySelectorAll('.winStars .fa-star')\n if (moves === 33) {\n lastStar = deckStars[2];\n lastModalStar = modalStars[2];\n } else if (moves === 45) {\n lastStar = deckStars[1];\n lastModalStar = modalStars[1];\n } else if (moves === 52) {\n lastStar = deckStars[0];\n lastModalStar = modalStars[0];\n }\n if (lastStar !== undefined) {\n lastStar.classList.replace('fa-star', 'fa-star-o');\n lastModalStar.classList.replace('fa-star', 'fa-star-o');\n }\n}", "function scoreStar() {\n if (moveCounter === 18) {\n stars1 = 2 // 2 estrelas\n $('.fa-star').remove()\n $('.stars').append('<li><i class=\"fa fa-star\"></i></li>')\n $('.stars').append('<li><i class=\"fa fa-star\"></i></li>')\n } else if (moveCounter === 22) {\n stars1 = 1 // 1 estrela\n $('.fa-star').remove()\n $('.stars').append('<li><i class=\"fa fa-star\"></i></li>')\n } else if (moveCounter === 29) {\n stars1 = 0 // 0 estrelas\n $('.fa-star').remove()\n }\n return\n}", "function setRating() {\n // make sure rating doesn't go below 1 star\n if (mismatches > 7) return;\n\n // decrease rating every 3 mismatches\n if ( (mismatches % 3) === 0 ) {\n rating--;\n ratingLabel.removeChild(ratingLabel.lastElementChild);\n }\n}", "function updateMoves() {\n if (moves === 1) {\n $(\"#movesText\").text(\" Move\");\n } else {\n $(\"#movesText\").text(\" Moves\");\n }\n $(\"#moves\").text(moves.toString());\n\n if (moves > 0 && moves < 16) { // gives star rating according the no of moves ,removes the class\n starRating = starRating;\n } else if (moves >= 16 && moves <= 20) {\n $(\"#starOne\").removeClass(\"fa-star\");\n starRating = \"2\";\n } else if (moves > 20) {\n $(\"#starTwo\").removeClass(\"fa-star\");\n starRating = \"1\";\n }\n}", "function updateStars() {\n // if moves <=12 with 3 starts\n if (moves <= 12) {\n $('.stars .fa').addClass(\"fa-star\");\n stars = 3;\n } else if(moves >= 13 && moves <= 14){\n $('.stars li:last-child .fa').removeClass(\"fa-star\");\n $('.stars li:last-child .fa').addClass(\"fa-star-o\");\n stars = 2;\n } else if (moves >= 15 && moves <20){\n $('.stars li:nth-child(2) .fa').removeClass(\"fa-star\");\n $('.stars li:nth-child(2) .fa').addClass(\"fa-star-o\");\n stars = 1;\n } else if (moves >=20){\n $('.stars li .fa').removeClass(\"fa-star\");\n $('.stars li .fa').addClass(\"fa-star-o\");\n stars = 0;\n }\n $('.win-container .stars-number').text(stars);\n\n}", "function updateMoves() {\n moves += 1;\n const move = document.querySelector(\".moves\");\n move.innerHTML = moves;\n if (moves === 16) {\n removeStar();\n starRating = 2;\n } else if (moves === 25) {\n removeStar();\n starRating = 1;\n }\n}", "function checkMovesNumber() {\n const STAR_1 = document.getElementById('star1');\n const STAR_2 = document.getElementById('star2');\n const STAR_3 = document.getElementById('star3');\n if (movesNumber > 14 && movesNumber <= 18) {\n starRating = 2.5;\n STAR_3.classList.remove('fa-star');\n STAR_3.classList.add('fa-star-half-o');\n } else if (movesNumber > 18 && movesNumber <= 22) {\n starRating = 2;\n STAR_3.classList.remove('fa-star-half-o');\n STAR_3.classList.add('fa-star-o');\n } else if (movesNumber > 22 && movesNumber <= 26) {\n starRating = 1.5;\n STAR_2.classList.remove('fa-star');\n STAR_2.classList.add('fa-star-half-o');\n } else if (movesNumber > 26 && movesNumber <= 30) {\n starRating = 1;\n STAR_2.classList.remove('fa-star-half-o');\n STAR_2.classList.add('fa-star-o');\n } else if (movesNumber > 30 && movesNumber <= 34) {\n starRating = 0.5;\n STAR_1.classList.remove('fa-star');\n STAR_1.classList.add('fa-star-half-o');\n } else if (movesNumber > 34) {\n starRating = 0;\n STAR_1.classList.remove('fa-star-half-o');\n STAR_1.classList.add('fa-star-o');\n alert('Game over! Du hattest zu viele Züge! Versuche es erneut!\\nAnzahl Züge: ' + movesNumber + '\\nVergangene Zeit: ' + sec + ' Sekunden' + '\\nDeine Bewertung: ' + starRating + ' Sterne');\n clearInterval(timer);\n } else {\n return;\n }\n}", "function rating(){\n if (moves.innerHTML > 7 && moves.innerHTML <= 10){\n uls[0].children[0].firstChild.className = \"fa fa-star-o\";\n } else if ( moves.innerHTML > 10 && moves.innerHTML <=20) {\n uls[0].children[1].firstChild.className = \"fa fa-star-o\";\n }\n else {\n checLose();\n }\n }", "function removeStars() {\n moves.innerHTML++;\n if (moves.innerHTML == 15) {\n starsChildren[2].firstElementChild.className = 'fa fa-star-o';\n userStars.innerHTML--;\n }\n if (moves.innerHTML == 20) {\n starsChildren[1].firstElementChild.className = 'fa fa-star-o';\n userStars.innerHTML--;\n }\n}", "function updateStarCounter() {\n\t// when moves counter reaches 20, one star is removed\n\tif (Number(movesMade.innerText) === 20) {\n\t\tlet star = document.querySelector('#star-one').classList.add('none');\n\t}\n\t// when moves counter reaches 29, two stars are removed\n\tif (Number(movesMade.innerText) === 29) {\n\t\tlet star = document.querySelector('#star-two').classList.add('none');\n\t}\n\t//when moves counter is zero, all stars should be shown\n\tif (Number(movesMade.innerText) === 0) {\n\t\tdocument.querySelector('#star-one').classList.remove('none');\n\t\tdocument.querySelector('#star-two').classList.remove('none');\n\t\tdocument.querySelector('#star-three').classList.remove('none');\n\t}\n}", "function starCounter(moves) {\r\n if (moves >= 20 && moves <= 30) {\r\n // stars.innerHTML.remove();\r\n stars.innerHTML = star.repeat(4);\r\n } else if (moves >= 31 && moves <= 40) {\r\n // stars.innerHTML.remove();\r\n stars.innerHTML = star.repeat(3);\r\n } else if (moves >= 41 && moves <= 50) {\r\n // stars.innerHTML.remove();\r\n stars.innerHTML = star.repeat(2);\r\n } else if (moves >= 51) {\r\n // stars.innerHTML.remove();\r\n stars.innerHTML = star.repeat(1);\r\n } else {\r\n // stars.innerHTML.remove();\r\n stars.innerHTML = star.repeat(5);\r\n\r\n }\r\n}", "function ratePlayer() {\n let starsChilds = stars.children('li');\n let starsClasses = 'fa-star fa-star-o';\n let rateNumber = moves === 16 ? 2 : moves === 20 ? 1 : null;\n $(starsChilds[rateNumber]).children('i').toggleClass(starsClasses);\n}", "function rating (){\n let stars = document.querySelector('.stars');\n let movesNumber = movesContainer.textContent;\n if((movesNumber == 16 && stars.firstChild) || (movesNumber == 24 && stars.firstChild)){\n stars.removeChild(stars.firstChild);\n } \n}", "function countStars() {\n\n if (moves <= 20) {\n stars = 3;\n } else if (moves <= 25) {\n stars = 2;\n } else {\n stars = 1;\n }\n\n displayStars();\n}", "function Rating(myMoves){\r\n let score = 3;\r\n if(myMoves <= 20) {\r\n theStarsRating.eq(3).removeClass(\"fa-star\").addClass(\"fa-star-o\");\r\n score=3;\r\n } else if (myMoves > 20 && myMoves <= 30) {\r\n theStarsRating.eq(2).removeClass(\"fa-star\").addClass(\"fa-star-o\");\r\n score=2;\r\n } else if (myMoves > 30) {\r\n theStarsRating.eq(1).removeClass(\"fa-star\").addClass(\"fa-star-o\");\r\n score=1;\r\n }\r\n return score;\r\n}", "function incMoves() {\n moveCounter += 1;\n moves.innerText = moveCounter;\n //set star score\n if (moveCounter > 12 && moveCounter <= 18) {\n //if player uses more than 18 moves, but less than 24, deduct one star\n for (i = 0; i < starsList.length; i++) {\n if (i > 1) {\n starsList[i].style.visibility = \"collapse\";\n score = starsList.length - 1;\n }\n }\n } else if (moveCounter > 18 && moveCounter <= 24) {\n //if player uses more than 24 moves, but less than 32, deduct another star\n for (i = 0; i < starsList.length; i++) {\n if (i > 0) {\n starsList[i].style.visibility = \"collapse\";\n score = starsList.length - 2;\n }\n }\n }\n}", "function applyRating() {\n for (var i = 0; i < 3; i++) {\n stars[i].style.visibility = (i < rating) ? \"show\" : \"collapse\";\n }\n}", "function starCount() {\n if (moveCountNum === 20 || moveCountNum === 35) {\n removeStar();\n }\n}", "function rating(numOfMistakes) {\n if ((numOfMistakes === 9)||(numOfMistakes === 12)) {\n stars.removeChild(stars.lastChild);\n starCount -= 1;\n }\n }", "function rating() {\n if (totalClicks <= 29) {\n starRating.innerHTML = `\n <li><i class=\"fa fa-star\"></i></li>\n <li><i class=\"fa fa-star\"></i></li>\n <li><i class=\"fa fa-star\"></i></li>`;\n } else if (totalClicks >= 30 && totalClicks <= 39) {\n starRating.innerHTML = `\n <li><i class=\"fa fa-star\"></i></li>\n <li><i class=\"fa fa-star\"></i></li>`;\n } else if (totalClicks >= 40) {\n starRating.innerHTML = `\n <li><i class=\"fa fa-star\"></i></li>`;\n } else {\n starRating.innerHTML = `\n <li><i class=\"fa fa-star\"></i></li>\n <li><i class=\"fa fa-star\"></i></li>\n <li><i class=\"fa fa-star\"></i></li>`;\n }\n }", "function gameRating(count){\n if (count === 29){\n starCount --;\n document.querySelector('.rating.second').className = 'rating second hidden';\n }else if (count === 39){\n starCount --;\n document.querySelector('.rating.first').className = 'rating first hidden';\n }\n}", "function setRating() {\n if ((moves - match) == 3) { //3 moves\n $ratingStars.eq(2).removeClass('fa-star').addClass('fa-star-o');\n rating = 2;\n questionLevel2();\n } else if ((moves - match) == 5) { //5 moves\n $ratingStars.eq(1).removeClass('fa-star').addClass('fa-star-o');\n rating = 1;\n questionLevel2();\n } else if ((moves - match) >= 7) { //7 moves\n $ratingStars.eq(0).removeClass('fa-star').addClass('fa-star-o');\n rating = 0;\n questionLevel2();\n }\n return { score: rating };\n}", "function outputStars(newRating) {\n\tlet intRating = parseInt(newRating)\n\t\n\t$('#rating-stars i').each(function(i) {\n\t\tlet $this = $(this)\n\t\t$this.removeClass('user-rating')\n\t\tif (i < intRating) {\n\t\t\t$this.removeClass('far').addClass('fas')\n\t\t} else {\n\t\t\t$this.removeClass('fas').addClass('far')\n\t\t}\n\t})\n}", "function updateStars() {\n\t{\n\t\t$(\".fa-star\").last().attr(\"class\", \"fa fa-star-o\");\n\t\tif (numStars > 0)\n\t\t{\n\t\t\tnumStars--;\n\t\t}\n\t\t$(\".numStars\").text(numStars);\n\t}\n}", "function setStars() {\n if (movements === 0) {\n totalStars = 3;\n let fStar = document.querySelector(\"#firstStar\");\n fStar.remove();\n let starsUl = document.querySelector(\".stars\");\n let newStar = document.createElement(\"li\");\n newStar.className = \"fa fa-star\";\n newStar.id=\"firstStar\";\n starsUl.appendChild(newStar);\n let sStar = document.querySelector(\"#secondStar\");\n sStar.remove();\n let starsUl2 = document.querySelector(\".stars\");\n let newStar2 = document.createElement(\"li\");\n newStar2.className = \"fa fa-star\";\n newStar2.id=\"secondStar\";\n starsUl.appendChild(newStar2);\n let tStar = document.querySelector(\"#thirdStar\");\n tStar.remove();\n let starsUl3 = document.querySelector(\".stars\");\n let newStar3 = document.createElement(\"li\");\n newStar3.className = \"fa fa-star\";\n newStar3.id=\"thirdStar\";\n starsUl.appendChild(newStar3);}\n else if (movements === 14) {\n totalStars = 2;\n let fStar = document.querySelector(\"#firstStar\");\n fStar.remove();\n let starsUl = document.querySelector(\".stars\");\n let newStar = document.createElement(\"li\");\n newStar.className = \"fa fa-star-o\";\n newStar.id=\"firstStar\";\n starsUl.appendChild(newStar);\n } else if (movements === 21) {\n totalStars = 1;\n let fStar = document.querySelector(\"#secondStar\");\n fStar.remove();\n let starsUl = document.querySelector(\".stars\");\n let newStar = document.createElement(\"li\");\n newStar.className = \"fa fa-star-o\";\n newStar.id=\"secondStar\";\n starsUl.appendChild(newStar);\n } else if (movements === 24) {\n totalStars = 0;\n let fStar = document.querySelector(\"#thirdStar\");\n fStar.remove();\n let starsUl = document.querySelector(\".stars\");\n let newStar = document.createElement(\"li\");\n newStar.className = \"fa fa-star-o\";\n newStar.id=\"thirdStar\";\n starsUl.appendChild(newStar);\n }\n}", "function starRating() {\n if(moveCounter <= 25) {\n starsList[0].style.display = 'inline-block';\n starsList[1].style.display = 'inline-block';\n starsList[2].style.display = 'inline-block';\n moves.style.color = \"green\";\n }\n else if(moveCounter > 25 && moveCounter <=65) {\n starsList[0].style.display = 'inline-block';\n starsList[1].style.display = 'inline-block';\n starsList[2].style.display = 'none';\n moves.style.color = \"orange\";\n }\n else if(moveCounter > 65) {\n starsList[0].style.display = 'inline-block';\n starsList[1].style.display = 'none';\n starsList[2].style.display = 'none';\n moves.style.color = \"red\";\n }\n}", "function rating(moves) {\n let rating = 3;\n if (moves > stars3 && moves < stars2) {\n $rating.eq(3).removeClass('fa-star').addClass('fa-star-o');\n } else if (moves > stars2 && moves < star1) {\n $rating.eq(2).removeClass('fa-star').addClass('fa-star-o');\n } else if (moves > star1) {\n $rating.eq(1).removeClass('fa-star').addClass('fa-star-o');\n rating = 1;\n }\n return { score: rating };\n}", "function starRating(moves) {\n if (moves >= 12 && moves < 18) {\n starCount.childNodes[5].childNodes[0].className = 'fa fa-star-o';\n } else if (moves >= 18) {\n starCount.childNodes[3].childNodes[0].className = 'fa fa-star-o';\n }\n return starCount;\n}", "function updateStarsDisplay(counter){\n let stars = document.getElementsByClassName(\"fa-star\");\n\n // for every 16 moves (or number of cards), remove a star\n if (counter > 0 && stars.length > 0){\n let penaltyLimit = cards.length + 1; \n let z = counter % penaltyLimit;\n if (z == 0){\n stars[0].classList.add(\"fa-star-o\");\n stars[0].classList.remove(\"fa-star\");\n }\n }\n return stars.length;\n}", "function updateStarRating(moves) {\n\tswitch (moves) {\n\t\tcase 10:\n\t\t\tstarRatingElements[2].classList.add('star--disabled');\n\t\t\tstarCount = 2;\n\t\tbreak;\n\t\tcase 15:\n\t\t\tstarRatingElements[1].classList.add('star--disabled');\n\t\t\tstarCount = 1;\n\t\tbreak;\n\t}\n}", "function resetStarRating() {\n stars[1].classList.remove(\"fa-star-o\");\n stars[1].classList.add(\"fa-star\");\n stars[2].classList.remove(\"fa-star-o\");\n stars[2].classList.add(\"fa-star\");\n rating = 3;\n}", "function placeStars(x) {\n if (x < 4){\n $('.star-rate').html(3);\n }\n if (x === 5) {\n $('.star-3').removeClass('fa-star').addClass('fa-star-o');\n $('.star-rate').html(2);\n }\n if (x === 9) {\n $('.star-2').removeClass('fa-star').addClass('fa-star-o');\n $('.star-rate').html(1);\n\n }\n if (x === 13) {\n $('.star-1').removeClass('fa-star').addClass('fa-star-o');\n $('.star-rate').html(0);\n }\n}", "function resetRating() {\n mismatches = 0;\n rating = 3;\n ratingLabel.innerHTML = \"\";\n for (let i = 3; i > 0; i--) {\n const i = document.createElement('i');\n i.classList.add('fa', 'fa-star');\n ratingLabel.appendChild(i);\n }\n}", "function scoreRating(moves){\n var excellent = 14;\n var average = 20;\n var bad = 24;\n if (moves > excellent && moves < average){\n document.getElementById(\"3star\").className = \"fa fa-o\";\n } else if (moves > average && moves < bad) {\n document.getElementById(\"2star\").className = \"fa fa-o\";\n }\n}", "function moveCounter() {\n moveCount ++;\n moves.textContent = moveCount;\n // star Rating:\n let starRating = document.getElementsByClassName(\"stars\")[0];\n if (moveCount > 20) {\n starRating.innerHTML = \"<li><i class=\\\"fa fa-star\\\"></i></li> <li><i class=\\\"fa fa-star\\\"></i></li>\";\n } else if (moveCount > 30) {\n starRating.innerHTML = \"<li><i class=\\\"fa fa-star\\\"></i></li>\";\n }\n}", "function showStars() {\n let count;\n if (moveCount < 16) {\n count = 3;\n score = 60;\n } else if (moveCount < 32) {\n count = 2;\n score = 40;\n } else {\n count = 1;\n score = 10;\n }\n for (let i = 0; i < (stars.length - count); i++) {\n stars[i].setAttribute('style', 'display: none');\n }\n}", "function starRating(){\r\n \r\n for (let i=0; i<starsContainer.length; i++){\r\n\r\n \r\n \r\n\r\n\r\n if (moves>= 0 && moves<=13){\r\n starsContainer[i].innerHTML=\r\n `<li><i class=\"fa fa-star\"></i></li>\r\n <li><i class=\"fa fa-star\"></i></li>\r\n <li><i class=\"fa fa-star\"></i></li>`;\r\n\r\n }\r\n \r\n else if (moves>13 && moves <= 17){\r\n starsContainer[i].innerHTML=\r\n `<li><i class=\"fa fa-star\"></i></li>\r\n <li><i class=\"fa fa-star\"></i></li>`;\r\n }\r\n else if (moves>16 && moves <= 21){\r\n starsContainer[i].innerHTML=\r\n `<li><i class=\"fa fa-star\"></i></li>`;\r\n }else {\r\n starsContainer[i].innerHTML=\"\";\r\n }\r\n}\r\nif (moves===1 ){\r\n \r\n startTimer();\r\n }\r\n \r\n}", "function decrementStars() {\n $(\".stars i.fa-star\").first()\n .removeClass(\"fa-star\")\n .addClass(\"fa-star-o\");\n stars -= 1;\n }", "function rating(moves) {\n // \n let rating = 3;\n\n // Scoring system from 1 to 3 stars\n let stars3 = 10,\n stars2 = 16,\n star1 = 20;\n\n if (moves > stars3 && moves < stars2) {\n $stars.eq(3).removeClass('fa-star').addClass('fa-star-o');\n } else if (moves > stars2 && moves < star1) {\n $stars.eq(2).removeClass('fa-star').addClass('fa-star-o');\n } else if (moves > star1) {\n $stars.eq(1).removeClass('fa-star').addClass('fa-star-o');\n rating = 1;\n }\n return {\n score: rating\n };\n}", "function movieScore(rating) {\r\n // Trasformazione punteggio a 5 punti\r\n var ratingTrasformato = rating / 2;\r\n\r\n var vote = Math.round(ratingTrasformato);\r\n\r\n var stars = '';\r\n for (var i = 1; i <= 5; i++) {\r\n if (i <= vote) {\r\n stars += '<i class=\"fas fa-star\"></i>';\r\n } else {\r\n stars += '<i class=\"far fa-star\"></i>';\r\n }\r\n }\r\n return stars;\r\n}", "function starCount() {\n\n if(numMoves < 16) {\n numStars = 3;\n }else if (numMoves >= 16 && numMoves < 25) {\n numStars = 2;\n }else {\n numStars = 1;\n };\n\n printStars();\n}", "function removeStar() {\n if (moves <= 15) {\n starNum = 3;\n }\n if (moves > 15) {\n document.querySelector('.three').innerHTML = '<i></i>';\n starNum = 2;\n };\n if (moves > 30) {\n document.querySelector('.two').innerHTML = '<i></i>';\n starNum = 1;\n };\n}", "function starCount() {\r\n if (moveCounter === 15) { // when the move counter reaches 10 remove the star\r\n document.querySelector('.fa-star:last-of-type').classList.remove('fa-star');\r\n console.log('drop one star');\r\n } else if (moveCounter === 30) {\r\n document.querySelector('.fa-star:last-of-type').classList.remove('fa-star');\r\n console.log('drop second star');\r\n }\r\n}", "function starCount() {\n let stars = document.querySelectorAll('.stars li i');\n\n switch (true) {\n case ( cardMoves >= 24):\n stars[2].classList.add('hide');\n starCounter = 0;\n break;\n case (cardMoves >= 18):\n stars[1].classList.add('hide');\n starCounter = 1;\n break;\n case (cardMoves >= 9):\n stars[0].classList.add('hide');\n starCounter = 2;\n break;\n default:\n starCounter = 3;\n }\n }", "function displayStarRating() {\n const userRating = document.querySelector(\".total-rating\").textContent;\n if (userRating < 10) {\n addProfileStars(1)\n }\n else if (userRating >= 10 && userRating <= 100) {\n addProfileStars(2);\n }\n else if (userRating > 100 && userRating <= 200) {\n addProfileStars(3);\n }\n else if (userRating > 200 && userRating <= 500) {\n addProfileStars(4);\n }\n else {\n addProfileStars(5);\n }\n}", "function countMoves() {\n move++;\n moves.innerHTML = move;\n\n //Removes stars after a number of moves\n if (move > 15 && move < 20) {\n for (let i = 0; i < 3; i++) {\n if (i > 1) {\n stars[i].style.visibility = \"collapse\";\n }\n }\n } else if (move > 20) {\n for (let i = 0; i < 3; i++) {\n if (i > 0) {\n stars[i].style.visibility = \"collapse\";\n }\n }\n }\n}", "function reduceMoves () {\n moves--;\n $('.moves').text(moves);\n if (moves === 6 || moves === 3) {\n $('.stars').find('li:last').remove();\n }\n}", "function setStars() {\r\nlet starsDOM = document.querySelector('.stars');\r\n if (moveCounter == 0) {\r\n starsDOM.innerHTML = `<li><i class=\"fa fa-star\"></i></li>\r\n <li><i class=\"fa fa-star\"></i></li>\r\n <li><i class=\"fa fa-star\"></i></li>`;\r\n starCounter = 3;\r\n } else if (moveCounter == 14) {\r\n starsDOM.innerHTML = `<li><i class=\"fa fa-star\"></i></li>\r\n <li><i class=\"fa fa-star\"></i></li>`;\r\n starCounter = 2;\r\n } else if (moveCounter == 22) {\r\n starsDOM.innerHTML = `<li><i class=\"fa fa-star\"></i></li>`;\r\n starCounter = 1;\r\n } else if (moveCounter == 30) {\r\n starsDOM.innerHTML = ``;\r\n starCounter = 0;\r\n }\r\n}", "function countStars() {\n if (moves <= 30) { //star count will be initial value of 3 stars\n document.getElementById(\"oneStar\").style.visibility = 'visible'; //star is visible//\n document.getElementById(\"twoStar\").style.visibility = 'visible'; //star is visible//\n document.getElementById(\"threeStar\").style.visibility = 'visible'; //star is visible//\n document.getElementById(\"oneStar\").style.color = 'green'; //star colour is green//\n document.getElementById(\"twoStar\").style.color = 'green'; //star colour is green//\n document.getElementById(\"threeStar\").style.color = 'green'; //star colour is green//\n } else if (moves > 30 && moves < 50) {\n document.getElementById(\"threeStar\").style.visibility = 'hidden'; //star is hidden\n document.getElementById(\"oneStar\").style.color = 'yellow'; //star colour is yellow//\n document.getElementById(\"twoStar\").style.color = 'yellow'; //star colour is yellow//\n stars = 2; //star count will be 2 stars//\n } else if (moves > 50) {\n document.getElementById(\"twoStar\").style.visibility = 'hidden'; //star is hidden\n document.getElementById(\"threeStar\").style.visibility = 'hidden'; //star is hidden\n document.getElementById(\"oneStar\").style.color = 'red'; //star colour is red//\n stars = 1; //star count will be 1 star//\n }\n }", "function removeStar() {\n if (remainingStars >= 2) {\n remainingStars -=1;\n stars.removeChild(stars.firstElementChild);\n }\n}", "function calculateRemainingStars() {\n if (state.totalMoves >= 0 && state.totalMoves < 15) {\n return 3;\n }\n \n if (state.totalMoves >= 15 && state.totalMoves < 25) {\n return 2;\n }\n \n if (state.totalMoves >= 25) {\n return 1;\n }\n \n throw 'Unable to calculate remaining stars';\n }", "function starSetter() {\n // moves less than or equal 9 -> 3 stars\n // moves between 10 and 15 -> 2.5 stars\n if (moves >= 10 && moves <= 15) {\n starsList[2].className = halfStar;\n stars = 2.5;\n }\n // moves between 16 and 20 -> 2 stars\n else if (moves >= 16 && moves <= 20) {\n starsList[2].className = emptyStar;\n stars = 2;\n }\n // moves between 21 and 24 -> 1.5 stars\n else if (moves >= 21 && moves <= 24) {\n starsList[1].className = halfStar;\n stars = 1.5;\n }\n // moves between 25 and 28 -> 1 star\n else if (moves >= 25 && moves <= 28) {\n starsList[1].className = emptyStar;\n stars = 1;\n }\n // moves between 29 and more -> 0.5 stars\n else if (moves >= 29) {\n starsList[0].className = halfStar;\n stars = 0.5;\n }\n}", "function fillStarsTill(starNo){\n\tclearAllStars();\n\t\n\tif(starNo == 1){\n\t\tdocument.getElementById(\"1\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"1\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"starRating\").value = \"1\";\n\t}\n\t\n\tif(starNo == 2){\n\t\tdocument.getElementById(\"1\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"1\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"2\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"2\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"starRating\").value = \"2\";\n\t}\n\t\n\tif(starNo == 3){\n\t\tdocument.getElementById(\"1\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"1\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"2\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"2\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"3\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"3\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"starRating\").value = \"3\";\n\t}\n\t\n\tif(starNo == 4){\n\t\tdocument.getElementById(\"1\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"1\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"2\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"2\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"3\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"3\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"4\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"4\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"starRating\").value = \"4\";\n\t}\n\t\n\tif(starNo == 5){\n\t\tdocument.getElementById(\"1\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"1\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"2\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"2\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"3\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"3\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"4\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"4\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"5\").className = \"glyphicon glyphicon-star\";\n\t\tdocument.getElementById(\"5\").style.color = \"yellow\";\n\t\t\n\t\tdocument.getElementById(\"starRating\").value = \"5\";\n\t}\n}", "function addAMove(){\n moves++;\n moveCounter.innerHTML = moves;\n //game displays a star rating from 1 to at least 3 stars - after some number of moves, star rating lowers\n if (moves > 8 && moves < 12) {\n numStars = 4;\n stars.innerHTML = `<li class=\"star\"><i class=\"fa fa-star\"></i></li><li class=\"star\"><i class=\"fa fa-star\"></i></li><li class=\"star\"><i class=\"fa fa-star\"></i></li><li class=\"star\"><i class=\"fa fa-star\"></i></li>`;\n }\n if (moves >= 12 && moves < 20) {\n numStars = 3;\n stars.innerHTML = `<li class=\"star\"><i class=\"fa fa-star\"></i></li><li class=\"star\"><i class=\"fa fa-star\"></i></li><li class=\"star\"><i class=\"fa fa-star\"></i></li>`;\n }\n if (moves >= 20 && moves < 30) {\n numStars = 2;\n stars.innerHTML = `<li class=\"star\"><i class=\"fa fa-star\"></i></li><li class=\"star\"><i class=\"fa fa-star\"></i></li>`;\n }\n if (moves > 30) {\n numStars = 1;\n stars.innerHTML = `<li class=\"star\"><i class=\"fa fa-star\"></i></li>`;\n }\n}", "function starRemoval(){\n\tstars = document.querySelectorAll('.fa-star');\n\tstarCount = countMoves;\n\tswitch (starCount) {\n\t\tcase 10:\n\t\t\tstars[stars.length-1].className='fa fa-star-o';\n\t\t\tbreak;\n\t\tcase 13:\n\t\t\tstars[stars.length-1].className='fa fa-star-o';\n\t\t\tbreak;\n\t\tcase 16:\n\t\t\tstars[stars.length-1].className='fa fa-star-o';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}", "function stars() {\n const starSelector = document.querySelector('.stars');\n switch (true) {\n case (moveCounter >= 15):\n starSelector.children[1].firstElementChild.setAttribute('class', 'fa fa-star-o');\n break;\n case (moveCounter >= 9):\n starSelector.children[2].firstElementChild.setAttribute('class', 'fa fa-star-o');\n break;\n default:\n starSelector.children[0].firstElementChild.setAttribute('class', 'fa fa-star');\n starSelector.children[1].firstElementChild.setAttribute('class', 'fa fa-star');\n starSelector.children[2].firstElementChild.setAttribute('class', 'fa fa-star');\n }\n}", "function UpdateMoves() {\n\n $(\"#moves\").text(moves.toString());\n // Update star's number\n if (moves >= 0 && moves <= 8) {\n starNumber = '3';\n // Remove 1st Star\n } else if (moves >= 9 && moves <= 18) {\n $(\"#starOne\").removeClass(\"fa-star\");\n starNumber = '2';\n // Remove 2nd Star \n } else if (moves >= 19 && moves <= 25) {\n $(\"#starTwo\").removeClass(\"fa-star\");\n starNumber = '1';\n }\n}", "function updateStars(){\n if (incorrectGuesses === 10) {\n $('#star-10').attr('src','images/black-star.png');\n startingStars -= 1;\n }\n else if (incorrectGuesses === 20) {\n $('#star-20').attr('src','images/black-star.png');\n startingStars -= 1;\n }\n else if (incorrectGuesses === 30) {\n $('#star-30').attr('src','images/black-star.png');\n startingStars -= 1;\n }\n}", "function setRating(moves) {\n var rating = 3;\n if (moves > rank3stars && moves < rank2stars) {\n $starsCount.eq(2).removeClass('fa-star').addClass('fa-star-o');\n rating = 2;\n } else if (moves > rank2stars && moves < rank1stars) {\n $starsCount.eq(1).removeClass('fa-star').addClass('fa-star-o');\n rating = 1;\n } else if (moves >= rank1stars) {\n rating = 1;\n }\n return {\n score: rating\n };\n}", "function starsEarned() {\n if (moves > 8 && moves < 12) {\n for (i = 0; i < 3; i++) {\n if (i > 1) {\n stars[i].style.visibility = \"hidden\";\n }\n }\n } else if (moves > 13) {\n for (i = 0; i < 3; i++) {\n if (i > 0) {\n stars[i].style.visibility = \"hidden\";\n }\n }\n }\n}", "function stars() {\n\tconst starar = star.getElementsByTagName('i');\n\tfor (i = 0; i < starar.length; i++) {\n\t\tif (moves > 14 && moves <= 19) {\n\t\t\tstarar[2].className = 'fa fa-star-o';\n\t\t\tstarnum = 2;\n\t\t} else if (moves > 19) {\n\t\t\tstarar[1].className = 'fa fa-star-o';\n\t\t\tstarnum = 1;\n//\t\t} else if (moves > 24) {\n//\t\t\tstarar[0].className = 'fa fa-star-o';\n//\t\t\tstarnum = 0;\n\t\t} else {\n\t\t\tstarar[0].className = 'fa fa-star';\n\t\t\tstarar[1].className = 'fa fa-star';\n\t\t\tstarar[2].className = 'fa fa-star';\n\t\t\tstarnum = 3;\n\t\t}\n\t}\n}", "function howManyStars() {\n\tif (Number(movesMade.innerText) < 20) {\n\t\treturn \"3 stars\";\n\t}\n\tif (Number(movesMade.innerText) > 19 && Number(movesMade.innerText) < 29) {\n\t\treturn \"2 stars\";\n\t}\n\tif (Number(movesMade.innerText) > 28) {\n\t\treturn \"1 star\";\n\t}\n}", "function removeStar() {\n const stars = Array.from(document.querySelectorAll('.fa-star'));\n if (moves === 12 || moves === 15 || moves === 18) {\n for (star of stars){\n if (star.style.display !== 'none'){\n star.style.display = 'none';\n numberOfStarts--;\n break;\n }\n }\n }\n}", "function setStars(numStars){\n let count = 0;\n let indexRating = global.ratingPara.indexOf(\":\") + 2;\n let ratingNum = parseFloat(global.ratingPara.slice(indexRating));\n\n for (let i=0; i < numStars; i++){\n let star = document.createElement(\"span\");\n\n // sets constants representing the minimum and maximum ratings\n const FIVE_STARS = 5;\n const ZERO_STARS = 0;\n\n if(ratingNum == FIVE_STARS){\n star.textContent = \"\\u2605\";\n }\n else if (ratingNum == ZERO_STARS){\n star.textContent = \"\\u2606\";\n }\n else{\n // ensures that ratings with decimals do not count as an extra star. Ex: Rating 2.9 --> 2 stars.\n let difference = ratingNum - count;\n if (count <= ratingNum && difference >= 1){\n star.textContent = \"\\u2605\";\n count++;\n }\n else{\n star.textContent = \"\\u2606\";\n }\n }\n displayStars(star);\n }\n}", "function displayMovesAndRating() {\n\tmoves = 0; rating = 3;\n\tmoveElement.innerText = `${moves} Move`;\n\n\tratingElement.children[2].classList.remove('fa-star-o');\n\tratingElement.children[2].classList.add('fa-star');\n\n\tratingElement.children[1].classList.remove('fa-star-o');\n\tratingElement.children[1].classList.add('fa-star');\n}", "function starCount() {\n if (moves == 22 || moves == 27 || moves == 32) {\n hideStar();\n }\n}", "function moveCounter() {\n moves++;\n counter.innerHTML = moves;\n textMoves();\n\n /*\n * Check to determine the player's rating after\n * certain number of moves have been exceeded\n */\n if (moves > 12 && moves < 19) {\n starsArray.forEach(function(star, i) {\n if (i > 1) {\n star.style.visibility = 'collapse';\n }\n });\n } else if (moves > 20) {\n starsArray.forEach(function(star, i) {\n if (i > 0) {\n star.style.visibility = 'collapse';\n }\n });\n }\n}", "function movesHandler() {\n movesCounter++;\n if (movesCounter === 1) {\n document.querySelector(\".checker\").innerHTML = \"Move\";\n document.querySelector(\".moves\").innerHTML = movesCounter;\n } else {\n document.querySelector(\".moves\").innerHTML = movesCounter;\n document.querySelector(\".checker\").innerHTML = \"Moves\";\n }\n if (movesCounter > 30 && movesCounter < 32) {\n for (var i = 0; i < 3; i++) {\n if (i > 1) {\n rating[i].style.visibility = \"hidden\";\n }\n }\n numberOfStars = 2;\n } else if (movesCounter > 40) {\n for (var x = 0; x < 3; x++) {\n if (x > 0) {\n rating[x].style.visibility = \"hidden\";\n }\n }\n numberOfStars = 1;\n }\n}", "function updateScore() {\n\t$(\".stars\").empty();\n\tconsole.log(\"error count: \" + errorCount);\n\tconsole.log((maxErrorCount - errorCount) / maxErrorCount);\n\tconsole.log((pairsCount - 1) / pairsCount);\n\tif (gameMode == 1) {\n\t\tif (remainTime / totalTime >= 0.6) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLStar, HTMLStar);\n\t\t} else if (remainTime / totalTime >= 0.5) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLStar, HTMLHalfStar);\n\t\t} else if (remainTime / totalTime >= 0.4) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLStar, HTMLEmptyStar);\n\t\t} else if (remainTime / totalTime >= 0.3) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLHalfStar, HTMLEmptyStar);\n\t\t} else if (remainTime / totalTime >= 0.2) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLEmptyStar, HTMLEmptyStar);\n\t\t} else if (remainTime / totalTime > 0) {\n\t\t\t$(\".stars:last\").append(HTMLHalfStar, HTMLEmptyStar, HTMLEmptyStar);\n\t\t} else {\n\t\t\t$(\".stars:last\").append(HTMLEmptyStar, HTMLEmptyStar, HTMLEmptyStar);\n\t\t}\t\n\t} else {\n\t\t// Normal mode or default rules\n\t\tif (errorCount / maxErrorCount >= (pairsCount - 1) / pairsCount) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLStar, HTMLStar);\n\t\t} else if (errorCount / maxErrorCount >= (pairsCount - 2) / pairsCount) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLStar, HTMLHalfStar);\n\t\t} else if (errorCount / maxErrorCount >= (pairsCount - 3) / pairsCount) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLStar, HTMLEmptyStar);\n\t\t} else if (errorCount / maxErrorCount >= (pairsCount - 4) / pairsCount) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLHalfStar, HTMLEmptyStar);\n\t\t} else if (errorCount / maxErrorCount >= (pairsCount - 5) / pairsCount) {\n\t\t\t$(\".stars:last\").append(HTMLStar, HTMLEmptyStar, HTMLEmptyStar);\n\t\t} else if (errorCount / maxErrorCount >= (pairsCount - 6) / pairsCount) {\n\t\t\t$(\".stars:last\").append(HTMLHalfStar, HTMLEmptyStar, HTMLEmptyStar);\n\t\t} else {\n\t\t\t$(\".stars:last\").append(HTMLEmptyStar, HTMLEmptyStar, HTMLEmptyStar);\n\t\t}\n\t}\n}", "function checkStarRating() {\n\tif (moves < twoStar) {\n\t\treturn ' <i class=\"fa fa-star\"></i> <i class=\"fa fa-star\"></i> <i class=\"fa fa-star\"></i>';\n\t} else if (moves < oneStar) {\n\t\treturn ' <i class=\"fa fa-star\"></i> <i class=\"fa fa-star\"></i>';\n\t} else {\n\t\treturn ' <i class=\"fa fa-star\"></i>';\n\t}\n}", "function starCount() {\n if (moveCount >= starChart4 && moveCount < starChart3) {\n $('.star4').hide();\n starResult = 3;\n\t}\n else if (moveCount >= starChart3 && moveCount < starChart2) {\n $('.star3').hide();\n starResult = 2;\n }\n else if (moveCount >= starChart2) {\n $('.star2').hide();\n starResult = 1;\n }\n}", "function calcRating(score){\n var starimg = document.getElementById(\"rating-img\");\n starimg.style.display = \"block\";\n // divide score into 5 sections (consider a score out of 100 points)\n if(score <= 86){ //1 star\n starimg.src = \"media/Utilities/1star.png\";\n } else if(score <=173) {//2 star\n starimg.src = \"media/Utilities/2stars.png\";\n } else if(score <=260) {//3 star \n starimg.src = \"media/Utilities/3stars.png\";\n } else if(score <=299) {//4 star\n starimg.src = \"media/Utilities/4stars.png\";\n } else {//5 star\n starimg.src = \"media/Utilities/5stars.png\";\n }\n outputstr += \"</br></br>\";\n document.getElementById(\"item-feedback\").innerHTML = outputstr;\n}", "function star(numOfMove){\n\t noMoves = numOfMove; \n\t let stars = document.querySelector(\".stars\");\n\t if(numOfMove>50){\n\t \tnoStar=1;\n stars.innerHTML = `<li><i class=\"fa fa-star\"></i></li>`;\n\t }\n\t else if (numOfMove>30){\n\t \tnoStar=2;\n\t \tstars.innerHTML = `<li><i class=\"fa fa-star\"></i></li><li><i class=\"fa fa-star\"></i></li>`;\n\t }\n\t else{\n\t \tnoStar=3;\n\t\tstars.innerHTML = `<li><i class=\"fa fa-star\"></i></li><li><i class=\"fa fa-star\"></i></li><li><i class=\"fa fa-star\"></i></li>`;\n\t }\n}" ]
[ "0.8504081", "0.8085305", "0.8018432", "0.7990851", "0.7953461", "0.794036", "0.7937681", "0.7900717", "0.78490096", "0.7838171", "0.7827704", "0.7803736", "0.77422833", "0.7721286", "0.76983905", "0.7685585", "0.76812255", "0.7678665", "0.7662117", "0.76504904", "0.7639948", "0.7635131", "0.76127326", "0.7611013", "0.76071537", "0.7574303", "0.7551597", "0.75202364", "0.7515432", "0.7510752", "0.74923563", "0.74914986", "0.7436004", "0.7422005", "0.7414715", "0.740159", "0.7401001", "0.7389524", "0.7386096", "0.73802096", "0.7369963", "0.73576224", "0.73553115", "0.73546445", "0.7351207", "0.73471004", "0.73132145", "0.72955537", "0.729466", "0.7281663", "0.7274892", "0.7266823", "0.72642136", "0.7261639", "0.7248831", "0.7245224", "0.7230292", "0.72064054", "0.71997684", "0.71889627", "0.71800244", "0.71775395", "0.7176809", "0.71715367", "0.716096", "0.7148412", "0.71465755", "0.71442956", "0.71399426", "0.7126071", "0.7102354", "0.71016157", "0.70980036", "0.7090789", "0.70850897", "0.70671576", "0.7064127", "0.70577115", "0.7049912", "0.7040251", "0.70347375", "0.70311755", "0.70257497", "0.7017713", "0.7017241", "0.70152396", "0.7007415", "0.69998026", "0.6991073", "0.6989204", "0.69745594", "0.6956652", "0.695314", "0.69504905", "0.69450885", "0.69424736", "0.6927739", "0.6926989", "0.6911537", "0.6904112" ]
0.7420619
34
Method to load resource preference info from props and then run the Method to fetch books
loadFilter(token) { let url = hostUrl.url + "/instance-types?limit=30"; axios.get(url, { headers: { 'X-Okapi-Tenant': 'diku', 'X-Okapi-Token': token, }, }) .then((response) => { this.setState({ resources: response.data.instanceTypes, }) }) .catch((error) => { console.error(error); }) .then(() => { let resources = this.props.navigation.state.params.resources; for (i in resources) { for (j in this.state.resources) { if (resources[i].name == this.state.resources[j].name) { resources[i].id = this.state.resources[j].id; break; } } } this.setState({ resources: resources, }) }) .then(() => { this.findInstances(token); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadBooks() {\n const data = {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n // Authorization: 'Kinvey ' + localStorage.getItem('authToken'),\n };\n\n fetch(url, data)\n .then(handler)\n .then(displayBooks)\n .catch((err) => {\n console.warn(err);\n });\n }", "function loadBooks() {\n API.getBooks()\n .then(res =>\n setBooks(res.data)\n )\n .catch(err => console.log(err));\n }", "function loadBooks() {\n API.getBooks()\n .then((res) => setBooks(res.data))\n .catch((err) => console.log(err));\n }", "async function loadBooks() {\n const response = await api.get('books');\n setBooks(response.data);\n }", "function loadBooks() {\n API.getBooks()\n .then(res => \n setBooks(res.data)\n )\n .catch(err => console.log(err));\n }", "function loadBooks() {\n API.getBooks()\n .then(res => \n setBooks(res.data)\n )\n .catch(err => console.log(err));\n }", "function loadBooks() {\n API.getBooks()\n .then(res => \n setBooks(res.data)\n )\n .catch(err => console.log(err));\n }", "function loadBooks() {\n API.getBooks()\n .then(res =>\n setBooks(res.data)\n )\n .catch(err => console.log(err));\n }", "async getBooks() {\n if(this.props.currentUser) {\n var bookIdList = this.props.currentUser[\"library\"][\"to_read_list\"];\n if(bookIdList === null) {\n bookIdList = [];\n this.setState({isLoading: false});\n }\n\n var bookList = [];\n\n // Get details from Cache or API and add to list - skip if not available\n for (let i = 0; i < bookIdList.length; i++) {\n var book = await this.props.getBookDetails(bookIdList[i]);\n if(book === null) {\n continue;\n }\n\n if(this.state.searchString === \"\" || (this.state.searchString !== \"\" && ((book.Title.toLowerCase().indexOf(this.state.searchString.toLowerCase()) !== -1) || book.Authors.join(\"\").toLowerCase().indexOf(this.state.searchString.toLowerCase()) !== -1))) {\n bookList.push(book);\n }\n\n }\n await this.setState({toReadList: bookList, isLoading: false});\n\n // Add books to cache\n this.props.addBooksToCache(bookList);\n } else {\n this.setState({isLoading: false});\n }\n\n }", "function loadBooks() {\n API.getBooks()\n .then(res => {\n setBooks(res.data);\n // console.log(res);\n })\n .catch(err => console.log(err.response));\n }", "function fetchBook() {\n Books.get($stateParams.id)\n .then(function(book) {\n $scope.book = book;\n })\n .catch(function(error) {\n $scope.error = error;\n });\n }", "function loadAndDisplayBooks() {\n\n\tloadBooks().then(books => {\n\t\tdisplayBooks(books);\n\t});\n}", "function getBooks () {\n fetch(bookUrl)\n .then(resp => resp.json())\n .then(books => {\n renderBooks(books);\n window.allBooks = books\n }) //aspirational code to renderBooks(books)\n }", "function loadBooks() {\n API.getBooks()\n .then(res => {\n console.log(res.data)\n setBooks(res.data)\n })\n .catch(err => console.log(err));\n }", "function setRecommendedBooks(){\n $.ajax({\n url: '/books?isRecommended=true',\n type: 'GET',\n dataType: 'json',\n success: (data) => { if(data){ setBooksToPage(data, 'recommendedBooks') }}\n });\n}", "@action\n load(){\n this.book = this.service.getBook(this.id);\n this.totalPages = this.book.getTotalPages();\n this.pageNumber = 1;\n this.chapters = this.book.chapters;\n this.currentChapter = this.chapters[0];\n this.currentPage = this.currentChapter.getPageByNumber(1);\n this.isHardWordFocused = false; \n }", "componentDidMount(){\n BooksAPI.getAll()\n .then(books => this.placeOnShelf(books))\n }", "componentDidMount() {\n this.props.fetchBooks();\n}", "function loadBooks(res) {\n console.log(res.data)\n setBooks(res.data.data)\n }", "async componentDidMount() {\n \ttry{\n //gets all the book from the API\n const books = await getAll();\n //distributes the books to their corresponding shelf with the function from the ContextProvider\n this.props.addBooks(books);\n } catch(error){\n \tconsole.log(error);\n }\n }", "function load() {\r\n\t\tvisibility(\"none\", \"allbooks\");\r\n\t\tvisibility(\"\", \"singlebook\");\r\n\t\tbookTitle = this.className; // enables the user to go to page of the book that is clicked\r\n\t\tdocument.getElementById(\"cover\").src = \"books/\"+bookTitle+\"/cover.jpg\";\r\n\t\tdocument.getElementById(\"allbooks\").innerHTML = \"\"; \r\n\t\tsearchData(\"info&title=\" + bookTitle, oneBookInfo);\r\n\t\tsearchData(\"description&title=\" + bookTitle, oneBookDescription);\r\n\t\tsearchData(\"reviews&title=\" + bookTitle, oneBookReview);\t\r\n\t}", "componentDidMount() {\n this.loadBooks();\n }", "componentDidMount() {\n this.loadBooks();\n }", "componentDidMount() {\n this.loadBooks();\n }", "componentDidMount(){\n this.loadBooks()\n }", "componentDidMount() {\n this.loadBooks();\n }", "componentDidMount() {\n this.fetchBooksDetails()\n }", "componentDidMount() {\n\t\t//we fetch the books and put in the right shelf\n\t\tthis.fetchBooks();\n\t}", "loadResource() {\n // Load Selects\n this.loadStorageTierSelect(this.storage_tier)\n this.loadPublicAccessTypeSelect(this.public_access_type)\n this.loadAutoTieringSelect(this.auto_tiering)\n this.loadVersioningSelect(this.versioning)\n this.loadSelect(this.kms_key_id, 'key', true, () => true, 'Oracle-managed keys')\n // Assign Values\n this.storage_tier.property('value', this.resource.storage_tier)\n this.public_access_type.property('value', this.resource.public_access_type)\n this.auto_tiering.property('value', this.resource.auto_tiering)\n this.versioning.property('value', this.resource.versioning)\n this.object_events_enabled.property('checked', this.resource.object_events_enabled)\n this.kms_key_id.property('value', this.resource.kms_key_id)\n // Pricing Estimates\n this.estimated_monthly_capacity_gbs.property('value', this.resource.estimated_monthly_capacity_gbs)\n this.estimated_monthly_requests.property('value', this.resource.estimated_monthly_requests)\n }", "async function getAllBooks () {\n console.log('book')\n const books = await fetchData(endpoint, config);\n // console.log(books)\n render.allBooks(books);\n}", "componentDidMount() {\n this.fetchBooks()\n }", "function getBook(obj) {\n fetch(bookUrl + obj.id)\n .then(response => response.json());\n }", "display(bookshelf){\n this.bookshelf = bookshelf;\n\n switch(this.bookshelf){\n case 'store':\n this.books = this.searchResults;\n break;\n case 'bookmarks':\n this.books = this.bookmarks;\n break;\n case 'favorites':\n this.books = this.favorites;\n break;\n }\n }", "componentDidMount(){\n\n this.fetchBooks()\n\n }", "componentDidMount() {\n this.fetchBooks();\n }", "function getAllBooks(){\n fetch(baseURL)\n .then(res => res.json())\n .then(books => listBooks(books))\n }", "static preloadData(dispatch) {\n return Promise.all([\n complexActionCreators.loadNotebooksWithTags()(dispatch),\n ]);\n }", "componentDidMount() {\n this.getbooks();\n // this.getGoogleBooks();\n }", "function loadBooks() {\n books = JSON.parse(localStorage.getItem(\"totalBooks\"));\n if (!books) {\n //alert('No books are present for now! Please add some')\n } else {\n books.forEach((book) => {\n renderBook(book);\n });\n }\n\n finishedBooks = JSON.parse(localStorage.getItem(\"finishedBooks\"));\n if (!finishedBooks) {\n //alert('No books are present for now! Please add some')\n } else {\n finishedBooks.forEach((book) => {\n renderFinishedBooks(book);\n });\n }\n}", "async function getBooks(){\n if(!books){\n let result = await MyBooklistApi.bookSearch(\"fiction\", getCurrentDate(), user.username);\n setBooks(result);\n }\n }", "function getBooks() {\n $.ajax({\n url: 'http://127.0.0.1:8000/book/',\n method: 'GET'\n }).done(function (response) {\n setBooks(response);\n });\n }", "componentDidMount () {\n const { user, setParks, parks, image, currentPark, setFavorites } = this.props\n\n // calls api exploreParks/:id endpoint.\n // If user is signed in, they get back their favoriteParks in addition to the default parks list.\n getAllParks(user)\n .then(res => res.json())\n .then(res => {\n setParks(\n { parks: res.parks,\n image: res.parks[0].images[0].url,\n currentPark: res.parks[0]}\n )\n return res\n })\n .then(res => {\n setFavorites({favoriteParksData: res.favoriteParksData})\n return res\n })\n .catch(console.error)\n }", "componentDidMount() {\n\t\tthis.props.fetchInfo('offences', 'offencesList');\n\t\tthis.props.fetchInfo('areas', 'lga');\n\t\tthis.props.fetchInfo('ages', 'age');\n\t\tthis.props.fetchInfo('genders', 'gender');\n\t\tthis.props.fetchInfo('years', 'year');\n\t}", "function loadSingleBook() {\r\n\t\tdocument.getElementById(\"cover\").src = \"books/\" + this.id + \"/cover.jpg\";\r\n\t\tdocument.getElementById(\"singlebook\").style.display = \"block\";\r\n\t\tdocument.getElementById(\"allbooks\").innerHTML = \"\"; // clear up \"allbooks\" div\r\n\t\trequest(loadInfo, \"info\", this.id);\r\n\t\trequest(loadDescription, \"description\", this.id);\r\n\t\trequest(loadReviews, \"reviews\", this.id);\r\n\t}", "fetch () {\n this._makeRequest('GET', resources);\n }", "function loadAllBooksHelper() {\r\n\t\trequest(loadAllBooks, \"books\", \"\");\r\n\t}", "loadBooksFromServer () {\n\t\t fetch('http://localhost:8080/books')\n .then(result => result.json())\n .then(result => this.setState({ books: result })\n )\n\t\t }", "componentDidMount() {\n this.props.getAllBooks();\n }", "bindResources(props) {\n const page = props.params.page ? Number.parseInt(props.params.page) : 1\n this.setState({ page });\n const query = {\n filter: {\n limit: this.state.perPage,\n skip: this.state.perPage * (page - 1),\n include: ['roles']\n }\n }\n // # retrieve all the posts from the Post Store\n this.retrieveAll(this.store, { query });\n }", "static getBooks() {\n let books;\n if(localStorage.getItem('books') === null) {\n books = [];\n } else {\n books = JSON.parse(localStorage.getItem('books'));\n }\n }", "componentDidMount() {\n this.get_all_books()\n }", "constructor(){\n this.service = new BookService();\n this.load() \n }", "componentDidMount() {\n axios\n .get(\n `https://www.googleapis.com/books/v1/volumes?q=subject:fiction&filter=paid-ebooks&langRestrict=en&maxResults=20&&orderBy=newest&key=${process.env.REACT_APP_GOOGLE_BOOK_TOKEN}`\n )\n .then((response) => {\n console.log(\"axios Api\", response.data);\n this.setState({\n booksFromApi: response.data.items,\n });\n })\n .catch((error) => {\n console.log(error);\n });\n\n // service\n\n // .get(\"/bookFromData\")\n // .then((result) => {\n // console.log(\"fetch ggl id and populate \", result.data);\n // this.setState({\n // saveList: result.data,\n // });\n // })\n // .catch((error) => console.log(error));\n }", "componentWillMount(){\n //getBooks(limit, start, order) from actions url parameters \n //DISPATCH accepts an ACTION and dispatches the data to the store which gives it full access to the app \n // which makes data available from getBooks function to use and display on the UI \n this.props.dispatch(getBooks(1, 0, 'desc'))\n }", "function getBooks() {\n fetch(\"http://localhost:3000/books\")\n .then(res => res.json())\n .then(books => showBooks(books))\n .catch(err => console.log(err))\n}", "componentDidMount() {\n API.getBook(this.props.match.params.id)\n .then(res => this.setState({\n title: res.data.title,\n author: res.data.author,\n synopsis: res.data.synopsis\n }))\n .catch(err => console.log(err));\n }", "loadResource() {\n // Load Selects\n const pool_filter = (ip) => !this.resource.getOkitJson().getAutoscalingConfigurations().map(a => a.resource.id).includes(ip.id)\n this.loadSelect(this.instance_pool_id, 'instance_pool', true, pool_filter)\n // Assign Values\n this.instance_pool_id.property('value', this.resource.auto_scaling_resources.id)\n this.cool_down_in_seconds.property('value', this.resource.cool_down_in_seconds)\n this.policy_type.property('value', this.resource.policy_type)\n this.showHidePolicyTypeRows(this.resource.policy_type)\n if (this.resource.policy_type === 'threshold') this.loadThresholdResources()\n else this.loadScheduledResources()\n }", "resolve(parent, args) {\n /*\n NOTE: In this function it's possible to access a database or another external data source\n */\n\n return Book.findById(args.id) // return specific book\n }", "componentDidMount() {\n const { getFavouriteArticle, getMyArticle } = this.props;\n //call api for favourite Articles & my articles\n getFavouriteArticle({ favorited: this.props.match.params.author, limit: 20, offset: 0 });\n getMyArticle({ author: this.props.match.params.author, limit: 20, offset: 0 });\n }", "function getBooks() {\n clubID = this.value;\n // console.log('clubID', clubID);\n fetch('/get_books_in_genre?clubID=' + clubID)\n .then(function (response) {\n return response.json();\n }).then(function (json) {\n // console.log('GET response', json);\n if (json.length > 0) {\n set_book_select(json);\n };\n });\n}", "function loadData() {\n var strBookPath = io.appendPath(conf.bookPath, this.strBookName);\n var strBookStructurePath = io.appendPath(strBookPath, conf.bookStructureFileName);\n io.getXmlContent(strBookStructurePath, setBookStructureXml);\n io.getFilesInDirectory(strBookPath, setPageFileNames);\n}", "componentDidMount () {\n const { getRejectedProposals } = this.props;\n getRejectedProposals();\n this.init();\n }", "componentDidMount() {\n this.getCurrentBooks();\n }", "loadBooksByRating(filterObj) {\n\t\tapi.getBooks({rating: filterObj.map(rating => rating.description).join(\",\")}, result => {\n\n\t\t});\n\t}", "componentDidMount() {\n BooksAPI.getAll().then((books) => {\n //set the state of the books on the main page\n this.setState({books})\n })\n }", "loadProgram() {\n const getBooks = JSON.parse(localStorage.getItem(STORAGE_NAME));\n const getId = JSON.parse(localStorage.getItem(STORAGE_ID));\n if (getBooks && getBooks.length != 0) {\n const storedBooks = getBooks;\n const storedId = getId;\n myLibrary = [...storedBooks];\n bookId = parseInt(storedId);\n console.log('loaded');\n } else {\n myLibrary = [...FILLER_DATA];\n bookId = 2;\n console.log('default');\n }\n storage.saveData();\n this.renderElem.render();\n }", "static displayBooks(){\n // Taking books from the local Storage\n const books = Store.getBooks();\n\n // Looping through the books and adding it to bookList\n books.forEach((book) => UI.addBookToList(book));\n }", "function loadBooks() {\n\n\t// We return the promise that axios gives us\n\treturn axios.get(apiBooksUrl)\n\t\t.then(response => response.data) // turns to a promise of books\n\t\t.catch(error => {\n\t\t\tconsole.log(\"AJAX request finished with an error :(\");\n\t\t\tconsole.error(error);\n\t\t});\n}", "loadResource() {\n // Load Selects\n this.loadSelect(this.vcn_id, 'virtual_cloud_network', false)\n this.loadSelect(this.drg_id, 'dynamic_routing_gateways', true)\n // Assign Values\n this.vcn_id.property('value', this.resource.vcn_id)\n this.drg_id.property('value', this.resource.drg_id)\n }", "componentDidMount() {\n this.getBooks();\n }", "load_book() {\n $.get(\"assets/story.json\")\n .then((json) => {\n this.book = json\n this.max_chapters = this.book.length -1\n })\n .then(this.load_chapter)\n }", "populateCitations() {\n\n let that = this;\n\n if (this.props.selectedId !== undefined) {\n fetch('/api/papers/by_ref_id/' + this.props.selectedId)\n .then(function (response) {\n if (response.ok || (response.status !== 404 && response.status !== 500)) {\n return response.json();\n } else {\n that.handleQueueAlert('Could not get Citations', 'error');\n\n }\n })\n .then(function (myJson) {\n that.setState({\n paper_ids: myJson\n });\n try {\n fetch('/api/papers/' + myJson[0][\"_id\"])\n .then(function (response) {\n if (response.ok || (response.status !== 404 && response.status !== 500)) {\n return response.json();\n } else {\n that.handleQueueAlert('Could not get Paper', 'error');\n }\n })\n .then(function (myJson) {\n that.setState({\n current_pdf_data: myJson[\"pdf\"][\"data\"],\n raw_pdf_data: myJson['body'],\n curPaperId: myJson[\"_id\"]\n });\n that.get_citation_info(myJson[\"_id\"])\n .then((citations) => {\n if (citations[0]) {\n that.setCurrentCitation(citations[0][\"_id\"]);\n }\n });\n });\n } catch (e) {\n that.props.history.push({\n pathname: \"/\",\n props: { ...that.state }\n });\n }\n });\n } else {\n this.setState({ assignmentId: \"no assignment selected\" });\n }\n fetch('/api/rubrics/' + this.props.user.id)\n .then(function (response) {\n if (response.ok || response.status !== 500) {\n return response.json();\n } else {\n that.handleQueueAlert('Could not get Citations', 'error');\n }\n })\n .then(function (myJson) {\n that.setState({ AvailableRubrics: myJson });\n });\n }", "function getBooks(bibleParam, callback) {\n var dfd = $.Deferred();\n bible = bibleParam;\n // if default books found use it\n var booksPath = bible.defaultIndex ? (baseUrl + '/defaults/books/' + bible.defaultIndex + '.bz2') : (baseUrl + bible.dbpath + '/' + 'books.bz2');\n $.when(getBzData(booksPath)).then(d => {\n dfd.resolve(books = d);\n });\n return dfd.promise();\n }", "componentDidMount() {\n this.getBooks();\n }", "loadResource() {\n // Load Reference Selects\n this.loadSelect(this.vcn_id, 'virtual_cloud_network', false)\n this.loadSelect(this.drg_id, 'drg', true)\n this.loadSelect(this.route_table_id, 'route_table', true, this.vcn_filter)\n this.loadDrgRouteRulesSelect()\n // Assign Values\n this.vcn_id.property('value', this.resource.vcn_id)\n this.drg_id.property('value', this.resource.drg_id)\n this.route_table_id.property('value', this.resource.route_table_id)\n this.drg_route_table_id.property('value', this.resource.drg_route_table_id)\n }", "componentWillReceiveProps(){\n let competence = new Competence();\n let type = this.props.type == 'competences' ? 'reloadCompetences' : 'reloadGoals';\n setTimeout(() => {\n competence.getItem(type, false).then((value) => {\n if(value) {\n this.loadData(false, true);\n competence.setItem(type, false);\n }\n })\n }, 10)\n //console.log('CompetenceList componentWillReceiveProps');\n }", "function fetchBook(slug) {\n var $def = $.Deferred(),\n m = slug.match(/p=(\\d+)/),\n id = m && +m[1];\n if (book && (id && book.ID == id || book.slug == encodeURI(slug).toLowerCase())) {\n $def.resolve(book);\n } else if (state.offline()) {\n localizeBook(slug, id).then(function(data) {\n book = data;\n $def.resolve(data);\n }, function(err) {\n $def.reject(err);\n });\n } else {\n var data = !id ? { slug: slug } : { id: id };\n $.ajax({\n url: '/book-as-json/',\n data: data,\n dataType: 'json'\n }).done(function(data) {\n book = data;\n $def.resolve(data);\n });\n }\n return $def;\n }", "static getBook() {\n let books;\n if (localStorage.getItem('books') === null) {\n books = [];\n } else {\n books = JSON.parse(localStorage.getItem('books'));\n }\n\n return books;\n }", "componentDidMount() {\n this.getBooks()\n }", "loadResource() {\n // Load Reference Selects\n this.loadSelect(this.vcn_id, 'virtual_cloud_network', false)\n this.loadSelect(this.route_table_id, 'route_table', true)\n // Assign Values\n this.vcn_id.property('value', this.resource.vcn_id)\n this.route_table_id.property('value', this.resource.route_table_id)\n }", "componentDidMount() {\n const id = this.props.match.params.id;\n API.getBook(id).then(res => {\n this.setState({\n book: res.data\n });\n });\n }", "componentDidMount(){\n BooksAPI.getAll()\n .then((books)=>{\n this.setState({books});\n })\n // .then(()=> {console.log (\"apps page books: \", this.state.books)\n // })\n }", "async componentWillReceiveProps(nextProps) {\n this.setState({\n isLoading: true,\n });\n this.props = nextProps;\n this.setState({\n seal: await fetchResource(this.props.match.params.id, 'seal'),\n isLoading: false,\n });\n }", "function loadRecommendedItems() {\n\t\tactiveBtn('recommend-btn');\n\n\t\t// request parameters\n\t\tvar url = './recommendation' + '?' + 'user_id=' + user_id + '&lat=' + lat\n\t\t\t\t+ '&lon=' + lng;\n\t\tvar data = null;\n\n\t\t// display loading message\n\t\tshowLoadingMessage('Loading recommended items...');\n\n\t\t// make AJAX call\n\t\tajax(\n\t\t\t\t'GET',\n\t\t\t\turl,\n\t\t\t\tdata,\n\t\t\t\t// successful callback\n\t\t\t\tfunction(res) {\n\t\t\t\t\tvar items = JSON.parse(res);\n\t\t\t\t\tconsole.log(items);\n\t\t\t\t\tif (!items || items.length === 0) {\n\t\t\t\t\t\tshowWarningMessage(' No recommended item. Make sure you have favorites.');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlistItems(items);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// failed callback\n\t\t\t\tfunction() {\n\t\t\t\t\tshowErrorMessage('Cannot load recommended items.');\n\t\t\t\t});\n\t}", "constructor( props ){\n super( props );\n this.state = {\n bookTitle: \"\",\n author:\"\",\n volId: \"\", \n result: \"\",\n snippet : \"\",\n apiURL: 'https://www.googleapis.com/books/v1/volumes?q='\n }\n }", "componentDidMount(){\n this.getBooks(); \n }", "getAllShelves() {\n \t\tthis.props.model.getShelves((shelves) => {\n\t\t\tif (shelves === 'error'){\n\t\t\t\tthis.setState({\n\t\t\t\t\tstatus: 'ERROR'\n\t\t\t\t})\n\t\t\t}\n\t\t\telse{\n\t\t\t\t// Shelf is the actual book object which we get with the book id\n\t\t\t\tvar shelf = this.props.model.getShelfByID(shelves, parseInt(this.state.id, 10));\n\t\t\t\tthis.setState({\n\t\t\t\t\tshelf: shelf,\n\t\t\t\t\tstatus: 'LOADED'\n\t\t\t\t})\n\t\t\t}\n \t\t})\n\t}", "function initBookshelf() {\n addBooksFromStorage();\n const bookshelf = document.querySelector(\".bookshelf\");\n library.forEach(element => {\n addBookToDOM(element);\n });\n}", "function Book(props) {\n\n const {imageLinks, authors, title, shelves, shelf,onShelfChanged} = props;\n\n return (\n <div className=\"book\">\n <div className=\"book-top\">\n <div className=\"book-cover\" style={{ width: 128, height: 193, backgroundImage: `url(\"${imageLinks.smallThumbnail}\")` }}></div>\n <BookShelfChanger book={props} onShelfChanged={onShelfChanged} shelves={shelves} shelf={shelf} />\n </div>\n <div className=\"book-title\">{title}</div>\n {authors.map((author,index)=>(\n <div key={`author_${index}`} className=\"book-authors\">{author}</div>\n ))}\n </div>\n )\n}", "async getRenderItems(token) {\n let books = [];\n var isbnid;\n var coverUrl;\n for (i = 0; i < this.state.idTypes.length; i++) {\n if (this.state.idTypes[i].name == \"ISBN\") {\n isbnid = this.state.idTypes[i].id;\n break;\n }\n }\n var i;\n var id;\n for (i in this.state.books) {\n let book = this.state.books[i];\n for (j = 0; j < book.identifiers.length; j++) {\n id = book.identifiers[j].identifierTypeId;\n let value = book.identifiers[j].value.split(\" \");\n value = value[0];\n if (id == isbnid) {\n coverUrl = await this.getCover('&isbn=' + value, book.title);\n console.log(coverUrl);\n if (coverUrl != \"\") {\n console.log(book.title);\n books.push(book);\n books[books.length - 1].cover = coverUrl;\n break;\n }\n }\n else { // If a book don't have ISBN, get cover by title only\n console.log(book.title);\n books.push(book);\n coverUrl = await this.getCover('', book.title);\n console.log(coverUrl);\n books[books.length - 1].cover = coverUrl;\n break;\n }\n }\n }\n // data load complete\n this.setState({\n books: books,\n isLoadingComplete: true,\n })\n }", "fetchBooks(){\n getAll().then((data) => {\n this.setState({books: data})\n })\n }", "async function getBook (id) {\n const book = await findBook(id);\n render.book(book);\n}", "getIdeas() { this.props.fetchIdeas() }", "componentWillMount() {\n let id = this.props.match.params.id;\n Promise.all([this.props.bookService.show(id), this.props.authorService.index()])\n .then(res => {\n /**\n * Fill book data\n */\n let book = this.state.book;\n book.fillFromResponse(res[0]);\n /**\n * Convert the array of authors\n * to a HashMap of authors\n * this will allow to hide the\n * ones that the book already have\n */\n let dictOfAuthors = {};\n res[1].map((a) =>\n dictOfAuthors[a.id] = a\n );\n /**\n * Iterate the book authors\n * and hide them from the HashMap\n * of authors\n */\n book.authors.map((a) =>\n dictOfAuthors[a.id].visible = false\n );\n this.setState({\n book: book,\n authors: dictOfAuthors\n });\n })\n .catch(err => {\n toast.error('¡Solicitud Fallida!, Inténtalo de nuevo');\n });\n }", "function loadProps() {\n var item = Office.context.mailbox.item;\n if (item.itemType == Office.MailboxEnums.ItemType.Message) {\n loadBodyProps(item);\n loadDetectionDetails(item);\n loadRuleHitDetails(item);\n }\n else {\n loadAppointmentProps(item);\n app.showNotification('Warning', 'This iteration is not supposed to run for appointments.');\n }\n $('#body')\n }", "componentDidMount() {\n this.getAllBooks();\n }", "componentDidMount() {\n const { courses, authors, actions, loadCourses, loadAuthors } = this.props;\n\n // if we're not using Redux we would just write:\n // getCourses().then((courses) => this.setState({ courses: courses }));\n // but since we're using Redux, we need to invoke an action that has been binded to props via mapDispatchToProps, down below:\n\n // Warning: In order to avoid making a new http call each time the ManageCoursePage mounts we should see if we really need it, like this:\n\n // without using object destructuring as declared right above\n\n if (courses.length === 0) {\n console.log(\"component did mount\");\n loadCourses()\n .then((x) => console.log(\"Everything went ok \" + x))\n .catch((error) => {\n alert(\"Loading courses failed\" + error);\n });\n }\n\n if (authors.length === 0) {\n loadAuthors()\n .then((y) => console.log(\"Everything went ok \" + y))\n .catch((error) => {\n alert(\"Loading authors failed\" + error);\n });\n }\n }", "componentDidMount() {\n\t\tBooksAPI.getAll().then((books) => {\n\t\t\tthis.setState(state => state.books = { books })\n\t\t})\n\t}", "componentWillMount() {\n const { filters, fetchAfterMount } = this.props;\n\n const firstPri = this.getFilter(filters.PRIMARY);\n this.setState({ primary: firstPri });\n\n const firstSec = this.getFilter(filters.SECONDARY);\n if (firstSec) {\n this.setState({ secondary: firstSec });\n }\n if (fetchAfterMount) {\n this.fetch(firstPri, firstSec);\n }\n }", "componentDidMount() {\n // can write some fetch infos code\n let that = this;\n books.find({ }).sort({ 'updatedAt': -1 }).exec((err, bks) => {\n if(bks.length == 0)\n that.props.listBooks(bks);\n let tmpC = 0;\n bks.forEach((bk, index) => {\n files.count({bookId: bk._id, available: true}, (error, count) => {\n if(error){\n throw new Error('db error');\n return;\n }\n bk.filesCount = count;\n tmpC += 1;\n if(tmpC == bks.length)\n that.props.listBooks(bks);\n })\n let availableBooks = bks.filter((book) => {\n return book.available;\n });\n if(!that.props.globalBook._id && availableBooks.length > 0){\n that.props.setGlobalBook(\n {\n _id: availableBooks[0]._id,\n name: availableBooks[0].name\n }\n );\n }\n });\n });\n ipcRenderer.send('onNotebookContainer');\n this._checkNewNoteBookParam();\n }", "static fetchBooksFromGoogle(searchInput){ //searchInput from Content.js\n return fetch(`https://www.googleapis.com/books/v1/volumes?q=${searchInput}`)\n .then(response => response.json())\n .then(json => {\n return json.items.map(item => this.createBook(item)) //returns an array of objects created from the createBook fn.\n })\n }" ]
[ "0.62201107", "0.6143052", "0.6138654", "0.6130056", "0.60673875", "0.60673875", "0.6054763", "0.6031109", "0.5958807", "0.59501916", "0.5934147", "0.5915574", "0.58968735", "0.5858546", "0.58303344", "0.5803628", "0.5620129", "0.562", "0.561793", "0.5598792", "0.5580903", "0.5580773", "0.5580773", "0.5580773", "0.55766916", "0.5527658", "0.5524469", "0.55182856", "0.5489831", "0.54802203", "0.54547006", "0.54531765", "0.54318374", "0.54264635", "0.5423546", "0.541193", "0.54055417", "0.53995", "0.53787637", "0.53604203", "0.5330761", "0.5329585", "0.5326083", "0.52968186", "0.52951133", "0.5275272", "0.5267129", "0.52638775", "0.5257896", "0.5256182", "0.52482665", "0.52381194", "0.52371097", "0.52370375", "0.5232812", "0.5224734", "0.5216844", "0.52132934", "0.5213072", "0.5196777", "0.51915807", "0.51874983", "0.5181697", "0.5180509", "0.51779044", "0.5177131", "0.5174223", "0.51683336", "0.51570547", "0.5152777", "0.51465344", "0.51422024", "0.5140385", "0.51399326", "0.513271", "0.5127535", "0.5123326", "0.5119556", "0.5111188", "0.5109378", "0.5107122", "0.5098639", "0.5092588", "0.50901276", "0.5088298", "0.50831133", "0.5082104", "0.5077147", "0.50740385", "0.5073465", "0.5072301", "0.5071687", "0.5067545", "0.50672704", "0.5066943", "0.50623846", "0.50564396", "0.505326", "0.50506073", "0.5044676", "0.5040298" ]
0.0
-1